flutter - 如何改变我的高架按钮的形状
问题描述
import 'package:flutter/material.dart';
class SignInPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Time Tracker'),
elevation: 5.0,
),
body: _buildContent(),
backgroundColor: Colors.amber[50],
);
}
Widget _buildContent() {
return Padding(
padding: EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text(
'Sing in',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 32.0,
fontWeight: FontWeight.w600,
),
),
SizedBox(height: 8.0),
ElevatedButton(
child: Text('Sing in with google'),
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.purple[200],
onPrimary: Colors.black87,
elevation: 6.0,
shadowColor: Colors.yellow[200],
),
],
),
);
}
}
1_ 在这种情况下,我不知道如何更改按钮的形状,我在最后一个正方形的末尾显然有一个错误],第 41 行。请帮我解决它,我提前感谢您的帮助。
解决方案
您可以使用 Container 作为 Button 的子级,或者执行以下操作:
ElevatedButton.styleFrom(shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0),
),),
child: Text(' Elevated Button'))
推荐阅读
- javascript - js上的自动停止计时器
- microsoft-graph-api - OneDrive 权限 - 使用 Microsoft Graph API 获取完整数据
- html - 使用“输入”标签输入文本
- r - R中的sqrt(9)和sqrt(x = 9)有什么区别?
- shell - 按名称杀死特定端口上的进程
- mysql - RShiny 中的 For 循环:警告:“名称错误:0 个参数传递给 ... 需要 1 个”
- python - Django 表单发送两次邮件
- c# - 访问任务的返回值 (C#)
- java - Firebase UI:不显示 RecyclerView 项目
- java - 放置令牌失败。状态码:404 - Azure 函数 (Java) 失败由服务总线触发