transparent status bar on Android

unified metering screen dialogs
This commit is contained in:
Vadim 2022-12-04 22:46:11 +03:00
parent 1c344da29f
commit 0a45a2719b
3 changed files with 55 additions and 47 deletions

View file

@ -36,10 +36,11 @@ class _ApplicationState extends State<Application> 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

View file

@ -55,7 +55,10 @@ class _MeteringScreenDialogPickerState<T> extends State<MeteringScreenDialogPick
itemBuilder: (context, index) => 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(() {

View file

@ -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,
selectedValue: iso,
values: isoValues,
itemTitleBuilder: (context, value) => Text(
value.value.toString(),
style: value.stopType == StopType.full
? Theme.of(context).textTheme.bodyLarge
? null // use default
: Theme.of(context).textTheme.bodySmall,
),
onCancel: () {
_isoDialogKey.currentState?.close();
},
onSelect: (value) {
_isoDialogKey.currentState?.close().then((_) => onIsoChanged(value));
},
),
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,
selectedValue: 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));
},
),
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<T extends PhotographyValue> extends AnimatedDialog {
_AnimatedDialogPicker({
required GlobalKey<AnimatedDialogState> key,
required String title,
required T selectedValue,
required List<T> values,
required Widget Function(BuildContext, T) itemTitleBuilder,
required ValueChanged<T> 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));
},
),
);
}