Updated Settings Page
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/account.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.dart';
|
||||
import 'package:pweb/pages/settings/profile/account/password/password.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
@@ -18,34 +23,48 @@ class ProfileSettingsPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
final theme = Theme.of(context);
|
||||
final accountName = context.select<AccountProvider, String?>(
|
||||
(provider) => provider.account?.describable.name,
|
||||
);
|
||||
|
||||
return Material(
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(_cardRadius),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
color: theme.colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: _cardPadding,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: _itemSpacing,
|
||||
children: [
|
||||
AvatarTile(
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/65651201',
|
||||
title: loc.avatar,
|
||||
description: loc.avatarHint,
|
||||
errorText: loc.avatarUpdateError,
|
||||
),
|
||||
AccountName(
|
||||
name: loc.userNamePlaceholder,
|
||||
title: loc.accountName,
|
||||
hintText: loc.accountNameHint,
|
||||
errorText: loc.accountNameUpdateError,
|
||||
),
|
||||
LocalePicker(
|
||||
title: loc.language,
|
||||
),
|
||||
],
|
||||
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: 'https://avatars.githubusercontent.com/u/65651201',
|
||||
title: loc.avatar,
|
||||
description: loc.avatarHint,
|
||||
errorText: loc.avatarUpdateError,
|
||||
),
|
||||
AccountName(
|
||||
name: accountName ?? loc.userNamePlaceholder,
|
||||
title: loc.accountName,
|
||||
hintText: loc.accountNameHint,
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user