-
Notifications
You must be signed in to change notification settings - Fork 1
/
ToDoList.dart
156 lines (150 loc) · 4.38 KB
/
ToDoList.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false, //Removing Debug Banner
home: Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
backgroundColor: Colors.green,
title: const Text("To Do List"),
titleSpacing: 0.0,
centerTitle: true,
toolbarHeight: 70,
toolbarOpacity: 0.8,
actions: <Widget>[
IconButton(
icon: const Icon(Icons.search),
tooltip: "Search",
onPressed: () {},
),
],
),
body: Center(
child: AppBody(),
),
drawer: Drawer(
child: ListView(
padding: const EdgeInsets.all(0),
children: [
const DrawerHeader(
decoration: BoxDecoration(
color: Colors.green,
),
child: UserAccountsDrawerHeader(
decoration: BoxDecoration(
color: Colors.green,
),
accountName: Text(
"Account Name",
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
accountEmail: Text("jo@jojo.com"),
currentAccountPictureSize: Size.square(50),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.greenAccent,
child: Text(
"A",
style: TextStyle(
fontSize: 40,
color: Colors.blue,
),
),
),
),
),
ListTile(
leading: const Icon(Icons.person),
title: const Text(' My Profile '),
onTap: () {
Navigator.pop(context);
},
),
ListTile(
leading: const Icon(Icons.settings),
title: const Text("Settings"),
onTap: () {
Navigator.pop(context);
},
),
ListTile(
leading: const Icon(Icons.logout),
title: const Text("Log Out"),
onTap: () {
Navigator.pop(context);
},
),
],
),
),
),
);
}
}
class AppBody extends StatefulWidget {
// const AppBody({super.key});
@override
State<AppBody> createState() => _AppBodyState();
}
class _AppBodyState extends State<AppBody> {
bool isChecked = false;
Color getColor(Set<MaterialState> states) {
const Set<MaterialState> interactiveStates = <MaterialState>{
MaterialState.pressed,
MaterialState.hovered,
MaterialState.focused,
};
if (states.any(interactiveStates.contains)) {
return Colors.blue;
}
return Colors.red;
}
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(20),
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.white70,
border: Border.all(color: Colors.teal, width: 2),
borderRadius: BorderRadius.circular(10),
boxShadow: const [
BoxShadow(
color: Colors.tealAccent,
spreadRadius: 5.0,
blurRadius: 7.0,
offset: Offset(1, 3),
),
],
),
child: Row(
children: <Widget>[
Container(
margin: const EdgeInsets.all(5),
child: Checkbox(
checkColor: Colors.white,
fillColor: MaterialStateProperty.resolveWith(getColor),
value: isChecked,
onChanged: (bool? value) {
setState(() {
isChecked = value!;
});
}),
),
const Text("Learn Dart"),
IconButton(
icon: const Icon(Icons.delete),
tooltip: "Delete",
onPressed: () {},
),
],
),
);
}
}