scroll to index with fixed/variable row height inside Flutter scrollable widget

Overview

scroll-to-index

This package provides the scroll to index mechanism for fixed/variable row height for Flutter scrollable widget.

Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  scroll_to_index: any

In your library add the following import:

import 'package:scroll_to_index/scroll_to_index.dart';

For help getting started with Flutter, view the online documentation.

Usage

This is a widget level library, means you can use this mechanism inside any Flutter scrollable widget.

Example for Flutter ListView

ListView(
  scrollDirection: scrollDirection,
  controller: controller,
  children: randomList.map<Widget>((data) {
  	final index = data[0];
  	final height = data[1];
    return AutoScrollTag(
      key: ValueKey(index),
      controller: controller,
      index: index,
      child: Text('index: $index, height: $height'),
      highlightColor: Colors.black.withOpacity(0.1),
    );
  }).toList(),
)

you can wrap any of your row widget which has dynamic row height

AutoScrollTag(
  key: ValueKey(index),
  controller: controller,
  index: index,
  child: child
)

with the AutoScrollController controller.

when you need to trigger scroll to a specified index, you can call

controller.scrollToIndex(index, preferPosition: AutoScrollPosition.begin)

even more, with a fixed row height, you can give it a suggested height for more efficient scrolling. there are more configuration.

final controller = AutoScrollController(
  //add this for advanced viewport boundary. e.g. SafeArea
  viewportBoundaryGetter: () => Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),

  //choose vertical/horizontal
  axis: scrollDirection,

  //this given value will bring the scroll offset to the nearest position in fixed row height case.
  //for variable row height case, you can still set the average height, it will try to get to the relatively closer offset 
  //and then start searching.
  suggestedRowHeight: 200
);

for full example, please see this Demo.

Who Uses

  • Quire - a simple, collaborative, multi-level task management tool.
Comments
  • Failed (offsetToLastState?.offset ?? 0) >= 0

    Failed (offsetToLastState?.offset ?? 0) >= 0

    I'm getting the following error.

    In my case:

    • the list items have variably sized heights
    • the list items have dynamic height (their height increase as new data is loaded)
    • the list is a fixed length and created with ListView.builder.

    The error happens occasionally.

    After the error, isAutoScrolling does not return to true unless another scrollToIndex is requested.

    Any ideas? I haven't been able to produce a reasonably sized reproduction example yet. Any ideas what the problem may be? Thanks in advance.

    E/flutter (12779): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: 'package:scroll_to_index/scroll_to_index.dart': Failed assertion: line 339 pos 14: '(offsetToLastState?.offset ?? 0) >= 0': ERROR: %%%%%%%%%%%%%%: 15, 0, 1.0, RevealedOffset(offset: -408.8262626669658, rect: Rect.fromLTRB(NaN, NaN, NaN, NaN)), 0,1,4,6,8,10,12,14,17,19,21,24,26,28,30,31,32,33,34,35,36,37,38,39,40
    E/flutter (12779): #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
    E/flutter (12779): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
    E/flutter (12779): #2      AutoScrollControllerMixin._forecastMoveUnit (package:scroll_to_index/scroll_to_index.dart:339:14)
    E/flutter (12779): #3      AutoScrollControllerMixin._scrollToIndex (package:scroll_to_index/scroll_to_index.dart:252:28)
    E/flutter (12779): <asynchronous suspension>
    E/flutter (12779): #4      AutoScrollControllerMixin.scrollToIndex.<anonymous closure> (package:scroll_to_index/scroll_to_index.dart:196:27)
    E/flutter (12779): #5      co (package:scroll_to_index/util.dart:37:26)
    E/flutter (12779): #6      AutoScrollControllerMixin.scrollToIndex (package:scroll_to_index/scroll_to_index.dart:196:12)
    
    
    opened by stuz5000 11
  • scrollToIndex not working when defining AppBar

    scrollToIndex not working when defining AppBar

    Describe the bug

    scrollToIndex is not working when defining AppBar. scrollToIndex is working as expected when no defining AppBar.

    Reproduction code

    Code working as expected when no AppBar is defined:

    
    import 'package:flutter/material.dart';
    import 'package:scroll_to_index/scroll_to_index.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Scroll To Index working as expected',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: TestPage(),
        );
      }
    }
    
    class TestPage extends StatefulWidget {
      @override
      State<StatefulWidget> createState() => _TestPageState();
    }
    
    class _TestPageState extends State<TestPage> {
      AutoScrollController _scrollController = AutoScrollController();
    
      @override
      Widget build(BuildContext context) {
        WidgetsBinding.instance!.addPostFrameCallback((_) => _scrollController
            .scrollToIndex(0, preferPosition: AutoScrollPosition.begin));
        return Scaffold(
            body: ListView(
              controller: _scrollController,
              children: [
                Container(
                  height: 550,
                  color: Colors.red,
                ),
                Container(
                  height: 100,
                  color: Colors.black26,
                ),
                AutoScrollTag(
                    key: ValueKey(0),
                    controller: _scrollController,
                    index: 0,
                    child: Container(
                      height: 320.0,
                      color: Colors.yellow,
                    )),
                Container(
                  height: 700,
                  color: Colors.blue,
                ),
              ],
            ));
      }
    
      @override
      void dispose() {
        _scrollController.dispose();
        super.dispose();
      }
    }
    
    
    

    Code not working as expected when AppBar is defined:

    import 'package:flutter/material.dart';
    import 'package:scroll_to_index/scroll_to_index.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Scroll To Index not working as expected',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: TestPage(),
        );
      }
    }
    
    class TestPage extends StatefulWidget {
      @override
      State<StatefulWidget> createState() => _TestPageState();
    }
    
    class _TestPageState extends State<TestPage> {
      AutoScrollController _scrollController = AutoScrollController();
    
      @override
      Widget build(BuildContext context) {
        WidgetsBinding.instance!.addPostFrameCallback((_) => _scrollController
            .scrollToIndex(0, preferPosition: AutoScrollPosition.begin));
        return Scaffold(
            appBar: AppBar(
              title: const Text('Text'),
            ),
            body: ListView(
              controller: _scrollController,
              children: [
                Container(
                  height: 550,
                  color: Colors.red,
                ),
                Container(
                  height: 100,
                  color: Colors.black26,
                ),
                AutoScrollTag(
                    key: ValueKey(0),
                    controller: _scrollController,
                    index: 0,
                    child: Container(
                      height: 320.0,
                      color: Colors.yellow,
                    )),
                Container(
                  height: 700,
                  color: Colors.blue,
                ),
              ],
            ));
      }
    
      @override
      void dispose() {
        _scrollController.dispose();
        super.dispose();
      }
    }
    
    
    

    To Reproduce Steps to reproduce the behavior:

    1. Load the page

    Expected behavior

    scrollToIndex should take us to the third container.

    Flutter Version:

    juancarlos@juancarlos-XPS-15-7590:~/AndroidStudioProjects/solon_flutter_app$ flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.2.0, on Linux, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Chrome - develop for the web [✓] Android Studio (version 4.1) [✓] Connected device (2 available) ! Device emulator-5554 is offline.

    • No issues found!

    Dependencies:

    scroll_to_index: ^2.0.0

    Describe on which device you found the bug: Android 11 emulator

    opened by jcblancomartinez 8
  • Possible to get current index based on current position?

    Possible to get current index based on current position?

    I am planning to return current index when user pop the navigation. Is it possible? For example, my screen is currently showing index 3 out of 15, when i scroll down the list...and lets say I am at index 6.. when i pop and come back to the screen, i want to maintain the last scrollable position which is index 6.

    I have also implemented endless scrolling with this package, so the height of the listview will always increase and each item has dynamic height.

    opened by fadhlisulaimi 8
  • Failed Assertion

    Failed Assertion

    If I try to scroll to an already visible AutoScrollTag I get this error:

    [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: 'package:scroll_to_index/scroll_to_index.dart': Failed assertion: line 381 pos 14: '(offsetToLastState?.offset ?? 0) >= 0': ERROR: %%%%%%%%%%%%%%: 2, 1, 1.0, RevealedOffset(offset: -144.0, rect: Rect.fromLTRB(0.0, 144.0, 1182.0, 200.0)), 1 #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39) #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5) #2 AutoScrollControllerMixin._forecastMoveUnit (package:scroll_to_index/scroll_to_index.dart:381:14) #3 AutoScrollControllerMixin._scrollToIndex (package:scroll_to_index/scroll_to_index.dart:271:13)

    opened by ufobm 7
  • Doesn't work when put inside CustomScrollView with SliverToBoxAdapter

    Doesn't work when put inside CustomScrollView with SliverToBoxAdapter

    I modified the example a bit to reproduce the issue.

    //Copyright (C) 2019 Potix Corporation. All Rights Reserved.
    //History: Tue Apr 24 09:29 CST 2019
    // Author: Jerry Chen
    
    import 'dart:math' as math;
    
    import 'package:flutter/material.dart';
    import 'package:scroll_to_index/scroll_to_index.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Scroll To Index Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: MyHomePage(title: 'Scroll To Index Demo'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      MyHomePage({Key key, this.title}) : super(key: key);
    
      final String title;
    
      @override
      _MyHomePageState createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      static const maxCount = 100;
      final random = math.Random();
      final scrollDirection = Axis.vertical;
    
      AutoScrollController controller;
      List<List<int>> randomList;
    
      @override
      void initState() {
        super.initState();
        controller = AutoScrollController(
            viewportBoundaryGetter: () =>
                Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),
            axis: scrollDirection);
        randomList = List.generate(maxCount,
            (index) => <int>[index, (1000 * random.nextDouble()).toInt()]);
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text(widget.title),
          ),
          body: CustomScrollView(
            slivers: [
              SliverToBoxAdapter(
                child: ListView(
                  shrinkWrap: true,
                  scrollDirection: scrollDirection,
                  controller: controller,
                  children: randomList.map<Widget>((data) {
                    return Padding(
                      padding: EdgeInsets.all(8),
                      child: _getRow(data[0], math.max(data[1].toDouble(), 50.0)),
                    );
                  }).toList(),
                ),
              )
            ],
          ),
          floatingActionButton: FloatingActionButton(
            onPressed: _scrollToIndex,
            tooltip: 'Increment',
            child: Text(counter.toString()),
          ),
        );
      }
    
      int counter = -1;
      Future _scrollToIndex() async {
        setState(() {
          counter++;
    
          if (counter >= maxCount) counter = 0;
        });
    
        await controller.scrollToIndex(counter,
            preferPosition: AutoScrollPosition.begin);
        controller.highlight(counter);
      }
    
      Widget _getRow(int index, double height) {
        return _wrapScrollTag(
            index: index,
            child: Container(
              padding: EdgeInsets.all(8),
              alignment: Alignment.topCenter,
              height: height,
              decoration: BoxDecoration(
                  border: Border.all(color: Colors.lightBlue, width: 4),
                  borderRadius: BorderRadius.circular(12)),
              child: Text('index: $index, height: $height'),
            ));
      }
    
      Widget _wrapScrollTag({int index, Widget child}) => AutoScrollTag(
            key: ValueKey(index),
            controller: controller,
            index: index,
            child: child,
            highlightColor: Colors.black.withOpacity(0.1),
          );
    }
    
    
    opened by khoadng 7
  • Highlight but not scrolling

    Highlight but not scrolling

    Highlight but not scrolling to bottom items which are not visible. I have

    SingleChildScollView(
        child:  ListView.generate( // works with this 
             child : ListView.generate( /// but not this
              )
         )
    ) 
    

    PS : I have added scrollcontroller to singlechildscrollview I read other issues but its not solving my problem

    Even if I go to that bottom item and try it scrolls back to top area where it becomes invisible

    opened by rahuldange09 6
  • scrollToIndex not working when defining SmartRefresher as parent of SingleChildScrollView

    scrollToIndex not working when defining SmartRefresher as parent of SingleChildScrollView

    Describe the bug

    scrollToIndex is not working when defining SmartRefresher as parent of SingleChildScrollView. scrollToIndexis working as expected wihout SmartRefresher as parent of SingleChildScrollView.

    Reproduction code

    Code working as expected when no SmartRefresher is defined as parent of SingleChildScrollView:

    
    import 'package:flutter/material.dart';
    import 'package:flutter/widgets.dart';
    import 'package:scroll_to_index/scroll_to_index.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Scroll To Index Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: MyHomePage(title: 'Scroll To Index Demo'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      MyHomePage({Key? key, required this.title}) : super(key: key);
    
      final String title;
    
      @override
      _MyHomePageState createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      final scrollDirection = Axis.vertical;
    
      late AutoScrollController controller;
      int count = 2;
    
      @override
      void initState() {
        super.initState();
        controller = AutoScrollController(
            viewportBoundaryGetter: () =>
                Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),
            axis: scrollDirection);
        controller.scrollToIndex(1, preferPosition: AutoScrollPosition.begin);
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text(widget.title),
          ),
          body: SingleChildScrollView(
            controller: controller,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.end,
              children: _buildChildren(),
            ),
          ),
        );
      }
    
      @override
      void dispose() {
        super.dispose();
        controller.dispose();
      }
    
      Widget _wrapScrollTag(
              {required int index,
              required AutoScrollController controller,
              required Widget child}) =>
          AutoScrollTag(
              key: ValueKey(index),
              controller: controller,
              index: index,
              child: child);
    
      List<Widget> _buildChildren() {
        List<Widget> widgets = [];
        for (int i = 0; i < count; i++) {
          widgets.add(_wrapScrollTag(
              index: i,
              controller: controller,
              child: Container(
                  height: 520.0,
                  width: 400.0,
                  color: i.isEven ? Colors.yellow : Colors.green,
                  padding:
                      new EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
                  child: Text(i.toString()))));
        }
        return widgets;
      }
    }
    
    

    Code not working as expected when SmartRefresher is defined as parent of SingleChildScrollView:

    import 'package:flutter/material.dart';
    import 'package:flutter/widgets.dart';
    import 'package:pull_to_refresh/pull_to_refresh.dart';
    import 'package:scroll_to_index/scroll_to_index.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Scroll To Index Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: MyHomePage(title: 'Scroll To Index Demo'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      MyHomePage({Key? key, required this.title}) : super(key: key);
    
      final String title;
    
      @override
      _MyHomePageState createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      final scrollDirection = Axis.vertical;
    
      final RefreshController _refreshController = RefreshController();
      late AutoScrollController controller;
      int count = 2;
    
      @override
      void initState() {
        super.initState();
        controller = AutoScrollController(
            viewportBoundaryGetter: () =>
                Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),
            axis: scrollDirection);
        controller.scrollToIndex(1, preferPosition: AutoScrollPosition.begin);
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text(widget.title),
          ),
          body: SmartRefresher(
              controller: _refreshController,
              enablePullDown: false,
              enablePullUp: true,
              onLoading: _onLoading,
              child: SingleChildScrollView(
                controller: controller,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: _buildChildren(),
                ),
              )),
        );
      }
    
      @override
      void dispose() {
        super.dispose();
        controller.dispose();
        _refreshController.dispose();
      }
    
      Widget _wrapScrollTag(
              {required int index,
              required AutoScrollController controller,
              required Widget child}) =>
          AutoScrollTag(
              key: ValueKey(index),
              controller: controller,
              index: index,
              child: child);
    
      void _onLoading() {
        _refreshController.loadComplete();
        setState(() {
          count++;
        });
      }
    
      List<Widget> _buildChildren() {
        List<Widget> widgets = [];
        for (int i = 0; i < count; i++) {
          widgets.add(_wrapScrollTag(
              index: i,
              controller: controller,
              child: Container(
                  height: 520.0,
                  width: 400.0,
                  color: i.isEven ? Colors.yellow : Colors.green,
                  padding:
                      new EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
                  child: Text(i.toString()))));
        }
        return widgets;
      }
    }
    
    

    To Reproduce Steps to reproduce the behavior:

    1. Load the page

    Expected behavior

    scrollToIndex should take us to the second container.

    Flutter Version:

    juancarlos@juancarlos-XPS-15-7590:~/AndroidStudioProjects/solon_flutter_app$ flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.2.0, on Linux, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Chrome - develop for the web [✓] Android Studio (version 4.1) [✓] Connected device (2 available)

    • No issues found!

    Dependencies:

    pull_to_refresh: ^2.0.0 scroll_to_index: ^2.0.0

    Describe on which device you found the bug: Android 11 emulator

    opened by jcblancomartinez 5
  • Cancel In Progress Scroll

    Cancel In Progress Scroll

    Thank you so much for this wonderful library. It has been a lifesaver and the highlight feature is exceptional!

    Is there a way to cancel in flight scrolls? Because scrollToIndex is asynchronous, sometimes too many scrolls get queued up.

    Ideally there's a way to get a list of active scrolls and then cancel them.

    On a side note, isAutoScrolling does not always return the correct value when multiple scrollToIndex are called.

    I'm happy to dig a bit more in depth and make a PR if you're available for answering some ScrollPosition questions. I've done a bit of research and have some experience here thanks to some synchronizing scroll work.

    opened by searchy2 5
  • When the ListView scrolls to the bottom, the bottom entry and some of the entries on the bottom cannot be scrolled to the begin position. Is there any good solution?

    When the ListView scrolls to the bottom, the bottom entry and some of the entries on the bottom cannot be scrolled to the begin position. Is there any good solution?

    When the ListView scrolls to the bottom, the bottom entry and some of the entries on the bottom cannot be scrolled to the begin position. Is there any good solution?

    opened by love-bk 5
  • Tapping last item in list doesn't bring to top.

    Tapping last item in list doesn't bring to top.

    In the example, there is a counter that tracks if the counter is greater than the number of items in the list and if so, it sets the counter to 0 and attempts to scroll to the 0th index. However, when I'm implementing this, it tries to keep scrolling to the bottom. Am I missing something?

    opened by QoLTech 5
  • Listen to index changes

    Listen to index changes

    Hi @jerrywell,

    Is it possible to listen to index changes? That would be really awesome.

    I've seen this features in other packages, but then they don't other good features scroll-to-index has.

    Thanks.

    opened by guihackmann 4
  • Scroll to index issue in a NestedScrollView

    Scroll to index issue in a NestedScrollView

    I have this issue in a NestedScrollView. The package is used correctly and works, but if it's placed in a NestedScrollView, the item that the page scrolls to will be under the headers. See video for clarification.

    In the video I first show an example where it looks like it goes right, but that's because it's at the end of the list. If I then make it scroll to something somewhere in the middle of the list, it goes behind the sliver header.

    https://user-images.githubusercontent.com/94898347/195586493-87dfd10e-5575-4968-8018-bc38ab41cbec.MP4

    I've also tried fixing it with this fix (#88), but it didn't fix the issue.

    flutter doctor -v [✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-arm, locale en-NL) • Flutter version 3.3.4 on channel stable at /Users/sepekerimu/Developer/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision eb6d86ee27 (8 days ago), 2022-10-04 22:31:45 -0700 • Engine revision c08d7d5efc • Dart version 2.18.2 • DevTools version 2.15.0

    [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/sepekerimu/Library/Android/sdk • Platform android-33, build-tools 32.1.0-rc1 • Java binary at: /Users/sepekerimu/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 14.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14A400 • CocoaPods version 1.11.3

    [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [✓] Android Studio (version 2021.3) • Android Studio at /Users/sepekerimu/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

    [✓] Android Studio (version 2021.2) • Android Studio at /Users/sepekerimu/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8815526/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

    [✓] VS Code (version 1.71.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

    [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.103

    [✓] HTTP Host Availability • All required HTTP hosts are available

    • No issues found!

    opened by appcapsergen 0
  • Unhandled Exception: Cannot get renderObject of inactive element.

    Unhandled Exception: Cannot get renderObject of inactive element.

    1. Firstly, the lastest version of this packages can not run below Flutter 3.0.
    2. And, it can't jump to the listview item, which showed previoulsy then be inactive in a long listview.builder. The exception meessage is under below.

    Can you help make it still available on Flutter 2.x and give me some suggestion on question 2.

    [VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: Cannot get renderObject of inactive element. In order for an element to have a valid renderObject, it must be active, which means it is part of the tree. Instead, this element is in the _ElementLifecycle.inactive state. If you called this method from a State object, consider guarding it with State.mounted. The findRenderObject() method was called for the following element: AutoScrollTag-[<1480198977>] #0 Element.findRenderObject. (package:flutter/src/widgets/framework.dart:4039:9) #1 Element.findRenderObject (package:flutter/src/widgets/framework.dart:4052:6) #2 AutoScrollControllerMixin._offsetToRevealInViewport (package:scroll_to_index/scroll_to_index.dart:478:27) #3 AutoScrollControllerMixin._forecastMoveUnit (package:scroll_to_index/scroll_to_index.dart:380:11) #4 AutoScrollControllerMixin._scrollToIndex (package:scroll_to_index/scroll_to_index.dart:271:13)

    opened by Rolewong6 1
  • It doesn't work when use a center key in CustomScrollView - Used for bidirectional list

    It doesn't work when use a center key in CustomScrollView - Used for bidirectional list

    Hi, I try to create a bidirectional lazy load list like the like flutter docs said https://github.com/flutter/flutter/blob/5464c5bac742001448fe4fc0597be939379f88ea/packages/flutter/lib/src/widgets/scroll_view.dart#L502-L513

    I create a gist where you can enable a disable the center key, and you can see that only highlight work, but the scrollTo not work when the center key is enable.

    how can I keep the scroll to index behavior while have the center key? or maybe do you know other way to create a list that append items to the top of the list by preserving the scroll, the solution that I used is from https://github.com/flutter/flutter/issues/21541#issuecomment-629121578

    thank you

    opened by MiniSuperDev 2
  • How do I get a current Index

    How do I get a current Index

    My concern is how do I get a currentIndex, while user is scrolling.

    I saw on AutoScrollController we don't get a index, will you please tell me how can I get a current Index ??

    opened by rajvarasdiya 0
  • support nested scroll view

    support nested scroll view

    Hi!

    I did some small changes to support nested scroll view, i.e. scrollable parent with non-scrollable list view children. Also added a demo in the sample app.

    Please kindly help to review and let me know if it is inappropriate, thank you!

    Some related issues: #22 #23 #49 #89

    opened by edingroot 2
Owner
Quire
A collaborative task management tool for breaking down goals in hierarchical lists.
Quire
Reorderable table, row, column, wrap, and sliver list that allow drag and drop of the children. https://pub.dartlang.org/packages/reorderables

** Kindly submit PR if you encounter issues and please make sure you're using stable channel releases. ** Maintaining open source software ain't easy.

Hansheng 575 Jan 5, 2023
🔁 A custom refresh indicator for flutter.

Liquid Pull To Refresh A beautiful and custom refresh indicator for flutter highly inspired from Ramotion Pull Down to Refresh. Table of contents Inst

Ayush Agarwal 1.1k Dec 23, 2022
Flutter Infinite ListView - ListView with items that can be scrolled infinitely in both directions. Maintainer: @slightfoot

Flutter Infinite ListView ListView with items that can be scrolled infinitely in both directions. Quick Usage Replace your existing ListView with Infi

Flutter Community 257 Jan 8, 2023
A Flutter package that builds a list view and notifies when the widgets are on screen.

inview_notifier_list A Flutter package that builds a ListView or CustomScrollView and notifies when the widgets are on screen within a provided area.

Vamsi Krishna 511 Dec 21, 2022
Flutter plugin that allows you to showcase your features on iOS and Android. 👌🔝🎉

ShowCaseView A Flutter package allows you to Showcase/Highlight your widgets step by step. It is inspired from Fluttery's Flutter challange. Preview I

Simform Solutions 1.1k Jan 7, 2023
Easily make Flutter apps responsive. Automatically adapt UI to different screen sizes. Responsiveness made simple. Demo: https://gallery.codelessly.com/flutterwebsites/minimal/

Responsive Framework Responsiveness made simple Responsive Framework adapts your UI to different screen sizes automatically. Create your UI once and h

Codelessly 931 Dec 25, 2022
Effortless property builder for composing maintainable Flutter UI

Niku Effortless property builder for composing maintainable Flutter UI Why Creating UI in Flutter is easy. Its declarative enables developers to contr

SaltyAom 218 Dec 30, 2022
Compare your design and current flutter layout.

pixel_perfect Put a semi-transparent image with the design over the top of the developed layout. It helps you to compare original design and current p

Kherel 45 Oct 24, 2022
This package allows you to draw dotted lines with Flutter. You can draw a beautiful dotted line.

This package allows you to draw dotted lines with Flutter. You can draw a beautiful dotted line.

Tushar Nikam 1 Feb 9, 2022
A flutter plugin for bluebooth ble device connect and control.

flutter_blue_elves A flutter plugin witch includes platform-specific implementation code for Android and/or iOS to connect and control bluetooth ble d

PineappleOilPrince 29 Dec 30, 2022
Device Preview For Flutter

Approximate how your app looks and performs on another device. Main features Preview any device from any device Change the device orientation Dynamic

null 3 May 14, 2022
NuConta Marketplace For Flutter

NuConta Marketplace telegram-cloud-document-1-5136388785566646724.mp4 Layout based in this drible project A Flutter project made using: Clean Dart tha

David Araujo 5 Nov 27, 2022
适用于 Flutter 的云片行为验证插件

flutter_yunpian_captcha 适用于 Flutter 的云片行为验证插件 屏幕截图 快速开始 安装 用法 获取 SDK 版本 初始化 SDK 开始验证 相关链接 许可证 屏幕截图 快速开始 安装 将此添加到包的 pubspec.yaml 文件中: dependencies: f

LeanFlutter 5 Mar 16, 2021
🎥 Movie app which is developed using flutter and powered by tmdb.

Fluttery Filmy ?? Movie app which is developed using flutter and powered by tmdb. Preview Screenshot Listing Screen Detail Screen What's next? Movies

Bhavik Makwana 197 Dec 28, 2022
Flutter package to get keyboard height. Can be used to display a sticker/emoji modal with correct height.

flutter_persistent_keyboard_height Flutter package to get keyboard height. The height is persisted during app sessions and keyboard states (you can us

Arshak Aghakaryan 13 Oct 17, 2022
An android application built using Flutter that computes the Body Mass Index of person and suggestion to carry ,by taking Inputs (Weight, Height, and Age), Built using Flutter

BMI Calculator ?? Our Goal The objective of this tutorial is to look at how we can customise Flutter Widgets to achieve our own beautiful user interfa

dev_allauddin 7 Nov 2, 2022
Body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women. Here is the simple program for BMI calculator in Flutter.

BMI-Calculator Body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women. Here is the simple progr

Renganathan 2 Oct 31, 2021
Body Mass Index (BMI) - a person’s weight in kilograms divided by the square of height in meters

Body Mass Index (BMI) is a person’s weight in kilograms divided by the square of height in meters. A high BMI can indicate high body fatness. BMI screens for weight categories that may lead to health problems, but it does not diagnose the body fatness or health of an individual.

Prashant Kumar Singh 9 Dec 3, 2022
Flutter Bidirectional ListView - ListView with items that can be scrolled in both directions with a fixed item count and scroll boundaries.

Flutter Bidirectional ListView ListView with items that can be scrolled and lazy loaded in up and down direction with a fixed item count and scroll bo

Christoph Rothermel 7 May 30, 2022
Flutter-sorted-chips-row - Flutter library for rendering a row of Material "Chip" buttons that gets sorted according to the given function

sorted_chips_row A Flutter Widget displaying a row of Material Chips, sorted according to the provided comparison function. How to use Adding dependen

Callstack Incubator 29 Jul 29, 2021