Created
January 29, 2019 13:33
-
-
Save ashishrawat2911/d36a00e2cdfdb476cfac2d487e7644f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void showCupertinoSheet<T>({BuildContext context}) { | |
showCupertinoModalPopup<T>( | |
context: context, | |
builder: (BuildContext context) => CupertinoActionSheet( | |
title: const Text('Choose Options'), | |
message: const Text('Your options are '), | |
actions: <Widget>[ | |
CupertinoActionSheetAction( | |
child: const Text('One'), | |
onPressed: () { | |
Navigator.pop(context, 'One'); | |
}, | |
), | |
CupertinoActionSheetAction( | |
child: const Text('Two'), | |
onPressed: () { | |
Navigator.pop(context, 'Two'); | |
}, | |
) | |
], | |
cancelButton: CupertinoActionSheetAction( | |
child: const Text('Cancel'), | |
isDefaultAction: true, | |
onPressed: () { | |
Navigator.pop(context, 'Cancel'); | |
}, | |
)), | |
).then<void>((T value) { | |
Scaffold.of(context).showSnackBar(new SnackBar( | |
content: new Text('You clicked $value'), | |
duration: Duration(milliseconds: 50), | |
)); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment