- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 Flutter 的新手。
这是我的代码,
对于 ElevatedButton,
ElevatedButton(
onPressed: () {
// Add your onPressed code here!
},
child: Text("Login"),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
AppColors.SecondaryColor),
foregroundColor: MaterialStateProperty.all<Color>(
AppColors.PrimaryColor))),
对于轮廓按钮,
OutlinedButton(
onPressed: () {
// Add your onPressed code here!
},
child: Text("Register Now"),
style: OutlinedButton.styleFrom(
side: BorderSide(width: 2, color: AppColors.SecondaryColor),
))
我的问题是为什么我必须对 OutlinedButton 使用 styleFrom 而不是 ButtonStyle?如果将 OutlinedButton.styleFrom 替换为 ButtonStyle,则会出现错误。为什么?
最佳答案
OutlinedButton(
onPressed: null,
child: Text('Outlined Button'),
style: ButtonStyle(
side: MaterialStateProperty.all(
BorderSide.lerp(
BorderSide(
style: BorderStyle.solid,
color: Color(0xffe4e978),
width: 10.0,
),
BorderSide(
style: BorderStyle.solid,
color: Color(0xffe4e978),
width: 10.0,
),
10.0),
),
),
),
输出:
关于Flutter:ButtonStyle() 和 .styleFrom() 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64764169/
我一直在努力使按钮样式与 API 级别 16 一起工作(API 级别 22 工作得很好)。我解决了用 buttonStyle 替换 android:buttonStyle @style/bu
使用 Xcode 11 Beta 5,我收到警告: "'buttonStyle' is deprecated: Use concrete 'PrimitiveButtonStyle' types di
我设计了一个按钮,如下所示,但是收到了一些错误消息。 android:background="@drawable/buttonshape" android:shadowColor="#
我正在使用自定义 ButtonStyle 创建一个 Button。我希望这个按钮样式支持两种不同的“外观”——圆形或圆角矩形。为此,我为外观情况定义了一个枚举,并将其传递给 ButtonStyle,以
要在 SwiftUI 中设置按钮样式,根据我的理解,您需要扩展 ButtonStyle 并实现 func makeBody(configuration: Self.Configuration) ->
我正在尝试创建一个自定义 ButtonStyle,它提供一些默认值但也可以覆盖。 例如,在 iOS 上,DefaultButtonStyle 默认将文本着色为蓝色,但您可以通过指定 foregroun
我是 Flutter 的新手。 这是我的代码, 对于 ElevatedButton, ElevatedButton( onPressed: () {
我偶然发现了 Button 的奇怪行为SwiftUI 中的 s 结合自定义 ButtonStyle . 我的目标是创建一个自定义 ButtonStyle带有某种“后推动画”。我为此使用了以下设置: s
我在将按钮样式应用到主题上时遇到问题,但直接应用到按钮上效果很好。知道这里有什么问题吗? 主题.xml @style/ButtonAppTheme styles.xml
我正在运行一个 PHP 脚本,当我在我的 VPS 上而不是在 web-server 上托管文件时出现此错误. 这里是错误: Notice: Undefined index: buttonstyle i
我正在学习关于 creating custom buttons 的教程.如果我直接将样式应用到按钮,它会起作用,但如果我使用 android:buttonStyle 将样式应用到主题,它就不起作用。
我有这个主题, @style/MyButtonStyle 我需要为按钮定义另一种样式(称为 MyButtonStyleDealer)。 使用下面的代码我得到错误 android:butto
所以,我遇到了这个奇怪的问题:我的应用非常简单,主要 Activity 只有一个按钮, list 中为 Activity 设置了自定义主题。 我可以确认主题有效并被选中,因为我可以更改 Activit
在 SwiftUI 中,您可以使用 tracking View modifier 在 Text View 上设置字体跟踪(字母间距): Text("Hello, World!") .trackin
我目前有一个 ButtonStyle 定义如下: struct RoundedButtonRed: ButtonStyle { func makeBody(configuration: Confi
我想为明暗模式的按钮设置自定义 buttonStyle 修饰符。如何根据亮或暗模式更改按钮样式修饰符?我想为我的按钮设置明暗模式的自定义修饰符。 这是我的按钮代码, Button(action: {
我正在使用 com.android.support:appcompat-v7:22.1.1 此属性 android:buttonStyle 不是为每个按钮设置该样式,我需要在每个按钮上手动设置 and
我想在 SwiftUI 中创建一个自定义按钮,我想在整个应用程序中重用它。该按钮基本上只是一个可点击的图像,上面没有标签。 我考虑为它创建一个自定义 ButtonStyle。 不过,我在遵守 Butt
我正在制作自己的自定义按钮样式以简化按钮的外观和感觉。根据按钮是否被禁用,我想更改外观。我发现能够做到这一点的唯一方法是通过 isDisabled从顶部的属性(property)。有没有办法直接从 B
用自定义按钮样式替换标准按钮样式后,该按钮在 tvOS 上不再可选(在 iOS 上按预期工作)。在 PlainButtonStyle() 中是否有我缺少的特殊修饰符?还是 SwiftUI 中的错误?
我是一名优秀的程序员,十分优秀!