73 lines
2.4 KiB
Dart
73 lines
2.4 KiB
Dart
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';
|
|
|
|
|
|
class ProfileSettingsPage extends StatelessWidget {
|
|
const ProfileSettingsPage({super.key});
|
|
|
|
static const _cardPadding = EdgeInsets.symmetric(vertical: 32, horizontal: 16);
|
|
static const _cardRadius = 16.0;
|
|
static const _itemSpacing = 12.0;
|
|
|
|
@override
|
|
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 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,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|