Various Flutter widgets that are developed by Google but not by the core Flutter team

Overview

Flutter widgets

Build Status

This repository contains the source code for various Flutter widgets that are developed by Google but not by the core Flutter team.

Issues

Please file any issues, bugs, or feature requests in the this repo.

Contributing

If you wish to contribute a change to any of the existing widgets in this repo, please review our contribution guide, and send a pull request.

Comments
  • feature: support for shrinkWrap

    feature: support for shrinkWrap

    Description

    support for shrinkWrap for scrollPositionList, fix the shrinkWrap make scroll error.

    Related Issues

    fix issue: #52 ScrollablePositionedList: Provide shrinkWrap

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [x] I signed the CLA.
    • [x] All tests from running flutter test pass.
    • [x] flutter analyze does not report any problems on my PR.
    • [x] I am willing to follow-up on review comments in a timely manner.
    cla: yes 
    opened by lvfen 26
  • visibility_detector 0.3.0 breaks the build

    visibility_detector 0.3.0 breaks the build

    Steps to reproduce

    1. In Android Studio, create a new Flutter project.
    2. Add visibility_detector: ^0.3.0 to pubspec.yaml
    3. Replace main.dart with the following:
    import 'package:flutter/material.dart';
    import 'package:visibility_detector/visibility_detector.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          home: VisibilityDetector(
            key: ValueKey(1),
            child: Scaffold(),
            onVisibilityChanged: (_) {},
          ),
        );
      }
    }
    

    Expected behavior

    The app builds.

    Actual behavior

    Launching lib/main.dart on SM T585 in debug mode...
    Running Gradle task 'assembleDebug'...
    ../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/visibility_detector-0.3.0/lib/src/visibility_detector_layer.dart:126:37: Error: Property 'renderView' cannot be accessed on 'RendererBinding?' because it is potentially null.
     - 'RendererBinding' is from 'package:flutter/src/rendering/binding.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/rendering/binding.dart').
    Try accessing using ?. instead.
        assert(RendererBinding.instance.renderView != null);
                                        ^^^^^^^^^^
    ../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/visibility_detector-0.3.0/lib/src/visibility_detector_layer.dart:127:59: Error: Property 'renderView' cannot be accessed on 'RendererBinding?' because it is potentially null.
     - 'RendererBinding' is from 'package:flutter/src/rendering/binding.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/rendering/binding.dart').
    Try accessing using ?. instead.
        var clipRect = Offset.zero & RendererBinding.instance.renderView.size;
                                                              ^^^^^^^^^^
    ../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/visibility_detector-0.3.0/lib/src/visibility_detector_layer.dart:170:35: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null.
     - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    Try calling using ?. instead.
            SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
                                      ^^^^^^^^^^^^^^^^^^^^
    ../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/visibility_detector-0.3.0/lib/src/visibility_detector_layer.dart:194:10: Error: Method 'scheduleTask' cannot be called on 'SchedulerBinding?' because it is potentially null.
     - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    Try calling using ?. instead.
            .scheduleTask<void>(_processCallbacks, Priority.touch);
             ^^^^^^^^^^^^
    
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script '/home/alexey/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102
    
    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command '/home/alexey/snap/flutter/common/flutter/bin/flutter'' finished with non-zero exit value 1
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 28s
    Exception: Gradle task assembleDebug failed with exit code 1
    
    opened by alexeyinkin 20
  • Refactor visibility_detector to avoid forcing compositing.

    Refactor visibility_detector to avoid forcing compositing.

    Instead, use methods on RenderObject and new framework API to listen to compositing and determine the transform/clip.

    Removes an O(N^2) algorithm from the ancestor walk.

    Deletes the custom layer that is no longer used.

    Minor update to main.dart to be more desktop friendly.

    Tests adjusted to use new API. Removed API has no usages in internal codesearch.

    Depends on https://github.com/flutter/flutter/pull/103378

    opened by dnfield 18
  • 【ScrollablePositionedList】fix #173

    【ScrollablePositionedList】fix #173

    Description

    to fix Infinity or NaN toInt error caused by reveal value thanks for #180

    TODO

    Related Issues

    #173

    TODO

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [x] I signed the CLA.
    • [x] All tests from running flutter test pass.
    • [x] flutter analyze does not report any problems on my PR.
    • [x] I am willing to follow-up on review comments in a timely manner.
    cla: yes 
    opened by asjqkkkk 17
  • Bug fix for using VisibilityDetector with FittedBox and Transform.scale.

    Bug fix for using VisibilityDetector with FittedBox and Transform.scale.

    Description

    This is a bug fix for an existing function. The VisibilityDetector did not work correctly with widgets that change the scale because it used an offset after the scaling was applied instead of before the scaling was applied. It seems to work fine with this change. I use it in my app now (but I have backported it and use it with Flutter 1.17 because Flutter 2.x does not work correctly in Firefox on Android yet).

    Related Issues

    https://github.com/google/flutter.widgets/issues/283

    Checklist

    • [x] I signed the [CLA].
    • [x] All tests from running flutter test pass.
    • [x] flutter analyze does not report any problems on my PR.
    • [x] I am willing to follow-up on review comments in a timely manner.
    cla: yes 
    opened by dg76 15
  • ScrollablePositionedList: Laggy problem when including a StreamBuilder in the construction of the Index

    ScrollablePositionedList: Laggy problem when including a StreamBuilder in the construction of the Index

    Problem description

    I tested it on devices, Redmi Note 7 and Iphone 8, as well as emulators. I noticed that if I put any StreamBuilder in the index, both in ListView.Builder and in ScrollablePositionList the Laggy problem happens. If I remove it goes back to normal. This gets to be a big hassle, because if the user is reading a book the possibility of getting lost in the paragraphs is very large. In my case when I'm rolling down, it doesn't happen, but when I roll up, it gets to skip paragraphs. I don't know if it is correct to say that you cannot use StreamBuilder inside the ScrollablePositionList, because if I remove everyone who is inside the problem is solved. Once again I emphasize that this happens with ListView.Builder too.

    Code example

    https://drive.google.com/file/d/13e0obso6KfjsW1rElH3ne4-APFVXiWj4/view?usp=sharing

    Video example

    https://drive.google.com/file/d/1Nb9T0adSUi1tWA9MJNqu2S-KlLMcMGh9/view?usp=sharing

    Environment

    `Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.7 19H2, locale pt-BR) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 12.0.1) [✓] Android Studio (version 4.0) [✓] VS Code (version 1.49.3) [✓] Connected device (1 available)

    • No issues found! [email protected] busca-flutter % flutter doctor -v [✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.7 19H2, locale pt-BR) • Flutter version 1.20.4 at /Users/oseiasribeiro/Downloads/flutter • Framework revision fba99f6cf9 (3 weeks ago), 2020-09-14 15:32:52 -0700 • Engine revision d1bc06f032 • Dart version 2.9.2

    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/oseiasribeiro/Library/Android/sdk • Platform android-30, build-tools 30.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 12.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.0.1, Build version 12A7300 • CocoaPods version 1.9.3

    [✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 50.0.1 • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

    [✓] VS Code (version 1.49.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.15.0

    [✓] Connected device (1 available) • iPhone SE (2nd generation) (mobile) • 55711D46-E166-420B-8491-9E3D8D677C7F • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)

    • No issues found!`

    Additional details

    p: scrollable_positioned_list 
    opened by oseiasmribeiro 15
  • scrollable_positioned_list stopped worked after flutter 1.22 upgrade

    scrollable_positioned_list stopped worked after flutter 1.22 upgrade

    Problem description

    scrollable_positioned_list stopped worked after flutter 1.22 upgrade.

    Steps to reproduce

    1. Build demo app
    2. Copy scrollable_positioned_list example code https://pub.dev/packages/scrollable_positioned_list/example
    3. Run the app

    Expected behavior

    Working scrollable positioned list.

    Actual behavior

    Exception thrown

    I/flutter (15302): ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
    I/flutter (15302): The following NoSuchMethodError was thrown during a scheduler callback:
    I/flutter (15302): The method 'toDouble' was called on null.
    I/flutter (15302): Receiver: null
    I/flutter (15302): Tried calling: toDouble()
    I/flutter (15302):
    I/flutter (15302): When the exception was thrown, this was the stack:
    I/flutter (15302): #0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:51:5))
    I/flutter (15302): #1      int./  (dart:core-patch/integers.dart:28:36))
    I/flutter (15302): #2      _PositionedListState._schedulePositionNotificationUpdate.<anonymous closure> 
    package:scrollable_positioned_list/src/positioned_list.dart:321
    I/flutter (15302): #3      SchedulerBinding._invokeFrameCallback 
    package:flutter/…/scheduler/binding.dart:1117
    I/flutter (15302): #4      SchedulerBinding.handleDrawFrame 
    package:flutter/…/scheduler/binding.dart:1063
    I/flutter (15302): #5      SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> 
    package:flutter/…/scheduler/binding.dart:864
    I/flutter (15302): (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
    I/flutter (15302): ════════════════════════════════════════════════════════════════════════════════════════════════════
    I/flutter (15302): Loaded flutter-ffmpeg-android-x86.
    I/flutter (15302): Another exception was thrown: NoSuchMethodError: The method 'toDouble' was called on null.
    

    Environment

    Android Flutter doctor summary: flutter doctor -v [✓] Flutter (Channel stable, 1.22.0, on Mac OS X 10.15.6 19G2021, locale en-GB) • Flutter version 1.22.0 at /Users/art/Development/flutter • Framework revision d408d302e2 (7 days ago), 2020-09-29 11:49:17 -0700 • Engine revision 5babba6c4d • Dart version 2.10.0

    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at /usr/local/Caskroom/android-sdk/25.2.3 • Platform android-29, build-tools 28.0.3 • ANDROID_HOME = /usr/local/Caskroom/android-sdk/25.2.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 12.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.0, Build version 12A7209 • CocoaPods version 1.9.3

    [✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 44.0.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

    [✓] VS Code (version 1.49.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.15.0

    [✓] Connected device (1 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

    • No issues found!

    opened by bachras 14
  • ScrollablePositionedList: Assert when reuse the ScrollablePositionedList

    ScrollablePositionedList: Assert when reuse the ScrollablePositionedList

    Well, it's not breaking things, just an assert triggered when dispose.

    flutter doctor -v:

    [✓] Flutter (Channel master, v1.10.1-pre.42, on Mac OS X 10.14.5 18F132, locale zh-Hans-CN)
        • Flutter version 1.10.1-pre.42 at /Users/li9s/github/flutter
        • Framework revision 681178ab45 (71 minutes ago), 2019-09-09 16:47:49 +0800
        • Engine revision c9ea4dba8d
        • Dart version 2.5.0 (build 2.5.0-dev.4.0 ec7ec4ecf7)
    
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
        • Android SDK at /Users/li9s/Library/Android/sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-29, build-tools 29.0.0
        • ANDROID_HOME = /Users/li9s/Library/Android/sdk
        • ANDROID_SDK_ROOT = /Users/li9s/Library/Android/sdk
        • Java binary at: /Applications/Dev/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 10.3)
        • Xcode at /Applications/Dev/Xcode.app/Contents/Developer
        • Xcode 10.3, Build version 10G8
        • CocoaPods version 1.7.1
    
    [✓] Android Studio (version 3.4)
        • Android Studio at /Applications/Dev/Android Studio.app/Contents
        • Flutter plugin version 36.0.1
        • Dart plugin version 183.6270
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    
    [✓] Android Studio (version 3.4)
        • Android Studio at /Applications/Dev/Android Studio.app/Contents
        • Flutter plugin version 36.0.1
        • Dart plugin version 183.6270
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2019.1.3)
        • IntelliJ at /Applications/Dev/IntelliJ IDEA.app
        • Flutter plugin version 37.1.3
        • Dart plugin version 191.7830
    
    [✓] Connected device (1 available)
        • LON AL00 • TEV0216C22001731 • android-arm64 • Android 9 (API 28)
    
    
    I/flutter (12153): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
    I/flutter (12153): The following assertion was thrown while finalizing the widget tree:
    I/flutter (12153): 'package:mhwo/third_party/scrollable_positioned_list/scrollable_positioned_list.dart': Failed
    I/flutter (12153): assertion: line 157 pos 12: '_scrollableListState != null': is not true.
    I/flutter (12153): 
    I/flutter (12153): Either the assertion indicates an error in the framework itself, or we should provide substantially
    I/flutter (12153): more information in this error message to help you determine and fix the underlying cause.
    I/flutter (12153): In either case, please report this assertion by filing a bug on GitHub:
    I/flutter (12153):   https://github.com/flutter/flutter/issues/new?template=BUG.md
    I/flutter (12153): 
    I/flutter (12153): When the exception was thrown, this was the stack:
    I/flutter (12153): #2      ItemScrollController._detach (package:mhwo/third_party/scrollable_positioned_list/scrollable_positioned_list.dart:157:12)
    I/flutter (12153): #3      _ScrollablePositionedListState.dispose (package:mhwo/third_party/scrollable_positioned_list/scrollable_positioned_list.dart:192:34)
    I/flutter (12153): #4      StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4135:12)
    I/flutter (12153): #5      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1738:13)
    I/flutter (12153): #6      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1736:7)
    I/flutter (12153): #7      ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3983:14)
    I/flutter (12153): #8      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1734:13)
    I/flutter (12153): #9      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1736:7)
    I/flutter (12153): #10     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3983:14)
    I/flutter (12153): #11     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1734:13)
    I/flutter (12153): #12     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1736:7)
    I/flutter (12153): #13     MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5218:16)
    I/flutter (12153): #14     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1734:13)
    I/flutter (12153): #15     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1736:7)
    I/flutter (12153): #16     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3983:14)
    I/flutter (12153): #17     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1734:13)
    I/flutter (12153): #18     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1736:7)
    I/flutter (12153): #19     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3983:14)
    I/flutter (12153): #20     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1734:13)
    
    p: scrollable_positioned_list SPL-warning SPL-lifecycle SPL - pr 
    opened by rockingdice 14
  • Expose cacheExtent property

    Expose cacheExtent property

    Description

    This PR exposes cacheExtent property to constructors, so the user can set a custom one. If not provided, previous behavior stays (defaults to constraints.maxHeight * _screenScrollCount).

    Related Issues

    Fixes #90

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [X] I signed the CLA.
    • [X] All tests from running flutter test pass.
    • [X] flutter analyze does not report any problems on my PR.
    • [X] I am willing to follow-up on review comments in a timely manner.
    cla: yes 
    opened by Zazo032 12
  • Got NaN exception when first time scrolling to beginning or end of list

    Got NaN exception when first time scrolling to beginning or end of list

    It's happened the following exception at first time scrolling to beginning or end of list.

    Steps:

    1. When scroll list is appeared.
    2. Swipe right to scroll to the beginning of list or Swipe left to scroll to the end of list
    3. Got the following NaN exception

    ════════ Exception caught by scheduler library ═════════════════════════════════════════════════════ The following UnsupportedError was thrown during a scheduler callback: Unsupported operation: Infinity or NaN toInt

    When the exception was thrown, this was the stack: #0 double.toInt (dart:core-patch/double.dart:192:36) #1 double.round (dart:core-patch/double.dart:160:34) #2 _PositionedListState._schedulePositionNotificationUpdate. (package:scrollable_positioned_list/src/positioned_list.dart:334:26) #3 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1116:15) #4 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1063:9) ... ════════════════════════════════════════════════════════════════════════════════════════════════════

    p: scrollable_positioned_list SPL-bounds issues SPL-scroll to end 
    opened by JmyW 11
  • Added shrinkWrap to ScrollablePositionedList

    Added shrinkWrap to ScrollablePositionedList

    Description

    Added the option to use shrinkWrap in ScrollablePositionedList.

    Related Issues

    • https://github.com/google/flutter.widgets/issues/56
    • https://github.com/google/flutter.widgets/issues/52

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [ x] I signed the CLA.
    • [ x] All tests from running flutter test pass.
    • [ x] flutter analyze does not report any problems on my PR.
    • [ x] I am willing to follow-up on review comments in a timely manner.
    cla: no 
    opened by HenrikThien 11
  • The cache extent of scrollable_positioned_list is determined by height when scroll direction is horizontal

    The cache extent of scrollable_positioned_list is determined by height when scroll direction is horizontal

    Problem description

    The cache extent of scrollable_positioned_list is determined by the height of the widget when the scroll direction is horizontal. It was supposed to be determined by width.

    Steps to reproduce

    import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        const scroll = Axis.horizontal;
        return MaterialApp(
          home: Scaffold(
            appBar: AppBar(),
            body: SizedBox(
              width: scroll == Axis.horizontal ? 400 : 100,
              height: scroll == Axis.horizontal ? 100 : 400,
              child: ScrollablePositionedList.builder(
                scrollDirection: scroll,
                itemCount: 50,
                itemBuilder: (context, index) {
                  print("item $index build");
                  return Container(
                    height: 100,
                    width: 100,
                    color: index.isOdd ? Colors.blue : Colors.green,
                  );
                },
              ),
            ),
          ),
        );
      }
    }
    
    

    Expected behavior

    the cache extent should be determined by the width of the widget when the scroll direction is horizontal. 12 items(1200 pixel) should be built, 800 more than the visible width, twice the widget width. This is the behavior when the scroll direction is vertical.

    Actual behavior

    6 items(600 pixel) are built, 200 more than the visible width, twice the widget height.

    Environment

    Flutter (Channel stable, 3.3.9, on macOS 12.6 21G115 darwin-arm, locale en-AU) • Flutter version 3.3.9 on channel stable at /Users/jax/php/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision b8f7f1f986 (3 weeks ago), 2022-11-23 06:43:51 +0900 • Engine revision 8f2221fbef • Dart version 2.18.5 • DevTools version 2.15.0

    Target platform is macOS

    Additional details

    The issue is likely from this code in src/scrollable_positioned_list.dart

      double _cacheExtent(BoxConstraints constraints) => max(
            constraints.maxHeight * _screenScrollCount,
            widget.minCacheExtent ?? 0,
          );
    

    There is a workaround by wrapping with LayoutBuilder and pass the constraint as minCacheExtent

    LayoutBuilder(
                builder: (context,constraint) {
                  return ScrollablePositionedList.builder(
                    scrollDirection: scroll,
                    itemCount: 50,
                    minCacheExtent: constraint.maxWidth*2,
                    itemBuilder:(){},
                  );
                }
              ),
    
    opened by PurplePolyhedron 0
  • Synchronizing ListWheelScrollView in Flutter

    Synchronizing ListWheelScrollView in Flutter

    Problem description

    When I scroll through one list, the other list either lags or does not scroll smoothly.https://pub.dev/packages/linked_scroll_controller allows to sync lists but does not support FixedExtendScrollPhysics.

    https://pub.dev/packages/linked_scroll_controller works perfectly if we are using CampingScrollPhysics but throws an error when used with a widget that uses FixedExtendScrollPhysics. I want both the list to move Synchronizing

    Steps to reproduce

    import 'package:linked_scroll_controller/linked_scroll_controller.dart';
    
    void main() => runApp(const MyApp());
    
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'List',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          debugShowCheckedModeBanner: false,
          home: const List(),
        );
      }
    }
    
    class List extends StatefulWidget {
      const List({Key? key}) : super(key: key);
      @override
      _ListState createState() => _ListState();
    }
    
    class _ListState extends State<List> {
      late LinkedScrollControllerGroup
          _controllers; // Declare link scroll Controller
      late ScrollController
          _letters; // Declare scroll controller for first list/widget
      late ScrollController
          _numbers; // Declare scroll controller for second list/widget
    
      @override
      void initState() {
        super.initState();
        _controllers =
            LinkedScrollControllerGroup(); // Initialize link scroll controller
        _letters = _controllers
            .addAndGet(); // Attach the first list/widget scroll controller to link scroll controller
        _numbers = _controllers
            .addAndGet(); // Attach the second list/widget scroll controller to link scroll controller
      }
    
      @override
      void dispose() {
        _letters.dispose();
        _numbers.dispose();
        super.dispose();
      }
    
      @override
      Widget build(BuildContext context) {
        return Material(
          child: Directionality(
            textDirection: TextDirection.ltr,
            child: Column(
              children: [
                Expanded(
                  child: ListWheelScrollView(
                      controller: _letters,
                      physics: const FixedExtentScrollPhysics(),
                      itemExtent: 100,
                      children: [
                        for (int i = 0; i < 5; i++) ...[
                          Container(
                            color: Colors.red,
                            height: 50,
                            width: 50,
                          )
                        ]
                      ]),
                ),
                Expanded(
                  child: ListWheelScrollView(
                      controller: _numbers,
                      physics: const FixedExtentScrollPhysics(),
                      itemExtent: 100,
                      children: [
                        for (int i = 0; i < 5; i++) ...[
                          Container(
                            color: Colors.red,
                            height: 50,
                            width: 50,
                          )
                        ]
                      ]),
                ),
              ],
            ),
          ),
        );
      }
    }
    
    class _Tile extends StatelessWidget {
      final String caption;
    
      _Tile(this.caption);
    
      @override
      Widget build(_) => Container(
            margin: const EdgeInsets.all(8.0),
            padding: const EdgeInsets.all(8.0),
            height: 250.0,
            child: Center(child: Text(caption)),
          );
    }
    

    Expected behavior

    Both lists should sync and hence move synchronously.

    Actual behavior

    It's throwing a error : FixedExtentScrollPhysics can only be used with Scrollables that uses the FixedExtentScrollController

    opened by omthetheos 0
  • Fix minor typo in comments

    Fix minor typo in comments

    Description

    This PR fixes a minor typo in a comment.

    Notes: "flutter analyze" failed with following result:

    Running "flutter pub get" in flutter_simple_treeview...          2,933ms
    Analyzing flutter_simple_treeview...                                    
    
      error - Target of URI doesn't exist: 'package:url_launcher/url_launcher.dart' - example\lib\main.dart:8:8 - uri_does_not_exist
      error - The method 'launchUrl' isn't defined for the type 'Demo' - example\lib\main.dart:32:48 - undefined_method
    
    2 issues found. (ran in 18.6s)
    

    Related Issues

    Not Applicable.

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [x] I signed the CLA.
    • [x] All tests from running flutter test pass.
    • [ ] flutter analyze does not report any problems on my PR.
    • [x] I am willing to follow-up on review comments in a timely manner.
    opened by CynaCons 0
  • _ScrollablePositionedListState._scrollTo has a mistake.

    _ScrollablePositionedListState._scrollTo has a mistake.

    if _isTransitioning, it returns immediately and the client code triggers immediately as well 'cause there's no any Future to wait for to know when the scrolling completes. That is a bug. You must use Completer to notify the client code about finishing the asynchronous scrolling initiated in the post-frame callback.

      Future<void> _scrollTo({
        required int index,
        required double alignment,
        required Duration duration,
        Curve curve = Curves.linear,
        required List<double> opacityAnimationWeights,
      }) async {
        if (index > widget.itemCount - 1) {
          index = widget.itemCount - 1;
        }
        if (_isTransitioning) {
          _stopScroll(canceled: true);
          // HERE we must wait until the internal call to  _startScroll completes!!!
          SchedulerBinding.instance.addPostFrameCallback((_) {
            _startScroll(
              index: index,
              alignment: alignment,
              duration: duration,
              curve: curve,
              opacityAnimationWeights: opacityAnimationWeights,
            );
          });
        } else {
          await _startScroll(
            index: index,
            alignment: alignment,
            duration: duration,
            curve: curve,
            opacityAnimationWeights: opacityAnimationWeights,
          );
        }
      }
    
    opened by darkstarx 0
  • When scrolling up, the index of the last element becomes smaller than the index of the first element

    When scrolling up, the index of the last element becomes smaller than the index of the first element

    Problem description

    When scrolling up, the index of the last element becomes smaller than the index of the first element

    Steps to reproduce

    I took an example of an infinite list from the Block documentation, replaced the ListView with a ScrollablePositionedList and added an ItemPositionsListener.

    https://youtu.be/H1wvKraTl24

    [√] Flutter (Channel stable, 3.3.6, on Microsoft Windows [Version 10.0.22000.1098], locale ru-RU) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Android Studio (version 2021.3) [√] VS Code (version 1.72.2)

    opened by mr-slonn 0
Owner
Google
Google ❤️ Open Source
Google
Flutter package: Assorted layout widgets that boldly go where no native Flutter widgets have gone before.

assorted_layout_widgets I will slowly but surely add interesting widgets, classes and methods to this package. Despite the package name, they are not

Marcelo Glasberg 122 Dec 22, 2022
Flutter-useful-widgets - Flutter Useful Widgets

useful_widgets This package makes it easy to build apps by providing a list of simple and useful widgets. import 'package:useful_widgets/useful_widget

Ricardo Crescenti 6 Jun 20, 2022
Custom widgets and utils using Flutter framework widgets and Dart language

reuse_widgets_and_utils The custom widgets and utils using Flutter framework widgets and Dart programming language. Getting Started This project is a

null 1 Oct 29, 2021
Widgets beginner - Widgets beginner with flutter

Widgets beginner - Widgets beginner with flutter

Tukhtamurodov Sardorbek 2 Feb 6, 2022
Flutter Triple Status Button can use toggle button but in three statuses.

triple_status_button Triple Status Button. Flutter Triple Status Button can use toggle button but in three statuses. Property Description height heigh

MahdiBagjani 2 Nov 13, 2021
Flutter package: Similar to a ListView, but lets you programmatically jump to any item, by index.

indexed_list_view Similar to a ListView, but lets you programmatically jump to any item, by index. The index jump happens instantly, no matter if you

Marcelo Glasberg 244 Dec 27, 2022
Main focus is to show dynamic operation not supported in Stateless Widget of Flutter

A new Flutter project. It will count the number of donut(Though increment doesnot take place Stateless Widget). Main focus is to show dynamic operation not supported in Stateless Widget of Flutter.

Avinandan Bose 2 Sep 9, 2022
A widget displaying children in a line with an overflow indicator at the end if there is not enough space.

overflow_view A widget displaying children in a line with an overflow indicator at the end if there is not enough space. Features Renders children hor

Romain Rastel 153 Dec 19, 2022
GoogleNavBar is a Flutter widget designed by Aurelien Salomon and developed by sooxt98

google_nav_bar A modern google style nav bar for flutter. GoogleNavBar is a Flutter widget designed by Aurelien Salomon and developed by sooxt98. Gett

null 530 Dec 21, 2022
Flutter UI Widgets Flutter Package

Flutter UI Widgets Flutter Package This package makes different Flutter UI widgets implementation easy for you. Flutter UI Widgets The list of widgets

Hassan Ur Rahman 0 May 6, 2022
React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.

English | Português Flutter Hooks A Flutter implementation of React hooks: https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889 Ho

Remi Rousselet 2.6k Dec 29, 2022
Code generation for Flutter Padding widgets based on your constants

Code generation for Flutter Padding widgets based on your constants

Emanuele 14 Oct 20, 2022
Flutter widgets and themes implementing the current macOS design language.

macos_ui Flutter widgets and themes implementing the current macOS design language. NOTE: This package depends on the excellent native_context_menu pl

Reuben Turner 1.1k Jan 7, 2023
Flutter Package for Easier Creation of Home Screen Widgets

Home Widget HomeWidget is a Plugin to make it easier to create HomeScreen Widgets on Android and iOS. HomeWidget does not allow writing Widgets with F

Anton Borries 405 Dec 31, 2022
This repo is for anything that can be reusable in flutter like custom widgets 🟥, animations 🌟and more

Flutter Shortcuts This repo is for anything that can be reusable in flutter like custom widgets ?? , animations ?? and more. How to Use Just get the f

Abdelrahman Mostafa Elmarakby 91 Dec 3, 2022
A basic Flutter app that includes some native Widgets like alerts, cards, avatars, animated container, inputs, etc.

Flutter components This project was created with Flutter and some native Widgets like alerts, cards, avatars, animated container, inputs, etc. Getting

Paúl 4 Nov 15, 2021
A Flutter package which provides helper widgets for selecting single or multiple account/user from the given list.

account_selector A Flutter package which provides helper widgets for selecting single or multiple account/user from a list Supported Dart Versions Dar

Harpreet Singh 49 Oct 7, 2021
Custom Flutter widgets that makes Checkbox and Radio Buttons much cleaner and easier.

custom_radio_grouped_button Custom Radio Buttons and Grouped Check Box Button Custom Flutter widgets that makes Checkbox and Radio Buttons much cleane

Ketan Choyal 144 Sep 23, 2022
A collection of widgets for making amazing onboarding experience in your flutter applications

Pal widgets A flutter package for better onboarding. A set of amazing onboarding widgets for your flutter applications. Install package add in your pu

Apparence.io 25 Oct 7, 2022