|
1 | 1 | // ignore_for_file: library_private_types_in_public_api, use_build_context_synchronously, file_names |
2 | 2 |
|
3 | 3 | import 'dart:developer'; |
4 | | -import 'package:another_flushbar/flushbar.dart'; |
5 | 4 | import 'package:flutter/material.dart'; |
6 | 5 | import 'package:get/get.dart'; |
7 | 6 | import 'package:google_fonts/google_fonts.dart'; |
@@ -47,50 +46,53 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> { |
47 | 46 | @override |
48 | 47 | Widget build(BuildContext context) { |
49 | 48 | const title = 'Add Task'; |
50 | | - return Center( |
51 | | - child: SingleChildScrollView( |
52 | | - child: AlertDialog( |
53 | | - surfaceTintColor: AppSettings.isDarkMode |
54 | | - ? TaskWarriorColors.kdialogBackGroundColor |
55 | | - : TaskWarriorColors.kLightDialogBackGroundColor, |
56 | | - shadowColor: AppSettings.isDarkMode |
57 | | - ? TaskWarriorColors.kdialogBackGroundColor |
58 | | - : TaskWarriorColors.kLightDialogBackGroundColor, |
59 | | - backgroundColor: AppSettings.isDarkMode |
60 | | - ? TaskWarriorColors.kdialogBackGroundColor |
61 | | - : TaskWarriorColors.kLightDialogBackGroundColor, |
62 | | - title: Center( |
63 | | - child: Text( |
64 | | - title, |
65 | | - style: TextStyle( |
66 | | - color: AppSettings.isDarkMode |
67 | | - ? TaskWarriorColors.white |
68 | | - : TaskWarriorColors.black, |
| 49 | + return Scaffold( |
| 50 | + backgroundColor: Colors.transparent, |
| 51 | + body: Center( |
| 52 | + child: SingleChildScrollView( |
| 53 | + child: AlertDialog( |
| 54 | + surfaceTintColor: AppSettings.isDarkMode |
| 55 | + ? TaskWarriorColors.kdialogBackGroundColor |
| 56 | + : TaskWarriorColors.kLightDialogBackGroundColor, |
| 57 | + shadowColor: AppSettings.isDarkMode |
| 58 | + ? TaskWarriorColors.kdialogBackGroundColor |
| 59 | + : TaskWarriorColors.kLightDialogBackGroundColor, |
| 60 | + backgroundColor: AppSettings.isDarkMode |
| 61 | + ? TaskWarriorColors.kdialogBackGroundColor |
| 62 | + : TaskWarriorColors.kLightDialogBackGroundColor, |
| 63 | + title: Center( |
| 64 | + child: Text( |
| 65 | + title, |
| 66 | + style: TextStyle( |
| 67 | + color: AppSettings.isDarkMode |
| 68 | + ? TaskWarriorColors.white |
| 69 | + : TaskWarriorColors.black, |
| 70 | + ), |
69 | 71 | ), |
70 | 72 | ), |
71 | | - ), |
72 | | - content: Form( |
73 | | - key: formKey, |
74 | | - child: SizedBox( |
75 | | - width: MediaQuery.of(context).size.width * 0.8, |
76 | | - child: Column( |
77 | | - mainAxisSize: MainAxisSize.min, |
78 | | - children: <Widget>[ |
79 | | - const SizedBox(height: 8), |
80 | | - buildName(), |
81 | | - const SizedBox(height: 12), |
82 | | - buildDueDate(context), |
83 | | - const SizedBox(height: 8), |
84 | | - buildPriority(), |
85 | | - buildTags(), |
86 | | - ], |
| 73 | + content: Form( |
| 74 | + key: formKey, |
| 75 | + child: SizedBox( |
| 76 | + width: MediaQuery.of(context).size.width * 0.8, |
| 77 | + child: Column( |
| 78 | + mainAxisSize: MainAxisSize.min, |
| 79 | + children: <Widget>[ |
| 80 | + const SizedBox(height: 8), |
| 81 | + buildName(), |
| 82 | + const SizedBox(height: 12), |
| 83 | + buildDueDate(context), |
| 84 | + const SizedBox(height: 8), |
| 85 | + buildPriority(), |
| 86 | + buildTags(), |
| 87 | + ], |
| 88 | + ), |
87 | 89 | ), |
88 | 90 | ), |
| 91 | + actions: <Widget>[ |
| 92 | + buildCancelButton(context), |
| 93 | + buildAddButton(context), |
| 94 | + ], |
89 | 95 | ), |
90 | | - actions: <Widget>[ |
91 | | - buildCancelButton(context), |
92 | | - buildAddButton(context), |
93 | | - ], |
94 | 96 | ), |
95 | 97 | ), |
96 | 98 | ); |
@@ -307,17 +309,28 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> { |
307 | 309 | setState(() { |
308 | 310 | inThePast = true; |
309 | 311 | }); |
310 | | - //Replaced the snackBar to display message in the current context. |
311 | | - // ignore: avoid_single_cascade_in_expression_statements |
312 | | - Flushbar( |
313 | | - message: 'The selected time is in the past', |
314 | | - duration: const Duration(seconds: 3), |
315 | | - )..show(context); |
| 312 | + |
| 313 | + ScaffoldMessenger.of(context).showSnackBar(SnackBar( |
| 314 | + content: Text( |
| 315 | + "The selected time is in the past.", |
| 316 | + style: TextStyle( |
| 317 | + color: AppSettings.isDarkMode |
| 318 | + ? TaskWarriorColors.kprimaryTextColor |
| 319 | + : TaskWarriorColors.kLightPrimaryTextColor, |
| 320 | + ), |
| 321 | + ), |
| 322 | + backgroundColor: AppSettings.isDarkMode |
| 323 | + ? TaskWarriorColors.ksecondaryBackgroundColor |
| 324 | + : TaskWarriorColors |
| 325 | + .kLightSecondaryBackgroundColor, |
| 326 | + duration: const Duration(seconds: 2))); |
316 | 327 | } else { |
317 | 328 | setState(() { |
318 | 329 | inThePast = false; |
319 | 330 | }); |
320 | 331 | } |
| 332 | + |
| 333 | + // setState(() {}); |
321 | 334 | } |
322 | 335 | } |
323 | 336 | }, |
|
0 commit comments