mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
fixed photography value picker overscroll
This commit is contained in:
parent
0f78fd0e3a
commit
537e19f9c8
2 changed files with 15 additions and 3 deletions
|
@ -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<T extends PhotographyValue> extends StatefulW
|
|||
class _PhotographyValuePickerDialogState<T extends PhotographyValue>
|
||||
extends State<PhotographyValuePickerDialog<T>> {
|
||||
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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue