From 2c3da3bae4ae447cc7f6a7180e47d033a68f45de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=BB=8B=E6=B6=A6?= <807046079@qq.com> Date: Tue, 22 Oct 2024 00:11:10 +0800 Subject: [PATCH] update ui --- lib/common/constant.dart | 9 +- lib/main.dart | 7 + lib/view/account/edit/account_edit.dart | 2 +- lib/view/account/list/enter.dart | 2 +- .../account_user_detail_buttom_sheet.dart | 2 +- lib/view/home/widget/header_card.dart | 2 +- lib/view/navigation/navigation.dart | 2 +- .../navigation/widget/user_drawer_header.dart | 2 +- lib/view/share/home/widget/account_total.dart | 2 +- .../edit/transaction_category_edit.dart | 13 +- .../transaction_detail_bottom_sheet.dart | 3 - .../transaction/flow/transaction_flow.dart | 22 +-- .../flow/widget/condition_bottom_sheet.dart | 151 +++++++++--------- .../share/transaction_share_bottom_sheet.dart | 4 +- .../forgetPassword/user_forgetPassword.dart | 20 +-- lib/view/user/login/user_login.dart | 18 +-- .../password/update/user_password_update.dart | 20 +-- lib/view/user/register/user_register.dart | 20 +-- lib/view/user/widget/enter.dart | 4 + lib/view/user/widget/submit_buttom.dart | 22 +++ lib/widget/amount/amount_input.dart | 3 +- .../category/category_icon_and_name.dart | 4 +- lib/widget/common/common_expansion_list.dart | 4 +- lib/widget/icon/circular_icon.dart | 2 +- 24 files changed, 150 insertions(+), 190 deletions(-) create mode 100644 lib/view/user/widget/enter.dart create mode 100644 lib/view/user/widget/submit_buttom.dart diff --git a/lib/common/constant.dart b/lib/common/constant.dart index 20637144..372e5b50 100644 --- a/lib/common/constant.dart +++ b/lib/common/constant.dart @@ -23,12 +23,11 @@ class Constant { static init() { radius = 12.0.sp; buttomSheetRadius = 28.0.sp; - smallPadding = 8.0.sp; - padding = 16.0.sp; - largePadding = 24.0.sp; - margin = 8.0.sp; - buttomHight = 320.0.h; + buttomHight = 320.h; buttomLetterSpacing = 4.0.sp; + + iconSize = 24; + iconlargeSize = 32; } } diff --git a/lib/main.dart b/lib/main.dart index 24925dd2..042cb356 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -98,6 +98,13 @@ class MyApp extends StatelessWidget { shadowColor: ConstantColor.shadowColor, surfaceTintColor: Colors.white, ), + outlinedButtonTheme: OutlinedButtonThemeData( + style: OutlinedButton.styleFrom( + side: BorderSide(color: Colors.grey), + foregroundColor: Colors.grey, + shape: const StadiumBorder(side: BorderSide(style: BorderStyle.none)), + ), + ), elevatedButtonTheme: ElevatedButtonThemeData( style: ButtonStyle( backgroundColor: WidgetStatePropertyAll(Colors.blue), diff --git a/lib/view/account/edit/account_edit.dart b/lib/view/account/edit/account_edit.dart index 52466e0b..b9786a9d 100644 --- a/lib/view/account/edit/account_edit.dart +++ b/lib/view/account/edit/account_edit.dart @@ -70,7 +70,7 @@ class AccountEditState extends State { appBar: AppBar( title: Text(mode == AccountEditMode.add ? "添加账本" : "编辑账本"), actions: [ - IconButton(icon: Icon(Icons.save, size: 24), onPressed: _onSave), + IconButton(icon: Icon(Icons.save, size: Constant.iconSize), onPressed: _onSave), ], ), body: SingleChildScrollView( diff --git a/lib/view/account/list/enter.dart b/lib/view/account/list/enter.dart index 266510c4..f6b94940 100644 --- a/lib/view/account/list/enter.dart +++ b/lib/view/account/list/enter.dart @@ -22,7 +22,7 @@ Widget _buildLeading(AccountModel account, int selectAccountId) { child: Container(color: account.id == selectAccountId ? ConstantColor.primaryColor : Colors.white), ), SizedBox(width: Constant.margin), - Icon(account.icon, size: Constant.iconlargeSize), + Icon(account.icon, size: Constant.iconSize), SizedBox(width: Constant.margin), ]); } diff --git a/lib/view/account/user/detail/account_user_detail_buttom_sheet.dart b/lib/view/account/user/detail/account_user_detail_buttom_sheet.dart index 7d121055..3ee8fc3f 100644 --- a/lib/view/account/user/detail/account_user_detail_buttom_sheet.dart +++ b/lib/view/account/user/detail/account_user_detail_buttom_sheet.dart @@ -161,7 +161,7 @@ class _AccountUserDetailButtomSheetState extends State { padding: EdgeInsets.symmetric(horizontal: Constant.padding), child: Text( "${_bloc.account.timeLocation.name} ${DateFormat.Md().format(_bloc.getTZDateTime(start))} - ${DateFormat.Md().format(_bloc.getTZDateTime(end))}", - style: TextStyle(fontSize: ConstantFontSize.bodySmall), + style: TextStyle(fontSize: ConstantFontSize.body), ), ); } diff --git a/lib/view/navigation/navigation.dart b/lib/view/navigation/navigation.dart index d1e11b3b..9ed3cc36 100644 --- a/lib/view/navigation/navigation.dart +++ b/lib/view/navigation/navigation.dart @@ -94,7 +94,7 @@ class _NavigationState extends State { return IndexedStack(index: index, children: _pages); }, ), - floatingActionButton: FloatingActionButton(onPressed: _onAdd, child: const Icon(Icons.add)), + floatingActionButton: FloatingActionButton(onPressed: _onAdd, child: Icon(Icons.add, size: Constant.iconSize)), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, bottomNavigationBar: const _BottomNavigationBar(), endDrawer: const UserDrawer(), diff --git a/lib/view/navigation/widget/user_drawer_header.dart b/lib/view/navigation/widget/user_drawer_header.dart index 61b73c16..a795d5e7 100644 --- a/lib/view/navigation/widget/user_drawer_header.dart +++ b/lib/view/navigation/widget/user_drawer_header.dart @@ -79,7 +79,7 @@ class _UserDrawerHeaderState extends State { Clipboard.setData(ClipboardData(text: user.uniqueUsername)); CommonToast.tipToast("用户名已复制"); }, - child: Icon(Icons.copy_outlined, color: Colors.white, size: 18)) + child: Icon(Icons.copy_outlined, color: Colors.white, size: ConstantFontSize.body)) ], ))); } diff --git a/lib/view/share/home/widget/account_total.dart b/lib/view/share/home/widget/account_total.dart index c23bdbd7..0692f478 100644 --- a/lib/view/share/home/widget/account_total.dart +++ b/lib/view/share/home/widget/account_total.dart @@ -27,7 +27,7 @@ class AccountTotal extends StatelessWidget { children: [ Column( children: [ - Icon(icon, size: 36, color: ConstantColor.primaryColor), + Icon(icon, size: Constant.iconlargeSize, color: ConstantColor.primaryColor), Text( text, style: TextStyle( diff --git a/lib/view/transaction/category/edit/transaction_category_edit.dart b/lib/view/transaction/category/edit/transaction_category_edit.dart index 80eba9ca..6057060e 100644 --- a/lib/view/transaction/category/edit/transaction_category_edit.dart +++ b/lib/view/transaction/category/edit/transaction_category_edit.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:leap_ledger_app/bloc/category/category_bloc.dart'; import 'package:leap_ledger_app/common/global.dart'; import 'package:leap_ledger_app/model/account/model.dart'; import 'package:leap_ledger_app/model/transaction/category/model.dart'; import 'package:leap_ledger_app/widget/form/form.dart'; +import 'package:leap_ledger_app/widget/icon/enter.dart'; class TransactionCategoryEdit extends StatefulWidget { const TransactionCategoryEdit({super.key, this.transactionCategory, required this.account}); @@ -67,16 +67,7 @@ class _TransactionCategoryEditState extends State { child: SingleChildScrollView( child: Column( children: [ - Container( - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.circular(90), - ), - margin: EdgeInsets.only(bottom: Constant.padding), - width: 64.sp, - height: 64.sp, - child: Icon(data.icon, size: Constant.iconlargeSize, color: Colors.black87), - ), + CircularIcon(icon: data.icon), FormInputField.string('名称', data.name, (text) => data.name = text), SizedBox(height: Constant.padding), FormSelecter.transactionCategoryIcon(data.icon, onChanged: _onSelectIcon), diff --git a/lib/view/transaction/detail/transaction_detail_bottom_sheet.dart b/lib/view/transaction/detail/transaction_detail_bottom_sheet.dart index 7d81fb15..c69990b7 100644 --- a/lib/view/transaction/detail/transaction_detail_bottom_sheet.dart +++ b/lib/view/transaction/detail/transaction_detail_bottom_sheet.dart @@ -161,9 +161,6 @@ class _TransactionDetailBottomSheetState extends State(BorderSide(color: ConstantColor.primaryColor)), - ), child: Text( "删除", style: TextStyle(letterSpacing: Constant.buttomLetterSpacing), diff --git a/lib/view/transaction/flow/transaction_flow.dart b/lib/view/transaction/flow/transaction_flow.dart index cf14d7c2..5e4a27bc 100644 --- a/lib/view/transaction/flow/transaction_flow.dart +++ b/lib/view/transaction/flow/transaction_flow.dart @@ -185,10 +185,13 @@ class _TransactionFlowState extends State { child: BlocBuilder( buildWhen: (_, state) => state is FlowCurrentAccountChanged, builder: (context, state) { - return Row(children: [ - Icon(_conditionCubit.account.icon, size: Constant.iconSize), - Text(_conditionCubit.account.name) - ]); + return Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Icon(_conditionCubit.account.icon, size: Constant.iconSize),Text(_conditionCubit.account.name) + ], + ); }, ), ), @@ -200,11 +203,7 @@ class _TransactionFlowState extends State { startDate: _conditionCubit.condition.startTime, endDate: _conditionCubit.condition.endTime, ).push(), - icon: Icon( - Icons.pie_chart_outline_outlined, - color: ConstantColor.primaryColor, - size: Constant.iconSize, - ), + icon: Icon(Icons.pie_chart_outline_outlined, color: ConstantColor.primaryColor, size: Constant.iconSize), ), Builder(builder: (context) { return IconButton( @@ -213,6 +212,11 @@ class _TransactionFlowState extends State { showModalBottomSheet( isScrollControlled: true, context: context, + transitionAnimationController: AnimationController( + animationBehavior: AnimationBehavior.preserve, + vsync: Scaffold.of(context), + duration: Duration(milliseconds: 600), + )..drive(CurveTween(curve: Curves.easeInOut)), builder: (BuildContext context) { return BlocProvider.value( value: _conditionCubit, diff --git a/lib/view/transaction/flow/widget/condition_bottom_sheet.dart b/lib/view/transaction/flow/widget/condition_bottom_sheet.dart index e12affe7..12e9e42f 100644 --- a/lib/view/transaction/flow/widget/condition_bottom_sheet.dart +++ b/lib/view/transaction/flow/widget/condition_bottom_sheet.dart @@ -54,7 +54,6 @@ class _ConditionBottomSheetState extends State { return Stack(children: [ Container( decoration: ConstantDecoration.bottomSheet, - height: size.height * 0.8, width: size.width, child: _buildForm(), ), @@ -75,21 +74,18 @@ class _ConditionBottomSheetState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - flex: 11, - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildOneConditon(name: "金额", _buildAmountInput()), - _buildOneConditon(name: "收支", _buildIncomeExpense()), - _buildCategory() - ], - ), + SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildOneConditon(name: "金额", _buildAmountInput()), + _buildOneConditon(name: "收支", _buildIncomeExpense()), + _buildCategory() + ], ), ), - Expanded(flex: 1, child: _buildButtonGroup()), + _buildButtonGroup(), ], ), ); @@ -99,7 +95,7 @@ class _ConditionBottomSheetState extends State { return Padding( padding: EdgeInsets.fromLTRB(Constant.padding, Constant.padding, Constant.padding, 0), child: Column( - mainAxisSize: MainAxisSize.max, + mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( @@ -108,7 +104,7 @@ class _ConditionBottomSheetState extends State { visible: name != null, child: Text( name ?? "", - style: TextStyle(fontSize: ConstantFontSize.bodyLarge, fontWeight: FontWeight.w500), + style: TextStyle(fontSize: ConstantFontSize.body, fontWeight: FontWeight.w500), ), ), ), @@ -126,27 +122,30 @@ class _ConditionBottomSheetState extends State { Row( mainAxisSize: MainAxisSize.min, children: [ - Flexible( - child: AmountInput( - controller: _minAmountController, - onChanged: (amount) => _conditionCubit.updateMinimumAmount(amount: amount), - decoration: AmountInput.defaultDecoration.copyWith(labelText: "最低金额"), + AmountInput( + controller: _minAmountController, + onChanged: (amount) => _conditionCubit.updateMinimumAmount(amount: amount), + decoration: AmountInput.defaultDecoration.copyWith( + labelText: "最低金额", + labelStyle: TextStyle(fontSize: ConstantFontSize.bodySmall), ), ), SizedBox( - width: 32.w, - child: Divider( - color: ConstantColor.greyText, - indent: Constant.margin, - endIndent: Constant.margin, - height: 0.5, - thickness: 0.5, - )), - Flexible( - child: AmountInput( - controller: _maxAmountController, - onChanged: (amount) => _conditionCubit.updateMaximumAmount(amount: amount), - decoration: AmountInput.defaultDecoration.copyWith(labelText: "最高金额"), + width: 32, + child: Divider( + color: ConstantColor.greyText, + indent: Constant.margin, + endIndent: Constant.margin, + height: 0.5, + thickness: 0.5, + ), + ), + AmountInput( + controller: _maxAmountController, + onChanged: (amount) => _conditionCubit.updateMaximumAmount(amount: amount), + decoration: AmountInput.defaultDecoration.copyWith( + labelText: "最高金额", + labelStyle: TextStyle(fontSize: ConstantFontSize.bodySmall), ), ), ], @@ -182,23 +181,28 @@ class _ConditionBottomSheetState extends State { ButtonSegment( value: IncomeExpense.income, label: Padding( - padding: EdgeInsets.symmetric(vertical: Constant.padding, horizontal: Constant.padding / 2), - child: Text("收入", - style: TextStyle( - fontSize: ConstantFontSize.body, - color: selectedIncomeExpense == IncomeExpense.income ? Colors.white : null, - )), + padding: EdgeInsets.symmetric(vertical: Constant.padding, horizontal: Constant.margin), + child: Text( + "收入", + style: TextStyle( + fontSize: ConstantFontSize.bodySmall, + color: selectedIncomeExpense == IncomeExpense.income ? Colors.white : null, + ), + ), ), ), ButtonSegment( value: IncomeExpense.expense, label: Padding( - padding: EdgeInsets.symmetric(vertical: Constant.padding, horizontal: Constant.padding / 2), - child: Text("支出", - style: TextStyle( - fontSize: ConstantFontSize.body, - color: selectedIncomeExpense == IncomeExpense.expense ? Colors.white : null, - ))), + padding: EdgeInsets.symmetric(vertical: Constant.padding, horizontal: Constant.margin), + child: Text( + "支出", + style: TextStyle( + fontSize: ConstantFontSize.bodySmall, + color: selectedIncomeExpense == IncomeExpense.expense ? Colors.white : null, + ), + ), + ), ) ], ), @@ -210,15 +214,12 @@ class _ConditionBottomSheetState extends State { return BlocBuilder( buildWhen: (_, state) => state is FlowConditionCategoryLoaded, builder: (context, state) { - return Column( - children: List.generate( - _conditionCubit.categorytree.length, - (index) => _buildOneConditon( - [_buildCategoryChildren(_conditionCubit.categorytree[index].value)], - name: _conditionCubit.categorytree[index].key.name, - ), - )..add(SizedBox(height:Constant.padding,)), + List list = []; + List.generate( + _conditionCubit.categorytree.length, + (index) => list.addAll(_conditionCubit.categorytree[index].value), ); + return _buildOneConditon([_buildCategoryChildren(list)], name: "类型"); }, ); } @@ -253,35 +254,31 @@ class _ConditionBottomSheetState extends State { /// 按钮组 Widget _buildButtonGroup() { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 100, - child: OutlinedButton( - style: ButtonStyle( - shape: WidgetStateProperty.all(const StadiumBorder(side: BorderSide(style: BorderStyle.none)))), - onPressed: () { - _minAmountController.clear(); - _maxAmountController.clear(); - _conditionCubit.setOptionalFieldsToEmpty(); - }, - child: const Text("重 置"), - )), - SizedBox( - width: 100, - child: ElevatedButton( + return Padding( + padding: EdgeInsets.all(Constant.padding), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + OutlinedButton( + onPressed: () { + _minAmountController.clear(); + _maxAmountController.clear(); + _conditionCubit.setOptionalFieldsToEmpty(); + }, + child: Text("重置", style: TextStyle(letterSpacing: Constant.buttomLetterSpacing)), + ), + ElevatedButton( style: ButtonStyle( shape: WidgetStateProperty.all(const StadiumBorder(side: BorderSide(style: BorderStyle.none)))), onPressed: () { _conditionCubit.save(); Navigator.of(context).pop(); }, - child: const Text("确 定"), - ), - ) - ], + child: Text("确定", style: TextStyle(letterSpacing: Constant.buttomLetterSpacing)), + ) + ], + ), ); } } diff --git a/lib/view/transaction/share/transaction_share_bottom_sheet.dart b/lib/view/transaction/share/transaction_share_bottom_sheet.dart index 7b4a2e14..546b6a17 100644 --- a/lib/view/transaction/share/transaction_share_bottom_sheet.dart +++ b/lib/view/transaction/share/transaction_share_bottom_sheet.dart @@ -40,7 +40,7 @@ class TransactionShareDialog extends StatelessWidget { ), width: 48.sp, height: 48.sp, - child: Icon(Icons.download_outlined, size: 28), + child: Icon(Icons.download_outlined, size: Constant.iconSize), )), ], ), @@ -121,7 +121,7 @@ class TransactionShareDialog extends StatelessWidget { ), width: 48, height: 48, - child: Icon(icon, size: 28), + child: Icon(icon, size: Constant.iconSize), ), SizedBox( height: Constant.margin, diff --git a/lib/view/user/forgetPassword/user_forgetPassword.dart b/lib/view/user/forgetPassword/user_forgetPassword.dart index ff81c165..292a6dbb 100644 --- a/lib/view/user/forgetPassword/user_forgetPassword.dart +++ b/lib/view/user/forgetPassword/user_forgetPassword.dart @@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:leap_ledger_app/bloc/user/user_bloc.dart'; import 'package:leap_ledger_app/common/global.dart'; +import 'package:leap_ledger_app/view/user/widget/enter.dart'; import 'package:leap_ledger_app/widget/common/common.dart'; import 'package:leap_ledger_app/widget/toast.dart'; @@ -68,7 +69,7 @@ class UserForgetPasswordState extends State { obscureText: true, ), SizedBox(height: 70.h), - buildSubmitButton(), + SubmitButtom(title: '修改', onPressed: triggerUpdateEvent), ], ), ), @@ -77,23 +78,6 @@ class UserForgetPasswordState extends State { ); } - Widget buildSubmitButton() { - return Align( - child: SizedBox( - height: 45.h, - width: 270.w, - child: ElevatedButton( - style: ButtonStyle( - shape: WidgetStateProperty.all(const StadiumBorder(side: BorderSide(style: BorderStyle.none)))), - child: Text('修改', style: Theme.of(context).primaryTextTheme.headlineSmall), - onPressed: () { - triggerUpdateEvent(); - }, - ), - ), - ); - } - void triggerUpdateEvent() { var email = ""; var captcha = ""; diff --git a/lib/view/user/login/user_login.dart b/lib/view/user/login/user_login.dart index 7643d4e0..89b78e9b 100644 --- a/lib/view/user/login/user_login.dart +++ b/lib/view/user/login/user_login.dart @@ -6,6 +6,7 @@ import 'package:leap_ledger_app/bloc/user/user_bloc.dart'; import 'package:leap_ledger_app/common/current.dart'; import 'package:leap_ledger_app/common/global.dart'; import 'package:leap_ledger_app/routes/routes.dart'; +import 'package:leap_ledger_app/view/user/widget/enter.dart'; import 'package:leap_ledger_app/widget/common/common.dart'; class UserLogin extends StatefulWidget { @@ -95,7 +96,7 @@ class UserLoginState extends State { SizedBox(height: 40.h), Padding(padding: EdgeInsets.all(Constant.padding), child: _buildTourButton()), SizedBox(height: 30.h), - buildLoginButton(), + SubmitButtom(title: '登录', onPressed: onPressed), ], ), ), @@ -106,21 +107,6 @@ class UserLoginState extends State { ); } - Widget buildLoginButton() { - return Align( - child: SizedBox( - height: 45.h, - width: 270.w, - child: ElevatedButton( - style: ButtonStyle( - shape: WidgetStateProperty.all(const StadiumBorder(side: BorderSide(style: BorderStyle.none)))), - onPressed: onPressed, - child: Text('登录', style: Theme.of(context).primaryTextTheme.headlineSmall), - ), - ), - ); - } - Widget _buildTourButton() { return Offstage( offstage: Current.deviceId == null, diff --git a/lib/view/user/password/update/user_password_update.dart b/lib/view/user/password/update/user_password_update.dart index 0b7b5021..f6f4924a 100644 --- a/lib/view/user/password/update/user_password_update.dart +++ b/lib/view/user/password/update/user_password_update.dart @@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:leap_ledger_app/bloc/user/user_bloc.dart'; import 'package:leap_ledger_app/common/global.dart'; +import 'package:leap_ledger_app/view/user/widget/enter.dart'; import 'package:leap_ledger_app/widget/common/common.dart'; import 'package:leap_ledger_app/widget/toast.dart'; @@ -61,7 +62,7 @@ class UserPasswordUpdateState extends State { obscureText: true, ), SizedBox(height: 70.h), - buildSubmitButton(), + SubmitButtom(title: '修改', onPressed: triggerUpdateEvent), ], ), ), @@ -70,23 +71,6 @@ class UserPasswordUpdateState extends State { ); } - Widget buildSubmitButton() { - return Align( - child: SizedBox( - height: 45.h, - width: 270.w, - child: ElevatedButton( - style: ButtonStyle( - shape: WidgetStateProperty.all(const StadiumBorder(side: BorderSide(style: BorderStyle.none)))), - child: Text('修改', style: Theme.of(context).primaryTextTheme.headlineSmall), - onPressed: () { - triggerUpdateEvent(); - }, - ), - ), - ); - } - void triggerUpdateEvent() { var captcha = ""; if (emailCaptchaKey.currentState != null) { diff --git a/lib/view/user/register/user_register.dart b/lib/view/user/register/user_register.dart index f5249958..2ea9462b 100644 --- a/lib/view/user/register/user_register.dart +++ b/lib/view/user/register/user_register.dart @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:leap_ledger_app/bloc/user/user_bloc.dart'; import 'package:leap_ledger_app/common/global.dart'; import 'package:leap_ledger_app/routes/routes.dart'; +import 'package:leap_ledger_app/view/user/widget/enter.dart'; import 'package:leap_ledger_app/widget/common/common.dart'; import 'package:leap_ledger_app/widget/toast.dart'; @@ -80,7 +81,7 @@ class UserRegisterState extends State { formKey: emailCaptchaKey, ), SizedBox(height: 70.h), - buildSubmitButton(), + SubmitButtom(title: '注册', onPressed: triggerRegisterEvent), ], ), ), @@ -89,23 +90,6 @@ class UserRegisterState extends State { ); } - Widget buildSubmitButton() { - return Align( - child: SizedBox( - height: 45.h, - width: 270.w, - child: ElevatedButton( - style: ButtonStyle( - shape: WidgetStateProperty.all(const StadiumBorder(side: BorderSide(style: BorderStyle.none)))), - child: Text('注册', style: Theme.of(context).primaryTextTheme.headlineSmall), - onPressed: () { - triggerRegisterEvent(); - }, - ), - ), - ); - } - void triggerRegisterEvent() { var email = ""; var captcha = ""; diff --git a/lib/view/user/widget/enter.dart b/lib/view/user/widget/enter.dart new file mode 100644 index 00000000..2cf8295d --- /dev/null +++ b/lib/view/user/widget/enter.dart @@ -0,0 +1,4 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +part 'submit_buttom.dart'; diff --git a/lib/view/user/widget/submit_buttom.dart b/lib/view/user/widget/submit_buttom.dart new file mode 100644 index 00000000..7801b5b4 --- /dev/null +++ b/lib/view/user/widget/submit_buttom.dart @@ -0,0 +1,22 @@ +part of 'enter.dart'; + +class SubmitButtom extends StatelessWidget { + const SubmitButtom({super.key, required this.title, required this.onPressed}); + final String title; + final VoidCallback onPressed; + @override + Widget build(BuildContext context) { + return Align( + child: SizedBox( + height: 45.sp, + width: 270.w, + child: ElevatedButton( + style: ButtonStyle( + shape: WidgetStateProperty.all(const StadiumBorder(side: BorderSide(style: BorderStyle.none)))), + onPressed: onPressed, + child: Text(title, style: Theme.of(context).primaryTextTheme.headlineSmall), + ), + ), + ); + } +} diff --git a/lib/widget/amount/amount_input.dart b/lib/widget/amount/amount_input.dart index 8434dfba..f88cf7b1 100644 --- a/lib/widget/amount/amount_input.dart +++ b/lib/widget/amount/amount_input.dart @@ -27,7 +27,8 @@ class AmountInput extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - height: 48.sp, + width: 132.sp, + height: 48, child: TextFormField( controller: controller, style: const TextStyle(fontSize: ConstantFontSize.body), diff --git a/lib/widget/category/category_icon_and_name.dart b/lib/widget/category/category_icon_and_name.dart index 23722866..4c9a5dd8 100644 --- a/lib/widget/category/category_icon_and_name.dart +++ b/lib/widget/category/category_icon_and_name.dart @@ -22,7 +22,7 @@ class CategoryIconAndName extends Statel child: SizedBox( width: 48.sp, height: 48.sp, - child: Icon(category.icon, size: 28, color: isSelected ? Colors.white : Colors.black), + child: Icon(category.icon, size: Constant.iconSize, color: isSelected ? Colors.white : Colors.black), ), ), if (category.name.isNotEmpty) SizedBox(height: Constant.margin / 2), @@ -61,7 +61,7 @@ class LargeCategoryIconAndName extends StatelessWidget { child: SizedBox( width: 48.sp, height: 48.sp, - child: Icon(category.icon, size: 28, color: Colors.white), + child: Icon(category.icon, size: Constant.iconSize, color: Colors.white), ), ), if (category.name.isNotEmpty) SizedBox(height: Constant.margin / 2), diff --git a/lib/widget/common/common_expansion_list.dart b/lib/widget/common/common_expansion_list.dart index d44ab2bd..4c10e40b 100644 --- a/lib/widget/common/common_expansion_list.dart +++ b/lib/widget/common/common_expansion_list.dart @@ -46,12 +46,12 @@ class _CommonExpansionListState extends State with SingleTi late List list; if (!stateOfExpansion) { list = [ - Icon(Icons.keyboard_double_arrow_down_outlined, size: ConstantFontSize.body + 2), + Icon(Icons.keyboard_double_arrow_down_outlined, size: ConstantFontSize.body), Text("展开", style: TextStyle(fontSize: ConstantFontSize.body)), ]; } else { list = [ - Icon(Icons.keyboard_double_arrow_up_outlined, size: ConstantFontSize.body + 2), + Icon(Icons.keyboard_double_arrow_up_outlined, size: ConstantFontSize.body), Text("合起", style: TextStyle(fontSize: ConstantFontSize.body)), ]; } diff --git a/lib/widget/icon/circular_icon.dart b/lib/widget/icon/circular_icon.dart index c26b7076..e70cb615 100644 --- a/lib/widget/icon/circular_icon.dart +++ b/lib/widget/icon/circular_icon.dart @@ -17,7 +17,7 @@ class CircularIcon extends StatelessWidget { ), width: 64.sp, height: 64.sp, - child: Icon(icon, size: Constant.iconlargeSize, color: Colors.black87), + child: Icon(icon, size: Constant.iconlargeSize, color: Colors.grey.shade800), ); } }