2023-08-05 01:00:46 -04:00
|
|
|
import 'package:awesome_extensions/awesome_extensions.dart';
|
2023-07-28 20:36:05 -04:00
|
|
|
import 'package:flutter/material.dart';
|
2024-01-29 22:38:19 -05:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2023-07-28 20:36:05 -04:00
|
|
|
|
2024-01-08 21:37:08 -05:00
|
|
|
import '../../theme/theme.dart';
|
2024-01-29 22:38:19 -05:00
|
|
|
import '../../tools/tools.dart';
|
|
|
|
import '../cubit/cubit.dart';
|
2023-08-05 01:00:46 -04:00
|
|
|
|
2024-01-08 21:37:08 -05:00
|
|
|
class ProfileWidget extends StatelessWidget {
|
2023-07-28 20:36:05 -04:00
|
|
|
const ProfileWidget({
|
|
|
|
super.key,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
// ignore: prefer_expression_function_bodies
|
2024-01-08 21:37:08 -05:00
|
|
|
Widget build(BuildContext context) {
|
2024-01-29 22:38:19 -05:00
|
|
|
final accountData = context.watch<AccountRecordCubit>().state.data;
|
|
|
|
if (accountData == null) {
|
|
|
|
return waitingPage(context);
|
|
|
|
}
|
|
|
|
final account = accountData.value;
|
|
|
|
|
2023-08-05 01:00:46 -04:00
|
|
|
final theme = Theme.of(context);
|
|
|
|
final scale = theme.extension<ScaleScheme>()!;
|
|
|
|
final textTheme = theme.textTheme;
|
2023-07-28 20:36:05 -04:00
|
|
|
|
2023-09-23 12:56:54 -04:00
|
|
|
return DecoratedBox(
|
|
|
|
decoration: ShapeDecoration(
|
2023-09-24 15:30:54 -04:00
|
|
|
color: scale.primaryScale.border,
|
|
|
|
shape:
|
|
|
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))),
|
2023-09-23 12:56:54 -04:00
|
|
|
child: Column(children: [
|
|
|
|
Text(
|
2024-01-29 22:38:19 -05:00
|
|
|
account.profile.name,
|
2023-09-23 12:56:54 -04:00
|
|
|
style: textTheme.headlineSmall,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
).paddingAll(4),
|
2024-01-29 22:38:19 -05:00
|
|
|
if (account.profile.pronouns.isNotEmpty)
|
|
|
|
Text(account.profile.pronouns, style: textTheme.bodyMedium)
|
|
|
|
.paddingLTRB(4, 0, 4, 4),
|
2023-09-23 12:56:54 -04:00
|
|
|
]),
|
|
|
|
);
|
2023-07-28 20:36:05 -04:00
|
|
|
}
|
|
|
|
}
|