FlatButton(
child: Text('ORDER NOW'),
onPressed: () {
Provider.of<Orders>(context, listen: false).addOrder(
cart.items.values.toList(),
cart.totalAmount,
);
cart.clear();
},
textcolor: Theme.of(context).primaryColor,
Run Code Online (Sandbox Code Playgroud) Flutter 升级后“FlatButton”已弃用,我必须改用 TextButton。我没有找到具有宽度和高度的新按钮类型的解决方案。
这是我的工作 FlatButton。如何使用 textButton 或提升按钮解决它?
_buttonPreview(double _height, double _width) {
return FlatButton(
onPressed: () { },
height: _height,
minWidth: _width,
color: Colors.grey,
padding: EdgeInsets.all(0),
child: Text(
"some text",
style: TextStyle(color: Colors.white),
),
);
}
Run Code Online (Sandbox Code Playgroud) Flutter 中 appBar 上的操作按钮默认与右侧对齐,我想将我的 FlatButton 与标题/徽标旁边的左侧对齐。
任何人都可以请指教吗?
以下是我的代码:
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: const Text('Logo'),
elevation: 0.0,
actions: <Widget>[
FlatButton(
onPressed: () {
_select(choices[0]);
},
child: Text(
'Portfolio',
style: TextStyle(
fontFamily: 'Futura',
fontSize: 12,
color: Color.fromRGBO(80, 86, 89, 100)),
)),
Run Code Online (Sandbox Code Playgroud)
干杯,凯伦