Skip to content

Commit 8c17acb

Browse files
committed
Snackbar displaying TaskServer error added
1 parent f93d332 commit 8c17acb

File tree

1 file changed

+15
-34
lines changed

1 file changed

+15
-34
lines changed

lib/taskserver/ntaskserver.dart

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -160,40 +160,21 @@ class _ManageTaskServerState extends State<ManageTaskServer> {
160160
Navigator.of(context).pop();
161161

162162
//Displaying Error message.
163-
showDialog(
164-
context: context,
165-
builder: (context) => Utils.showAlertDialog(
166-
shape: RoundedRectangleBorder(
167-
borderRadius: BorderRadius.circular(
168-
20), // Adjust the radius as needed
169-
),
170-
actionsPadding: const EdgeInsets.all(5),
171-
title: Text(
172-
"Error",
173-
style: TextStyle(color: TaskWarriorColors.red),
174-
),
175-
content: Text(
176-
trace.toString().startsWith("#0")
177-
? "Please set up your Task Server."
178-
: e.toString(),
179-
style: TextStyle(
180-
color: AppSettings.isDarkMode
181-
? TaskWarriorColors.white
182-
: TaskWarriorColors.black,
183-
),
184-
),
185-
actions: <Widget>[
186-
TextButton(
187-
onPressed: () {
188-
Navigator.pop(context);
189-
},
190-
child: Text(
191-
"OK",
192-
style: TextStyle(color: TaskWarriorColors.grey),
193-
),
194-
)
195-
]));
196-
163+
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
164+
content: Text(
165+
trace.toString().startsWith("#0")
166+
? "Please set up your TaskServer."
167+
: e.toString(),
168+
style: TextStyle(
169+
color: AppSettings.isDarkMode
170+
? TaskWarriorColors.kprimaryTextColor
171+
: TaskWarriorColors.kLightPrimaryTextColor,
172+
),
173+
),
174+
backgroundColor: AppSettings.isDarkMode
175+
? TaskWarriorColors.ksecondaryBackgroundColor
176+
: TaskWarriorColors.kLightSecondaryBackgroundColor,
177+
duration: const Duration(seconds: 2)));
197178
// Log the error and trace
198179
logError(e, trace);
199180
// Refresh the state of ProfilesWidget

0 commit comments

Comments
 (0)