1
1
import 'package:flutter/material.dart' ;
2
+ import 'package:fluttertoast/fluttertoast.dart' ;
2
3
import 'package:taskmanager/Services/HiveDb.dart' ;
3
4
import 'package:taskmanager/locator.dart' ;
4
5
import 'package:uuid/uuid.dart' ;
@@ -40,6 +41,7 @@ class _CreateTaskState extends State<CreateTask> {
40
41
"ID" : Uuid ().v4 (),
41
42
"Name" : nameCon.text,
42
43
"Period" : myChoice,
44
+ "RawTime" : DateTime .now ().millisecondsSinceEpoch
43
45
};
44
46
if (myChoice == "Daily" ) data["Time" ] = timeCon.text;
45
47
return await database.addTask (data);
@@ -50,16 +52,26 @@ class _CreateTaskState extends State<CreateTask> {
50
52
localizations = MaterialLocalizations .of (context);
51
53
return SafeArea (
52
54
child: Scaffold (
53
- backgroundColor: Colors .orange[ 300 ],
55
+ backgroundColor: Colors .blueGrey[ 700 ],
54
56
appBar: AppBar (
55
57
title: Text ("Create Task" ),
56
58
centerTitle: true ,
57
59
),
58
60
floatingActionButton: FloatingActionButton (
61
+ shape: RoundedRectangleBorder (
62
+ borderRadius: BorderRadius .all (Radius .circular (15 ))),
59
63
onPressed: () async {
60
64
await saveTask ().then ((value) {
61
65
if (value) {
62
66
print ("Successful" );
67
+ Fluttertoast .showToast (
68
+ msg: "Task Created" ,
69
+ toastLength: Toast .LENGTH_SHORT ,
70
+ gravity: ToastGravity .BOTTOM ,
71
+ timeInSecForIosWeb: 1 ,
72
+ backgroundColor: Colors .blue,
73
+ textColor: Colors .white,
74
+ fontSize: 16.0 );
63
75
Navigator .pop (context, true );
64
76
}
65
77
});
@@ -90,16 +102,30 @@ class _CreateTaskState extends State<CreateTask> {
90
102
);
91
103
}
92
104
93
- DropdownButton <String > periodSelection () {
94
- return DropdownButton <String >(
95
- hint: Text ("Choice Time Period" ),
96
- value: myChoice,
97
- items: dropdownList,
98
- onChanged: (choice) {
99
- setState (() {
100
- myChoice = choice;
101
- });
102
- });
105
+ Widget periodSelection () {
106
+ return Card (
107
+ shape: RoundedRectangleBorder (borderRadius: BorderRadius .circular (8.0 )),
108
+ color: Colors .blue[300 ],
109
+ child: Padding (
110
+ padding: const EdgeInsets .all (8.0 ),
111
+ child: DropdownButton <String >(
112
+ dropdownColor: Colors .blue[300 ],
113
+ hint: Text ("Choice Time Period" ),
114
+ value: myChoice,
115
+ style: TextStyle (color: Colors .white, fontSize: 20 ),
116
+ underline: Container (),
117
+ items: dropdownList,
118
+ icon: Icon (
119
+ Icons .date_range,
120
+ color: Colors .white,
121
+ ),
122
+ onChanged: (choice) {
123
+ setState (() {
124
+ myChoice = choice;
125
+ });
126
+ }),
127
+ ),
128
+ );
103
129
}
104
130
105
131
Widget timePicker (BuildContext context) {
@@ -133,7 +159,7 @@ class _CreateTaskState extends State<CreateTask> {
133
159
enabled: false ,
134
160
decoration: InputDecoration (
135
161
labelStyle: TextStyle (fontSize: 20 ),
136
- hintText: 'Time not set ' ),
162
+ hintText: 'Select Time (Optional) ' ),
137
163
),
138
164
),
139
165
),
@@ -155,7 +181,10 @@ class _CreateTaskState extends State<CreateTask> {
155
181
title: TextField (
156
182
controller: nameCon,
157
183
decoration: InputDecoration (
158
- border: OutlineInputBorder (),
184
+ focusedBorder: OutlineInputBorder (
185
+ borderSide: BorderSide (color: Colors .red, width: 2 )),
186
+ enabledBorder: OutlineInputBorder (
187
+ borderSide: BorderSide (color: Colors .blue, width: 2 )),
159
188
labelText: 'Task Name' ,
160
189
labelStyle: TextStyle (fontSize: 20 ),
161
190
hintText: 'Enter a task name' ),
0 commit comments