升級到顫振 3.3.6 后,我的顫振應用程式出現錯誤。將錯誤拋出為“未定義”的命名引數:高程、顏色、形狀
下面列出了我得到錯誤的片段:
return ButtonTheme(
minWidth: 110,
child: RaisedButton(
elevation: 0,
child: isLoading
? _buildLoadingIndicatorWithColor(textColor)
: Text(
text,
style: TextStyle(
color: textColor,
fontWeight: FontWeight.bold,
fontSize: 16),
),
color: communityColor,
onPressed: onPressed,
shape: new RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius))),
);
}
這是另一個片段,其中出現了類似的錯誤,并且 textColor 引數引發了相同的錯誤:
return ButtonTheme(
minWidth: minWidth,
height: height,
child: FlatButton(
textColor: Colors.black87,
child: this.child,
onPressed: this.onPressed,
),
);
這是與materialTapTargetSize相關的一個:
hasText
? TextButton(
style: TextButton.styleFrom(
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap),
onPressed: _cancelSearch,
child: OBText(localizationService.user_search__cancel),
)
: const SizedBox(
width: 15.0,
)
根據我閱讀的以下檔案https://docs.flutter.dev/release/break-changes/buttons,需要進行一些更改才能使其正常作業。感謝您的幫助,因為我是 Flutter 的新手,也是編程的初學者
uj5u.com熱心網友回復:
RaisedButton 已棄用。您可以使用 ElevatedButton()。請檢查以下代碼。
ButtonTheme(
minWidth: 110,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0,
backgroundColor: communityColor,
shape: new RoundedRectangleBorder(),
),
child: isLoading
? _buildLoadingIndicatorWithColor(textColor)
: Text(
text,
style: TextStyle(color: textColor, fontWeight: FontWeight.bold, fontSize: 16),
),
onPressed: onPressed,
),
);
對于平面按鈕()
ButtonTheme(
minWidth: minWidth,
height: height,
child: TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.black87,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: this.child,
onPressed: this.onPressed,
),
);
uj5u.com熱心網友回復:
正如KK Muhammed Fazil所說,RaisedButton將ElevatedButton
如果這對您不起作用請嘗試在終端中執行以下命令:
首先執行此命令
flutter clean
然后這個
flutter pub get
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/524347.html
標籤:扑镖
上一篇:如何使用JavaScript從GoogleApps腳本設定標記文本值?
下一篇:如何國際化串列視圖生成器
