akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.36k stars 377 forks source link

Panel body event does not work when it is collapsed, the component is in the collapse region #298

Open amed901107 opened 2 years ago

amed901107 commented 2 years ago

Describe the bug Panel body event does not work when it is collapsed, the component is in the collapse region. Close button event not working

Expected behavior the event of the close button is fired

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

Smartphone (please complete the following information):

SlidingUpPanel( // renderPanelSheet: false, controller: controller.roomsPanelController, backdropTapClosesPanel: false, isDraggable: false, backdropEnabled: true, // minHeight: Get.mediaQuery.size.height 0.12, maxHeight: Get.mediaQuery.size.height 0.82 , color: AppColors.white, borderRadius: const BorderRadius.only( topLeft: Radius.circular(24.0), topRight: Radius.circular(24.0), ), onPanelClosed: () => controller.onPanelIsClose(), onPanelOpened: () => controller.onPanelOpen(), panelBuilder: (sc) => BodyPanelRoom( keyForm: myFormCreateRoom, scrollController: sc, createRoom: () => controller.closePanelInsertRoomWithButtonClose(), onClosePanel: () => controller.closePanelInsertRoomWithButtonClose(), openPanel: () => controller.openPanelAddRoom(), ),

        collapsed: Container(
          decoration: const BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(24.0),
              topRight: Radius.circular(24.0),
            ),
          ),
          child: Center(
            child: ButtonGeneral(
                radius: 16,
                text: 'app.createRoom'.tr,
                heightButton: Get.mediaQuery.size.height * 0.06,
                widthButton: Get.mediaQuery.size.width * 0.25,
                disabledColor: AppColors.primary,
                buttonColor: AppColors.primary,
                style: Get.textTheme.headline3!.merge(
                  TextStyle(fontSize: 18.sp, color: AppColors.white),
                ),
                onPressed: () async {
                  controller.openPanelAddRoom();
                }),
          ),
        ),

class BodyPanelRoom extends StatelessWidget { const BodyPanelRoom( {required this.keyForm, required this.scrollController, required this.createRoom, required this.onClosePanel, required this.openPanel, Key? key}) : super(key: key);

//#region Variables

final Key keyForm; final ScrollController scrollController; final VoidCallback onClosePanel; final VoidCallback createRoom; final VoidCallback openPanel;

//#endregion

@override Widget build(BuildContext context) => _floatingPanel(context);

//#region Widget

Widget _floatingPanel(BuildContext context) => Container( decoration: const BoxDecoration( color: AppColors.white, borderRadius: BorderRadius.all(Radius.circular(24)), ), child: Form( key: keyForm, child: SingleChildScrollView( controller: scrollController, padding: EdgeInsets.only( left: Get.mediaQuery.size.width 0.08, right: Get.mediaQuery.size.width 0.08), child: Column(children: [ SizedBoxStatic.sizedBoxHeight16, LinedModalWithCloseAndText( text: 'app.newRoom'.tr,onPressed: onClosePanel), SizedBoxStatic.sizedBoxHeight10, Center( child: Text( "test", style: Get.textTheme.headline4!.merge(TextStyle( color: context.theme.hintColor, fontSize: 20, )), ), ), Center( child: Text( "aaaaaa", style: context.theme.textTheme.headline1!.merge(TextStyle( color: context.theme.hintColor, fontSize: 18, )), ), ), SizedBoxStatic.sizedBoxHeight26, Center( child: ButtonGeneral( radius: 16, text: 'app.createRoom'.tr, heightButton: Get.mediaQuery.size.height 0.06, widthButton: Get.mediaQuery.size.width 0.25, disabledColor: AppColors.primary, buttonColor: AppColors.primary, style: Get.textTheme.headline3!.merge( TextStyle(fontSize: 18.sp, color: AppColors.white), ), onPressed: createRoom), ), SizedBoxStatic.sizedBoxHeight80, ]), ), ), );

//#endregion } photo_2022-03-03_12-49-05