Browse Source

refactor(neon): Use switches instead of checkboxes

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/845/head
jld3103 1 year ago
parent
commit
240dd27b30
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      packages/app/integration_test/screenshot_test.dart
  2. 7
      packages/neon/neon/lib/src/settings/widgets/toggle_settings_tile.dart

2
packages/app/integration_test/screenshot_test.dart

@ -346,7 +346,7 @@ Future<void> main() async {
await binding.takeScreenshot('settings_dark'); await binding.takeScreenshot('settings_dark');
// Enable OLED theme // Enable OLED theme
await tester.tap(find.byType(CheckboxListTile).first); await tester.tap(find.byType(SwitchListTile).first);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await binding.takeScreenshot('settings_oled'); await binding.takeScreenshot('settings_oled');

7
packages/neon/neon/lib/src/settings/widgets/toggle_settings_tile.dart

@ -13,13 +13,10 @@ class ToggleSettingsTile extends InputSettingsTile<ToggleOption> {
@override @override
Widget build(final BuildContext context) => ValueListenableBuilder( Widget build(final BuildContext context) => ValueListenableBuilder(
valueListenable: option, valueListenable: option,
builder: (final context, final value, final child) => CheckboxListTile.adaptive( builder: (final context, final value, final child) => SwitchListTile.adaptive(
enabled: option.enabled,
title: child, title: child,
value: value, value: value,
onChanged: (final value) { onChanged: option.enabled ? (final value) => option.value = value : null,
option.value = value!;
},
), ),
child: Text(option.label(context)), child: Text(option.label(context)),
); );

Loading…
Cancel
Save