我textStyle為elevatedButtonTheme
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Color(0xff64ffda)),
textStyle: MaterialStateProperty.all(TextStyle(color: Colors.black)),
),
),
但是它并沒有改變ElevatedButton文本顏色,這有什么問題?
它應該像我描述的那樣作業嗎?
child: ElevatedButton(
onPressed: _submit,
child: Padding(
child: Text(
AppLocalizations.key(context, 'save'),
),
),
),
uj5u.com熱心網友回復:
從檔案中,我們可以看到關于 textStyle
[textStyle] 的顏色通常不直接
foregroundColor使用,而是使用[ ]。
而對于 foregroundColor
通常使用此顏色代替 [
textStyle]的顏色。所有從 [ButtonStyle] 值計算默認值的組件計算默認值 [foregroundColor] 并使用它代替 [textStyle] 的顏色。
用于更改按鈕使用時的文本顏色 foregroundColor
更多關于ButtonStyle
uj5u.com熱心網友回復:
它沒有任何問題。它應該作業。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/362186.html
標籤:扑
