@@ -28,57 +28,57 @@ class HistorySidebarHeader extends ConsumerWidget {
28
28
color: Theme .of (context).brightness == Brightness .dark
29
29
? kColorDarkDanger
30
30
: 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' ),
55
42
),
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' ),
66
76
),
67
- );
68
- }
69
- }
77
+ ],
78
+ ),
79
+ );
70
80
},
71
- style: TextButton .styleFrom (
72
- foregroundColor: Theme .of (context).colorScheme.error,
73
- ),
74
- child: const Text ('Clear' ),
75
81
),
76
- ],
77
- ),
78
- );
79
- },
80
- ),
81
-
82
82
ADIconButton (
83
83
icon: Icons .manage_history_rounded,
84
84
iconSize: kButtonIconSizeLarge,
0 commit comments