👽 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,16 +352,13 @@ 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 = textColor = isSpecial
isSpecial
? Theme.of(context).colorScheme.onSecondary ? Theme.of(context).colorScheme.onSecondary
: Theme.of(context).colorScheme.onSurface; : Theme.of(context).colorScheme.onSurface;
borderColor = borderColor = isSpecial
isSpecial
? Theme.of(context).colorScheme.secondary ? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.outline.withOpacity(0.3); : Theme.of(context).colorScheme.outline.withOpacity(0.3);
@@ -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( : Theme.of(context).colorScheme.outline.withOpacity(0.3),
context,
).colorScheme.outline.withOpacity(0.3),
), ),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
@@ -701,8 +697,7 @@ 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
@@ -773,8 +768,7 @@ 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(
@@ -785,9 +779,7 @@ class _LotteryPurchaseSheetState extends State<LotteryPurchaseSheet> {
? 'specialOnly'.tr() ? 'specialOnly'.tr()
: entry.key.tr(), : entry.key.tr(),
), ),
Text( Text('${entry.value} ${'walletCurrencyShortPoints'.tr()}'),
'${entry.value} ${'walletCurrencyShortPoints'.tr()}',
),
], ],
), ),
); );