🐛 Fix serval bugs
This commit is contained in:
@@ -127,13 +127,9 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
|
||||
// Stickers grid
|
||||
Expanded(
|
||||
child: packContent.when(
|
||||
data:
|
||||
(stickers) => RefreshIndicator(
|
||||
onRefresh:
|
||||
() => ref.refresh(
|
||||
marketplaceStickerPackContentProvider(
|
||||
packId: id,
|
||||
).future,
|
||||
data: (stickers) => RefreshIndicator(
|
||||
onRefresh: () => ref.refresh(
|
||||
marketplaceStickerPackContentProvider(packId: id).future,
|
||||
),
|
||||
child: GridView.builder(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -157,8 +153,7 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Theme.of(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainer,
|
||||
borderRadius: const BorderRadius.all(
|
||||
@@ -178,9 +173,7 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
error:
|
||||
(err, _) =>
|
||||
Text(
|
||||
error: (err, _) => Text(
|
||||
'Error: $err',
|
||||
).textAlignment(TextAlign.center).center(),
|
||||
loading: () => const CircularProgressIndicator().center(),
|
||||
@@ -189,27 +182,21 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
||||
child: owned.when(
|
||||
data:
|
||||
(isOwned) => FilledButton.icon(
|
||||
onPressed:
|
||||
isOwned
|
||||
data: (isOwned) => FilledButton.icon(
|
||||
onPressed: isOwned
|
||||
? removePackFromMyCollection
|
||||
: addPackToMyCollection,
|
||||
icon: Icon(
|
||||
isOwned ? Symbols.remove_circle : Symbols.add_circle,
|
||||
),
|
||||
label: Text(
|
||||
isOwned ? 'removePack'.tr() : 'addPack'.tr(),
|
||||
label: Text(isOwned ? 'removePack'.tr() : 'addPack'.tr()),
|
||||
),
|
||||
),
|
||||
loading:
|
||||
() => const SizedBox(
|
||||
loading: () => const SizedBox(
|
||||
height: 32,
|
||||
width: 32,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
error:
|
||||
(_, _) => OutlinedButton.icon(
|
||||
).center(),
|
||||
error: (_, _) => OutlinedButton.icon(
|
||||
onPressed: addPackToMyCollection,
|
||||
icon: const Icon(Symbols.add_circle),
|
||||
label: Text('addPack').tr(),
|
||||
@@ -220,8 +207,7 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
|
||||
],
|
||||
);
|
||||
},
|
||||
error:
|
||||
(err, _) =>
|
||||
error: (err, _) =>
|
||||
Text('Error: $err').textAlignment(TextAlign.center).center(),
|
||||
loading: () => const CircularProgressIndicator().center(),
|
||||
),
|
||||
|
||||
@@ -60,8 +60,7 @@ class MarketplaceStickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
|
||||
);
|
||||
|
||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||
final stickers =
|
||||
response.data
|
||||
final stickers = response.data
|
||||
.map((e) => SnStickerPack.fromJson(e))
|
||||
.cast<SnStickerPack>()
|
||||
.toList();
|
||||
@@ -112,12 +111,10 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
||||
onPressed: () {
|
||||
query.value = query.value.copyWith(byUsage: !query.value.byUsage);
|
||||
},
|
||||
icon:
|
||||
query.value.byUsage
|
||||
icon: query.value.byUsage
|
||||
? const Icon(Symbols.local_fire_department)
|
||||
: const Icon(Symbols.access_time),
|
||||
tooltip:
|
||||
query.value.byUsage
|
||||
tooltip: query.value.byUsage
|
||||
? 'orderByPopularity'.tr()
|
||||
: 'orderByReleaseDate'.tr(),
|
||||
),
|
||||
@@ -137,8 +134,8 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
||||
padding: WidgetStateProperty.all(
|
||||
const EdgeInsets.symmetric(horizontal: 24),
|
||||
),
|
||||
onTapOutside:
|
||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
onTapOutside: (_) =>
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
trailing: [
|
||||
if (query.value.query != null && query.value.query!.isNotEmpty)
|
||||
IconButton(
|
||||
@@ -171,14 +168,13 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
provider: marketplaceStickerPacksNotifierProvider,
|
||||
notifier: marketplaceStickerPacksNotifierProvider.notifier,
|
||||
itemBuilder:
|
||||
(context, idx, pack) => Card(
|
||||
itemBuilder: (context, idx, pack) => Card(
|
||||
margin: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
if (pack.stickers.isNotEmpty)
|
||||
Container(
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondaryContainer,
|
||||
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
@@ -200,11 +196,8 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
||||
maxWidth: 80,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
8,
|
||||
),
|
||||
color:
|
||||
Theme.of(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.tertiaryContainer,
|
||||
),
|
||||
@@ -234,14 +227,12 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
||||
borderRadius: BorderRadius.circular(
|
||||
8,
|
||||
),
|
||||
color:
|
||||
Theme.of(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.tertiaryContainer,
|
||||
),
|
||||
child: CloudImageWidget(
|
||||
file:
|
||||
pack.stickers[index + 4].image,
|
||||
file: pack.stickers[index + 4].image,
|
||||
),
|
||||
).clipRRect(all: 8),
|
||||
),
|
||||
@@ -254,8 +245,7 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
||||
ListTile(
|
||||
leading: Container(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Theme.of(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.tertiaryContainer,
|
||||
borderRadius: const BorderRadius.all(
|
||||
@@ -263,7 +253,7 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
child: CloudImageWidget(
|
||||
file: pack.icon ?? pack.stickers.first.image,
|
||||
file: pack.icon ?? pack.stickers.firstOrNull?.image,
|
||||
),
|
||||
).width(40).height(40).clipRRect(all: 8),
|
||||
shape: RoundedRectangleBorder(
|
||||
|
||||
Reference in New Issue
Block a user