diff --git a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart index 0d30042..a8cc72a 100644 --- a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart +++ b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart @@ -1,3 +1,4 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/data/models/photography_values/photography_value.dart'; @@ -36,8 +37,19 @@ class PhotographyValuePickerDialog extends StatefulW class _PhotographyValuePickerDialogState extends State> { late T _selectedValue = widget.initialValue; - late final _scrollController = - ScrollController(initialScrollOffset: Dimens.grid56 * widget.values.indexOf(_selectedValue)); + late final _scrollController = ScrollController(); + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + _scrollController.jumpTo(clampDouble( + Dimens.grid56 * widget.values.indexOf(_selectedValue), + _scrollController.position.minScrollExtent, + _scrollController.position.maxScrollExtent, + )); + }); + } @override void dispose() { diff --git a/lib/screens/settings/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart b/lib/screens/settings/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart index e7367b8..40655b5 100644 --- a/lib/screens/settings/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart +++ b/lib/screens/settings/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart @@ -91,7 +91,7 @@ class _SelectableColorItemState extends State<_SelectableColorItem> { @override void initState() { super.initState(); - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + WidgetsBinding.instance.addPostFrameCallback((_) { if (widget.selected) { Scrollable.ensureVisible(context); }