veilidchat/lib/account_manager/views/profile_widget.dart

65 lines
2.0 KiB
Dart
Raw Normal View History

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-30 14:14:11 -05:00
import '../../proto/proto.dart' as proto;
2024-01-08 21:37:08 -05:00
import '../../theme/theme.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({
2024-01-30 14:14:11 -05:00
required proto.Profile profile,
2023-07-28 20:36:05 -04:00
super.key,
2024-01-30 14:14:11 -05:00
}) : _profile = profile;
//
final proto.Profile _profile;
//
2023-07-28 20:36:05 -04:00
@override
// ignore: prefer_expression_function_bodies
2024-01-08 21:37:08 -05:00
Widget build(BuildContext context) {
2023-08-05 01:00:46 -04:00
final theme = Theme.of(context);
final scale = theme.extension<ScaleScheme>()!;
2024-07-06 20:09:18 -04:00
final scaleConfig = theme.extension<ScaleConfig>()!;
2023-08-05 01:00:46 -04:00
final textTheme = theme.textTheme;
2023-07-28 20:36:05 -04:00
2023-09-23 12:56:54 -04:00
return DecoratedBox(
decoration: ShapeDecoration(
2024-07-06 20:09:18 -04:00
color: scaleConfig.preferBorders
? scale.primaryScale.elementBackground
: scale.primaryScale.border,
shape: RoundedRectangleBorder(
side: !scaleConfig.useVisualIndicators
? BorderSide.none
: BorderSide(
strokeAlign: BorderSide.strokeAlignCenter,
color: scaleConfig.preferBorders
? scale.primaryScale.border
: scale.primaryScale.borderText,
width: 2),
borderRadius: BorderRadius.all(
Radius.circular(16 * scaleConfig.borderRadiusScale))),
),
2023-09-23 12:56:54 -04:00
child: Column(children: [
Text(
2024-01-30 14:14:11 -05:00
_profile.name,
2024-07-06 20:09:18 -04:00
style: textTheme.headlineSmall!.copyWith(
color: scaleConfig.preferBorders
? scale.primaryScale.border
: scale.primaryScale.borderText),
2023-09-23 12:56:54 -04:00
textAlign: TextAlign.left,
).paddingAll(4),
2024-01-30 14:14:11 -05:00
if (_profile.pronouns.isNotEmpty)
Text(_profile.pronouns,
2024-07-06 20:09:18 -04:00
style: textTheme.bodyMedium!.copyWith(
color: scaleConfig.preferBorders
? scale.primaryScale.border
: scale.primaryScale.borderText))
2024-01-29 22:38:19 -05:00
.paddingLTRB(4, 0, 4, 4),
2023-09-23 12:56:54 -04:00
]),
);
2023-07-28 20:36:05 -04:00
}
}