Skip to content

Commit de68b1a

Browse files
committed
home ui
1 parent 4d57fed commit de68b1a

File tree

3 files changed

+98
-63
lines changed

3 files changed

+98
-63
lines changed

lib/main.dart

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

lib/screen/home.dart

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter/rendering.dart';
3+
import 'package:flutter_to_do_list/const/colors.dart';
4+
import 'package:flutter_to_do_list/widgets/task_widgets.dart';
25

36
class Home_Screen extends StatefulWidget {
47
const Home_Screen({super.key});
@@ -7,9 +10,43 @@ class Home_Screen extends StatefulWidget {
710
State<Home_Screen> createState() => _Home_ScreenState();
811
}
912

13+
bool show = true;
14+
1015
class _Home_ScreenState extends State<Home_Screen> {
1116
@override
1217
Widget build(BuildContext context) {
13-
return Scaffold();
18+
return Scaffold(
19+
backgroundColor: backgroundColors,
20+
floatingActionButton: Visibility(
21+
visible: show,
22+
child: FloatingActionButton(
23+
onPressed: () {},
24+
backgroundColor: custom_green,
25+
child: Icon(Icons.add, size: 30),
26+
),
27+
),
28+
body: SafeArea(
29+
child: NotificationListener<UserScrollNotification>(
30+
onNotification: (notification) {
31+
if (notification.direction == ScrollDirection.forward) {
32+
setState(() {
33+
show = true;
34+
});
35+
}
36+
if (notification.direction == ScrollDirection.reverse) {
37+
setState(() {
38+
show = false;
39+
});
40+
}
41+
return true;
42+
},
43+
child: ListView.builder(
44+
itemBuilder: (context, index) {
45+
return Task_Widget();
46+
},
47+
itemCount: 10,
48+
),
49+
)),
50+
);
1451
}
1552
}

lib/widgets/task_widgets.dart

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,75 +13,74 @@ bool isDone = false;
1313
class _Task_WidgetState extends State<Task_Widget> {
1414
@override
1515
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-
],
16+
return get();
17+
}
18+
19+
Widget get() {
20+
return Padding(
21+
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
22+
child: Container(
23+
width: double.infinity,
24+
height: 130,
25+
decoration: BoxDecoration(
26+
borderRadius: BorderRadius.circular(10),
27+
color: Colors.white,
28+
boxShadow: [
29+
BoxShadow(
30+
color: Colors.grey.withOpacity(0.2),
31+
spreadRadius: 5,
32+
blurRadius: 7,
33+
offset: Offset(0, 2),
3534
),
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,
35+
],
36+
),
37+
child: Padding(
38+
padding: const EdgeInsets.symmetric(horizontal: 10),
39+
child: Row(
40+
children: [
41+
// image
42+
imageee(),
43+
SizedBox(width: 25),
44+
// title and subtitle
45+
Expanded(
46+
child: Column(
47+
crossAxisAlignment: CrossAxisAlignment.start,
48+
children: [
49+
SizedBox(height: 5),
50+
Row(
51+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
4752
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-
),
7053
Text(
71-
'subtitle',
54+
'title',
7255
style: TextStyle(
73-
fontSize: 16,
74-
fontWeight: FontWeight.w400,
75-
color: Colors.grey.shade400),
56+
fontSize: 18,
57+
fontWeight: FontWeight.bold,
58+
),
7659
),
77-
Spacer(),
78-
edit_time()
60+
Checkbox(
61+
activeColor: custom_green,
62+
value: isDone,
63+
onChanged: (value) {
64+
setState(() {
65+
isDone = !isDone;
66+
});
67+
},
68+
)
7969
],
8070
),
81-
),
82-
],
71+
Text(
72+
'subtitle',
73+
style: TextStyle(
74+
fontSize: 16,
75+
fontWeight: FontWeight.w400,
76+
color: Colors.grey.shade400),
77+
),
78+
Spacer(),
79+
edit_time()
80+
],
81+
),
8382
),
84-
),
83+
],
8584
),
8685
),
8786
),

0 commit comments

Comments
 (0)