1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
| | import 'package:flutter/material.dart';
| |
| | import '../theme/app_theme.dart';
| |
| | /// Row of command buttons: Screen, Navigate, Photo, Clear (+ Help in text mode).
| | class CommandBar extends StatelessWidget {
| | final VoidCallback onScreen;
| | final VoidCallback onNavigate;
| | final VoidCallback onPhoto;
| | final VoidCallback onClear;
| | final VoidCallback? onHelp;
| | final bool showHelp;
| |
| | const CommandBar({
| | super.key,
| | required this.onScreen,
| | required this.onNavigate,
| | required this.onPhoto,
| | required this.onClear,
| | this.onHelp,
| | this.showHelp = false,
| | });
| |
| | @override
| | Widget build(BuildContext context) {
| | final isDark = Theme.of(context).brightness == Brightness.dark;
| |
| | return Container(
| | padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
| | decoration: BoxDecoration(
| | color: isDark ? AppColors.darkSurface : AppColors.lightSurface,
| | ),
| | child: Row(
| | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
| | children: [
| | _CommandButton(
| | icon: Icons.screenshot_monitor,
| | label: 'Screen',
| | onTap: onScreen,
| | ),
| | _CommandButton(
| | icon: Icons.explore,
| | label: 'Navigate',
| | onTap: onNavigate,
| | ),
| | _CommandButton(
| | icon: Icons.attach_file,
| | label: 'Attach',
| | onTap: onPhoto,
| | ),
| | _CommandButton(
| | icon: Icons.delete_sweep,
| | label: 'Clear',
| | onTap: onClear,
| | ),
| | if (showHelp && onHelp != null)
| | _CommandButton(
| | icon: Icons.help_outline,
| | label: 'Help',
| | onTap: onHelp!,
| | ),
| | ],
| | ),
| | );
| | }
| | }
| |
| | class _CommandButton extends StatelessWidget {
| | final IconData icon;
| | final String label;
| | final VoidCallback onTap;
| |
| | const _CommandButton({
| | required this.icon,
| | required this.label,
| | required this.onTap,
| | });
| |
| | @override
| | Widget build(BuildContext context) {
| | final isDark = Theme.of(context).brightness == Brightness.dark;
| |
| | return InkWell(
| | onTap: onTap,
| | borderRadius: BorderRadius.circular(8),
| | child: Padding(
| | padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
| | child: Column(
| | mainAxisSize: MainAxisSize.min,
| | children: [
| | Icon(
| | icon,
| | size: 22,
| | color: isDark ? AppColors.darkTextSecondary : AppColors.lightTextSecondary,
| | ),
| | const SizedBox(height: 2),
| | Text(
| | label,
| | style: TextStyle(
| | fontSize: 10,
| | color: isDark ? AppColors.darkTextTertiary : Colors.grey.shade600,
| | ),
| | ),
| | ],
| | ),
| | ),
| | );
| | }
| | }
|
|