Search code examples
flutterwidthandroid-alertdialog

Flutter AlertDialog Container minimum width size controll


enter image description here

Hello mates

i was making instagram colon app with flutter and i wanted to making this pop up page but when i tried to make container size less than 100, it wasn't work and i couldn't find the way can u tell me how can i make that container width size more less then 100

enter image description here

SliverAppBar(
              floating: true,
              snap: true,
              toolbarHeight: 60,
              backgroundColor: Colors.black,
              actions: [
                IconButton(
                  onPressed: () {},
                  icon: Icon(
                    CupertinoIcons.heart,
                  ),
                ),
                IconButton(
                  onPressed: () {},
                  icon: Icon(
                    CupertinoIcons.paperplane,
                  ),
                ),
              ],
              centerTitle: false,
              // Instagram Logo Button
              title: GestureDetector(
                onTap: () {
                  print(kToolbarHeight);
                  showCupertinoDialog(
                    barrierDismissible: true,
                    context: context,
                    builder: (context) => Dialog(
                        insetPadding: EdgeInsets.zero,

                        // clipBehavior: Clip.antiAlias,
                        backgroundColor: Colors.transparent,
                        alignment: FractionalOffset(
                            0,
                            (MediaQuery.of(context).padding.top +
                                    kToolbarHeight) /
                                MediaQuery.of(context).size.height),
                        child: ClipRRect(
                          child: BackdropFilter(
                            filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
                            child: Container(
                                width: 10,
                                decoration: BoxDecoration(
                                    borderRadius:
                                        BorderRadius.all(Radius.circular(24)),
                                    color: Colors.grey[800]!.withOpacity(0.6)),
                                child: const Column(
                                  mainAxisSize: MainAxisSize.min,
                                  crossAxisAlignment:
                                      CrossAxisAlignment.stretch,
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: [
                                    Row(
                                      mainAxisSize: MainAxisSize.min,
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Icon(CupertinoIcons.person_2,
                                            size: 32, color: Colors.white),
                                        SizedBox(width: 12),
                                        Text('Following',
                                            style: TextStyle(fontSize: 18))
                                      ],
                                    ),
                                    SizedBox(
                                      height: 12,
                                    ),
                                    Row(
                                      mainAxisSize: MainAxisSize.min,
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Icon(CupertinoIcons.star,
                                            size: 32, color: Colors.white),
                                        SizedBox(width: 12),
                                        Text('Favorates',
                                            style: TextStyle(fontSize: 18))
                                      ],
                                    ),
                                  ],
                                )),
                          ),
                        )),
                  );
                },
                child: Row(
                  children: [
                    Text(
                      'Instagram',
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 32,
                      ),
                    ),
                    Icon(
                      CupertinoIcons.chevron_down,
                      color: Colors.white,
                    )
                  ],
                ),
              ),
            ),

finding new widgets for fix, tried to search on google and chargpt also looking official Docs and stackoverflows checking widget's pharams


Solution

  • changed alertdialog -> actions

    and it worked