Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Widget for GetX Dialog?

I am currently new in GetX. I know about showDialog() method from Flutter. But, what I want to achieve is a custom dialog derived from Get.defaultDialog() using the template image attached below. In this documentation link, I know that there is a variable named: "content", which we can replace with a widget within Get.defaultDialog().

Does anyone know what does it mean? Does using this "content" can replace the entire widget of Get.defaultDialog() template layout, or is there something I have to done to achieve it? Any tips and tricks are welcome. Thank you.

Example of dialog

like image 228
Wege Avatar asked Nov 01 '25 07:11

Wege


1 Answers

  Get.dialog(
            barrierDismissible: false,
            Dialog(
              backgroundColor: AppColor.transparent,
              child: WillPopScope(
                onWillPop: () async => false,
                child: Container(
                  padding: EdgeInsets.all(10),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(20)),
                  child: Column(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Center(
                        child: Text("No Internet Connection"),
                      ),
                      SizedBox(height:10,),
                      Image.asset(AppImage.internetConnection,height:30),
                      Padding(
                        padding: EdgeInsets.symmetric(horizontal: 10),
                        child: Text("Please check your connection again,or connect to wi-fi.",),
                      ),
                      Divider(
                        color: AppColor.grey,
                        thickness: 1,
                      ),
                      Inkwell(
                        onTap: () {
                            Get.to(() => const AllVideoScreen());
                        }, child: Center(
                        child: Container(
                          height:50,
                          width: 30,
                          alignment: Alignment.center,
                          decoration: BoxDecoration(
                              color: AppColor.blackWhite,
                              borderRadius: const BorderRadius.all(Radius.circular(10))
                          ),
                          child: Text(
                             "Refresh",
                            
                          ),
                        ),
                      ),),
                    ],
                  ),
                ),
              ),
            )
        );
like image 135
Priya Developer Avatar answered Nov 02 '25 21:11

Priya Developer