Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15731

How to stack two bottom sheets in flutter?

$
0
0

I want to stack two bottom sheets each other in flutter as show in photo. The upper one is shown when in error state. In photo, it builds with alert dialog. I want is with bottom sheet. How can I get it?enter image description here

Edit:Here is my code that I want to do. Lower bottom sheet is with pin field, autoComplete. autoComplete trigger StreamController, and then streamBuilder watch Error state and show dialog.

confirmPasswordModalBottomSheet(      BiometricAuthRegisterBloc biometricAuthRegBloc) {    showMaterialModalBottomSheet(      context: context,      builder: (BuildContext context) {        return StreamBuilder(            stream: biometricAuthRegBloc.biometricAuthRegisterStream,            builder: (context,AsyncSnapshot<ResponseObject>biometricAuthRegSnapShot) {              if (biometricAuthRegSnapShot.hasData) {                if (biometricAuthRegSnapShot.data!.messageState ==                    MessageState.requestError) {                  showModalBottomSheet(context: context, builder:                 (BuildContext context){                    return Container(                     width: 200,height: 200,                     child: Center(child: Text('Helllllllllo'),),);                  });                }              }              return SizedBox(                width: 100,                height: 300,                child: Column(                  crossAxisAlignment: CrossAxisAlignment.center,                  children: [                    SizedBox(                      height: margin30,                    ),                    Text(CURRENT_PIN_TITLE),                    SizedBox(                      height: margin30,                    ),                    Padding(                      padding: const EdgeInsets.only(                          left: margin60, right: margin60),                      child: PinCodeField(                        pinLength: 6,                        onChange: () {},                        onComplete: (value) {                          biometricAuthRegBloc.biometricAuthRegister(                              biometricType:_biometricAuthTypeForApi,                              password: value);                        },                      ),                    ),                    SizedBox(                      height: margin30,                    ),                    Padding(                      padding: const EdgeInsets.symmetric(horizontal:                     margin80),                      child: AppButton(                        onClick: () {},                        label: CANCEL_BTN_LABEL,                      ),                    ),                    Container(                      padding: const EdgeInsets.all(8.0),                      margin:                          EdgeInsets.symmetric(vertical: 8.0,                       horizontal: 30),                      decoration: BoxDecoration(                        color: Colors.grey,                        border: Border.all(color: Colors.black),                      ),                      child: const Text(                        FINGER_PRINT_DIALOG,                        textAlign: TextAlign.center,                      ),                    )                  ],                ),              );            });      },    );  }

When I do like that above, I get setState() or markNeedsBuild() called during build. Error and why? Sorry for my previous incomplete question.


Viewing all articles
Browse latest Browse all 15731

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>