-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to Reproduce
Use this simple app:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
final String title;
MyHomePage({Key? key, required this.title}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final pager = PageController();
int current = 0;
@override
Widget build(BuildContext context) {
return CupertinoTabScaffold(
resizeToAvoidBottomInset: true,
tabBar: CupertinoTabBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.filter_1),
label: 'Red',
),
BottomNavigationBarItem(
icon: Icon(Icons.filter_2),
label: 'Green',
),
BottomNavigationBarItem(
icon: Icon(Icons.filter_3),
label: 'Blue',
),
BottomNavigationBarItem(
icon: Icon(Icons.filter_4),
label: 'Yellow',
),
],
currentIndex: current,
iconSize: 24.0,
activeColor: CupertinoTheme.of(context).primaryColor,
inactiveColor: CupertinoColors.inactiveGray,
onTap: (page) {
setState(() => current = page);
if (pager.hasClients) pager.animateToPage(current, duration: kThemeAnimationDuration, curve: Curves.easeInOut);
},
),
tabBuilder: (context, index) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('Test'),
),
resizeToAvoidBottomInset: true,
child: PageView(
controller: pager,
onPageChanged: (page) {
setState(() => current = page);
},
children: [
Container(color: Colors.red),
Container(color: Colors.green),
Container(color: Colors.blue),
Container(color: Colors.yellow),
],
),
);
},
);
}
}Expected results:
- The tabs below should change as we swipe between the pages.
- By tapping on the tabs below, the pages should change.
Actual results:
- Tabs don't change,
CupertinoTabBardoesn't pick up itscurrentIndex. - Pages don't follow the tabs. Afer the third tap, you'll start getting "ScrollController attached to multiple scroll views" errors.
Doc
``` [√] Flutter (Channel dev, 2.3.0-1.0.pre, on Microsoft Windows [Version 10.0.19042.985], locale en-US) • Flutter version 2.3.0-1.0.pre at E:\Android\flutter-dev • Upstream repository https://github.com/flutter/flutter.git • Framework revision d97f41c (3 weeks ago), 2021-04-30 12:35:21 -0700 • Engine revision e7939e0 • Dart version 2.14.0 (build 2.14.0-48.0.dev)[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at E:/Android/Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = E:/Android/Sdk
• ANDROID_SDK_ROOT = e:\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.5)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31229.75
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• 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.8+10-b944.6842174)
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.985]
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.62
! Doctor found issues in 2 categories.
</details>