Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions lib/screens/tasks/task_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ class _TaskScreenState extends State<TaskScreen> {
_loadTasks();
} catch (e) {
debugPrint('Error updating task status: $e');
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Error updating task status: $e'),
backgroundColor: Colors.red,
),
);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Error updating task status: $e'),
backgroundColor: Colors.red,
),
);
}
}
}

Expand All @@ -125,12 +127,14 @@ class _TaskScreenState extends State<TaskScreen> {
_loadTasks();
} catch (e) {
debugPrint('Error updating task approval: $e');
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Error updating task approval: $e'),
backgroundColor: Colors.red,
),
);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Error updating task approval: $e'),
backgroundColor: Colors.red,
),
);
}
}
}

Expand Down Expand Up @@ -161,6 +165,7 @@ class _TaskScreenState extends State<TaskScreen> {
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
floatingActionButton: FloatingActionButton(
onPressed: () async {
final messenger = ScaffoldMessenger.of(context);
final result = await Navigator.push(
context,
MaterialPageRoute(
Expand All @@ -169,9 +174,9 @@ class _TaskScreenState extends State<TaskScreen> {
),
);

if (result == true) {
if (result == true && mounted) {
_loadTasks();
ScaffoldMessenger.of(context).showSnackBar(
messenger.showSnackBar(
const SnackBar(
content: Text('Task created successfully'),
backgroundColor: Colors.green,
Expand Down
5 changes: 3 additions & 2 deletions lib/screens/tickets/ticket_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class _TicketScreenState extends State<TicketScreen> {
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
floatingActionButton: FloatingActionButton(
onPressed: () async {
final messenger = ScaffoldMessenger.of(context);
final result = await Navigator.push(
context,
MaterialPageRoute(
Expand All @@ -160,9 +161,9 @@ class _TicketScreenState extends State<TicketScreen> {
),
);

if (result == true) {
if (result == true && mounted) {
refreshTickets();
ScaffoldMessenger.of(context).showSnackBar(
messenger.showSnackBar(
const SnackBar(
content: Text('Ticket created successfully'),
backgroundColor: Colors.green,
Expand Down
42 changes: 24 additions & 18 deletions lib/screens/workspace/workspace_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ class _WorkspaceScreenState extends State<WorkspaceScreen>
// Force refresh of the task screen
TaskScreen.refreshTasks();

ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Task created successfully'),
backgroundColor: Colors.green,
),
);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Task created successfully'),
backgroundColor: Colors.green,
),
);
}
}
});
}
Expand All @@ -106,12 +108,14 @@ class _WorkspaceScreenState extends State<WorkspaceScreen>
// Force refresh of the ticket screen
TicketScreen.refreshTickets();

ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Ticket created successfully'),
backgroundColor: Colors.green,
),
);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Ticket created successfully'),
backgroundColor: Colors.green,
),
);
}
}
});
}
Expand All @@ -132,12 +136,14 @@ class _WorkspaceScreenState extends State<WorkspaceScreen>
// Force refresh of the meeting screen
MeetingScreen.refreshMeetings();

ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Meeting created successfully'),
backgroundColor: Colors.green,
),
);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Meeting created successfully'),
backgroundColor: Colors.green,
),
);
}
}
});
}
Expand Down