Rod*_*y R 16
用 Theme 包装并使用 copyWith 来保留其他主题数据。
Theme(data: Theme.of(context).copyWith(
textSelectionTheme: TextSelectionThemeData(
selectionColor: Colors.green)),
child: TextFormField()
)
Run Code Online (Sandbox Code Playgroud)
小智 7
用主题包装文本小部件并将颜色分配给ThemeData内的textSelectionColor属性
请参阅下面的代码:-我已将文本选择颜色更改为绿色
Theme(
data: ThemeData(textSelectionColor: Colors.green),
child: TextField(
controller: _inputController,
decoration: InputDecoration(hintText: "Input"),
),
),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12362 次 |
| 最近记录: |