作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
ButtonStyle 中的 MaterialStateProperty 是什么?
ThemeData(
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
backgroundColor: , //?
),
),
),
最佳答案
我假设您想知道如何为 ButtonStyle 小部件的 backgroundColor 参数分配颜色。如果是这种情况,那么只需键入如下内容:
backgroundColor: MaterialStateProperty.all(Colors.green),
要么
backgroundColor: MaterialStateProperty.all(Color(0xFF5D5F6E)),
关于flutter - 什么是 MaterialStateProperty<Color>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66542199/
如何使用buttonstyle中的shape,MaterialStateProperty shape 这对我不起作用 最佳答案 这里是一个例子,你可以这样做来改变 ElevatedButton 的形状
ButtonStyle 中的 MaterialStateProperty 是什么? ThemeData( textButtonTheme: TextButtonThemeData( sty
好的,随着新的 flutter 更新,我已经弄明白了大部分事情,但我似乎无法弄清楚提升的属性想要什么。我已经应用了 MaterialStateProperty.all 并且该属性要求位置参数,但我不知
我一直在疑惑这个问题。我希望具有不同文本的 2 个按钮具有相同的宽度。 我通过使 ElevatedButton 成为 SizedBox 的子项来实现这一点,但我担心如果用户将默认字体大小设置为大,则
我是一名优秀的程序员,十分优秀!