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