Comments (10)
I think you're trying to pop a nested Navigator.
Navigator.of(context, rootNavigator: true).pop();
should fix it.
from flutter_adaptive_action_sheet.
I am facing the exact same error, but just on iOS platform.
from flutter_adaptive_action_sheet.
@DedicatedDev Not sure what's the problem. Can you please provide a small example?
from flutter_adaptive_action_sheet.
Thank you. I've tried to implement closed solution but it is not working.
I'm developing quiz app right now. Just replaced this role native module -> CupertinoActionSheetAction
implementation code. disabled part is for current this repo.
Navigator.of(context).pop don't close actionsheet.
showCupertinoModalPopup(
context: context,
builder: (BuildContext context) => CupertinoActionSheet(
title: const Text('Edit Photo'),
actions: [
CupertinoActionSheetAction(
child: const Text('Take New Photo',
style: TextStyle(color: Colors.black)),
onPressed: () {
Navigator.pop(context);
getImagFromGallery(ImageSource.camera);
},
),
CupertinoActionSheetAction(
child: const Text(
'Upload New Photo',
style: TextStyle(color: Colors.black),
),
onPressed: () {
Navigator.pop(context);
getImagFromGallery(ImageSource.gallery);
},
),
CupertinoActionSheetAction(
child: const Text('Delete', style: TextStyle(color: Colors.black)),
onPressed: () {
Navigator.pop(context);
},
),
CupertinoActionSheetAction(
child: const Text('Cancel'),
onPressed: () {
Navigator.pop(context);
},
),
],
),
);
// showAdaptiveActionSheet(
// context: context,
// title: const Text('Edit Photo'),
// actions: [
// BottomSheetAction(
// title: const Text('Take New Photo'),
// onPressed: () => Navigator.pop(context)),
// BottomSheetAction(
// title: const Text('Upload New Photo '),
// onPressed: () {
// //Navigator.of(context).pop();
// }),
// BottomSheetAction(title: const Text('Delete'), onPressed: () {}),
// ],
// cancelAction: CancelAction(
// title: const Text(
// 'Cancel')), // onPressed parameter is optional by default will dismiss the ActionSheet
// );
from flutter_adaptive_action_sheet.
from flutter_adaptive_action_sheet.
I've implemented Navigator.of(context).pop().
If I click one time, it does not closed and navigate parent widget.
so screen move to previous screen.
from flutter_adaptive_action_sheet.
@DedicatedDev That weird behavior, I try to reproduce it but I couldn't. I copy paste the code you provided to a example project and works as expected. If you check the lib code you will see that basically it calls showCupertinoModalPopup
for ios and showModalBottomSheet
for Android. Navigator.of(context).pop()
should pop the top-most route off the navigator, in this case is the ActionSheet and not the parent widget.
Please check the code that I used to reproduce the issue and and let me know if I missed anything
showAdaptiveActionSheet(
context: context,
title: const Text('Edit Photo'),
actions: [
BottomSheetAction(
title: const Text('Take New Photo'),
onPressed: () => Navigator.pop(context),
),
BottomSheetAction(
title: const Text('Upload New Photo '),
onPressed: () {
Navigator.of(context).pop();
},
),
BottomSheetAction(title: const Text('Delete'), onPressed: () {}),
],
cancelAction: CancelAction(
title: const Text('Cancel'),
),
);
from flutter_adaptive_action_sheet.
@naoki0719 Yes it works :)
from flutter_adaptive_action_sheet.
Normally the mechanic of an action sheet to to automatically remove its self after any sections. and so we should not have to call pop to remove the action sheet.
from flutter_adaptive_action_sheet.
Normally the mechanic of an action sheet to to automatically remove its self after any sections. and so we should not have to call pop to remove the action sheet.
I agree with this. I thought it strange that after clicking an option, the sheet did not close.
from flutter_adaptive_action_sheet.
Related Issues (10)
- [IOS] set bottomSheetColor error HOT 1
- Automatically dismiss BottomSheetAction HOT 2
- Missing functionality showing icon and changing text position HOT 3
- Minimal support for browser HOT 3
- Null_safety incompatibility HOT 2
- How to get a disabled action? HOT 1
- Remove universal_io dependency
- How to change background color in ios?
- [Android] Default Sheet Color
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_adaptive_action_sheet.