From 2cdb2b3332cc84ee7ef6ec7f52a59620230f5ddf Mon Sep 17 00:00:00 2001 From: Simon Ding Date: Fri, 5 Jul 2024 15:24:59 +0800 Subject: [PATCH] center save button --- ui/lib/system_settings.dart | 41 +++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/ui/lib/system_settings.dart b/ui/lib/system_settings.dart index 4d7fd06..e908fa3 100644 --- a/ui/lib/system_settings.dart +++ b/ui/lib/system_settings.dart @@ -20,6 +20,8 @@ class _SystemSettingsPageState extends State { Widget build(BuildContext context) { _handleRefresh(); return Expanded( + child: Container( + padding: const EdgeInsets.fromLTRB(40, 10, 40, 0), child: RefreshIndicator( onRefresh: _handleRefresh, child: Form( @@ -39,34 +41,29 @@ class _SystemSettingsPageState extends State { return v!.trim().isNotEmpty ? null : "ApiKey 不能为空"; }, ), - Padding( - padding: const EdgeInsets.only(top: 28.0), - child: Row( - children: [ - Center( - child: ElevatedButton( - child: const Padding( - padding: EdgeInsets.all(16.0), - child: Text("保存"), - ), - onPressed: () { - // 通过_formKey.currentState 获取FormState后, - // 调用validate()方法校验用户名密码是否合法,校验 - // 通过后再提交数据。 - if ((_formKey.currentState as FormState) - .validate()) { - _submitSettings(context,_tmdbApiKeyController.text); - } - }, - ), + Center( + child: Padding( + padding: const EdgeInsets.only(top: 28.0), + child: ElevatedButton( + child: const Padding( + padding: EdgeInsets.all(16.0), + child: Text("保存"), ), - ], + onPressed: () { + // 通过_formKey.currentState 获取FormState后, + // 调用validate()方法校验用户名密码是否合法,校验 + // 通过后再提交数据。 + if ((_formKey.currentState as FormState).validate()) { + _submitSettings(context, _tmdbApiKeyController.text); + } + }, + ), ), ) ], ), )), - ); + )); } Future _handleRefresh() async {