mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-02-22 20:40:40 +00:00
scroll to the first checkbox selected
This commit is contained in:
parent
1cf4793a9c
commit
71e7c88a4e
1 changed files with 21 additions and 0 deletions
|
@ -34,6 +34,26 @@ class _DialogFilterState<T> extends State<DialogFilter<T>> {
|
||||||
bool get _hasAnySelected => checkboxValues.contains(true);
|
bool get _hasAnySelected => checkboxValues.contains(true);
|
||||||
bool get _hasAnyUnselected => checkboxValues.contains(false);
|
bool get _hasAnyUnselected => checkboxValues.contains(false);
|
||||||
|
|
||||||
|
late final ScrollController _scrollController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
int i = 0;
|
||||||
|
for (; i < checkboxValues.length; i++) {
|
||||||
|
if (checkboxValues[i]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_scrollController = ScrollController(initialScrollOffset: Dimens.grid56 * i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_scrollController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
|
@ -50,6 +70,7 @@ class _DialogFilterState<T> extends State<DialogFilter<T>> {
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
controller: _scrollController,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
|
Loading…
Reference in a new issue