How to remove double background from alertDialog in flutter?

66 Views Asked by At

plese see the issue in this image How to remove double background from here.

This is my code. I want to remove the white background color and use same background everywhere for ios device flutter.

AlertDialog.adaptive(
          title: Text(
            title!,
            style: TextStyle(
                fontSize: Theme.of(context).textTheme.titleLarge!.fontSize),
          ),
          content: contentWidget ??
              Text(content,
                  style: TextStyle(
                      fontSize:
                          Theme.of(context).textTheme.bodyLarge!.fontSize)),
          actions: lstDialog == null
              ? [
                  TextButton(
                      child: Text(
                        UC.lang!.ok!,
                        style: TextStyle(
                            fontSize: Theme.of(context)
                                .textTheme
                                .titleLarge!
                                .fontSize),
                      ),
                      onPressed: () {
                        if (canClose == null || canClose()) {
                          UC.popScene();
                        }
                      })
                ]
              : lstDialog.reversed
                  .filter((item) => item != null)
                  .map(
                    (dlg) => TextButton(
                        style: ButtonStyle(
                          backgroundColor: MaterialStateProperty.all<Color?>(
                            dlg!.color ?? null,
                          ),
                        ),
                        child: Text(
                          dlg.label!,
                          style: TextStyle(
                              fontSize: Theme.of(context)
                                  .textTheme
                                  .titleLarge!
                                  .fontSize),
                        ),
                        onPressed: () {
                          if (canClose == null || canClose()) {
                            UC.popScene();
                          }
                          if (dlg.onPress != null) {
                            dlg.onPress!();
                          }
                        }),
                  )
                  .toList(),
        );

Calling from this Function. You can change values and check from list.

List<Map> confirmBoxData = [
      {
        "value": 20,
        "title": "Items",
        "icon": Icons.menu,
      },
      {
        "value": 10,
        "title": "Attempted",
        "icon": UCIcons.icomoon_eye_3,
      },
      {
        "value": 10,
        "title": "Unattempted",
        "icon": UCIcons.icomoon_eye_blocked_2,
      },
      {
        "value": 3,
        "title": "Bookmarked",
        "icon": UCIcons.icomoon_bookmark_2,
      },
      {
          "value": "",
          "title": "Time Left",
          "icon": UCIcons.icomoon_24px_timer,
      },
    ];
    simpleDialog(
        "End Test?",
        [
          DialogAction("Exit", onPress: () {
            print("end test");
          }),
          DialogAction("Cancel"),
        ],
        ctx: context,
        SingleChildScrollView(
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    ...confirmBoxData
                        .map(
                          (element) => Container(
                            child: Container(
                              height: 50,
                              padding:
                                  const EdgeInsets.only(left: 10, right: 10),
                              constraints: BoxConstraints(maxHeight: 50),
                              child: Row(
                                crossAxisAlignment: CrossAxisAlignment.center,
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Container(
                                    child: Row(
                                      children: <Widget>[
                                        Icon(
                                          element["icon"],
                                          size: 24,
                                          color: Theme.of(context).primaryColor,
                                        ),
                                        const SizedBox(width: 10),
                                        Text(
                                          element["title"],
                                          style: TextStyle(
                                              fontSize: Theme.of(context)
                                                  .textTheme
                                                  .bodyMedium!
                                                  .fontSize),
                                          overflow: TextOverflow.ellipsis,
                                        ),
                                      ],
                                    ),
                                  ),
                                  Text(
                                          element["value"],
                                          style: TextStyle(
                                              fontSize: Theme.of(context)
                                                  .textTheme
                                                  .titleLarge!
                                                  .fontSize),
                                          textAlign: TextAlign.end,
                                        ),
                                ],
                              ),
                            ),
                          ),
                        )
                        .toList(),
                  ],
                ),
              ));
  }

Plese tell me how to fix this issue.

enter image description here

0

There are 0 best solutions below