🎨 Use feature based folder structure
This commit is contained in:
103
lib/core/models/activity.dart
Normal file
103
lib/core/models/activity.dart
Normal file
@@ -0,0 +1,103 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:island/accounts/accounts_models/account.dart';
|
||||
|
||||
part 'activity.freezed.dart';
|
||||
part 'activity.g.dart';
|
||||
|
||||
@freezed
|
||||
sealed class SnNotableDay with _$SnNotableDay {
|
||||
const factory SnNotableDay({
|
||||
required DateTime date,
|
||||
required String localName,
|
||||
required String globalName,
|
||||
required String? countryCode,
|
||||
required String? localizableKey,
|
||||
required List<int> holidays,
|
||||
}) = _SnNotableDay;
|
||||
|
||||
factory SnNotableDay.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnNotableDayFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnTimelineEvent with _$SnTimelineEvent {
|
||||
const factory SnTimelineEvent({
|
||||
required String id,
|
||||
required String type,
|
||||
required String resourceIdentifier,
|
||||
required dynamic data,
|
||||
required DateTime createdAt,
|
||||
required DateTime updatedAt,
|
||||
required DateTime? deletedAt,
|
||||
}) = _SnTimelineEvent;
|
||||
|
||||
factory SnTimelineEvent.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnTimelineEventFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnCheckInResult with _$SnCheckInResult {
|
||||
const factory SnCheckInResult({
|
||||
required String id,
|
||||
required int level,
|
||||
required List<SnFortuneTip> tips,
|
||||
required String accountId,
|
||||
required SnAccount? account,
|
||||
required DateTime createdAt,
|
||||
required DateTime updatedAt,
|
||||
required DateTime? deletedAt,
|
||||
}) = _SnCheckInResult;
|
||||
|
||||
factory SnCheckInResult.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnCheckInResultFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnFortuneTip with _$SnFortuneTip {
|
||||
const factory SnFortuneTip({
|
||||
required bool isPositive,
|
||||
required String title,
|
||||
required String content,
|
||||
}) = _SnFortuneTip;
|
||||
|
||||
factory SnFortuneTip.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnFortuneTipFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnEventCalendarEntry with _$SnEventCalendarEntry {
|
||||
const factory SnEventCalendarEntry({
|
||||
required DateTime date,
|
||||
required SnCheckInResult? checkInResult,
|
||||
required List<SnAccountStatus> statuses,
|
||||
}) = _SnEventCalendarEntry;
|
||||
|
||||
factory SnEventCalendarEntry.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnEventCalendarEntryFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnPresenceActivity with _$SnPresenceActivity {
|
||||
const factory SnPresenceActivity({
|
||||
required String id,
|
||||
required int type,
|
||||
required String? manualId,
|
||||
required String? title,
|
||||
required String? subtitle,
|
||||
required String? caption,
|
||||
required String? titleUrl,
|
||||
required String? subtitleUrl,
|
||||
required String? smallImage,
|
||||
required String? largeImage,
|
||||
required Map<String, dynamic>? meta,
|
||||
required int leaseMinutes,
|
||||
required DateTime leaseExpiresAt,
|
||||
required String accountId,
|
||||
required DateTime createdAt,
|
||||
required DateTime updatedAt,
|
||||
required DateTime? deletedAt,
|
||||
}) = _SnPresenceActivity;
|
||||
|
||||
factory SnPresenceActivity.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnPresenceActivityFromJson(json);
|
||||
}
|
||||
1744
lib/core/models/activity.freezed.dart
Normal file
1744
lib/core/models/activity.freezed.dart
Normal file
File diff suppressed because it is too large
Load Diff
163
lib/core/models/activity.g.dart
Normal file
163
lib/core/models/activity.g.dart
Normal file
@@ -0,0 +1,163 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'activity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_SnNotableDay _$SnNotableDayFromJson(Map<String, dynamic> json) =>
|
||||
_SnNotableDay(
|
||||
date: DateTime.parse(json['date'] as String),
|
||||
localName: json['local_name'] as String,
|
||||
globalName: json['global_name'] as String,
|
||||
countryCode: json['country_code'] as String?,
|
||||
localizableKey: json['localizable_key'] as String?,
|
||||
holidays: (json['holidays'] as List<dynamic>)
|
||||
.map((e) => (e as num).toInt())
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnNotableDayToJson(_SnNotableDay instance) =>
|
||||
<String, dynamic>{
|
||||
'date': instance.date.toIso8601String(),
|
||||
'local_name': instance.localName,
|
||||
'global_name': instance.globalName,
|
||||
'country_code': instance.countryCode,
|
||||
'localizable_key': instance.localizableKey,
|
||||
'holidays': instance.holidays,
|
||||
};
|
||||
|
||||
_SnTimelineEvent _$SnTimelineEventFromJson(Map<String, dynamic> json) =>
|
||||
_SnTimelineEvent(
|
||||
id: json['id'] as String,
|
||||
type: json['type'] as String,
|
||||
resourceIdentifier: json['resource_identifier'] as String,
|
||||
data: json['data'],
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnTimelineEventToJson(_SnTimelineEvent instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'type': instance.type,
|
||||
'resource_identifier': instance.resourceIdentifier,
|
||||
'data': instance.data,
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
'updated_at': instance.updatedAt.toIso8601String(),
|
||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
_SnCheckInResult _$SnCheckInResultFromJson(Map<String, dynamic> json) =>
|
||||
_SnCheckInResult(
|
||||
id: json['id'] as String,
|
||||
level: (json['level'] as num).toInt(),
|
||||
tips: (json['tips'] as List<dynamic>)
|
||||
.map((e) => SnFortuneTip.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
accountId: json['account_id'] as String,
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnCheckInResultToJson(_SnCheckInResult instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'level': instance.level,
|
||||
'tips': instance.tips.map((e) => e.toJson()).toList(),
|
||||
'account_id': instance.accountId,
|
||||
'account': instance.account?.toJson(),
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
'updated_at': instance.updatedAt.toIso8601String(),
|
||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
_SnFortuneTip _$SnFortuneTipFromJson(Map<String, dynamic> json) =>
|
||||
_SnFortuneTip(
|
||||
isPositive: json['is_positive'] as bool,
|
||||
title: json['title'] as String,
|
||||
content: json['content'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnFortuneTipToJson(_SnFortuneTip instance) =>
|
||||
<String, dynamic>{
|
||||
'is_positive': instance.isPositive,
|
||||
'title': instance.title,
|
||||
'content': instance.content,
|
||||
};
|
||||
|
||||
_SnEventCalendarEntry _$SnEventCalendarEntryFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _SnEventCalendarEntry(
|
||||
date: DateTime.parse(json['date'] as String),
|
||||
checkInResult: json['check_in_result'] == null
|
||||
? null
|
||||
: SnCheckInResult.fromJson(
|
||||
json['check_in_result'] as Map<String, dynamic>,
|
||||
),
|
||||
statuses: (json['statuses'] as List<dynamic>)
|
||||
.map((e) => SnAccountStatus.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnEventCalendarEntryToJson(
|
||||
_SnEventCalendarEntry instance,
|
||||
) => <String, dynamic>{
|
||||
'date': instance.date.toIso8601String(),
|
||||
'check_in_result': instance.checkInResult?.toJson(),
|
||||
'statuses': instance.statuses.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
|
||||
_SnPresenceActivity _$SnPresenceActivityFromJson(Map<String, dynamic> json) =>
|
||||
_SnPresenceActivity(
|
||||
id: json['id'] as String,
|
||||
type: (json['type'] as num).toInt(),
|
||||
manualId: json['manual_id'] as String?,
|
||||
title: json['title'] as String?,
|
||||
subtitle: json['subtitle'] as String?,
|
||||
caption: json['caption'] as String?,
|
||||
titleUrl: json['title_url'] as String?,
|
||||
subtitleUrl: json['subtitle_url'] as String?,
|
||||
smallImage: json['small_image'] as String?,
|
||||
largeImage: json['large_image'] as String?,
|
||||
meta: json['meta'] as Map<String, dynamic>?,
|
||||
leaseMinutes: (json['lease_minutes'] as num).toInt(),
|
||||
leaseExpiresAt: DateTime.parse(json['lease_expires_at'] as String),
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnPresenceActivityToJson(_SnPresenceActivity instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'type': instance.type,
|
||||
'manual_id': instance.manualId,
|
||||
'title': instance.title,
|
||||
'subtitle': instance.subtitle,
|
||||
'caption': instance.caption,
|
||||
'title_url': instance.titleUrl,
|
||||
'subtitle_url': instance.subtitleUrl,
|
||||
'small_image': instance.smallImage,
|
||||
'large_image': instance.largeImage,
|
||||
'meta': instance.meta,
|
||||
'lease_minutes': instance.leaseMinutes,
|
||||
'lease_expires_at': instance.leaseExpiresAt.toIso8601String(),
|
||||
'account_id': instance.accountId,
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
'updated_at': instance.updatedAt.toIso8601String(),
|
||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||
};
|
||||
108
lib/core/models/activitypub.dart
Normal file
108
lib/core/models/activitypub.dart
Normal file
@@ -0,0 +1,108 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'activitypub.freezed.dart';
|
||||
part 'activitypub.g.dart';
|
||||
|
||||
@freezed
|
||||
sealed class SnActivityPubInstance with _$SnActivityPubInstance {
|
||||
const factory SnActivityPubInstance({
|
||||
required String id,
|
||||
required String domain,
|
||||
String? name,
|
||||
String? description,
|
||||
String? software,
|
||||
String? version,
|
||||
String? iconUrl,
|
||||
String? thumbnailUrl,
|
||||
String? contactEmail,
|
||||
String? contactAccountUsername,
|
||||
int? activeUsers,
|
||||
@Default(false) bool isBlocked,
|
||||
@Default(false) bool isSilenced,
|
||||
String? blockReason,
|
||||
Map<String, dynamic>? metadata,
|
||||
DateTime? lastFetchedAt,
|
||||
DateTime? lastActivityAt,
|
||||
DateTime? metadataFetchedAt,
|
||||
}) = _SnActivityPubInstance;
|
||||
|
||||
factory SnActivityPubInstance.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnActivityPubInstanceFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnActivityPubUser with _$SnActivityPubUser {
|
||||
const factory SnActivityPubUser({
|
||||
required String actorUri,
|
||||
required String username,
|
||||
required String displayName,
|
||||
required String bio,
|
||||
required String avatarUrl,
|
||||
required DateTime followedAt,
|
||||
required bool isLocal,
|
||||
required String instanceDomain,
|
||||
}) = _SnActivityPubUser;
|
||||
|
||||
factory SnActivityPubUser.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnActivityPubUserFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnActivityPubActor with _$SnActivityPubActor {
|
||||
const factory SnActivityPubActor({
|
||||
required String id,
|
||||
required String uri,
|
||||
@Default('') String type,
|
||||
String? displayName,
|
||||
String? username,
|
||||
String? summary,
|
||||
String? inboxUri,
|
||||
String? outboxUri,
|
||||
String? followersUri,
|
||||
String? followingUri,
|
||||
String? featuredUri,
|
||||
String? avatarUrl,
|
||||
String? headerUrl,
|
||||
String? publicKeyId,
|
||||
String? publicKey,
|
||||
@Default(false) bool isBot,
|
||||
@Default(false) bool isLocked,
|
||||
@Default(true) bool discoverable,
|
||||
@Default(false) bool manuallyApprovesFollowers,
|
||||
Map<String, dynamic>? endpoints,
|
||||
Map<String, dynamic>? publicKeyData,
|
||||
Map<String, dynamic>? metadata,
|
||||
DateTime? lastFetchedAt,
|
||||
DateTime? lastActivityAt,
|
||||
required SnActivityPubInstance instance,
|
||||
required String instanceId,
|
||||
bool? isFollowing,
|
||||
}) = _SnActivityPubActor;
|
||||
|
||||
factory SnActivityPubActor.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnActivityPubActorFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnActivityPubFollowResponse with _$SnActivityPubFollowResponse {
|
||||
const factory SnActivityPubFollowResponse({
|
||||
required bool success,
|
||||
required String message,
|
||||
}) = _SnActivityPubFollowResponse;
|
||||
|
||||
factory SnActivityPubFollowResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnActivityPubFollowResponseFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class SnActorStatusResponse with _$SnActorStatusResponse {
|
||||
const factory SnActorStatusResponse({
|
||||
required bool enabled,
|
||||
@Default(0) int followerCount,
|
||||
SnActivityPubActor? actor,
|
||||
String? actorUri,
|
||||
}) = _SnActorStatusResponse;
|
||||
|
||||
factory SnActorStatusResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnActorStatusResponseFromJson(json);
|
||||
}
|
||||
1535
lib/core/models/activitypub.freezed.dart
Normal file
1535
lib/core/models/activitypub.freezed.dart
Normal file
File diff suppressed because it is too large
Load Diff
186
lib/core/models/activitypub.g.dart
Normal file
186
lib/core/models/activitypub.g.dart
Normal file
@@ -0,0 +1,186 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'activitypub.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_SnActivityPubInstance _$SnActivityPubInstanceFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _SnActivityPubInstance(
|
||||
id: json['id'] as String,
|
||||
domain: json['domain'] as String,
|
||||
name: json['name'] as String?,
|
||||
description: json['description'] as String?,
|
||||
software: json['software'] as String?,
|
||||
version: json['version'] as String?,
|
||||
iconUrl: json['icon_url'] as String?,
|
||||
thumbnailUrl: json['thumbnail_url'] as String?,
|
||||
contactEmail: json['contact_email'] as String?,
|
||||
contactAccountUsername: json['contact_account_username'] as String?,
|
||||
activeUsers: (json['active_users'] as num?)?.toInt(),
|
||||
isBlocked: json['is_blocked'] as bool? ?? false,
|
||||
isSilenced: json['is_silenced'] as bool? ?? false,
|
||||
blockReason: json['block_reason'] as String?,
|
||||
metadata: json['metadata'] as Map<String, dynamic>?,
|
||||
lastFetchedAt: json['last_fetched_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_fetched_at'] as String),
|
||||
lastActivityAt: json['last_activity_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_activity_at'] as String),
|
||||
metadataFetchedAt: json['metadata_fetched_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['metadata_fetched_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnActivityPubInstanceToJson(
|
||||
_SnActivityPubInstance instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'domain': instance.domain,
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'software': instance.software,
|
||||
'version': instance.version,
|
||||
'icon_url': instance.iconUrl,
|
||||
'thumbnail_url': instance.thumbnailUrl,
|
||||
'contact_email': instance.contactEmail,
|
||||
'contact_account_username': instance.contactAccountUsername,
|
||||
'active_users': instance.activeUsers,
|
||||
'is_blocked': instance.isBlocked,
|
||||
'is_silenced': instance.isSilenced,
|
||||
'block_reason': instance.blockReason,
|
||||
'metadata': instance.metadata,
|
||||
'last_fetched_at': instance.lastFetchedAt?.toIso8601String(),
|
||||
'last_activity_at': instance.lastActivityAt?.toIso8601String(),
|
||||
'metadata_fetched_at': instance.metadataFetchedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
_SnActivityPubUser _$SnActivityPubUserFromJson(Map<String, dynamic> json) =>
|
||||
_SnActivityPubUser(
|
||||
actorUri: json['actor_uri'] as String,
|
||||
username: json['username'] as String,
|
||||
displayName: json['display_name'] as String,
|
||||
bio: json['bio'] as String,
|
||||
avatarUrl: json['avatar_url'] as String,
|
||||
followedAt: DateTime.parse(json['followed_at'] as String),
|
||||
isLocal: json['is_local'] as bool,
|
||||
instanceDomain: json['instance_domain'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnActivityPubUserToJson(_SnActivityPubUser instance) =>
|
||||
<String, dynamic>{
|
||||
'actor_uri': instance.actorUri,
|
||||
'username': instance.username,
|
||||
'display_name': instance.displayName,
|
||||
'bio': instance.bio,
|
||||
'avatar_url': instance.avatarUrl,
|
||||
'followed_at': instance.followedAt.toIso8601String(),
|
||||
'is_local': instance.isLocal,
|
||||
'instance_domain': instance.instanceDomain,
|
||||
};
|
||||
|
||||
_SnActivityPubActor _$SnActivityPubActorFromJson(Map<String, dynamic> json) =>
|
||||
_SnActivityPubActor(
|
||||
id: json['id'] as String,
|
||||
uri: json['uri'] as String,
|
||||
type: json['type'] as String? ?? '',
|
||||
displayName: json['display_name'] as String?,
|
||||
username: json['username'] as String?,
|
||||
summary: json['summary'] as String?,
|
||||
inboxUri: json['inbox_uri'] as String?,
|
||||
outboxUri: json['outbox_uri'] as String?,
|
||||
followersUri: json['followers_uri'] as String?,
|
||||
followingUri: json['following_uri'] as String?,
|
||||
featuredUri: json['featured_uri'] as String?,
|
||||
avatarUrl: json['avatar_url'] as String?,
|
||||
headerUrl: json['header_url'] as String?,
|
||||
publicKeyId: json['public_key_id'] as String?,
|
||||
publicKey: json['public_key'] as String?,
|
||||
isBot: json['is_bot'] as bool? ?? false,
|
||||
isLocked: json['is_locked'] as bool? ?? false,
|
||||
discoverable: json['discoverable'] as bool? ?? true,
|
||||
manuallyApprovesFollowers:
|
||||
json['manually_approves_followers'] as bool? ?? false,
|
||||
endpoints: json['endpoints'] as Map<String, dynamic>?,
|
||||
publicKeyData: json['public_key_data'] as Map<String, dynamic>?,
|
||||
metadata: json['metadata'] as Map<String, dynamic>?,
|
||||
lastFetchedAt: json['last_fetched_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_fetched_at'] as String),
|
||||
lastActivityAt: json['last_activity_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_activity_at'] as String),
|
||||
instance: SnActivityPubInstance.fromJson(
|
||||
json['instance'] as Map<String, dynamic>,
|
||||
),
|
||||
instanceId: json['instance_id'] as String,
|
||||
isFollowing: json['is_following'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnActivityPubActorToJson(_SnActivityPubActor instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'uri': instance.uri,
|
||||
'type': instance.type,
|
||||
'display_name': instance.displayName,
|
||||
'username': instance.username,
|
||||
'summary': instance.summary,
|
||||
'inbox_uri': instance.inboxUri,
|
||||
'outbox_uri': instance.outboxUri,
|
||||
'followers_uri': instance.followersUri,
|
||||
'following_uri': instance.followingUri,
|
||||
'featured_uri': instance.featuredUri,
|
||||
'avatar_url': instance.avatarUrl,
|
||||
'header_url': instance.headerUrl,
|
||||
'public_key_id': instance.publicKeyId,
|
||||
'public_key': instance.publicKey,
|
||||
'is_bot': instance.isBot,
|
||||
'is_locked': instance.isLocked,
|
||||
'discoverable': instance.discoverable,
|
||||
'manually_approves_followers': instance.manuallyApprovesFollowers,
|
||||
'endpoints': instance.endpoints,
|
||||
'public_key_data': instance.publicKeyData,
|
||||
'metadata': instance.metadata,
|
||||
'last_fetched_at': instance.lastFetchedAt?.toIso8601String(),
|
||||
'last_activity_at': instance.lastActivityAt?.toIso8601String(),
|
||||
'instance': instance.instance.toJson(),
|
||||
'instance_id': instance.instanceId,
|
||||
'is_following': instance.isFollowing,
|
||||
};
|
||||
|
||||
_SnActivityPubFollowResponse _$SnActivityPubFollowResponseFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _SnActivityPubFollowResponse(
|
||||
success: json['success'] as bool,
|
||||
message: json['message'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnActivityPubFollowResponseToJson(
|
||||
_SnActivityPubFollowResponse instance,
|
||||
) => <String, dynamic>{
|
||||
'success': instance.success,
|
||||
'message': instance.message,
|
||||
};
|
||||
|
||||
_SnActorStatusResponse _$SnActorStatusResponseFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _SnActorStatusResponse(
|
||||
enabled: json['enabled'] as bool,
|
||||
followerCount: (json['follower_count'] as num?)?.toInt() ?? 0,
|
||||
actor: json['actor'] == null
|
||||
? null
|
||||
: SnActivityPubActor.fromJson(json['actor'] as Map<String, dynamic>),
|
||||
actorUri: json['actor_uri'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnActorStatusResponseToJson(
|
||||
_SnActorStatusResponse instance,
|
||||
) => <String, dynamic>{
|
||||
'enabled': instance.enabled,
|
||||
'follower_count': instance.followerCount,
|
||||
'actor': instance.actor?.toJson(),
|
||||
'actor_uri': instance.actorUri,
|
||||
};
|
||||
231
lib/core/models/route_item.dart
Normal file
231
lib/core/models/route_item.dart
Normal file
@@ -0,0 +1,231 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
part 'route_item.freezed.dart';
|
||||
|
||||
@freezed
|
||||
sealed class RouteItem with _$RouteItem {
|
||||
const factory RouteItem({
|
||||
required String name,
|
||||
required String path,
|
||||
required String description,
|
||||
@Default([]) List<String> searchableAliases,
|
||||
required IconData icon,
|
||||
}) = _RouteItem;
|
||||
}
|
||||
|
||||
final List<RouteItem> kAvailableRoutes = [
|
||||
RouteItem(
|
||||
name: 'dashboard'.tr(),
|
||||
path: '/',
|
||||
description: 'dashboardDescription'.tr(),
|
||||
searchableAliases: ['dashboard', 'home'],
|
||||
icon: Symbols.home,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'explore'.tr(),
|
||||
path: '/explore',
|
||||
description: 'exploreDescription'.tr(),
|
||||
searchableAliases: ['explore', 'discover'],
|
||||
icon: Symbols.explore,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'universalSearch'.tr(),
|
||||
path: '/search',
|
||||
description: 'universalSearchDescription'.tr(),
|
||||
searchableAliases: ['search', 'universal', 'fediverse'],
|
||||
icon: Symbols.search,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'postShuffle'.tr(),
|
||||
path: '/posts/shuffle',
|
||||
description: 'postShuffleDescription'.tr(),
|
||||
searchableAliases: ['shuffle', 'random', 'posts'],
|
||||
icon: Symbols.shuffle,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'postTagsCategories'.tr(),
|
||||
path: '/posts/categories',
|
||||
description: 'postTagsCategoriesDescription'.tr(),
|
||||
searchableAliases: ['tags', 'categories', 'posts'],
|
||||
icon: Symbols.category,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'discoverRealms'.tr(),
|
||||
path: '/discovery/realms',
|
||||
description: 'discoverRealmsDescription'.tr(),
|
||||
searchableAliases: ['realms', 'groups', 'communities'],
|
||||
icon: Symbols.public,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'chat'.tr(),
|
||||
path: '/chat',
|
||||
description: 'chatDescription'.tr(),
|
||||
searchableAliases: ['chat', 'messages', 'conversations', 'dm'],
|
||||
icon: Symbols.chat,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'realms'.tr(),
|
||||
path: '/realms',
|
||||
description: 'realmsDescription'.tr(),
|
||||
searchableAliases: ['realms', 'groups', 'communities'],
|
||||
icon: Symbols.group,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'account'.tr(),
|
||||
path: '/account',
|
||||
description: 'accountDescription'.tr(),
|
||||
searchableAliases: ['account', 'me', 'profile', 'user'],
|
||||
icon: Symbols.person,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'stickerMarketplace'.tr(),
|
||||
path: '/stickers',
|
||||
description: 'stickerMarketplaceDescription'.tr(),
|
||||
searchableAliases: ['stickers', 'marketplace', 'emojis', 'emojis'],
|
||||
icon: Symbols.emoji_emotions,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'webFeeds'.tr(),
|
||||
path: '/feeds',
|
||||
description: 'webFeedsDescription'.tr(),
|
||||
searchableAliases: ['feeds', 'web feeds', 'rss', 'news'],
|
||||
icon: Symbols.feed,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'wallet'.tr(),
|
||||
path: '/account/wallet',
|
||||
description: 'walletDescription'.tr(),
|
||||
searchableAliases: [
|
||||
'wallet',
|
||||
'balance',
|
||||
'money',
|
||||
'source points',
|
||||
'gold points',
|
||||
'nsp',
|
||||
'shd',
|
||||
],
|
||||
icon: Symbols.account_balance_wallet,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'relationships'.tr(),
|
||||
path: '/account/relationships',
|
||||
description: 'relationshipsDescription'.tr(),
|
||||
searchableAliases: ['relationships', 'friends', 'block list', 'blocks'],
|
||||
icon: Symbols.people,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'updateYourProfile'.tr(),
|
||||
path: '/account/me/update',
|
||||
description: 'updateYourProfileDescription'.tr(),
|
||||
searchableAliases: ['profile', 'update', 'edit', 'my profile'],
|
||||
icon: Symbols.edit,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'leveling'.tr(),
|
||||
path: '/account/me/leveling',
|
||||
description: 'levelingDescription'.tr(),
|
||||
searchableAliases: [
|
||||
'leveling',
|
||||
'level',
|
||||
'levels',
|
||||
'subscriptions',
|
||||
'social credits',
|
||||
],
|
||||
icon: Symbols.trending_up,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'accountSettings'.tr(),
|
||||
path: '/account/me/settings',
|
||||
description: 'accountSettingsDescription'.tr(),
|
||||
searchableAliases: [
|
||||
'settings',
|
||||
'preferences',
|
||||
'account',
|
||||
'account settings',
|
||||
],
|
||||
icon: Symbols.settings,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'abuseReports'.tr(),
|
||||
path: '/safety/reports/me',
|
||||
description: 'abuseReportsDescription'.tr(),
|
||||
searchableAliases: ['reports', 'abuse', 'safety'],
|
||||
icon: Symbols.report,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'files'.tr(),
|
||||
path: '/files',
|
||||
description: 'filesDescription'.tr(),
|
||||
searchableAliases: ['files', 'folders', 'storage', 'drive', 'cloud'],
|
||||
icon: Symbols.folder,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'aiThought'.tr(),
|
||||
path: '/thought',
|
||||
description: 'aiThoughtTitle'.tr(),
|
||||
searchableAliases: ['thought', 'ai', 'ai thought'],
|
||||
icon: Symbols.psychology,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'creatorHub'.tr(),
|
||||
path: '/creators',
|
||||
description: 'creatorHubDescription'.tr(),
|
||||
searchableAliases: ['creators', 'hub', 'creator hub', 'creators hub'],
|
||||
icon: Symbols.create,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'developerPortal'.tr(),
|
||||
path: '/developers',
|
||||
description: 'developerPortalDescription'.tr(),
|
||||
searchableAliases: [
|
||||
'developers',
|
||||
'dev',
|
||||
'developer',
|
||||
'developer hub',
|
||||
'developers hub',
|
||||
],
|
||||
icon: Symbols.code,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'debugLogs'.tr(),
|
||||
path: '/logs',
|
||||
description: 'debugLogsDescription'.tr(),
|
||||
searchableAliases: ['logs', 'debug', 'debug logs'],
|
||||
icon: Symbols.bug_report,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'webArticlesStand'.tr(),
|
||||
path: '/feeds/articles',
|
||||
description: 'webArticlesStandDescription'.tr(),
|
||||
searchableAliases: ['articles', 'stand', 'feed', 'web feed'],
|
||||
icon: Symbols.article,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'appSettings'.tr(),
|
||||
path: '/settings',
|
||||
description: 'appSettingsDescription'.tr(),
|
||||
searchableAliases: ['settings', 'preferences', 'app', 'app settings'],
|
||||
icon: Symbols.settings,
|
||||
),
|
||||
RouteItem(
|
||||
name: 'about'.tr(),
|
||||
path: '/about',
|
||||
description: 'about'.tr(),
|
||||
searchableAliases: ['about', 'info'],
|
||||
icon: Symbols.info,
|
||||
),
|
||||
];
|
||||
|
||||
@freezed
|
||||
sealed class SpecialAction with _$SpecialAction {
|
||||
const factory SpecialAction({
|
||||
required String name,
|
||||
required String description,
|
||||
required IconData icon,
|
||||
required VoidCallback action,
|
||||
@Default([]) List<String> searchableAliases,
|
||||
}) = _SpecialAction;
|
||||
}
|
||||
552
lib/core/models/route_item.freezed.dart
Normal file
552
lib/core/models/route_item.freezed.dart
Normal file
@@ -0,0 +1,552 @@
|
||||
// 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 'route_item.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$RouteItem {
|
||||
|
||||
String get name; String get path; String get description; List<String> get searchableAliases; IconData get icon;
|
||||
/// Create a copy of RouteItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$RouteItemCopyWith<RouteItem> get copyWith => _$RouteItemCopyWithImpl<RouteItem>(this as RouteItem, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is RouteItem&&(identical(other.name, name) || other.name == name)&&(identical(other.path, path) || other.path == path)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.searchableAliases, searchableAliases)&&(identical(other.icon, icon) || other.icon == icon));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,path,description,const DeepCollectionEquality().hash(searchableAliases),icon);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RouteItem(name: $name, path: $path, description: $description, searchableAliases: $searchableAliases, icon: $icon)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $RouteItemCopyWith<$Res> {
|
||||
factory $RouteItemCopyWith(RouteItem value, $Res Function(RouteItem) _then) = _$RouteItemCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name, String path, String description, List<String> searchableAliases, IconData icon
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$RouteItemCopyWithImpl<$Res>
|
||||
implements $RouteItemCopyWith<$Res> {
|
||||
_$RouteItemCopyWithImpl(this._self, this._then);
|
||||
|
||||
final RouteItem _self;
|
||||
final $Res Function(RouteItem) _then;
|
||||
|
||||
/// Create a copy of RouteItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? path = null,Object? description = null,Object? searchableAliases = null,Object? icon = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,path: null == path ? _self.path : path // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String,searchableAliases: null == searchableAliases ? _self.searchableAliases : searchableAliases // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||
as IconData,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [RouteItem].
|
||||
extension RouteItemPatterns on RouteItem {
|
||||
/// 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( _RouteItem value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RouteItem() 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( _RouteItem value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RouteItem():
|
||||
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( _RouteItem value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RouteItem() 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( String name, String path, String description, List<String> searchableAliases, IconData icon)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RouteItem() when $default != null:
|
||||
return $default(_that.name,_that.path,_that.description,_that.searchableAliases,_that.icon);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( String name, String path, String description, List<String> searchableAliases, IconData icon) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RouteItem():
|
||||
return $default(_that.name,_that.path,_that.description,_that.searchableAliases,_that.icon);}
|
||||
}
|
||||
/// 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( String name, String path, String description, List<String> searchableAliases, IconData icon)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RouteItem() when $default != null:
|
||||
return $default(_that.name,_that.path,_that.description,_that.searchableAliases,_that.icon);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _RouteItem implements RouteItem {
|
||||
const _RouteItem({required this.name, required this.path, required this.description, final List<String> searchableAliases = const [], required this.icon}): _searchableAliases = searchableAliases;
|
||||
|
||||
|
||||
@override final String name;
|
||||
@override final String path;
|
||||
@override final String description;
|
||||
final List<String> _searchableAliases;
|
||||
@override@JsonKey() List<String> get searchableAliases {
|
||||
if (_searchableAliases is EqualUnmodifiableListView) return _searchableAliases;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_searchableAliases);
|
||||
}
|
||||
|
||||
@override final IconData icon;
|
||||
|
||||
/// Create a copy of RouteItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$RouteItemCopyWith<_RouteItem> get copyWith => __$RouteItemCopyWithImpl<_RouteItem>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _RouteItem&&(identical(other.name, name) || other.name == name)&&(identical(other.path, path) || other.path == path)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._searchableAliases, _searchableAliases)&&(identical(other.icon, icon) || other.icon == icon));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,path,description,const DeepCollectionEquality().hash(_searchableAliases),icon);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RouteItem(name: $name, path: $path, description: $description, searchableAliases: $searchableAliases, icon: $icon)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$RouteItemCopyWith<$Res> implements $RouteItemCopyWith<$Res> {
|
||||
factory _$RouteItemCopyWith(_RouteItem value, $Res Function(_RouteItem) _then) = __$RouteItemCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String name, String path, String description, List<String> searchableAliases, IconData icon
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$RouteItemCopyWithImpl<$Res>
|
||||
implements _$RouteItemCopyWith<$Res> {
|
||||
__$RouteItemCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _RouteItem _self;
|
||||
final $Res Function(_RouteItem) _then;
|
||||
|
||||
/// Create a copy of RouteItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? path = null,Object? description = null,Object? searchableAliases = null,Object? icon = null,}) {
|
||||
return _then(_RouteItem(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,path: null == path ? _self.path : path // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String,searchableAliases: null == searchableAliases ? _self._searchableAliases : searchableAliases // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||
as IconData,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SpecialAction {
|
||||
|
||||
String get name; String get description; IconData get icon; VoidCallback get action; List<String> get searchableAliases;
|
||||
/// Create a copy of SpecialAction
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$SpecialActionCopyWith<SpecialAction> get copyWith => _$SpecialActionCopyWithImpl<SpecialAction>(this as SpecialAction, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SpecialAction&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.action, action) || other.action == action)&&const DeepCollectionEquality().equals(other.searchableAliases, searchableAliases));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,description,icon,action,const DeepCollectionEquality().hash(searchableAliases));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SpecialAction(name: $name, description: $description, icon: $icon, action: $action, searchableAliases: $searchableAliases)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $SpecialActionCopyWith<$Res> {
|
||||
factory $SpecialActionCopyWith(SpecialAction value, $Res Function(SpecialAction) _then) = _$SpecialActionCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name, String description, IconData icon, VoidCallback action, List<String> searchableAliases
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$SpecialActionCopyWithImpl<$Res>
|
||||
implements $SpecialActionCopyWith<$Res> {
|
||||
_$SpecialActionCopyWithImpl(this._self, this._then);
|
||||
|
||||
final SpecialAction _self;
|
||||
final $Res Function(SpecialAction) _then;
|
||||
|
||||
/// Create a copy of SpecialAction
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? description = null,Object? icon = null,Object? action = null,Object? searchableAliases = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||
as IconData,action: null == action ? _self.action : action // ignore: cast_nullable_to_non_nullable
|
||||
as VoidCallback,searchableAliases: null == searchableAliases ? _self.searchableAliases : searchableAliases // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [SpecialAction].
|
||||
extension SpecialActionPatterns on SpecialAction {
|
||||
/// 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( _SpecialAction value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SpecialAction() 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( _SpecialAction value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SpecialAction():
|
||||
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( _SpecialAction value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SpecialAction() 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( String name, String description, IconData icon, VoidCallback action, List<String> searchableAliases)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SpecialAction() when $default != null:
|
||||
return $default(_that.name,_that.description,_that.icon,_that.action,_that.searchableAliases);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( String name, String description, IconData icon, VoidCallback action, List<String> searchableAliases) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SpecialAction():
|
||||
return $default(_that.name,_that.description,_that.icon,_that.action,_that.searchableAliases);}
|
||||
}
|
||||
/// 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( String name, String description, IconData icon, VoidCallback action, List<String> searchableAliases)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SpecialAction() when $default != null:
|
||||
return $default(_that.name,_that.description,_that.icon,_that.action,_that.searchableAliases);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _SpecialAction implements SpecialAction {
|
||||
const _SpecialAction({required this.name, required this.description, required this.icon, required this.action, final List<String> searchableAliases = const []}): _searchableAliases = searchableAliases;
|
||||
|
||||
|
||||
@override final String name;
|
||||
@override final String description;
|
||||
@override final IconData icon;
|
||||
@override final VoidCallback action;
|
||||
final List<String> _searchableAliases;
|
||||
@override@JsonKey() List<String> get searchableAliases {
|
||||
if (_searchableAliases is EqualUnmodifiableListView) return _searchableAliases;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_searchableAliases);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of SpecialAction
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$SpecialActionCopyWith<_SpecialAction> get copyWith => __$SpecialActionCopyWithImpl<_SpecialAction>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SpecialAction&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.action, action) || other.action == action)&&const DeepCollectionEquality().equals(other._searchableAliases, _searchableAliases));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,description,icon,action,const DeepCollectionEquality().hash(_searchableAliases));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SpecialAction(name: $name, description: $description, icon: $icon, action: $action, searchableAliases: $searchableAliases)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$SpecialActionCopyWith<$Res> implements $SpecialActionCopyWith<$Res> {
|
||||
factory _$SpecialActionCopyWith(_SpecialAction value, $Res Function(_SpecialAction) _then) = __$SpecialActionCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String name, String description, IconData icon, VoidCallback action, List<String> searchableAliases
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$SpecialActionCopyWithImpl<$Res>
|
||||
implements _$SpecialActionCopyWith<$Res> {
|
||||
__$SpecialActionCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _SpecialAction _self;
|
||||
final $Res Function(_SpecialAction) _then;
|
||||
|
||||
/// Create a copy of SpecialAction
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? description = null,Object? icon = null,Object? action = null,Object? searchableAliases = null,}) {
|
||||
return _then(_SpecialAction(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||
as IconData,action: null == action ? _self.action : action // ignore: cast_nullable_to_non_nullable
|
||||
as VoidCallback,searchableAliases: null == searchableAliases ? _self._searchableAliases : searchableAliases // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
Reference in New Issue
Block a user