我在這里遇到下一個問題。我使用一個高架按鈕來保存功能(見圖)
我不喜歡按鈕的位置,并將按鈕的位置進一步降低。
return AlertDialog(
content: Form(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
TextFormField(
onChanged: (String txt) => item = txt,
onFieldSubmitted: (String txt) => save(),
validator: (String? value) {
if(value!.isEmpty) {
return 'Please enter a value';
}
return null;
},
),
ElevatedButton(
child: Text('Save', style: TextStyle(color: Colors.white),),
onPressed: save,
style: ElevatedButton.styleFrom(
primary: Color.fromRGBO(23, 152, 185, 100),
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20),
)
)
],
),
)
);
}
uj5u.com熱心網友回復:
你實際上可以在這里做很多事情,但我認為最簡單的是放置
const SizedBox(
height: 10.0, // height you want
)
TextFormField和之間ElevatedButton
uj5u.com熱心網友回復:
您可以將您包裹ElevatedButton在Padding小部件內,然后將頂部填充設定為您想要的距離
Padding(
padding: const EdgeInsets.only(top: 8.0), //The distance you want
child: ElevatedButton(
child: Text('Save', style: TextStyle(color: Colors.white),),
onPressed: save,
style: ElevatedButton.styleFrom(
primary: Color.fromRGBO(23, 152, 185, 100),
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20),
),
),
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/398604.html
上一篇:顫動,迭代firebasecollection中的檔案
下一篇:帶有文本的顫動圓圈復選框
