Skip to content

Commit 01da684

Browse files
committed
create task widget
1 parent bb537f6 commit 01da684

File tree

4 files changed

+182
-1
lines changed

4 files changed

+182
-1
lines changed

lib/main.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'package:firebase_core/firebase_core.dart';
22
import 'package:flutter/material.dart';
33
import 'package:flutter_to_do_list/auth/main_page.dart';
4+
import 'package:flutter_to_do_list/screen/home.dart';
5+
import 'package:flutter_to_do_list/widgets/task_widgets.dart';
46

57
void main() async {
68
WidgetsFlutterBinding.ensureInitialized();
@@ -15,7 +17,7 @@ class MyApp extends StatelessWidget {
1517
Widget build(BuildContext context) {
1618
return MaterialApp(
1719
debugShowCheckedModeBanner: false,
18-
home: Main_Page(),
20+
home: Home_Screen(),
1921
);
2022
}
2123
}

lib/widgets/task_widgets.dart

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_to_do_list/const/colors.dart';
3+
4+
class Task_Widget extends StatefulWidget {
5+
const Task_Widget({super.key});
6+
7+
@override
8+
State<Task_Widget> createState() => _Task_WidgetState();
9+
}
10+
11+
bool isDone = false;
12+
13+
class _Task_WidgetState extends State<Task_Widget> {
14+
@override
15+
Widget build(BuildContext context) {
16+
return Scaffold(
17+
backgroundColor: backgroundColors,
18+
body: SafeArea(
19+
child: Padding(
20+
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
21+
child: Container(
22+
width: double.infinity,
23+
height: 130,
24+
decoration: BoxDecoration(
25+
borderRadius: BorderRadius.circular(10),
26+
color: Colors.white,
27+
boxShadow: [
28+
BoxShadow(
29+
color: Colors.grey.withOpacity(0.2),
30+
spreadRadius: 5,
31+
blurRadius: 7,
32+
offset: Offset(0, 2),
33+
),
34+
],
35+
),
36+
child: Padding(
37+
padding: const EdgeInsets.symmetric(horizontal: 10),
38+
child: Row(
39+
children: [
40+
// image
41+
imageee(),
42+
SizedBox(width: 25),
43+
// title and subtitle
44+
Expanded(
45+
child: Column(
46+
crossAxisAlignment: CrossAxisAlignment.start,
47+
children: [
48+
SizedBox(height: 5),
49+
Row(
50+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
51+
children: [
52+
Text(
53+
'title',
54+
style: TextStyle(
55+
fontSize: 18,
56+
fontWeight: FontWeight.bold,
57+
),
58+
),
59+
Checkbox(
60+
activeColor: custom_green,
61+
value: isDone,
62+
onChanged: (value) {
63+
setState(() {
64+
isDone = !isDone;
65+
});
66+
},
67+
)
68+
],
69+
),
70+
Text(
71+
'subtitle',
72+
style: TextStyle(
73+
fontSize: 16,
74+
fontWeight: FontWeight.w400,
75+
color: Colors.grey.shade400),
76+
),
77+
Spacer(),
78+
edit_time()
79+
],
80+
),
81+
),
82+
],
83+
),
84+
),
85+
),
86+
),
87+
),
88+
);
89+
}
90+
91+
Widget edit_time() {
92+
return Padding(
93+
padding: const EdgeInsets.symmetric(vertical: 10),
94+
child: Row(
95+
children: [
96+
Container(
97+
width: 90,
98+
height: 28,
99+
decoration: BoxDecoration(
100+
color: custom_green,
101+
borderRadius: BorderRadius.circular(18),
102+
),
103+
child: Padding(
104+
padding: const EdgeInsets.symmetric(
105+
horizontal: 12,
106+
vertical: 6,
107+
),
108+
child: Row(
109+
children: [
110+
Image.asset('images/icon_time.png'),
111+
SizedBox(width: 10),
112+
Text(
113+
'time',
114+
style: TextStyle(
115+
color: Colors.white,
116+
fontSize: 14,
117+
fontWeight: FontWeight.bold,
118+
),
119+
),
120+
],
121+
),
122+
),
123+
),
124+
SizedBox(width: 20),
125+
Container(
126+
width: 90,
127+
height: 28,
128+
decoration: BoxDecoration(
129+
color: Color(0xffE2F6F1),
130+
borderRadius: BorderRadius.circular(18),
131+
),
132+
child: Padding(
133+
padding: const EdgeInsets.symmetric(
134+
horizontal: 12,
135+
vertical: 6,
136+
),
137+
child: Row(
138+
children: [
139+
Image.asset('images/icon_edit.png'),
140+
SizedBox(width: 10),
141+
Text(
142+
'edit',
143+
style: TextStyle(
144+
fontSize: 14,
145+
fontWeight: FontWeight.bold,
146+
),
147+
),
148+
],
149+
),
150+
),
151+
),
152+
],
153+
),
154+
);
155+
}
156+
157+
Widget imageee() {
158+
return Container(
159+
height: 130,
160+
width: 100,
161+
decoration: BoxDecoration(
162+
color: Colors.white,
163+
image: DecorationImage(
164+
image: AssetImage('images/1.png'),
165+
fit: BoxFit.cover,
166+
),
167+
),
168+
);
169+
}
170+
}

pubspec.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ packages:
192192
url: "https://pub.dev"
193193
source: hosted
194194
version: "1.9.1"
195+
msh_checkbox:
196+
dependency: "direct main"
197+
description:
198+
name: msh_checkbox
199+
sha256: "5c7933ce503f1fa037ae7df209351f949bf253e3e6855308779afd5dfea341e5"
200+
url: "https://pub.dev"
201+
source: hosted
202+
version: "1.2.1"
195203
path:
196204
dependency: transitive
197205
description:

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dependencies:
3232
sdk: flutter
3333
firebase_auth: ^4.3.0
3434
cloud_firestore: ^4.5.0
35+
msh_checkbox: ^1.1.1
3536

3637

3738
# The following adds the Cupertino Icons font to your application.

0 commit comments

Comments
 (0)