-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Infinity pageView how to use nextPage method? #35259
Copy link
Copy link
Closed
Description
I have an Infinity PageView,When i use
pageController.nextPage(duration: new Duration(microseconds: 300),curve: Curves.linear);
i received a problem
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: 'package:flutter/src/widgets/page_view.dart': Failed assertion: line 97 pos 7: 'positions.isNotEmpty': PageController.page cannot be accessed before a PageView is built with it.
flutter doctor -v
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale zh-Hans-CN)
• Flutter version 1.5.4-hotfix.2 at /Users/duiduikeji/flutter
• Framework revision 7a4c33425d (9 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/duiduikeji/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/duiduikeji/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_152-release-1343-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• ios-deploy 1.9.4
• CocoaPods version 1.7.0.rc.1
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 36.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.35.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.1.0
[✓] Connected device (1 available)
• EML L29 • UBV0218710000805 • android-arm64 • Android 9 (API 28)
• No issues found!
there is my code
child: Scaffold(
body: PageView.custom(
physics: CustomScrollPhysics(),
scrollDirection: Axis.vertical,
childrenDelegate: new SliverChildBuilderDelegate(
(context, index) {
return FriendsItem(
key: PageStorageKey(index),
parentPageController:controller
);
},
),
),
),
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels