|
1 | | -import 'package:cloud_firestore/cloud_firestore.dart'; |
2 | | -import 'package:firebase_auth/firebase_auth.dart'; |
3 | 1 | import 'package:flutter/material.dart'; |
4 | 2 | import 'package:flutter/rendering.dart'; |
5 | 3 | import 'package:flutter_to_do_list/const/colors.dart'; |
6 | | -import 'package:flutter_to_do_list/data/firestor.dart'; |
7 | 4 | import 'package:flutter_to_do_list/screen/add_note_screen.dart'; |
8 | | -import 'package:flutter_to_do_list/widgets/task_widgets.dart'; |
| 5 | +import 'package:flutter_to_do_list/widgets/stream_note.dart'; |
9 | 6 |
|
10 | 7 | class Home_Screen extends StatefulWidget { |
11 | 8 | const Home_Screen({super.key}); |
@@ -34,41 +31,35 @@ class _Home_ScreenState extends State<Home_Screen> { |
34 | 31 | ), |
35 | 32 | ), |
36 | 33 | body: SafeArea( |
37 | | - child: NotificationListener<UserScrollNotification>( |
38 | | - onNotification: (notification) { |
39 | | - if (notification.direction == ScrollDirection.forward) { |
40 | | - setState(() { |
41 | | - show = true; |
42 | | - }); |
43 | | - } |
44 | | - if (notification.direction == ScrollDirection.reverse) { |
45 | | - setState(() { |
46 | | - show = false; |
47 | | - }); |
48 | | - } |
49 | | - return true; |
50 | | - }, |
51 | | - child: StreamBuilder<QuerySnapshot>( |
52 | | - stream: Firestore_Datasource().stream(), |
53 | | - builder: (context, snapshot) { |
54 | | - if (!snapshot.hasData) { |
55 | | - return CircularProgressIndicator(); |
56 | | - } |
57 | | - final noteslist = Firestore_Datasource().getNotes(snapshot); |
58 | | - return ListView.builder( |
59 | | - itemBuilder: (context, index) { |
60 | | - final note = noteslist[index]; |
61 | | - return Dismissible( |
62 | | - key: UniqueKey(), |
63 | | - onDismissed: (direction) { |
64 | | - Firestore_Datasource().delet_note(note.id); |
65 | | - }, |
66 | | - child: Task_Widget(note)); |
67 | | - }, |
68 | | - itemCount: noteslist.length, |
69 | | - ); |
70 | | - }), |
71 | | - )), |
| 34 | + child: NotificationListener<UserScrollNotification>( |
| 35 | + onNotification: (notification) { |
| 36 | + if (notification.direction == ScrollDirection.forward) { |
| 37 | + setState(() { |
| 38 | + show = true; |
| 39 | + }); |
| 40 | + } |
| 41 | + if (notification.direction == ScrollDirection.reverse) { |
| 42 | + setState(() { |
| 43 | + show = false; |
| 44 | + }); |
| 45 | + } |
| 46 | + return true; |
| 47 | + }, |
| 48 | + child: Column( |
| 49 | + children: [ |
| 50 | + Stream_note(false), |
| 51 | + Text( |
| 52 | + 'isDone', |
| 53 | + style: TextStyle( |
| 54 | + fontSize: 16, |
| 55 | + color: Colors.grey.shade500, |
| 56 | + fontWeight: FontWeight.bold), |
| 57 | + ), |
| 58 | + Stream_note(true), |
| 59 | + ], |
| 60 | + ), |
| 61 | + ), |
| 62 | + ), |
72 | 63 | ); |
73 | 64 | } |
74 | 65 | } |
0 commit comments