Skip to content

Scrolling direction bug when in RTL mode #192

Open
@basel-sader

Description

@basel-sader

Problem description

In scrollable_positioned_list 0.1.7, using the method "scrollTo" produces smooth animations in Left to Right mode, however the indexes and positions get mixed when setting the locale of the Flutter app to any RTL language, for example Arabic.

Steps to reproduce

ScrollablePositionedList.builder(
        itemScrollController: itemScrollController,
        initialScrollIndex: 0,
        // reverse: !isLTR(context),
        scrollDirection: Axis.horizontal,
        itemBuilder: (context, index) =>
            selected != null && selected.id == categories[index].id
                ? SelectedCategoryTextWidget(
                    categories[index], index == categories.length - 1, lTR)
                : CategoryTextWidget(
                    categories[index],
                    (category) => onSelected(category, index),
                    index == categories.length - 1,
                    lTR),
        itemCount: categories.length,
      );
  1. Set the reverse to "true"
  2. Alternatively, set the locale of the Flutter app to an RTL locale or force RTL behaviour.

Expected behavior

Setting "reverse" to true would make scrolling from Right to Left smooth, and calculate the offset based on the right starting edge

Actual behavior

Setting "reverse" to true, or false, in RTL mode, breaks the scrolling smoothness (I think it might be the offset calculation that needs to be modified).

Environment

[✓] Flutter (Channel beta, 1.23.0-18.1.pre, on Mac OS X 10.15.7 19H2 x86_64, locale en-PS)
• Flutter version 1.23.0-18.1.pre at /Users/husky/flutter
• Framework revision 198df796aa (9 days ago), 2020-10-15 12:04:33 -0700
• Engine revision 1d12d82d9c
• Dart version 2.11.0 (build 2.11.0-213.1.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/husky/Library/Android/sdk
• Platform android-30, build-tools 29.0.2
• ANDROID_HOME = /Users/husky/Library/Android/sdk
• 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)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.0, Build version 12A7209
• CocoaPods version 1.8.4

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

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

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

[✓] Connected device (2 available)
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.111

• No issues found!

Additional details

https://drive.google.com/file/d/15wIxJdk37be9z95JDYwSR8ibu9sIPBwf/view?usp=sharing

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp: scrollable_positioned_listRelated to package:scrollable_positioned_list

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions