Skip to content

Commit 1a4031f

Browse files
committed
feat: replace FilledButton with TextButton in DeviceErrorDialog and wrap ScreenTopRoundedContainer in SafeArea
1 parent dc5b1b6 commit 1a4031f

6 files changed

Lines changed: 47 additions & 44 deletions

File tree

client/lib/features/devices/views/device_error_dialog.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DeviceErrorDialog extends StatelessWidget {
1414
style: Theme.of(context).textTheme.titleMedium?.copyWith(color: Theme.of(context).colorScheme.error),
1515
),
1616
content: Text(errorMessage),
17-
actions: [FilledButton(onPressed: () => Navigator.of(context).pop(), child: Text(context.translate('OK')))],
17+
actions: [TextButton(onPressed: () => Navigator.of(context).pop(), child: Text(context.translate('OK')))],
1818
);
1919
}
2020
}

client/lib/features/devices/views/device_group_selection_sheet.dart

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ class DeviceGroupSelectionSheet extends StatelessWidget {
2121
Widget build(BuildContext context) {
2222
final String? effectiveExcludeGroupId = excludeGroupId;
2323
final filteredGroups = availableGroups.where((g) => g.id != effectiveExcludeGroupId).toList();
24+
final theme = Theme.of(context);
2425

2526
final tiles =
2627
<Widget>[
2728
if (effectiveExcludeGroupId != '')
2829
ListTile(
2930
dense: true,
3031
tileColor: Colors.transparent,
31-
title: Text(context.translate('No group')),
32+
title: Text(context.translate('No group'), style: theme.textTheme.bodyLarge),
3233
onTap: () {
3334
Navigator.pop(context);
3435
onTapGroup(null);
@@ -40,7 +41,7 @@ class DeviceGroupSelectionSheet extends StatelessWidget {
4041
return ListTile(
4142
dense: true,
4243
tileColor: Colors.transparent,
43-
title: Text(g.name),
44+
title: Text(g.name, style: theme.textTheme.bodyLarge),
4445
onTap: () {
4546
Navigator.pop(context);
4647
onTapGroup(g);
@@ -49,36 +50,39 @@ class DeviceGroupSelectionSheet extends StatelessWidget {
4950
}),
5051
)
5152
.toList();
52-
return Column(
53-
crossAxisAlignment: CrossAxisAlignment.stretch,
54-
mainAxisSize: MainAxisSize.min,
55-
children: [
56-
Container(
57-
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
58-
child: Text(title, textAlign: TextAlign.center),
59-
),
60-
if (subtitle != null)
53+
return SafeArea(
54+
child: Column(
55+
crossAxisAlignment: CrossAxisAlignment.stretch,
56+
mainAxisSize: MainAxisSize.min,
57+
children: [
6158
Container(
62-
padding: EdgeInsets.fromLTRB(16, 8, 16, 0),
63-
child: Text(
64-
subtitle!,
65-
textAlign: TextAlign.start,
66-
style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Theme.of(context).hintColor),
67-
),
59+
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
60+
child: Text(title, style: Theme.of(context).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600)),
6861
),
69-
const SizedBox(height: 8),
70-
Flexible(
71-
child: ListView.separated(
72-
padding: const EdgeInsets.all(0),
73-
shrinkWrap: true,
74-
physics: const ClampingScrollPhysics(),
75-
itemBuilder: (BuildContext context, int index) => tiles[index],
76-
separatorBuilder: (BuildContext context, int index) => const Divider(indent: 16, height: 1, thickness: 1),
77-
itemCount: tiles.length,
62+
if (subtitle != null)
63+
Container(
64+
padding: EdgeInsets.fromLTRB(16, 8, 16, 0),
65+
child: Text(
66+
subtitle!,
67+
textAlign: TextAlign.start,
68+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Theme.of(context).hintColor),
69+
),
70+
),
71+
const SizedBox(height: 8),
72+
Flexible(
73+
child: ListView.separated(
74+
padding: const EdgeInsets.all(0),
75+
shrinkWrap: true,
76+
physics: const ClampingScrollPhysics(),
77+
itemBuilder: (BuildContext context, int index) => tiles[index],
78+
separatorBuilder: (BuildContext context, int index) => const Divider(indent: 16, height: 1, thickness: 1),
79+
itemCount: tiles.length,
80+
),
7881
),
79-
),
80-
const SizedBox(height: 16),
81-
],
82+
const Divider(indent: 16, height: 1, thickness: 1),
83+
const SizedBox(height: 16),
84+
],
85+
),
8286
);
8387
}
8488
}

client/lib/features/devices/views/group_edit_screen.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,7 @@ class _GroupEditBodyState extends ConsumerState<_GroupEditBody> {
140140
if (widget.args.isCreation) return const [];
141141

142142
return [
143-
IconButton(
144-
key: const Key('btn_delete_group'),
145-
onPressed: () => _onDeletePressed(context),
146-
icon: const Icon(Icons.delete_outline),
147-
),
143+
TextButton(key: const Key('btn_delete_group'), onPressed: () => _onDeletePressed(context), child: Text('Delete')),
148144
];
149145
}
150146

client/lib/features/scenes/views/scene_edit_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ class _SceneEditBodyState extends ConsumerState<_SceneEditBody> {
248248
if (!deletionAvailable) return const [];
249249
final isBusy = ref.watch(sceneEditProvider.select((s) => s.isBusy));
250250
return [
251-
IconButton(
251+
TextButton(
252252
key: const Key('btn_delete_scene'),
253253
onPressed: isBusy ? null : () => _onDeletePressed(context),
254-
icon: const Icon(Icons.delete_outline),
254+
child: Text('Delete'),
255255
),
256256
];
257257
}

client/lib/shared/widgets/generic_bottom_sheet_picker.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class GenericBottomSheetPicker<T> extends StatelessWidget {
104104
),
105105
),
106106

107+
const Divider(height: 1, thickness: 1),
107108
// items
108109
Flexible(
109110
child: Container(
@@ -121,7 +122,7 @@ class GenericBottomSheetPicker<T> extends StatelessWidget {
121122
padding: EdgeInsets.zero,
122123
itemCount: entries.length,
123124
separatorBuilder: (context, index) =>
124-
Divider(height: 1, indent: 20, endIndent: 20, color: Theme.of(context).colorScheme.surfaceDim),
125+
Divider(height: 1, indent: 16, endIndent: 16, color: Theme.of(context).colorScheme.surfaceDim),
125126
itemBuilder: (context, index) {
126127
final entry = entries[index];
127128
final isSelected = entry.value == effective;
@@ -134,7 +135,7 @@ class GenericBottomSheetPicker<T> extends StatelessWidget {
134135
),
135136
),
136137
trailing: isSelected ? Icon(Icons.check, color: colorScheme.primary, size: 20) : null,
137-
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 0),
138+
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 0),
138139
onTap: () => onValueSelected(entry.value),
139140
dense: true,
140141
);

client/lib/shared/widgets/screen_top_rounded_container.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ class ScreenTopRoundedContainer extends StatelessWidget {
2727
final info = Provider.of<PlatformDeviceInfo?>(context, listen: false);
2828
final r = info?.screenCornerRadius ?? ScreenRadius.value(0.0);
2929

30-
return ClipRRect(
31-
borderRadius: BorderRadius.only(topLeft: Radius.circular(r.topLeft), topRight: Radius.circular(r.topRight)),
32-
child: Container(
33-
decoration: BoxDecoration(color: bg, boxShadow: shadows),
34-
child: Padding(padding: padding ?? EdgeInsets.zero, child: child),
30+
return SafeArea(
31+
child: ClipRRect(
32+
borderRadius: BorderRadius.only(topLeft: Radius.circular(r.topLeft), topRight: Radius.circular(r.topRight)),
33+
child: Container(
34+
decoration: BoxDecoration(color: bg, boxShadow: shadows),
35+
child: Padding(padding: padding ?? EdgeInsets.zero, child: child),
36+
),
3537
),
3638
);
3739
}

0 commit comments

Comments
 (0)