feat:更新用户表单
This commit is contained in:
@@ -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.dart';
|
||||||
import 'package:food_hub_app/views/moment_form.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/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/profile_user.dart';
|
||||||
import 'package:food_hub_app/views/recipe_form.dart';
|
import 'package:food_hub_app/views/recipe_form.dart';
|
||||||
import 'package:food_hub_app/views/record_form.dart';
|
import 'package:food_hub_app/views/record_form.dart';
|
||||||
@@ -125,7 +126,8 @@ class MyApp extends StatelessWidget {
|
|||||||
'/momentForm': (context) => MomentForm(),
|
'/momentForm': (context) => MomentForm(),
|
||||||
'/moment': (context) => MomentPage(),
|
'/moment': (context) => MomentPage(),
|
||||||
'/momentUser': (context) => MomentUserPage(),
|
'/momentUser': (context) => MomentUserPage(),
|
||||||
'/ProfileUser': (context) => ProfileUserPage(),
|
'/profileUser': (context) => ProfileUserPage(),
|
||||||
|
'/profileForm': (context) => ProfileForm(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,15 +46,16 @@ class ProfilePageState extends State<ProfilePage> {
|
|||||||
void _onTapInfo(UserProvider provider) {
|
void _onTapInfo(UserProvider provider) {
|
||||||
provider.initUserForm(provider.currentUser);
|
provider.initUserForm(provider.currentUser);
|
||||||
|
|
||||||
showModalBottomSheet(
|
Navigator.pushNamed(context, '/profileForm');
|
||||||
context: context,
|
// showModalBottomSheet(
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
// context: context,
|
||||||
isScrollControlled: true,
|
// backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
shape: const RoundedRectangleBorder(
|
// isScrollControlled: true,
|
||||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
// shape: const RoundedRectangleBorder(
|
||||||
),
|
// borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||||
builder: (context) => ProfileForm(),
|
// ),
|
||||||
);
|
// builder: (context) => ProfileForm(),
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onTapMoment() {
|
void _onTapMoment() {
|
||||||
@@ -73,7 +74,7 @@ class ProfilePageState extends State<ProfilePage> {
|
|||||||
children: [
|
children: [
|
||||||
_buildFunctionButton(
|
_buildFunctionButton(
|
||||||
icon: Icons.account_circle,
|
icon: Icons.account_circle,
|
||||||
text: '基本资料',
|
text: '基本信息',
|
||||||
onTap: () => _onTapInfo(provider),
|
onTap: () => _onTapInfo(provider),
|
||||||
),
|
),
|
||||||
const Divider(height: 1, thickness: 0.2),
|
const Divider(height: 1, thickness: 0.2),
|
||||||
|
|||||||
@@ -164,10 +164,6 @@ class _ProfileFormState extends State<ProfileForm> {
|
|||||||
FormBuilderField<List<String>>(
|
FormBuilderField<List<String>>(
|
||||||
name: 'tags',
|
name: 'tags',
|
||||||
initialValue: provider.userFormItem.tags,
|
initialValue: provider.userFormItem.tags,
|
||||||
validator: FormBuilderValidators.minLength(
|
|
||||||
1,
|
|
||||||
errorText: '至少添加一个标签',
|
|
||||||
),
|
|
||||||
builder: (FormFieldState<List<String>> field) {
|
builder: (FormFieldState<List<String>> field) {
|
||||||
return FlutterInputChips(
|
return FlutterInputChips(
|
||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
@@ -236,13 +232,20 @@ class _ProfileFormState extends State<ProfileForm> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final provider = context.watch<UserProvider>();
|
final provider = context.watch<UserProvider>();
|
||||||
|
final colors = Theme.of(context).colorScheme;
|
||||||
|
|
||||||
return AnimatedPadding(
|
return Scaffold(
|
||||||
duration: const Duration(milliseconds: 200),
|
appBar: AppBar(
|
||||||
padding: MediaQuery.of(context).viewInsets,
|
title: Text('基本信息', style: Theme.of(context).textTheme.titleLarge),
|
||||||
child: SingleChildScrollView(
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(Icons.arrow_back, color: colors.primary),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: _buildFormBuilder(provider),
|
child: _buildFormBuilder(provider),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class MomentCardState extends State<MomentCard> {
|
|||||||
await provider.queryMomentByUserId(widget.moment.userId!);
|
await provider.queryMomentByUserId(widget.moment.userId!);
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
Navigator.pushNamed(context, '/ProfileUser');
|
Navigator.pushNamed(context, '/profileUser');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user