redesign for settings page
This commit is contained in:
@@ -4,10 +4,10 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/account.dart';
|
||||
|
||||
import 'package:pweb/controllers/auth/account_name.dart';
|
||||
import 'package:pweb/pages/settings/profile/account/avatar.dart';
|
||||
import 'package:pweb/pages/settings/profile/account/locale.dart';
|
||||
import 'package:pweb/pages/settings/profile/account/name/name.dart';
|
||||
import 'package:pweb/pages/settings/profile/account/password/password.dart';
|
||||
import 'package:pweb/pages/settings/profile/actions/section.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
@@ -15,7 +15,10 @@ import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
class ProfileSettingsPage extends StatelessWidget {
|
||||
const ProfileSettingsPage({super.key});
|
||||
|
||||
static const _cardPadding = EdgeInsets.symmetric(vertical: 32, horizontal: 16);
|
||||
static const _cardPadding = EdgeInsets.symmetric(
|
||||
vertical: 32,
|
||||
horizontal: 16,
|
||||
);
|
||||
static const _cardRadius = 16.0;
|
||||
static const _itemSpacing = 12.0;
|
||||
|
||||
@@ -33,45 +36,50 @@ class ProfileSettingsPage extends StatelessWidget {
|
||||
(provider) => provider.account?.avatarUrl,
|
||||
);
|
||||
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Material(
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(_cardRadius),
|
||||
color: theme.colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: _cardPadding,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: _itemSpacing,
|
||||
children: [
|
||||
AvatarTile(
|
||||
avatarUrl: accountAvatarUrl,
|
||||
title: loc.avatar,
|
||||
description: loc.avatarHint,
|
||||
errorText: loc.avatarUpdateError,
|
||||
),
|
||||
AccountName(
|
||||
firstName: accountFirstName ?? '',
|
||||
lastName: accountLastName ?? '',
|
||||
title: loc.accountName,
|
||||
hintText: loc.accountNameHint,
|
||||
lastNameHint: loc.lastName,
|
||||
errorText: loc.accountNameUpdateError,
|
||||
),
|
||||
AccountPassword(
|
||||
title: loc.changePassword,
|
||||
successText: loc.changePasswordSuccess,
|
||||
errorText: loc.changePasswordError,
|
||||
oldPasswordLabel: loc.oldPassword,
|
||||
newPasswordLabel: loc.newPassword,
|
||||
confirmPasswordLabel: loc.confirmPassword,
|
||||
savePassword: loc.savePassword,
|
||||
),
|
||||
LocalePicker(
|
||||
title: loc.language,
|
||||
),
|
||||
],
|
||||
return ChangeNotifierProxyProvider<AccountProvider, AccountNameController>(
|
||||
create: (_) => AccountNameController(
|
||||
initialFirstName: accountFirstName ?? '',
|
||||
initialLastName: accountLastName ?? '',
|
||||
errorMessage: loc.accountNameUpdateError,
|
||||
),
|
||||
update: (_, accountProvider, controller) =>
|
||||
controller!..update(accountProvider),
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Material(
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(_cardRadius),
|
||||
color: theme.colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: _cardPadding,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: _itemSpacing,
|
||||
children: [
|
||||
AvatarTile(
|
||||
avatarUrl: accountAvatarUrl,
|
||||
title: loc.avatar,
|
||||
description: loc.avatarHint,
|
||||
errorText: loc.avatarUpdateError,
|
||||
),
|
||||
AccountName(
|
||||
hintText: loc.accountNameHint,
|
||||
lastNameHint: loc.lastName,
|
||||
),
|
||||
SizedBox(height: _itemSpacing),
|
||||
ProfileActionsSection(
|
||||
nameLabel: loc.editName,
|
||||
languageLabel: loc.language,
|
||||
passwordLabel: loc.changePassword,
|
||||
passwordSuccessText: loc.changePasswordSuccess,
|
||||
passwordErrorText: loc.changePasswordError,
|
||||
oldPasswordLabel: loc.oldPassword,
|
||||
newPasswordLabel: loc.newPassword,
|
||||
confirmPasswordLabel: loc.confirmPassword,
|
||||
savePasswordLabel: loc.savePassword,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user