【发布时间】:2020-07-02 12:42:04
【问题描述】:
我正在学习使用 Flutter,现在我在设置按钮样式时偶然发现了一个问题。即使遵循此处提出的指南和问题,我的样式按钮也会出现“错误”,可能是因为我的代码中存在问题。检查按钮现在的外观:
这是我的按钮代码(问题就在那里,因为它甚至只显示按钮),我认为问题出在我里面的容器中,这可能是错误的,但我无法做到发现问题:
RaisedButton(
onPressed: () {},
textColor: Colors.white,
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0),
),
child: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: <Color>[
Colors.purple,
Color.fromARGB(1, 247, 120, 150),
],
),
),
padding: const EdgeInsets.all(20.0),
child: const Text('Empezar partida',
style: TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.bold)),
),
)
【问题讨论】:
-
你想让那个按钮完全填满吗?
-
@LonelyWolf 我的想法是内部按钮的渐变占据了整个按钮形状,这意味着稍微圆形,具有边框半径。
标签: flutter dart flutter-layout