Skip to content

Commit 302332a

Browse files
committed
Update his_sidebar_header.dart
1 parent c63647f commit 302332a

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

lib/screens/history/history_widgets/his_sidebar_header.dart

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,57 +28,57 @@ class HistorySidebarHeader extends ConsumerWidget {
2828
color: Theme.of(context).brightness == Brightness.dark
2929
? kColorDarkDanger
3030
: kColorLightDanger,
31-
onPressed: () {
32-
showDialog(
33-
context: context,
34-
builder: (context) => AlertDialog(
35-
title: const Text('Clear History'),
36-
content: const Text('Are you sure you want to clear all history? This action cannot be undone.'),
37-
actions: [
38-
TextButton(
39-
onPressed: () => Navigator.pop(context),
40-
child: const Text('Cancel'),
41-
),
42-
TextButton(
43-
onPressed: () async {
44-
try {
45-
await ref
46-
.read(historyMetaStateNotifier.notifier)
47-
.clearAllHistory();
48-
49-
if (context.mounted) {
50-
Navigator.pop(context);
51-
ScaffoldMessenger.of(context).showSnackBar(
52-
const SnackBar(
53-
content: Text('History cleared successfully'),
54-
duration: Duration(seconds: 2),
31+
onPressed: () {
32+
showDialog(
33+
context: context,
34+
builder: (context) => AlertDialog(
35+
title: const Text('Clear History'),
36+
content: const Text(
37+
'Are you sure you want to clear all history? This action cannot be undone.'),
38+
actions: [
39+
TextButton(
40+
onPressed: () => Navigator.pop(context),
41+
child: const Text('Cancel'),
5542
),
56-
);
57-
}
58-
} catch (e) {
59-
if (context.mounted) {
60-
Navigator.pop(context);
61-
ScaffoldMessenger.of(context).showSnackBar(
62-
const SnackBar(
63-
content: Text('Error clearing history'),
64-
backgroundColor: Colors.red,
65-
duration: Duration(seconds: 2),
43+
TextButton(
44+
onPressed: () async {
45+
try {
46+
await ref
47+
.read(historyMetaStateNotifier.notifier)
48+
.clearAllHistory();
49+
50+
if (context.mounted) {
51+
Navigator.pop(context);
52+
ScaffoldMessenger.of(context).showSnackBar(
53+
const SnackBar(
54+
content: Text('History cleared successfully'),
55+
duration: Duration(seconds: 2),
56+
),
57+
);
58+
}
59+
} catch (e) {
60+
if (context.mounted) {
61+
Navigator.pop(context);
62+
ScaffoldMessenger.of(context).showSnackBar(
63+
const SnackBar(
64+
content: Text('Error clearing history'),
65+
backgroundColor: Colors.red,
66+
duration: Duration(seconds: 2),
67+
),
68+
);
69+
}
70+
}
71+
},
72+
style: TextButton.styleFrom(
73+
foregroundColor: Theme.of(context).colorScheme.error,
74+
),
75+
child: const Text('Clear'),
6676
),
67-
);
68-
}
69-
}
77+
],
78+
),
79+
);
7080
},
71-
style: TextButton.styleFrom(
72-
foregroundColor: Theme.of(context).colorScheme.error,
73-
),
74-
child: const Text('Clear'),
7581
),
76-
],
77-
),
78-
);
79-
},
80-
),
81-
8282
ADIconButton(
8383
icon: Icons.manage_history_rounded,
8484
iconSize: kButtonIconSizeLarge,

0 commit comments

Comments
 (0)