diff --git a/lib/main.dart b/lib/main.dart index a8ec20d..9ebbbe5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -36,10 +36,11 @@ class _ApplicationState extends State with TickerProviderStateMixin void initState() { super.initState(); final mySystemTheme = SystemUiOverlayStyle.light.copyWith( - statusBarColor: lightColorScheme.surface, + statusBarColor: Colors.transparent, statusBarBrightness: Brightness.light, statusBarIconBrightness: Brightness.dark, - systemNavigationBarColor: lightColorScheme.surface, + systemNavigationBarColor: Colors.transparent, + systemNavigationBarIconBrightness: Brightness.dark, ); SystemChrome.setSystemUIOverlayStyle(mySystemTheme); // 0 - collapsed diff --git a/lib/screens/metering/components/topbar/components/dialog_picker.dart b/lib/screens/metering/components/topbar/components/dialog_picker.dart index fb79eef..3401966 100644 --- a/lib/screens/metering/components/topbar/components/dialog_picker.dart +++ b/lib/screens/metering/components/topbar/components/dialog_picker.dart @@ -55,7 +55,10 @@ class _MeteringScreenDialogPickerState extends State RadioListTile( value: widget.values[index], groupValue: _selectedValue, - title: widget.itemTitleBuilder(context, widget.values[index]), + title: DefaultTextStyle( + style: Theme.of(context).textTheme.bodyLarge!, + child: widget.itemTitleBuilder(context, widget.values[index]), + ), onChanged: (value) { if (value != null) { setState(() { diff --git a/lib/screens/metering/components/topbar/topbar.dart b/lib/screens/metering/components/topbar/topbar.dart index 374e549..3457c76 100644 --- a/lib/screens/metering/components/topbar/topbar.dart +++ b/lib/screens/metering/components/topbar/topbar.dart @@ -93,31 +93,18 @@ class MeteringTopBar extends StatelessWidget { const _InnerPadding(), SizedBox( width: columnWidth, - child: AnimatedDialog( + child: _AnimatedDialogPicker( key: _isoDialogKey, - closedChild: ReadingContainer.singleValue( - value: ReadingValue( - label: S.of(context).iso, - value: iso.value.toString(), - ), - ), - openedChild: MeteringScreenDialogPicker( - title: S.of(context).iso, - initialValue: iso, - values: isoValues, - itemTitleBuilder: (context, value) => Text( - value.value.toString(), - style: value.stopType == StopType.full - ? Theme.of(context).textTheme.bodyLarge - : Theme.of(context).textTheme.bodySmall, - ), - onCancel: () { - _isoDialogKey.currentState?.close(); - }, - onSelect: (value) { - _isoDialogKey.currentState?.close().then((_) => onIsoChanged(value)); - }, + title: S.of(context).iso, + selectedValue: iso, + values: isoValues, + itemTitleBuilder: (context, value) => Text( + value.value.toString(), + style: value.stopType == StopType.full + ? null // use default + : Theme.of(context).textTheme.bodySmall, ), + onChanged: onIsoChanged, ), ), ], @@ -142,29 +129,15 @@ class MeteringTopBar extends StatelessWidget { ), ), const _InnerPadding(), - AnimatedDialog( + _AnimatedDialogPicker( key: _ndDialogKey, - closedChild: ReadingContainer.singleValue( - value: ReadingValue( - label: S.of(context).nd, - value: nd.value.toString(), - ), - ), - openedChild: MeteringScreenDialogPicker( - title: S.of(context).nd, - initialValue: nd, - values: ndValues, - itemTitleBuilder: (context, value) => Text( - value.value == 0 ? S.of(context).none : value.value.toString(), - style: Theme.of(context).textTheme.bodyLarge, - ), - onCancel: () { - _ndDialogKey.currentState?.close(); - }, - onSelect: (value) { - _ndDialogKey.currentState?.close().then((_) => onNdChanged(value)); - }, + title: S.of(context).nd, + selectedValue: nd, + values: ndValues, + itemTitleBuilder: (context, value) => Text( + value.value == 0 ? S.of(context).none : value.value.toString(), ), + onChanged: onNdChanged, ), ], ), @@ -182,3 +155,34 @@ class MeteringTopBar extends StatelessWidget { class _InnerPadding extends SizedBox { const _InnerPadding() : super(height: Dimens.grid16, width: Dimens.grid16); } + +class _AnimatedDialogPicker extends AnimatedDialog { + _AnimatedDialogPicker({ + required GlobalKey key, + required String title, + required T selectedValue, + required List values, + required Widget Function(BuildContext, T) itemTitleBuilder, + required ValueChanged onChanged, + }) : super( + key: key, + closedChild: ReadingContainer.singleValue( + value: ReadingValue( + label: title, + value: selectedValue.value.toString(), + ), + ), + openedChild: MeteringScreenDialogPicker( + title: title, + initialValue: selectedValue, + values: values, + itemTitleBuilder: itemTitleBuilder, + onCancel: () { + key.currentState?.close(); + }, + onSelect: (value) { + key.currentState?.close().then((_) => onChanged(value)); + }, + ), + ); +}