Giter Site home page Giter Site logo

Comments (10)

naoki0719 avatar naoki0719 commented on May 12, 2024 9

I think you're trying to pop a nested Navigator.
Navigator.of(context, rootNavigator: true).pop(); should fix it.

from flutter_adaptive_action_sheet.

ricardogobbo avatar ricardogobbo commented on May 12, 2024 1

I am facing the exact same error, but just on iOS platform.

from flutter_adaptive_action_sheet.

Daniel-Ioannou avatar Daniel-Ioannou commented on May 12, 2024

@DedicatedDev Not sure what's the problem. Can you please provide a small example?

from flutter_adaptive_action_sheet.

DedicatedDev avatar DedicatedDev commented on May 12, 2024

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
// );

image

from flutter_adaptive_action_sheet.

DedicatedDev avatar DedicatedDev commented on May 12, 2024

image

from flutter_adaptive_action_sheet.

DedicatedDev avatar DedicatedDev commented on May 12, 2024

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.
image

from flutter_adaptive_action_sheet.

Daniel-Ioannou avatar Daniel-Ioannou commented on May 12, 2024

@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.

DharmbirChoudhary avatar DharmbirChoudhary commented on May 12, 2024

@naoki0719 Yes it works :)

from flutter_adaptive_action_sheet.

nissaba avatar nissaba commented on May 12, 2024

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.

KCL-TelferAA avatar KCL-TelferAA commented on May 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.