如何根據圖像在顫動中創建警報對話框?

顫振開發者

在此處輸入圖像描述void cruptoalert(){ showDialog( context: context, builder: (BuildContext context) =>

       CupertinoAlertDialog(

           title: Text('Accept?'),
           content: Text('Do you accept?'),
           actions: [
             CupertinoDialogAction(child: Text("Yes"),onPressed:() {

               Navigator.pop(context);
               alert();
             }),
             CupertinoDialogAction(child: Text("No"))]),

barrierDismissible: 假, ); }我已經創建的警報對話框調用的函數,而是按照我的需要,我可以不設計,圖片鏈接在下面

什魯蒂·拉姆南丹·夏爾馬

您需要構建自定義對話框,如果我沒猜錯,您會期待這個:

class CustomView extends StatelessWidget {
  const CustomView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
            child: ElevatedButton(
                onPressed: () {
                  showFancyCustomDialog(context);
                },
                child: const Text("Open"))));
  }
}

void showFancyCustomDialog(BuildContext context) {
  Dialog fancyDialog = Dialog(
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(12.0),
    ),
    child: Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(20.0),
      ),
      height: 200.0,
      width: 200.0,
      child: Stack(
        children: <Widget>[
          Container(
            alignment: Alignment.center,
            width: double.infinity,
            height: 200,
            decoration: BoxDecoration(
              color: Colors.grey[100],
              borderRadius: BorderRadius.circular(12.0),
            ),
            child: Text(
              "Do you want to discard your\nFeedback",
              textAlign: TextAlign.center,
              style: TextStyle(
                  color: Colors.blue,
                  fontSize: 18,
                  fontWeight: FontWeight.w600),
            ),
          ),
          Container(
            width: double.infinity,
            height: 50,
            alignment: Alignment.bottomCenter,
            decoration: BoxDecoration(
              color: Colors.white,
              border: Border(
                bottom: BorderSide(width: 2.0, color: Colors.black26),
              ),
            ),
            child: Align(
              alignment: Alignment.center,
              child: Text(
                "Confirmation",
                style: TextStyle(
                    color: Colors.blue.shade900,
                    fontSize: 20,
                    fontWeight: FontWeight.w600),
              ),
            ),
          ),
          Align(
            alignment: Alignment.bottomCenter,
            child: Container(
                width: double.infinity,
                height: 50,
                decoration: BoxDecoration(
                  color: Colors.white,
                  border: Border(
                    top: BorderSide(width: 2.0, color: Colors.black26),
                  ),
                ),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Expanded(
                      child: InkWell(
                        onTap: () {
                          Navigator.of(context).pop();
                        },
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            "No",
                            style: TextStyle(
                                color: Colors.blue,
                                fontSize: 20,
                                fontWeight: FontWeight.w600),
                          ),
                        ),
                      ),
                    ),
                    VerticalDivider(
                      thickness: 1,
                      color: Colors.grey[300],
                    ),
                    Expanded(
                      child: InkWell(
                        onTap: () {
                           Navigator.of(context).pop();
                        },
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            "Yes",
                            style: TextStyle(
                                color: Colors.blue,
                                fontSize: 20,
                                fontWeight: FontWeight.w600),
                          ),
                        ),
                      ),
                    ),
                  ],
                )),
          ),
        ],
      ),
    ),
  );
  showDialog(context: context, builder: (BuildContext context) => fancyDialog);
}

在此處輸入圖片說明

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在顫振中創建帶有圖像參數的自定義對話

如何根據列 dtype 創建不同圖的組

根據提供的值在 C# 中動態創建 JSON 對象

如何根據C#中的列表創建對象

如何在顫動中更改底部工作表對話框內的文本?

如何在 JavaFXML 中創建“多選”之類的對話框?

顫動吐司對話框

在 Django 中,我如何根據在兩個模型中找到的字段自動創建多對多條目

根據向量中的級別在數據框中創建動態數量的新列

如何根據谷歌表格中每天更新的數據之間的差異創建累積報告?

根據 r Shiny 中選定的類別創建圖表餅圖

如何創建表格顫動?

如何為數據框中的每組數據創建帶有標題的子圖

如何根據參數名稱對值進行排序並在 Python 中創建表?

如何使用谷歌應用程序腳本根據創建日期插入圖像?

ImageMagick:如何根據圖像顏色創建背景顏色?

根據 parent_id 創建樹視圖

如何根據值創建具有相同結構的n個數據框?

如何對此數據集進行排序以創建合適的數據框

Android Kotlin - 警報對話框未顯示未選中的單選按鈕

在 Kotlin 中創建帶有回調的自定義對話框

如何根據屬性值合併 2 個對像以創建新對象?

如何使用兩個對象創建 R 數據框?

使用一對多映射在 Pandas 數據框中創建重複行

我們如何使用數據框對象創建和弦圖?

如何確保我的圖像在顫動中的 url 不會顯示在屏幕上而不是圖像上?

我是否需要手動銷毀在視圖模型中創建的 StateFlow 對象?

如何創建多行字符串 sf 對像以在 Leaflet 地圖中創建時間滑塊

如何在顫動中創建圓形標籤欄?