feat:更新用户表单

This commit is contained in:
2026-07-05 20:41:06 +08:00
parent 780526ddf4
commit a5b3053920
4 changed files with 27 additions and 21 deletions

View File

@@ -46,15 +46,16 @@ class ProfilePageState extends State<ProfilePage> {
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<ProfilePage> {
children: [
_buildFunctionButton(
icon: Icons.account_circle,
text: '基本资料',
text: '基本信息',
onTap: () => _onTapInfo(provider),
),
const Divider(height: 1, thickness: 0.2),

View File

@@ -164,10 +164,6 @@ class _ProfileFormState extends State<ProfileForm> {
FormBuilderField<List<String>>(
name: 'tags',
initialValue: provider.userFormItem.tags,
validator: FormBuilderValidators.minLength(
1,
errorText: '至少添加一个标签',
),
builder: (FormFieldState<List<String>> field) {
return FlutterInputChips(
padding: EdgeInsets.all(0),
@@ -236,13 +232,20 @@ class _ProfileFormState extends State<ProfileForm> {
@override
Widget build(BuildContext context) {
final provider = context.watch<UserProvider>();
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),
),
),