👽 Changes due to the lotteries data has been moved to wallet

This commit is contained in:
2026-02-05 16:36:45 +08:00
parent f2819a9d92
commit 5414dfd4f0

View File

@@ -22,7 +22,7 @@ Future<List<SnLotteryTicket>> lotteryTickets(
int take = 20, int take = 20,
}) async { }) async {
final client = ref.watch(apiClientProvider); final client = ref.watch(apiClientProvider);
final resp = await client.get('/pass/lotteries?offset=$offset&take=$take'); final resp = await client.get('/wallet/lotteries?offset=$offset&take=$take');
return (resp.data as List).map((e) => SnLotteryTicket.fromJson(e)).toList(); return (resp.data as List).map((e) => SnLotteryTicket.fromJson(e)).toList();
} }
@@ -34,7 +34,7 @@ Future<List<SnLotteryRecord>> lotteryRecords(
}) async { }) async {
final client = ref.watch(apiClientProvider); final client = ref.watch(apiClientProvider);
final resp = await client.get( final resp = await client.get(
'/pass/lotteries/records?offset=$offset&take=$take', '/wallet/lotteries/records?offset=$offset&take=$take',
); );
return (resp.data as List).map((e) => SnLotteryRecord.fromJson(e)).toList(); return (resp.data as List).map((e) => SnLotteryRecord.fromJson(e)).toList();
} }
@@ -49,7 +49,10 @@ class LotteryTab extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
TabBar( TabBar(
tabs: [Tab(text: 'myTickets'.tr()), Tab(text: 'drawHistory'.tr())], tabs: [
Tab(text: 'myTickets'.tr()),
Tab(text: 'drawHistory'.tr()),
],
), ),
Expanded( Expanded(
child: TabBarView( child: TabBarView(
@@ -226,7 +229,7 @@ class LotteryTicketsList extends HookConsumerWidget {
// The lottery API creates the order for us // The lottery API creates the order for us
final orderResponse = await client.post( final orderResponse = await client.post(
'/pass/lotteries', '/wallet/lotteries',
data: purchaseData, data: purchaseData,
); );
@@ -349,18 +352,15 @@ class LotteryTicketsList extends HookConsumerWidget {
textColor = Colors.white; textColor = Colors.white;
borderColor = Colors.green; borderColor = Colors.green;
} else { } else {
backgroundColor = backgroundColor = isSpecial
isSpecial ? Theme.of(context).colorScheme.secondary
? Theme.of(context).colorScheme.secondary : Theme.of(context).colorScheme.surface;
: Theme.of(context).colorScheme.surface; textColor = isSpecial
textColor = ? Theme.of(context).colorScheme.onSecondary
isSpecial : Theme.of(context).colorScheme.onSurface;
? Theme.of(context).colorScheme.onSecondary borderColor = isSpecial
: Theme.of(context).colorScheme.onSurface; ? Theme.of(context).colorScheme.secondary
borderColor = : Theme.of(context).colorScheme.outline.withOpacity(0.3);
isSpecial
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.outline.withOpacity(0.3);
// Blend with red if all numbers are unmatched // Blend with red if all numbers are unmatched
if (allUnmatched) { if (allUnmatched) {
@@ -679,21 +679,17 @@ class _LotteryPurchaseSheetState extends State<LotteryPurchaseSheet> {
onTap: () => _toggleNumber(number), onTap: () => _toggleNumber(number),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: color: isSpecialNumber
isSpecialNumber ? Theme.of(context).colorScheme.secondary
? Theme.of(context).colorScheme.secondary : isSelected
: isSelected ? Theme.of(context).colorScheme.primary
? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.surface,
: Theme.of(context).colorScheme.surface,
border: Border.all( border: Border.all(
color: color: isSpecialNumber
isSpecialNumber ? Theme.of(context).colorScheme.secondary
? Theme.of(context).colorScheme.secondary : isSelected
: isSelected ? Theme.of(context).colorScheme.primary
? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.outline.withOpacity(0.3),
: Theme.of(
context,
).colorScheme.outline.withOpacity(0.3),
), ),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
@@ -701,12 +697,11 @@ class _LotteryPurchaseSheetState extends State<LotteryPurchaseSheet> {
child: Text( child: Text(
number.toString().padLeft(2, '0'), number.toString().padLeft(2, '0'),
style: TextStyle( style: TextStyle(
color: color: isSpecialNumber
isSpecialNumber ? Theme.of(context).colorScheme.onSecondary
? Theme.of(context).colorScheme.onSecondary : isSelected
: isSelected ? Theme.of(context).colorScheme.onPrimary
? Theme.of(context).colorScheme.onPrimary : Theme.of(context).colorScheme.onSurface,
: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@@ -773,25 +768,22 @@ class _LotteryPurchaseSheetState extends State<LotteryPurchaseSheet> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Column( child: Column(
children: children: prizeStructure.entries.map((entry) {
prizeStructure.entries.map((entry) { return Padding(
return Padding( padding: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.only(bottom: 8), child: Row(
child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
children: [ Text(
Text( entry.key == '0+Special'
entry.key == '0+Special' ? 'specialOnly'.tr()
? 'specialOnly'.tr() : entry.key.tr(),
: entry.key.tr(),
),
Text(
'${entry.value} ${'walletCurrencyShortPoints'.tr()}',
),
],
), ),
); Text('${entry.value} ${'walletCurrencyShortPoints'.tr()}'),
}).toList(), ],
),
);
}).toList(),
), ),
), ),
); );