簡體   English   中英

flutter 突然報錯命名參數child isnt defined

[英]flutter error all of a sudden the named parameter child isnt defined

我更換了筆記本電腦並重新安裝了 android studio 和 flutter

之前沒有任何錯誤和警告的應用程序突然開始拋出錯誤和警告

在此處輸入圖像描述

這是錯誤所在的代碼:

          onTap: () async {
                          showDialog(
                              context: context,
                              child: Container(
                                  height: 30,
                                  width: 30,
                                  child: Center(
                                      child: CupertinoActivityIndicator(
                                    key: UniqueKey(),
                                    radius: 20,
                                    animating: true,
                                  ))));
                          await handleFacebookLogin(context).then((user) {
                            navigationCheck(user, context);
                          }).then((_) {
                            Navigator.pop(context);
                          }).catchError((e) {
                            Navigator.pop(context);
                          });
                        },

它以前工作得很好,它在新安裝上拋出錯誤似乎有點奇怪,有人可以指導我這里有什么問題嗎?

到目前為止我嘗試過的:

  1. 通過運行清理項目緩存

    flutter clean cache

然后使緩存無效/重新啟動 Android Studio

  1. 重啟dart分析服務器

但問題還是一樣

showDialog需要context和生成builder ,而不是child級。

嘗試這個:

onTap: () async {
   showDialog(
       context: context,
       builder: (BuildContext context) { 
           return Container(
               height: 30,
               width: 30,
               child: Center(
                   child: CupertinoActivityIndicator(
                       key: UniqueKey(),
                       radius: 20,
                       animating: true,
               ))));
                   

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM