import 'package:flutter/material.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/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);

    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,
            ),
          ],
        ),
      ),
    );
  }
}
