Basic Functions done

This commit is contained in:
warlock
2022-02-27 16:46:13 +05:30
parent d4dd0864fa
commit 8c7ea9b86e
10 changed files with 421 additions and 160 deletions

View File

@@ -5,27 +5,26 @@ import 'Data.dart';
import 'User.dart' as User;
import 'package:sn_progress_dialog/sn_progress_dialog.dart';
late ProgressDialog progressDialog;
class Tasks extends StatefulWidget {
const Tasks({Key? key}) : super(key: key);
@override
_TasksState createState() => _TasksState();
}
late ProgressDialog progressDialog;
class _TasksState extends State<Tasks> {
@override
void initState() {
// TODO: implement initState
super.initState();
progressDialog = ProgressDialog(context: context);
User.progressDialog=progressDialog;
UpdateList();
}
@override
Widget build(BuildContext context) {
progressDialog=ProgressDialog(context: context);
return Scaffold(
floatingActionButton: FloatingActionButton.extended(
@@ -67,10 +66,13 @@ class _TasksState extends State<Tasks> {
}
void UpdateList() async {
if(progressDialog != null){progressDialog.show(max:100,msg: 'Loading Task Types');}
try{progressDialog.show(max:100, msg: 'Loading Task Types...');}catch(e){}
await User.updateTasksList();
// hideProgressDialog();
setState(() {});
if(progressDialog != null){progressDialog.update(value: 100);}
try{progressDialog.update(value: 100);}catch(e){}
}
List<Widget> PrintTasks() {
@@ -165,7 +167,7 @@ class _TasksState extends State<Tasks> {
}
void DeleteSelectedTasks() async{
progressDialog.show(max: 100, msg: 'Deleteing ${selectedTasks.length} Task Types');
progressDialog.show(max: 100, msg: "Deleting ${selectedTasks.length} ");
selectedTasks.forEach((element) async {
await User.UserOperations.deleteTask(element, bulk:true);
});