Repository navigation
Description
Having an extra scrollbar on my showCupertinoModalPopup which causes an internal flutter exception (All Exception Enabled) when the user clicks or drags it. Please see the image and the example code below:
Why does the dialog show scroll?, is there any way to remove it
Example Flutter Code
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: 'Material App',
home: Home(),
);
}
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
int currentSelectedNotification = 0;
var _filterPhoneOptions = [
'Option 1',
'Option 2',
'Option 3',
'Option 4',
'Option 5',
'Option 6',
'Option 7',
'Option 8',
'Option 9',
];
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Material App Bar'),
),
body: Center(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
'showCupertinoModalPopup + CupertinoPicker shows scroll on right top corner while user scrolls the CupertinoPicker. if user clicks the scrolls flutter throws an exeception.',
textAlign: TextAlign.justify,
),
),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () async {
await showCupertinoModalPopup(
semanticsDismissible: false,
context: context,
builder: (BuildContext cnt) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Material(
color: Colors.transparent,
child: CupertinoActionSheet(
title: Text("Some Title",
style: const TextStyle(
fontSize: 30,
)),
message: _buildPhoneFilter(),
actions: <Widget>[
CupertinoActionSheetAction(
child: Text("Confirm"),
onPressed: () {
Navigator.pop(context, 1);
},
),
],
cancelButton: CupertinoActionSheetAction(
isDefaultAction: true,
child: Text("Cancel"),
onPressed: () {
Navigator.pop(context, 0);
},
),
),
);
});
},
) as int;
},
icon: Icon(Icons.add),
label: Text('bottomsheet'),
),
);
}
Widget _buildPhoneFilter() => ConstrainedBox(
constraints: BoxConstraints(maxHeight: 48, maxWidth: 100),
child: CupertinoPicker(
scrollController: FixedExtentScrollController(),
useMagnifier: true,
magnification: 1,
itemExtent: 40,
onSelectedItemChanged: (int index) {
currentSelectedNotification = index;
},
children: new List<Widget>.generate(_filterPhoneOptions.length,
(int index) {
return Center(
child: Text(
_filterPhoneOptions[index],
overflow: TextOverflow.clip,
style: TextStyle(
color: Colors.black,
fontSize: 15,
letterSpacing: -0.4,
fontWeight: FontWeight.w400),
),
);
}),
),
);
}
flutter doctor -v
flutter doctor -v ``` [✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H15, locale en-US) • Flutter version 1.22.3 at /Users/XXX/Documents/flutter • Framework revision 8874f21 (3 weeks ago), 2020-10-29 14:14:35 -0700 • Engine revision a1440ca392 • Dart version 2.10.3[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/XXX/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.9.3
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (1 available)
• iPhone 11 Pro (mobile) • CCDD6B4D-C6B0-48AF-8BE5-090E0403F2B8 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)
</details>

Activity
sidrao2006 commentedon Nov 18, 2020
Hello @edwin-alvarez ,
Could you please post the outputs of
flutter run -vandflutter doctor -v?Thank you!
[-]showCupertinoModalPopup scrollbar exception.[/-][+]showCupertinoModalPopup shows not expected scrollbar[/+]edwin-alvarez commentedon Nov 18, 2020
@sidrao2006 , updated.
pedromassangocode commentedon Nov 19, 2020
flutter doctor -v
edwin-alvarez commentedon Nov 19, 2020
@pedromassangocode , thanks for also checking on 1.24. hope we can get some help to figure out why there is a scroll.
Did you include your CupertinoPicker inside a Container(decoration:borderRadius) for the rounded shape?
pedromassangocode commentedon Nov 20, 2020
No, I just copy/pasted your code and ran it. Hmmm looks like there is a breaking change here.
Cc @HansMuller
[-]showCupertinoModalPopup shows not expected scrollbar[/-][+]showCupertinoModalPopup shows unexpected scrollbar[/+]simrat39 commentedon Dec 24, 2020
This happens due to the same reason as #36474.
To fix this you can handle the ScrollNotification right above the CupertinoPicker
xu-baolin commentedon Dec 24, 2020
Can be fixed by #71843
edwin-alvarez commentedon Dec 30, 2020
I tried @simrat39 workaround and it worked 👍
github-actions commentedon Aug 7, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.