From a5b3053920ac1dfb85c6599a404717ed39ba8b42 Mon Sep 17 00:00:00 2001 From: Cxx0822 <1556464090@qq.com> Date: Sun, 5 Jul 2026 20:41:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 4 +++- lib/views/profile.dart | 21 +++++++++++---------- lib/views/profile_form.dart | 21 ++++++++++++--------- lib/widgets/moment/card.dart | 2 +- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index b10ecc9..950305b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,6 +11,7 @@ import 'package:food_hub_app/views/login.dart'; import 'package:food_hub_app/views/moment.dart'; import 'package:food_hub_app/views/moment_form.dart'; import 'package:food_hub_app/views/moment_user.dart'; +import 'package:food_hub_app/views/profile_form.dart'; import 'package:food_hub_app/views/profile_user.dart'; import 'package:food_hub_app/views/recipe_form.dart'; import 'package:food_hub_app/views/record_form.dart'; @@ -125,7 +126,8 @@ class MyApp extends StatelessWidget { '/momentForm': (context) => MomentForm(), '/moment': (context) => MomentPage(), '/momentUser': (context) => MomentUserPage(), - '/ProfileUser': (context) => ProfileUserPage(), + '/profileUser': (context) => ProfileUserPage(), + '/profileForm': (context) => ProfileForm(), }, ); } diff --git a/lib/views/profile.dart b/lib/views/profile.dart index 2ca5973..5821526 100644 --- a/lib/views/profile.dart +++ b/lib/views/profile.dart @@ -46,15 +46,16 @@ class ProfilePageState extends State { void _onTapInfo(UserProvider provider) { provider.initUserForm(provider.currentUser); - showModalBottomSheet( - context: context, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - isScrollControlled: true, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical(top: Radius.circular(16)), - ), - builder: (context) => ProfileForm(), - ); + Navigator.pushNamed(context, '/profileForm'); + // showModalBottomSheet( + // context: context, + // backgroundColor: Theme.of(context).scaffoldBackgroundColor, + // isScrollControlled: true, + // shape: const RoundedRectangleBorder( + // borderRadius: BorderRadius.vertical(top: Radius.circular(16)), + // ), + // builder: (context) => ProfileForm(), + // ); } void _onTapMoment() { @@ -73,7 +74,7 @@ class ProfilePageState extends State { children: [ _buildFunctionButton( icon: Icons.account_circle, - text: '基本资料', + text: '基本信息', onTap: () => _onTapInfo(provider), ), const Divider(height: 1, thickness: 0.2), diff --git a/lib/views/profile_form.dart b/lib/views/profile_form.dart index 7ef1ece..43edf3e 100644 --- a/lib/views/profile_form.dart +++ b/lib/views/profile_form.dart @@ -164,10 +164,6 @@ class _ProfileFormState extends State { FormBuilderField>( name: 'tags', initialValue: provider.userFormItem.tags, - validator: FormBuilderValidators.minLength( - 1, - errorText: '至少添加一个标签', - ), builder: (FormFieldState> field) { return FlutterInputChips( padding: EdgeInsets.all(0), @@ -236,13 +232,20 @@ class _ProfileFormState extends State { @override Widget build(BuildContext context) { final provider = context.watch(); + final colors = Theme.of(context).colorScheme; - return AnimatedPadding( - duration: const Duration(milliseconds: 200), - padding: MediaQuery.of(context).viewInsets, - child: SingleChildScrollView( + return Scaffold( + appBar: AppBar( + title: Text('基本信息', style: Theme.of(context).textTheme.titleLarge), + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + leading: IconButton( + icon: Icon(Icons.arrow_back, color: colors.primary), + onPressed: () => Navigator.pop(context), + ), + ), + body: SingleChildScrollView( child: Padding( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: _buildFormBuilder(provider), ), ), diff --git a/lib/widgets/moment/card.dart b/lib/widgets/moment/card.dart index 9076e91..a455347 100644 --- a/lib/widgets/moment/card.dart +++ b/lib/widgets/moment/card.dart @@ -65,7 +65,7 @@ class MomentCardState extends State { await provider.queryMomentByUserId(widget.moment.userId!); if (mounted) { - Navigator.pushNamed(context, '/ProfileUser'); + Navigator.pushNamed(context, '/profileUser'); } } }