Flutter onClosing callback for showModalBottomSheet

前端 未结 8 1167
梦如初夏
梦如初夏 2021-02-04 00:50

I have a showModalBottomSheet like the below, which I understand to inherit from BottomSheet (right?)

      showModalBottomSheet

        
8条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 01:46

    showBottomSheet does not return a future, now it returns a PersistentBottomSheetController

      var _scaffoldKey = GlobalKey();
      PersistentBottomSheetController persistentBottomSheetController;
    
     persistentBottomSheetController = _scaffoldKey.currentState.showBottomSheet(
        (context)=>Container(
    
        )
     );
    
     persistentBottomSheetController.closed.then(_closeModal);
    
      void _closeModal(void value) {
        print('modal closed');
      }
    

提交回复
热议问题