Bottomsheet

57 views
Skip to first unread message

Evripides Kyriacou

unread,
May 9, 2020, 2:00:55 PM5/9/20
to Flutter Development (flutter-dev)
Hello

How can I navigate to a new page (blank) that on initstate call bottom sheet and on close of bottom sheet to close and the page

Can I do it or is wrong?

Suzuki Tomohiro

unread,
May 9, 2020, 2:32:00 PM5/9/20
to Flutter Development (flutter-dev)
Yes, you can do it via initState when opening. Was there any obstacle?

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/3bacf3e6-22d3-4f15-8a2e-264ccfdf8c86%40googlegroups.com.

Evripides Kyriacou

unread,
May 9, 2020, 2:38:30 PM5/9/20
to Flutter Development (flutter-dev)
After I close it I get a blank page how can I close and the page when the modal dismissed

Suzuki Tomohiro

unread,
May 9, 2020, 2:42:56 PM5/9/20
to Flutter Development (flutter-dev)
You want to “await” the return value of Navigation.push(), which comes from Navigation.pop()’s argument.

On Sat, May 9, 2020 at 14:38 Evripides Kyriacou <evri...@gmail.com> wrote:
After I close it I get a blank page how can I close and the page when the modal dismissed

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

Evripides Kyriacou

unread,
May 9, 2020, 2:49:11 PM5/9/20
to Flutter Development (flutter-dev)
Than you for your reply. I am new at flutter
The modal is closing when you drop down it
How can I make this

Suzuki Tomohiro

unread,
May 9, 2020, 3:27:39 PM5/9/20
to Flutter Development (flutter-dev)
I didn’t get the problem. If you need further help, would you share your code?

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

Evripides Kyriacou

unread,
May 9, 2020, 4:50:18 PM5/9/20
to Flutter Development (flutter-dev)
Yeap
home.dart

   Navigator.of(context).push(PageRouteBuilder(


                          opaque: false,


                          pageBuilder: (BuildContext context, _, __) =>


                              imageModal()));



imagemodal.dart
class imageModalState extends State<imageModal> {

  @override
 void initState() {
   // TODO: implement initState
   super.initState();
      _modalBottomSheetMenu();
 }

 
  void _modalBottomSheetMenu() {

    WidgetsBinding.instance.addPostFrameCallback((_) async {
     await showBarModalBottomSheet(
       bounce: true,
       
         context: context,
         builder: (context, scrollController) =>
         Scaffold(  
          body:  new Container(
             height: 350.0,
             color:
                 Colors.transparent, //could change this to Color(0xFF737373),
             //so you don't have to change MaterialApp canvasColor
             child:
              Column(
               children: <Widget>[
                 IconButton(
                icon: Icon(Icons.close, color: Colors.black),
                 tooltip: 'like',
                 onPressed: () {
                  Navigator.of(context).pop();
                  Navigator.of(context).pop();

                   
                  },
             ),
                 new Container(
                     decoration: new BoxDecoration(
                         color: Colors.white,
                         borderRadius: new BorderRadius.only(
                             topLeft: const Radius.circular(10.0),
                             topRight: const Radius.circular(10.0))),
                     child: new Center(
                       child: new Text("This is a modal sheet"),
                     )),
               ],
             ),
           )
         )
         );
   });
 }
Widget build(BuildContext context) {
}
}




On Saturday, May 9, 2020 at 10:27:39 PM UTC+3, Suzuki Tomohiro wrote:
I didn’t get the problem. If you need further help, would you share your code?
On Sat, May 9, 2020 at 2:49 PM Evripides Kyriacou <evri...@gmail.com> wrote:
Than you for your reply. I am new at flutter
The modal is closing when you drop down it
How can I make this

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.

Suzuki Tomohiro

unread,
May 9, 2020, 5:23:42 PM5/9/20
to Flutter Development (flutter-dev)
Good. Then “await” the return value of await showBarModalBottomSheet() which comes from Navigation.pop()’s argument. Depending on the returned value, your imagemodal.dart can close itself.


To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/4578d28b-5d18-4280-aef5-dfdecb5be94e%40googlegroups.com.

Evripides Kyriacou

unread,
May 9, 2020, 5:34:33 PM5/9/20
to Flutter Development (flutter-dev)
Thank you again for your reply! Can you give me example of code how I can make this

Suzuki Tomohiro

unread,
May 9, 2020, 10:22:02 PM5/9/20
to Flutter Development (flutter-dev)

On Sat, May 9, 2020 at 5:34 PM Evripides Kyriacou <evri...@gmail.com> wrote:
Thank you again for your reply! Can you give me example of code how I can make this

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages