English 中文(简体)
是否在材料3上安装了液破碎的初级监视?
原标题:Does flutter default primary swatch to purple on material 3?
  • 时间:2023-06-17 05:01:44
  •  标签:
  • flutter

This is a flutter web project on Flutter 3.10.5. I m trying to change the border color on a textfield in flutter, and I noticed that the color is purple, even when I haven t declared purple any where in my theme or primary swatch. I easily solved the problem but I need to understand the source of this weird theming.

“code”/

“weird

因此,我只增加了一个边界颜色,并且是纯洁的,我增加了所有边界,以纠正这一变化,但我注意到,即使是曲线的颜色也是纯洁的。 我的主要监视是灰色的。

问题回答

See Dhafin Rayhan s answer to this Stack Overflow question for a workaround:

在升级到3.16波堤后, app、背景颜色、纽顿大小和空间变化

彩色来自https://api.flutter.dev/flutter/material/ThemeData/colorScheme.html” rel=“nofollow noreferer”>colorScheme Property of ThemeData。 2. 改用蓝色,看结果:

ThemeData(
  colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
  // ...
),

这里是边界颜色和曲线色的全球定义。

...
textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.grey), // <-- change color
inputDecorationTheme: InputDecorationTheme(
  enabledBorder: OutlineInputBorder(
    borderRadius: BorderRadius.all(Radius.circular(100)),
    borderSide: BorderSide(color: Colors.purple)), // <-- change color
  focusedBorder: OutlineInputBorder(
    borderRadius: BorderRadius.all(Radius.circular(100)),
    borderSide: BorderSide(color: Colors.purple)), // <-- change color
  errorBorder: OutlineInputBorder(
    borderRadius: BorderRadius.all(Radius.circular(100)),
    borderSide: BorderSide(color: Colors.red)), // <-- change color
  focusedErrorBorder: OutlineInputBorder(
    borderRadius: BorderRadius.all(Radius.circular(100)),
    borderSide: BorderSide(color: Colors.red)), // <-- change color
  filled: true,
  fillColor: Colors.white),
...




相关问题
Flutter App cannot be installed on Android TV

I m building a Flutter app that should support Android TV and Mobile devices. Despite Google Play shows that it is supported, I cannot install app on my MiBox device. While trying to install it, both ...

Moving the icon button to the right causes rendering issues

I am trying to align the icon button to the right of the Text field, I tried the row which made the icon button not centered vertically and now I am trying out the Stack widget. Here is my code - ...

热门标签