-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack overflow when use nesting NestedScrollView
s
#123590
Comments
Hi @bambinoua |
Steps to reprodurce:
Debug console:
Minimal reproduceable codeimport 'package:flutter/material.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark(),
home: Scaffold(
body: Padding(
padding: const EdgeInsets.all(30),
child: Container(
color: Colors.grey.shade700,
child: Row(
children: [
Container(
width: 150,
alignment: Alignment.topCenter,
color: Colors.grey.shade500,
child: const Center(child: Text('List1')),
),
Expanded(
child: Column(
children: const [
SizedBox(
height: 30,
child: Text('Title1'),
),
Expanded(
child: TabView(
titles: ['Tab1', 'Tab2', 'Tab3'],
panes: [
Center(child: TabPane1()),
Center(child: Text('Tab2')),
Center(child: Text('Tab3')),
],
),
),
],
),
)
],
),
),
),
),
);
}
}
class TabPane1 extends StatelessWidget {
const TabPane1({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(30),
child: Container(
color: Colors.grey.shade600,
child: Row(
children: [
Container(
width: 150,
alignment: Alignment.topCenter,
color: Colors.grey.shade500,
child: const Center(child: Text('List1.1')),
),
Expanded(
child: Column(
children: const [
SizedBox(
height: 30,
child: Text('Title1.1'),
),
Expanded(
child: TabView(
titles: ['Tab1.1', 'Tab1.2', 'Tab1.3'],
panes: [
Center(child: Text('Tab1.1')),
Center(child: Text('Tab1.2')),
Center(child: Text('Tab1.3')),
],
),
),
],
),
)
],
),
),
);
}
}
class TabView extends StatefulWidget {
const TabView({
Key? key,
required this.titles,
required this.panes,
}) : super(key: key);
final List<String> titles;
final List<Widget> panes;
@override
State<TabView> createState() => _TabViewState();
}
class _TabViewState extends State<TabView> with TickerProviderStateMixin {
late final TabController _controller;
@override
void initState() {
super.initState();
_controller = TabController(length: widget.titles.length, vsync: this);
}
@override
Widget build(BuildContext context) {
return NestedScrollView(
headerSliverBuilder: (context, innerBoxIsScrolled) => [
SliverToBoxAdapter(
child: TabBar(
controller: _controller,
isScrollable: true,
tabs: widget.titles.map((e) => Tab(text: e)).toList(),
),
),
const SliverToBoxAdapter(
child: Divider(height: 1),
)
],
body: TabBarView(
controller: _controller,
children: widget.panes,
),
);
}
} flutter doctor -v[√] Flutter (Channel stable, 3.7.8, on Microsoft Windows [Version 10.0.19045.2728]) • Flutter version 3.7.8 on channel stable at D:\Programs\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 90c64ed (8 days ago), 2023-03-21 11:27:08 -0500 • Engine revision 9aa7816315 • Dart version 2.19.5 • DevTools version 2.20.1[X] Windows Version (Unable to confirm if installed Windows version is 10 or greater) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.1) [√] Chrome - develop for the web [!] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.11.17) [√] Android Studio (version 2021.2) [√] Connected device (4 available) [√] HTTP Host Availability flutter run -v -d chrome
|
NestedScrollView
sNestedScrollView
s in Web
Thanks for providing more information! Reproduced the issue on the latest stable and master channels with above sample code. It also occurs on other platforms (such as Android) as well. Attaching full crash stack trace:
flutter doctor -v (stable and master)[✓] Flutter (Channel stable, 3.7.8, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
• Flutter version 3.7.8 on channel stable at /Users/huynq/Documents/GitHub/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 90c64ed42b (34 hours ago), 2023-03-21 11:27:08 -0500
• Engine revision 9aa7816315
• Dart version 2.19.5
• DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 32.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/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.15+0-b2043.56-8887301)
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• 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
[✓] VS Code (version 1.76.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.60.0
[✓] Connected device (3 available)
• RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 11 (API 30)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 111.0.5563.64
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found! [!] Flutter (Channel master, 3.9.0-18.0.pre.51, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
• Flutter version 3.9.0-18.0.pre.51 on channel master at /Users/huynq/Documents/GitHub/flutter_master
! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 659ba386f6 (3 hours ago), 2023-03-28 19:13:50 -0500
• Engine revision 78f9c68971
• Dart version 3.0.0 (build 3.0.0-376.0.dev)
• DevTools version 2.22.2
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 32.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/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.15+0-b2043.56-8887301)
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• 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
[✓] VS Code (version 1.76.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.60.0
[✓] Connected device (3 available)
• iPhone 8 Plus (mobile) • A6BF67EF-D048-430D-A097-324F146781DA • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 111.0.5563.110
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category. |
NestedScrollView
s in WebNestedScrollView
s
+1 👍🏼 |
I have such GUI
All of these tab sets are built on
NestedScrollView
widget.My widget's
State
class looks similar to this:nested_scroll_view_stack_overflow.mp4
As you may see there is a loop calling
And then I have the error:
The text was updated successfully, but these errors were encountered: