💄 New sticker marketplace card
This commit is contained in:
@@ -1,60 +1,72 @@
|
|||||||
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/sticker.dart';
|
import 'package:island/models/sticker.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:island/widgets/content/cloud_files.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
|
|
||||||
part 'sticker_marketplace.g.dart';
|
part 'sticker_marketplace.freezed.dart';
|
||||||
|
|
||||||
@riverpod
|
@freezed
|
||||||
class MarketplaceStickerPacksNotifier extends _$MarketplaceStickerPacksNotifier
|
sealed class MarketplaceStickerQuery with _$MarketplaceStickerQuery {
|
||||||
with CursorPagingNotifierMixin<SnStickerPack> {
|
const factory MarketplaceStickerQuery({
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnStickerPack>> build({
|
|
||||||
required String? query,
|
|
||||||
required bool byUsage,
|
required bool byUsage,
|
||||||
}) {
|
required String? query,
|
||||||
return fetch(cursor: null);
|
}) = _MarketplaceStickerQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final marketplaceStickerPacksNotifierProvider = AsyncNotifierProvider(
|
||||||
|
MarketplaceStickerPacksNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class MarketplaceStickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
|
||||||
|
with
|
||||||
|
AsyncPaginationController<SnStickerPack>,
|
||||||
|
AsyncPaginationFilter<MarketplaceStickerQuery, SnStickerPack> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnStickerPack>> fetch({
|
MarketplaceStickerQuery currentFilter = MarketplaceStickerQuery(
|
||||||
required String? cursor,
|
byUsage: true,
|
||||||
}) async {
|
query: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<SnStickerPack>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/stickers',
|
'/sphere/stickers',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'offset': offset,
|
'offset': fetchedCount.toString(),
|
||||||
'take': 20,
|
'take': pageSize,
|
||||||
'order': byUsage ? 'usage' : 'date',
|
'order': currentFilter.byUsage ? 'usage' : 'date',
|
||||||
if (query != null && query!.isNotEmpty) 'query': query,
|
if (currentFilter.query != null && currentFilter.query!.isNotEmpty)
|
||||||
|
'query': currentFilter.query,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final stickers =
|
||||||
final stickers = data.map((e) => SnStickerPack.fromJson(e)).toList();
|
response.data
|
||||||
|
.map((e) => SnStickerPack.fromJson(e))
|
||||||
|
.cast<SnStickerPack>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + stickers.length < total;
|
return stickers;
|
||||||
final nextCursor = hasMore ? (offset + stickers.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: stickers,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,17 +77,23 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final byUsage = useState(true);
|
final query = useState<MarketplaceStickerQuery>(
|
||||||
final query = useState<String?>(null);
|
MarketplaceStickerQuery(byUsage: true, query: null),
|
||||||
|
);
|
||||||
final searchController = useTextEditingController();
|
final searchController = useTextEditingController();
|
||||||
final focusNode = useFocusNode();
|
final focusNode = useFocusNode();
|
||||||
final debounceTimer = useState<Timer?>(null);
|
final debounceTimer = useState<Timer?>(null);
|
||||||
|
|
||||||
|
final notifier = ref.watch(
|
||||||
|
marketplaceStickerPacksNotifierProvider.notifier,
|
||||||
|
);
|
||||||
|
|
||||||
// Clear search when query is cleared
|
// Clear search when query is cleared
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
if (query.value == null || query.value!.isEmpty) {
|
if (query.value.query == null || query.value.query!.isEmpty) {
|
||||||
searchController.clear();
|
searchController.clear();
|
||||||
}
|
}
|
||||||
|
notifier.applyFilter(query.value);
|
||||||
return null;
|
return null;
|
||||||
}, [query]);
|
}, [query]);
|
||||||
|
|
||||||
@@ -92,107 +110,185 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
|
|||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
byUsage.value = !byUsage.value;
|
query.value = query.value.copyWith(byUsage: !query.value.byUsage);
|
||||||
},
|
},
|
||||||
icon:
|
icon:
|
||||||
byUsage.value
|
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:
|
||||||
byUsage.value
|
query.value.byUsage
|
||||||
? 'orderByPopularity'.tr()
|
? 'orderByPopularity'.tr()
|
||||||
: 'orderByReleaseDate'.tr(),
|
: 'orderByReleaseDate'.tr(),
|
||||||
),
|
),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: PagingHelperView(
|
body: Column(
|
||||||
provider: marketplaceStickerPacksNotifierProvider(
|
children: [
|
||||||
byUsage: byUsage.value,
|
Padding(
|
||||||
query: query.value,
|
padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
|
||||||
),
|
child: SearchBar(
|
||||||
futureRefreshable:
|
elevation: WidgetStateProperty.all(4),
|
||||||
marketplaceStickerPacksNotifierProvider(
|
controller: searchController,
|
||||||
byUsage: byUsage.value,
|
focusNode: focusNode,
|
||||||
query: query.value,
|
hintText: 'search'.tr(),
|
||||||
).future,
|
leading: const Icon(Symbols.search),
|
||||||
notifierRefreshable:
|
padding: WidgetStateProperty.all(
|
||||||
marketplaceStickerPacksNotifierProvider(
|
const EdgeInsets.symmetric(horizontal: 24),
|
||||||
byUsage: byUsage.value,
|
),
|
||||||
query: query.value,
|
onTapOutside:
|
||||||
).notifier,
|
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
contentBuilder:
|
trailing: [
|
||||||
(data, widgetCount, endItemView) => Column(
|
if (query.value.query != null && query.value.query!.isNotEmpty)
|
||||||
children: [
|
IconButton(
|
||||||
// Search bar above the list
|
icon: const Icon(Symbols.close),
|
||||||
Padding(
|
onPressed: () {
|
||||||
padding: const EdgeInsets.all(16),
|
query.value = query.value.copyWith(query: null);
|
||||||
child: SearchBar(
|
searchController.clear();
|
||||||
elevation: WidgetStateProperty.all(4),
|
|
||||||
controller: searchController,
|
|
||||||
focusNode: focusNode,
|
|
||||||
hintText: 'search'.tr(),
|
|
||||||
leading: const Icon(Symbols.search),
|
|
||||||
padding: WidgetStateProperty.all(
|
|
||||||
const EdgeInsets.symmetric(horizontal: 24),
|
|
||||||
),
|
|
||||||
onTapOutside:
|
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
trailing: [
|
|
||||||
if (query.value != null && query.value!.isNotEmpty)
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Symbols.close),
|
|
||||||
onPressed: () {
|
|
||||||
query.value = null;
|
|
||||||
searchController.clear();
|
|
||||||
focusNode.unfocus();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onChanged: (value) {
|
|
||||||
// Debounce search to avoid excessive API calls
|
|
||||||
debounceTimer.value?.cancel();
|
|
||||||
debounceTimer.value = Timer(
|
|
||||||
const Duration(milliseconds: 500),
|
|
||||||
() {
|
|
||||||
query.value = value.isEmpty ? null : value;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onSubmitted: (value) {
|
|
||||||
query.value = value.isEmpty ? null : value;
|
|
||||||
focusNode.unfocus();
|
focusNode.unfocus();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: ListView.builder(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final pack = data.items[index];
|
|
||||||
return ListTile(
|
|
||||||
title: Text(pack.name),
|
|
||||||
subtitle: Text(pack.description),
|
|
||||||
trailing: const Icon(Symbols.chevron_right),
|
|
||||||
onTap: () {
|
|
||||||
// Navigate to user-facing sticker pack detail page.
|
|
||||||
// Adjust the route name/parameters if your app uses different ones.
|
|
||||||
context.pushNamed(
|
|
||||||
'stickerPackDetail',
|
|
||||||
pathParameters: {'packId': pack.id},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
|
onChanged: (value) {
|
||||||
|
// Debounce search to avoid excessive API calls
|
||||||
|
debounceTimer.value?.cancel();
|
||||||
|
debounceTimer.value = Timer(
|
||||||
|
const Duration(milliseconds: 500),
|
||||||
|
() {
|
||||||
|
query.value = query.value.copyWith(query: value);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onSubmitted: (value) {
|
||||||
|
query.value = query.value.copyWith(query: value);
|
||||||
|
focusNode.unfocus();
|
||||||
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: PaginationList(
|
||||||
|
padding: EdgeInsets.only(top: 8),
|
||||||
|
provider: marketplaceStickerPacksNotifierProvider,
|
||||||
|
notifier: marketplaceStickerPacksNotifierProvider.notifier,
|
||||||
|
itemBuilder:
|
||||||
|
(context, idx, pack) => Card(
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color:
|
||||||
|
Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 20,
|
||||||
|
vertical: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: List.generate(
|
||||||
|
math.min(pack.stickers.length, 4),
|
||||||
|
(index) => Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
right: index < 3 ? 8 : 0,
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
maxWidth: 80,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
8,
|
||||||
|
),
|
||||||
|
color:
|
||||||
|
Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.tertiaryContainer,
|
||||||
|
),
|
||||||
|
child: CloudImageWidget(
|
||||||
|
file: pack.stickers[index].image,
|
||||||
|
),
|
||||||
|
).clipRRect(all: 8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (pack.stickers.length > 4)
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
if (pack.stickers.length > 4)
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: List.generate(
|
||||||
|
math.min(pack.stickers.length - 4, 4),
|
||||||
|
(index) => Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
right: index < 3 ? 8 : 0,
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
maxWidth: 80,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
8,
|
||||||
|
),
|
||||||
|
color:
|
||||||
|
Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.tertiaryContainer,
|
||||||
|
),
|
||||||
|
child: CloudImageWidget(
|
||||||
|
file:
|
||||||
|
pack.stickers[index + 4].image,
|
||||||
|
),
|
||||||
|
).clipRRect(all: 8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).clipRRect(topLeft: 8, topRight: 8),
|
||||||
|
ListTile(
|
||||||
|
leading: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.tertiaryContainer,
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: CloudImageWidget(
|
||||||
|
file: pack.icon ?? pack.stickers.first.image,
|
||||||
|
),
|
||||||
|
).width(40).height(40).clipRRect(all: 8),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Text(pack.name),
|
||||||
|
subtitle: Text(pack.description),
|
||||||
|
trailing: const Icon(Symbols.chevron_right),
|
||||||
|
onTap: () {
|
||||||
|
// Navigate to user-facing sticker pack detail page.
|
||||||
|
// Adjust the route name/parameters if your app uses different ones.
|
||||||
|
context.pushNamed(
|
||||||
|
'stickerPackDetail',
|
||||||
|
pathParameters: {'packId': pack.id},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
268
lib/screens/stickers/sticker_marketplace.freezed.dart
Normal file
268
lib/screens/stickers/sticker_marketplace.freezed.dart
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'sticker_marketplace.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$MarketplaceStickerQuery {
|
||||||
|
|
||||||
|
bool get byUsage; String? get query;
|
||||||
|
/// Create a copy of MarketplaceStickerQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$MarketplaceStickerQueryCopyWith<MarketplaceStickerQuery> get copyWith => _$MarketplaceStickerQueryCopyWithImpl<MarketplaceStickerQuery>(this as MarketplaceStickerQuery, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is MarketplaceStickerQuery&&(identical(other.byUsage, byUsage) || other.byUsage == byUsage)&&(identical(other.query, query) || other.query == query));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,byUsage,query);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'MarketplaceStickerQuery(byUsage: $byUsage, query: $query)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $MarketplaceStickerQueryCopyWith<$Res> {
|
||||||
|
factory $MarketplaceStickerQueryCopyWith(MarketplaceStickerQuery value, $Res Function(MarketplaceStickerQuery) _then) = _$MarketplaceStickerQueryCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
bool byUsage, String? query
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$MarketplaceStickerQueryCopyWithImpl<$Res>
|
||||||
|
implements $MarketplaceStickerQueryCopyWith<$Res> {
|
||||||
|
_$MarketplaceStickerQueryCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final MarketplaceStickerQuery _self;
|
||||||
|
final $Res Function(MarketplaceStickerQuery) _then;
|
||||||
|
|
||||||
|
/// Create a copy of MarketplaceStickerQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? byUsage = null,Object? query = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
byUsage: null == byUsage ? _self.byUsage : byUsage // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,query: freezed == query ? _self.query : query // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [MarketplaceStickerQuery].
|
||||||
|
extension MarketplaceStickerQueryPatterns on MarketplaceStickerQuery {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _MarketplaceStickerQuery value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _MarketplaceStickerQuery() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _MarketplaceStickerQuery value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _MarketplaceStickerQuery():
|
||||||
|
return $default(_that);}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _MarketplaceStickerQuery value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _MarketplaceStickerQuery() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool byUsage, String? query)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _MarketplaceStickerQuery() when $default != null:
|
||||||
|
return $default(_that.byUsage,_that.query);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool byUsage, String? query) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _MarketplaceStickerQuery():
|
||||||
|
return $default(_that.byUsage,_that.query);}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool byUsage, String? query)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _MarketplaceStickerQuery() when $default != null:
|
||||||
|
return $default(_that.byUsage,_that.query);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class _MarketplaceStickerQuery implements MarketplaceStickerQuery {
|
||||||
|
const _MarketplaceStickerQuery({required this.byUsage, required this.query});
|
||||||
|
|
||||||
|
|
||||||
|
@override final bool byUsage;
|
||||||
|
@override final String? query;
|
||||||
|
|
||||||
|
/// Create a copy of MarketplaceStickerQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$MarketplaceStickerQueryCopyWith<_MarketplaceStickerQuery> get copyWith => __$MarketplaceStickerQueryCopyWithImpl<_MarketplaceStickerQuery>(this, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _MarketplaceStickerQuery&&(identical(other.byUsage, byUsage) || other.byUsage == byUsage)&&(identical(other.query, query) || other.query == query));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,byUsage,query);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'MarketplaceStickerQuery(byUsage: $byUsage, query: $query)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$MarketplaceStickerQueryCopyWith<$Res> implements $MarketplaceStickerQueryCopyWith<$Res> {
|
||||||
|
factory _$MarketplaceStickerQueryCopyWith(_MarketplaceStickerQuery value, $Res Function(_MarketplaceStickerQuery) _then) = __$MarketplaceStickerQueryCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
bool byUsage, String? query
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$MarketplaceStickerQueryCopyWithImpl<$Res>
|
||||||
|
implements _$MarketplaceStickerQueryCopyWith<$Res> {
|
||||||
|
__$MarketplaceStickerQueryCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _MarketplaceStickerQuery _self;
|
||||||
|
final $Res Function(_MarketplaceStickerQuery) _then;
|
||||||
|
|
||||||
|
/// Create a copy of MarketplaceStickerQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? byUsage = null,Object? query = freezed,}) {
|
||||||
|
return _then(_MarketplaceStickerQuery(
|
||||||
|
byUsage: null == byUsage ? _self.byUsage : byUsage // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,query: freezed == query ? _self.query : query // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'sticker_marketplace.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
String _$marketplaceStickerPacksNotifierHash() =>
|
|
||||||
r'3bde76e18bb024f45ff6261fe735cdba97b02808';
|
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$MarketplaceStickerPacksNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnStickerPack>> {
|
|
||||||
late final String? query;
|
|
||||||
late final bool byUsage;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnStickerPack>> build({
|
|
||||||
required String? query,
|
|
||||||
required bool byUsage,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [MarketplaceStickerPacksNotifier].
|
|
||||||
@ProviderFor(MarketplaceStickerPacksNotifier)
|
|
||||||
const marketplaceStickerPacksNotifierProvider =
|
|
||||||
MarketplaceStickerPacksNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [MarketplaceStickerPacksNotifier].
|
|
||||||
class MarketplaceStickerPacksNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnStickerPack>>> {
|
|
||||||
/// See also [MarketplaceStickerPacksNotifier].
|
|
||||||
const MarketplaceStickerPacksNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [MarketplaceStickerPacksNotifier].
|
|
||||||
MarketplaceStickerPacksNotifierProvider call({
|
|
||||||
required String? query,
|
|
||||||
required bool byUsage,
|
|
||||||
}) {
|
|
||||||
return MarketplaceStickerPacksNotifierProvider(
|
|
||||||
query: query,
|
|
||||||
byUsage: byUsage,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
MarketplaceStickerPacksNotifierProvider getProviderOverride(
|
|
||||||
covariant MarketplaceStickerPacksNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(query: provider.query, byUsage: provider.byUsage);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'marketplaceStickerPacksNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [MarketplaceStickerPacksNotifier].
|
|
||||||
class MarketplaceStickerPacksNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
MarketplaceStickerPacksNotifier,
|
|
||||||
CursorPagingData<SnStickerPack>
|
|
||||||
> {
|
|
||||||
/// See also [MarketplaceStickerPacksNotifier].
|
|
||||||
MarketplaceStickerPacksNotifierProvider({
|
|
||||||
required String? query,
|
|
||||||
required bool byUsage,
|
|
||||||
}) : this._internal(
|
|
||||||
() =>
|
|
||||||
MarketplaceStickerPacksNotifier()
|
|
||||||
..query = query
|
|
||||||
..byUsage = byUsage,
|
|
||||||
from: marketplaceStickerPacksNotifierProvider,
|
|
||||||
name: r'marketplaceStickerPacksNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$marketplaceStickerPacksNotifierHash,
|
|
||||||
dependencies: MarketplaceStickerPacksNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
MarketplaceStickerPacksNotifierFamily._allTransitiveDependencies,
|
|
||||||
query: query,
|
|
||||||
byUsage: byUsage,
|
|
||||||
);
|
|
||||||
|
|
||||||
MarketplaceStickerPacksNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.query,
|
|
||||||
required this.byUsage,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? query;
|
|
||||||
final bool byUsage;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<CursorPagingData<SnStickerPack>> runNotifierBuild(
|
|
||||||
covariant MarketplaceStickerPacksNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(query: query, byUsage: byUsage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(MarketplaceStickerPacksNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: MarketplaceStickerPacksNotifierProvider._internal(
|
|
||||||
() =>
|
|
||||||
create()
|
|
||||||
..query = query
|
|
||||||
..byUsage = byUsage,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
query: query,
|
|
||||||
byUsage: byUsage,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
MarketplaceStickerPacksNotifier,
|
|
||||||
CursorPagingData<SnStickerPack>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _MarketplaceStickerPacksNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is MarketplaceStickerPacksNotifierProvider &&
|
|
||||||
other.query == query &&
|
|
||||||
other.byUsage == byUsage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, query.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, byUsage.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin MarketplaceStickerPacksNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnStickerPack>> {
|
|
||||||
/// The parameter `query` of this provider.
|
|
||||||
String? get query;
|
|
||||||
|
|
||||||
/// The parameter `byUsage` of this provider.
|
|
||||||
bool get byUsage;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MarketplaceStickerPacksNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
MarketplaceStickerPacksNotifier,
|
|
||||||
CursorPagingData<SnStickerPack>
|
|
||||||
>
|
|
||||||
with MarketplaceStickerPacksNotifierRef {
|
|
||||||
_MarketplaceStickerPacksNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get query =>
|
|
||||||
(origin as MarketplaceStickerPacksNotifierProvider).query;
|
|
||||||
@override
|
|
||||||
bool get byUsage =>
|
|
||||||
(origin as MarketplaceStickerPacksNotifierProvider).byUsage;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
Reference in New Issue
Block a user