Update widget_dialog_picker_photography_value.dart

This commit is contained in:
Vadim 2023-02-05 17:14:01 +03:00
parent 537e19f9c8
commit 51e00b31dd

View file

@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart'; import 'package:lightmeter/data/models/photography_values/photography_value.dart';
@ -37,19 +36,8 @@ class PhotographyValuePickerDialog<T extends PhotographyValue> extends StatefulW
class _PhotographyValuePickerDialogState<T extends PhotographyValue> class _PhotographyValuePickerDialogState<T extends PhotographyValue>
extends State<PhotographyValuePickerDialog<T>> { extends State<PhotographyValuePickerDialog<T>> {
late T _selectedValue = widget.initialValue; late T _selectedValue = widget.initialValue;
late final _scrollController = ScrollController(); late final _scrollController =
ScrollController(initialScrollOffset: Dimens.grid56 * widget.values.indexOf(_selectedValue));
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
_scrollController.jumpTo(clampDouble(
Dimens.grid56 * widget.values.indexOf(_selectedValue),
_scrollController.position.minScrollExtent,
_scrollController.position.maxScrollExtent,
));
});
}
@override @override
void dispose() { void dispose() {