add new featurs like new stat page
This commit is contained in:
@@ -12,17 +12,18 @@ class ChallengesPage extends StatelessWidget {
|
||||
return Scaffold(
|
||||
backgroundColor: FinanceDesignSystem.backgroundColor,
|
||||
body: GetBuilder<ChallengesController>(builder: (cc) {
|
||||
if (cc.isLoading)
|
||||
return const Center(
|
||||
if (cc.isLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: FinanceDesignSystem.primaryDark));
|
||||
}
|
||||
return CustomScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
expandedHeight: 160,
|
||||
pinned: true,
|
||||
backgroundColor: const Color(0xFF1A237E),
|
||||
backgroundColor: Get.isDarkMode ? FinanceDesignSystem.primaryDark : const Color(0xFF1A237E),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios_new_rounded,
|
||||
color: Colors.white, size: 20),
|
||||
@@ -36,22 +37,22 @@ class ChallengesPage extends StatelessWidget {
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
centerTitle: true,
|
||||
title: Text('Challenges'.tr,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18)),
|
||||
background: Stack(fit: StackFit.expand, children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(colors: [
|
||||
Color(0xFF0A0E21),
|
||||
Color(0xFF1A237E)
|
||||
]))),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: Get.isDarkMode
|
||||
? [FinanceDesignSystem.primaryDark, const Color(0xFF1E1E2E)]
|
||||
: [const Color(0xFF0A0E21), const Color(0xFF1A237E)]
|
||||
))),
|
||||
Positioned(
|
||||
right: -30,
|
||||
top: -10,
|
||||
child: Icon(Icons.bolt_rounded,
|
||||
size: 160, color: Colors.white.withOpacity(0.04))),
|
||||
size: 160, color: Colors.white.withValues(alpha: 0.04))),
|
||||
]),
|
||||
),
|
||||
),
|
||||
@@ -92,10 +93,10 @@ class ChallengesPage extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: FinanceDesignSystem.accentBlue.withOpacity(0.1),
|
||||
color: FinanceDesignSystem.accentBlue.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(20)),
|
||||
child: Text('$done/$total',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: FinanceDesignSystem.accentBlue)),
|
||||
@@ -112,11 +113,11 @@ class ChallengesPage extends StatelessWidget {
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(FinanceDesignSystem.cardRadius),
|
||||
border: c.isCompleted
|
||||
? Border.all(color: c.color.withOpacity(0.3), width: 1.5)
|
||||
? Border.all(color: c.color.withValues(alpha: 0.3), width: 1.5)
|
||||
: null,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.03),
|
||||
color: Colors.black.withValues(alpha: 0.03),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4))
|
||||
],
|
||||
@@ -127,7 +128,7 @@ class ChallengesPage extends StatelessWidget {
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: c.color.withOpacity(0.12),
|
||||
color: c.color.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
child: Icon(c.icon, color: c.color, size: 22),
|
||||
),
|
||||
@@ -143,12 +144,12 @@ class ChallengesPage extends StatelessWidget {
|
||||
color: FinanceDesignSystem.primaryDark)),
|
||||
Text(isAr ? c.descriptionAr : c.descriptionEn,
|
||||
style:
|
||||
TextStyle(fontSize: 11, color: Colors.grey.shade500)),
|
||||
TextStyle(fontSize: 11, color: FinanceDesignSystem.textSecondary)),
|
||||
])),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFD700).withOpacity(0.15),
|
||||
color: const Color(0xFFFFD700).withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
child: Text('+${c.reward}',
|
||||
style: const TextStyle(
|
||||
@@ -164,7 +165,7 @@ class ChallengesPage extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey.shade600)),
|
||||
color: FinanceDesignSystem.textSecondary)),
|
||||
Text('${(c.progress * 100).toStringAsFixed(0)}%',
|
||||
style: TextStyle(
|
||||
fontSize: 11, fontWeight: FontWeight.bold, color: c.color)),
|
||||
@@ -174,7 +175,7 @@ class ChallengesPage extends StatelessWidget {
|
||||
Container(
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
color: FinanceDesignSystem.backgroundColor,
|
||||
borderRadius: BorderRadius.circular(4))),
|
||||
LayoutBuilder(
|
||||
builder: (ctx, cons) => AnimatedContainer(
|
||||
@@ -184,7 +185,7 @@ class ChallengesPage extends StatelessWidget {
|
||||
width: cons.maxWidth * c.progress,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [c.color, c.color.withOpacity(0.6)]),
|
||||
colors: [c.color, c.color.withValues(alpha: 0.6)]),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
)),
|
||||
@@ -212,11 +213,11 @@ class ChallengesPage extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
Center(
|
||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
const Icon(Icons.check_circle_rounded,
|
||||
Icon(Icons.check_circle_rounded,
|
||||
color: FinanceDesignSystem.successGreen, size: 16),
|
||||
const SizedBox(width: 4),
|
||||
Text('Claimed'.tr,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: FinanceDesignSystem.successGreen)),
|
||||
|
||||
@@ -12,121 +12,251 @@ class LeaderboardPage extends StatelessWidget {
|
||||
return Scaffold(
|
||||
backgroundColor: FinanceDesignSystem.backgroundColor,
|
||||
body: GetBuilder<LeaderboardController>(builder: (lc) {
|
||||
if (lc.isLoading) return const Center(child: CircularProgressIndicator(color: FinanceDesignSystem.primaryDark));
|
||||
return CustomScrollView(physics: const BouncingScrollPhysics(), slivers: [
|
||||
SliverAppBar(
|
||||
expandedHeight: 200, pinned: true,
|
||||
backgroundColor: const Color(0xFF0A0E21),
|
||||
leading: IconButton(icon: const Icon(Icons.arrow_back_ios_new_rounded, color: Colors.white, size: 20), onPressed: () => Get.back()),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
centerTitle: true,
|
||||
title: Text('Leaderboard'.tr, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18)),
|
||||
background: Stack(fit: StackFit.expand, children: [
|
||||
Container(decoration: const BoxDecoration(gradient: LinearGradient(colors: [Color(0xFF0A0E21), Color(0xFFB71C1C)]))),
|
||||
Positioned(right: -40, top: -20, child: Icon(Icons.leaderboard_rounded, size: 180, color: Colors.white.withOpacity(0.04))),
|
||||
// Top 3 podium
|
||||
if (lc.currentLeaderboard.length >= 3) Positioned(bottom: 50, left: 0, right: 0, child: _buildPodium(lc)),
|
||||
]),
|
||||
),
|
||||
),
|
||||
// Tab bar
|
||||
SliverToBoxAdapter(child: Container(
|
||||
margin: const EdgeInsets.fromLTRB(16, 16, 16, 0),
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(color: Colors.grey.shade100, borderRadius: BorderRadius.circular(14)),
|
||||
child: Row(children: [
|
||||
_tab('Trips'.tr, Icons.local_taxi_rounded, 0, lc),
|
||||
_tab('Earnings'.tr, Icons.monetization_on_rounded, 1, lc),
|
||||
]),
|
||||
)),
|
||||
// List
|
||||
SliverPadding(padding: const EdgeInsets.fromLTRB(16, 16, 16, 40), sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(ctx, i) {
|
||||
if (i >= lc.currentLeaderboard.length) return null;
|
||||
return _buildRow(lc.currentLeaderboard[i], lc.selectedTab == 1);
|
||||
},
|
||||
childCount: lc.currentLeaderboard.length,
|
||||
),
|
||||
)),
|
||||
]);
|
||||
if (lc.isLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: FinanceDesignSystem.primaryDark));
|
||||
}
|
||||
return CustomScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
expandedHeight: 200,
|
||||
pinned: true,
|
||||
backgroundColor: Get.isDarkMode
|
||||
? FinanceDesignSystem.primaryDark
|
||||
: const Color(0xFF0A0E21),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios_new_rounded,
|
||||
color: Colors.white, size: 20),
|
||||
onPressed: () => Get.back()),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
centerTitle: true,
|
||||
title: Text('Leaderboard'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18)),
|
||||
background: Stack(fit: StackFit.expand, children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(colors: [
|
||||
Color(0xFF0A0E21),
|
||||
Color(0xFFB71C1C)
|
||||
]))),
|
||||
Positioned(
|
||||
right: -40,
|
||||
top: -20,
|
||||
child: Icon(Icons.leaderboard_rounded,
|
||||
size: 180, color: Colors.white.withValues(alpha: 0.04))),
|
||||
// Top 3 podium
|
||||
if (lc.currentLeaderboard.length >= 3)
|
||||
Positioned(
|
||||
bottom: 50,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: _buildPodium(lc)),
|
||||
]),
|
||||
),
|
||||
),
|
||||
// Tab bar
|
||||
SliverToBoxAdapter(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.fromLTRB(16, 16, 16, 0),
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: FinanceDesignSystem.backgroundColor.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(14)),
|
||||
child: Row(children: [
|
||||
_tab('Trips'.tr, Icons.local_taxi_rounded, 0, lc),
|
||||
_tab('Earnings'.tr, Icons.monetization_on_rounded, 1, lc),
|
||||
]),
|
||||
)),
|
||||
// List
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 40),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(ctx, i) {
|
||||
if (i >= lc.currentLeaderboard.length) return null;
|
||||
return _buildRow(
|
||||
lc.currentLeaderboard[i], lc.selectedTab == 1);
|
||||
},
|
||||
childCount: lc.currentLeaderboard.length,
|
||||
),
|
||||
)),
|
||||
]);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPodium(LeaderboardController lc) {
|
||||
final top3 = lc.currentLeaderboard.take(3).toList();
|
||||
return Row(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [
|
||||
if (top3.length > 1) _podiumItem(top3[1], 2, 50, const Color(0xFFC0C0C0)),
|
||||
if (top3.isNotEmpty) _podiumItem(top3[0], 1, 70, const Color(0xFFFFD700)),
|
||||
if (top3.length > 2) _podiumItem(top3[2], 3, 35, const Color(0xFFCD7F32)),
|
||||
]);
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
if (top3.length > 1)
|
||||
_podiumItem(top3[1], 2, 50, const Color(0xFFC0C0C0)),
|
||||
if (top3.isNotEmpty)
|
||||
_podiumItem(top3[0], 1, 70, const Color(0xFFFFD700)),
|
||||
if (top3.length > 2)
|
||||
_podiumItem(top3[2], 3, 35, const Color(0xFFCD7F32)),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget _podiumItem(LeaderboardEntry e, int rank, double height, Color color) {
|
||||
return Padding(padding: const EdgeInsets.symmetric(horizontal: 8), child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
CircleAvatar(radius: rank == 1 ? 22 : 18, backgroundColor: color.withOpacity(0.3),
|
||||
child: Text(_getRankEmoji(rank), style: TextStyle(fontSize: rank == 1 ? 22 : 16))),
|
||||
const SizedBox(height: 4),
|
||||
Text(e.name.length > 8 ? '${e.name.substring(0, 8)}...' : e.name,
|
||||
style: TextStyle(color: Colors.white, fontSize: 10, fontWeight: e.isCurrentUser ? FontWeight.bold : FontWeight.normal)),
|
||||
]));
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
CircleAvatar(
|
||||
radius: rank == 1 ? 22 : 18,
|
||||
backgroundColor: color.withValues(alpha: 0.3),
|
||||
child: Text(_getRankEmoji(rank),
|
||||
style: TextStyle(fontSize: rank == 1 ? 22 : 16))),
|
||||
const SizedBox(height: 4),
|
||||
Text(e.name.length > 8 ? '${e.name.substring(0, 8)}...' : e.name,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
fontWeight:
|
||||
e.isCurrentUser ? FontWeight.bold : FontWeight.normal)),
|
||||
]));
|
||||
}
|
||||
|
||||
Widget _tab(String label, IconData icon, int idx, LeaderboardController lc) {
|
||||
final selected = lc.selectedTab == idx;
|
||||
return Expanded(child: GestureDetector(
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => lc.changeTab(idx),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
decoration: BoxDecoration(color: selected ? Colors.white : Colors.transparent, borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: selected ? [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 5)] : null),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
selected ? FinanceDesignSystem.cardColor : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: selected
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05), blurRadius: 5)
|
||||
]
|
||||
: null),
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Icon(icon, size: 16, color: selected ? FinanceDesignSystem.primaryDark : Colors.grey),
|
||||
Icon(icon,
|
||||
size: 16,
|
||||
color: selected ? FinanceDesignSystem.primaryDark : Colors.grey),
|
||||
const SizedBox(width: 6),
|
||||
Text(label, style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: selected ? FinanceDesignSystem.primaryDark : Colors.grey)),
|
||||
Text(label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: selected
|
||||
? FinanceDesignSystem.primaryDark
|
||||
: Colors.grey)),
|
||||
]),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildRow(LeaderboardEntry e, bool isEarnings) {
|
||||
final rankColor = e.rank == 1 ? const Color(0xFFFFD700) : e.rank == 2 ? const Color(0xFFC0C0C0) : e.rank == 3 ? const Color(0xFFCD7F32) : Colors.grey.shade400;
|
||||
final rankColor = e.rank == 1
|
||||
? const Color(0xFFFFD700)
|
||||
: e.rank == 2
|
||||
? const Color(0xFFC0C0C0)
|
||||
: e.rank == 3
|
||||
? const Color(0xFFCD7F32)
|
||||
: Colors.grey.shade400;
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 8),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: e.isCurrentUser ? FinanceDesignSystem.accentBlue.withOpacity(0.08) : Colors.white,
|
||||
color: e.isCurrentUser
|
||||
? FinanceDesignSystem.accentBlue.withValues(alpha: 0.08)
|
||||
: FinanceDesignSystem.cardColor,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: e.isCurrentUser ? Border.all(color: FinanceDesignSystem.accentBlue.withOpacity(0.3), width: 1.5) : null,
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.02), blurRadius: 8, offset: const Offset(0, 3))],
|
||||
border: e.isCurrentUser
|
||||
? Border.all(
|
||||
color: FinanceDesignSystem.accentBlue.withValues(alpha: 0.3),
|
||||
width: 1.5)
|
||||
: null,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.02),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 3))
|
||||
],
|
||||
),
|
||||
child: Row(children: [
|
||||
// Rank
|
||||
Container(width: 32, height: 32, decoration: BoxDecoration(color: rankColor.withOpacity(0.15), borderRadius: BorderRadius.circular(8)),
|
||||
child: Center(child: e.rank <= 3
|
||||
? Text(_getRankEmoji(e.rank), style: const TextStyle(fontSize: 16))
|
||||
: Text('${e.rank}', style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold, color: rankColor)))),
|
||||
Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: rankColor.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
child: Center(
|
||||
child: e.rank <= 3
|
||||
? Text(_getRankEmoji(e.rank),
|
||||
style: const TextStyle(fontSize: 16))
|
||||
: Text('${e.rank}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: rankColor)))),
|
||||
const SizedBox(width: 12),
|
||||
// Avatar
|
||||
CircleAvatar(radius: 18, backgroundColor: Colors.grey.shade200, child: Text(e.name.isNotEmpty ? e.name[0] : '?', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey.shade600))),
|
||||
CircleAvatar(
|
||||
radius: 18,
|
||||
backgroundColor: FinanceDesignSystem.backgroundColor,
|
||||
child: Text(e.name.isNotEmpty ? e.name[0] : '?',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: FinanceDesignSystem.textSecondary))),
|
||||
const SizedBox(width: 12),
|
||||
// Name
|
||||
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Expanded(
|
||||
child:
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Row(children: [
|
||||
Text(e.name, style: TextStyle(fontSize: 13, fontWeight: e.isCurrentUser ? FontWeight.bold : FontWeight.w500, color: FinanceDesignSystem.primaryDark)),
|
||||
if (e.isCurrentUser) ...[const SizedBox(width: 6),
|
||||
Container(padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), decoration: BoxDecoration(color: FinanceDesignSystem.accentBlue, borderRadius: BorderRadius.circular(6)),
|
||||
child: Text('You'.tr, style: const TextStyle(fontSize: 8, fontWeight: FontWeight.bold, color: Colors.white)))],
|
||||
Text(e.name,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight:
|
||||
e.isCurrentUser ? FontWeight.bold : FontWeight.w500,
|
||||
color: FinanceDesignSystem.primaryDark)),
|
||||
if (e.isCurrentUser) ...[
|
||||
const SizedBox(width: 6),
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: FinanceDesignSystem.accentBlue,
|
||||
borderRadius: BorderRadius.circular(6)),
|
||||
child: Text('You'.tr,
|
||||
style: const TextStyle(
|
||||
fontSize: 8,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white)))
|
||||
],
|
||||
]),
|
||||
])),
|
||||
// Value
|
||||
Text(isEarnings ? '${e.value.toStringAsFixed(0)} ${'SYP'.tr}' : '${e.value.toInt()} ${'Rides'.tr}',
|
||||
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w800, color: FinanceDesignSystem.primaryDark)),
|
||||
Text(
|
||||
isEarnings
|
||||
? '${e.value.toStringAsFixed(0)} ${'SYP'.tr}'
|
||||
: '${e.value.toInt()} ${'Rides'.tr}',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: FinanceDesignSystem.primaryDark)),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
String _getRankEmoji(int rank) => rank == 1 ? '🥇' : rank == 2 ? '🥈' : '🥉';
|
||||
String _getRankEmoji(int rank) => rank == 1
|
||||
? '🥇'
|
||||
: rank == 2
|
||||
? '🥈'
|
||||
: '🥉';
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
return Scaffold(
|
||||
backgroundColor: FinanceDesignSystem.backgroundColor,
|
||||
body: GetBuilder<ReferralController>(builder: (rc) {
|
||||
if (rc.isLoading) return const Center(child: CircularProgressIndicator(color: FinanceDesignSystem.primaryDark));
|
||||
if (rc.isLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: FinanceDesignSystem.primaryDark));
|
||||
}
|
||||
return CustomScrollView(physics: const BouncingScrollPhysics(), slivers: [
|
||||
// ═══ Header ═══
|
||||
SliverAppBar(
|
||||
@@ -28,7 +32,7 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
title: Text('Referral Center'.tr, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18)),
|
||||
background: Stack(fit: StackFit.expand, children: [
|
||||
Container(decoration: const BoxDecoration(gradient: LinearGradient(colors: [Color(0xFF0A0E21), Color(0xFF311B92)]))),
|
||||
Positioned(right: -50, bottom: -30, child: Icon(Icons.share_rounded, size: 200, color: Colors.white.withOpacity(0.03))),
|
||||
Positioned(right: -50, bottom: -30, child: Icon(Icons.share_rounded, size: 200, color: Colors.white.withValues(alpha: 0.03))),
|
||||
// Stats in header
|
||||
Positioned(bottom: 60, left: 24, right: 24, child: Row(children: [
|
||||
_headerStat('${rc.totalReferrals}', 'Total Invites'.tr),
|
||||
@@ -72,7 +76,7 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
Widget _headerStat(String value, String label) {
|
||||
return Expanded(child: Column(children: [
|
||||
Text(value, style: const TextStyle(fontSize: 22, fontWeight: FontWeight.w900, color: Colors.white)),
|
||||
Text(label, style: TextStyle(fontSize: 10, color: Colors.white.withOpacity(0.6))),
|
||||
Text(label, style: TextStyle(fontSize: 10, color: Colors.white.withValues(alpha: 0.6))),
|
||||
]));
|
||||
}
|
||||
|
||||
@@ -82,14 +86,14 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(colors: [Color(0xFF1A237E), Color(0xFF311B92)]),
|
||||
borderRadius: BorderRadius.circular(FinanceDesignSystem.cardRadius),
|
||||
boxShadow: [BoxShadow(color: const Color(0xFF311B92).withOpacity(0.3), blurRadius: 15, offset: const Offset(0, 8))],
|
||||
boxShadow: [BoxShadow(color: const Color(0xFF311B92).withValues(alpha: 0.3), blurRadius: 15, offset: const Offset(0, 8))],
|
||||
),
|
||||
child: Column(children: [
|
||||
Text('Your Referral Code'.tr, style: TextStyle(color: Colors.white.withOpacity(0.7), fontSize: 14)),
|
||||
Text('Your Referral Code'.tr, style: TextStyle(color: Colors.white.withValues(alpha: 0.7), fontSize: 14)),
|
||||
const SizedBox(height: 12),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.15), borderRadius: BorderRadius.circular(12), border: Border.all(color: Colors.white.withOpacity(0.2))),
|
||||
decoration: BoxDecoration(color: Colors.white.withValues(alpha: 0.15), borderRadius: BorderRadius.circular(12), border: Border.all(color: Colors.white.withValues(alpha: 0.2))),
|
||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
Text(rc.referralCode, style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w900, color: Colors.white, letterSpacing: 3)),
|
||||
const SizedBox(width: 12),
|
||||
@@ -97,14 +101,14 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
onTap: () { rc.copyCode(); mySnackbarSuccess('Code copied!'.tr); },
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.2), borderRadius: BorderRadius.circular(8)),
|
||||
decoration: BoxDecoration(color: Colors.white.withValues(alpha: 0.2), borderRadius: BorderRadius.circular(8)),
|
||||
child: const Icon(Icons.copy_rounded, color: Colors.white, size: 18),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('Share this code to earn rewards'.tr, style: TextStyle(color: Colors.white.withOpacity(0.5), fontSize: 12)),
|
||||
Text('Share this code to earn rewards'.tr, style: TextStyle(color: Colors.white.withValues(alpha: 0.5), fontSize: 12)),
|
||||
]),
|
||||
);
|
||||
}
|
||||
@@ -130,7 +134,7 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
decoration: BoxDecoration(color: color.withOpacity(0.1), borderRadius: BorderRadius.circular(14)),
|
||||
decoration: BoxDecoration(color: color.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(14)),
|
||||
child: Column(children: [
|
||||
Icon(icon, color: color, size: 24),
|
||||
const SizedBox(height: 6),
|
||||
@@ -144,9 +148,9 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(FinanceDesignSystem.cardRadius),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 10, offset: const Offset(0, 4))]),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.03), blurRadius: 10, offset: const Offset(0, 4))]),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text('How It Works'.tr, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: FinanceDesignSystem.primaryDark)),
|
||||
Text('How It Works'.tr, style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: FinanceDesignSystem.primaryDark)),
|
||||
const SizedBox(height: 16),
|
||||
_step('1', 'Share your code'.tr, 'Send your referral code to friends'.tr, const Color(0xFF2196F3)),
|
||||
_step('2', 'Friend signs up'.tr, 'They register using your code'.tr, const Color(0xFFFF9800)),
|
||||
@@ -158,12 +162,12 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
|
||||
Widget _step(String num, String title, String desc, Color color) {
|
||||
return Padding(padding: const EdgeInsets.only(bottom: 12), child: Row(children: [
|
||||
Container(width: 32, height: 32, decoration: BoxDecoration(color: color.withOpacity(0.15), borderRadius: BorderRadius.circular(8)),
|
||||
Container(width: 32, height: 32, decoration: BoxDecoration(color: color.withValues(alpha: 0.15), borderRadius: BorderRadius.circular(8)),
|
||||
child: Center(child: Text(num, style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: color))),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(title, style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: FinanceDesignSystem.primaryDark)),
|
||||
Text(title, style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: FinanceDesignSystem.primaryDark)),
|
||||
Text(desc, style: TextStyle(fontSize: 11, color: Colors.grey.shade500)),
|
||||
])),
|
||||
]));
|
||||
@@ -174,9 +178,9 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(14),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.02), blurRadius: 8, offset: const Offset(0, 3))]),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.02), blurRadius: 8, offset: const Offset(0, 3))]),
|
||||
child: Row(children: [
|
||||
Container(width: 40, height: 40, decoration: BoxDecoration(color: color.withOpacity(0.1), borderRadius: BorderRadius.circular(10)),
|
||||
Container(width: 40, height: 40, decoration: BoxDecoration(color: color.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(10)),
|
||||
child: Icon(r.type == 'driver' ? Icons.local_taxi_rounded : Icons.person_rounded, color: color, size: 20)),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
@@ -186,8 +190,8 @@ class ReferralCenterPage extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: r.status == 'active' ? FinanceDesignSystem.successGreen.withOpacity(0.1)
|
||||
: r.status == 'registered' ? FinanceDesignSystem.accentBlue.withOpacity(0.1) : Colors.grey.shade100,
|
||||
color: r.status == 'active' ? FinanceDesignSystem.successGreen.withValues(alpha: 0.1)
|
||||
: r.status == 'registered' ? FinanceDesignSystem.accentBlue.withValues(alpha: 0.1) : Colors.grey.shade100,
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
child: Text(r.status.tr, style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600,
|
||||
color: r.status == 'active' ? FinanceDesignSystem.successGreen
|
||||
|
||||
Reference in New Issue
Block a user