Skip to content

Commit b6cb149

Browse files
committed
feat: update dialogs and buttons to use adaptive styles and replace ElevatedButton with FilledButton
1 parent 9ac2d5e commit b6cb149

23 files changed

+65
-52
lines changed

client/3rd-party/flutter_esp_ble_prov/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class _ProvisioningHomePageState extends State<ProvisioningHomePage> {
196196
void _showSuccessDialog() {
197197
showDialog(
198198
context: context,
199-
builder: (context) => AlertDialog(
199+
builder: (context) => AlertDialog.adaptive(
200200
title: const Row(
201201
children: [
202202
Icon(Icons.check_circle, color: Colors.green),

client/lib/core/services/app_notification_service_impl.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class AppNotificationServiceImpl implements IAppNotificationService {
2525
showDialog<void>(
2626
context: context,
2727
barrierDismissible: false,
28-
builder: (dialogContext) => AlertDialog(
28+
builder: (dialogContext) => AlertDialog.adaptive(
2929
icon: Icon(Icons.error_outline, color: theme.colorScheme.error, size: 32),
3030
title: Text(title),
3131
content: body != null ? SingleChildScrollView(child: Text(body)) : null,

client/lib/devices/borneo/lyfi/views/controller_settings_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class _ControllerSettingsScreenState extends State<ControllerSettingsScreen> {
239239
showDialog(
240240
context: context,
241241
builder: (BuildContext dialogContext) {
242-
return AlertDialog(
242+
return AlertDialog.adaptive(
243243
title: Text(context.translate('Confirm Submit')),
244244
content: Text(
245245
context.translate(

client/lib/devices/borneo/lyfi/views/dashboard/dashboard_chart.dart

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,32 @@ class DashboardChart extends StatelessWidget {
1919
if (!isActuallyOnline) {
2020
return Container(
2121
constraints: const BoxConstraints(minHeight: 200),
22-
child: Center(
23-
child: Column(
24-
mainAxisAlignment: MainAxisAlignment.center,
25-
children: [
26-
Icon(Icons.wifi_off, size: 48, color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5)),
27-
const SizedBox(height: 8),
28-
Text(
29-
context.translate('Device Offline'),
30-
style: Theme.of(context).textTheme.titleLarge?.copyWith(
31-
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7),
22+
child: Column(
23+
mainAxisAlignment: MainAxisAlignment.start,
24+
children: [
25+
Expanded(
26+
child: FittedBox(
27+
fit: BoxFit.fill,
28+
child: Icon(
29+
Icons.wifi_off,
30+
size: null,
31+
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.38),
3232
),
3333
),
34-
const SizedBox(height: 8),
35-
Text(
36-
context.translate('Please check device connection'),
37-
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
38-
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5),
39-
),
34+
),
35+
Text(
36+
context.translate('Device Offline'),
37+
style: Theme.of(context).textTheme.titleMedium?.copyWith(
38+
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7),
4039
),
41-
],
42-
),
40+
),
41+
Text(
42+
context.translate('Please check device connection'),
43+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
44+
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5),
45+
),
46+
),
47+
],
4348
),
4449
);
4550
} else {

client/lib/devices/borneo/lyfi/views/dashboard/dashboard_power_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class DashboardPowerTile extends StatelessWidget {
3737
builder: (context, _) => DashboardToufu(
3838
title: context.translate("LED Power"),
3939
icon: Icons.power_outlined,
40-
foregroundColor: fgColor,
40+
foregroundColor: isOnline ? fgColor : disabledColor,
4141
backgroundColor: theme.colorScheme.surfaceContainerHighest,
4242
arcColor: arcColor,
4343
progressColor: progressColor,

client/lib/devices/borneo/lyfi/views/dashboard/dashboard_temperature_tile.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class DashboardTemperatureTile extends StatelessWidget {
2626
(vm) =>
2727
(vm.isOnline, vm.currentTempRaw, vm.currentTemp, vm.localeService.temperatureUnitText, vm.fanPowerRatio),
2828
);
29+
final disabledColor = theme.colorScheme.onSurface.withValues(alpha: 0.38);
30+
final Color fgColor = theme.colorScheme.onSurface;
2931

3032
Color progressColor;
3133
if (currentTempRaw != null && currentTempRaw <= 45) {
@@ -41,7 +43,7 @@ class DashboardTemperatureTile extends StatelessWidget {
4143
return DashboardToufu(
4244
title: context.translate("Temperature & Fan"),
4345
icon: Icons.thermostat,
44-
foregroundColor: theme.colorScheme.onSurface,
46+
foregroundColor: isOnline ? fgColor : disabledColor,
4547
backgroundColor: theme.colorScheme.surfaceContainerHighest,
4648
arcColor: null,
4749
progressColor: progressColor,

client/lib/devices/borneo/lyfi/views/moon_screen.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ class MoonScreen extends StatelessWidget {
4444
title: Text(context.translate('Moonlight')),
4545
actions: [
4646
Consumer<MoonViewModel>(
47-
builder: (context, vm, _) =>
48-
Switch(value: vm.enabled, onChanged: !vm.isBusy && vm.isOnline && vm.isOn ? vm.setEnabled : null),
47+
builder: (context, vm, _) => Switch.adaptive(
48+
value: vm.enabled,
49+
onChanged: !vm.isBusy && vm.isOnline && vm.isOn ? vm.setEnabled : null,
50+
),
4951
),
5052
Consumer<MoonViewModel>(
5153
builder: (context, vm, _) => AppBarApplyButton(

client/lib/devices/borneo/lyfi/views/settings_screen.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class SettingsScreen extends StatelessWidget {
297297
void _showFactoryResetDialog(BuildContext context, SettingsViewModel vm) {
298298
showDialog(
299299
context: context,
300-
builder: (context) => AlertDialog(
300+
builder: (context) => AlertDialog.adaptive(
301301
title: Text(context.translate('Restore Factory Settings')),
302302
content: Column(
303303
mainAxisSize: MainAxisSize.min,
@@ -381,17 +381,18 @@ class SettingsScreen extends StatelessWidget {
381381
showDialog(
382382
context: context,
383383
builder: (context) => StatefulBuilder(
384-
builder: (context, setState) => AlertDialog(
385-
title: Text(context.translate('Set Manual Fan Power')),
384+
builder: (context, setState) => AlertDialog.adaptive(
385+
title: Text(context.translate('Set Manual Fan Power'), style: Theme.of(context).textTheme.titleMedium),
386386
content: Column(
387387
mainAxisSize: MainAxisSize.min,
388388
children: [
389389
Text('${tempValue.toInt()}%'),
390-
Slider(
390+
Slider.adaptive(
391391
value: tempValue,
392392
min: 0,
393393
max: 100,
394394
divisions: 100,
395+
label: '${tempValue.toInt()}%',
395396
onChanged: (value) {
396397
setState(() {
397398
tempValue = value;
@@ -438,7 +439,7 @@ class SettingsScreen extends StatelessWidget {
438439
showDialog(
439440
context: context,
440441
builder: (context) => StatefulBuilder(
441-
builder: (context, setState) => AlertDialog(
442+
builder: (context, setState) => AlertDialog.adaptive(
442443
title: Text(context.translate('Set Device Name')),
443444
content: Column(
444445
mainAxisSize: MainAxisSize.min,

client/lib/devices/views/device_offline_view.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class DeviceOfflineView extends StatelessWidget {
2828
textAlign: TextAlign.center,
2929
),
3030
const SizedBox(height: 32),
31-
ElevatedButton.icon(
31+
FilledButton.icon(
3232
onPressed: () {
3333
Navigator.pop(context);
3434
},
3535
icon: const Icon(Icons.arrow_back, size: 24),
3636
label: Text(context.translate('Close')),
37-
style: ElevatedButton.styleFrom(
37+
style: FilledButton.styleFrom(
3838
backgroundColor: theme.colorScheme.primary,
3939
foregroundColor: theme.colorScheme.onPrimary,
4040
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),

client/lib/devices/views/device_ota_screen.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class _DeviceOtaScreenState extends State<DeviceOtaScreen> with TickerProviderSt
4646
final confirmed = await showDialog<bool>(
4747
context: context,
4848
barrierDismissible: false,
49-
builder: (ctx) => AlertDialog(
49+
builder: (ctx) => AlertDialog.adaptive(
5050
title: Text(context.translate('Firmware Update')),
5151
content: SingleChildScrollView(
5252
child: Column(
@@ -438,7 +438,7 @@ class _DeviceOtaScreenState extends State<DeviceOtaScreen> with TickerProviderSt
438438
if (vm.isSucceeded) {
439439
return SizedBox(
440440
width: double.infinity,
441-
child: ElevatedButton.icon(
441+
child: FilledButton.icon(
442442
onPressed: () => Navigator.of(context).pop(),
443443
icon: const Icon(Icons.check),
444444
label: Text(context.translate('Done')),
@@ -449,7 +449,7 @@ class _DeviceOtaScreenState extends State<DeviceOtaScreen> with TickerProviderSt
449449
if (vm.hasUpdate) {
450450
return SizedBox(
451451
width: double.infinity,
452-
child: ElevatedButton.icon(
452+
child: FilledButton.icon(
453453
onPressed: () async {
454454
final ok = await _confirmUpgrade(context);
455455
if (ok && context.mounted) {
@@ -468,7 +468,7 @@ class _DeviceOtaScreenState extends State<DeviceOtaScreen> with TickerProviderSt
468468
children: [
469469
SizedBox(
470470
width: double.infinity,
471-
child: ElevatedButton.icon(
471+
child: FilledButton.icon(
472472
onPressed: vm.canCheck ? () => vm.checkUpdate() : null,
473473
icon: const Icon(Icons.refresh),
474474
label: Text(

0 commit comments

Comments
 (0)