After refonte for the options of Profile2

This commit is contained in:
Your Name 2026-10-25 17:35:56 +02:00
parent 19d2ac8ad0
commit 0198b60c24

View File

@ -159,6 +159,8 @@ class ReferralNetworkTreeState extends State<ReferralNetworkTree>
showModalBottomSheet<void>(
context: context,
useRootNavigator: true,
isScrollControlled: true,
showDragHandle: true,
backgroundColor: Theme.of(context).colorScheme.surface,
builder: (ctx) {
@ -178,119 +180,123 @@ class ReferralNetworkTreeState extends State<ReferralNetworkTree>
}();
return SafeArea(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 8, 20, 24),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
s.memberDetails,
style: Theme.of(ctx).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w800,
),
),
const SizedBox(height: 16),
Row(
children: [
CircleAvatar(
radius: 28,
backgroundColor: AppColors.primary.withValues(alpha: 0.18),
child: Text(
initials.characters.first.toUpperCase(),
style: const TextStyle(
fontWeight: FontWeight.w900,
fontSize: 22,
color: AppColors.primary,
padding: const EdgeInsets.fromLTRB(20, 8, 20, 16),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
s.memberDetails,
style: Theme.of(ctx).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w800,
),
),
),
const SizedBox(width: 14),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
name,
style: const TextStyle(
fontWeight: FontWeight.w900,
fontSize: 18,
),
),
const SizedBox(height: 16),
Row(
children: [
CircleAvatar(
radius: 28,
backgroundColor:
AppColors.primary.withValues(alpha: 0.18),
child: Text(
initials.characters.first.toUpperCase(),
style: const TextStyle(
fontWeight: FontWeight.w900,
fontSize: 22,
color: AppColors.primary,
),
if (!isRoot && member != null) ...[
const SizedBox(height: 4),
Text(
[
s.referralLevelLabel(member.levelNumber),
referralStatusLabel(member.status, s),
].join(' · '),
style: TextStyle(color: muted, fontSize: 13),
),
],
],
),
),
],
),
const SizedBox(height: 16),
if (!isRoot && member != null) ...[
_SheetRow(
label: s.sponsorLabel,
value: parentName ?? '—',
),
_SheetRow(
label: s.email,
value: (member.email?.trim().isNotEmpty ?? false)
? member.email!.trim()
: '—',
),
_SheetRow(
label: s.memberCountry,
value: countryLabel,
),
_SheetRow(
label: s.memberReferralCode,
value: (member.referralCode?.trim().isNotEmpty ?? false)
? member.referralCode!.trim()
: '—',
),
_SheetRow(
label: s.directReferrals,
value: '${member.directReferralsCount}',
),
_SheetRow(
label: s.memberSince,
value: formatReferralDate(member.registeredAt),
),
if (member.generatesCommissions)
Padding(
padding: const EdgeInsets.symmetric(vertical: 6),
child: Text(
s.generatesCommissions,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: AppColors.accentGold,
),
),
const SizedBox(width: 14),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
name,
style: const TextStyle(
fontWeight: FontWeight.w900,
fontSize: 18,
),
),
if (!isRoot && member != null) ...[
const SizedBox(height: 4),
Text(
[
s.referralLevelLabel(member.levelNumber),
referralStatusLabel(member.status, s),
].join(' · '),
style: TextStyle(color: muted, fontSize: 13),
),
],
],
),
),
],
),
const SizedBox(height: 16),
if (!isRoot && member != null) ...[
_SheetRow(
label: s.sponsorLabel,
value: parentName ?? '—',
),
if (_hasPartialChildren(member.userId)) ...[
const SizedBox(height: 8),
Text(
s.networkPartialData,
style: TextStyle(color: muted, fontSize: 12),
_SheetRow(
label: s.email,
value: (member.email?.trim().isNotEmpty ?? false)
? member.email!.trim()
: '—',
),
_SheetRow(
label: s.memberCountry,
value: countryLabel,
),
_SheetRow(
label: s.memberReferralCode,
value: (member.referralCode?.trim().isNotEmpty ?? false)
? member.referralCode!.trim()
: '—',
),
_SheetRow(
label: s.directReferrals,
value: '${member.directReferralsCount}',
),
_SheetRow(
label: s.memberSince,
value: formatReferralDate(member.registeredAt),
),
if (member.generatesCommissions)
Padding(
padding: const EdgeInsets.symmetric(vertical: 6),
child: Text(
s.generatesCommissions,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: AppColors.accentGold,
),
),
),
if (_hasPartialChildren(member.userId)) ...[
const SizedBox(height: 8),
Text(
s.networkPartialData,
style: TextStyle(color: muted, fontSize: 12),
),
],
] else ...[
_SheetRow(
label: s.directReferrals,
value:
'${(_childMap[widget.rootUserId] ?? const []).length}',
),
],
] else ...[
_SheetRow(
label: s.directReferrals,
value: '${(_childMap[widget.rootUserId] ?? const []).length}',
const SizedBox(height: 16),
FilledButton(
onPressed: () => Navigator.of(ctx, rootNavigator: true).pop(),
child: Text(s.closeSheet),
),
],
const SizedBox(height: 16),
FilledButton(
onPressed: () => Navigator.of(ctx).pop(),
child: Text(s.closeSheet),
),
],
),
),
),
);