mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
Clean up
transparent status bar on Android unified metering screen dialogs
This commit is contained in:
parent
1c344da29f
commit
0a45a2719b
3 changed files with 55 additions and 47 deletions
|
@ -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
|
||||
|
|
|
@ -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(() {
|
||||
|
|
|
@ -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));
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue