repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/settings_page/settings_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:miria/router/app_router.dart';
@RoutePage()
class SettingsPage extends StatelessWidget {
const SettingsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: ListView(
children: [
ListTile(
title: Text(S.of(context).generalSettings),
leading: const Icon(Icons.settings),
trailing: const Icon(Icons.chevron_right),
onTap: () => context.pushRoute(const GeneralSettingsRoute()),
),
ListTile(
title: Text(S.of(context).accountSettings),
leading: const Icon(Icons.account_circle),
trailing: const Icon(Icons.chevron_right),
onTap: () => context.pushRoute(const AccountListRoute()),
),
ListTile(
title: Text(S.of(context).tabSettings),
leading: const Icon(Icons.tab),
trailing: const Icon(Icons.chevron_right),
onTap: () => context.pushRoute(const TabSettingsListRoute()),
),
ListTile(
title: Text(S.of(context).settingsImportAndExport),
leading: const Icon(Icons.import_export),
trailing: const Icon(Icons.chevron_right),
onTap: () => context.pushRoute(const ImportExportRoute()),
),
ListTile(
title: Text(S.of(context).aboutMiria),
leading: const Icon(Icons.info),
trailing: const Icon(Icons.chevron_right),
onTap: () => context.pushRoute(const AppInfoRoute()),
)
],
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/tab_settings_page/icon_select_dialog.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:miria/model/account.dart';
import 'package:miria/model/tab_icon.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/reaction_picker_dialog/reaction_picker_content.dart';
class IconSelectDialog extends StatelessWidget {
final icons = [
Icons.home,
Icons.home_outlined,
Icons.favorite,
Icons.favorite_border,
Icons.star,
Icons.star_outline,
Icons.public,
Icons.south_america,
Icons.rocket,
Icons.rocket_outlined,
Icons.rocket_launch,
Icons.rocket_launch_outlined,
Icons.bookmark,
Icons.bookmark_outline,
Icons.hub,
Icons.hub_outlined,
Icons.settings_input_antenna,
Icons.list,
Icons.format_list_bulleted,
Icons.feed,
Icons.feed_outlined,
Icons.chat,
Icons.chat_outlined,
Icons.chat_bubble,
Icons.chat_bubble_outline,
Icons.notifications,
Icons.diversity_1,
Icons.diversity_1_outlined,
Icons.diversity_2,
Icons.diversity_2_outlined,
Icons.diversity_3,
Icons.diversity_3_outlined,
Icons.person,
Icons.face,
Icons.sentiment_neutral,
Icons.sentiment_very_dissatisfied,
Icons.sentiment_dissatisfied,
Icons.sentiment_satisfied,
Icons.sentiment_very_satisfied,
Icons.mood_bad,
Icons.mood,
Icons.face,
Icons.face_2,
Icons.face_3,
Icons.face_4,
Icons.face_5,
Icons.face_6,
Icons.person,
Icons.person_2,
Icons.person_3,
Icons.person_4,
Icons.sick,
Icons.sick_outlined,
Icons.cruelty_free,
Icons.cruelty_free_outlined,
Icons.psychology,
Icons.psychology_alt,
Icons.bolt,
Icons.electric_bolt,
Icons.offline_bolt,
Icons.offline_bolt_outlined,
Icons.dataset,
Icons.dataset_outlined,
Icons.diamond,
Icons.diamond_outlined,
];
final Account account;
IconSelectDialog({super.key, required this.account});
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text(S.of(context).selectIcon),
content: DefaultTabController(
length: 2,
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.width * 0.8,
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 5),
child: DecoratedBox(
decoration:
BoxDecoration(color: Theme.of(context).primaryColor),
child: TabBar(
tabs: [
Tab(text: S.of(context).standardIcon),
Tab(text: S.of(context).emojiIcon),
],
),
),
),
Expanded(
child: TabBarView(children: [
SingleChildScrollView(
child: Wrap(
children: [
for (final icon in icons)
IconButton(
onPressed: () => Navigator.of(context)
.pop(TabIcon(codePoint: icon.codePoint)),
icon: Icon(icon)),
],
),
),
AccountScope(
account: account,
child: ReactionPickerContent(
isAcceptSensitive: true,
onTap: (emoji) => Navigator.of(context)
.pop(TabIcon(customEmojiName: emoji.baseName)),
),
)
]),
)
],
),
)));
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/tab_settings_page/channel_select_dialog.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:miria/model/account.dart';
import 'package:miria/view/channels_page/channel_favorited.dart';
import 'package:miria/view/channels_page/channel_followed.dart';
import 'package:miria/view/channels_page/channel_search.dart';
import 'package:miria/view/channels_page/channel_trend.dart';
import 'package:miria/view/common/account_scope.dart';
class ChannelSelectDialog extends StatelessWidget {
final Account account;
const ChannelSelectDialog({super.key, required this.account});
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text(S.of(context).selectChannel),
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.8,
child: DefaultTabController(
length: 4,
initialIndex: 2,
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 5),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
),
child: Align(
child: TabBar(
tabs: [
Tab(text: S.of(context).search),
Tab(text: S.of(context).trend),
Tab(text: S.of(context).favorite),
Tab(text: S.of(context).following),
],
isScrollable: true,
tabAlignment: TabAlignment.center,
),
),
),
),
Expanded(
child: AccountScope(
account: account,
child: TabBarView(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ChannelSearch(
onChannelSelected: (channel) =>
Navigator.of(context).pop(channel),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ChannelTrend(
onChannelSelected: (channel) =>
Navigator.of(context).pop(channel),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ChannelFavorited(
onChannelSelected: (channel) =>
Navigator.of(context).pop(channel),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ChannelFollowed(
onChannelSelected: (channel) =>
Navigator.of(context).pop(channel),
),
),
],
),
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/tab_settings_page/tab_settings_list_page.dart | import 'dart:io';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/tab_setting.dart';
import 'package:miria/providers.dart';
import 'package:miria/router/app_router.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/common/tab_icon_view.dart';
@RoutePage()
class TabSettingsListPage extends ConsumerWidget {
const TabSettingsListPage({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final tabSettings = ref
.watch(
tabSettingsRepositoryProvider
.select((repository) => repository.tabSettings),
)
.toList();
return Scaffold(
appBar: AppBar(
leading: Container(),
title: Text(S.of(context).tabSettings),
actions: [
IconButton(
onPressed: () {
context.pushRoute(TabSettingsRoute());
},
icon: const Icon(Icons.add),
),
],
),
body: Column(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: ReorderableListView.builder(
buildDefaultDragHandles: false,
itemCount: tabSettings.length,
itemBuilder: (context, index) {
final tabSetting = tabSettings[index];
if (Platform.isAndroid || Platform.isIOS) {
return ReorderableDelayedDragStartListener(
key: Key("$index"),
index: index,
child: TabSettingsListItem(
tabSetting: tabSetting,
index: index,
),
);
} else {
return ReorderableDragStartListener(
key: Key("$index"),
index: index,
child: TabSettingsListItem(
tabSetting: tabSetting,
index: index,
),
);
}
},
onReorder: (oldIndex, newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final item = tabSettings.removeAt(oldIndex);
tabSettings.insert(newIndex, item);
ref.read(tabSettingsRepositoryProvider).save(tabSettings);
},
),
),
Align(
alignment: Alignment.center,
child: Padding(
padding: const EdgeInsets.all(10),
child: ElevatedButton(
onPressed: () {
context.router
..removeWhere((route) => true)
..push(const SplashRoute());
},
child: Text(S.of(context).apply),
),
),
),
],
),
);
}
}
class TabSettingsListItem extends ConsumerWidget {
const TabSettingsListItem({
super.key,
required this.tabSetting,
required this.index,
});
final TabSetting tabSetting;
final int index;
@override
Widget build(BuildContext context, WidgetRef ref) {
final account = ref.watch(accountProvider(tabSetting.acct));
return ListTile(
leading: AccountScope(
account: account,
child: TabIconView(icon: tabSetting.icon),
),
title: Text(tabSetting.name ?? tabSetting.tabType.displayName(context)),
subtitle: Text(
"${tabSetting.tabType.displayName(context)} / ${tabSetting.acct}",
),
trailing: const Icon(Icons.drag_handle),
onTap: () => context.pushRoute(TabSettingsRoute(tabIndex: index)),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/tab_settings_page/role_select_dialog.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:misskey_dart/misskey_dart.dart';
class RoleSelectDialog extends ConsumerStatefulWidget {
final Account account;
const RoleSelectDialog({super.key, required this.account});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
RoleSelectDialogState();
}
class RoleSelectDialogState extends ConsumerState<RoleSelectDialog> {
final roles = <RolesListResponse>[];
@override
void didChangeDependencies() {
super.didChangeDependencies();
Future(() async {
final rolesList =
await ref.read(misskeyProvider(widget.account)).roles.list();
roles
..clear()
..addAll(rolesList);
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return AccountScope(
account: widget.account,
child: AlertDialog(
title: Text(S.of(context).selectRole),
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.8,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).role,
style: Theme.of(context).textTheme.titleMedium,
),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: roles.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
Navigator.of(context).pop(roles[index]);
},
title: Text(roles[index].name));
}),
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/tab_settings_page/tab_settings_page.dart | import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';
import 'package:miria/extensions/users_lists_show_response_extension.dart';
import 'package:miria/model/account.dart';
import 'package:miria/model/tab_icon.dart';
import 'package:miria/model/tab_setting.dart';
import 'package:miria/model/tab_type.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/dialogs/simple_message_dialog.dart';
import 'package:miria/view/common/tab_icon_view.dart';
import 'package:miria/view/settings_page/tab_settings_page/role_select_dialog.dart';
import 'package:miria/view/settings_page/tab_settings_page/antenna_select_dialog.dart';
import 'package:miria/view/settings_page/tab_settings_page/channel_select_dialog.dart';
import 'package:miria/view/settings_page/tab_settings_page/icon_select_dialog.dart';
import 'package:miria/view/settings_page/tab_settings_page/user_list_select_dialog.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:misskey_dart/misskey_dart.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@RoutePage()
class TabSettingsPage extends ConsumerStatefulWidget {
const TabSettingsPage({super.key, this.tabIndex});
final int? tabIndex;
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
TabSettingsAddDialogState();
}
class TabSettingsAddDialogState extends ConsumerState<TabSettingsPage> {
late Account? selectedAccount = ref.read(accountsProvider).first;
TabType? selectedTabType = TabType.localTimeline;
RolesListResponse? selectedRole;
CommunityChannel? selectedChannel;
UsersList? selectedUserList;
Antenna? selectedAntenna;
TextEditingController nameController = TextEditingController();
TabIcon? selectedIcon;
bool renoteDisplay = true;
bool isSubscribe = true;
bool isMediaOnly = false;
bool isIncludeReply = false;
bool get availableIncludeReply =>
selectedTabType == TabType.localTimeline ||
selectedTabType == TabType.hybridTimeline;
bool isTabTypeAvailable(TabType tabType) {
return switch (tabType) {
TabType.localTimeline =>
selectedAccount?.i.policies.ltlAvailable ?? false,
TabType.globalTimeline =>
selectedAccount?.i.policies.gtlAvailable ?? false,
_ => true,
};
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
final tab = widget.tabIndex;
if (tab != null) {
final tabSetting =
ref.read(tabSettingsRepositoryProvider).tabSettings.toList()[tab];
selectedAccount = ref.read(accountProvider(tabSetting.acct));
selectedTabType =
isTabTypeAvailable(tabSetting.tabType) ? tabSetting.tabType : null;
final roleId = tabSetting.roleId;
final channelId = tabSetting.channelId;
final listId = tabSetting.listId;
final antennaId = tabSetting.antennaId;
nameController.text =
tabSetting.name ?? tabSetting.tabType.displayName(context);
selectedIcon = tabSetting.icon;
renoteDisplay = tabSetting.renoteDisplay;
isSubscribe = tabSetting.isSubscribe;
isMediaOnly = tabSetting.isMediaOnly;
isIncludeReply = tabSetting.isIncludeReplies;
if (roleId != null) {
Future(() async {
selectedRole = await ref
.read(misskeyProvider(selectedAccount!))
.roles
.show(RolesShowRequest(roleId: roleId));
setState(() {});
});
}
if (channelId != null) {
Future(() async {
selectedChannel = await ref
.read(misskeyProvider(selectedAccount!))
.channels
.show(ChannelsShowRequest(channelId: channelId));
if (!mounted) return;
setState(() {});
});
}
if (listId != null) {
Future(() async {
final response = await ref
.read(misskeyProvider(selectedAccount!))
.users
.list
.show(UsersListsShowRequest(listId: listId));
selectedUserList = response.toUsersList();
if (!mounted) return;
setState(() {});
});
}
if (antennaId != null) {
Future(() async {
selectedAntenna = await ref
.read(misskeyProvider(selectedAccount!))
.antennas
.show(AntennasShowRequest(antennaId: antennaId));
if (!mounted) return;
setState(() {});
});
}
}
}
@override
void dispose() {
nameController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final accounts = ref.watch(accountsProvider);
return Scaffold(
appBar: AppBar(
title: Text(S.of(context).tabSettings),
actions: [
if (widget.tabIndex != null)
IconButton(
onPressed: () {
ref.read(tabSettingsRepositoryProvider).save(ref
.read(tabSettingsRepositoryProvider)
.tabSettings
.toList()
..removeAt(widget.tabIndex!));
if (!mounted) return;
Navigator.of(context).pop();
},
icon: const Icon(Icons.delete_outline_outlined))
],
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Text(S.of(context).account),
DropdownButton<Account>(
items: [
for (final account in accounts)
DropdownMenuItem(
value: account,
child: Text(account.acct.toString()),
),
],
onChanged: (value) {
final tabType = selectedTabType;
setState(() {
selectedAccount = value;
selectedTabType =
tabType != null && isTabTypeAvailable(tabType)
? tabType
: null;
selectedAntenna = null;
selectedUserList = null;
selectedChannel = null;
if (selectedIcon?.customEmojiName != null) {
selectedIcon = null;
}
});
},
value: selectedAccount,
),
const Padding(padding: EdgeInsets.all(10)),
Text(S.of(context).tabType),
DropdownButton<TabType>(
items: [
for (final tabType in TabType.values)
if (isTabTypeAvailable(tabType))
DropdownMenuItem(
value: tabType,
child: Text(tabType.displayName(context)),
),
],
onChanged: (value) {
setState(() {
selectedTabType = value;
});
},
value: selectedTabType,
),
const Padding(padding: EdgeInsets.all(10)),
if (selectedTabType == TabType.roleTimeline) ...[
Text(S.of(context).roleTimeline),
Row(
children: [
Expanded(child: Text(selectedRole?.name ?? "")),
IconButton(
onPressed: () async {
final selected = selectedAccount;
if (selected == null) return;
selectedRole = await showDialog<RolesListResponse>(
context: context,
builder: (context) =>
RoleSelectDialog(account: selected));
setState(() {
nameController.text =
selectedRole?.name ?? nameController.text;
});
},
icon: const Icon(Icons.navigate_next))
],
)
],
if (selectedTabType == TabType.channel) ...[
Text(S.of(context).channel),
Row(
children: [
Expanded(child: Text(selectedChannel?.name ?? "")),
IconButton(
onPressed: () async {
final selected = selectedAccount;
if (selected == null) return;
selectedChannel = await showDialog<CommunityChannel>(
context: context,
builder: (context) =>
ChannelSelectDialog(account: selected));
setState(() {
nameController.text =
selectedChannel?.name ?? nameController.text;
});
},
icon: const Icon(Icons.navigate_next))
],
)
],
if (selectedTabType == TabType.userList) ...[
Text(S.of(context).list),
Row(
children: [
Expanded(child: Text(selectedUserList?.name ?? "")),
IconButton(
onPressed: () async {
final selected = selectedAccount;
if (selected == null) return;
selectedUserList = await showDialog<UsersList>(
context: context,
builder: (context) =>
UserListSelectDialog(account: selected));
setState(() {
nameController.text =
selectedUserList?.name ?? nameController.text;
});
},
icon: const Icon(Icons.navigate_next))
],
)
],
if (selectedTabType == TabType.antenna) ...[
Text(S.of(context).antenna),
Row(
children: [
Expanded(child: Text(selectedAntenna?.name ?? "")),
IconButton(
onPressed: () async {
final selected = selectedAccount;
if (selected == null) return;
selectedAntenna = await showDialog<Antenna>(
context: context,
builder: (context) =>
AntennaSelectDialog(account: selected));
setState(() {
nameController.text =
selectedAntenna?.name ?? nameController.text;
});
},
icon: const Icon(Icons.navigate_next))
],
)
],
const Padding(padding: EdgeInsets.all(10)),
Text(S.of(context).tabName),
TextField(
decoration: const InputDecoration(prefixIcon: Icon(Icons.edit)),
controller: nameController,
),
const Padding(padding: EdgeInsets.all(10)),
Text(S.of(context).icon),
Row(
children: [
Expanded(
child: selectedAccount == null
? Container()
: AccountScope(
account: selectedAccount!,
child: SizedBox(
height: 32,
child: TabIconView(
icon: selectedIcon,
size: IconTheme.of(context).size),
))),
IconButton(
onPressed: () async {
if (selectedAccount == null) return;
selectedIcon = await showDialog<TabIcon>(
context: context,
builder: (context) => IconSelectDialog(
account: selectedAccount!,
));
setState(() {});
},
icon: const Icon(Icons.navigate_next))
],
),
CheckboxListTile(
title: Text(S.of(context).displayRenotes),
value: renoteDisplay,
onChanged: (value) =>
setState(() => renoteDisplay = !renoteDisplay),
),
if (availableIncludeReply)
CheckboxListTile(
title: Text(S.of(context).includeReplies),
subtitle: Text(S.of(context).includeRepliesAvailability),
value: isIncludeReply,
enabled: !isMediaOnly,
onChanged: (value) => setState(() {
isIncludeReply = !isIncludeReply;
if (value ?? false) {
isMediaOnly = false;
}
}),
),
CheckboxListTile(
title: Text(S.of(context).mediaOnly),
value: isMediaOnly,
enabled: !isIncludeReply,
onChanged: (value) => setState(() {
isMediaOnly = !isMediaOnly;
if (value ?? false) {
isIncludeReply = false;
}
}),
),
CheckboxListTile(
title: Text(S.of(context).subscribeNotes),
subtitle: Text(S.of(context).subscribeNotesDescription),
value: isSubscribe,
onChanged: (value) =>
setState(() => isSubscribe = !isSubscribe),
),
Center(
child: ElevatedButton(
onPressed: () async {
final account = selectedAccount;
if (account == null) {
SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectAccount,
);
return;
}
final tabType = selectedTabType;
if (tabType == null) {
SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectTabType,
);
return;
}
final icon = selectedIcon;
if (icon == null) {
SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectIcon,
);
return;
}
if (tabType == TabType.channel && selectedChannel == null) {
SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectChannel,
);
return;
}
if (tabType == TabType.userList &&
selectedUserList == null) {
SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectList,
);
return;
}
if (tabType == TabType.antenna && selectedAntenna == null) {
SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectAntenna,
);
return;
}
if (tabType == TabType.roleTimeline &&
selectedRole == null) {
SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectRole,
);
return;
}
final list = ref
.read(tabSettingsRepositoryProvider)
.tabSettings
.toList();
final newTabSetting = TabSetting(
icon: icon,
tabType: tabType,
name: nameController.text,
acct: account.acct,
roleId: selectedRole?.id,
channelId: selectedChannel?.id,
listId: selectedUserList?.id,
antennaId: selectedAntenna?.id,
renoteDisplay: renoteDisplay,
isSubscribe: isSubscribe,
isIncludeReplies: isIncludeReply,
isMediaOnly: isMediaOnly,
);
if (widget.tabIndex == null) {
await ref
.read(tabSettingsRepositoryProvider)
.save([...list, newTabSetting]);
} else {
list[widget.tabIndex!] = newTabSetting;
await ref.read(tabSettingsRepositoryProvider).save(list);
}
if (!mounted) return;
Navigator.of(context).pop();
},
child: Text(S.of(context).done),
),
)
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/tab_settings_page/antenna_select_dialog.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:misskey_dart/misskey_dart.dart';
class AntennaSelectDialog extends ConsumerStatefulWidget {
final Account account;
const AntennaSelectDialog({super.key, required this.account});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
AntennaSelectDialogState();
}
class AntennaSelectDialogState extends ConsumerState<AntennaSelectDialog> {
final antennas = <Antenna>[];
@override
void didChangeDependencies() {
super.didChangeDependencies();
Future(() async {
final myAntennas =
await ref.read(misskeyProvider(widget.account)).antennas.list();
antennas
..clear()
..addAll(myAntennas);
if (!mounted) return;
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return AccountScope(
account: widget.account,
child: AlertDialog(
title: Text(S.of(context).selectAntenna),
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.8,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).antenna,
style: Theme.of(context).textTheme.titleMedium,
),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: antennas.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
Navigator.of(context).pop(antennas[index]);
},
title: Text(antennas[index].name));
}),
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/tab_settings_page/user_list_select_dialog.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:misskey_dart/misskey_dart.dart';
class UserListSelectDialog extends ConsumerStatefulWidget {
final Account account;
const UserListSelectDialog({super.key, required this.account});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
UserListSelectDialogState();
}
class UserListSelectDialogState extends ConsumerState<UserListSelectDialog> {
final userLists = <UsersList>[];
@override
void didChangeDependencies() {
super.didChangeDependencies();
Future(() async {
final myLists =
await ref.read(misskeyProvider(widget.account)).users.list.list();
userLists
..clear()
..addAll(myLists);
if (!mounted) return;
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return AccountScope(
account: widget.account,
child: AlertDialog(
title: Text(S.of(context).selectList),
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.8,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).list,
style: Theme.of(context).textTheme.titleMedium,
),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: userLists.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
Navigator.of(context).pop(userLists[index]);
},
title: Text(userLists[index].name ?? ""));
}),
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/app_info_page/app_info_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/common/misskey_notes/mfm_text.dart';
import 'package:package_info_plus/package_info_plus.dart';
@RoutePage()
class AppInfoPage extends ConsumerStatefulWidget {
const AppInfoPage({super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() => AppInfoPageState();
}
class AppInfoPageState extends ConsumerState<AppInfoPage> {
PackageInfo? packageInfo;
@override
void didChangeDependencies() {
super.didChangeDependencies();
Future(() async {
packageInfo = await PackageInfo.fromPlatform();
if (!mounted) return;
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(S.of(context).aboutMiria)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(10),
child: AccountScope(
account: Account.demoAccount("", null),
child: Column(
children: [
MfmText(
mfmText: '''
<center>\$[x3 Miria]</center>
${S.of(context).packageName}: ${packageInfo?.packageName ?? ""}
${S.of(context).version}: ${packageInfo?.version ?? ""}+${packageInfo?.buildNumber ?? ""}
${S.of(context).developer}: @[email protected]
\$[x2 **${S.of(context).aboutMiria}**]
[${S.of(context).officialWebSite}](https://shiosyakeyakini.info/miria_web/index.html)
[GitHub](https://github.com/shiosyakeyakini-info/miria)
\$[x2 **${S.of(context).openSourceLicense}**]
''',
),
ElevatedButton(
onPressed: () async {
showLicensePage(
context: context,
applicationName: packageInfo?.appName.toString(),
applicationIcon: Image.asset("assets/images/icon.png"),
applicationVersion:
"${packageInfo?.version ?? ""}+${packageInfo?.buildNumber.toString() ?? ""}",
);
},
child: Text(S.of(context).showLicense),
),
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/general_settings_page/general_settings_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:miria/const.dart';
import 'package:miria/model/general_settings.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/themes/app_theme.dart';
import 'package:miria/view/themes/built_in_color_themes.dart';
@RoutePage()
class GeneralSettingsPage extends ConsumerStatefulWidget {
const GeneralSettingsPage({super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
GeneralSettingsPageState();
}
class GeneralSettingsPageState extends ConsumerState<GeneralSettingsPage> {
String lightModeTheme = "";
String darkModeTheme = "";
ThemeColorSystem colorSystem = ThemeColorSystem.system;
NSFWInherit nsfwInherit = NSFWInherit.inherit;
AutomaticPush automaticPush = AutomaticPush.none;
bool enableDirectReaction = false;
bool enableAnimatedMFM = true;
bool enableLongTextElipsed = false;
bool enableFavoritedRenoteElipsed = true;
TabPosition tabPosition = TabPosition.top;
double textScaleFactor = 1.0;
EmojiType emojiType = EmojiType.twemoji;
String defaultFontName = "";
String serifFontName = "";
String monospaceFontName = "";
String cursiveFontName = "";
String fantasyFontName = "";
Languages language = Languages.jaJP;
@override
void initState() {
super.initState();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
final settings = ref.read(generalSettingsRepositoryProvider).settings;
setState(() {
lightModeTheme = settings.lightColorThemeId;
if (lightModeTheme.isEmpty) {
lightModeTheme = builtInColorThemes
.where((element) => !element.isDarkTheme)
.first
.id;
}
darkModeTheme = settings.darkColorThemeId;
if (darkModeTheme.isEmpty ||
builtInColorThemes.every((element) =>
!element.isDarkTheme || element.id != darkModeTheme)) {
darkModeTheme =
builtInColorThemes.where((element) => element.isDarkTheme).first.id;
}
colorSystem = settings.themeColorSystem;
nsfwInherit = settings.nsfwInherit;
enableDirectReaction = settings.enableDirectReaction;
automaticPush = settings.automaticPush;
enableAnimatedMFM = settings.enableAnimatedMFM;
enableLongTextElipsed = settings.enableLongTextElipsed;
enableFavoritedRenoteElipsed = settings.enableFavoritedRenoteElipsed;
tabPosition = settings.tabPosition;
textScaleFactor = settings.textScaleFactor;
emojiType = settings.emojiType;
defaultFontName = settings.defaultFontName;
serifFontName = settings.serifFontName;
monospaceFontName = settings.monospaceFontName;
cursiveFontName = settings.cursiveFontName;
fantasyFontName = settings.fantasyFontName;
language = settings.languages;
});
}
Future<void> save() async {
ref.read(generalSettingsRepositoryProvider).update(
GeneralSettings(
lightColorThemeId: lightModeTheme,
darkColorThemeId: darkModeTheme,
themeColorSystem: colorSystem,
nsfwInherit: nsfwInherit,
enableDirectReaction: enableDirectReaction,
automaticPush: automaticPush,
enableAnimatedMFM: enableAnimatedMFM,
enableFavoritedRenoteElipsed: enableFavoritedRenoteElipsed,
enableLongTextElipsed: enableLongTextElipsed,
tabPosition: tabPosition,
emojiType: emojiType,
textScaleFactor: textScaleFactor,
defaultFontName: defaultFontName,
serifFontName: serifFontName,
monospaceFontName: monospaceFontName,
cursiveFontName: cursiveFontName,
fantasyFontName: fantasyFontName,
languages: language),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(S.of(context).generalSettings)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).general,
style: Theme.of(context).textTheme.titleLarge,
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).language),
DropdownButton<Languages>(
isExpanded: true,
items: [
for (final element in Languages.values)
DropdownMenuItem(
value: element,
child: Text(element.displayName),
),
],
value: language,
onChanged: (value) => setState(
() {
language = value ?? Languages.jaJP;
save();
},
),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).displayOfSensitiveNotes),
DropdownButton<NSFWInherit>(
isExpanded: true,
items: [
for (final element in NSFWInherit.values)
DropdownMenuItem(
value: element,
child: Text(element.displayName(context)),
),
],
value: nsfwInherit,
onChanged: (value) => setState(
() {
nsfwInherit = value ?? NSFWInherit.inherit;
save();
},
),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).infiniteScroll),
DropdownButton<AutomaticPush>(
isExpanded: true,
items: [
for (final element in AutomaticPush.values)
DropdownMenuItem(
value: element,
child: Text(element.displayName(context)),
),
],
value: automaticPush,
onChanged: (value) => setState(
() {
automaticPush = value ?? AutomaticPush.none;
save();
},
),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).enableAnimatedMfm),
CheckboxListTile(
value: enableAnimatedMFM,
onChanged: (value) => setState(() {
enableAnimatedMFM = value ?? true;
save();
}),
title: Text(S.of(context).enableAnimatedMfmDescription),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).collapseNotes),
CheckboxListTile(
value: enableFavoritedRenoteElipsed,
onChanged: (value) => setState(() {
enableFavoritedRenoteElipsed = value ?? true;
save();
}),
title: Text(S.of(context).collapseReactionedRenotes),
),
CheckboxListTile(
value: enableLongTextElipsed,
onChanged: (value) => setState(() {
enableLongTextElipsed = value ?? true;
save();
}),
title: Text(S.of(context).collapseLongNotes),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).tabPosition),
DropdownButton<TabPosition>(
isExpanded: true,
items: [
for (final element in TabPosition.values)
DropdownMenuItem(
value: element,
child: Text(
S.of(context).tabPositionDescription(
element.displayName(context),
),
),
),
],
value: tabPosition,
onChanged: (value) => setState(
() {
tabPosition = value ?? TabPosition.top;
save();
},
),
),
],
),
),
),
Card(
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).theme,
style: Theme.of(context).textTheme.titleLarge,
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).themeForLightMode),
DropdownButton<String>(
items: [
for (final element in builtInColorThemes
.where((element) => !element.isDarkTheme))
DropdownMenuItem(
value: element.id,
child: Text(S.of(context).themeIsh(element.name)),
),
],
value: lightModeTheme,
onChanged: (value) => setState(
() {
lightModeTheme = value ?? "";
save();
},
),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).themeForDarkMode),
DropdownButton<String>(
items: [
for (final element in builtInColorThemes
.where((element) => element.isDarkTheme))
DropdownMenuItem(
value: element.id,
child: Text(S.of(context).themeIsh(element.name)),
),
],
value: darkModeTheme,
onChanged: (value) => setState(() {
darkModeTheme = value ?? "";
save();
}),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).selectLightOrDarkMode),
DropdownButton<ThemeColorSystem>(
items: [
for (final colorSystem in ThemeColorSystem.values)
DropdownMenuItem(
value: colorSystem,
child: Text(colorSystem.displayName(context)),
),
],
value: colorSystem,
onChanged: (value) => setState(() {
colorSystem = value ?? ThemeColorSystem.system;
save();
}),
),
],
),
),
),
Card(
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).reaction,
style: Theme.of(context).textTheme.titleLarge,
),
CheckboxListTile(
value: enableDirectReaction,
title: Text(S.of(context).emojiTapReaction),
subtitle:
Text(S.of(context).emojiTapReactionDescription),
onChanged: (value) {
setState(() {
enableDirectReaction = !enableDirectReaction;
save();
});
},
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(S.of(context).emojiStyle),
DropdownButton(
items: [
for (final type in EmojiType.values)
DropdownMenuItem(
value: type,
child: Text(type.displayName(context)),
),
],
value: emojiType,
isExpanded: true,
onChanged: (value) {
setState(() {
emojiType = value ?? EmojiType.twemoji;
save();
});
},
),
],
),
),
),
Card(
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).fontSize,
style: Theme.of(context).textTheme.titleSmall,
),
Slider(
value: textScaleFactor,
min: 0.5,
max: 1.5,
divisions: 10,
label: "${(textScaleFactor * 100).toInt()}%",
onChanged: (value) {
setState(() {
textScaleFactor = value;
save();
});
},
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(
S.of(context).fontStandard,
style: Theme.of(context).textTheme.titleSmall,
),
DropdownButton<Font>(
items: [
for (final font in choosableFonts)
DropdownMenuItem(
value: font,
child: Text(
font.actualName.isEmpty
? S.of(context).systemFont
: font.displayName,
// style: GoogleFonts.asMap()[font.actualName]
// ?.call(),
),
)
],
value: choosableFonts.firstWhereOrNull(
(e) => e.actualName == defaultFontName) ??
choosableFonts.first,
isExpanded: true,
onChanged: (item) => setState(() {
defaultFontName = item?.actualName ?? "";
save();
}),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(
S.of(context).fontSerif,
style: Theme.of(context).textTheme.titleSmall,
),
DropdownButton<Font>(
items: [
for (final font in choosableFonts)
DropdownMenuItem(
value: font,
child: Text(
font.actualName.isEmpty
? S.of(context).systemFont
: font.displayName,
// style: GoogleFonts.asMap()[font.actualName]
// ?.call() ??
// AppTheme.of(context).serifStyle,
),
),
],
value: choosableFonts.firstWhereOrNull(
(e) => e.actualName == serifFontName) ??
choosableFonts.first,
isExpanded: true,
onChanged: (item) => setState(() {
serifFontName = item?.actualName ?? "";
save();
}),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(
S.of(context).fontMonospace,
style: Theme.of(context).textTheme.titleSmall,
),
DropdownButton<Font>(
items: [
for (final font in choosableFonts)
DropdownMenuItem(
value: font,
child: Text(
font.actualName.isEmpty
? S.of(context).systemFont
: font.displayName,
// style: GoogleFonts.asMap()[font.actualName]
// ?.call() ??
// AppTheme.of(context).monospaceStyle,
),
),
],
value: choosableFonts.firstWhereOrNull(
(e) => e.actualName == monospaceFontName) ??
choosableFonts.first,
isExpanded: true,
onChanged: (item) => setState(
() => monospaceFontName = item?.actualName ?? ""),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(
S.of(context).fontCursive,
style: Theme.of(context).textTheme.titleSmall,
),
DropdownButton<Font>(
items: [
for (final font in choosableFonts)
DropdownMenuItem(
value: font,
child: Text(
font.actualName.isEmpty
? S.of(context).systemFont
: font.displayName,
// style: GoogleFonts.asMap()[font.actualName]
// ?.call() ??
// AppTheme.of(context).cursiveStyle,
),
)
],
value: choosableFonts.firstWhereOrNull(
(e) => e.actualName == cursiveFontName) ??
choosableFonts.first,
isExpanded: true,
onChanged: (item) => setState(() {
cursiveFontName = item?.actualName ?? "";
save();
}),
),
const Padding(padding: EdgeInsets.only(top: 10)),
Text(
S.of(context).fontFantasy,
style: Theme.of(context).textTheme.titleSmall,
),
DropdownButton<Font>(
items: [
for (final font in choosableFonts)
DropdownMenuItem(
value: font,
child: Text(
font.actualName.isEmpty
? S.of(context).systemFont
: font.displayName,
// style: GoogleFonts.asMap()[font.actualName]
// ?.call() ??
// AppTheme.of(context).fantasyStyle,
),
)
],
value: choosableFonts.firstWhereOrNull(
(e) => e.actualName == fantasyFontName) ??
choosableFonts.first,
isExpanded: true,
onChanged: (item) => setState(() {
fantasyFontName = item?.actualName ?? "";
save();
}),
),
],
),
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/import_export_page/folder_select_dialog.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/futable_list_builder.dart';
import 'package:miria/view/common/pushable_listview.dart';
import 'package:misskey_dart/misskey_dart.dart';
class FolderResult {
const FolderResult(this.folder);
final DriveFolder? folder;
}
class FolderSelectDialog extends ConsumerStatefulWidget {
final Account account;
final List<String>? fileShowTarget;
final String confirmationText;
const FolderSelectDialog({
super.key,
required this.account,
required this.fileShowTarget,
required this.confirmationText,
});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
FolderSelectDialogState();
}
class FolderSelectDialogState extends ConsumerState<FolderSelectDialog> {
final List<DriveFolder> path = [];
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Column(
children: [
Text(S.of(context).selectFolder),
Row(
children: [
if (path.isNotEmpty)
IconButton(
onPressed: () {
setState(() {
path.removeLast();
});
},
icon: const Icon(Icons.arrow_back),
),
Expanded(child: Text(path.map((e) => e.name).join("/"))),
],
)
],
),
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.8,
child: SingleChildScrollView(
child: Column(
children: [
PushableListView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
showAd: false,
initializeFuture: () async {
final misskey = ref.read(misskeyProvider(widget.account));
final response = await misskey.drive.folders.folders(
DriveFoldersRequest(
folderId: path.isEmpty ? null : path.last.id,
),
);
return response.toList();
},
nextFuture: (lastItem, _) async {
final misskey = ref.read(misskeyProvider(widget.account));
final response = await misskey.drive.folders.folders(
DriveFoldersRequest(
untilId: lastItem.id,
folderId: path.isEmpty ? null : path.last.id,
),
);
return response.toList();
},
listKey: path.map((e) => e.id).join("/"),
itemBuilder: (context, item) {
return ListTile(
leading: const Icon(Icons.folder),
title: Text(item.name),
onTap: () {
setState(() {
path.add(item);
});
},
);
},
),
if (widget.fileShowTarget != null)
FutureListView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
future: () async {
final list = [];
for (final element in widget.fileShowTarget!) {
list.addAll(
await ref
.read(misskeyProvider(widget.account))
.drive
.files
.find(
DriveFilesFindRequest(
folderId: path.lastOrNull?.id,
name: element,
),
),
);
}
return list.toList();
}(),
builder: (context, item) => Row(
children: [
const Icon(Icons.description),
Expanded(child: Text(item.name)),
],
),
)
],
),
),
),
actions: [
ElevatedButton(
onPressed: () {
Navigator.of(context).pop(FolderResult(path.lastOrNull));
},
child: Text(widget.confirmationText),
)
],
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/import_export_page/import_export_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/error_dialog_handler.dart';
import 'package:miria/view/dialogs/simple_message_dialog.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@RoutePage()
class ImportExportPage extends ConsumerStatefulWidget {
const ImportExportPage({super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
ImportExportPageState();
}
class ImportExportPageState extends ConsumerState<ImportExportPage> {
Account? selectedImportAccount;
Account? selectedExportAccount;
@override
Widget build(BuildContext context) {
final accounts = ref.watch(accountsProvider);
return Scaffold(
appBar: AppBar(title: Text(S.of(context).settingsImportAndExport)),
body: Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).importSettings,
style: Theme.of(context).textTheme.titleLarge,
),
Text(S.of(context).importSettingsDescription),
Row(
children: [
Expanded(
child: DropdownButton(
isExpanded: true,
items: [
for (final account in accounts)
DropdownMenuItem(
value: account,
child: Text(account.acct.toString()),
),
],
value: selectedImportAccount,
onChanged: (Account? value) {
setState(() {
selectedImportAccount = value;
});
},
),
),
ElevatedButton(
onPressed: () async {
final account = selectedImportAccount;
if (account == null) {
await SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectAccount,
);
return;
}
await ref
.read(importExportRepository)
.import(context, account)
.expectFailure(context);
},
child: Text(S.of(context).select),
),
],
),
const Padding(padding: EdgeInsets.only(top: 30)),
Text(
S.of(context).exportSettings,
style: Theme.of(context).textTheme.titleLarge,
),
Text(S.of(context).exportSettingsDescription1),
Text(S.of(context).exportSettingsDescription2),
Row(
children: [
Expanded(
child: DropdownButton(
isExpanded: true,
items: [
for (final account in accounts)
DropdownMenuItem(
value: account,
child: Text(account.acct.toString()),
),
],
value: selectedExportAccount,
onChanged: (Account? value) {
setState(() {
selectedExportAccount = value;
});
},
),
),
ElevatedButton(
onPressed: () {
final account = selectedExportAccount;
if (account == null) {
SimpleMessageDialog.show(
context,
S.of(context).pleaseSelectAccountToExportSettings,
);
return;
}
ref
.read(importExportRepository)
.export(context, account)
.expectFailure(context);
},
child: Text(S.of(context).save)),
],
),
]),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view/settings_page | mirrored_repositories/miria/lib/view/settings_page/account_settings_page/account_list.dart | import 'dart:io';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/providers.dart';
import 'package:miria/router/app_router.dart';
import 'package:miria/view/common/avatar_icon.dart';
@RoutePage()
class AccountListPage extends ConsumerWidget {
const AccountListPage({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final accounts = ref.watch(accountsProvider);
return Scaffold(
appBar: AppBar(
title: Text(S.of(context).accountSettings),
leading: Container(),
actions: [
IconButton(
onPressed: () {
context.pushRoute(const LoginRoute());
},
icon: const Icon(Icons.add),
),
],
),
body: Column(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: ReorderableListView.builder(
buildDefaultDragHandles: false,
itemCount: accounts.length,
itemBuilder: (context, index) {
final account = accounts[index];
if (Platform.isAndroid || Platform.isIOS) {
return ReorderableDelayedDragStartListener(
key: Key("$index"),
index: index,
child: AccountListItem(account),
);
} else {
return ReorderableDragStartListener(
key: Key("$index"),
index: index,
child: AccountListItem(account),
);
}
},
onReorder: ref.read(accountRepositoryProvider.notifier).reorder,
),
),
Align(
alignment: Alignment.center,
child: Padding(
padding: const EdgeInsets.all(10),
child: ElevatedButton(
onPressed: () {
context.router
..removeWhere((route) => true)
..push(const SplashRoute());
},
child: Text(S.of(context).quitAccountSettings),
),
),
),
],
),
);
}
}
class AccountListItem extends ConsumerWidget {
const AccountListItem(this.account, {super.key});
final Account account;
@override
Widget build(BuildContext context, WidgetRef ref) {
return ListTile(
leading: AvatarIcon(user: account.i),
title: Text(
account.i.name ?? account.i.username,
style: Theme.of(context).textTheme.titleMedium,
),
subtitle: Text(
account.acct.toString(),
style: Theme.of(context).textTheme.bodySmall,
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: const Icon(Icons.delete),
onPressed: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
content: Text(S.of(context).confirmDelete),
actions: [
OutlinedButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(S.of(context).cancel),
),
ElevatedButton(
onPressed: () async {
await ref
.read(
accountRepositoryProvider.notifier,
)
.remove(account);
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: Text(S.of(context).doDeleting),
),
],
),
);
},
),
const Icon(Icons.drag_handle),
],
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/users_list_page/users_list_settings_dialog.dart | import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/users_list_settings.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
final _formKeyProvider = Provider.autoDispose((ref) => GlobalKey<FormState>());
final _initialSettingsProvider = Provider.autoDispose<UsersListSettings>(
(ref) => throw UnimplementedError(),
);
final _usersListSettingsNotifierProvider =
NotifierProvider.autoDispose<_UsersListSettingsNotifier, UsersListSettings>(
_UsersListSettingsNotifier.new,
dependencies: [_initialSettingsProvider],
);
class _UsersListSettingsNotifier
extends AutoDisposeNotifier<UsersListSettings> {
@override
UsersListSettings build() {
return ref.watch(_initialSettingsProvider);
}
void updateName(String? name) {
if (name != null) {
state = state.copyWith(name: name);
}
}
void updateIsPublic(bool? isPublic) {
if (isPublic != null) {
state = state.copyWith(isPublic: isPublic);
}
}
}
class UsersListSettingsDialog extends StatelessWidget {
const UsersListSettingsDialog({
super.key,
this.title,
this.initialSettings = const UsersListSettings(),
});
final Widget? title;
final UsersListSettings initialSettings;
@override
Widget build(BuildContext context) {
return AlertDialog(
title: title,
content: ProviderScope(
overrides: [
_initialSettingsProvider.overrideWithValue(initialSettings),
],
child: const UsersListSettingsForm(),
),
);
}
}
class UsersListSettingsForm extends ConsumerWidget {
const UsersListSettingsForm({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final formKey = ref.watch(_formKeyProvider);
final initialSettings = ref.watch(_initialSettingsProvider);
final settings = ref.watch(_usersListSettingsNotifierProvider);
return Form(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextFormField(
initialValue: initialSettings.name,
maxLength: 100,
decoration: InputDecoration(
labelText: S.of(context).listName,
contentPadding: const EdgeInsets.fromLTRB(12, 24, 12, 16),
),
validator: (value) {
if (value == null || value.isEmpty) {
return S.of(context).pleaseInput;
}
return null;
},
onSaved: ref
.read(_usersListSettingsNotifierProvider.notifier)
.updateName,
),
CheckboxListTile(
title: Text(S.of(context).public),
value: settings.isPublic,
onChanged: ref
.read(_usersListSettingsNotifierProvider.notifier)
.updateIsPublic,
),
ElevatedButton(
child: Text(S.of(context).done),
onPressed: () {
if (formKey.currentState!.validate()) {
formKey.currentState!.save();
final settings = ref.read(_usersListSettingsNotifierProvider);
if (settings == initialSettings) {
Navigator.of(context).pop();
} else {
Navigator.of(context).pop(settings);
}
}
},
),
],
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/users_list_page/users_list_detail_page.dart | import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/extensions/users_lists_show_response_extension.dart';
import 'package:miria/model/account.dart';
import 'package:miria/model/users_list_settings.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/common/error_detail.dart';
import 'package:miria/view/common/error_dialog_handler.dart';
import 'package:miria/view/dialogs/simple_confirm_dialog.dart';
import 'package:miria/view/user_page/user_list_item.dart';
import 'package:miria/view/user_select_dialog.dart';
import 'package:miria/view/users_list_page/users_list_settings_dialog.dart';
import 'package:misskey_dart/misskey_dart.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
final _usersListNotifierProvider = AutoDisposeAsyncNotifierProviderFamily<
_UsersListNotifier, UsersList, (Misskey, String)>(_UsersListNotifier.new);
class _UsersListNotifier
extends AutoDisposeFamilyAsyncNotifier<UsersList, (Misskey, String)> {
@override
Future<UsersList> build((Misskey, String) arg) async {
final response = await _misskey.users.list.show(
UsersListsShowRequest(listId: _listId),
);
return response.toUsersList();
}
Misskey get _misskey => arg.$1;
String get _listId => arg.$2;
Future<void> updateList(UsersListSettings settings) async {
await _misskey.users.list.update(
UsersListsUpdateRequest(
listId: _listId,
name: settings.name,
isPublic: settings.isPublic,
),
);
final list = state.valueOrNull;
if (list != null) {
state = AsyncValue.data(
list.copyWith(
name: settings.name,
isPublic: settings.isPublic,
),
);
}
}
}
final _usersListUsersProvider = AutoDisposeAsyncNotifierProviderFamily<
_UsersListUsers, List<User>, (Misskey, String)>(
_UsersListUsers.new,
);
class _UsersListUsers
extends AutoDisposeFamilyAsyncNotifier<List<User>, (Misskey, String)> {
@override
Future<List<User>> build((Misskey, String) arg) async {
final list = await ref.watch(_usersListNotifierProvider(arg).future);
final response = await _misskey.users.showByIds(
UsersShowByIdsRequest(
userIds: list.userIds,
),
);
return response.toList();
}
Misskey get _misskey => arg.$1;
String get _listId => arg.$2;
Future<void> push(User user) async {
await _misskey.users.list.push(
UsersListsPushRequest(
listId: _listId,
userId: user.id,
),
);
state = AsyncValue.data([...?state.valueOrNull, user]);
}
Future<void> pull(User user) async {
await _misskey.users.list.pull(
UsersListsPullRequest(
listId: _listId,
userId: user.id,
),
);
state = AsyncValue.data(
state.valueOrNull?.where((e) => e.id != user.id).toList() ?? [],
);
}
}
@RoutePage()
class UsersListDetailPage extends ConsumerWidget {
const UsersListDetailPage({
super.key,
required this.account,
required this.listId,
});
final Account account;
final String listId;
@override
Widget build(BuildContext context, WidgetRef ref) {
final misskey = ref.watch(misskeyProvider(account));
final arg = (misskey, listId);
final list = ref.watch(_usersListNotifierProvider(arg));
final users = ref.watch(_usersListUsersProvider(arg));
return Scaffold(
appBar: list.maybeWhen(
data: (list) => AppBar(
title: Text(list.name ?? ""),
actions: [
IconButton(
icon: const Icon(Icons.settings),
onPressed: () async {
final settings = await showDialog<UsersListSettings>(
context: context,
builder: (context) => UsersListSettingsDialog(
title: Text(S.of(context).edit),
initialSettings: UsersListSettings.fromUsersList(list),
),
);
if (!context.mounted) return;
if (settings != null) {
ref
.read(_usersListNotifierProvider(arg).notifier)
.updateList(settings)
.expectFailure(context);
}
},
),
],
),
orElse: () => AppBar(),
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: users.when(
data: (users) {
return AccountScope(
account: account,
child: Column(
children: [
ListTile(
title: Text(S.of(context).members),
subtitle: Text(
S.of(context).listCapacity(
users.length,
account.i.policies.userEachUserListsLimit,
),
),
trailing: ElevatedButton(
child: Text(S.of(context).addUser),
onPressed: () async {
final user = await showDialog<User>(
context: context,
builder: (context) =>
UserSelectDialog(account: account),
);
if (user == null) {
return;
}
if (!context.mounted) return;
await ref
.read(_usersListUsersProvider(arg).notifier)
.push(user)
.expectFailure(context);
},
),
),
const Divider(),
Expanded(
child: ListView.builder(
itemCount: users.length,
itemBuilder: (context, index) {
final user = users[index];
return Row(
children: [
Expanded(
child: UserListItem(user: user),
),
IconButton(
icon: const Icon(Icons.close),
onPressed: () async {
final result = await SimpleConfirmDialog.show(
context: context,
message: S.of(context).confirmRemoveUser,
primary: S.of(context).removeUser,
secondary: S.of(context).cancel,
);
if (!context.mounted) return;
if (result ?? false) {
await ref
.read(
_usersListUsersProvider(arg).notifier,
)
.pull(user)
.expectFailure(context);
}
},
),
],
);
},
),
),
],
),
);
},
error: (e, st) =>
Center(child: ErrorDetail(error: e, stackTrace: st)),
loading: () => const Center(child: CircularProgressIndicator()),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/users_list_page/users_list_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/model/users_list_settings.dart';
import 'package:miria/providers.dart';
import 'package:miria/router/app_router.dart';
import 'package:miria/view/common/error_detail.dart';
import 'package:miria/view/common/error_dialog_handler.dart';
import 'package:miria/view/dialogs/simple_confirm_dialog.dart';
import 'package:miria/view/users_list_page/users_list_settings_dialog.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@RoutePage()
class UsersListPage extends ConsumerWidget {
final Account account;
const UsersListPage(this.account, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final misskey = ref.watch(misskeyProvider(account));
final list = ref.watch(usersListsNotifierProvider(misskey));
return Scaffold(
appBar: AppBar(
title: Text(S.of(context).list),
actions: [
IconButton(
icon: const Icon(Icons.add),
onPressed: () async {
final settings = await showDialog<UsersListSettings>(
context: context,
builder: (context) => UsersListSettingsDialog(
title: Text(S.of(context).create),
),
);
if (!context.mounted) return;
if (settings != null) {
ref
.read(usersListsNotifierProvider(misskey).notifier)
.create(settings)
.expectFailure(context);
}
},
),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: list.when(
data: (data) {
return ListView.builder(
itemCount: data.length,
itemBuilder: (context, index) {
final list = data[index];
return ListTile(
title: Text(list.name ?? ""),
trailing: IconButton(
icon: const Icon(Icons.delete),
onPressed: () async {
final result = await SimpleConfirmDialog.show(
context: context,
message: S.of(context).confirmDeleteList,
primary: S.of(context).doDeleting,
secondary: S.of(context).cancel,
);
if (!context.mounted) return;
if (result ?? false) {
await ref
.read(
usersListsNotifierProvider(misskey).notifier,
)
.delete(list.id)
.expectFailure(context);
}
},
),
onTap: () => context.pushRoute(
UsersListTimelineRoute(
account: account,
list: list,
),
),
);
},
);
},
error: (e, st) =>
Center(child: ErrorDetail(error: e, stackTrace: st)),
loading: () => const Center(child: CircularProgressIndicator()),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/users_list_page/users_list_timeline_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/router/app_router.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/users_list_page/users_list_timeline.dart';
import 'package:misskey_dart/misskey_dart.dart';
@RoutePage()
class UsersListTimelinePage extends ConsumerWidget {
final Account account;
final UsersList list;
const UsersListTimelinePage(this.account, this.list, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
return Scaffold(
appBar: AppBar(
title: Text(list.name ?? ""),
actions: [
IconButton(
icon: const Icon(Icons.info_outline),
onPressed: () => context.pushRoute(
UsersListDetailRoute(
account: account,
listId: list.id,
),
),
),
],
),
body: AccountScope(
account: account,
child: Padding(
padding: const EdgeInsets.only(right: 10),
child: UsersListTimeline(listId: list.id),
),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/users_list_page/users_list_timeline.dart | import 'package:flutter/widgets.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/common/misskey_notes/misskey_note.dart';
import 'package:miria/view/common/pushable_listview.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:misskey_dart/misskey_dart.dart';
class UsersListTimeline extends ConsumerWidget {
final String listId;
const UsersListTimeline({super.key, required this.listId});
@override
Widget build(BuildContext context, WidgetRef ref) {
final account = AccountScope.of(context);
return PushableListView<Note>(
initializeFuture: () async {
final response = await ref
.read(misskeyProvider(account))
.notes
.userListTimeline(UserListTimelineRequest(listId: listId));
ref.read(notesProvider(account)).registerAll(response);
return response.toList();
},
nextFuture: (lastItem, _) async {
final response = await ref
.read(misskeyProvider(account))
.notes
.userListTimeline(
UserListTimelineRequest(listId: listId, untilId: lastItem.id));
ref.read(notesProvider(account)).registerAll(response);
return response.toList();
},
itemBuilder: (context, item) {
return MisskeyNote(note: item);
},
);
}
}
| 0 |
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/reaction_picker_dialog/reaction_picker_content.dart | import 'dart:async';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/misskey_emoji_data.dart';
import 'package:miria/providers.dart';
import 'package:miria/repository/emoji_repository.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/common/misskey_notes/custom_emoji.dart';
import 'package:miria/view/dialogs/simple_message_dialog.dart';
import 'package:miria/view/themes/app_theme.dart';
import 'package:visibility_detector/visibility_detector.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class ReactionPickerContent extends ConsumerStatefulWidget {
final FutureOr Function(MisskeyEmojiData emoji) onTap;
final bool isAcceptSensitive;
const ReactionPickerContent({
super.key,
required this.onTap,
required this.isAcceptSensitive,
});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
ReactionPickerContentState();
}
class ReactionPickerContentState extends ConsumerState<ReactionPickerContent> {
final categoryList = <String>[];
EmojiRepository get emojiRepository =>
ref.read(emojiRepositoryProvider(AccountScope.of(context)));
@override
void didChangeDependencies() {
super.didChangeDependencies();
categoryList
..clear()
..addAll(emojiRepository.emoji
?.map((e) => e.category)
.toSet()
.toList()
.whereNotNull() ??
[]);
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: [
EmojiSearch(
onTap: widget.onTap,
isAcceptSensitive: widget.isAcceptSensitive,
),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: categoryList.length,
itemBuilder: (context, index) => ExpansionTile(
title: Text(categoryList[index]),
children: [
Padding(
padding: const EdgeInsets.all(10),
child: Align(
alignment: Alignment.topLeft,
child: Wrap(
spacing: 5,
runSpacing: 5,
crossAxisAlignment: WrapCrossAlignment.start,
children: [
for (final emoji in (emojiRepository.emoji ?? []).where(
(element) =>
element.category == categoryList[index]))
EmojiButton(
emoji: emoji.emoji,
onTap: widget.onTap,
isAcceptSensitive: widget.isAcceptSensitive,
)
],
),
),
)
],
),
)
],
),
);
}
}
class EmojiButton extends ConsumerStatefulWidget {
final MisskeyEmojiData emoji;
final FutureOr Function(MisskeyEmojiData emoji) onTap;
final bool isForceVisible;
final bool isAcceptSensitive;
const EmojiButton({
super.key,
required this.emoji,
required this.onTap,
this.isForceVisible = false,
required this.isAcceptSensitive,
});
@override
ConsumerState<ConsumerStatefulWidget> createState() => EmojiButtonState();
}
class EmojiButtonState extends ConsumerState<EmojiButton> {
late var isVisibility = widget.isForceVisible;
late var isVisibilityOnceMore = widget.isForceVisible;
@override
Widget build(BuildContext context) {
final disabled = !widget.isAcceptSensitive && widget.emoji.isSensitive;
return VisibilityDetector(
key: Key(widget.emoji.baseName),
onVisibilityChanged: (visibilityInfo) {
if (visibilityInfo.visibleFraction != 0) {
setState(() {
isVisibility = true;
isVisibilityOnceMore = true;
});
}
},
child: DecoratedBox(
decoration: disabled && isVisibility
? BoxDecoration(color: Theme.of(context).disabledColor)
: const BoxDecoration(),
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.transparent),
padding: MaterialStatePropertyAll(EdgeInsets.all(5)),
elevation: MaterialStatePropertyAll(0),
minimumSize: MaterialStatePropertyAll(Size.zero),
overlayColor: MaterialStatePropertyAll(AppTheme.of(context).colorTheme.accentedBackground),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: () async {
if (!isVisibility) return;
if (disabled) {
SimpleMessageDialog.show(
context,
S.of(context).disabledUsingSensitiveCustomEmoji,
);
} else {
widget.onTap.call(widget.emoji);
}
},
child: isVisibility
? SizedBox(
height: MediaQuery.textScalerOf(context).scale(32),
child: CustomEmoji(emojiData: widget.emoji),
)
: SizedBox(
width: MediaQuery.textScalerOf(context).scale(32),
height: MediaQuery.textScalerOf(context).scale(32),
),
),
),
);
}
}
class EmojiSearch extends ConsumerStatefulWidget {
final FutureOr Function(MisskeyEmojiData emoji) onTap;
final bool isAcceptSensitive;
const EmojiSearch({
super.key,
required this.onTap,
required this.isAcceptSensitive,
});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
EmojiSearchState();
}
class EmojiSearchState extends ConsumerState<EmojiSearch> {
final emojis = <MisskeyEmojiData>[];
EmojiRepository get emojiRepository =>
ref.read(emojiRepositoryProvider(AccountScope.of(context)));
@override
void didChangeDependencies() {
super.didChangeDependencies();
emojis.clear();
emojis.addAll(emojiRepository.defaultEmojis().toList());
}
@override
Widget build(BuildContext context) {
return Column(children: [
TextField(
decoration: const InputDecoration(prefixIcon: Icon(Icons.search)),
autofocus: true,
keyboardType: TextInputType.emailAddress,
onChanged: (value) {
Future(() async {
final result = await emojiRepository.searchEmojis(value);
if (!mounted) return;
setState(() {
emojis.clear();
emojis.addAll(result);
});
});
},
),
const Padding(padding: EdgeInsets.only(top: 10)),
Align(
alignment: Alignment.topLeft,
child: Wrap(
spacing: 5,
runSpacing: 5,
crossAxisAlignment: WrapCrossAlignment.start,
children: [
for (final emoji in emojis)
EmojiButton(
emoji: emoji,
onTap: widget.onTap,
isForceVisible: true,
isAcceptSensitive: widget.isAcceptSensitive,
)
],
))
]);
}
}
| 0 |
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/reaction_picker_dialog/reaction_picker_dialog.dart | import 'package:flutter/material.dart';
import 'package:miria/model/account.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/view/reaction_picker_dialog/reaction_picker_content.dart';
class ReactionPickerDialog extends ConsumerStatefulWidget {
final Account account;
final bool isAcceptSensitive;
const ReactionPickerDialog({
super.key,
required this.account,
required this.isAcceptSensitive,
});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
_ReactionPickerDialogState();
}
class _ReactionPickerDialogState extends ConsumerState<ReactionPickerDialog> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return AlertDialog(
contentPadding: const EdgeInsets.all(5),
content: AccountScope(
account: widget.account,
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.9,
height: MediaQuery.of(context).size.height * 0.9,
child: ReactionPickerContent(
isAcceptSensitive: widget.isAcceptSensitive,
onTap: (emoji) => Navigator.of(context).pop(emoji),
)),
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/view | mirrored_repositories/miria/lib/view/favorited_note_page/favorited_note_page.dart | import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';
import 'package:miria/model/account.dart';
import 'package:miria/providers.dart';
import 'package:miria/view/common/account_scope.dart';
import 'package:miria/view/common/misskey_notes/misskey_note.dart';
import 'package:miria/view/common/pushable_listview.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:misskey_dart/misskey_dart.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@RoutePage()
class FavoritedNotePage extends ConsumerWidget {
final Account account;
const FavoritedNotePage({super.key, required this.account});
@override
Widget build(BuildContext context, WidgetRef ref) {
return Scaffold(
appBar: AppBar(
title: Text(S.of(context).favorite),
),
body: AccountScope(
account: account,
child: Padding(
padding: const EdgeInsets.only(right: 10),
child: PushableListView(
initializeFuture: () async {
final response = await ref
.read(misskeyProvider(account))
.i
.favorites(const IFavoritesRequest());
ref
.read(notesProvider(account))
.registerAll(response.map((e) => e.note));
return response.map((e) => e.note).toList();
},
nextFuture: (lastItem, _) async {
final response = await ref
.read(misskeyProvider(account))
.i
.favorites(IFavoritesRequest(untilId: lastItem.id));
ref
.read(notesProvider(account))
.registerAll(response.map((e) => e.note));
return response.map((e) => e.note).toList();
},
itemBuilder: (context, item) => MisskeyNote(note: item),
),
)));
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/router/app_router.gr.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
// **************************************************************************
// AutoRouterGenerator
// **************************************************************************
// ignore_for_file: type=lint
// coverage:ignore-file
part of 'app_router.dart';
abstract class _$AppRouter extends RootStackRouter {
// ignore: unused_element
_$AppRouter({super.navigatorKey});
@override
final Map<String, PageFactory> pagesMap = {
NotesAfterRenoteRoute.name: (routeData) {
final args = routeData.argsAs<NotesAfterRenoteRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: NotesAfterRenotePage(
key: args.key,
note: args.note,
account: args.account,
),
);
},
AntennaRoute.name: (routeData) {
final args = routeData.argsAs<AntennaRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: AntennaPage(
account: args.account,
key: args.key,
),
);
},
AntennaNotesRoute.name: (routeData) {
final args = routeData.argsAs<AntennaNotesRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: AntennaNotesPage(
key: args.key,
antenna: args.antenna,
account: args.account,
),
);
},
NotificationRoute.name: (routeData) {
final args = routeData.argsAs<NotificationRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: NotificationPage(
key: args.key,
account: args.account,
),
);
},
LoginRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const LoginPage(),
);
},
ClipDetailRoute.name: (routeData) {
final args = routeData.argsAs<ClipDetailRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: ClipDetailPage(
key: args.key,
account: args.account,
id: args.id,
),
);
},
ClipListRoute.name: (routeData) {
final args = routeData.argsAs<ClipListRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: ClipListPage(
key: args.key,
account: args.account,
),
);
},
NoteCreateRoute.name: (routeData) {
final args = routeData.argsAs<NoteCreateRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: NoteCreatePage(
key: args.key,
initialAccount: args.initialAccount,
initialText: args.initialText,
initialMediaFiles: args.initialMediaFiles,
exitOnNoted: args.exitOnNoted,
channel: args.channel,
reply: args.reply,
renote: args.renote,
note: args.note,
noteCreationMode: args.noteCreationMode,
),
);
},
HashtagRoute.name: (routeData) {
final args = routeData.argsAs<HashtagRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: HashtagPage(
key: args.key,
hashtag: args.hashtag,
account: args.account,
),
);
},
UserFolloweeRoute.name: (routeData) {
final args = routeData.argsAs<UserFolloweeRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: UserFolloweePage(
key: args.key,
userId: args.userId,
account: args.account,
),
);
},
UserRoute.name: (routeData) {
final args = routeData.argsAs<UserRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: UserPage(
key: args.key,
userId: args.userId,
account: args.account,
),
);
},
UserFollowerRoute.name: (routeData) {
final args = routeData.argsAs<UserFollowerRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: UserFollowerPage(
key: args.key,
userId: args.userId,
account: args.account,
),
);
},
PhotoEditRoute.name: (routeData) {
final args = routeData.argsAs<PhotoEditRouteArgs>();
return AutoRoutePage<Uint8List?>(
routeData: routeData,
child: PhotoEditPage(
account: args.account,
file: args.file,
onSubmit: args.onSubmit,
key: args.key,
),
);
},
AnnouncementRoute.name: (routeData) {
final args = routeData.argsAs<AnnouncementRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: AnnouncementPage(
key: args.key,
account: args.account,
),
);
},
SplashRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const SplashPage(),
);
},
SeveralAccountGeneralSettingsRoute.name: (routeData) {
final args = routeData.argsAs<SeveralAccountGeneralSettingsRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: SeveralAccountGeneralSettingsPage(
key: args.key,
account: args.account,
),
);
},
SeveralAccountSettingsRoute.name: (routeData) {
final args = routeData.argsAs<SeveralAccountSettingsRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: SeveralAccountSettingsPage(
key: args.key,
account: args.account,
),
);
},
InstanceMuteRoute.name: (routeData) {
final args = routeData.argsAs<InstanceMuteRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: InstanceMutePage(
key: args.key,
account: args.account,
),
);
},
WordMuteRoute.name: (routeData) {
final args = routeData.argsAs<WordMuteRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: WordMutePage(
key: args.key,
account: args.account,
muteType: args.muteType,
),
);
},
CacheManagementRoute.name: (routeData) {
final args = routeData.argsAs<CacheManagementRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: CacheManagementPage(
key: args.key,
account: args.account,
),
);
},
ReactionDeckRoute.name: (routeData) {
final args = routeData.argsAs<ReactionDeckRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: ReactionDeckPage(
key: args.key,
account: args.account,
),
);
},
UsersListTimelineRoute.name: (routeData) {
final args = routeData.argsAs<UsersListTimelineRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: UsersListTimelinePage(
args.account,
args.list,
key: args.key,
),
);
},
UsersListRoute.name: (routeData) {
final args = routeData.argsAs<UsersListRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: UsersListPage(
args.account,
key: args.key,
),
);
},
UsersListDetailRoute.name: (routeData) {
final args = routeData.argsAs<UsersListDetailRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: UsersListDetailPage(
key: args.key,
account: args.account,
listId: args.listId,
),
);
},
ChannelDetailRoute.name: (routeData) {
final args = routeData.argsAs<ChannelDetailRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: ChannelDetailPage(
key: args.key,
account: args.account,
channelId: args.channelId,
),
);
},
ChannelsRoute.name: (routeData) {
final args = routeData.argsAs<ChannelsRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: ChannelsPage(
key: args.key,
account: args.account,
),
);
},
FederationRoute.name: (routeData) {
final args = routeData.argsAs<FederationRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: FederationPage(
key: args.key,
account: args.account,
host: args.host,
),
);
},
NoteDetailRoute.name: (routeData) {
final args = routeData.argsAs<NoteDetailRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: NoteDetailPage(
key: args.key,
note: args.note,
account: args.account,
),
);
},
SearchRoute.name: (routeData) {
final args = routeData.argsAs<SearchRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: SearchPage(
key: args.key,
initialNoteSearchCondition: args.initialNoteSearchCondition,
account: args.account,
),
);
},
SharingAccountSelectRoute.name: (routeData) {
final args = routeData.argsAs<SharingAccountSelectRouteArgs>(
orElse: () => const SharingAccountSelectRouteArgs());
return AutoRoutePage<dynamic>(
routeData: routeData,
child: SharingAccountSelectPage(
key: args.key,
sharingText: args.sharingText,
filePath: args.filePath,
),
);
},
MisskeyRouteRoute.name: (routeData) {
final args = routeData.argsAs<MisskeyRouteRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: MisskeyPagePage(
key: args.key,
account: args.account,
page: args.page,
),
);
},
MisskeyGamesRoute.name: (routeData) {
final args = routeData.argsAs<MisskeyGamesRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: MisskeyGamesPage(
key: args.key,
account: args.account,
),
);
},
ImportExportRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const ImportExportPage(),
);
},
GeneralSettingsRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const GeneralSettingsPage(),
);
},
TabSettingsRoute.name: (routeData) {
final args = routeData.argsAs<TabSettingsRouteArgs>(
orElse: () => const TabSettingsRouteArgs());
return AutoRoutePage<dynamic>(
routeData: routeData,
child: TabSettingsPage(
key: args.key,
tabIndex: args.tabIndex,
),
);
},
TabSettingsListRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const TabSettingsListPage(),
);
},
AppInfoRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const AppInfoPage(),
);
},
SettingsRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const SettingsPage(),
);
},
AccountListRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const AccountListPage(),
);
},
ExploreRoleUsersRoute.name: (routeData) {
final args = routeData.argsAs<ExploreRoleUsersRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: ExploreRoleUsersPage(
key: args.key,
item: args.item,
account: args.account,
),
);
},
ExploreRoute.name: (routeData) {
final args = routeData.argsAs<ExploreRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: ExplorePage(
key: args.key,
account: args.account,
),
);
},
TimeLineRoute.name: (routeData) {
final args = routeData.argsAs<TimeLineRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: TimeLinePage(
key: args.key,
initialTabSetting: args.initialTabSetting,
),
);
},
ShareExtensionRoute.name: (routeData) {
return AutoRoutePage<dynamic>(
routeData: routeData,
child: const ShareExtensionPage(),
);
},
FavoritedNoteRoute.name: (routeData) {
final args = routeData.argsAs<FavoritedNoteRouteArgs>();
return AutoRoutePage<dynamic>(
routeData: routeData,
child: FavoritedNotePage(
key: args.key,
account: args.account,
),
);
},
};
}
/// generated route for
/// [NotesAfterRenotePage]
class NotesAfterRenoteRoute extends PageRouteInfo<NotesAfterRenoteRouteArgs> {
NotesAfterRenoteRoute({
Key? key,
required Note note,
required Account account,
List<PageRouteInfo>? children,
}) : super(
NotesAfterRenoteRoute.name,
args: NotesAfterRenoteRouteArgs(
key: key,
note: note,
account: account,
),
initialChildren: children,
);
static const String name = 'NotesAfterRenoteRoute';
static const PageInfo<NotesAfterRenoteRouteArgs> page =
PageInfo<NotesAfterRenoteRouteArgs>(name);
}
class NotesAfterRenoteRouteArgs {
const NotesAfterRenoteRouteArgs({
this.key,
required this.note,
required this.account,
});
final Key? key;
final Note note;
final Account account;
@override
String toString() {
return 'NotesAfterRenoteRouteArgs{key: $key, note: $note, account: $account}';
}
}
/// generated route for
/// [AntennaPage]
class AntennaRoute extends PageRouteInfo<AntennaRouteArgs> {
AntennaRoute({
required Account account,
Key? key,
List<PageRouteInfo>? children,
}) : super(
AntennaRoute.name,
args: AntennaRouteArgs(
account: account,
key: key,
),
initialChildren: children,
);
static const String name = 'AntennaRoute';
static const PageInfo<AntennaRouteArgs> page =
PageInfo<AntennaRouteArgs>(name);
}
class AntennaRouteArgs {
const AntennaRouteArgs({
required this.account,
this.key,
});
final Account account;
final Key? key;
@override
String toString() {
return 'AntennaRouteArgs{account: $account, key: $key}';
}
}
/// generated route for
/// [AntennaNotesPage]
class AntennaNotesRoute extends PageRouteInfo<AntennaNotesRouteArgs> {
AntennaNotesRoute({
Key? key,
required Antenna antenna,
required Account account,
List<PageRouteInfo>? children,
}) : super(
AntennaNotesRoute.name,
args: AntennaNotesRouteArgs(
key: key,
antenna: antenna,
account: account,
),
initialChildren: children,
);
static const String name = 'AntennaNotesRoute';
static const PageInfo<AntennaNotesRouteArgs> page =
PageInfo<AntennaNotesRouteArgs>(name);
}
class AntennaNotesRouteArgs {
const AntennaNotesRouteArgs({
this.key,
required this.antenna,
required this.account,
});
final Key? key;
final Antenna antenna;
final Account account;
@override
String toString() {
return 'AntennaNotesRouteArgs{key: $key, antenna: $antenna, account: $account}';
}
}
/// generated route for
/// [NotificationPage]
class NotificationRoute extends PageRouteInfo<NotificationRouteArgs> {
NotificationRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
NotificationRoute.name,
args: NotificationRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'NotificationRoute';
static const PageInfo<NotificationRouteArgs> page =
PageInfo<NotificationRouteArgs>(name);
}
class NotificationRouteArgs {
const NotificationRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'NotificationRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [LoginPage]
class LoginRoute extends PageRouteInfo<void> {
const LoginRoute({List<PageRouteInfo>? children})
: super(
LoginRoute.name,
initialChildren: children,
);
static const String name = 'LoginRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [ClipDetailPage]
class ClipDetailRoute extends PageRouteInfo<ClipDetailRouteArgs> {
ClipDetailRoute({
Key? key,
required Account account,
required String id,
List<PageRouteInfo>? children,
}) : super(
ClipDetailRoute.name,
args: ClipDetailRouteArgs(
key: key,
account: account,
id: id,
),
initialChildren: children,
);
static const String name = 'ClipDetailRoute';
static const PageInfo<ClipDetailRouteArgs> page =
PageInfo<ClipDetailRouteArgs>(name);
}
class ClipDetailRouteArgs {
const ClipDetailRouteArgs({
this.key,
required this.account,
required this.id,
});
final Key? key;
final Account account;
final String id;
@override
String toString() {
return 'ClipDetailRouteArgs{key: $key, account: $account, id: $id}';
}
}
/// generated route for
/// [ClipListPage]
class ClipListRoute extends PageRouteInfo<ClipListRouteArgs> {
ClipListRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
ClipListRoute.name,
args: ClipListRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'ClipListRoute';
static const PageInfo<ClipListRouteArgs> page =
PageInfo<ClipListRouteArgs>(name);
}
class ClipListRouteArgs {
const ClipListRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'ClipListRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [NoteCreatePage]
class NoteCreateRoute extends PageRouteInfo<NoteCreateRouteArgs> {
NoteCreateRoute({
Key? key,
required Account initialAccount,
String? initialText,
List<String>? initialMediaFiles,
bool exitOnNoted = false,
CommunityChannel? channel,
Note? reply,
Note? renote,
Note? note,
NoteCreationMode? noteCreationMode,
List<PageRouteInfo>? children,
}) : super(
NoteCreateRoute.name,
args: NoteCreateRouteArgs(
key: key,
initialAccount: initialAccount,
initialText: initialText,
initialMediaFiles: initialMediaFiles,
exitOnNoted: exitOnNoted,
channel: channel,
reply: reply,
renote: renote,
note: note,
noteCreationMode: noteCreationMode,
),
initialChildren: children,
);
static const String name = 'NoteCreateRoute';
static const PageInfo<NoteCreateRouteArgs> page =
PageInfo<NoteCreateRouteArgs>(name);
}
class NoteCreateRouteArgs {
const NoteCreateRouteArgs({
this.key,
required this.initialAccount,
this.initialText,
this.initialMediaFiles,
this.exitOnNoted = false,
this.channel,
this.reply,
this.renote,
this.note,
this.noteCreationMode,
});
final Key? key;
final Account initialAccount;
final String? initialText;
final List<String>? initialMediaFiles;
final bool exitOnNoted;
final CommunityChannel? channel;
final Note? reply;
final Note? renote;
final Note? note;
final NoteCreationMode? noteCreationMode;
@override
String toString() {
return 'NoteCreateRouteArgs{key: $key, initialAccount: $initialAccount, initialText: $initialText, initialMediaFiles: $initialMediaFiles, exitOnNoted: $exitOnNoted, channel: $channel, reply: $reply, renote: $renote, note: $note, noteCreationMode: $noteCreationMode}';
}
}
/// generated route for
/// [HashtagPage]
class HashtagRoute extends PageRouteInfo<HashtagRouteArgs> {
HashtagRoute({
Key? key,
required String hashtag,
required Account account,
List<PageRouteInfo>? children,
}) : super(
HashtagRoute.name,
args: HashtagRouteArgs(
key: key,
hashtag: hashtag,
account: account,
),
initialChildren: children,
);
static const String name = 'HashtagRoute';
static const PageInfo<HashtagRouteArgs> page =
PageInfo<HashtagRouteArgs>(name);
}
class HashtagRouteArgs {
const HashtagRouteArgs({
this.key,
required this.hashtag,
required this.account,
});
final Key? key;
final String hashtag;
final Account account;
@override
String toString() {
return 'HashtagRouteArgs{key: $key, hashtag: $hashtag, account: $account}';
}
}
/// generated route for
/// [UserFolloweePage]
class UserFolloweeRoute extends PageRouteInfo<UserFolloweeRouteArgs> {
UserFolloweeRoute({
Key? key,
required String userId,
required Account account,
List<PageRouteInfo>? children,
}) : super(
UserFolloweeRoute.name,
args: UserFolloweeRouteArgs(
key: key,
userId: userId,
account: account,
),
initialChildren: children,
);
static const String name = 'UserFolloweeRoute';
static const PageInfo<UserFolloweeRouteArgs> page =
PageInfo<UserFolloweeRouteArgs>(name);
}
class UserFolloweeRouteArgs {
const UserFolloweeRouteArgs({
this.key,
required this.userId,
required this.account,
});
final Key? key;
final String userId;
final Account account;
@override
String toString() {
return 'UserFolloweeRouteArgs{key: $key, userId: $userId, account: $account}';
}
}
/// generated route for
/// [UserPage]
class UserRoute extends PageRouteInfo<UserRouteArgs> {
UserRoute({
Key? key,
required String userId,
required Account account,
List<PageRouteInfo>? children,
}) : super(
UserRoute.name,
args: UserRouteArgs(
key: key,
userId: userId,
account: account,
),
initialChildren: children,
);
static const String name = 'UserRoute';
static const PageInfo<UserRouteArgs> page = PageInfo<UserRouteArgs>(name);
}
class UserRouteArgs {
const UserRouteArgs({
this.key,
required this.userId,
required this.account,
});
final Key? key;
final String userId;
final Account account;
@override
String toString() {
return 'UserRouteArgs{key: $key, userId: $userId, account: $account}';
}
}
/// generated route for
/// [UserFollowerPage]
class UserFollowerRoute extends PageRouteInfo<UserFollowerRouteArgs> {
UserFollowerRoute({
Key? key,
required String userId,
required Account account,
List<PageRouteInfo>? children,
}) : super(
UserFollowerRoute.name,
args: UserFollowerRouteArgs(
key: key,
userId: userId,
account: account,
),
initialChildren: children,
);
static const String name = 'UserFollowerRoute';
static const PageInfo<UserFollowerRouteArgs> page =
PageInfo<UserFollowerRouteArgs>(name);
}
class UserFollowerRouteArgs {
const UserFollowerRouteArgs({
this.key,
required this.userId,
required this.account,
});
final Key? key;
final String userId;
final Account account;
@override
String toString() {
return 'UserFollowerRouteArgs{key: $key, userId: $userId, account: $account}';
}
}
/// generated route for
/// [PhotoEditPage]
class PhotoEditRoute extends PageRouteInfo<PhotoEditRouteArgs> {
PhotoEditRoute({
required Account account,
required MisskeyPostFile file,
required void Function(Uint8List) onSubmit,
Key? key,
List<PageRouteInfo>? children,
}) : super(
PhotoEditRoute.name,
args: PhotoEditRouteArgs(
account: account,
file: file,
onSubmit: onSubmit,
key: key,
),
initialChildren: children,
);
static const String name = 'PhotoEditRoute';
static const PageInfo<PhotoEditRouteArgs> page =
PageInfo<PhotoEditRouteArgs>(name);
}
class PhotoEditRouteArgs {
const PhotoEditRouteArgs({
required this.account,
required this.file,
required this.onSubmit,
this.key,
});
final Account account;
final MisskeyPostFile file;
final void Function(Uint8List) onSubmit;
final Key? key;
@override
String toString() {
return 'PhotoEditRouteArgs{account: $account, file: $file, onSubmit: $onSubmit, key: $key}';
}
}
/// generated route for
/// [AnnouncementPage]
class AnnouncementRoute extends PageRouteInfo<AnnouncementRouteArgs> {
AnnouncementRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
AnnouncementRoute.name,
args: AnnouncementRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'AnnouncementRoute';
static const PageInfo<AnnouncementRouteArgs> page =
PageInfo<AnnouncementRouteArgs>(name);
}
class AnnouncementRouteArgs {
const AnnouncementRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'AnnouncementRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [SplashPage]
class SplashRoute extends PageRouteInfo<void> {
const SplashRoute({List<PageRouteInfo>? children})
: super(
SplashRoute.name,
initialChildren: children,
);
static const String name = 'SplashRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [SeveralAccountGeneralSettingsPage]
class SeveralAccountGeneralSettingsRoute
extends PageRouteInfo<SeveralAccountGeneralSettingsRouteArgs> {
SeveralAccountGeneralSettingsRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
SeveralAccountGeneralSettingsRoute.name,
args: SeveralAccountGeneralSettingsRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'SeveralAccountGeneralSettingsRoute';
static const PageInfo<SeveralAccountGeneralSettingsRouteArgs> page =
PageInfo<SeveralAccountGeneralSettingsRouteArgs>(name);
}
class SeveralAccountGeneralSettingsRouteArgs {
const SeveralAccountGeneralSettingsRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'SeveralAccountGeneralSettingsRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [SeveralAccountSettingsPage]
class SeveralAccountSettingsRoute
extends PageRouteInfo<SeveralAccountSettingsRouteArgs> {
SeveralAccountSettingsRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
SeveralAccountSettingsRoute.name,
args: SeveralAccountSettingsRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'SeveralAccountSettingsRoute';
static const PageInfo<SeveralAccountSettingsRouteArgs> page =
PageInfo<SeveralAccountSettingsRouteArgs>(name);
}
class SeveralAccountSettingsRouteArgs {
const SeveralAccountSettingsRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'SeveralAccountSettingsRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [InstanceMutePage]
class InstanceMuteRoute extends PageRouteInfo<InstanceMuteRouteArgs> {
InstanceMuteRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
InstanceMuteRoute.name,
args: InstanceMuteRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'InstanceMuteRoute';
static const PageInfo<InstanceMuteRouteArgs> page =
PageInfo<InstanceMuteRouteArgs>(name);
}
class InstanceMuteRouteArgs {
const InstanceMuteRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'InstanceMuteRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [WordMutePage]
class WordMuteRoute extends PageRouteInfo<WordMuteRouteArgs> {
WordMuteRoute({
Key? key,
required Account account,
required MuteType muteType,
List<PageRouteInfo>? children,
}) : super(
WordMuteRoute.name,
args: WordMuteRouteArgs(
key: key,
account: account,
muteType: muteType,
),
initialChildren: children,
);
static const String name = 'WordMuteRoute';
static const PageInfo<WordMuteRouteArgs> page =
PageInfo<WordMuteRouteArgs>(name);
}
class WordMuteRouteArgs {
const WordMuteRouteArgs({
this.key,
required this.account,
required this.muteType,
});
final Key? key;
final Account account;
final MuteType muteType;
@override
String toString() {
return 'WordMuteRouteArgs{key: $key, account: $account, muteType: $muteType}';
}
}
/// generated route for
/// [CacheManagementPage]
class CacheManagementRoute extends PageRouteInfo<CacheManagementRouteArgs> {
CacheManagementRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
CacheManagementRoute.name,
args: CacheManagementRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'CacheManagementRoute';
static const PageInfo<CacheManagementRouteArgs> page =
PageInfo<CacheManagementRouteArgs>(name);
}
class CacheManagementRouteArgs {
const CacheManagementRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'CacheManagementRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [ReactionDeckPage]
class ReactionDeckRoute extends PageRouteInfo<ReactionDeckRouteArgs> {
ReactionDeckRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
ReactionDeckRoute.name,
args: ReactionDeckRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'ReactionDeckRoute';
static const PageInfo<ReactionDeckRouteArgs> page =
PageInfo<ReactionDeckRouteArgs>(name);
}
class ReactionDeckRouteArgs {
const ReactionDeckRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'ReactionDeckRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [UsersListTimelinePage]
class UsersListTimelineRoute extends PageRouteInfo<UsersListTimelineRouteArgs> {
UsersListTimelineRoute({
required Account account,
required UsersList list,
Key? key,
List<PageRouteInfo>? children,
}) : super(
UsersListTimelineRoute.name,
args: UsersListTimelineRouteArgs(
account: account,
list: list,
key: key,
),
initialChildren: children,
);
static const String name = 'UsersListTimelineRoute';
static const PageInfo<UsersListTimelineRouteArgs> page =
PageInfo<UsersListTimelineRouteArgs>(name);
}
class UsersListTimelineRouteArgs {
const UsersListTimelineRouteArgs({
required this.account,
required this.list,
this.key,
});
final Account account;
final UsersList list;
final Key? key;
@override
String toString() {
return 'UsersListTimelineRouteArgs{account: $account, list: $list, key: $key}';
}
}
/// generated route for
/// [UsersListPage]
class UsersListRoute extends PageRouteInfo<UsersListRouteArgs> {
UsersListRoute({
required Account account,
Key? key,
List<PageRouteInfo>? children,
}) : super(
UsersListRoute.name,
args: UsersListRouteArgs(
account: account,
key: key,
),
initialChildren: children,
);
static const String name = 'UsersListRoute';
static const PageInfo<UsersListRouteArgs> page =
PageInfo<UsersListRouteArgs>(name);
}
class UsersListRouteArgs {
const UsersListRouteArgs({
required this.account,
this.key,
});
final Account account;
final Key? key;
@override
String toString() {
return 'UsersListRouteArgs{account: $account, key: $key}';
}
}
/// generated route for
/// [UsersListDetailPage]
class UsersListDetailRoute extends PageRouteInfo<UsersListDetailRouteArgs> {
UsersListDetailRoute({
Key? key,
required Account account,
required String listId,
List<PageRouteInfo>? children,
}) : super(
UsersListDetailRoute.name,
args: UsersListDetailRouteArgs(
key: key,
account: account,
listId: listId,
),
initialChildren: children,
);
static const String name = 'UsersListDetailRoute';
static const PageInfo<UsersListDetailRouteArgs> page =
PageInfo<UsersListDetailRouteArgs>(name);
}
class UsersListDetailRouteArgs {
const UsersListDetailRouteArgs({
this.key,
required this.account,
required this.listId,
});
final Key? key;
final Account account;
final String listId;
@override
String toString() {
return 'UsersListDetailRouteArgs{key: $key, account: $account, listId: $listId}';
}
}
/// generated route for
/// [ChannelDetailPage]
class ChannelDetailRoute extends PageRouteInfo<ChannelDetailRouteArgs> {
ChannelDetailRoute({
Key? key,
required Account account,
required String channelId,
List<PageRouteInfo>? children,
}) : super(
ChannelDetailRoute.name,
args: ChannelDetailRouteArgs(
key: key,
account: account,
channelId: channelId,
),
initialChildren: children,
);
static const String name = 'ChannelDetailRoute';
static const PageInfo<ChannelDetailRouteArgs> page =
PageInfo<ChannelDetailRouteArgs>(name);
}
class ChannelDetailRouteArgs {
const ChannelDetailRouteArgs({
this.key,
required this.account,
required this.channelId,
});
final Key? key;
final Account account;
final String channelId;
@override
String toString() {
return 'ChannelDetailRouteArgs{key: $key, account: $account, channelId: $channelId}';
}
}
/// generated route for
/// [ChannelsPage]
class ChannelsRoute extends PageRouteInfo<ChannelsRouteArgs> {
ChannelsRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
ChannelsRoute.name,
args: ChannelsRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'ChannelsRoute';
static const PageInfo<ChannelsRouteArgs> page =
PageInfo<ChannelsRouteArgs>(name);
}
class ChannelsRouteArgs {
const ChannelsRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'ChannelsRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [FederationPage]
class FederationRoute extends PageRouteInfo<FederationRouteArgs> {
FederationRoute({
Key? key,
required Account account,
required String host,
List<PageRouteInfo>? children,
}) : super(
FederationRoute.name,
args: FederationRouteArgs(
key: key,
account: account,
host: host,
),
initialChildren: children,
);
static const String name = 'FederationRoute';
static const PageInfo<FederationRouteArgs> page =
PageInfo<FederationRouteArgs>(name);
}
class FederationRouteArgs {
const FederationRouteArgs({
this.key,
required this.account,
required this.host,
});
final Key? key;
final Account account;
final String host;
@override
String toString() {
return 'FederationRouteArgs{key: $key, account: $account, host: $host}';
}
}
/// generated route for
/// [NoteDetailPage]
class NoteDetailRoute extends PageRouteInfo<NoteDetailRouteArgs> {
NoteDetailRoute({
Key? key,
required Note note,
required Account account,
List<PageRouteInfo>? children,
}) : super(
NoteDetailRoute.name,
args: NoteDetailRouteArgs(
key: key,
note: note,
account: account,
),
initialChildren: children,
);
static const String name = 'NoteDetailRoute';
static const PageInfo<NoteDetailRouteArgs> page =
PageInfo<NoteDetailRouteArgs>(name);
}
class NoteDetailRouteArgs {
const NoteDetailRouteArgs({
this.key,
required this.note,
required this.account,
});
final Key? key;
final Note note;
final Account account;
@override
String toString() {
return 'NoteDetailRouteArgs{key: $key, note: $note, account: $account}';
}
}
/// generated route for
/// [SearchPage]
class SearchRoute extends PageRouteInfo<SearchRouteArgs> {
SearchRoute({
Key? key,
NoteSearchCondition? initialNoteSearchCondition,
required Account account,
List<PageRouteInfo>? children,
}) : super(
SearchRoute.name,
args: SearchRouteArgs(
key: key,
initialNoteSearchCondition: initialNoteSearchCondition,
account: account,
),
initialChildren: children,
);
static const String name = 'SearchRoute';
static const PageInfo<SearchRouteArgs> page = PageInfo<SearchRouteArgs>(name);
}
class SearchRouteArgs {
const SearchRouteArgs({
this.key,
this.initialNoteSearchCondition,
required this.account,
});
final Key? key;
final NoteSearchCondition? initialNoteSearchCondition;
final Account account;
@override
String toString() {
return 'SearchRouteArgs{key: $key, initialNoteSearchCondition: $initialNoteSearchCondition, account: $account}';
}
}
/// generated route for
/// [SharingAccountSelectPage]
class SharingAccountSelectRoute
extends PageRouteInfo<SharingAccountSelectRouteArgs> {
SharingAccountSelectRoute({
Key? key,
String? sharingText,
List<String>? filePath,
List<PageRouteInfo>? children,
}) : super(
SharingAccountSelectRoute.name,
args: SharingAccountSelectRouteArgs(
key: key,
sharingText: sharingText,
filePath: filePath,
),
initialChildren: children,
);
static const String name = 'SharingAccountSelectRoute';
static const PageInfo<SharingAccountSelectRouteArgs> page =
PageInfo<SharingAccountSelectRouteArgs>(name);
}
class SharingAccountSelectRouteArgs {
const SharingAccountSelectRouteArgs({
this.key,
this.sharingText,
this.filePath,
});
final Key? key;
final String? sharingText;
final List<String>? filePath;
@override
String toString() {
return 'SharingAccountSelectRouteArgs{key: $key, sharingText: $sharingText, filePath: $filePath}';
}
}
/// generated route for
/// [MisskeyPagePage]
class MisskeyRouteRoute extends PageRouteInfo<MisskeyRouteRouteArgs> {
MisskeyRouteRoute({
Key? key,
required Account account,
required Page page,
List<PageRouteInfo>? children,
}) : super(
MisskeyRouteRoute.name,
args: MisskeyRouteRouteArgs(
key: key,
account: account,
page: page,
),
initialChildren: children,
);
static const String name = 'MisskeyRouteRoute';
static const PageInfo<MisskeyRouteRouteArgs> page =
PageInfo<MisskeyRouteRouteArgs>(name);
}
class MisskeyRouteRouteArgs {
const MisskeyRouteRouteArgs({
this.key,
required this.account,
required this.page,
});
final Key? key;
final Account account;
final Page page;
@override
String toString() {
return 'MisskeyRouteRouteArgs{key: $key, account: $account, page: $page}';
}
}
/// generated route for
/// [MisskeyGamesPage]
class MisskeyGamesRoute extends PageRouteInfo<MisskeyGamesRouteArgs> {
MisskeyGamesRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
MisskeyGamesRoute.name,
args: MisskeyGamesRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'MisskeyGamesRoute';
static const PageInfo<MisskeyGamesRouteArgs> page =
PageInfo<MisskeyGamesRouteArgs>(name);
}
class MisskeyGamesRouteArgs {
const MisskeyGamesRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'MisskeyGamesRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [ImportExportPage]
class ImportExportRoute extends PageRouteInfo<void> {
const ImportExportRoute({List<PageRouteInfo>? children})
: super(
ImportExportRoute.name,
initialChildren: children,
);
static const String name = 'ImportExportRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [GeneralSettingsPage]
class GeneralSettingsRoute extends PageRouteInfo<void> {
const GeneralSettingsRoute({List<PageRouteInfo>? children})
: super(
GeneralSettingsRoute.name,
initialChildren: children,
);
static const String name = 'GeneralSettingsRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [TabSettingsPage]
class TabSettingsRoute extends PageRouteInfo<TabSettingsRouteArgs> {
TabSettingsRoute({
Key? key,
int? tabIndex,
List<PageRouteInfo>? children,
}) : super(
TabSettingsRoute.name,
args: TabSettingsRouteArgs(
key: key,
tabIndex: tabIndex,
),
initialChildren: children,
);
static const String name = 'TabSettingsRoute';
static const PageInfo<TabSettingsRouteArgs> page =
PageInfo<TabSettingsRouteArgs>(name);
}
class TabSettingsRouteArgs {
const TabSettingsRouteArgs({
this.key,
this.tabIndex,
});
final Key? key;
final int? tabIndex;
@override
String toString() {
return 'TabSettingsRouteArgs{key: $key, tabIndex: $tabIndex}';
}
}
/// generated route for
/// [TabSettingsListPage]
class TabSettingsListRoute extends PageRouteInfo<void> {
const TabSettingsListRoute({List<PageRouteInfo>? children})
: super(
TabSettingsListRoute.name,
initialChildren: children,
);
static const String name = 'TabSettingsListRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [AppInfoPage]
class AppInfoRoute extends PageRouteInfo<void> {
const AppInfoRoute({List<PageRouteInfo>? children})
: super(
AppInfoRoute.name,
initialChildren: children,
);
static const String name = 'AppInfoRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [SettingsPage]
class SettingsRoute extends PageRouteInfo<void> {
const SettingsRoute({List<PageRouteInfo>? children})
: super(
SettingsRoute.name,
initialChildren: children,
);
static const String name = 'SettingsRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [AccountListPage]
class AccountListRoute extends PageRouteInfo<void> {
const AccountListRoute({List<PageRouteInfo>? children})
: super(
AccountListRoute.name,
initialChildren: children,
);
static const String name = 'AccountListRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [ExploreRoleUsersPage]
class ExploreRoleUsersRoute extends PageRouteInfo<ExploreRoleUsersRouteArgs> {
ExploreRoleUsersRoute({
Key? key,
required RolesListResponse item,
required Account account,
List<PageRouteInfo>? children,
}) : super(
ExploreRoleUsersRoute.name,
args: ExploreRoleUsersRouteArgs(
key: key,
item: item,
account: account,
),
initialChildren: children,
);
static const String name = 'ExploreRoleUsersRoute';
static const PageInfo<ExploreRoleUsersRouteArgs> page =
PageInfo<ExploreRoleUsersRouteArgs>(name);
}
class ExploreRoleUsersRouteArgs {
const ExploreRoleUsersRouteArgs({
this.key,
required this.item,
required this.account,
});
final Key? key;
final RolesListResponse item;
final Account account;
@override
String toString() {
return 'ExploreRoleUsersRouteArgs{key: $key, item: $item, account: $account}';
}
}
/// generated route for
/// [ExplorePage]
class ExploreRoute extends PageRouteInfo<ExploreRouteArgs> {
ExploreRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
ExploreRoute.name,
args: ExploreRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'ExploreRoute';
static const PageInfo<ExploreRouteArgs> page =
PageInfo<ExploreRouteArgs>(name);
}
class ExploreRouteArgs {
const ExploreRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'ExploreRouteArgs{key: $key, account: $account}';
}
}
/// generated route for
/// [TimeLinePage]
class TimeLineRoute extends PageRouteInfo<TimeLineRouteArgs> {
TimeLineRoute({
Key? key,
required TabSetting initialTabSetting,
List<PageRouteInfo>? children,
}) : super(
TimeLineRoute.name,
args: TimeLineRouteArgs(
key: key,
initialTabSetting: initialTabSetting,
),
initialChildren: children,
);
static const String name = 'TimeLineRoute';
static const PageInfo<TimeLineRouteArgs> page =
PageInfo<TimeLineRouteArgs>(name);
}
class TimeLineRouteArgs {
const TimeLineRouteArgs({
this.key,
required this.initialTabSetting,
});
final Key? key;
final TabSetting initialTabSetting;
@override
String toString() {
return 'TimeLineRouteArgs{key: $key, initialTabSetting: $initialTabSetting}';
}
}
/// generated route for
/// [ShareExtensionPage]
class ShareExtensionRoute extends PageRouteInfo<void> {
const ShareExtensionRoute({List<PageRouteInfo>? children})
: super(
ShareExtensionRoute.name,
initialChildren: children,
);
static const String name = 'ShareExtensionRoute';
static const PageInfo<void> page = PageInfo<void>(name);
}
/// generated route for
/// [FavoritedNotePage]
class FavoritedNoteRoute extends PageRouteInfo<FavoritedNoteRouteArgs> {
FavoritedNoteRoute({
Key? key,
required Account account,
List<PageRouteInfo>? children,
}) : super(
FavoritedNoteRoute.name,
args: FavoritedNoteRouteArgs(
key: key,
account: account,
),
initialChildren: children,
);
static const String name = 'FavoritedNoteRoute';
static const PageInfo<FavoritedNoteRouteArgs> page =
PageInfo<FavoritedNoteRouteArgs>(name);
}
class FavoritedNoteRouteArgs {
const FavoritedNoteRouteArgs({
this.key,
required this.account,
});
final Key? key;
final Account account;
@override
String toString() {
return 'FavoritedNoteRouteArgs{key: $key, account: $account}';
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/router/app_router.dart | import 'dart:typed_data';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart' hide Page;
import 'package:miria/model/account.dart';
import 'package:miria/model/image_file.dart';
import 'package:miria/model/note_search_condition.dart';
import 'package:miria/model/tab_setting.dart';
import 'package:miria/view/announcements_page/announcements_page.dart';
import 'package:miria/view/antenna_page/antenna_page.dart';
import 'package:miria/view/channels_page/channels_page.dart';
import 'package:miria/view/clip_list_page/clip_detail_page.dart';
import 'package:miria/view/clip_list_page/clip_list_page.dart';
import 'package:miria/view/explore_page/explore_page.dart';
import 'package:miria/view/explore_page/explore_role_users_page.dart';
import 'package:miria/view/favorited_note_page/favorited_note_page.dart';
import 'package:miria/view/federation_page/federation_page.dart';
import 'package:miria/view/games_page/misskey_games_page.dart';
import 'package:miria/view/hashtag_page/hashtag_page.dart';
import 'package:miria/view/misskey_page_page/misskey_page_page.dart';
import 'package:miria/view/note_create_page/note_create_page.dart';
import 'package:miria/view/note_detail_page/note_detail_page.dart';
import 'package:miria/view/notes_after_renote_page/notes_after_renote_page.dart';
import 'package:miria/view/notification_page/notification_page.dart';
import 'package:miria/view/search_page/search_page.dart';
import 'package:miria/view/photo_edit_page/photo_edit_page.dart';
import 'package:miria/view/settings_page/account_settings_page/account_list.dart';
import 'package:miria/view/settings_page/app_info_page/app_info_page.dart';
import 'package:miria/view/settings_page/general_settings_page/general_settings_page.dart';
import 'package:miria/view/settings_page/import_export_page/import_export_page.dart';
import 'package:miria/view/settings_page/tab_settings_page/tab_settings_list_page.dart';
import 'package:miria/view/several_account_settings_page/cache_management_page/cache_management_page.dart';
import 'package:miria/view/several_account_settings_page/word_mute_page/word_mute_page.dart';
import 'package:miria/view/several_account_settings_page/instance_mute_page/instance_mute_page.dart';
import 'package:miria/view/several_account_settings_page/reaction_deck_page/reaction_deck_page.dart';
import 'package:miria/view/several_account_settings_page/several_account_general_settings_page/several_account_general_settings_page.dart';
import 'package:miria/view/several_account_settings_page/several_account_settings_page.dart';
import 'package:miria/view/share_extension_page/share_extension_page.dart';
import 'package:miria/view/sharing_account_select_page/account_select_page.dart';
import 'package:miria/view/time_line_page/time_line_page.dart';
import 'package:miria/view/user_page/user_followee.dart';
import 'package:miria/view/user_page/user_follower.dart';
import 'package:miria/view/user_page/user_page.dart';
import 'package:miria/view/users_list_page/users_list_detail_page.dart';
import 'package:miria/view/users_list_page/users_list_page.dart';
import 'package:miria/view/users_list_page/users_list_timeline_page.dart';
import 'package:miria/view/splash_page/splash_page.dart';
import 'package:misskey_dart/misskey_dart.dart';
import '../view/antenna_page/antenna_notes_page.dart';
import '../view/channels_page/channel_detail_page.dart';
import '../view/login_page/login_page.dart';
import '../view/settings_page/settings_page.dart';
import '../view/settings_page/tab_settings_page/tab_settings_page.dart';
part 'app_router.gr.dart';
@AutoRouterConfig()
class AppRouter extends _$AppRouter {
@override
final List<AutoRoute> routes = [
AutoRoute(page: SplashRoute.page, initial: true),
AutoRoute(page: TimeLineRoute.page),
AutoRoute(page: NoteDetailRoute.page),
AutoRoute(page: UserRoute.page),
AutoRoute(page: UserFollowerRoute.page),
AutoRoute(page: UserFolloweeRoute.page),
AutoRoute(page: NoteCreateRoute.page),
AutoRoute(page: PhotoEditRoute.page),
AutoRoute(page: NotesAfterRenoteRoute.page),
AutoRoute(page: AntennaRoute.page),
AutoRoute(page: AntennaNotesRoute.page),
AutoRoute(page: UsersListRoute.page),
AutoRoute(page: UsersListTimelineRoute.page),
AutoRoute(page: UsersListDetailRoute.page),
AutoRoute(page: NotificationRoute.page),
AutoRoute(page: FavoritedNoteRoute.page),
AutoRoute(page: ClipListRoute.page),
AutoRoute(page: ClipDetailRoute.page),
AutoRoute(page: ChannelsRoute.page),
AutoRoute(page: ChannelDetailRoute.page),
AutoRoute(page: HashtagRoute.page),
AutoRoute(page: ExploreRoute.page),
AutoRoute(page: ExploreRoleUsersRoute.page),
AutoRoute(page: SearchRoute.page),
AutoRoute(page: FederationRoute.page),
AutoRoute(page: AnnouncementRoute.page),
AutoRoute(page: LoginRoute.page),
AutoRoute(page: SettingsRoute.page),
AutoRoute(page: GeneralSettingsRoute.page),
AutoRoute(page: TabSettingsListRoute.page),
AutoRoute(page: TabSettingsRoute.page),
AutoRoute(page: ImportExportRoute.page),
AutoRoute(page: AccountListRoute.page),
AutoRoute(page: AppInfoRoute.page),
AutoRoute(page: SeveralAccountSettingsRoute.page),
AutoRoute(page: ReactionDeckRoute.page),
AutoRoute(page: WordMuteRoute.page),
AutoRoute(page: InstanceMuteRoute.page),
AutoRoute(page: CacheManagementRoute.page),
AutoRoute(page: SeveralAccountGeneralSettingsRoute.page),
AutoRoute(page: SharingAccountSelectRoute.page),
AutoRoute(page: MisskeyGamesRoute.page),
// きしょ……
AutoRoute(page: MisskeyRouteRoute.page),
AutoRoute(path: "/share-extension", page: ShareExtensionRoute.page)
];
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/general_settings.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'general_settings.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$GeneralSettingsImpl _$$GeneralSettingsImplFromJson(
Map<String, dynamic> json) =>
_$GeneralSettingsImpl(
lightColorThemeId: json['lightColorThemeId'] as String? ?? "",
darkColorThemeId: json['darkColorThemeId'] as String? ?? "",
themeColorSystem: $enumDecodeNullable(
_$ThemeColorSystemEnumMap, json['themeColorSystem']) ??
ThemeColorSystem.system,
nsfwInherit:
$enumDecodeNullable(_$NSFWInheritEnumMap, json['nsfwInherit']) ??
NSFWInherit.inherit,
enableDirectReaction: json['enableDirectReaction'] as bool? ?? false,
automaticPush:
$enumDecodeNullable(_$AutomaticPushEnumMap, json['automaticPush']) ??
AutomaticPush.none,
enableAnimatedMFM: json['enableAnimatedMFM'] as bool? ?? true,
enableLongTextElipsed: json['enableLongTextElipsed'] as bool? ?? false,
enableFavoritedRenoteElipsed:
json['enableFavoritedRenoteElipsed'] as bool? ?? true,
tabPosition:
$enumDecodeNullable(_$TabPositionEnumMap, json['tabPosition']) ??
TabPosition.top,
textScaleFactor: (json['textScaleFactor'] as num?)?.toDouble() ?? 1.0,
emojiType: $enumDecodeNullable(_$EmojiTypeEnumMap, json['emojiType']) ??
EmojiType.twemoji,
defaultFontName: json['defaultFontName'] as String? ?? "",
serifFontName: json['serifFontName'] as String? ?? "",
monospaceFontName: json['monospaceFontName'] as String? ?? "",
cursiveFontName: json['cursiveFontName'] as String? ?? "",
fantasyFontName: json['fantasyFontName'] as String? ?? "",
languages: $enumDecodeNullable(_$LanguagesEnumMap, json['languages']) ??
Languages.jaJP,
);
Map<String, dynamic> _$$GeneralSettingsImplToJson(
_$GeneralSettingsImpl instance) =>
<String, dynamic>{
'lightColorThemeId': instance.lightColorThemeId,
'darkColorThemeId': instance.darkColorThemeId,
'themeColorSystem': _$ThemeColorSystemEnumMap[instance.themeColorSystem]!,
'nsfwInherit': _$NSFWInheritEnumMap[instance.nsfwInherit]!,
'enableDirectReaction': instance.enableDirectReaction,
'automaticPush': _$AutomaticPushEnumMap[instance.automaticPush]!,
'enableAnimatedMFM': instance.enableAnimatedMFM,
'enableLongTextElipsed': instance.enableLongTextElipsed,
'enableFavoritedRenoteElipsed': instance.enableFavoritedRenoteElipsed,
'tabPosition': _$TabPositionEnumMap[instance.tabPosition]!,
'textScaleFactor': instance.textScaleFactor,
'emojiType': _$EmojiTypeEnumMap[instance.emojiType]!,
'defaultFontName': instance.defaultFontName,
'serifFontName': instance.serifFontName,
'monospaceFontName': instance.monospaceFontName,
'cursiveFontName': instance.cursiveFontName,
'fantasyFontName': instance.fantasyFontName,
'languages': _$LanguagesEnumMap[instance.languages]!,
};
const _$ThemeColorSystemEnumMap = {
ThemeColorSystem.forceLight: 'forceLight',
ThemeColorSystem.forceDark: 'forceDark',
ThemeColorSystem.system: 'system',
};
const _$NSFWInheritEnumMap = {
NSFWInherit.inherit: 'inherit',
NSFWInherit.ignore: 'ignore',
NSFWInherit.allHidden: 'allHidden',
NSFWInherit.removeNsfw: 'removeNsfw',
};
const _$AutomaticPushEnumMap = {
AutomaticPush.automatic: 'automatic',
AutomaticPush.none: 'none',
};
const _$TabPositionEnumMap = {
TabPosition.top: 'top',
TabPosition.bottom: 'bottom',
};
const _$EmojiTypeEnumMap = {
EmojiType.twemoji: 'twemoji',
EmojiType.system: 'system',
};
const _$LanguagesEnumMap = {
Languages.jaJP: 'jaJP',
Languages.jaOJ: 'jaOJ',
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/antenna_settings.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:misskey_dart/misskey_dart.dart';
part 'antenna_settings.freezed.dart';
@freezed
class AntennaSettings with _$AntennaSettings {
const factory AntennaSettings({
@Default("") String name,
@Default(AntennaSource.all) AntennaSource src,
String? userListId,
@Default([]) List<List<String>> keywords,
@Default([]) List<List<String>> excludeKeywords,
@Default([]) List<String> users,
@Default(false) bool caseSensitive,
@Default(false) bool withReplies,
@Default(false) bool withFile,
@Default(false) bool notify,
@Default(false) bool localOnly,
}) = _AntennaSettings;
const AntennaSettings._();
factory AntennaSettings.fromAntenna(Antenna antenna) {
return AntennaSettings(
name: antenna.name,
src: antenna.src,
userListId: antenna.userListId,
keywords: antenna.keywords,
excludeKeywords: antenna.excludeKeywords,
users: antenna.users,
caseSensitive: antenna.caseSensitive,
withReplies: antenna.withReplies,
withFile: antenna.withFile,
notify: antenna.notify,
localOnly: antenna.localOnly ?? false,
);
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/account.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:miria/model/acct.dart';
import 'package:misskey_dart/misskey_dart.dart';
part 'account.freezed.dart';
part 'account.g.dart';
@Freezed(equal: false)
class Account with _$Account {
const Account._();
const factory Account({
required String host,
required String userId,
String? token,
required MeDetailed i,
MetaResponse? meta,
}) = _Account;
factory Account.fromJson(Map<String, Object?> json) =>
_$AccountFromJson(json);
@override
bool operator ==(Object other) {
return other is Account &&
other.runtimeType == runtimeType &&
other.host == host &&
other.userId == userId;
}
@override
int get hashCode => Object.hash(runtimeType, host, userId);
Acct get acct {
return Acct(
host: host,
username: userId,
);
}
factory Account.demoAccount(String host, MetaResponse? meta) => Account(
host: host,
userId: "",
token: null,
meta: meta,
i: MeDetailed(
id: "",
username: "",
createdAt: DateTime.now(),
avatarUrl: Uri.parse("https://example.com/"),
isBot: false,
isCat: false,
badgeRoles: [],
isLocked: false,
isSuspended: false,
isSilenced: false,
followingCount: 0,
followersCount: 0,
notesCount: 0,
publicReactions: false,
twoFactorEnabled: false,
usePasswordLessLogin: false,
securityKeys: false,
isModerator: false,
isAdmin: false,
injectFeaturedNote: false,
receiveAnnouncementEmail: false,
alwaysMarkNsfw: false,
autoSensitive: false,
carefulBot: false,
autoAcceptFollowed: false,
noCrawle: false,
isExplorable: false,
isDeleted: false,
hideOnlineStatus: false,
hasUnreadAnnouncement: false,
hasPendingReceivedFollowRequest: false,
hasUnreadAntenna: false,
hasUnreadChannel: false,
hasUnreadMentions: false,
hasUnreadNotification: false,
hasUnreadSpecifiedNotes: false,
mutedWords: [],
mutedInstances: [],
mutingNotificationTypes: [],
emailNotificationTypes: [],
achievements: [],
loggedInDays: 0,
policies: const UserPolicies(
gtlAvailable: false,
ltlAvailable: false,
canPublicNote: false,
canInvite: false,
canManageCustomEmojis: false,
canHideAds: false,
driveCapacityMb: 0,
pinLimit: 0,
antennaLimit: 0,
wordMuteLimit: 0,
webhookLimit: 0,
clipLimit: 0,
noteEachClipsLimit: 0,
userListLimit: 0,
userEachUserListsLimit: 0,
rateLimitFactor: 0)));
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/exported_setting.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'exported_setting.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ExportedSettingImpl _$$ExportedSettingImplFromJson(
Map<String, dynamic> json) =>
_$ExportedSettingImpl(
accountSettings: (json['accountSettings'] as List<dynamic>?)
?.map((e) => AccountSettings.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
generalSettings: GeneralSettings.fromJson(
json['generalSettings'] as Map<String, dynamic>),
tabSettings: (json['tabSettings'] as List<dynamic>?)
?.map((e) => TabSetting.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
);
Map<String, dynamic> _$$ExportedSettingImplToJson(
_$ExportedSettingImpl instance) =>
<String, dynamic>{
'accountSettings':
instance.accountSettings.map((e) => e.toJson()).toList(),
'generalSettings': instance.generalSettings.toJson(),
'tabSettings': instance.tabSettings.map((e) => e.toJson()).toList(),
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/color_theme.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'color_theme.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$ColorTheme {
String get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
bool get isDarkTheme => throw _privateConstructorUsedError;
Color get primary => throw _privateConstructorUsedError;
Color get primaryDarken => throw _privateConstructorUsedError;
Color get primaryLighten => throw _privateConstructorUsedError;
Color get accentedBackground => throw _privateConstructorUsedError;
Color get background => throw _privateConstructorUsedError;
Color get foreground => throw _privateConstructorUsedError;
Color get renote => throw _privateConstructorUsedError;
Color get mention => throw _privateConstructorUsedError;
Color get hashtag => throw _privateConstructorUsedError;
Color get link => throw _privateConstructorUsedError;
Color get divider => throw _privateConstructorUsedError;
Color get buttonBackground => throw _privateConstructorUsedError;
Color get buttonGradateA => throw _privateConstructorUsedError;
Color get buttonGradateB => throw _privateConstructorUsedError;
Color get panel => throw _privateConstructorUsedError;
Color get panelBackground => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ColorThemeCopyWith<ColorTheme> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ColorThemeCopyWith<$Res> {
factory $ColorThemeCopyWith(
ColorTheme value, $Res Function(ColorTheme) then) =
_$ColorThemeCopyWithImpl<$Res, ColorTheme>;
@useResult
$Res call(
{String id,
String name,
bool isDarkTheme,
Color primary,
Color primaryDarken,
Color primaryLighten,
Color accentedBackground,
Color background,
Color foreground,
Color renote,
Color mention,
Color hashtag,
Color link,
Color divider,
Color buttonBackground,
Color buttonGradateA,
Color buttonGradateB,
Color panel,
Color panelBackground});
}
/// @nodoc
class _$ColorThemeCopyWithImpl<$Res, $Val extends ColorTheme>
implements $ColorThemeCopyWith<$Res> {
_$ColorThemeCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? isDarkTheme = null,
Object? primary = null,
Object? primaryDarken = null,
Object? primaryLighten = null,
Object? accentedBackground = null,
Object? background = null,
Object? foreground = null,
Object? renote = null,
Object? mention = null,
Object? hashtag = null,
Object? link = null,
Object? divider = null,
Object? buttonBackground = null,
Object? buttonGradateA = null,
Object? buttonGradateB = null,
Object? panel = null,
Object? panelBackground = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
isDarkTheme: null == isDarkTheme
? _value.isDarkTheme
: isDarkTheme // ignore: cast_nullable_to_non_nullable
as bool,
primary: null == primary
? _value.primary
: primary // ignore: cast_nullable_to_non_nullable
as Color,
primaryDarken: null == primaryDarken
? _value.primaryDarken
: primaryDarken // ignore: cast_nullable_to_non_nullable
as Color,
primaryLighten: null == primaryLighten
? _value.primaryLighten
: primaryLighten // ignore: cast_nullable_to_non_nullable
as Color,
accentedBackground: null == accentedBackground
? _value.accentedBackground
: accentedBackground // ignore: cast_nullable_to_non_nullable
as Color,
background: null == background
? _value.background
: background // ignore: cast_nullable_to_non_nullable
as Color,
foreground: null == foreground
? _value.foreground
: foreground // ignore: cast_nullable_to_non_nullable
as Color,
renote: null == renote
? _value.renote
: renote // ignore: cast_nullable_to_non_nullable
as Color,
mention: null == mention
? _value.mention
: mention // ignore: cast_nullable_to_non_nullable
as Color,
hashtag: null == hashtag
? _value.hashtag
: hashtag // ignore: cast_nullable_to_non_nullable
as Color,
link: null == link
? _value.link
: link // ignore: cast_nullable_to_non_nullable
as Color,
divider: null == divider
? _value.divider
: divider // ignore: cast_nullable_to_non_nullable
as Color,
buttonBackground: null == buttonBackground
? _value.buttonBackground
: buttonBackground // ignore: cast_nullable_to_non_nullable
as Color,
buttonGradateA: null == buttonGradateA
? _value.buttonGradateA
: buttonGradateA // ignore: cast_nullable_to_non_nullable
as Color,
buttonGradateB: null == buttonGradateB
? _value.buttonGradateB
: buttonGradateB // ignore: cast_nullable_to_non_nullable
as Color,
panel: null == panel
? _value.panel
: panel // ignore: cast_nullable_to_non_nullable
as Color,
panelBackground: null == panelBackground
? _value.panelBackground
: panelBackground // ignore: cast_nullable_to_non_nullable
as Color,
) as $Val);
}
}
/// @nodoc
abstract class _$$ColorThemeImplCopyWith<$Res>
implements $ColorThemeCopyWith<$Res> {
factory _$$ColorThemeImplCopyWith(
_$ColorThemeImpl value, $Res Function(_$ColorThemeImpl) then) =
__$$ColorThemeImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
String name,
bool isDarkTheme,
Color primary,
Color primaryDarken,
Color primaryLighten,
Color accentedBackground,
Color background,
Color foreground,
Color renote,
Color mention,
Color hashtag,
Color link,
Color divider,
Color buttonBackground,
Color buttonGradateA,
Color buttonGradateB,
Color panel,
Color panelBackground});
}
/// @nodoc
class __$$ColorThemeImplCopyWithImpl<$Res>
extends _$ColorThemeCopyWithImpl<$Res, _$ColorThemeImpl>
implements _$$ColorThemeImplCopyWith<$Res> {
__$$ColorThemeImplCopyWithImpl(
_$ColorThemeImpl _value, $Res Function(_$ColorThemeImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? isDarkTheme = null,
Object? primary = null,
Object? primaryDarken = null,
Object? primaryLighten = null,
Object? accentedBackground = null,
Object? background = null,
Object? foreground = null,
Object? renote = null,
Object? mention = null,
Object? hashtag = null,
Object? link = null,
Object? divider = null,
Object? buttonBackground = null,
Object? buttonGradateA = null,
Object? buttonGradateB = null,
Object? panel = null,
Object? panelBackground = null,
}) {
return _then(_$ColorThemeImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
isDarkTheme: null == isDarkTheme
? _value.isDarkTheme
: isDarkTheme // ignore: cast_nullable_to_non_nullable
as bool,
primary: null == primary
? _value.primary
: primary // ignore: cast_nullable_to_non_nullable
as Color,
primaryDarken: null == primaryDarken
? _value.primaryDarken
: primaryDarken // ignore: cast_nullable_to_non_nullable
as Color,
primaryLighten: null == primaryLighten
? _value.primaryLighten
: primaryLighten // ignore: cast_nullable_to_non_nullable
as Color,
accentedBackground: null == accentedBackground
? _value.accentedBackground
: accentedBackground // ignore: cast_nullable_to_non_nullable
as Color,
background: null == background
? _value.background
: background // ignore: cast_nullable_to_non_nullable
as Color,
foreground: null == foreground
? _value.foreground
: foreground // ignore: cast_nullable_to_non_nullable
as Color,
renote: null == renote
? _value.renote
: renote // ignore: cast_nullable_to_non_nullable
as Color,
mention: null == mention
? _value.mention
: mention // ignore: cast_nullable_to_non_nullable
as Color,
hashtag: null == hashtag
? _value.hashtag
: hashtag // ignore: cast_nullable_to_non_nullable
as Color,
link: null == link
? _value.link
: link // ignore: cast_nullable_to_non_nullable
as Color,
divider: null == divider
? _value.divider
: divider // ignore: cast_nullable_to_non_nullable
as Color,
buttonBackground: null == buttonBackground
? _value.buttonBackground
: buttonBackground // ignore: cast_nullable_to_non_nullable
as Color,
buttonGradateA: null == buttonGradateA
? _value.buttonGradateA
: buttonGradateA // ignore: cast_nullable_to_non_nullable
as Color,
buttonGradateB: null == buttonGradateB
? _value.buttonGradateB
: buttonGradateB // ignore: cast_nullable_to_non_nullable
as Color,
panel: null == panel
? _value.panel
: panel // ignore: cast_nullable_to_non_nullable
as Color,
panelBackground: null == panelBackground
? _value.panelBackground
: panelBackground // ignore: cast_nullable_to_non_nullable
as Color,
));
}
}
/// @nodoc
class _$ColorThemeImpl implements _ColorTheme {
const _$ColorThemeImpl(
{required this.id,
required this.name,
required this.isDarkTheme,
required this.primary,
required this.primaryDarken,
required this.primaryLighten,
required this.accentedBackground,
required this.background,
required this.foreground,
required this.renote,
required this.mention,
required this.hashtag,
required this.link,
required this.divider,
required this.buttonBackground,
required this.buttonGradateA,
required this.buttonGradateB,
required this.panel,
required this.panelBackground});
@override
final String id;
@override
final String name;
@override
final bool isDarkTheme;
@override
final Color primary;
@override
final Color primaryDarken;
@override
final Color primaryLighten;
@override
final Color accentedBackground;
@override
final Color background;
@override
final Color foreground;
@override
final Color renote;
@override
final Color mention;
@override
final Color hashtag;
@override
final Color link;
@override
final Color divider;
@override
final Color buttonBackground;
@override
final Color buttonGradateA;
@override
final Color buttonGradateB;
@override
final Color panel;
@override
final Color panelBackground;
@override
String toString() {
return 'ColorTheme(id: $id, name: $name, isDarkTheme: $isDarkTheme, primary: $primary, primaryDarken: $primaryDarken, primaryLighten: $primaryLighten, accentedBackground: $accentedBackground, background: $background, foreground: $foreground, renote: $renote, mention: $mention, hashtag: $hashtag, link: $link, divider: $divider, buttonBackground: $buttonBackground, buttonGradateA: $buttonGradateA, buttonGradateB: $buttonGradateB, panel: $panel, panelBackground: $panelBackground)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ColorThemeImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.isDarkTheme, isDarkTheme) ||
other.isDarkTheme == isDarkTheme) &&
(identical(other.primary, primary) || other.primary == primary) &&
(identical(other.primaryDarken, primaryDarken) ||
other.primaryDarken == primaryDarken) &&
(identical(other.primaryLighten, primaryLighten) ||
other.primaryLighten == primaryLighten) &&
(identical(other.accentedBackground, accentedBackground) ||
other.accentedBackground == accentedBackground) &&
(identical(other.background, background) ||
other.background == background) &&
(identical(other.foreground, foreground) ||
other.foreground == foreground) &&
(identical(other.renote, renote) || other.renote == renote) &&
(identical(other.mention, mention) || other.mention == mention) &&
(identical(other.hashtag, hashtag) || other.hashtag == hashtag) &&
(identical(other.link, link) || other.link == link) &&
(identical(other.divider, divider) || other.divider == divider) &&
(identical(other.buttonBackground, buttonBackground) ||
other.buttonBackground == buttonBackground) &&
(identical(other.buttonGradateA, buttonGradateA) ||
other.buttonGradateA == buttonGradateA) &&
(identical(other.buttonGradateB, buttonGradateB) ||
other.buttonGradateB == buttonGradateB) &&
(identical(other.panel, panel) || other.panel == panel) &&
(identical(other.panelBackground, panelBackground) ||
other.panelBackground == panelBackground));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
id,
name,
isDarkTheme,
primary,
primaryDarken,
primaryLighten,
accentedBackground,
background,
foreground,
renote,
mention,
hashtag,
link,
divider,
buttonBackground,
buttonGradateA,
buttonGradateB,
panel,
panelBackground
]);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ColorThemeImplCopyWith<_$ColorThemeImpl> get copyWith =>
__$$ColorThemeImplCopyWithImpl<_$ColorThemeImpl>(this, _$identity);
}
abstract class _ColorTheme implements ColorTheme {
const factory _ColorTheme(
{required final String id,
required final String name,
required final bool isDarkTheme,
required final Color primary,
required final Color primaryDarken,
required final Color primaryLighten,
required final Color accentedBackground,
required final Color background,
required final Color foreground,
required final Color renote,
required final Color mention,
required final Color hashtag,
required final Color link,
required final Color divider,
required final Color buttonBackground,
required final Color buttonGradateA,
required final Color buttonGradateB,
required final Color panel,
required final Color panelBackground}) = _$ColorThemeImpl;
@override
String get id;
@override
String get name;
@override
bool get isDarkTheme;
@override
Color get primary;
@override
Color get primaryDarken;
@override
Color get primaryLighten;
@override
Color get accentedBackground;
@override
Color get background;
@override
Color get foreground;
@override
Color get renote;
@override
Color get mention;
@override
Color get hashtag;
@override
Color get link;
@override
Color get divider;
@override
Color get buttonBackground;
@override
Color get buttonGradateA;
@override
Color get buttonGradateB;
@override
Color get panel;
@override
Color get panelBackground;
@override
@JsonKey(ignore: true)
_$$ColorThemeImplCopyWith<_$ColorThemeImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/general_settings.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'general_settings.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
GeneralSettings _$GeneralSettingsFromJson(Map<String, dynamic> json) {
return _GeneralSettings.fromJson(json);
}
/// @nodoc
mixin _$GeneralSettings {
String get lightColorThemeId => throw _privateConstructorUsedError;
String get darkColorThemeId => throw _privateConstructorUsedError;
ThemeColorSystem get themeColorSystem => throw _privateConstructorUsedError;
/// NSFW設定を継承する
NSFWInherit get nsfwInherit => throw _privateConstructorUsedError;
/// ノートのカスタム絵文字直接タップでのリアクションを有効にする
bool get enableDirectReaction => throw _privateConstructorUsedError;
/// TLの自動更新を有効にする
AutomaticPush get automaticPush => throw _privateConstructorUsedError;
/// 動きのあるMFMを有効にする
bool get enableAnimatedMFM => throw _privateConstructorUsedError;
/// 長いノートを省略する
bool get enableLongTextElipsed => throw _privateConstructorUsedError;
/// リアクション済みノートを短くする
bool get enableFavoritedRenoteElipsed => throw _privateConstructorUsedError;
/// タブの位置
TabPosition get tabPosition => throw _privateConstructorUsedError;
/// 文字の大きさの倍率
double get textScaleFactor => throw _privateConstructorUsedError;
/// 使用するUnicodeの絵文字種別
EmojiType get emojiType => throw _privateConstructorUsedError;
/// デフォルトのフォント名
String get defaultFontName => throw _privateConstructorUsedError;
/// `$[font.serif のフォント名
String get serifFontName => throw _privateConstructorUsedError;
/// `$[font.monospace およびコードブロックのフォント名
String get monospaceFontName => throw _privateConstructorUsedError;
/// `$[font.cursive のフォント名
String get cursiveFontName => throw _privateConstructorUsedError;
/// `$[font.fantasy のフォント名
String get fantasyFontName => throw _privateConstructorUsedError;
/// 言語設定
Languages get languages => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$GeneralSettingsCopyWith<GeneralSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $GeneralSettingsCopyWith<$Res> {
factory $GeneralSettingsCopyWith(
GeneralSettings value, $Res Function(GeneralSettings) then) =
_$GeneralSettingsCopyWithImpl<$Res, GeneralSettings>;
@useResult
$Res call(
{String lightColorThemeId,
String darkColorThemeId,
ThemeColorSystem themeColorSystem,
NSFWInherit nsfwInherit,
bool enableDirectReaction,
AutomaticPush automaticPush,
bool enableAnimatedMFM,
bool enableLongTextElipsed,
bool enableFavoritedRenoteElipsed,
TabPosition tabPosition,
double textScaleFactor,
EmojiType emojiType,
String defaultFontName,
String serifFontName,
String monospaceFontName,
String cursiveFontName,
String fantasyFontName,
Languages languages});
}
/// @nodoc
class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
implements $GeneralSettingsCopyWith<$Res> {
_$GeneralSettingsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? lightColorThemeId = null,
Object? darkColorThemeId = null,
Object? themeColorSystem = null,
Object? nsfwInherit = null,
Object? enableDirectReaction = null,
Object? automaticPush = null,
Object? enableAnimatedMFM = null,
Object? enableLongTextElipsed = null,
Object? enableFavoritedRenoteElipsed = null,
Object? tabPosition = null,
Object? textScaleFactor = null,
Object? emojiType = null,
Object? defaultFontName = null,
Object? serifFontName = null,
Object? monospaceFontName = null,
Object? cursiveFontName = null,
Object? fantasyFontName = null,
Object? languages = null,
}) {
return _then(_value.copyWith(
lightColorThemeId: null == lightColorThemeId
? _value.lightColorThemeId
: lightColorThemeId // ignore: cast_nullable_to_non_nullable
as String,
darkColorThemeId: null == darkColorThemeId
? _value.darkColorThemeId
: darkColorThemeId // ignore: cast_nullable_to_non_nullable
as String,
themeColorSystem: null == themeColorSystem
? _value.themeColorSystem
: themeColorSystem // ignore: cast_nullable_to_non_nullable
as ThemeColorSystem,
nsfwInherit: null == nsfwInherit
? _value.nsfwInherit
: nsfwInherit // ignore: cast_nullable_to_non_nullable
as NSFWInherit,
enableDirectReaction: null == enableDirectReaction
? _value.enableDirectReaction
: enableDirectReaction // ignore: cast_nullable_to_non_nullable
as bool,
automaticPush: null == automaticPush
? _value.automaticPush
: automaticPush // ignore: cast_nullable_to_non_nullable
as AutomaticPush,
enableAnimatedMFM: null == enableAnimatedMFM
? _value.enableAnimatedMFM
: enableAnimatedMFM // ignore: cast_nullable_to_non_nullable
as bool,
enableLongTextElipsed: null == enableLongTextElipsed
? _value.enableLongTextElipsed
: enableLongTextElipsed // ignore: cast_nullable_to_non_nullable
as bool,
enableFavoritedRenoteElipsed: null == enableFavoritedRenoteElipsed
? _value.enableFavoritedRenoteElipsed
: enableFavoritedRenoteElipsed // ignore: cast_nullable_to_non_nullable
as bool,
tabPosition: null == tabPosition
? _value.tabPosition
: tabPosition // ignore: cast_nullable_to_non_nullable
as TabPosition,
textScaleFactor: null == textScaleFactor
? _value.textScaleFactor
: textScaleFactor // ignore: cast_nullable_to_non_nullable
as double,
emojiType: null == emojiType
? _value.emojiType
: emojiType // ignore: cast_nullable_to_non_nullable
as EmojiType,
defaultFontName: null == defaultFontName
? _value.defaultFontName
: defaultFontName // ignore: cast_nullable_to_non_nullable
as String,
serifFontName: null == serifFontName
? _value.serifFontName
: serifFontName // ignore: cast_nullable_to_non_nullable
as String,
monospaceFontName: null == monospaceFontName
? _value.monospaceFontName
: monospaceFontName // ignore: cast_nullable_to_non_nullable
as String,
cursiveFontName: null == cursiveFontName
? _value.cursiveFontName
: cursiveFontName // ignore: cast_nullable_to_non_nullable
as String,
fantasyFontName: null == fantasyFontName
? _value.fantasyFontName
: fantasyFontName // ignore: cast_nullable_to_non_nullable
as String,
languages: null == languages
? _value.languages
: languages // ignore: cast_nullable_to_non_nullable
as Languages,
) as $Val);
}
}
/// @nodoc
abstract class _$$GeneralSettingsImplCopyWith<$Res>
implements $GeneralSettingsCopyWith<$Res> {
factory _$$GeneralSettingsImplCopyWith(_$GeneralSettingsImpl value,
$Res Function(_$GeneralSettingsImpl) then) =
__$$GeneralSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String lightColorThemeId,
String darkColorThemeId,
ThemeColorSystem themeColorSystem,
NSFWInherit nsfwInherit,
bool enableDirectReaction,
AutomaticPush automaticPush,
bool enableAnimatedMFM,
bool enableLongTextElipsed,
bool enableFavoritedRenoteElipsed,
TabPosition tabPosition,
double textScaleFactor,
EmojiType emojiType,
String defaultFontName,
String serifFontName,
String monospaceFontName,
String cursiveFontName,
String fantasyFontName,
Languages languages});
}
/// @nodoc
class __$$GeneralSettingsImplCopyWithImpl<$Res>
extends _$GeneralSettingsCopyWithImpl<$Res, _$GeneralSettingsImpl>
implements _$$GeneralSettingsImplCopyWith<$Res> {
__$$GeneralSettingsImplCopyWithImpl(
_$GeneralSettingsImpl _value, $Res Function(_$GeneralSettingsImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? lightColorThemeId = null,
Object? darkColorThemeId = null,
Object? themeColorSystem = null,
Object? nsfwInherit = null,
Object? enableDirectReaction = null,
Object? automaticPush = null,
Object? enableAnimatedMFM = null,
Object? enableLongTextElipsed = null,
Object? enableFavoritedRenoteElipsed = null,
Object? tabPosition = null,
Object? textScaleFactor = null,
Object? emojiType = null,
Object? defaultFontName = null,
Object? serifFontName = null,
Object? monospaceFontName = null,
Object? cursiveFontName = null,
Object? fantasyFontName = null,
Object? languages = null,
}) {
return _then(_$GeneralSettingsImpl(
lightColorThemeId: null == lightColorThemeId
? _value.lightColorThemeId
: lightColorThemeId // ignore: cast_nullable_to_non_nullable
as String,
darkColorThemeId: null == darkColorThemeId
? _value.darkColorThemeId
: darkColorThemeId // ignore: cast_nullable_to_non_nullable
as String,
themeColorSystem: null == themeColorSystem
? _value.themeColorSystem
: themeColorSystem // ignore: cast_nullable_to_non_nullable
as ThemeColorSystem,
nsfwInherit: null == nsfwInherit
? _value.nsfwInherit
: nsfwInherit // ignore: cast_nullable_to_non_nullable
as NSFWInherit,
enableDirectReaction: null == enableDirectReaction
? _value.enableDirectReaction
: enableDirectReaction // ignore: cast_nullable_to_non_nullable
as bool,
automaticPush: null == automaticPush
? _value.automaticPush
: automaticPush // ignore: cast_nullable_to_non_nullable
as AutomaticPush,
enableAnimatedMFM: null == enableAnimatedMFM
? _value.enableAnimatedMFM
: enableAnimatedMFM // ignore: cast_nullable_to_non_nullable
as bool,
enableLongTextElipsed: null == enableLongTextElipsed
? _value.enableLongTextElipsed
: enableLongTextElipsed // ignore: cast_nullable_to_non_nullable
as bool,
enableFavoritedRenoteElipsed: null == enableFavoritedRenoteElipsed
? _value.enableFavoritedRenoteElipsed
: enableFavoritedRenoteElipsed // ignore: cast_nullable_to_non_nullable
as bool,
tabPosition: null == tabPosition
? _value.tabPosition
: tabPosition // ignore: cast_nullable_to_non_nullable
as TabPosition,
textScaleFactor: null == textScaleFactor
? _value.textScaleFactor
: textScaleFactor // ignore: cast_nullable_to_non_nullable
as double,
emojiType: null == emojiType
? _value.emojiType
: emojiType // ignore: cast_nullable_to_non_nullable
as EmojiType,
defaultFontName: null == defaultFontName
? _value.defaultFontName
: defaultFontName // ignore: cast_nullable_to_non_nullable
as String,
serifFontName: null == serifFontName
? _value.serifFontName
: serifFontName // ignore: cast_nullable_to_non_nullable
as String,
monospaceFontName: null == monospaceFontName
? _value.monospaceFontName
: monospaceFontName // ignore: cast_nullable_to_non_nullable
as String,
cursiveFontName: null == cursiveFontName
? _value.cursiveFontName
: cursiveFontName // ignore: cast_nullable_to_non_nullable
as String,
fantasyFontName: null == fantasyFontName
? _value.fantasyFontName
: fantasyFontName // ignore: cast_nullable_to_non_nullable
as String,
languages: null == languages
? _value.languages
: languages // ignore: cast_nullable_to_non_nullable
as Languages,
));
}
}
/// @nodoc
@JsonSerializable()
class _$GeneralSettingsImpl implements _GeneralSettings {
const _$GeneralSettingsImpl(
{this.lightColorThemeId = "",
this.darkColorThemeId = "",
this.themeColorSystem = ThemeColorSystem.system,
this.nsfwInherit = NSFWInherit.inherit,
this.enableDirectReaction = false,
this.automaticPush = AutomaticPush.none,
this.enableAnimatedMFM = true,
this.enableLongTextElipsed = false,
this.enableFavoritedRenoteElipsed = true,
this.tabPosition = TabPosition.top,
this.textScaleFactor = 1.0,
this.emojiType = EmojiType.twemoji,
this.defaultFontName = "",
this.serifFontName = "",
this.monospaceFontName = "",
this.cursiveFontName = "",
this.fantasyFontName = "",
this.languages = Languages.jaJP});
factory _$GeneralSettingsImpl.fromJson(Map<String, dynamic> json) =>
_$$GeneralSettingsImplFromJson(json);
@override
@JsonKey()
final String lightColorThemeId;
@override
@JsonKey()
final String darkColorThemeId;
@override
@JsonKey()
final ThemeColorSystem themeColorSystem;
/// NSFW設定を継承する
@override
@JsonKey()
final NSFWInherit nsfwInherit;
/// ノートのカスタム絵文字直接タップでのリアクションを有効にする
@override
@JsonKey()
final bool enableDirectReaction;
/// TLの自動更新を有効にする
@override
@JsonKey()
final AutomaticPush automaticPush;
/// 動きのあるMFMを有効にする
@override
@JsonKey()
final bool enableAnimatedMFM;
/// 長いノートを省略する
@override
@JsonKey()
final bool enableLongTextElipsed;
/// リアクション済みノートを短くする
@override
@JsonKey()
final bool enableFavoritedRenoteElipsed;
/// タブの位置
@override
@JsonKey()
final TabPosition tabPosition;
/// 文字の大きさの倍率
@override
@JsonKey()
final double textScaleFactor;
/// 使用するUnicodeの絵文字種別
@override
@JsonKey()
final EmojiType emojiType;
/// デフォルトのフォント名
@override
@JsonKey()
final String defaultFontName;
/// `$[font.serif のフォント名
@override
@JsonKey()
final String serifFontName;
/// `$[font.monospace およびコードブロックのフォント名
@override
@JsonKey()
final String monospaceFontName;
/// `$[font.cursive のフォント名
@override
@JsonKey()
final String cursiveFontName;
/// `$[font.fantasy のフォント名
@override
@JsonKey()
final String fantasyFontName;
/// 言語設定
@override
@JsonKey()
final Languages languages;
@override
String toString() {
return 'GeneralSettings(lightColorThemeId: $lightColorThemeId, darkColorThemeId: $darkColorThemeId, themeColorSystem: $themeColorSystem, nsfwInherit: $nsfwInherit, enableDirectReaction: $enableDirectReaction, automaticPush: $automaticPush, enableAnimatedMFM: $enableAnimatedMFM, enableLongTextElipsed: $enableLongTextElipsed, enableFavoritedRenoteElipsed: $enableFavoritedRenoteElipsed, tabPosition: $tabPosition, textScaleFactor: $textScaleFactor, emojiType: $emojiType, defaultFontName: $defaultFontName, serifFontName: $serifFontName, monospaceFontName: $monospaceFontName, cursiveFontName: $cursiveFontName, fantasyFontName: $fantasyFontName, languages: $languages)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$GeneralSettingsImpl &&
(identical(other.lightColorThemeId, lightColorThemeId) ||
other.lightColorThemeId == lightColorThemeId) &&
(identical(other.darkColorThemeId, darkColorThemeId) ||
other.darkColorThemeId == darkColorThemeId) &&
(identical(other.themeColorSystem, themeColorSystem) ||
other.themeColorSystem == themeColorSystem) &&
(identical(other.nsfwInherit, nsfwInherit) ||
other.nsfwInherit == nsfwInherit) &&
(identical(other.enableDirectReaction, enableDirectReaction) ||
other.enableDirectReaction == enableDirectReaction) &&
(identical(other.automaticPush, automaticPush) ||
other.automaticPush == automaticPush) &&
(identical(other.enableAnimatedMFM, enableAnimatedMFM) ||
other.enableAnimatedMFM == enableAnimatedMFM) &&
(identical(other.enableLongTextElipsed, enableLongTextElipsed) ||
other.enableLongTextElipsed == enableLongTextElipsed) &&
(identical(other.enableFavoritedRenoteElipsed,
enableFavoritedRenoteElipsed) ||
other.enableFavoritedRenoteElipsed ==
enableFavoritedRenoteElipsed) &&
(identical(other.tabPosition, tabPosition) ||
other.tabPosition == tabPosition) &&
(identical(other.textScaleFactor, textScaleFactor) ||
other.textScaleFactor == textScaleFactor) &&
(identical(other.emojiType, emojiType) ||
other.emojiType == emojiType) &&
(identical(other.defaultFontName, defaultFontName) ||
other.defaultFontName == defaultFontName) &&
(identical(other.serifFontName, serifFontName) ||
other.serifFontName == serifFontName) &&
(identical(other.monospaceFontName, monospaceFontName) ||
other.monospaceFontName == monospaceFontName) &&
(identical(other.cursiveFontName, cursiveFontName) ||
other.cursiveFontName == cursiveFontName) &&
(identical(other.fantasyFontName, fantasyFontName) ||
other.fantasyFontName == fantasyFontName) &&
(identical(other.languages, languages) ||
other.languages == languages));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
lightColorThemeId,
darkColorThemeId,
themeColorSystem,
nsfwInherit,
enableDirectReaction,
automaticPush,
enableAnimatedMFM,
enableLongTextElipsed,
enableFavoritedRenoteElipsed,
tabPosition,
textScaleFactor,
emojiType,
defaultFontName,
serifFontName,
monospaceFontName,
cursiveFontName,
fantasyFontName,
languages);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$GeneralSettingsImplCopyWith<_$GeneralSettingsImpl> get copyWith =>
__$$GeneralSettingsImplCopyWithImpl<_$GeneralSettingsImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$GeneralSettingsImplToJson(
this,
);
}
}
abstract class _GeneralSettings implements GeneralSettings {
const factory _GeneralSettings(
{final String lightColorThemeId,
final String darkColorThemeId,
final ThemeColorSystem themeColorSystem,
final NSFWInherit nsfwInherit,
final bool enableDirectReaction,
final AutomaticPush automaticPush,
final bool enableAnimatedMFM,
final bool enableLongTextElipsed,
final bool enableFavoritedRenoteElipsed,
final TabPosition tabPosition,
final double textScaleFactor,
final EmojiType emojiType,
final String defaultFontName,
final String serifFontName,
final String monospaceFontName,
final String cursiveFontName,
final String fantasyFontName,
final Languages languages}) = _$GeneralSettingsImpl;
factory _GeneralSettings.fromJson(Map<String, dynamic> json) =
_$GeneralSettingsImpl.fromJson;
@override
String get lightColorThemeId;
@override
String get darkColorThemeId;
@override
ThemeColorSystem get themeColorSystem;
@override
/// NSFW設定を継承する
NSFWInherit get nsfwInherit;
@override
/// ノートのカスタム絵文字直接タップでのリアクションを有効にする
bool get enableDirectReaction;
@override
/// TLの自動更新を有効にする
AutomaticPush get automaticPush;
@override
/// 動きのあるMFMを有効にする
bool get enableAnimatedMFM;
@override
/// 長いノートを省略する
bool get enableLongTextElipsed;
@override
/// リアクション済みノートを短くする
bool get enableFavoritedRenoteElipsed;
@override
/// タブの位置
TabPosition get tabPosition;
@override
/// 文字の大きさの倍率
double get textScaleFactor;
@override
/// 使用するUnicodeの絵文字種別
EmojiType get emojiType;
@override
/// デフォルトのフォント名
String get defaultFontName;
@override
/// `$[font.serif のフォント名
String get serifFontName;
@override
/// `$[font.monospace およびコードブロックのフォント名
String get monospaceFontName;
@override
/// `$[font.cursive のフォント名
String get cursiveFontName;
@override
/// `$[font.fantasy のフォント名
String get fantasyFontName;
@override
/// 言語設定
Languages get languages;
@override
@JsonKey(ignore: true)
_$$GeneralSettingsImplCopyWith<_$GeneralSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/exported_setting.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'exported_setting.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
ExportedSetting _$ExportedSettingFromJson(Map<String, dynamic> json) {
return _ExportedSetting.fromJson(json);
}
/// @nodoc
mixin _$ExportedSetting {
List<AccountSettings> get accountSettings =>
throw _privateConstructorUsedError;
GeneralSettings get generalSettings => throw _privateConstructorUsedError;
List<TabSetting> get tabSettings => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ExportedSettingCopyWith<ExportedSetting> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ExportedSettingCopyWith<$Res> {
factory $ExportedSettingCopyWith(
ExportedSetting value, $Res Function(ExportedSetting) then) =
_$ExportedSettingCopyWithImpl<$Res, ExportedSetting>;
@useResult
$Res call(
{List<AccountSettings> accountSettings,
GeneralSettings generalSettings,
List<TabSetting> tabSettings});
$GeneralSettingsCopyWith<$Res> get generalSettings;
}
/// @nodoc
class _$ExportedSettingCopyWithImpl<$Res, $Val extends ExportedSetting>
implements $ExportedSettingCopyWith<$Res> {
_$ExportedSettingCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountSettings = null,
Object? generalSettings = null,
Object? tabSettings = null,
}) {
return _then(_value.copyWith(
accountSettings: null == accountSettings
? _value.accountSettings
: accountSettings // ignore: cast_nullable_to_non_nullable
as List<AccountSettings>,
generalSettings: null == generalSettings
? _value.generalSettings
: generalSettings // ignore: cast_nullable_to_non_nullable
as GeneralSettings,
tabSettings: null == tabSettings
? _value.tabSettings
: tabSettings // ignore: cast_nullable_to_non_nullable
as List<TabSetting>,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$GeneralSettingsCopyWith<$Res> get generalSettings {
return $GeneralSettingsCopyWith<$Res>(_value.generalSettings, (value) {
return _then(_value.copyWith(generalSettings: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$ExportedSettingImplCopyWith<$Res>
implements $ExportedSettingCopyWith<$Res> {
factory _$$ExportedSettingImplCopyWith(_$ExportedSettingImpl value,
$Res Function(_$ExportedSettingImpl) then) =
__$$ExportedSettingImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{List<AccountSettings> accountSettings,
GeneralSettings generalSettings,
List<TabSetting> tabSettings});
@override
$GeneralSettingsCopyWith<$Res> get generalSettings;
}
/// @nodoc
class __$$ExportedSettingImplCopyWithImpl<$Res>
extends _$ExportedSettingCopyWithImpl<$Res, _$ExportedSettingImpl>
implements _$$ExportedSettingImplCopyWith<$Res> {
__$$ExportedSettingImplCopyWithImpl(
_$ExportedSettingImpl _value, $Res Function(_$ExportedSettingImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountSettings = null,
Object? generalSettings = null,
Object? tabSettings = null,
}) {
return _then(_$ExportedSettingImpl(
accountSettings: null == accountSettings
? _value._accountSettings
: accountSettings // ignore: cast_nullable_to_non_nullable
as List<AccountSettings>,
generalSettings: null == generalSettings
? _value.generalSettings
: generalSettings // ignore: cast_nullable_to_non_nullable
as GeneralSettings,
tabSettings: null == tabSettings
? _value._tabSettings
: tabSettings // ignore: cast_nullable_to_non_nullable
as List<TabSetting>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ExportedSettingImpl implements _ExportedSetting {
const _$ExportedSettingImpl(
{final List<AccountSettings> accountSettings = const [],
required this.generalSettings,
final List<TabSetting> tabSettings = const []})
: _accountSettings = accountSettings,
_tabSettings = tabSettings;
factory _$ExportedSettingImpl.fromJson(Map<String, dynamic> json) =>
_$$ExportedSettingImplFromJson(json);
final List<AccountSettings> _accountSettings;
@override
@JsonKey()
List<AccountSettings> get accountSettings {
if (_accountSettings is EqualUnmodifiableListView) return _accountSettings;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_accountSettings);
}
@override
final GeneralSettings generalSettings;
final List<TabSetting> _tabSettings;
@override
@JsonKey()
List<TabSetting> get tabSettings {
if (_tabSettings is EqualUnmodifiableListView) return _tabSettings;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_tabSettings);
}
@override
String toString() {
return 'ExportedSetting(accountSettings: $accountSettings, generalSettings: $generalSettings, tabSettings: $tabSettings)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ExportedSettingImpl &&
const DeepCollectionEquality()
.equals(other._accountSettings, _accountSettings) &&
(identical(other.generalSettings, generalSettings) ||
other.generalSettings == generalSettings) &&
const DeepCollectionEquality()
.equals(other._tabSettings, _tabSettings));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_accountSettings),
generalSettings,
const DeepCollectionEquality().hash(_tabSettings));
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ExportedSettingImplCopyWith<_$ExportedSettingImpl> get copyWith =>
__$$ExportedSettingImplCopyWithImpl<_$ExportedSettingImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ExportedSettingImplToJson(
this,
);
}
}
abstract class _ExportedSetting implements ExportedSetting {
const factory _ExportedSetting(
{final List<AccountSettings> accountSettings,
required final GeneralSettings generalSettings,
final List<TabSetting> tabSettings}) = _$ExportedSettingImpl;
factory _ExportedSetting.fromJson(Map<String, dynamic> json) =
_$ExportedSettingImpl.fromJson;
@override
List<AccountSettings> get accountSettings;
@override
GeneralSettings get generalSettings;
@override
List<TabSetting> get tabSettings;
@override
@JsonKey(ignore: true)
_$$ExportedSettingImplCopyWith<_$ExportedSettingImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/unicode_emoji.dart | import 'package:freezed_annotation/freezed_annotation.dart';
part 'unicode_emoji.freezed.dart';
part 'unicode_emoji.g.dart';
@freezed
class UnicodeEmoji with _$UnicodeEmoji {
const factory UnicodeEmoji({
required String category,
required String char,
required String name,
required List<String> keywords,
}) = _UnicodeEmoji;
factory UnicodeEmoji.fromJson(Map<String, dynamic> json) =>
_$UnicodeEmojiFromJson(json);
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/acct.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'acct.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$AcctImpl _$$AcctImplFromJson(Map<String, dynamic> json) => _$AcctImpl(
host: json['host'] as String,
username: json['username'] as String,
);
Map<String, dynamic> _$$AcctImplToJson(_$AcctImpl instance) =>
<String, dynamic>{
'host': instance.host,
'username': instance.username,
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/desktop_settings.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'desktop_settings.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$DesktopSettingsImpl _$$DesktopSettingsImplFromJson(
Map<String, dynamic> json) =>
_$DesktopSettingsImpl(
window: json['window'] == null
? const DesktopWindowSettings()
: DesktopWindowSettings.fromJson(
json['window'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$DesktopSettingsImplToJson(
_$DesktopSettingsImpl instance) =>
<String, dynamic>{
'window': instance.window.toJson(),
};
_$DesktopWindowSettingsImpl _$$DesktopWindowSettingsImplFromJson(
Map<String, dynamic> json) =>
_$DesktopWindowSettingsImpl(
x: (json['x'] as num?)?.toDouble() ?? null,
y: (json['y'] as num?)?.toDouble() ?? null,
w: (json['w'] as num?)?.toDouble() ?? 400,
h: (json['h'] as num?)?.toDouble() ?? 700,
);
Map<String, dynamic> _$$DesktopWindowSettingsImplToJson(
_$DesktopWindowSettingsImpl instance) =>
<String, dynamic>{
'x': instance.x,
'y': instance.y,
'w': instance.w,
'h': instance.h,
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/unicode_emoji.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'unicode_emoji.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$UnicodeEmojiImpl _$$UnicodeEmojiImplFromJson(Map<String, dynamic> json) =>
_$UnicodeEmojiImpl(
category: json['category'] as String,
char: json['char'] as String,
name: json['name'] as String,
keywords:
(json['keywords'] as List<dynamic>).map((e) => e as String).toList(),
);
Map<String, dynamic> _$$UnicodeEmojiImplToJson(_$UnicodeEmojiImpl instance) =>
<String, dynamic>{
'category': instance.category,
'char': instance.char,
'name': instance.name,
'keywords': instance.keywords,
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/antenna_settings.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'antenna_settings.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$AntennaSettings {
String get name => throw _privateConstructorUsedError;
AntennaSource get src => throw _privateConstructorUsedError;
String? get userListId => throw _privateConstructorUsedError;
List<List<String>> get keywords => throw _privateConstructorUsedError;
List<List<String>> get excludeKeywords => throw _privateConstructorUsedError;
List<String> get users => throw _privateConstructorUsedError;
bool get caseSensitive => throw _privateConstructorUsedError;
bool get withReplies => throw _privateConstructorUsedError;
bool get withFile => throw _privateConstructorUsedError;
bool get notify => throw _privateConstructorUsedError;
bool get localOnly => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$AntennaSettingsCopyWith<AntennaSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AntennaSettingsCopyWith<$Res> {
factory $AntennaSettingsCopyWith(
AntennaSettings value, $Res Function(AntennaSettings) then) =
_$AntennaSettingsCopyWithImpl<$Res, AntennaSettings>;
@useResult
$Res call(
{String name,
AntennaSource src,
String? userListId,
List<List<String>> keywords,
List<List<String>> excludeKeywords,
List<String> users,
bool caseSensitive,
bool withReplies,
bool withFile,
bool notify,
bool localOnly});
}
/// @nodoc
class _$AntennaSettingsCopyWithImpl<$Res, $Val extends AntennaSettings>
implements $AntennaSettingsCopyWith<$Res> {
_$AntennaSettingsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? src = null,
Object? userListId = freezed,
Object? keywords = null,
Object? excludeKeywords = null,
Object? users = null,
Object? caseSensitive = null,
Object? withReplies = null,
Object? withFile = null,
Object? notify = null,
Object? localOnly = null,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
src: null == src
? _value.src
: src // ignore: cast_nullable_to_non_nullable
as AntennaSource,
userListId: freezed == userListId
? _value.userListId
: userListId // ignore: cast_nullable_to_non_nullable
as String?,
keywords: null == keywords
? _value.keywords
: keywords // ignore: cast_nullable_to_non_nullable
as List<List<String>>,
excludeKeywords: null == excludeKeywords
? _value.excludeKeywords
: excludeKeywords // ignore: cast_nullable_to_non_nullable
as List<List<String>>,
users: null == users
? _value.users
: users // ignore: cast_nullable_to_non_nullable
as List<String>,
caseSensitive: null == caseSensitive
? _value.caseSensitive
: caseSensitive // ignore: cast_nullable_to_non_nullable
as bool,
withReplies: null == withReplies
? _value.withReplies
: withReplies // ignore: cast_nullable_to_non_nullable
as bool,
withFile: null == withFile
? _value.withFile
: withFile // ignore: cast_nullable_to_non_nullable
as bool,
notify: null == notify
? _value.notify
: notify // ignore: cast_nullable_to_non_nullable
as bool,
localOnly: null == localOnly
? _value.localOnly
: localOnly // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$AntennaSettingsImplCopyWith<$Res>
implements $AntennaSettingsCopyWith<$Res> {
factory _$$AntennaSettingsImplCopyWith(_$AntennaSettingsImpl value,
$Res Function(_$AntennaSettingsImpl) then) =
__$$AntennaSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String name,
AntennaSource src,
String? userListId,
List<List<String>> keywords,
List<List<String>> excludeKeywords,
List<String> users,
bool caseSensitive,
bool withReplies,
bool withFile,
bool notify,
bool localOnly});
}
/// @nodoc
class __$$AntennaSettingsImplCopyWithImpl<$Res>
extends _$AntennaSettingsCopyWithImpl<$Res, _$AntennaSettingsImpl>
implements _$$AntennaSettingsImplCopyWith<$Res> {
__$$AntennaSettingsImplCopyWithImpl(
_$AntennaSettingsImpl _value, $Res Function(_$AntennaSettingsImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? src = null,
Object? userListId = freezed,
Object? keywords = null,
Object? excludeKeywords = null,
Object? users = null,
Object? caseSensitive = null,
Object? withReplies = null,
Object? withFile = null,
Object? notify = null,
Object? localOnly = null,
}) {
return _then(_$AntennaSettingsImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
src: null == src
? _value.src
: src // ignore: cast_nullable_to_non_nullable
as AntennaSource,
userListId: freezed == userListId
? _value.userListId
: userListId // ignore: cast_nullable_to_non_nullable
as String?,
keywords: null == keywords
? _value._keywords
: keywords // ignore: cast_nullable_to_non_nullable
as List<List<String>>,
excludeKeywords: null == excludeKeywords
? _value._excludeKeywords
: excludeKeywords // ignore: cast_nullable_to_non_nullable
as List<List<String>>,
users: null == users
? _value._users
: users // ignore: cast_nullable_to_non_nullable
as List<String>,
caseSensitive: null == caseSensitive
? _value.caseSensitive
: caseSensitive // ignore: cast_nullable_to_non_nullable
as bool,
withReplies: null == withReplies
? _value.withReplies
: withReplies // ignore: cast_nullable_to_non_nullable
as bool,
withFile: null == withFile
? _value.withFile
: withFile // ignore: cast_nullable_to_non_nullable
as bool,
notify: null == notify
? _value.notify
: notify // ignore: cast_nullable_to_non_nullable
as bool,
localOnly: null == localOnly
? _value.localOnly
: localOnly // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
class _$AntennaSettingsImpl extends _AntennaSettings {
const _$AntennaSettingsImpl(
{this.name = "",
this.src = AntennaSource.all,
this.userListId,
final List<List<String>> keywords = const [],
final List<List<String>> excludeKeywords = const [],
final List<String> users = const [],
this.caseSensitive = false,
this.withReplies = false,
this.withFile = false,
this.notify = false,
this.localOnly = false})
: _keywords = keywords,
_excludeKeywords = excludeKeywords,
_users = users,
super._();
@override
@JsonKey()
final String name;
@override
@JsonKey()
final AntennaSource src;
@override
final String? userListId;
final List<List<String>> _keywords;
@override
@JsonKey()
List<List<String>> get keywords {
if (_keywords is EqualUnmodifiableListView) return _keywords;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_keywords);
}
final List<List<String>> _excludeKeywords;
@override
@JsonKey()
List<List<String>> get excludeKeywords {
if (_excludeKeywords is EqualUnmodifiableListView) return _excludeKeywords;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_excludeKeywords);
}
final List<String> _users;
@override
@JsonKey()
List<String> get users {
if (_users is EqualUnmodifiableListView) return _users;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_users);
}
@override
@JsonKey()
final bool caseSensitive;
@override
@JsonKey()
final bool withReplies;
@override
@JsonKey()
final bool withFile;
@override
@JsonKey()
final bool notify;
@override
@JsonKey()
final bool localOnly;
@override
String toString() {
return 'AntennaSettings(name: $name, src: $src, userListId: $userListId, keywords: $keywords, excludeKeywords: $excludeKeywords, users: $users, caseSensitive: $caseSensitive, withReplies: $withReplies, withFile: $withFile, notify: $notify, localOnly: $localOnly)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AntennaSettingsImpl &&
(identical(other.name, name) || other.name == name) &&
(identical(other.src, src) || other.src == src) &&
(identical(other.userListId, userListId) ||
other.userListId == userListId) &&
const DeepCollectionEquality().equals(other._keywords, _keywords) &&
const DeepCollectionEquality()
.equals(other._excludeKeywords, _excludeKeywords) &&
const DeepCollectionEquality().equals(other._users, _users) &&
(identical(other.caseSensitive, caseSensitive) ||
other.caseSensitive == caseSensitive) &&
(identical(other.withReplies, withReplies) ||
other.withReplies == withReplies) &&
(identical(other.withFile, withFile) ||
other.withFile == withFile) &&
(identical(other.notify, notify) || other.notify == notify) &&
(identical(other.localOnly, localOnly) ||
other.localOnly == localOnly));
}
@override
int get hashCode => Object.hash(
runtimeType,
name,
src,
userListId,
const DeepCollectionEquality().hash(_keywords),
const DeepCollectionEquality().hash(_excludeKeywords),
const DeepCollectionEquality().hash(_users),
caseSensitive,
withReplies,
withFile,
notify,
localOnly);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$AntennaSettingsImplCopyWith<_$AntennaSettingsImpl> get copyWith =>
__$$AntennaSettingsImplCopyWithImpl<_$AntennaSettingsImpl>(
this, _$identity);
}
abstract class _AntennaSettings extends AntennaSettings {
const factory _AntennaSettings(
{final String name,
final AntennaSource src,
final String? userListId,
final List<List<String>> keywords,
final List<List<String>> excludeKeywords,
final List<String> users,
final bool caseSensitive,
final bool withReplies,
final bool withFile,
final bool notify,
final bool localOnly}) = _$AntennaSettingsImpl;
const _AntennaSettings._() : super._();
@override
String get name;
@override
AntennaSource get src;
@override
String? get userListId;
@override
List<List<String>> get keywords;
@override
List<List<String>> get excludeKeywords;
@override
List<String> get users;
@override
bool get caseSensitive;
@override
bool get withReplies;
@override
bool get withFile;
@override
bool get notify;
@override
bool get localOnly;
@override
@JsonKey(ignore: true)
_$$AntennaSettingsImplCopyWith<_$AntennaSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/misskey_emoji_data.dart | import 'package:miria/repository/emoji_repository.dart';
import 'package:collection/collection.dart';
sealed class MisskeyEmojiData {
final String baseName;
final bool isSensitive;
const MisskeyEmojiData(
this.baseName,
this.isSensitive,
);
factory MisskeyEmojiData.fromEmojiName({
required String emojiName,
Map<String, String>? emojiInfo,
EmojiRepository? repository,
}) {
// Unicodeの絵文字
if (!emojiName.startsWith(":")) {
return UnicodeEmojiData(char: emojiName);
}
final customEmojiRegExp = RegExp(r":(.+?)@(.+?):");
final hostIncludedRegExp = RegExp(r":(.+?):");
// よそのサーバー
if (emojiInfo != null && emojiInfo.isNotEmpty) {
final baseName =
customEmojiRegExp.firstMatch(emojiName)?.group(1) ?? emojiName;
final hostIncludedBaseName =
hostIncludedRegExp.firstMatch(emojiName)?.group(1) ?? emojiName;
final found = emojiInfo[hostIncludedBaseName];
if (found != null) {
return CustomEmojiData(
baseName: baseName,
hostedName: emojiName,
url: Uri.parse(found),
isCurrentServer: false,
isSensitive: false //TODO: 要検証
);
}
}
// 自分のサーバー :ai@.:
if (customEmojiRegExp.hasMatch(emojiName)) {
assert(repository != null);
final EmojiRepositoryData? found = repository!.emoji?.firstWhereOrNull(
(e) =>
e.emoji.baseName ==
(customEmojiRegExp.firstMatch(emojiName)?.group(1) ?? emojiName));
if (found != null) {
return found.emoji;
} else {
return NotEmojiData(name: emojiName);
}
}
// 自分のサーバー :ai:
final customEmojiRegExp2 = RegExp(r"^:(.+?):$");
if (customEmojiRegExp2.hasMatch(emojiName)) {
assert(repository != null);
final EmojiRepositoryData? found = repository!.emoji?.firstWhereOrNull(
(e) =>
e.emoji.baseName ==
(customEmojiRegExp2.firstMatch(emojiName)?.group(1) ??
emojiName));
if (found != null) {
return found.emoji;
} else {
return NotEmojiData(name: emojiName);
}
}
return NotEmojiData(name: emojiName);
}
}
/// 絵文字に見せかけた単なるテキスト
class NotEmojiData extends MisskeyEmojiData {
const NotEmojiData({required this.name}) : super(name, false);
final String name;
}
/// カスタム絵文字
class CustomEmojiData extends MisskeyEmojiData {
const CustomEmojiData({
required String baseName,
required this.hostedName,
required this.url,
required this.isCurrentServer,
required bool isSensitive,
}) : super(baseName, isSensitive);
final String hostedName;
final Uri url;
final bool isCurrentServer;
}
/// Unicode絵文字
class UnicodeEmojiData extends MisskeyEmojiData {
const UnicodeEmojiData({
required this.char,
}) : super(char, false);
final String char;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/clip_settings.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:misskey_dart/misskey_dart.dart';
part 'clip_settings.freezed.dart';
@freezed
class ClipSettings with _$ClipSettings {
const factory ClipSettings({
@Default("") String name,
String? description,
@Default(false) bool isPublic,
}) = _ClipSettings;
const ClipSettings._();
factory ClipSettings.fromClip(Clip clip) {
return ClipSettings(
name: clip.name ?? "",
description: clip.description,
isPublic: clip.isPublic,
);
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/image_file.dart | import 'dart:typed_data';
sealed class MisskeyPostFile {
final String fileName;
final bool isNsfw;
final String? caption;
const MisskeyPostFile({
required this.fileName,
this.isNsfw = false,
this.caption,
});
}
class ImageFile extends MisskeyPostFile {
final Uint8List data;
const ImageFile({
required this.data,
required super.fileName,
super.isNsfw,
super.caption,
});
}
class ImageFileAlreadyPostedFile extends MisskeyPostFile {
final Uint8List data;
final String id;
final bool isEdited;
const ImageFileAlreadyPostedFile({
required this.data,
required this.id,
this.isEdited = false,
required super.fileName,
super.isNsfw,
super.caption,
});
}
class UnknownFile extends MisskeyPostFile {
final Uint8List data;
const UnknownFile({
required this.data,
required super.fileName,
super.isNsfw,
super.caption,
});
}
class UnknownAlreadyPostedFile extends MisskeyPostFile {
final String url;
final String id;
final bool isEdited;
const UnknownAlreadyPostedFile({
required this.url,
required this.id,
this.isEdited = false,
required super.fileName,
super.isNsfw,
super.caption,
});
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/color_theme.dart | import 'dart:ui';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:miria/extensions/color_extension.dart';
import 'package:miria/extensions/string_extensions.dart';
import 'package:miria/model/misskey_theme.dart';
part 'color_theme.freezed.dart';
@freezed
class ColorTheme with _$ColorTheme {
const factory ColorTheme({
required String id,
required String name,
required bool isDarkTheme,
required Color primary,
required Color primaryDarken,
required Color primaryLighten,
required Color accentedBackground,
required Color background,
required Color foreground,
required Color renote,
required Color mention,
required Color hashtag,
required Color link,
required Color divider,
required Color buttonBackground,
required Color buttonGradateA,
required Color buttonGradateB,
required Color panel,
required Color panelBackground,
}) = _ColorTheme;
factory ColorTheme.misskey(MisskeyTheme theme) {
final isDarkTheme = theme.base == "dark";
final props = {
...isDarkTheme ? defaultDarkThemeProps : defaultLightThemeProps
};
props.addAll(theme.props);
props
.cast<String, String>()
.removeWhere((key, value) => value.startsWith('"'));
// https://github.com/misskey-dev/misskey/blob/13.14.1/packages/frontend/src/scripts/theme.ts#L98-L124
Color getColor(String val) {
if (val[0] == "@") {
return getColor(props[val.substring(1)]!);
} else if (val[0] == r"$") {
return getColor(props[val]!);
} else if (val[0] == ":") {
final parts = val.split("<");
final func = parts.removeAt(0).substring(1);
final arg = double.parse(parts.removeAt(0));
final color = getColor(parts.join("<"));
return switch (func) {
"darken" => color.darken(arg / 100),
"lighten" => color.lighten(arg / 100),
"alpha" => color.withOpacity(arg),
"hue" => color.spin(arg),
"saturate" => color.saturate(arg / 100),
_ => color,
};
}
final input = val.trim();
if (input.startsWith("rgb(") && input.endsWith(")")) {
final rgb = input
.substring(4, input.length - 1)
.split(RegExp(r"[, ]+"))
.map(int.parse)
.toList();
return Color.fromRGBO(rgb[0], rgb[1], rgb[2], 1);
}
if (input.startsWith("rgba(") && input.endsWith(")")) {
final rgbo = input.substring(5, input.length - 1).split(",");
final rgb = rgbo.sublist(0, 3).map(int.parse).toList();
final opacity = double.parse(rgbo[3]);
return Color.fromRGBO(rgb[0], rgb[1], rgb[2], opacity);
}
final color = input.toColor();
if (color != null) {
return color;
}
throw FormatException("invalid color format", val);
}
final colors = props.map(
(key, value) => MapEntry(key, getColor(value)),
);
return ColorTheme(
id: theme.id,
name: theme.name,
isDarkTheme: isDarkTheme,
primary: colors["accent"]!,
primaryDarken: colors["accentDarken"]!,
primaryLighten: colors["accentLighten"]!,
accentedBackground: colors["accentedBg"]!,
background: colors["bg"]!,
foreground: colors["fg"]!,
renote: colors["renote"]!,
mention: colors["mention"]!,
hashtag: colors["hashtag"]!,
link: colors["link"]!,
divider: colors["divider"]!,
buttonBackground: colors["buttonBg"]!,
buttonGradateA: colors["buttonGradateA"]!,
buttonGradateB: colors["buttonGradateB"]!,
panel: colors["panel"]!,
panelBackground: colors["panelHeaderBg"]!,
);
}
}
// misskey/packages/frontend/src/themes/_light.json5
const defaultLightThemeProps = {
"accent": '#86b300',
"accentDarken": ':darken<10<@accent',
"accentLighten": ':lighten<10<@accent',
"accentedBg": ':alpha<0.15<@accent',
"focus": ':alpha<0.3<@accent',
"bg": '#fff',
"acrylicBg": ':alpha<0.5<@bg',
"fg": '#5f5f5f',
"fgTransparentWeak": ':alpha<0.75<@fg',
"fgTransparent": ':alpha<0.5<@fg',
"fgHighlighted": ':darken<3<@fg',
"fgOnAccent": '#fff',
"fgOnWhite": '#333',
"divider": 'rgba(0, 0, 0, 0.1)',
"indicator": '@accent',
"panel": ':lighten<3<@bg',
"panelHighlight": ':darken<3<@panel',
"panelHeaderBg": ':lighten<3<@panel',
"panelHeaderFg": '@fg',
"panelHeaderDivider": 'rgba(0, 0, 0, 0)',
"panelBorder": '" solid 1px var(--divider)',
"acrylicPanel": ':alpha<0.5<@panel',
"windowHeader": ':alpha<0.85<@panel',
"popup": ':lighten<3<@panel',
"shadow": 'rgba(0, 0, 0, 0.1)',
"header": ':alpha<0.7<@panel',
"navBg": '@panel',
"navFg": '@fg',
"navHoverFg": ':darken<17<@fg',
"navActive": '@accent',
"navIndicator": '@indicator',
"link": '#44a4c1',
"hashtag": '#ff9156',
"mention": '@accent',
"mentionMe": '@mention',
"renote": '#229e82',
"modalBg": 'rgba(0, 0, 0, 0.3)',
"scrollbarHandle": 'rgba(0, 0, 0, 0.2)',
"scrollbarHandleHover": 'rgba(0, 0, 0, 0.4)',
"dateLabelFg": '@fg',
"infoBg": '#e5f5ff',
"infoFg": '#72818a',
"infoWarnBg": '#fff0db',
"infoWarnFg": '#8f6e31',
"switchBg": 'rgba(0, 0, 0, 0.15)',
"cwBg": '#b1b9c1',
"cwFg": '#fff',
"cwHoverBg": '#bbc4ce',
"buttonBg": 'rgba(0, 0, 0, 0.05)',
"buttonHoverBg": 'rgba(0, 0, 0, 0.1)',
"buttonGradateA": '@accent',
"buttonGradateB": ':hue<20<@accent',
"switchOffBg": 'rgba(0, 0, 0, 0.1)',
"switchOffFg": '@panel',
"switchOnBg": '@accent',
"switchOnFg": '@fgOnAccent',
"inputBorder": 'rgba(0, 0, 0, 0.1)',
"inputBorderHover": 'rgba(0, 0, 0, 0.2)',
"listItemHoverBg": 'rgba(0, 0, 0, 0.03)',
"driveFolderBg": ':alpha<0.3<@accent',
"wallpaperOverlay": 'rgba(255, 255, 255, 0.5)',
"badge": '#31b1ce',
"messageBg": '@bg',
"success": '#86b300',
"error": '#ec4137',
"warn": '#ecb637',
"codeString": '#b98710',
"codeNumber": '#0fbbbb',
"codeBoolean": '#62b70c',
"deckBg": ':darken<3<@bg',
"htmlThemeColor": '@bg',
"X2": ':darken<2<@panel',
"X3": 'rgba(0, 0, 0, 0.05)',
"X4": 'rgba(0, 0, 0, 0.1)',
"X5": 'rgba(0, 0, 0, 0.05)',
"X6": 'rgba(0, 0, 0, 0.25)',
"X7": 'rgba(0, 0, 0, 0.05)',
"X8": ':lighten<5<@accent',
"X9": ':darken<5<@accent',
"X10": ':alpha<0.4<@accent',
"X11": 'rgba(0, 0, 0, 0.1)',
"X12": 'rgba(0, 0, 0, 0.1)',
"X13": 'rgba(0, 0, 0, 0.15)',
"X14": ':alpha<0.5<@navBg',
"X15": ':alpha<0<@panel',
"X16": ':alpha<0.7<@panel',
"X17": ':alpha<0.8<@bg',
};
// misskey/packages/frontend/src/themes/_dark.json5
const defaultDarkThemeProps = {
"accent": '#86b300',
"accentDarken": ':darken<10<@accent',
"accentLighten": ':lighten<10<@accent',
"accentedBg": ':alpha<0.15<@accent',
"focus": ':alpha<0.3<@accent',
"bg": '#000',
"acrylicBg": ':alpha<0.5<@bg',
"fg": '#dadada',
"fgTransparentWeak": ':alpha<0.75<@fg',
"fgTransparent": ':alpha<0.5<@fg',
"fgHighlighted": ':lighten<3<@fg',
"fgOnAccent": '#fff',
"fgOnWhite": '#333',
"divider": 'rgba(255, 255, 255, 0.1)',
"indicator": '@accent',
"panel": ':lighten<3<@bg',
"panelHighlight": ':lighten<3<@panel',
"panelHeaderBg": ':lighten<3<@panel',
"panelHeaderFg": '@fg',
"panelHeaderDivider": 'rgba(0, 0, 0, 0)',
"panelBorder": '" solid 1px var(--divider)',
"acrylicPanel": ':alpha<0.5<@panel',
"windowHeader": ':alpha<0.85<@panel',
"popup": ':lighten<3<@panel',
"shadow": 'rgba(0, 0, 0, 0.3)',
"header": ':alpha<0.7<@panel',
"navBg": '@panel',
"navFg": '@fg',
"navHoverFg": ':lighten<17<@fg',
"navActive": '@accent',
"navIndicator": '@indicator',
"link": '#44a4c1',
"hashtag": '#ff9156',
"mention": '@accent',
"mentionMe": '@mention',
"renote": '#229e82',
"modalBg": 'rgba(0, 0, 0, 0.5)',
"scrollbarHandle": 'rgba(255, 255, 255, 0.2)',
"scrollbarHandleHover": 'rgba(255, 255, 255, 0.4)',
"dateLabelFg": '@fg',
"infoBg": '#253142',
"infoFg": '#fff',
"infoWarnBg": '#42321c',
"infoWarnFg": '#ffbd3e',
"switchBg": 'rgba(255, 255, 255, 0.15)',
"cwBg": '#687390',
"cwFg": '#393f4f',
"cwHoverBg": '#707b97',
"buttonBg": 'rgba(255, 255, 255, 0.05)',
"buttonHoverBg": 'rgba(255, 255, 255, 0.1)',
"buttonGradateA": '@accent',
"buttonGradateB": ':hue<20<@accent',
"switchOffBg": 'rgba(255, 255, 255, 0.1)',
"switchOffFg": ':alpha<0.8<@fg',
"switchOnBg": '@accentedBg',
"switchOnFg": '@accent',
"inputBorder": 'rgba(255, 255, 255, 0.1)',
"inputBorderHover": 'rgba(255, 255, 255, 0.2)',
"listItemHoverBg": 'rgba(255, 255, 255, 0.03)',
"driveFolderBg": ':alpha<0.3<@accent',
"wallpaperOverlay": 'rgba(0, 0, 0, 0.5)',
"badge": '#31b1ce',
"messageBg": '@bg',
"success": '#86b300',
"error": '#ec4137',
"warn": '#ecb637',
"codeString": '#ffb675',
"codeNumber": '#cfff9e',
"codeBoolean": '#c59eff',
"deckBg": '#000',
"htmlThemeColor": '@bg',
"X2": ':darken<2<@panel',
"X3": 'rgba(255, 255, 255, 0.05)',
"X4": 'rgba(255, 255, 255, 0.1)',
"X5": 'rgba(255, 255, 255, 0.05)',
"X6": 'rgba(255, 255, 255, 0.15)',
"X7": 'rgba(255, 255, 255, 0.05)',
"X8": ':lighten<5<@accent',
"X9": ':darken<5<@accent',
"X10": ':alpha<0.4<@accent',
"X11": 'rgba(0, 0, 0, 0.3)',
"X12": 'rgba(255, 255, 255, 0.1)',
"X13": 'rgba(255, 255, 255, 0.15)',
"X14": ':alpha<0.5<@navBg',
"X15": ':alpha<0<@panel',
"X16": ':alpha<0.7<@panel',
"X17": ':alpha<0.8<@bg',
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/desktop_settings.dart | import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'desktop_settings.freezed.dart';
part 'desktop_settings.g.dart';
@freezed
class DesktopSettings with _$DesktopSettings {
const factory DesktopSettings({
@Default(DesktopWindowSettings()) DesktopWindowSettings window,
}) = _DesktopSettings;
factory DesktopSettings.fromJson(Map<String, dynamic> json) =>
_$DesktopSettingsFromJson(json);
}
@freezed
class DesktopWindowSettings with _$DesktopWindowSettings {
const factory DesktopWindowSettings({
@Default(null) double? x,
@Default(null) double? y,
@Default(400) double w,
@Default(700) double h,
}) = _DesktopWindowSettings;
factory DesktopWindowSettings.fromJson(Map<String, dynamic> json) =>
_$DesktopWindowSettingsFromJson(json);
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/account_settings.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:miria/model/acct.dart';
import 'package:misskey_dart/misskey_dart.dart';
part 'account_settings.freezed.dart';
part 'account_settings.g.dart';
enum CacheStrategy {
whenTabChange,
whenLaunch,
whenOneDay,
}
@freezed
class AccountSettings with _$AccountSettings {
const AccountSettings._();
const factory AccountSettings({
required String userId,
required String host,
@Default([]) List<String> reactions,
@Default(NoteVisibility.public) NoteVisibility defaultNoteVisibility,
@Default(false) bool defaultIsLocalOnly,
@Default(null) ReactionAcceptance? defaultReactionAcceptance,
@Default(CacheStrategy.whenTabChange) CacheStrategy iCacheStrategy,
DateTime? latestICached,
@Default(CacheStrategy.whenLaunch) CacheStrategy emojiCacheStrategy,
DateTime? latestEmojiCached,
@Default(CacheStrategy.whenOneDay) CacheStrategy metaChacheStrategy,
DateTime? latestMetaCached,
@Default(false) bool forceShowAd,
}) = _AccountSettings;
factory AccountSettings.fromJson(Map<String, dynamic> json) =>
_$AccountSettingsFromJson(json);
Acct get acct {
return Acct(
host: host,
username: userId,
);
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/tab_icon.dart | import 'package:freezed_annotation/freezed_annotation.dart';
part 'tab_icon.freezed.dart';
part 'tab_icon.g.dart';
@freezed
class TabIcon with _$TabIcon {
const factory TabIcon({
int? codePoint,
String? customEmojiName,
}) = _TabIcon;
factory TabIcon.fromJson(Map<String, dynamic> json) =>
_$TabIconFromJson(json);
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/note_search_condition.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'note_search_condition.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$NoteSearchCondition {
String? get query => throw _privateConstructorUsedError;
User? get user => throw _privateConstructorUsedError;
CommunityChannel? get channel => throw _privateConstructorUsedError;
bool get localOnly => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$NoteSearchConditionCopyWith<NoteSearchCondition> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $NoteSearchConditionCopyWith<$Res> {
factory $NoteSearchConditionCopyWith(
NoteSearchCondition value, $Res Function(NoteSearchCondition) then) =
_$NoteSearchConditionCopyWithImpl<$Res, NoteSearchCondition>;
@useResult
$Res call(
{String? query, User? user, CommunityChannel? channel, bool localOnly});
$CommunityChannelCopyWith<$Res>? get channel;
}
/// @nodoc
class _$NoteSearchConditionCopyWithImpl<$Res, $Val extends NoteSearchCondition>
implements $NoteSearchConditionCopyWith<$Res> {
_$NoteSearchConditionCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? query = freezed,
Object? user = freezed,
Object? channel = freezed,
Object? localOnly = null,
}) {
return _then(_value.copyWith(
query: freezed == query
? _value.query
: query // ignore: cast_nullable_to_non_nullable
as String?,
user: freezed == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as User?,
channel: freezed == channel
? _value.channel
: channel // ignore: cast_nullable_to_non_nullable
as CommunityChannel?,
localOnly: null == localOnly
? _value.localOnly
: localOnly // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$CommunityChannelCopyWith<$Res>? get channel {
if (_value.channel == null) {
return null;
}
return $CommunityChannelCopyWith<$Res>(_value.channel!, (value) {
return _then(_value.copyWith(channel: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$NoteSearchConditionImplCopyWith<$Res>
implements $NoteSearchConditionCopyWith<$Res> {
factory _$$NoteSearchConditionImplCopyWith(_$NoteSearchConditionImpl value,
$Res Function(_$NoteSearchConditionImpl) then) =
__$$NoteSearchConditionImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String? query, User? user, CommunityChannel? channel, bool localOnly});
@override
$CommunityChannelCopyWith<$Res>? get channel;
}
/// @nodoc
class __$$NoteSearchConditionImplCopyWithImpl<$Res>
extends _$NoteSearchConditionCopyWithImpl<$Res, _$NoteSearchConditionImpl>
implements _$$NoteSearchConditionImplCopyWith<$Res> {
__$$NoteSearchConditionImplCopyWithImpl(_$NoteSearchConditionImpl _value,
$Res Function(_$NoteSearchConditionImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? query = freezed,
Object? user = freezed,
Object? channel = freezed,
Object? localOnly = null,
}) {
return _then(_$NoteSearchConditionImpl(
query: freezed == query
? _value.query
: query // ignore: cast_nullable_to_non_nullable
as String?,
user: freezed == user
? _value.user
: user // ignore: cast_nullable_to_non_nullable
as User?,
channel: freezed == channel
? _value.channel
: channel // ignore: cast_nullable_to_non_nullable
as CommunityChannel?,
localOnly: null == localOnly
? _value.localOnly
: localOnly // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
class _$NoteSearchConditionImpl extends _NoteSearchCondition {
const _$NoteSearchConditionImpl(
{this.query, this.user, this.channel, this.localOnly = false})
: super._();
@override
final String? query;
@override
final User? user;
@override
final CommunityChannel? channel;
@override
@JsonKey()
final bool localOnly;
@override
String toString() {
return 'NoteSearchCondition(query: $query, user: $user, channel: $channel, localOnly: $localOnly)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NoteSearchConditionImpl &&
(identical(other.query, query) || other.query == query) &&
(identical(other.user, user) || other.user == user) &&
(identical(other.channel, channel) || other.channel == channel) &&
(identical(other.localOnly, localOnly) ||
other.localOnly == localOnly));
}
@override
int get hashCode => Object.hash(runtimeType, query, user, channel, localOnly);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NoteSearchConditionImplCopyWith<_$NoteSearchConditionImpl> get copyWith =>
__$$NoteSearchConditionImplCopyWithImpl<_$NoteSearchConditionImpl>(
this, _$identity);
}
abstract class _NoteSearchCondition extends NoteSearchCondition {
const factory _NoteSearchCondition(
{final String? query,
final User? user,
final CommunityChannel? channel,
final bool localOnly}) = _$NoteSearchConditionImpl;
const _NoteSearchCondition._() : super._();
@override
String? get query;
@override
User? get user;
@override
CommunityChannel? get channel;
@override
bool get localOnly;
@override
@JsonKey(ignore: true)
_$$NoteSearchConditionImplCopyWith<_$NoteSearchConditionImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/account_settings.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'account_settings.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$AccountSettingsImpl _$$AccountSettingsImplFromJson(
Map<String, dynamic> json) =>
_$AccountSettingsImpl(
userId: json['userId'] as String,
host: json['host'] as String,
reactions: (json['reactions'] as List<dynamic>?)
?.map((e) => e as String)
.toList() ??
const [],
defaultNoteVisibility: $enumDecodeNullable(
_$NoteVisibilityEnumMap, json['defaultNoteVisibility']) ??
NoteVisibility.public,
defaultIsLocalOnly: json['defaultIsLocalOnly'] as bool? ?? false,
defaultReactionAcceptance: $enumDecodeNullable(
_$ReactionAcceptanceEnumMap, json['defaultReactionAcceptance']) ??
null,
iCacheStrategy:
$enumDecodeNullable(_$CacheStrategyEnumMap, json['iCacheStrategy']) ??
CacheStrategy.whenTabChange,
latestICached: json['latestICached'] == null
? null
: DateTime.parse(json['latestICached'] as String),
emojiCacheStrategy: $enumDecodeNullable(
_$CacheStrategyEnumMap, json['emojiCacheStrategy']) ??
CacheStrategy.whenLaunch,
latestEmojiCached: json['latestEmojiCached'] == null
? null
: DateTime.parse(json['latestEmojiCached'] as String),
metaChacheStrategy: $enumDecodeNullable(
_$CacheStrategyEnumMap, json['metaChacheStrategy']) ??
CacheStrategy.whenOneDay,
latestMetaCached: json['latestMetaCached'] == null
? null
: DateTime.parse(json['latestMetaCached'] as String),
forceShowAd: json['forceShowAd'] as bool? ?? false,
);
Map<String, dynamic> _$$AccountSettingsImplToJson(
_$AccountSettingsImpl instance) =>
<String, dynamic>{
'userId': instance.userId,
'host': instance.host,
'reactions': instance.reactions,
'defaultNoteVisibility':
_$NoteVisibilityEnumMap[instance.defaultNoteVisibility]!,
'defaultIsLocalOnly': instance.defaultIsLocalOnly,
'defaultReactionAcceptance':
_$ReactionAcceptanceEnumMap[instance.defaultReactionAcceptance],
'iCacheStrategy': _$CacheStrategyEnumMap[instance.iCacheStrategy]!,
'latestICached': instance.latestICached?.toIso8601String(),
'emojiCacheStrategy':
_$CacheStrategyEnumMap[instance.emojiCacheStrategy]!,
'latestEmojiCached': instance.latestEmojiCached?.toIso8601String(),
'metaChacheStrategy':
_$CacheStrategyEnumMap[instance.metaChacheStrategy]!,
'latestMetaCached': instance.latestMetaCached?.toIso8601String(),
'forceShowAd': instance.forceShowAd,
};
const _$NoteVisibilityEnumMap = {
NoteVisibility.public: 'public',
NoteVisibility.home: 'home',
NoteVisibility.followers: 'followers',
NoteVisibility.specified: 'specified',
};
const _$ReactionAcceptanceEnumMap = {
ReactionAcceptance.likeOnlyForRemote: 'likeOnlyForRemote',
ReactionAcceptance.nonSensitiveOnly: 'nonSensitiveOnly',
ReactionAcceptance.nonSensitiveOnlyForLocalLikeOnlyForRemote:
'nonSensitiveOnlyForLocalLikeOnlyForRemote',
ReactionAcceptance.likeOnly: 'likeOnly',
};
const _$CacheStrategyEnumMap = {
CacheStrategy.whenTabChange: 'whenTabChange',
CacheStrategy.whenLaunch: 'whenLaunch',
CacheStrategy.whenOneDay: 'whenOneDay',
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/acct.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'acct.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
Acct _$AcctFromJson(Map<String, dynamic> json) {
return _Acct.fromJson(json);
}
/// @nodoc
mixin _$Acct {
String get host => throw _privateConstructorUsedError;
String get username => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$AcctCopyWith<Acct> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AcctCopyWith<$Res> {
factory $AcctCopyWith(Acct value, $Res Function(Acct) then) =
_$AcctCopyWithImpl<$Res, Acct>;
@useResult
$Res call({String host, String username});
}
/// @nodoc
class _$AcctCopyWithImpl<$Res, $Val extends Acct>
implements $AcctCopyWith<$Res> {
_$AcctCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? host = null,
Object? username = null,
}) {
return _then(_value.copyWith(
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
username: null == username
? _value.username
: username // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$AcctImplCopyWith<$Res> implements $AcctCopyWith<$Res> {
factory _$$AcctImplCopyWith(
_$AcctImpl value, $Res Function(_$AcctImpl) then) =
__$$AcctImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String host, String username});
}
/// @nodoc
class __$$AcctImplCopyWithImpl<$Res>
extends _$AcctCopyWithImpl<$Res, _$AcctImpl>
implements _$$AcctImplCopyWith<$Res> {
__$$AcctImplCopyWithImpl(_$AcctImpl _value, $Res Function(_$AcctImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? host = null,
Object? username = null,
}) {
return _then(_$AcctImpl(
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
username: null == username
? _value.username
: username // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$AcctImpl extends _Acct {
const _$AcctImpl({required this.host, required this.username}) : super._();
factory _$AcctImpl.fromJson(Map<String, dynamic> json) =>
_$$AcctImplFromJson(json);
@override
final String host;
@override
final String username;
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AcctImpl &&
(identical(other.host, host) || other.host == host) &&
(identical(other.username, username) ||
other.username == username));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, host, username);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$AcctImplCopyWith<_$AcctImpl> get copyWith =>
__$$AcctImplCopyWithImpl<_$AcctImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$AcctImplToJson(
this,
);
}
}
abstract class _Acct extends Acct {
const factory _Acct(
{required final String host,
required final String username}) = _$AcctImpl;
const _Acct._() : super._();
factory _Acct.fromJson(Map<String, dynamic> json) = _$AcctImpl.fromJson;
@override
String get host;
@override
String get username;
@override
@JsonKey(ignore: true)
_$$AcctImplCopyWith<_$AcctImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/clip_settings.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'clip_settings.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$ClipSettings {
String get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
bool get isPublic => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ClipSettingsCopyWith<ClipSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ClipSettingsCopyWith<$Res> {
factory $ClipSettingsCopyWith(
ClipSettings value, $Res Function(ClipSettings) then) =
_$ClipSettingsCopyWithImpl<$Res, ClipSettings>;
@useResult
$Res call({String name, String? description, bool isPublic});
}
/// @nodoc
class _$ClipSettingsCopyWithImpl<$Res, $Val extends ClipSettings>
implements $ClipSettingsCopyWith<$Res> {
_$ClipSettingsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? description = freezed,
Object? isPublic = null,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
isPublic: null == isPublic
? _value.isPublic
: isPublic // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$ClipSettingsImplCopyWith<$Res>
implements $ClipSettingsCopyWith<$Res> {
factory _$$ClipSettingsImplCopyWith(
_$ClipSettingsImpl value, $Res Function(_$ClipSettingsImpl) then) =
__$$ClipSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String name, String? description, bool isPublic});
}
/// @nodoc
class __$$ClipSettingsImplCopyWithImpl<$Res>
extends _$ClipSettingsCopyWithImpl<$Res, _$ClipSettingsImpl>
implements _$$ClipSettingsImplCopyWith<$Res> {
__$$ClipSettingsImplCopyWithImpl(
_$ClipSettingsImpl _value, $Res Function(_$ClipSettingsImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? description = freezed,
Object? isPublic = null,
}) {
return _then(_$ClipSettingsImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
isPublic: null == isPublic
? _value.isPublic
: isPublic // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
class _$ClipSettingsImpl extends _ClipSettings {
const _$ClipSettingsImpl(
{this.name = "", this.description, this.isPublic = false})
: super._();
@override
@JsonKey()
final String name;
@override
final String? description;
@override
@JsonKey()
final bool isPublic;
@override
String toString() {
return 'ClipSettings(name: $name, description: $description, isPublic: $isPublic)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ClipSettingsImpl &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.isPublic, isPublic) ||
other.isPublic == isPublic));
}
@override
int get hashCode => Object.hash(runtimeType, name, description, isPublic);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ClipSettingsImplCopyWith<_$ClipSettingsImpl> get copyWith =>
__$$ClipSettingsImplCopyWithImpl<_$ClipSettingsImpl>(this, _$identity);
}
abstract class _ClipSettings extends ClipSettings {
const factory _ClipSettings(
{final String name,
final String? description,
final bool isPublic}) = _$ClipSettingsImpl;
const _ClipSettings._() : super._();
@override
String get name;
@override
String? get description;
@override
bool get isPublic;
@override
@JsonKey(ignore: true)
_$$ClipSettingsImplCopyWith<_$ClipSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/account.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'account.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
Account _$AccountFromJson(Map<String, dynamic> json) {
return _Account.fromJson(json);
}
/// @nodoc
mixin _$Account {
String get host => throw _privateConstructorUsedError;
String get userId => throw _privateConstructorUsedError;
String? get token => throw _privateConstructorUsedError;
MeDetailed get i => throw _privateConstructorUsedError;
MetaResponse? get meta => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$AccountCopyWith<Account> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AccountCopyWith<$Res> {
factory $AccountCopyWith(Account value, $Res Function(Account) then) =
_$AccountCopyWithImpl<$Res, Account>;
@useResult
$Res call(
{String host,
String userId,
String? token,
MeDetailed i,
MetaResponse? meta});
$MeDetailedCopyWith<$Res> get i;
$MetaResponseCopyWith<$Res>? get meta;
}
/// @nodoc
class _$AccountCopyWithImpl<$Res, $Val extends Account>
implements $AccountCopyWith<$Res> {
_$AccountCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? host = null,
Object? userId = null,
Object? token = freezed,
Object? i = null,
Object? meta = freezed,
}) {
return _then(_value.copyWith(
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
token: freezed == token
? _value.token
: token // ignore: cast_nullable_to_non_nullable
as String?,
i: null == i
? _value.i
: i // ignore: cast_nullable_to_non_nullable
as MeDetailed,
meta: freezed == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as MetaResponse?,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$MeDetailedCopyWith<$Res> get i {
return $MeDetailedCopyWith<$Res>(_value.i, (value) {
return _then(_value.copyWith(i: value) as $Val);
});
}
@override
@pragma('vm:prefer-inline')
$MetaResponseCopyWith<$Res>? get meta {
if (_value.meta == null) {
return null;
}
return $MetaResponseCopyWith<$Res>(_value.meta!, (value) {
return _then(_value.copyWith(meta: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$AccountImplCopyWith<$Res> implements $AccountCopyWith<$Res> {
factory _$$AccountImplCopyWith(
_$AccountImpl value, $Res Function(_$AccountImpl) then) =
__$$AccountImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String host,
String userId,
String? token,
MeDetailed i,
MetaResponse? meta});
@override
$MeDetailedCopyWith<$Res> get i;
@override
$MetaResponseCopyWith<$Res>? get meta;
}
/// @nodoc
class __$$AccountImplCopyWithImpl<$Res>
extends _$AccountCopyWithImpl<$Res, _$AccountImpl>
implements _$$AccountImplCopyWith<$Res> {
__$$AccountImplCopyWithImpl(
_$AccountImpl _value, $Res Function(_$AccountImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? host = null,
Object? userId = null,
Object? token = freezed,
Object? i = null,
Object? meta = freezed,
}) {
return _then(_$AccountImpl(
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
token: freezed == token
? _value.token
: token // ignore: cast_nullable_to_non_nullable
as String?,
i: null == i
? _value.i
: i // ignore: cast_nullable_to_non_nullable
as MeDetailed,
meta: freezed == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as MetaResponse?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$AccountImpl extends _Account {
const _$AccountImpl(
{required this.host,
required this.userId,
this.token,
required this.i,
this.meta})
: super._();
factory _$AccountImpl.fromJson(Map<String, dynamic> json) =>
_$$AccountImplFromJson(json);
@override
final String host;
@override
final String userId;
@override
final String? token;
@override
final MeDetailed i;
@override
final MetaResponse? meta;
@override
String toString() {
return 'Account(host: $host, userId: $userId, token: $token, i: $i, meta: $meta)';
}
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$AccountImplCopyWith<_$AccountImpl> get copyWith =>
__$$AccountImplCopyWithImpl<_$AccountImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$AccountImplToJson(
this,
);
}
}
abstract class _Account extends Account {
const factory _Account(
{required final String host,
required final String userId,
final String? token,
required final MeDetailed i,
final MetaResponse? meta}) = _$AccountImpl;
const _Account._() : super._();
factory _Account.fromJson(Map<String, dynamic> json) = _$AccountImpl.fromJson;
@override
String get host;
@override
String get userId;
@override
String? get token;
@override
MeDetailed get i;
@override
MetaResponse? get meta;
@override
@JsonKey(ignore: true)
_$$AccountImplCopyWith<_$AccountImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/summaly_result.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'summaly_result.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
SummalyResult _$SummalyResultFromJson(Map<String, dynamic> json) {
return _SummalyResult.fromJson(json);
}
/// @nodoc
mixin _$SummalyResult {
String? get title => throw _privateConstructorUsedError;
String? get icon => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String? get thumbnail => throw _privateConstructorUsedError;
Player get player => throw _privateConstructorUsedError;
String? get sitename => throw _privateConstructorUsedError;
bool? get sensitive => throw _privateConstructorUsedError;
String? get url => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$SummalyResultCopyWith<SummalyResult> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $SummalyResultCopyWith<$Res> {
factory $SummalyResultCopyWith(
SummalyResult value, $Res Function(SummalyResult) then) =
_$SummalyResultCopyWithImpl<$Res, SummalyResult>;
@useResult
$Res call(
{String? title,
String? icon,
String? description,
String? thumbnail,
Player player,
String? sitename,
bool? sensitive,
String? url});
$PlayerCopyWith<$Res> get player;
}
/// @nodoc
class _$SummalyResultCopyWithImpl<$Res, $Val extends SummalyResult>
implements $SummalyResultCopyWith<$Res> {
_$SummalyResultCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? title = freezed,
Object? icon = freezed,
Object? description = freezed,
Object? thumbnail = freezed,
Object? player = null,
Object? sitename = freezed,
Object? sensitive = freezed,
Object? url = freezed,
}) {
return _then(_value.copyWith(
title: freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
icon: freezed == icon
? _value.icon
: icon // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
thumbnail: freezed == thumbnail
? _value.thumbnail
: thumbnail // ignore: cast_nullable_to_non_nullable
as String?,
player: null == player
? _value.player
: player // ignore: cast_nullable_to_non_nullable
as Player,
sitename: freezed == sitename
? _value.sitename
: sitename // ignore: cast_nullable_to_non_nullable
as String?,
sensitive: freezed == sensitive
? _value.sensitive
: sensitive // ignore: cast_nullable_to_non_nullable
as bool?,
url: freezed == url
? _value.url
: url // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$PlayerCopyWith<$Res> get player {
return $PlayerCopyWith<$Res>(_value.player, (value) {
return _then(_value.copyWith(player: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$SummalyResultImplCopyWith<$Res>
implements $SummalyResultCopyWith<$Res> {
factory _$$SummalyResultImplCopyWith(
_$SummalyResultImpl value, $Res Function(_$SummalyResultImpl) then) =
__$$SummalyResultImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String? title,
String? icon,
String? description,
String? thumbnail,
Player player,
String? sitename,
bool? sensitive,
String? url});
@override
$PlayerCopyWith<$Res> get player;
}
/// @nodoc
class __$$SummalyResultImplCopyWithImpl<$Res>
extends _$SummalyResultCopyWithImpl<$Res, _$SummalyResultImpl>
implements _$$SummalyResultImplCopyWith<$Res> {
__$$SummalyResultImplCopyWithImpl(
_$SummalyResultImpl _value, $Res Function(_$SummalyResultImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? title = freezed,
Object? icon = freezed,
Object? description = freezed,
Object? thumbnail = freezed,
Object? player = null,
Object? sitename = freezed,
Object? sensitive = freezed,
Object? url = freezed,
}) {
return _then(_$SummalyResultImpl(
title: freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
icon: freezed == icon
? _value.icon
: icon // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
thumbnail: freezed == thumbnail
? _value.thumbnail
: thumbnail // ignore: cast_nullable_to_non_nullable
as String?,
player: null == player
? _value.player
: player // ignore: cast_nullable_to_non_nullable
as Player,
sitename: freezed == sitename
? _value.sitename
: sitename // ignore: cast_nullable_to_non_nullable
as String?,
sensitive: freezed == sensitive
? _value.sensitive
: sensitive // ignore: cast_nullable_to_non_nullable
as bool?,
url: freezed == url
? _value.url
: url // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$SummalyResultImpl implements _SummalyResult {
const _$SummalyResultImpl(
{this.title,
this.icon,
this.description,
this.thumbnail,
required this.player,
this.sitename,
this.sensitive,
this.url});
factory _$SummalyResultImpl.fromJson(Map<String, dynamic> json) =>
_$$SummalyResultImplFromJson(json);
@override
final String? title;
@override
final String? icon;
@override
final String? description;
@override
final String? thumbnail;
@override
final Player player;
@override
final String? sitename;
@override
final bool? sensitive;
@override
final String? url;
@override
String toString() {
return 'SummalyResult(title: $title, icon: $icon, description: $description, thumbnail: $thumbnail, player: $player, sitename: $sitename, sensitive: $sensitive, url: $url)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SummalyResultImpl &&
(identical(other.title, title) || other.title == title) &&
(identical(other.icon, icon) || other.icon == icon) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.thumbnail, thumbnail) ||
other.thumbnail == thumbnail) &&
(identical(other.player, player) || other.player == player) &&
(identical(other.sitename, sitename) ||
other.sitename == sitename) &&
(identical(other.sensitive, sensitive) ||
other.sensitive == sensitive) &&
(identical(other.url, url) || other.url == url));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, title, icon, description,
thumbnail, player, sitename, sensitive, url);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$SummalyResultImplCopyWith<_$SummalyResultImpl> get copyWith =>
__$$SummalyResultImplCopyWithImpl<_$SummalyResultImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$SummalyResultImplToJson(
this,
);
}
}
abstract class _SummalyResult implements SummalyResult {
const factory _SummalyResult(
{final String? title,
final String? icon,
final String? description,
final String? thumbnail,
required final Player player,
final String? sitename,
final bool? sensitive,
final String? url}) = _$SummalyResultImpl;
factory _SummalyResult.fromJson(Map<String, dynamic> json) =
_$SummalyResultImpl.fromJson;
@override
String? get title;
@override
String? get icon;
@override
String? get description;
@override
String? get thumbnail;
@override
Player get player;
@override
String? get sitename;
@override
bool? get sensitive;
@override
String? get url;
@override
@JsonKey(ignore: true)
_$$SummalyResultImplCopyWith<_$SummalyResultImpl> get copyWith =>
throw _privateConstructorUsedError;
}
Player _$PlayerFromJson(Map<String, dynamic> json) {
return _Player.fromJson(json);
}
/// @nodoc
mixin _$Player {
String? get url => throw _privateConstructorUsedError;
double? get width => throw _privateConstructorUsedError;
double? get height => throw _privateConstructorUsedError;
List<String>? get allow => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$PlayerCopyWith<Player> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PlayerCopyWith<$Res> {
factory $PlayerCopyWith(Player value, $Res Function(Player) then) =
_$PlayerCopyWithImpl<$Res, Player>;
@useResult
$Res call({String? url, double? width, double? height, List<String>? allow});
}
/// @nodoc
class _$PlayerCopyWithImpl<$Res, $Val extends Player>
implements $PlayerCopyWith<$Res> {
_$PlayerCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? url = freezed,
Object? width = freezed,
Object? height = freezed,
Object? allow = freezed,
}) {
return _then(_value.copyWith(
url: freezed == url
? _value.url
: url // ignore: cast_nullable_to_non_nullable
as String?,
width: freezed == width
? _value.width
: width // ignore: cast_nullable_to_non_nullable
as double?,
height: freezed == height
? _value.height
: height // ignore: cast_nullable_to_non_nullable
as double?,
allow: freezed == allow
? _value.allow
: allow // ignore: cast_nullable_to_non_nullable
as List<String>?,
) as $Val);
}
}
/// @nodoc
abstract class _$$PlayerImplCopyWith<$Res> implements $PlayerCopyWith<$Res> {
factory _$$PlayerImplCopyWith(
_$PlayerImpl value, $Res Function(_$PlayerImpl) then) =
__$$PlayerImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String? url, double? width, double? height, List<String>? allow});
}
/// @nodoc
class __$$PlayerImplCopyWithImpl<$Res>
extends _$PlayerCopyWithImpl<$Res, _$PlayerImpl>
implements _$$PlayerImplCopyWith<$Res> {
__$$PlayerImplCopyWithImpl(
_$PlayerImpl _value, $Res Function(_$PlayerImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? url = freezed,
Object? width = freezed,
Object? height = freezed,
Object? allow = freezed,
}) {
return _then(_$PlayerImpl(
url: freezed == url
? _value.url
: url // ignore: cast_nullable_to_non_nullable
as String?,
width: freezed == width
? _value.width
: width // ignore: cast_nullable_to_non_nullable
as double?,
height: freezed == height
? _value.height
: height // ignore: cast_nullable_to_non_nullable
as double?,
allow: freezed == allow
? _value._allow
: allow // ignore: cast_nullable_to_non_nullable
as List<String>?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$PlayerImpl implements _Player {
const _$PlayerImpl(
{this.url, this.width, this.height, final List<String>? allow})
: _allow = allow;
factory _$PlayerImpl.fromJson(Map<String, dynamic> json) =>
_$$PlayerImplFromJson(json);
@override
final String? url;
@override
final double? width;
@override
final double? height;
final List<String>? _allow;
@override
List<String>? get allow {
final value = _allow;
if (value == null) return null;
if (_allow is EqualUnmodifiableListView) return _allow;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
@override
String toString() {
return 'Player(url: $url, width: $width, height: $height, allow: $allow)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PlayerImpl &&
(identical(other.url, url) || other.url == url) &&
(identical(other.width, width) || other.width == width) &&
(identical(other.height, height) || other.height == height) &&
const DeepCollectionEquality().equals(other._allow, _allow));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, url, width, height,
const DeepCollectionEquality().hash(_allow));
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PlayerImplCopyWith<_$PlayerImpl> get copyWith =>
__$$PlayerImplCopyWithImpl<_$PlayerImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$PlayerImplToJson(
this,
);
}
}
abstract class _Player implements Player {
const factory _Player(
{final String? url,
final double? width,
final double? height,
final List<String>? allow}) = _$PlayerImpl;
factory _Player.fromJson(Map<String, dynamic> json) = _$PlayerImpl.fromJson;
@override
String? get url;
@override
double? get width;
@override
double? get height;
@override
List<String>? get allow;
@override
@JsonKey(ignore: true)
_$$PlayerImplCopyWith<_$PlayerImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/tab_type.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/tab_setting.dart';
import 'package:miria/providers.dart';
import 'package:miria/repository/time_line_repository.dart';
enum TabType {
localTimeline,
homeTimeline,
globalTimeline,
hybridTimeline,
roleTimeline,
channel,
userList,
antenna,
;
String displayName(BuildContext context) {
return switch (this) {
TabType.localTimeline => S.of(context).localTimeline,
TabType.homeTimeline => S.of(context).homeTimeline,
TabType.globalTimeline => S.of(context).globalTimeline,
TabType.hybridTimeline => S.of(context).socialTimeline,
TabType.roleTimeline => S.of(context).roleTimeline,
TabType.channel => S.of(context).channel,
TabType.userList => S.of(context).list,
TabType.antenna => S.of(context).antenna,
};
}
ChangeNotifierProvider<TimelineRepository> timelineProvider(
TabSetting setting) {
switch (this) {
case TabType.localTimeline:
return localTimeLineProvider(setting);
case TabType.homeTimeline:
return homeTimeLineProvider(setting);
case TabType.globalTimeline:
return globalTimeLineProvider(setting);
case TabType.hybridTimeline:
return hybridTimeLineProvider(setting); //FIXME
case TabType.roleTimeline:
return roleTimelineProvider(setting);
case TabType.channel:
return channelTimelineProvider(setting);
case TabType.userList:
return userListTimelineProvider(setting);
case TabType.antenna:
return antennaTimelineProvider(setting);
}
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/tab_setting.dart | import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:miria/model/acct.dart';
import 'package:miria/model/converters/icon_converter.dart';
import 'package:miria/model/tab_icon.dart';
import 'package:miria/model/tab_type.dart';
import 'package:miria/repository/time_line_repository.dart';
part 'tab_setting.freezed.dart';
part 'tab_setting.g.dart';
Map<String, dynamic> _readAcct(Map<dynamic, dynamic> json, String name) {
final account = json["account"];
if (account != null) {
return {
"host": account["host"],
"username": account["userId"],
};
}
return json[name]! as Map<String, dynamic>;
}
@freezed
class TabSetting with _$TabSetting {
const TabSetting._();
ChangeNotifierProvider<TimelineRepository> get timelineProvider =>
tabType.timelineProvider(this);
const factory TabSetting({
@IconDataConverter() required TabIcon icon,
/// タブ種別
required TabType tabType,
/// ロールタイムラインのノートの場合、ロールID
String? roleId,
/// チャンネルのノートの場合、チャンネルID
String? channelId,
/// リストのノートの場合、リストID
String? listId,
/// アンテナのノートの場合、アンテナID
String? antennaId,
/// ノートの投稿のキャプチャをするかどうか
@Default(true) bool isSubscribe,
/// 返信を含むかどうか
@Default(true) bool isIncludeReplies,
/// ファイルのみにするかどうか
@Default(false) bool isMediaOnly,
/// タブ名
String? name,
/// アカウント情報
// https://github.com/rrousselGit/freezed/issues/488
// ignore: invalid_annotation_target
@JsonKey(readValue: _readAcct) required Acct acct,
/// Renoteを表示するかどうか
@Default(true) bool renoteDisplay,
}) = _TabSetting;
factory TabSetting.fromJson(Map<String, Object?> json) =>
_$TabSettingFromJson(json);
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/users_list_settings.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'users_list_settings.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$UsersListSettings {
String get name => throw _privateConstructorUsedError;
bool get isPublic => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$UsersListSettingsCopyWith<UsersListSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UsersListSettingsCopyWith<$Res> {
factory $UsersListSettingsCopyWith(
UsersListSettings value, $Res Function(UsersListSettings) then) =
_$UsersListSettingsCopyWithImpl<$Res, UsersListSettings>;
@useResult
$Res call({String name, bool isPublic});
}
/// @nodoc
class _$UsersListSettingsCopyWithImpl<$Res, $Val extends UsersListSettings>
implements $UsersListSettingsCopyWith<$Res> {
_$UsersListSettingsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? isPublic = null,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
isPublic: null == isPublic
? _value.isPublic
: isPublic // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$UsersListSettingsImplCopyWith<$Res>
implements $UsersListSettingsCopyWith<$Res> {
factory _$$UsersListSettingsImplCopyWith(_$UsersListSettingsImpl value,
$Res Function(_$UsersListSettingsImpl) then) =
__$$UsersListSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String name, bool isPublic});
}
/// @nodoc
class __$$UsersListSettingsImplCopyWithImpl<$Res>
extends _$UsersListSettingsCopyWithImpl<$Res, _$UsersListSettingsImpl>
implements _$$UsersListSettingsImplCopyWith<$Res> {
__$$UsersListSettingsImplCopyWithImpl(_$UsersListSettingsImpl _value,
$Res Function(_$UsersListSettingsImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? isPublic = null,
}) {
return _then(_$UsersListSettingsImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
isPublic: null == isPublic
? _value.isPublic
: isPublic // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
class _$UsersListSettingsImpl extends _UsersListSettings {
const _$UsersListSettingsImpl({this.name = "", this.isPublic = false})
: super._();
@override
@JsonKey()
final String name;
@override
@JsonKey()
final bool isPublic;
@override
String toString() {
return 'UsersListSettings(name: $name, isPublic: $isPublic)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UsersListSettingsImpl &&
(identical(other.name, name) || other.name == name) &&
(identical(other.isPublic, isPublic) ||
other.isPublic == isPublic));
}
@override
int get hashCode => Object.hash(runtimeType, name, isPublic);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$UsersListSettingsImplCopyWith<_$UsersListSettingsImpl> get copyWith =>
__$$UsersListSettingsImplCopyWithImpl<_$UsersListSettingsImpl>(
this, _$identity);
}
abstract class _UsersListSettings extends UsersListSettings {
const factory _UsersListSettings({final String name, final bool isPublic}) =
_$UsersListSettingsImpl;
const _UsersListSettings._() : super._();
@override
String get name;
@override
bool get isPublic;
@override
@JsonKey(ignore: true)
_$$UsersListSettingsImplCopyWith<_$UsersListSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/users_list_settings.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:misskey_dart/misskey_dart.dart';
part 'users_list_settings.freezed.dart';
@freezed
class UsersListSettings with _$UsersListSettings {
const factory UsersListSettings({
@Default("") String name,
@Default(false) bool isPublic,
}) = _UsersListSettings;
const UsersListSettings._();
factory UsersListSettings.fromUsersList(UsersList list) {
return UsersListSettings(
name: list.name ?? "",
isPublic: list.isPublic ?? false,
);
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/federation_data.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'federation_data.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$FederationData {
String? get bannerUrl => throw _privateConstructorUsedError;
String? get faviconUrl => throw _privateConstructorUsedError;
String? get tosUrl => throw _privateConstructorUsedError;
String? get privacyPolicyUrl => throw _privateConstructorUsedError;
String? get impressumUrl => throw _privateConstructorUsedError;
String? get repositoryUrl => throw _privateConstructorUsedError;
List<String> get serverRules => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String get description => throw _privateConstructorUsedError;
String? get maintainerName => throw _privateConstructorUsedError;
String? get maintainerEmail => throw _privateConstructorUsedError;
int? get usersCount => throw _privateConstructorUsedError;
int? get notesCount => throw _privateConstructorUsedError;
int? get reactionCount => throw _privateConstructorUsedError;
String get softwareName => throw _privateConstructorUsedError;
String get softwareVersion => throw _privateConstructorUsedError;
List<String> get languages => throw _privateConstructorUsedError;
List<MetaAd> get ads => throw _privateConstructorUsedError;
bool get isSupportedEmoji => throw _privateConstructorUsedError;
bool get isSupportedAnnouncement => throw _privateConstructorUsedError;
bool get isSupportedLocalTimeline => throw _privateConstructorUsedError;
MetaResponse? get meta => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$FederationDataCopyWith<FederationData> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $FederationDataCopyWith<$Res> {
factory $FederationDataCopyWith(
FederationData value, $Res Function(FederationData) then) =
_$FederationDataCopyWithImpl<$Res, FederationData>;
@useResult
$Res call(
{String? bannerUrl,
String? faviconUrl,
String? tosUrl,
String? privacyPolicyUrl,
String? impressumUrl,
String? repositoryUrl,
List<String> serverRules,
String name,
String description,
String? maintainerName,
String? maintainerEmail,
int? usersCount,
int? notesCount,
int? reactionCount,
String softwareName,
String softwareVersion,
List<String> languages,
List<MetaAd> ads,
bool isSupportedEmoji,
bool isSupportedAnnouncement,
bool isSupportedLocalTimeline,
MetaResponse? meta});
$MetaResponseCopyWith<$Res>? get meta;
}
/// @nodoc
class _$FederationDataCopyWithImpl<$Res, $Val extends FederationData>
implements $FederationDataCopyWith<$Res> {
_$FederationDataCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? bannerUrl = freezed,
Object? faviconUrl = freezed,
Object? tosUrl = freezed,
Object? privacyPolicyUrl = freezed,
Object? impressumUrl = freezed,
Object? repositoryUrl = freezed,
Object? serverRules = null,
Object? name = null,
Object? description = null,
Object? maintainerName = freezed,
Object? maintainerEmail = freezed,
Object? usersCount = freezed,
Object? notesCount = freezed,
Object? reactionCount = freezed,
Object? softwareName = null,
Object? softwareVersion = null,
Object? languages = null,
Object? ads = null,
Object? isSupportedEmoji = null,
Object? isSupportedAnnouncement = null,
Object? isSupportedLocalTimeline = null,
Object? meta = freezed,
}) {
return _then(_value.copyWith(
bannerUrl: freezed == bannerUrl
? _value.bannerUrl
: bannerUrl // ignore: cast_nullable_to_non_nullable
as String?,
faviconUrl: freezed == faviconUrl
? _value.faviconUrl
: faviconUrl // ignore: cast_nullable_to_non_nullable
as String?,
tosUrl: freezed == tosUrl
? _value.tosUrl
: tosUrl // ignore: cast_nullable_to_non_nullable
as String?,
privacyPolicyUrl: freezed == privacyPolicyUrl
? _value.privacyPolicyUrl
: privacyPolicyUrl // ignore: cast_nullable_to_non_nullable
as String?,
impressumUrl: freezed == impressumUrl
? _value.impressumUrl
: impressumUrl // ignore: cast_nullable_to_non_nullable
as String?,
repositoryUrl: freezed == repositoryUrl
? _value.repositoryUrl
: repositoryUrl // ignore: cast_nullable_to_non_nullable
as String?,
serverRules: null == serverRules
? _value.serverRules
: serverRules // ignore: cast_nullable_to_non_nullable
as List<String>,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
maintainerName: freezed == maintainerName
? _value.maintainerName
: maintainerName // ignore: cast_nullable_to_non_nullable
as String?,
maintainerEmail: freezed == maintainerEmail
? _value.maintainerEmail
: maintainerEmail // ignore: cast_nullable_to_non_nullable
as String?,
usersCount: freezed == usersCount
? _value.usersCount
: usersCount // ignore: cast_nullable_to_non_nullable
as int?,
notesCount: freezed == notesCount
? _value.notesCount
: notesCount // ignore: cast_nullable_to_non_nullable
as int?,
reactionCount: freezed == reactionCount
? _value.reactionCount
: reactionCount // ignore: cast_nullable_to_non_nullable
as int?,
softwareName: null == softwareName
? _value.softwareName
: softwareName // ignore: cast_nullable_to_non_nullable
as String,
softwareVersion: null == softwareVersion
? _value.softwareVersion
: softwareVersion // ignore: cast_nullable_to_non_nullable
as String,
languages: null == languages
? _value.languages
: languages // ignore: cast_nullable_to_non_nullable
as List<String>,
ads: null == ads
? _value.ads
: ads // ignore: cast_nullable_to_non_nullable
as List<MetaAd>,
isSupportedEmoji: null == isSupportedEmoji
? _value.isSupportedEmoji
: isSupportedEmoji // ignore: cast_nullable_to_non_nullable
as bool,
isSupportedAnnouncement: null == isSupportedAnnouncement
? _value.isSupportedAnnouncement
: isSupportedAnnouncement // ignore: cast_nullable_to_non_nullable
as bool,
isSupportedLocalTimeline: null == isSupportedLocalTimeline
? _value.isSupportedLocalTimeline
: isSupportedLocalTimeline // ignore: cast_nullable_to_non_nullable
as bool,
meta: freezed == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as MetaResponse?,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$MetaResponseCopyWith<$Res>? get meta {
if (_value.meta == null) {
return null;
}
return $MetaResponseCopyWith<$Res>(_value.meta!, (value) {
return _then(_value.copyWith(meta: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$FederationDataImplCopyWith<$Res>
implements $FederationDataCopyWith<$Res> {
factory _$$FederationDataImplCopyWith(_$FederationDataImpl value,
$Res Function(_$FederationDataImpl) then) =
__$$FederationDataImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String? bannerUrl,
String? faviconUrl,
String? tosUrl,
String? privacyPolicyUrl,
String? impressumUrl,
String? repositoryUrl,
List<String> serverRules,
String name,
String description,
String? maintainerName,
String? maintainerEmail,
int? usersCount,
int? notesCount,
int? reactionCount,
String softwareName,
String softwareVersion,
List<String> languages,
List<MetaAd> ads,
bool isSupportedEmoji,
bool isSupportedAnnouncement,
bool isSupportedLocalTimeline,
MetaResponse? meta});
@override
$MetaResponseCopyWith<$Res>? get meta;
}
/// @nodoc
class __$$FederationDataImplCopyWithImpl<$Res>
extends _$FederationDataCopyWithImpl<$Res, _$FederationDataImpl>
implements _$$FederationDataImplCopyWith<$Res> {
__$$FederationDataImplCopyWithImpl(
_$FederationDataImpl _value, $Res Function(_$FederationDataImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? bannerUrl = freezed,
Object? faviconUrl = freezed,
Object? tosUrl = freezed,
Object? privacyPolicyUrl = freezed,
Object? impressumUrl = freezed,
Object? repositoryUrl = freezed,
Object? serverRules = null,
Object? name = null,
Object? description = null,
Object? maintainerName = freezed,
Object? maintainerEmail = freezed,
Object? usersCount = freezed,
Object? notesCount = freezed,
Object? reactionCount = freezed,
Object? softwareName = null,
Object? softwareVersion = null,
Object? languages = null,
Object? ads = null,
Object? isSupportedEmoji = null,
Object? isSupportedAnnouncement = null,
Object? isSupportedLocalTimeline = null,
Object? meta = freezed,
}) {
return _then(_$FederationDataImpl(
bannerUrl: freezed == bannerUrl
? _value.bannerUrl
: bannerUrl // ignore: cast_nullable_to_non_nullable
as String?,
faviconUrl: freezed == faviconUrl
? _value.faviconUrl
: faviconUrl // ignore: cast_nullable_to_non_nullable
as String?,
tosUrl: freezed == tosUrl
? _value.tosUrl
: tosUrl // ignore: cast_nullable_to_non_nullable
as String?,
privacyPolicyUrl: freezed == privacyPolicyUrl
? _value.privacyPolicyUrl
: privacyPolicyUrl // ignore: cast_nullable_to_non_nullable
as String?,
impressumUrl: freezed == impressumUrl
? _value.impressumUrl
: impressumUrl // ignore: cast_nullable_to_non_nullable
as String?,
repositoryUrl: freezed == repositoryUrl
? _value.repositoryUrl
: repositoryUrl // ignore: cast_nullable_to_non_nullable
as String?,
serverRules: null == serverRules
? _value._serverRules
: serverRules // ignore: cast_nullable_to_non_nullable
as List<String>,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
maintainerName: freezed == maintainerName
? _value.maintainerName
: maintainerName // ignore: cast_nullable_to_non_nullable
as String?,
maintainerEmail: freezed == maintainerEmail
? _value.maintainerEmail
: maintainerEmail // ignore: cast_nullable_to_non_nullable
as String?,
usersCount: freezed == usersCount
? _value.usersCount
: usersCount // ignore: cast_nullable_to_non_nullable
as int?,
notesCount: freezed == notesCount
? _value.notesCount
: notesCount // ignore: cast_nullable_to_non_nullable
as int?,
reactionCount: freezed == reactionCount
? _value.reactionCount
: reactionCount // ignore: cast_nullable_to_non_nullable
as int?,
softwareName: null == softwareName
? _value.softwareName
: softwareName // ignore: cast_nullable_to_non_nullable
as String,
softwareVersion: null == softwareVersion
? _value.softwareVersion
: softwareVersion // ignore: cast_nullable_to_non_nullable
as String,
languages: null == languages
? _value._languages
: languages // ignore: cast_nullable_to_non_nullable
as List<String>,
ads: null == ads
? _value._ads
: ads // ignore: cast_nullable_to_non_nullable
as List<MetaAd>,
isSupportedEmoji: null == isSupportedEmoji
? _value.isSupportedEmoji
: isSupportedEmoji // ignore: cast_nullable_to_non_nullable
as bool,
isSupportedAnnouncement: null == isSupportedAnnouncement
? _value.isSupportedAnnouncement
: isSupportedAnnouncement // ignore: cast_nullable_to_non_nullable
as bool,
isSupportedLocalTimeline: null == isSupportedLocalTimeline
? _value.isSupportedLocalTimeline
: isSupportedLocalTimeline // ignore: cast_nullable_to_non_nullable
as bool,
meta: freezed == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as MetaResponse?,
));
}
}
/// @nodoc
class _$FederationDataImpl implements _FederationData {
const _$FederationDataImpl(
{this.bannerUrl,
this.faviconUrl,
this.tosUrl,
this.privacyPolicyUrl,
this.impressumUrl,
this.repositoryUrl,
final List<String> serverRules = const [],
this.name = "",
this.description = "",
this.maintainerName,
this.maintainerEmail,
this.usersCount,
this.notesCount,
this.reactionCount,
this.softwareName = "",
this.softwareVersion = "",
final List<String> languages = const [],
final List<MetaAd> ads = const [],
required this.isSupportedEmoji,
required this.isSupportedAnnouncement,
required this.isSupportedLocalTimeline,
this.meta})
: _serverRules = serverRules,
_languages = languages,
_ads = ads;
@override
final String? bannerUrl;
@override
final String? faviconUrl;
@override
final String? tosUrl;
@override
final String? privacyPolicyUrl;
@override
final String? impressumUrl;
@override
final String? repositoryUrl;
final List<String> _serverRules;
@override
@JsonKey()
List<String> get serverRules {
if (_serverRules is EqualUnmodifiableListView) return _serverRules;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_serverRules);
}
@override
@JsonKey()
final String name;
@override
@JsonKey()
final String description;
@override
final String? maintainerName;
@override
final String? maintainerEmail;
@override
final int? usersCount;
@override
final int? notesCount;
@override
final int? reactionCount;
@override
@JsonKey()
final String softwareName;
@override
@JsonKey()
final String softwareVersion;
final List<String> _languages;
@override
@JsonKey()
List<String> get languages {
if (_languages is EqualUnmodifiableListView) return _languages;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_languages);
}
final List<MetaAd> _ads;
@override
@JsonKey()
List<MetaAd> get ads {
if (_ads is EqualUnmodifiableListView) return _ads;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_ads);
}
@override
final bool isSupportedEmoji;
@override
final bool isSupportedAnnouncement;
@override
final bool isSupportedLocalTimeline;
@override
final MetaResponse? meta;
@override
String toString() {
return 'FederationData(bannerUrl: $bannerUrl, faviconUrl: $faviconUrl, tosUrl: $tosUrl, privacyPolicyUrl: $privacyPolicyUrl, impressumUrl: $impressumUrl, repositoryUrl: $repositoryUrl, serverRules: $serverRules, name: $name, description: $description, maintainerName: $maintainerName, maintainerEmail: $maintainerEmail, usersCount: $usersCount, notesCount: $notesCount, reactionCount: $reactionCount, softwareName: $softwareName, softwareVersion: $softwareVersion, languages: $languages, ads: $ads, isSupportedEmoji: $isSupportedEmoji, isSupportedAnnouncement: $isSupportedAnnouncement, isSupportedLocalTimeline: $isSupportedLocalTimeline, meta: $meta)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$FederationDataImpl &&
(identical(other.bannerUrl, bannerUrl) ||
other.bannerUrl == bannerUrl) &&
(identical(other.faviconUrl, faviconUrl) ||
other.faviconUrl == faviconUrl) &&
(identical(other.tosUrl, tosUrl) || other.tosUrl == tosUrl) &&
(identical(other.privacyPolicyUrl, privacyPolicyUrl) ||
other.privacyPolicyUrl == privacyPolicyUrl) &&
(identical(other.impressumUrl, impressumUrl) ||
other.impressumUrl == impressumUrl) &&
(identical(other.repositoryUrl, repositoryUrl) ||
other.repositoryUrl == repositoryUrl) &&
const DeepCollectionEquality()
.equals(other._serverRules, _serverRules) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.maintainerName, maintainerName) ||
other.maintainerName == maintainerName) &&
(identical(other.maintainerEmail, maintainerEmail) ||
other.maintainerEmail == maintainerEmail) &&
(identical(other.usersCount, usersCount) ||
other.usersCount == usersCount) &&
(identical(other.notesCount, notesCount) ||
other.notesCount == notesCount) &&
(identical(other.reactionCount, reactionCount) ||
other.reactionCount == reactionCount) &&
(identical(other.softwareName, softwareName) ||
other.softwareName == softwareName) &&
(identical(other.softwareVersion, softwareVersion) ||
other.softwareVersion == softwareVersion) &&
const DeepCollectionEquality()
.equals(other._languages, _languages) &&
const DeepCollectionEquality().equals(other._ads, _ads) &&
(identical(other.isSupportedEmoji, isSupportedEmoji) ||
other.isSupportedEmoji == isSupportedEmoji) &&
(identical(
other.isSupportedAnnouncement, isSupportedAnnouncement) ||
other.isSupportedAnnouncement == isSupportedAnnouncement) &&
(identical(
other.isSupportedLocalTimeline, isSupportedLocalTimeline) ||
other.isSupportedLocalTimeline == isSupportedLocalTimeline) &&
(identical(other.meta, meta) || other.meta == meta));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
bannerUrl,
faviconUrl,
tosUrl,
privacyPolicyUrl,
impressumUrl,
repositoryUrl,
const DeepCollectionEquality().hash(_serverRules),
name,
description,
maintainerName,
maintainerEmail,
usersCount,
notesCount,
reactionCount,
softwareName,
softwareVersion,
const DeepCollectionEquality().hash(_languages),
const DeepCollectionEquality().hash(_ads),
isSupportedEmoji,
isSupportedAnnouncement,
isSupportedLocalTimeline,
meta
]);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$FederationDataImplCopyWith<_$FederationDataImpl> get copyWith =>
__$$FederationDataImplCopyWithImpl<_$FederationDataImpl>(
this, _$identity);
}
abstract class _FederationData implements FederationData {
const factory _FederationData(
{final String? bannerUrl,
final String? faviconUrl,
final String? tosUrl,
final String? privacyPolicyUrl,
final String? impressumUrl,
final String? repositoryUrl,
final List<String> serverRules,
final String name,
final String description,
final String? maintainerName,
final String? maintainerEmail,
final int? usersCount,
final int? notesCount,
final int? reactionCount,
final String softwareName,
final String softwareVersion,
final List<String> languages,
final List<MetaAd> ads,
required final bool isSupportedEmoji,
required final bool isSupportedAnnouncement,
required final bool isSupportedLocalTimeline,
final MetaResponse? meta}) = _$FederationDataImpl;
@override
String? get bannerUrl;
@override
String? get faviconUrl;
@override
String? get tosUrl;
@override
String? get privacyPolicyUrl;
@override
String? get impressumUrl;
@override
String? get repositoryUrl;
@override
List<String> get serverRules;
@override
String get name;
@override
String get description;
@override
String? get maintainerName;
@override
String? get maintainerEmail;
@override
int? get usersCount;
@override
int? get notesCount;
@override
int? get reactionCount;
@override
String get softwareName;
@override
String get softwareVersion;
@override
List<String> get languages;
@override
List<MetaAd> get ads;
@override
bool get isSupportedEmoji;
@override
bool get isSupportedAnnouncement;
@override
bool get isSupportedLocalTimeline;
@override
MetaResponse? get meta;
@override
@JsonKey(ignore: true)
_$$FederationDataImplCopyWith<_$FederationDataImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/federation_data.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:misskey_dart/misskey_dart.dart';
part 'federation_data.freezed.dart';
@freezed
class FederationData with _$FederationData {
const factory FederationData({
String? bannerUrl,
String? faviconUrl,
String? tosUrl,
String? privacyPolicyUrl,
String? impressumUrl,
String? repositoryUrl,
@Default([]) List<String> serverRules,
@Default("") String name,
@Default("") String description,
String? maintainerName,
String? maintainerEmail,
int? usersCount,
int? notesCount,
int? reactionCount,
@Default("") String softwareName,
@Default("") String softwareVersion,
@Default([]) List<String> languages,
@Default([]) List<MetaAd> ads,
required bool isSupportedEmoji,
required bool isSupportedAnnouncement,
required bool isSupportedLocalTimeline,
MetaResponse? meta,
}) = _FederationData;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/tab_icon.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'tab_icon.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$TabIconImpl _$$TabIconImplFromJson(Map<String, dynamic> json) =>
_$TabIconImpl(
codePoint: json['codePoint'] as int?,
customEmojiName: json['customEmojiName'] as String?,
);
Map<String, dynamic> _$$TabIconImplToJson(_$TabIconImpl instance) =>
<String, dynamic>{
'codePoint': instance.codePoint,
'customEmojiName': instance.customEmojiName,
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/account_settings.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'account_settings.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
AccountSettings _$AccountSettingsFromJson(Map<String, dynamic> json) {
return _AccountSettings.fromJson(json);
}
/// @nodoc
mixin _$AccountSettings {
String get userId => throw _privateConstructorUsedError;
String get host => throw _privateConstructorUsedError;
List<String> get reactions => throw _privateConstructorUsedError;
NoteVisibility get defaultNoteVisibility =>
throw _privateConstructorUsedError;
bool get defaultIsLocalOnly => throw _privateConstructorUsedError;
ReactionAcceptance? get defaultReactionAcceptance =>
throw _privateConstructorUsedError;
CacheStrategy get iCacheStrategy => throw _privateConstructorUsedError;
DateTime? get latestICached => throw _privateConstructorUsedError;
CacheStrategy get emojiCacheStrategy => throw _privateConstructorUsedError;
DateTime? get latestEmojiCached => throw _privateConstructorUsedError;
CacheStrategy get metaChacheStrategy => throw _privateConstructorUsedError;
DateTime? get latestMetaCached => throw _privateConstructorUsedError;
bool get forceShowAd => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$AccountSettingsCopyWith<AccountSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AccountSettingsCopyWith<$Res> {
factory $AccountSettingsCopyWith(
AccountSettings value, $Res Function(AccountSettings) then) =
_$AccountSettingsCopyWithImpl<$Res, AccountSettings>;
@useResult
$Res call(
{String userId,
String host,
List<String> reactions,
NoteVisibility defaultNoteVisibility,
bool defaultIsLocalOnly,
ReactionAcceptance? defaultReactionAcceptance,
CacheStrategy iCacheStrategy,
DateTime? latestICached,
CacheStrategy emojiCacheStrategy,
DateTime? latestEmojiCached,
CacheStrategy metaChacheStrategy,
DateTime? latestMetaCached,
bool forceShowAd});
}
/// @nodoc
class _$AccountSettingsCopyWithImpl<$Res, $Val extends AccountSettings>
implements $AccountSettingsCopyWith<$Res> {
_$AccountSettingsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? userId = null,
Object? host = null,
Object? reactions = null,
Object? defaultNoteVisibility = null,
Object? defaultIsLocalOnly = null,
Object? defaultReactionAcceptance = freezed,
Object? iCacheStrategy = null,
Object? latestICached = freezed,
Object? emojiCacheStrategy = null,
Object? latestEmojiCached = freezed,
Object? metaChacheStrategy = null,
Object? latestMetaCached = freezed,
Object? forceShowAd = null,
}) {
return _then(_value.copyWith(
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
reactions: null == reactions
? _value.reactions
: reactions // ignore: cast_nullable_to_non_nullable
as List<String>,
defaultNoteVisibility: null == defaultNoteVisibility
? _value.defaultNoteVisibility
: defaultNoteVisibility // ignore: cast_nullable_to_non_nullable
as NoteVisibility,
defaultIsLocalOnly: null == defaultIsLocalOnly
? _value.defaultIsLocalOnly
: defaultIsLocalOnly // ignore: cast_nullable_to_non_nullable
as bool,
defaultReactionAcceptance: freezed == defaultReactionAcceptance
? _value.defaultReactionAcceptance
: defaultReactionAcceptance // ignore: cast_nullable_to_non_nullable
as ReactionAcceptance?,
iCacheStrategy: null == iCacheStrategy
? _value.iCacheStrategy
: iCacheStrategy // ignore: cast_nullable_to_non_nullable
as CacheStrategy,
latestICached: freezed == latestICached
? _value.latestICached
: latestICached // ignore: cast_nullable_to_non_nullable
as DateTime?,
emojiCacheStrategy: null == emojiCacheStrategy
? _value.emojiCacheStrategy
: emojiCacheStrategy // ignore: cast_nullable_to_non_nullable
as CacheStrategy,
latestEmojiCached: freezed == latestEmojiCached
? _value.latestEmojiCached
: latestEmojiCached // ignore: cast_nullable_to_non_nullable
as DateTime?,
metaChacheStrategy: null == metaChacheStrategy
? _value.metaChacheStrategy
: metaChacheStrategy // ignore: cast_nullable_to_non_nullable
as CacheStrategy,
latestMetaCached: freezed == latestMetaCached
? _value.latestMetaCached
: latestMetaCached // ignore: cast_nullable_to_non_nullable
as DateTime?,
forceShowAd: null == forceShowAd
? _value.forceShowAd
: forceShowAd // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$AccountSettingsImplCopyWith<$Res>
implements $AccountSettingsCopyWith<$Res> {
factory _$$AccountSettingsImplCopyWith(_$AccountSettingsImpl value,
$Res Function(_$AccountSettingsImpl) then) =
__$$AccountSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String userId,
String host,
List<String> reactions,
NoteVisibility defaultNoteVisibility,
bool defaultIsLocalOnly,
ReactionAcceptance? defaultReactionAcceptance,
CacheStrategy iCacheStrategy,
DateTime? latestICached,
CacheStrategy emojiCacheStrategy,
DateTime? latestEmojiCached,
CacheStrategy metaChacheStrategy,
DateTime? latestMetaCached,
bool forceShowAd});
}
/// @nodoc
class __$$AccountSettingsImplCopyWithImpl<$Res>
extends _$AccountSettingsCopyWithImpl<$Res, _$AccountSettingsImpl>
implements _$$AccountSettingsImplCopyWith<$Res> {
__$$AccountSettingsImplCopyWithImpl(
_$AccountSettingsImpl _value, $Res Function(_$AccountSettingsImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? userId = null,
Object? host = null,
Object? reactions = null,
Object? defaultNoteVisibility = null,
Object? defaultIsLocalOnly = null,
Object? defaultReactionAcceptance = freezed,
Object? iCacheStrategy = null,
Object? latestICached = freezed,
Object? emojiCacheStrategy = null,
Object? latestEmojiCached = freezed,
Object? metaChacheStrategy = null,
Object? latestMetaCached = freezed,
Object? forceShowAd = null,
}) {
return _then(_$AccountSettingsImpl(
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
reactions: null == reactions
? _value._reactions
: reactions // ignore: cast_nullable_to_non_nullable
as List<String>,
defaultNoteVisibility: null == defaultNoteVisibility
? _value.defaultNoteVisibility
: defaultNoteVisibility // ignore: cast_nullable_to_non_nullable
as NoteVisibility,
defaultIsLocalOnly: null == defaultIsLocalOnly
? _value.defaultIsLocalOnly
: defaultIsLocalOnly // ignore: cast_nullable_to_non_nullable
as bool,
defaultReactionAcceptance: freezed == defaultReactionAcceptance
? _value.defaultReactionAcceptance
: defaultReactionAcceptance // ignore: cast_nullable_to_non_nullable
as ReactionAcceptance?,
iCacheStrategy: null == iCacheStrategy
? _value.iCacheStrategy
: iCacheStrategy // ignore: cast_nullable_to_non_nullable
as CacheStrategy,
latestICached: freezed == latestICached
? _value.latestICached
: latestICached // ignore: cast_nullable_to_non_nullable
as DateTime?,
emojiCacheStrategy: null == emojiCacheStrategy
? _value.emojiCacheStrategy
: emojiCacheStrategy // ignore: cast_nullable_to_non_nullable
as CacheStrategy,
latestEmojiCached: freezed == latestEmojiCached
? _value.latestEmojiCached
: latestEmojiCached // ignore: cast_nullable_to_non_nullable
as DateTime?,
metaChacheStrategy: null == metaChacheStrategy
? _value.metaChacheStrategy
: metaChacheStrategy // ignore: cast_nullable_to_non_nullable
as CacheStrategy,
latestMetaCached: freezed == latestMetaCached
? _value.latestMetaCached
: latestMetaCached // ignore: cast_nullable_to_non_nullable
as DateTime?,
forceShowAd: null == forceShowAd
? _value.forceShowAd
: forceShowAd // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _$AccountSettingsImpl extends _AccountSettings {
const _$AccountSettingsImpl(
{required this.userId,
required this.host,
final List<String> reactions = const [],
this.defaultNoteVisibility = NoteVisibility.public,
this.defaultIsLocalOnly = false,
this.defaultReactionAcceptance = null,
this.iCacheStrategy = CacheStrategy.whenTabChange,
this.latestICached,
this.emojiCacheStrategy = CacheStrategy.whenLaunch,
this.latestEmojiCached,
this.metaChacheStrategy = CacheStrategy.whenOneDay,
this.latestMetaCached,
this.forceShowAd = false})
: _reactions = reactions,
super._();
factory _$AccountSettingsImpl.fromJson(Map<String, dynamic> json) =>
_$$AccountSettingsImplFromJson(json);
@override
final String userId;
@override
final String host;
final List<String> _reactions;
@override
@JsonKey()
List<String> get reactions {
if (_reactions is EqualUnmodifiableListView) return _reactions;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_reactions);
}
@override
@JsonKey()
final NoteVisibility defaultNoteVisibility;
@override
@JsonKey()
final bool defaultIsLocalOnly;
@override
@JsonKey()
final ReactionAcceptance? defaultReactionAcceptance;
@override
@JsonKey()
final CacheStrategy iCacheStrategy;
@override
final DateTime? latestICached;
@override
@JsonKey()
final CacheStrategy emojiCacheStrategy;
@override
final DateTime? latestEmojiCached;
@override
@JsonKey()
final CacheStrategy metaChacheStrategy;
@override
final DateTime? latestMetaCached;
@override
@JsonKey()
final bool forceShowAd;
@override
String toString() {
return 'AccountSettings(userId: $userId, host: $host, reactions: $reactions, defaultNoteVisibility: $defaultNoteVisibility, defaultIsLocalOnly: $defaultIsLocalOnly, defaultReactionAcceptance: $defaultReactionAcceptance, iCacheStrategy: $iCacheStrategy, latestICached: $latestICached, emojiCacheStrategy: $emojiCacheStrategy, latestEmojiCached: $latestEmojiCached, metaChacheStrategy: $metaChacheStrategy, latestMetaCached: $latestMetaCached, forceShowAd: $forceShowAd)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AccountSettingsImpl &&
(identical(other.userId, userId) || other.userId == userId) &&
(identical(other.host, host) || other.host == host) &&
const DeepCollectionEquality()
.equals(other._reactions, _reactions) &&
(identical(other.defaultNoteVisibility, defaultNoteVisibility) ||
other.defaultNoteVisibility == defaultNoteVisibility) &&
(identical(other.defaultIsLocalOnly, defaultIsLocalOnly) ||
other.defaultIsLocalOnly == defaultIsLocalOnly) &&
(identical(other.defaultReactionAcceptance,
defaultReactionAcceptance) ||
other.defaultReactionAcceptance == defaultReactionAcceptance) &&
(identical(other.iCacheStrategy, iCacheStrategy) ||
other.iCacheStrategy == iCacheStrategy) &&
(identical(other.latestICached, latestICached) ||
other.latestICached == latestICached) &&
(identical(other.emojiCacheStrategy, emojiCacheStrategy) ||
other.emojiCacheStrategy == emojiCacheStrategy) &&
(identical(other.latestEmojiCached, latestEmojiCached) ||
other.latestEmojiCached == latestEmojiCached) &&
(identical(other.metaChacheStrategy, metaChacheStrategy) ||
other.metaChacheStrategy == metaChacheStrategy) &&
(identical(other.latestMetaCached, latestMetaCached) ||
other.latestMetaCached == latestMetaCached) &&
(identical(other.forceShowAd, forceShowAd) ||
other.forceShowAd == forceShowAd));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
userId,
host,
const DeepCollectionEquality().hash(_reactions),
defaultNoteVisibility,
defaultIsLocalOnly,
defaultReactionAcceptance,
iCacheStrategy,
latestICached,
emojiCacheStrategy,
latestEmojiCached,
metaChacheStrategy,
latestMetaCached,
forceShowAd);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$AccountSettingsImplCopyWith<_$AccountSettingsImpl> get copyWith =>
__$$AccountSettingsImplCopyWithImpl<_$AccountSettingsImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$AccountSettingsImplToJson(
this,
);
}
}
abstract class _AccountSettings extends AccountSettings {
const factory _AccountSettings(
{required final String userId,
required final String host,
final List<String> reactions,
final NoteVisibility defaultNoteVisibility,
final bool defaultIsLocalOnly,
final ReactionAcceptance? defaultReactionAcceptance,
final CacheStrategy iCacheStrategy,
final DateTime? latestICached,
final CacheStrategy emojiCacheStrategy,
final DateTime? latestEmojiCached,
final CacheStrategy metaChacheStrategy,
final DateTime? latestMetaCached,
final bool forceShowAd}) = _$AccountSettingsImpl;
const _AccountSettings._() : super._();
factory _AccountSettings.fromJson(Map<String, dynamic> json) =
_$AccountSettingsImpl.fromJson;
@override
String get userId;
@override
String get host;
@override
List<String> get reactions;
@override
NoteVisibility get defaultNoteVisibility;
@override
bool get defaultIsLocalOnly;
@override
ReactionAcceptance? get defaultReactionAcceptance;
@override
CacheStrategy get iCacheStrategy;
@override
DateTime? get latestICached;
@override
CacheStrategy get emojiCacheStrategy;
@override
DateTime? get latestEmojiCached;
@override
CacheStrategy get metaChacheStrategy;
@override
DateTime? get latestMetaCached;
@override
bool get forceShowAd;
@override
@JsonKey(ignore: true)
_$$AccountSettingsImplCopyWith<_$AccountSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/exported_setting.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:miria/model/account_settings.dart';
import 'package:miria/model/general_settings.dart';
import 'package:miria/model/tab_setting.dart';
part 'exported_setting.freezed.dart';
part 'exported_setting.g.dart';
@freezed
class ExportedSetting with _$ExportedSetting {
const factory ExportedSetting({
@Default([]) List<AccountSettings> accountSettings,
required GeneralSettings generalSettings,
@Default([]) List<TabSetting> tabSettings,
}) = _ExportedSetting;
factory ExportedSetting.fromJson(Map<String, dynamic> json) =>
_$ExportedSettingFromJson(json);
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/misskey_theme.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'misskey_theme.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$MisskeyThemeImpl _$$MisskeyThemeImplFromJson(Map<String, dynamic> json) =>
_$MisskeyThemeImpl(
id: json['id'] as String,
name: json['name'] as String,
author: json['author'] as String?,
desc: json['desc'] as String?,
base: json['base'] as String?,
props: Map<String, String>.from(json['props'] as Map),
);
Map<String, dynamic> _$$MisskeyThemeImplToJson(_$MisskeyThemeImpl instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'author': instance.author,
'desc': instance.desc,
'base': instance.base,
'props': instance.props,
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/summaly_result.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'summaly_result.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$SummalyResultImpl _$$SummalyResultImplFromJson(Map<String, dynamic> json) =>
_$SummalyResultImpl(
title: json['title'] as String?,
icon: json['icon'] as String?,
description: json['description'] as String?,
thumbnail: json['thumbnail'] as String?,
player: Player.fromJson(json['player'] as Map<String, dynamic>),
sitename: json['sitename'] as String?,
sensitive: json['sensitive'] as bool?,
url: json['url'] as String?,
);
Map<String, dynamic> _$$SummalyResultImplToJson(_$SummalyResultImpl instance) =>
<String, dynamic>{
'title': instance.title,
'icon': instance.icon,
'description': instance.description,
'thumbnail': instance.thumbnail,
'player': instance.player.toJson(),
'sitename': instance.sitename,
'sensitive': instance.sensitive,
'url': instance.url,
};
_$PlayerImpl _$$PlayerImplFromJson(Map<String, dynamic> json) => _$PlayerImpl(
url: json['url'] as String?,
width: (json['width'] as num?)?.toDouble(),
height: (json['height'] as num?)?.toDouble(),
allow:
(json['allow'] as List<dynamic>?)?.map((e) => e as String).toList(),
);
Map<String, dynamic> _$$PlayerImplToJson(_$PlayerImpl instance) =>
<String, dynamic>{
'url': instance.url,
'width': instance.width,
'height': instance.height,
'allow': instance.allow,
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/note_search_condition.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:misskey_dart/misskey_dart.dart';
part 'note_search_condition.freezed.dart';
@freezed
class NoteSearchCondition with _$NoteSearchCondition {
const factory NoteSearchCondition({
String? query,
User? user,
CommunityChannel? channel,
@Default(false) bool localOnly,
}) = _NoteSearchCondition;
const NoteSearchCondition._();
bool get isEmpty {
return (query?.isEmpty ?? true) && channel == null && user == null;
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/unicode_emoji.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'unicode_emoji.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
UnicodeEmoji _$UnicodeEmojiFromJson(Map<String, dynamic> json) {
return _UnicodeEmoji.fromJson(json);
}
/// @nodoc
mixin _$UnicodeEmoji {
String get category => throw _privateConstructorUsedError;
String get char => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
List<String> get keywords => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$UnicodeEmojiCopyWith<UnicodeEmoji> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UnicodeEmojiCopyWith<$Res> {
factory $UnicodeEmojiCopyWith(
UnicodeEmoji value, $Res Function(UnicodeEmoji) then) =
_$UnicodeEmojiCopyWithImpl<$Res, UnicodeEmoji>;
@useResult
$Res call({String category, String char, String name, List<String> keywords});
}
/// @nodoc
class _$UnicodeEmojiCopyWithImpl<$Res, $Val extends UnicodeEmoji>
implements $UnicodeEmojiCopyWith<$Res> {
_$UnicodeEmojiCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? category = null,
Object? char = null,
Object? name = null,
Object? keywords = null,
}) {
return _then(_value.copyWith(
category: null == category
? _value.category
: category // ignore: cast_nullable_to_non_nullable
as String,
char: null == char
? _value.char
: char // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
keywords: null == keywords
? _value.keywords
: keywords // ignore: cast_nullable_to_non_nullable
as List<String>,
) as $Val);
}
}
/// @nodoc
abstract class _$$UnicodeEmojiImplCopyWith<$Res>
implements $UnicodeEmojiCopyWith<$Res> {
factory _$$UnicodeEmojiImplCopyWith(
_$UnicodeEmojiImpl value, $Res Function(_$UnicodeEmojiImpl) then) =
__$$UnicodeEmojiImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String category, String char, String name, List<String> keywords});
}
/// @nodoc
class __$$UnicodeEmojiImplCopyWithImpl<$Res>
extends _$UnicodeEmojiCopyWithImpl<$Res, _$UnicodeEmojiImpl>
implements _$$UnicodeEmojiImplCopyWith<$Res> {
__$$UnicodeEmojiImplCopyWithImpl(
_$UnicodeEmojiImpl _value, $Res Function(_$UnicodeEmojiImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? category = null,
Object? char = null,
Object? name = null,
Object? keywords = null,
}) {
return _then(_$UnicodeEmojiImpl(
category: null == category
? _value.category
: category // ignore: cast_nullable_to_non_nullable
as String,
char: null == char
? _value.char
: char // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
keywords: null == keywords
? _value._keywords
: keywords // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$UnicodeEmojiImpl implements _UnicodeEmoji {
const _$UnicodeEmojiImpl(
{required this.category,
required this.char,
required this.name,
required final List<String> keywords})
: _keywords = keywords;
factory _$UnicodeEmojiImpl.fromJson(Map<String, dynamic> json) =>
_$$UnicodeEmojiImplFromJson(json);
@override
final String category;
@override
final String char;
@override
final String name;
final List<String> _keywords;
@override
List<String> get keywords {
if (_keywords is EqualUnmodifiableListView) return _keywords;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_keywords);
}
@override
String toString() {
return 'UnicodeEmoji(category: $category, char: $char, name: $name, keywords: $keywords)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UnicodeEmojiImpl &&
(identical(other.category, category) ||
other.category == category) &&
(identical(other.char, char) || other.char == char) &&
(identical(other.name, name) || other.name == name) &&
const DeepCollectionEquality().equals(other._keywords, _keywords));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, category, char, name,
const DeepCollectionEquality().hash(_keywords));
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$UnicodeEmojiImplCopyWith<_$UnicodeEmojiImpl> get copyWith =>
__$$UnicodeEmojiImplCopyWithImpl<_$UnicodeEmojiImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$UnicodeEmojiImplToJson(
this,
);
}
}
abstract class _UnicodeEmoji implements UnicodeEmoji {
const factory _UnicodeEmoji(
{required final String category,
required final String char,
required final String name,
required final List<String> keywords}) = _$UnicodeEmojiImpl;
factory _UnicodeEmoji.fromJson(Map<String, dynamic> json) =
_$UnicodeEmojiImpl.fromJson;
@override
String get category;
@override
String get char;
@override
String get name;
@override
List<String> get keywords;
@override
@JsonKey(ignore: true)
_$$UnicodeEmojiImplCopyWith<_$UnicodeEmojiImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/tab_setting.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'tab_setting.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$TabSettingImpl _$$TabSettingImplFromJson(Map<String, dynamic> json) =>
_$TabSettingImpl(
icon: const IconDataConverter().fromJson(json['icon']),
tabType: $enumDecode(_$TabTypeEnumMap, json['tabType']),
roleId: json['roleId'] as String?,
channelId: json['channelId'] as String?,
listId: json['listId'] as String?,
antennaId: json['antennaId'] as String?,
isSubscribe: json['isSubscribe'] as bool? ?? true,
isIncludeReplies: json['isIncludeReplies'] as bool? ?? true,
isMediaOnly: json['isMediaOnly'] as bool? ?? false,
name: json['name'] as String?,
acct: Acct.fromJson(_readAcct(json, 'acct') as Map<String, dynamic>),
renoteDisplay: json['renoteDisplay'] as bool? ?? true,
);
Map<String, dynamic> _$$TabSettingImplToJson(_$TabSettingImpl instance) =>
<String, dynamic>{
'icon': const IconDataConverter().toJson(instance.icon),
'tabType': _$TabTypeEnumMap[instance.tabType]!,
'roleId': instance.roleId,
'channelId': instance.channelId,
'listId': instance.listId,
'antennaId': instance.antennaId,
'isSubscribe': instance.isSubscribe,
'isIncludeReplies': instance.isIncludeReplies,
'isMediaOnly': instance.isMediaOnly,
'name': instance.name,
'acct': instance.acct.toJson(),
'renoteDisplay': instance.renoteDisplay,
};
const _$TabTypeEnumMap = {
TabType.localTimeline: 'localTimeline',
TabType.homeTimeline: 'homeTimeline',
TabType.globalTimeline: 'globalTimeline',
TabType.hybridTimeline: 'hybridTimeline',
TabType.roleTimeline: 'roleTimeline',
TabType.channel: 'channel',
TabType.userList: 'userList',
TabType.antenna: 'antenna',
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/account.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'account.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$AccountImpl _$$AccountImplFromJson(Map<String, dynamic> json) =>
_$AccountImpl(
host: json['host'] as String,
userId: json['userId'] as String,
token: json['token'] as String?,
i: MeDetailed.fromJson(json['i'] as Map<String, dynamic>),
meta: json['meta'] == null
? null
: MetaResponse.fromJson(json['meta'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$AccountImplToJson(_$AccountImpl instance) =>
<String, dynamic>{
'host': instance.host,
'userId': instance.userId,
'token': instance.token,
'i': instance.i.toJson(),
'meta': instance.meta?.toJson(),
};
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/desktop_settings.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'desktop_settings.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
DesktopSettings _$DesktopSettingsFromJson(Map<String, dynamic> json) {
return _DesktopSettings.fromJson(json);
}
/// @nodoc
mixin _$DesktopSettings {
DesktopWindowSettings get window => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$DesktopSettingsCopyWith<DesktopSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DesktopSettingsCopyWith<$Res> {
factory $DesktopSettingsCopyWith(
DesktopSettings value, $Res Function(DesktopSettings) then) =
_$DesktopSettingsCopyWithImpl<$Res, DesktopSettings>;
@useResult
$Res call({DesktopWindowSettings window});
$DesktopWindowSettingsCopyWith<$Res> get window;
}
/// @nodoc
class _$DesktopSettingsCopyWithImpl<$Res, $Val extends DesktopSettings>
implements $DesktopSettingsCopyWith<$Res> {
_$DesktopSettingsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? window = null,
}) {
return _then(_value.copyWith(
window: null == window
? _value.window
: window // ignore: cast_nullable_to_non_nullable
as DesktopWindowSettings,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$DesktopWindowSettingsCopyWith<$Res> get window {
return $DesktopWindowSettingsCopyWith<$Res>(_value.window, (value) {
return _then(_value.copyWith(window: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$DesktopSettingsImplCopyWith<$Res>
implements $DesktopSettingsCopyWith<$Res> {
factory _$$DesktopSettingsImplCopyWith(_$DesktopSettingsImpl value,
$Res Function(_$DesktopSettingsImpl) then) =
__$$DesktopSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({DesktopWindowSettings window});
@override
$DesktopWindowSettingsCopyWith<$Res> get window;
}
/// @nodoc
class __$$DesktopSettingsImplCopyWithImpl<$Res>
extends _$DesktopSettingsCopyWithImpl<$Res, _$DesktopSettingsImpl>
implements _$$DesktopSettingsImplCopyWith<$Res> {
__$$DesktopSettingsImplCopyWithImpl(
_$DesktopSettingsImpl _value, $Res Function(_$DesktopSettingsImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? window = null,
}) {
return _then(_$DesktopSettingsImpl(
window: null == window
? _value.window
: window // ignore: cast_nullable_to_non_nullable
as DesktopWindowSettings,
));
}
}
/// @nodoc
@JsonSerializable()
class _$DesktopSettingsImpl implements _DesktopSettings {
const _$DesktopSettingsImpl({this.window = const DesktopWindowSettings()});
factory _$DesktopSettingsImpl.fromJson(Map<String, dynamic> json) =>
_$$DesktopSettingsImplFromJson(json);
@override
@JsonKey()
final DesktopWindowSettings window;
@override
String toString() {
return 'DesktopSettings(window: $window)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DesktopSettingsImpl &&
(identical(other.window, window) || other.window == window));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, window);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DesktopSettingsImplCopyWith<_$DesktopSettingsImpl> get copyWith =>
__$$DesktopSettingsImplCopyWithImpl<_$DesktopSettingsImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$DesktopSettingsImplToJson(
this,
);
}
}
abstract class _DesktopSettings implements DesktopSettings {
const factory _DesktopSettings({final DesktopWindowSettings window}) =
_$DesktopSettingsImpl;
factory _DesktopSettings.fromJson(Map<String, dynamic> json) =
_$DesktopSettingsImpl.fromJson;
@override
DesktopWindowSettings get window;
@override
@JsonKey(ignore: true)
_$$DesktopSettingsImplCopyWith<_$DesktopSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
DesktopWindowSettings _$DesktopWindowSettingsFromJson(
Map<String, dynamic> json) {
return _DesktopWindowSettings.fromJson(json);
}
/// @nodoc
mixin _$DesktopWindowSettings {
double? get x => throw _privateConstructorUsedError;
double? get y => throw _privateConstructorUsedError;
double get w => throw _privateConstructorUsedError;
double get h => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$DesktopWindowSettingsCopyWith<DesktopWindowSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DesktopWindowSettingsCopyWith<$Res> {
factory $DesktopWindowSettingsCopyWith(DesktopWindowSettings value,
$Res Function(DesktopWindowSettings) then) =
_$DesktopWindowSettingsCopyWithImpl<$Res, DesktopWindowSettings>;
@useResult
$Res call({double? x, double? y, double w, double h});
}
/// @nodoc
class _$DesktopWindowSettingsCopyWithImpl<$Res,
$Val extends DesktopWindowSettings>
implements $DesktopWindowSettingsCopyWith<$Res> {
_$DesktopWindowSettingsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? x = freezed,
Object? y = freezed,
Object? w = null,
Object? h = null,
}) {
return _then(_value.copyWith(
x: freezed == x
? _value.x
: x // ignore: cast_nullable_to_non_nullable
as double?,
y: freezed == y
? _value.y
: y // ignore: cast_nullable_to_non_nullable
as double?,
w: null == w
? _value.w
: w // ignore: cast_nullable_to_non_nullable
as double,
h: null == h
? _value.h
: h // ignore: cast_nullable_to_non_nullable
as double,
) as $Val);
}
}
/// @nodoc
abstract class _$$DesktopWindowSettingsImplCopyWith<$Res>
implements $DesktopWindowSettingsCopyWith<$Res> {
factory _$$DesktopWindowSettingsImplCopyWith(
_$DesktopWindowSettingsImpl value,
$Res Function(_$DesktopWindowSettingsImpl) then) =
__$$DesktopWindowSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({double? x, double? y, double w, double h});
}
/// @nodoc
class __$$DesktopWindowSettingsImplCopyWithImpl<$Res>
extends _$DesktopWindowSettingsCopyWithImpl<$Res,
_$DesktopWindowSettingsImpl>
implements _$$DesktopWindowSettingsImplCopyWith<$Res> {
__$$DesktopWindowSettingsImplCopyWithImpl(_$DesktopWindowSettingsImpl _value,
$Res Function(_$DesktopWindowSettingsImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? x = freezed,
Object? y = freezed,
Object? w = null,
Object? h = null,
}) {
return _then(_$DesktopWindowSettingsImpl(
x: freezed == x
? _value.x
: x // ignore: cast_nullable_to_non_nullable
as double?,
y: freezed == y
? _value.y
: y // ignore: cast_nullable_to_non_nullable
as double?,
w: null == w
? _value.w
: w // ignore: cast_nullable_to_non_nullable
as double,
h: null == h
? _value.h
: h // ignore: cast_nullable_to_non_nullable
as double,
));
}
}
/// @nodoc
@JsonSerializable()
class _$DesktopWindowSettingsImpl implements _DesktopWindowSettings {
const _$DesktopWindowSettingsImpl(
{this.x = null, this.y = null, this.w = 400, this.h = 700});
factory _$DesktopWindowSettingsImpl.fromJson(Map<String, dynamic> json) =>
_$$DesktopWindowSettingsImplFromJson(json);
@override
@JsonKey()
final double? x;
@override
@JsonKey()
final double? y;
@override
@JsonKey()
final double w;
@override
@JsonKey()
final double h;
@override
String toString() {
return 'DesktopWindowSettings(x: $x, y: $y, w: $w, h: $h)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DesktopWindowSettingsImpl &&
(identical(other.x, x) || other.x == x) &&
(identical(other.y, y) || other.y == y) &&
(identical(other.w, w) || other.w == w) &&
(identical(other.h, h) || other.h == h));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, x, y, w, h);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DesktopWindowSettingsImplCopyWith<_$DesktopWindowSettingsImpl>
get copyWith => __$$DesktopWindowSettingsImplCopyWithImpl<
_$DesktopWindowSettingsImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$DesktopWindowSettingsImplToJson(
this,
);
}
}
abstract class _DesktopWindowSettings implements DesktopWindowSettings {
const factory _DesktopWindowSettings(
{final double? x,
final double? y,
final double w,
final double h}) = _$DesktopWindowSettingsImpl;
factory _DesktopWindowSettings.fromJson(Map<String, dynamic> json) =
_$DesktopWindowSettingsImpl.fromJson;
@override
double? get x;
@override
double? get y;
@override
double get w;
@override
double get h;
@override
@JsonKey(ignore: true)
_$$DesktopWindowSettingsImplCopyWith<_$DesktopWindowSettingsImpl>
get copyWith => throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/tab_icon.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'tab_icon.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
TabIcon _$TabIconFromJson(Map<String, dynamic> json) {
return _TabIcon.fromJson(json);
}
/// @nodoc
mixin _$TabIcon {
int? get codePoint => throw _privateConstructorUsedError;
String? get customEmojiName => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$TabIconCopyWith<TabIcon> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $TabIconCopyWith<$Res> {
factory $TabIconCopyWith(TabIcon value, $Res Function(TabIcon) then) =
_$TabIconCopyWithImpl<$Res, TabIcon>;
@useResult
$Res call({int? codePoint, String? customEmojiName});
}
/// @nodoc
class _$TabIconCopyWithImpl<$Res, $Val extends TabIcon>
implements $TabIconCopyWith<$Res> {
_$TabIconCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? codePoint = freezed,
Object? customEmojiName = freezed,
}) {
return _then(_value.copyWith(
codePoint: freezed == codePoint
? _value.codePoint
: codePoint // ignore: cast_nullable_to_non_nullable
as int?,
customEmojiName: freezed == customEmojiName
? _value.customEmojiName
: customEmojiName // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$TabIconImplCopyWith<$Res> implements $TabIconCopyWith<$Res> {
factory _$$TabIconImplCopyWith(
_$TabIconImpl value, $Res Function(_$TabIconImpl) then) =
__$$TabIconImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int? codePoint, String? customEmojiName});
}
/// @nodoc
class __$$TabIconImplCopyWithImpl<$Res>
extends _$TabIconCopyWithImpl<$Res, _$TabIconImpl>
implements _$$TabIconImplCopyWith<$Res> {
__$$TabIconImplCopyWithImpl(
_$TabIconImpl _value, $Res Function(_$TabIconImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? codePoint = freezed,
Object? customEmojiName = freezed,
}) {
return _then(_$TabIconImpl(
codePoint: freezed == codePoint
? _value.codePoint
: codePoint // ignore: cast_nullable_to_non_nullable
as int?,
customEmojiName: freezed == customEmojiName
? _value.customEmojiName
: customEmojiName // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$TabIconImpl implements _TabIcon {
const _$TabIconImpl({this.codePoint, this.customEmojiName});
factory _$TabIconImpl.fromJson(Map<String, dynamic> json) =>
_$$TabIconImplFromJson(json);
@override
final int? codePoint;
@override
final String? customEmojiName;
@override
String toString() {
return 'TabIcon(codePoint: $codePoint, customEmojiName: $customEmojiName)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$TabIconImpl &&
(identical(other.codePoint, codePoint) ||
other.codePoint == codePoint) &&
(identical(other.customEmojiName, customEmojiName) ||
other.customEmojiName == customEmojiName));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, codePoint, customEmojiName);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$TabIconImplCopyWith<_$TabIconImpl> get copyWith =>
__$$TabIconImplCopyWithImpl<_$TabIconImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$TabIconImplToJson(
this,
);
}
}
abstract class _TabIcon implements TabIcon {
const factory _TabIcon(
{final int? codePoint, final String? customEmojiName}) = _$TabIconImpl;
factory _TabIcon.fromJson(Map<String, dynamic> json) = _$TabIconImpl.fromJson;
@override
int? get codePoint;
@override
String? get customEmojiName;
@override
@JsonKey(ignore: true)
_$$TabIconImplCopyWith<_$TabIconImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/misskey_theme.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'misskey_theme.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
MisskeyTheme _$MisskeyThemeFromJson(Map<String, dynamic> json) {
return _MisskeyTheme.fromJson(json);
}
/// @nodoc
mixin _$MisskeyTheme {
String get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get author => throw _privateConstructorUsedError;
String? get desc => throw _privateConstructorUsedError;
String? get base => throw _privateConstructorUsedError;
Map<String, String> get props => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$MisskeyThemeCopyWith<MisskeyTheme> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $MisskeyThemeCopyWith<$Res> {
factory $MisskeyThemeCopyWith(
MisskeyTheme value, $Res Function(MisskeyTheme) then) =
_$MisskeyThemeCopyWithImpl<$Res, MisskeyTheme>;
@useResult
$Res call(
{String id,
String name,
String? author,
String? desc,
String? base,
Map<String, String> props});
}
/// @nodoc
class _$MisskeyThemeCopyWithImpl<$Res, $Val extends MisskeyTheme>
implements $MisskeyThemeCopyWith<$Res> {
_$MisskeyThemeCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? author = freezed,
Object? desc = freezed,
Object? base = freezed,
Object? props = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
author: freezed == author
? _value.author
: author // ignore: cast_nullable_to_non_nullable
as String?,
desc: freezed == desc
? _value.desc
: desc // ignore: cast_nullable_to_non_nullable
as String?,
base: freezed == base
? _value.base
: base // ignore: cast_nullable_to_non_nullable
as String?,
props: null == props
? _value.props
: props // ignore: cast_nullable_to_non_nullable
as Map<String, String>,
) as $Val);
}
}
/// @nodoc
abstract class _$$MisskeyThemeImplCopyWith<$Res>
implements $MisskeyThemeCopyWith<$Res> {
factory _$$MisskeyThemeImplCopyWith(
_$MisskeyThemeImpl value, $Res Function(_$MisskeyThemeImpl) then) =
__$$MisskeyThemeImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
String name,
String? author,
String? desc,
String? base,
Map<String, String> props});
}
/// @nodoc
class __$$MisskeyThemeImplCopyWithImpl<$Res>
extends _$MisskeyThemeCopyWithImpl<$Res, _$MisskeyThemeImpl>
implements _$$MisskeyThemeImplCopyWith<$Res> {
__$$MisskeyThemeImplCopyWithImpl(
_$MisskeyThemeImpl _value, $Res Function(_$MisskeyThemeImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? author = freezed,
Object? desc = freezed,
Object? base = freezed,
Object? props = null,
}) {
return _then(_$MisskeyThemeImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
author: freezed == author
? _value.author
: author // ignore: cast_nullable_to_non_nullable
as String?,
desc: freezed == desc
? _value.desc
: desc // ignore: cast_nullable_to_non_nullable
as String?,
base: freezed == base
? _value.base
: base // ignore: cast_nullable_to_non_nullable
as String?,
props: null == props
? _value._props
: props // ignore: cast_nullable_to_non_nullable
as Map<String, String>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$MisskeyThemeImpl implements _MisskeyTheme {
const _$MisskeyThemeImpl(
{required this.id,
required this.name,
this.author,
this.desc,
this.base,
required final Map<String, String> props})
: _props = props;
factory _$MisskeyThemeImpl.fromJson(Map<String, dynamic> json) =>
_$$MisskeyThemeImplFromJson(json);
@override
final String id;
@override
final String name;
@override
final String? author;
@override
final String? desc;
@override
final String? base;
final Map<String, String> _props;
@override
Map<String, String> get props {
if (_props is EqualUnmodifiableMapView) return _props;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_props);
}
@override
String toString() {
return 'MisskeyTheme(id: $id, name: $name, author: $author, desc: $desc, base: $base, props: $props)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$MisskeyThemeImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.author, author) || other.author == author) &&
(identical(other.desc, desc) || other.desc == desc) &&
(identical(other.base, base) || other.base == base) &&
const DeepCollectionEquality().equals(other._props, _props));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, name, author, desc, base,
const DeepCollectionEquality().hash(_props));
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$MisskeyThemeImplCopyWith<_$MisskeyThemeImpl> get copyWith =>
__$$MisskeyThemeImplCopyWithImpl<_$MisskeyThemeImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$MisskeyThemeImplToJson(
this,
);
}
}
abstract class _MisskeyTheme implements MisskeyTheme {
const factory _MisskeyTheme(
{required final String id,
required final String name,
final String? author,
final String? desc,
final String? base,
required final Map<String, String> props}) = _$MisskeyThemeImpl;
factory _MisskeyTheme.fromJson(Map<String, dynamic> json) =
_$MisskeyThemeImpl.fromJson;
@override
String get id;
@override
String get name;
@override
String? get author;
@override
String? get desc;
@override
String? get base;
@override
Map<String, String> get props;
@override
@JsonKey(ignore: true)
_$$MisskeyThemeImplCopyWith<_$MisskeyThemeImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/summaly_result.dart | import 'package:freezed_annotation/freezed_annotation.dart';
part 'summaly_result.freezed.dart';
part 'summaly_result.g.dart';
// https://github.com/misskey-dev/summaly
@freezed
class SummalyResult with _$SummalyResult {
const factory SummalyResult({
String? title,
String? icon,
String? description,
String? thumbnail,
required Player player,
String? sitename,
bool? sensitive,
String? url,
}) = _SummalyResult;
factory SummalyResult.fromJson(Map<String, dynamic> json) =>
_$SummalyResultFromJson(json);
}
@freezed
class Player with _$Player {
const factory Player({
String? url,
double? width,
double? height,
List<String>? allow,
}) = _Player;
factory Player.fromJson(Map<String, dynamic> json) => _$PlayerFromJson(json);
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/input_completion_type.dart | sealed class InputCompletionType {
const InputCompletionType();
}
class Basic extends InputCompletionType {}
class Emoji extends InputCompletionType {
const Emoji(this.query);
final String query;
}
class MfmFn extends InputCompletionType {
const MfmFn(this.query);
final String query;
}
class Hashtag extends InputCompletionType {
const Hashtag(this.query);
final String query;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/misskey_theme.dart | import 'package:freezed_annotation/freezed_annotation.dart';
part 'misskey_theme.freezed.dart';
part 'misskey_theme.g.dart';
@freezed
class MisskeyTheme with _$MisskeyTheme {
const factory MisskeyTheme({
required String id,
required String name,
String? author,
String? desc,
String? base,
required Map<String, String> props,
}) = _MisskeyTheme;
factory MisskeyTheme.fromJson(Map<String, dynamic> json) =>
_$MisskeyThemeFromJson(json);
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/general_settings.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'general_settings.freezed.dart';
part 'general_settings.g.dart';
enum ThemeColorSystem {
forceLight,
forceDark,
system;
String displayName(BuildContext context) {
return switch (this) {
ThemeColorSystem.forceLight => S.of(context).lightMode,
ThemeColorSystem.forceDark => S.of(context).darkMode,
ThemeColorSystem.system => S.of(context).syncWithSystem,
};
}
}
enum NSFWInherit {
inherit,
ignore,
allHidden,
removeNsfw;
String displayName(BuildContext context) {
return switch (this) {
NSFWInherit.inherit => S.of(context).hideSensitiveMedia,
NSFWInherit.ignore => S.of(context).showSensitiveMedia,
NSFWInherit.allHidden => S.of(context).hideAllMedia,
NSFWInherit.removeNsfw => S.of(context).removeSensitiveNotes,
};
}
}
enum AutomaticPush {
automatic,
none;
String displayName(BuildContext context) {
return switch (this) {
AutomaticPush.automatic => S.of(context).enableInfiniteScroll,
AutomaticPush.none => S.of(context).disableInfiniteScroll,
};
}
}
enum TabPosition {
top,
bottom;
String displayName(BuildContext context) {
return switch (this) {
TabPosition.top => S.of(context).top,
TabPosition.bottom => S.of(context).bottom,
};
}
}
enum EmojiType {
twemoji,
system;
String displayName(BuildContext context) {
return switch (this) {
EmojiType.twemoji => "Twemoji",
EmojiType.system => S.of(context).systemEmoji,
};
}
}
enum Languages {
jaJP("日本語", "ja", "JP"),
jaOJ("日本語(お嬢様)", "ja", "OJ"),
zhCN("简体中文", "zh", "CN");
final String displayName;
final String countryCode;
final String languageCode;
const Languages(this.displayName, this.countryCode, this.languageCode);
}
@freezed
class GeneralSettings with _$GeneralSettings {
const factory GeneralSettings({
@Default("") String lightColorThemeId,
@Default("") String darkColorThemeId,
@Default(ThemeColorSystem.system) ThemeColorSystem themeColorSystem,
/// NSFW設定を継承する
@Default(NSFWInherit.inherit) NSFWInherit nsfwInherit,
/// ノートのカスタム絵文字直接タップでのリアクションを有効にする
@Default(false) bool enableDirectReaction,
/// TLの自動更新を有効にする
@Default(AutomaticPush.none) AutomaticPush automaticPush,
/// 動きのあるMFMを有効にする
@Default(true) bool enableAnimatedMFM,
/// 長いノートを省略する
@Default(false) bool enableLongTextElipsed,
/// リアクション済みノートを短くする
@Default(true) bool enableFavoritedRenoteElipsed,
/// タブの位置
@Default(TabPosition.top) TabPosition tabPosition,
/// 文字の大きさの倍率
@Default(1.0) double textScaleFactor,
/// 使用するUnicodeの絵文字種別
@Default(EmojiType.twemoji) EmojiType emojiType,
/// デフォルトのフォント名
@Default("") String defaultFontName,
/// `$[font.serif のフォント名
@Default("") String serifFontName,
/// `$[font.monospace およびコードブロックのフォント名
@Default("") String monospaceFontName,
/// `$[font.cursive のフォント名
@Default("") String cursiveFontName,
/// `$[font.fantasy のフォント名
@Default("") String fantasyFontName,
/// 言語設定
@Default(Languages.jaJP) Languages languages,
}) = _GeneralSettings;
factory GeneralSettings.fromJson(Map<String, dynamic> json) =>
_$GeneralSettingsFromJson(json);
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/acct.dart | import 'package:freezed_annotation/freezed_annotation.dart';
part 'acct.freezed.dart';
part 'acct.g.dart';
@freezed
class Acct with _$Acct {
const factory Acct({
required String host,
required String username,
}) = _Acct;
const Acct._();
factory Acct.fromJson(Map<String, Object?> json) => _$AcctFromJson(json);
@override
String toString() {
return "@$username@$host";
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/model/tab_setting.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'tab_setting.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
TabSetting _$TabSettingFromJson(Map<String, dynamic> json) {
return _TabSetting.fromJson(json);
}
/// @nodoc
mixin _$TabSetting {
@IconDataConverter()
TabIcon get icon => throw _privateConstructorUsedError;
/// タブ種別
TabType get tabType => throw _privateConstructorUsedError;
/// ロールタイムラインのノートの場合、ロールID
String? get roleId => throw _privateConstructorUsedError;
/// チャンネルのノートの場合、チャンネルID
String? get channelId => throw _privateConstructorUsedError;
/// リストのノートの場合、リストID
String? get listId => throw _privateConstructorUsedError;
/// アンテナのノートの場合、アンテナID
String? get antennaId => throw _privateConstructorUsedError;
/// ノートの投稿のキャプチャをするかどうか
bool get isSubscribe => throw _privateConstructorUsedError;
/// 返信を含むかどうか
bool get isIncludeReplies => throw _privateConstructorUsedError;
/// ファイルのみにするかどうか
bool get isMediaOnly => throw _privateConstructorUsedError;
/// タブ名
String? get name => throw _privateConstructorUsedError;
/// アカウント情報
// https://github.com/rrousselGit/freezed/issues/488
// ignore: invalid_annotation_target
@JsonKey(readValue: _readAcct)
Acct get acct => throw _privateConstructorUsedError;
/// Renoteを表示するかどうか
bool get renoteDisplay => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$TabSettingCopyWith<TabSetting> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $TabSettingCopyWith<$Res> {
factory $TabSettingCopyWith(
TabSetting value, $Res Function(TabSetting) then) =
_$TabSettingCopyWithImpl<$Res, TabSetting>;
@useResult
$Res call(
{@IconDataConverter() TabIcon icon,
TabType tabType,
String? roleId,
String? channelId,
String? listId,
String? antennaId,
bool isSubscribe,
bool isIncludeReplies,
bool isMediaOnly,
String? name,
@JsonKey(readValue: _readAcct) Acct acct,
bool renoteDisplay});
$TabIconCopyWith<$Res> get icon;
$AcctCopyWith<$Res> get acct;
}
/// @nodoc
class _$TabSettingCopyWithImpl<$Res, $Val extends TabSetting>
implements $TabSettingCopyWith<$Res> {
_$TabSettingCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? icon = null,
Object? tabType = null,
Object? roleId = freezed,
Object? channelId = freezed,
Object? listId = freezed,
Object? antennaId = freezed,
Object? isSubscribe = null,
Object? isIncludeReplies = null,
Object? isMediaOnly = null,
Object? name = freezed,
Object? acct = null,
Object? renoteDisplay = null,
}) {
return _then(_value.copyWith(
icon: null == icon
? _value.icon
: icon // ignore: cast_nullable_to_non_nullable
as TabIcon,
tabType: null == tabType
? _value.tabType
: tabType // ignore: cast_nullable_to_non_nullable
as TabType,
roleId: freezed == roleId
? _value.roleId
: roleId // ignore: cast_nullable_to_non_nullable
as String?,
channelId: freezed == channelId
? _value.channelId
: channelId // ignore: cast_nullable_to_non_nullable
as String?,
listId: freezed == listId
? _value.listId
: listId // ignore: cast_nullable_to_non_nullable
as String?,
antennaId: freezed == antennaId
? _value.antennaId
: antennaId // ignore: cast_nullable_to_non_nullable
as String?,
isSubscribe: null == isSubscribe
? _value.isSubscribe
: isSubscribe // ignore: cast_nullable_to_non_nullable
as bool,
isIncludeReplies: null == isIncludeReplies
? _value.isIncludeReplies
: isIncludeReplies // ignore: cast_nullable_to_non_nullable
as bool,
isMediaOnly: null == isMediaOnly
? _value.isMediaOnly
: isMediaOnly // ignore: cast_nullable_to_non_nullable
as bool,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
acct: null == acct
? _value.acct
: acct // ignore: cast_nullable_to_non_nullable
as Acct,
renoteDisplay: null == renoteDisplay
? _value.renoteDisplay
: renoteDisplay // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$TabIconCopyWith<$Res> get icon {
return $TabIconCopyWith<$Res>(_value.icon, (value) {
return _then(_value.copyWith(icon: value) as $Val);
});
}
@override
@pragma('vm:prefer-inline')
$AcctCopyWith<$Res> get acct {
return $AcctCopyWith<$Res>(_value.acct, (value) {
return _then(_value.copyWith(acct: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$TabSettingImplCopyWith<$Res>
implements $TabSettingCopyWith<$Res> {
factory _$$TabSettingImplCopyWith(
_$TabSettingImpl value, $Res Function(_$TabSettingImpl) then) =
__$$TabSettingImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{@IconDataConverter() TabIcon icon,
TabType tabType,
String? roleId,
String? channelId,
String? listId,
String? antennaId,
bool isSubscribe,
bool isIncludeReplies,
bool isMediaOnly,
String? name,
@JsonKey(readValue: _readAcct) Acct acct,
bool renoteDisplay});
@override
$TabIconCopyWith<$Res> get icon;
@override
$AcctCopyWith<$Res> get acct;
}
/// @nodoc
class __$$TabSettingImplCopyWithImpl<$Res>
extends _$TabSettingCopyWithImpl<$Res, _$TabSettingImpl>
implements _$$TabSettingImplCopyWith<$Res> {
__$$TabSettingImplCopyWithImpl(
_$TabSettingImpl _value, $Res Function(_$TabSettingImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? icon = null,
Object? tabType = null,
Object? roleId = freezed,
Object? channelId = freezed,
Object? listId = freezed,
Object? antennaId = freezed,
Object? isSubscribe = null,
Object? isIncludeReplies = null,
Object? isMediaOnly = null,
Object? name = freezed,
Object? acct = null,
Object? renoteDisplay = null,
}) {
return _then(_$TabSettingImpl(
icon: null == icon
? _value.icon
: icon // ignore: cast_nullable_to_non_nullable
as TabIcon,
tabType: null == tabType
? _value.tabType
: tabType // ignore: cast_nullable_to_non_nullable
as TabType,
roleId: freezed == roleId
? _value.roleId
: roleId // ignore: cast_nullable_to_non_nullable
as String?,
channelId: freezed == channelId
? _value.channelId
: channelId // ignore: cast_nullable_to_non_nullable
as String?,
listId: freezed == listId
? _value.listId
: listId // ignore: cast_nullable_to_non_nullable
as String?,
antennaId: freezed == antennaId
? _value.antennaId
: antennaId // ignore: cast_nullable_to_non_nullable
as String?,
isSubscribe: null == isSubscribe
? _value.isSubscribe
: isSubscribe // ignore: cast_nullable_to_non_nullable
as bool,
isIncludeReplies: null == isIncludeReplies
? _value.isIncludeReplies
: isIncludeReplies // ignore: cast_nullable_to_non_nullable
as bool,
isMediaOnly: null == isMediaOnly
? _value.isMediaOnly
: isMediaOnly // ignore: cast_nullable_to_non_nullable
as bool,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
acct: null == acct
? _value.acct
: acct // ignore: cast_nullable_to_non_nullable
as Acct,
renoteDisplay: null == renoteDisplay
? _value.renoteDisplay
: renoteDisplay // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _$TabSettingImpl extends _TabSetting {
const _$TabSettingImpl(
{@IconDataConverter() required this.icon,
required this.tabType,
this.roleId,
this.channelId,
this.listId,
this.antennaId,
this.isSubscribe = true,
this.isIncludeReplies = true,
this.isMediaOnly = false,
this.name,
@JsonKey(readValue: _readAcct) required this.acct,
this.renoteDisplay = true})
: super._();
factory _$TabSettingImpl.fromJson(Map<String, dynamic> json) =>
_$$TabSettingImplFromJson(json);
@override
@IconDataConverter()
final TabIcon icon;
/// タブ種別
@override
final TabType tabType;
/// ロールタイムラインのノートの場合、ロールID
@override
final String? roleId;
/// チャンネルのノートの場合、チャンネルID
@override
final String? channelId;
/// リストのノートの場合、リストID
@override
final String? listId;
/// アンテナのノートの場合、アンテナID
@override
final String? antennaId;
/// ノートの投稿のキャプチャをするかどうか
@override
@JsonKey()
final bool isSubscribe;
/// 返信を含むかどうか
@override
@JsonKey()
final bool isIncludeReplies;
/// ファイルのみにするかどうか
@override
@JsonKey()
final bool isMediaOnly;
/// タブ名
@override
final String? name;
/// アカウント情報
// https://github.com/rrousselGit/freezed/issues/488
// ignore: invalid_annotation_target
@override
@JsonKey(readValue: _readAcct)
final Acct acct;
/// Renoteを表示するかどうか
@override
@JsonKey()
final bool renoteDisplay;
@override
String toString() {
return 'TabSetting(icon: $icon, tabType: $tabType, roleId: $roleId, channelId: $channelId, listId: $listId, antennaId: $antennaId, isSubscribe: $isSubscribe, isIncludeReplies: $isIncludeReplies, isMediaOnly: $isMediaOnly, name: $name, acct: $acct, renoteDisplay: $renoteDisplay)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$TabSettingImpl &&
(identical(other.icon, icon) || other.icon == icon) &&
(identical(other.tabType, tabType) || other.tabType == tabType) &&
(identical(other.roleId, roleId) || other.roleId == roleId) &&
(identical(other.channelId, channelId) ||
other.channelId == channelId) &&
(identical(other.listId, listId) || other.listId == listId) &&
(identical(other.antennaId, antennaId) ||
other.antennaId == antennaId) &&
(identical(other.isSubscribe, isSubscribe) ||
other.isSubscribe == isSubscribe) &&
(identical(other.isIncludeReplies, isIncludeReplies) ||
other.isIncludeReplies == isIncludeReplies) &&
(identical(other.isMediaOnly, isMediaOnly) ||
other.isMediaOnly == isMediaOnly) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.acct, acct) || other.acct == acct) &&
(identical(other.renoteDisplay, renoteDisplay) ||
other.renoteDisplay == renoteDisplay));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
icon,
tabType,
roleId,
channelId,
listId,
antennaId,
isSubscribe,
isIncludeReplies,
isMediaOnly,
name,
acct,
renoteDisplay);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$TabSettingImplCopyWith<_$TabSettingImpl> get copyWith =>
__$$TabSettingImplCopyWithImpl<_$TabSettingImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$TabSettingImplToJson(
this,
);
}
}
abstract class _TabSetting extends TabSetting {
const factory _TabSetting(
{@IconDataConverter() required final TabIcon icon,
required final TabType tabType,
final String? roleId,
final String? channelId,
final String? listId,
final String? antennaId,
final bool isSubscribe,
final bool isIncludeReplies,
final bool isMediaOnly,
final String? name,
@JsonKey(readValue: _readAcct) required final Acct acct,
final bool renoteDisplay}) = _$TabSettingImpl;
const _TabSetting._() : super._();
factory _TabSetting.fromJson(Map<String, dynamic> json) =
_$TabSettingImpl.fromJson;
@override
@IconDataConverter()
TabIcon get icon;
@override
/// タブ種別
TabType get tabType;
@override
/// ロールタイムラインのノートの場合、ロールID
String? get roleId;
@override
/// チャンネルのノートの場合、チャンネルID
String? get channelId;
@override
/// リストのノートの場合、リストID
String? get listId;
@override
/// アンテナのノートの場合、アンテナID
String? get antennaId;
@override
/// ノートの投稿のキャプチャをするかどうか
bool get isSubscribe;
@override
/// 返信を含むかどうか
bool get isIncludeReplies;
@override
/// ファイルのみにするかどうか
bool get isMediaOnly;
@override
/// タブ名
String? get name;
@override
/// アカウント情報
// https://github.com/rrousselGit/freezed/issues/488
// ignore: invalid_annotation_target
@JsonKey(readValue: _readAcct)
Acct get acct;
@override
/// Renoteを表示するかどうか
bool get renoteDisplay;
@override
@JsonKey(ignore: true)
_$$TabSettingImplCopyWith<_$TabSettingImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib/model | mirrored_repositories/miria/lib/model/converters/icon_converter.dart | import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:miria/model/tab_icon.dart';
class IconDataConverter extends JsonConverter<TabIcon, dynamic> {
const IconDataConverter();
@override
TabIcon fromJson(dynamic json) {
if (json is int) {
// old compatibility
return TabIcon(codePoint: json);
} else if (json is Map<String, dynamic>) {
return TabIcon.fromJson(json);
} else {
throw UnimplementedError();
}
}
@override
dynamic toJson(TabIcon object) => object.toJson();
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/reaction_acceptance_extension.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:misskey_dart/misskey_dart.dart';
extension ReactionAcceptanceExtension on ReactionAcceptance {
String displayName(BuildContext context) {
return switch (this) {
ReactionAcceptance.likeOnlyForRemote =>
S.of(context).favoriteLikeOnlyForRemote,
ReactionAcceptance.nonSensitiveOnly =>
S.of(context).favoriteNonSensitiveOnly,
ReactionAcceptance.nonSensitiveOnlyForLocalLikeOnlyForRemote =>
S.of(context).favoriteNonSensitiveOnlyAndLikeOnlyForRemote,
ReactionAcceptance.likeOnly => S.of(context).favoriteLikeOnly,
};
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/date_time_extension.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:intl/intl.dart';
extension DateTimeExtension on DateTime {
Duration operator -(DateTime other) => difference(other);
operator <(DateTime other) => compareTo(other) < 0;
operator <=(DateTime other) => compareTo(other) <= 0;
operator >(DateTime other) => compareTo(other) > 0;
operator >=(DateTime other) => compareTo(other) >= 0;
String format(BuildContext context) {
final localeName = Localizations.localeOf(context).toLanguageTag();
return DateFormat.yMMMd(localeName).format(toUtc().toLocal());
}
String formatUntilSeconds(BuildContext context) {
final localeName = Localizations.localeOf(context).toLanguageTag();
final formattedDate =
DateFormat.yMMMd(localeName).add_Hms().format(toUtc().toLocal());
return "${year < 0 ? "-" : ""}$formattedDate";
}
String formatUntilMilliSeconds(BuildContext context) {
final localeName = Localizations.localeOf(context).toLanguageTag();
final formattedDate = DateFormat.yMd(localeName)
.add_Hms()
.addPattern("S", ".")
.format(toUtc().toLocal());
return "${year < 0 ? "-" : ""}$formattedDate";
}
String differenceNowDetail(BuildContext context) {
final differ = this - DateTime.now();
if (differ <= Duration.zero) {
return differenceNow(context);
} else if (differ >= const Duration(days: 365)) {
return S.of(context).inYears(differ.inDays ~/ 365);
} else if (differ >= const Duration(days: 1)) {
return S.of(context).inDays(differ.inDays);
} else if (differ >= const Duration(hours: 1)) {
return S.of(context).inHours(differ.inHours);
} else if (differ >= const Duration(minutes: 1)) {
return S.of(context).inMinutes(differ.inMinutes);
} else if (differ >= const Duration(seconds: 1)) {
return S.of(context).inSeconds(differ.inSeconds);
} else {
return S.of(context).justNow;
}
}
String differenceNow(BuildContext context) {
final differ = DateTime.now() - this;
if (DateTime.now() < this) {
return S.of(context).future;
} else if (differ < const Duration(seconds: 1)) {
return S.of(context).justNow;
} else if (differ < const Duration(minutes: 1)) {
return S.of(context).secondsAgo(differ.inSeconds);
} else if (differ < const Duration(hours: 1)) {
return S.of(context).minutesAgo(differ.inMinutes);
} else if (differ < const Duration(days: 1)) {
return S.of(context).hoursAgo(differ.inHours);
} else if (differ <= const Duration(days: 365)) {
return S.of(context).daysAgo(differ.inDays);
} else {
return S.of(context).yearsAgo(differ.inDays ~/ 365);
}
}
}
extension DurationExtenion on Duration {
String format(BuildContext context) {
if (this < const Duration(minutes: 1)) {
return S.of(context).nSeconds(inSeconds);
} else if (this < const Duration(hours: 1)) {
return S.of(context).nMinutes(inMinutes);
} else if (this < const Duration(days: 1)) {
return S.of(context).nHours(inHours);
} else {
return S.of(context).nDays(inDays);
}
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/list_mfm_node_extension.dart | import 'dart:collection';
import 'package:mfm_parser/mfm_parser.dart';
extension ListMfmNodeExtension on List<MfmNode> {
// https://github.com/misskey-dev/misskey/blob/2023.9.2/packages/frontend/src/scripts/extract-url-from-mfm.ts
List<String> extractLinks() {
String removeHash(String link) {
final hashIndex = link.lastIndexOf("#");
if (hashIndex < 0) {
return link;
} else {
return link.substring(0, hashIndex);
}
}
// # より前の部分が重複しているものを取り除く
final links = LinkedHashSet<String>(
equals: (link, other) => removeHash(link) == removeHash(other),
hashCode: (link) => removeHash(link).hashCode,
);
for (final node in this) {
final children = node.children;
if (children != null) {
links.addAll(children.extractLinks());
}
if (node is MfmURL) {
links.add(node.value);
} else if (node is MfmLink) {
if (!node.silent) {
links.add(node.url);
}
}
}
return links.toList();
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/user_extension.dart | import 'package:misskey_dart/misskey_dart.dart';
extension UserExtension on User {
String get acct {
return "@$username${host != null ? "@$host" : ""}";
}
}
extension UserDetailedExtension on UserDetailed {
bool get isFollowersVisibleForMe {
if (this is MeDetailed) {
return true;
}
final user = this;
return switch (followersVisibility ?? ffVisibility) {
FFVisibility.public => true,
FFVisibility.followers =>
user is UserDetailedNotMeWithRelations && user.isFollowing,
FFVisibility.private || null => false,
};
}
bool get isFollowingVisibleForMe {
if (this is MeDetailed) {
return true;
}
final user = this;
return switch (followingVisibility ?? ffVisibility) {
FFVisibility.public => true,
FFVisibility.followers =>
user is UserDetailedNotMeWithRelations && user.isFollowing,
FFVisibility.private || null => false,
};
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/note_extension.dart | import 'package:misskey_dart/misskey_dart.dart';
extension NoteExtension on Note {
bool get isEmptyRenote =>
renoteId != null &&
text == null &&
cw == null &&
files.isEmpty &&
poll == null;
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/color_extension.dart | import 'package:flutter/material.dart';
extension ColorExtension on Color {
Color darken([double amount = .1]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(this);
final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
return hslDark.toColor();
}
Color lighten([double amount = .1]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(this);
final hslLight =
hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0));
return hslLight.toColor();
}
Color spin(double amount) {
final hsl = HSLColor.fromColor(this);
final hslSpinned = hsl.withHue((hsl.hue + amount) % 360);
return hslSpinned.toColor();
}
Color saturate([double amount = .1]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(this);
final hslSaturated =
hsl.withSaturation((hsl.saturation + amount).clamp(0.0, 1.0));
return hslSaturated.toColor();
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/color_option_extension.dart | import 'package:image_editor/image_editor.dart';
// inspired colorfilter_generator
// https://github.com/hsbijarniya/colorfilter_generator/
extension ColorOptionExtension on ColorOption {}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/text_editing_controller_extension.dart | import 'package:flutter/material.dart';
import 'package:miria/model/input_completion_type.dart';
extension TextEditingControllerExtension on TextEditingController {
String? get textBeforeSelection {
final baseOffset = selection.baseOffset;
if (baseOffset < 0) {
return null;
}
return text.substring(0, baseOffset);
}
String? get emojiQuery {
final textBeforeSelection = this.textBeforeSelection;
if (textBeforeSelection == null) {
return null;
}
final lastColonIndex = textBeforeSelection.lastIndexOf(":");
if (lastColonIndex < 0) {
return null;
}
if (RegExp(r':[a-zA-z_0-9]+?:$')
.hasMatch(text.substring(0, lastColonIndex + 1))) {
return null;
} else {
return textBeforeSelection.substring(lastColonIndex + 1);
}
}
String? get mfmFnQuery {
final textBeforeSelection = this.textBeforeSelection;
if (textBeforeSelection == null) {
return null;
}
final lastOpenTagIndex = textBeforeSelection.lastIndexOf(r"$[");
if (lastOpenTagIndex < 0) {
return null;
}
final query = textBeforeSelection.substring(lastOpenTagIndex + 2);
if (RegExp(r"^[a-zA-Z0-9_.,-=]*$").hasMatch(query)) {
return query;
} else {
return null;
}
}
String? get hashtagQuery {
final textBeforeSelection = this.textBeforeSelection;
if (textBeforeSelection == null) {
return null;
}
final lastHashIndex = textBeforeSelection.lastIndexOf("#");
if (lastHashIndex < 0) {
return null;
}
final query = textBeforeSelection.substring(lastHashIndex + 1);
if (query.contains(RegExp(r"""[ \u3000\t.,!?'"#:/[\]【】()「」()<>]"""))) {
return null;
} else {
return query;
}
}
InputCompletionType get inputCompletionType {
final emojiQuery = this.emojiQuery;
if (emojiQuery != null) {
return Emoji(emojiQuery);
}
final mfmFnQuery = this.mfmFnQuery;
if (mfmFnQuery != null) {
return MfmFn(mfmFnQuery);
}
final hashtagQuery = this.hashtagQuery;
if (hashtagQuery != null) {
return Hashtag(hashtagQuery);
}
return Basic();
}
void insert(String insertText, {String? afterText}) {
final currentPosition = selection.base.offset;
final before = text.isEmpty ? "" : text.substring(0, currentPosition);
final after = (currentPosition == text.length || currentPosition == -1)
? ""
: text.substring(currentPosition, text.length);
value = TextEditingValue(
text: "$before$insertText${afterText ?? ""}$after",
selection: TextSelection.collapsed(
offset: (currentPosition == -1 ? 0 : currentPosition) +
insertText.length));
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/users_lists_show_response_extension.dart | import 'package:misskey_dart/misskey_dart.dart';
extension UsersListsShowResponseExtension on UsersListsShowResponse {
UsersList toUsersList() {
return UsersList(
id: id,
createdAt: createdAt,
name: name,
userIds: userIds,
isPublic: isPublic,
);
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/users_sort_type_extension.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:misskey_dart/misskey_dart.dart';
extension UsersSortTypeExtension on UsersSortType {
String displayName(BuildContext context) {
return switch (this) {
UsersSortType.followerAscendant => S.of(context).followerAscendingOrder,
UsersSortType.followerDescendant => S.of(context).followerDescendingOrder,
UsersSortType.createdAtAscendant => S.of(context).createdAtAscendingOrder,
UsersSortType.createdAtDescendant =>
S.of(context).createdAtDescendingOrder,
UsersSortType.updateAtAscendant => S.of(context).updatedAtAscendingOrder,
UsersSortType.updateAtDescendant =>
S.of(context).updatedAtDescendingOrder,
};
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/note_visibility_extension.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:misskey_dart/misskey_dart.dart';
extension NoteVisibilityExtension on NoteVisibility {
IconData get icon {
return switch (this) {
NoteVisibility.public => Icons.public,
NoteVisibility.home => Icons.home,
NoteVisibility.followers => Icons.lock,
NoteVisibility.specified => Icons.mail,
};
}
String displayName(BuildContext context) {
return switch (this) {
NoteVisibility.public => S.of(context).public,
NoteVisibility.home => S.of(context).homeOnly,
NoteVisibility.followers => S.of(context).followersOnly,
NoteVisibility.specified => S.of(context).direct,
};
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/origin_extension.dart | import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:misskey_dart/misskey_dart.dart';
extension OriginExtension on Origin {
String displayName(BuildContext context) {
return switch (this) {
Origin.local => S.of(context).local,
Origin.remote => S.of(context).remote,
Origin.combined => S.of(context).originCombined,
};
}
}
| 0 |
mirrored_repositories/miria/lib | mirrored_repositories/miria/lib/extensions/string_extensions.dart | import 'package:flutter/widgets.dart';
extension StringExtensions on String {
String get tight {
return Characters(this)
.replaceAll(Characters(''), Characters('\u{200B}'))
.toString();
}
Color? toColor() {
final code = startsWith("#") ? substring(1) : this;
switch (code.length) {
case 3:
final rgb = code
.split("")
.map((c) => int.tryParse(c, radix: 16))
.nonNulls
.map((i) => i * 16 + i)
.toList();
if (rgb.length == 3) {
return Color.fromRGBO(rgb[0], rgb[1], rgb[2], 1);
}
case 4:
final argb = code
.split("")
.map((c) => int.tryParse(c, radix: 16))
.nonNulls
.map((i) => i * 16 + i)
.toList();
if (argb.length != 4) {
return Color.fromARGB(argb[0], argb[1], argb[2], argb[3]);
}
case 6:
final hex = int.tryParse(code, radix: 16);
if (hex != null) {
return Color(hex + 0xFF000000);
}
case 8:
final hex = int.tryParse(
"${code.substring(6)}${code.substring(0, 6)}",
radix: 16,
);
if (hex != null) {
return Color(hex);
}
default:
return null;
}
return null;
}
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/clip_list_page/clips_notifier.dart | import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/clip_settings.dart';
import 'package:misskey_dart/misskey_dart.dart';
class ClipsNotifier
extends AutoDisposeFamilyAsyncNotifier<List<Clip>, Misskey> {
@override
Future<List<Clip>> build(Misskey arg) async {
final response = await _misskey.clips.list();
return response.toList();
}
Misskey get _misskey => arg;
Future<void> create(ClipSettings settings) async {
final list = await _misskey.clips.create(
ClipsCreateRequest(
name: settings.name,
description: settings.description,
isPublic: settings.isPublic,
),
);
state = AsyncValue.data([...?state.valueOrNull, list]);
}
Future<void> delete(String clipId) async {
await _misskey.clips.delete(ClipsDeleteRequest(clipId: clipId));
state = AsyncValue.data(
state.valueOrNull?.where((e) => e.id != clipId).toList() ?? [],
);
}
Future<void> updateClip(
String clipId,
ClipSettings settings,
) async {
final clip = await _misskey.clips.update(
ClipsUpdateRequest(
clipId: clipId,
name: settings.name,
description: settings.description,
isPublic: settings.isPublic,
),
);
state = AsyncValue.data(
state.valueOrNull
?.map(
(e) => (e.id == clipId) ? clip : e,
)
.toList() ??
[],
);
}
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/note_create_page/note_create_state_notifier.dart | import 'dart:typed_data';
import 'package:dio/dio.dart';
import 'package:file/file.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_image_compress/flutter_image_compress.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:mfm_parser/mfm_parser.dart';
import 'package:miria/extensions/note_visibility_extension.dart';
import 'package:miria/model/account.dart';
import 'package:miria/model/image_file.dart';
import 'package:miria/repository/note_repository.dart';
import 'package:miria/view/common/error_dialog_handler.dart';
import 'package:miria/view/dialogs/simple_confirm_dialog.dart';
import 'package:miria/view/dialogs/simple_message_dialog.dart';
import 'package:miria/view/note_create_page/drive_file_select_dialog.dart';
import 'package:miria/view/note_create_page/drive_modal_sheet.dart';
import 'package:miria/view/note_create_page/file_settings_dialog.dart';
import 'package:miria/view/note_create_page/note_create_page.dart';
import 'package:miria/view/user_select_dialog.dart';
import 'package:misskey_dart/misskey_dart.dart';
part 'note_create_state_notifier.freezed.dart';
enum NoteSendStatus { sending, finished, error }
enum VoteExpireType {
unlimited,
date,
duration;
String displayText(BuildContext context) {
return switch (this) {
VoteExpireType.unlimited => S.of(context).unlimited,
VoteExpireType.date => S.of(context).specifyByDate,
VoteExpireType.duration => S.of(context).specifyByDuration,
};
}
}
enum VoteExpireDurationType {
seconds,
minutes,
hours,
day;
String displayText(BuildContext context) {
return switch (this) {
VoteExpireDurationType.seconds => S.of(context).seconds,
VoteExpireDurationType.minutes => S.of(context).minutes,
VoteExpireDurationType.hours => S.of(context).hours,
VoteExpireDurationType.day => S.of(context).days,
};
}
}
sealed class NoteCreateException implements Exception {}
class EmptyNoteException implements NoteCreateException {}
class TooFewVoteChoiceException implements NoteCreateException {}
class EmptyVoteExpireDateException implements NoteCreateException {}
class EmptyVoteExpireDurationException implements NoteCreateException {}
class MentionToRemoteInLocalOnlyNoteException implements NoteCreateException {}
@freezed
class NoteCreate with _$NoteCreate {
const factory NoteCreate({
required Account account,
required NoteVisibility noteVisibility,
required bool localOnly,
@Default([]) List<User> replyTo,
@Default([]) List<MisskeyPostFile> files,
NoteCreateChannel? channel,
Note? reply,
Note? renote,
required ReactionAcceptance? reactionAcceptance,
@Default(false) bool isCw,
@Default("") String cwText,
@Default("") String text,
@Default(false) bool isTextFocused,
NoteSendStatus? isNoteSending,
@Default(false) bool isVote,
@Default(["", ""]) List<String> voteContent,
@Default(2) int voteContentCount,
@Default(VoteExpireType.unlimited) VoteExpireType voteExpireType,
@Default(false) bool isVoteMultiple,
DateTime? voteDate,
int? voteDuration,
@Default(VoteExpireDurationType.seconds)
VoteExpireDurationType voteDurationType,
NoteCreationMode? noteCreationMode,
String? noteId,
}) = _NoteCreate;
}
@freezed
class NoteCreateChannel with _$NoteCreateChannel {
const factory NoteCreateChannel({
required String id,
required String name,
}) = _NoteCreateChannel;
}
class NoteCreateNotifier extends StateNotifier<NoteCreate> {
FileSystem fileSystem;
Dio dio;
Misskey misskey;
NoteRepository noteRepository;
StateNotifier<(Object? error, BuildContext? context)> errorNotifier;
NoteCreateNotifier(
super.state,
this.fileSystem,
this.dio,
this.misskey,
this.errorNotifier,
this.noteRepository,
);
/// 初期化する
Future<void> initialize(
CommunityChannel? channel,
String? initialText,
List<String>? initialMediaFiles,
Note? note,
Note? renote,
Note? reply,
NoteCreationMode? noteCreationMode,
) async {
var resultState = state;
final NoteCreateChannel? channelData;
if (channel != null) {
channelData = NoteCreateChannel(id: channel.id, name: channel.name);
} else if (reply?.channel != null) {
channelData =
NoteCreateChannel(id: reply!.channel!.id, name: reply.channel!.name);
} else {
channelData = null;
}
resultState = resultState.copyWith(channel: channelData);
// 共有からの反映
if (initialText != null) {
resultState = resultState.copyWith(text: initialText);
}
if (initialMediaFiles != null && initialMediaFiles.isNotEmpty == true) {
resultState = resultState.copyWith(
files: await Future.wait(
initialMediaFiles.map((media) async {
final file = fileSystem.file(media);
final contents = await file.readAsBytes();
final fileName = file.basename;
final extension = fileName.split(".").last.toLowerCase();
if (["jpg", "png", "gif", "webp"].contains(extension)) {
return ImageFile(
data: contents,
fileName: fileName,
);
} else {
return UnknownFile(
data: contents,
fileName: fileName,
);
}
}),
),
);
}
// 削除されたノートの反映
if (note != null) {
final files = <MisskeyPostFile>[];
for (final file in note.files) {
if (file.type.startsWith("image")) {
final response = await dio.get(file.url,
options: Options(responseType: ResponseType.bytes));
files.add(
ImageFileAlreadyPostedFile(
fileName: file.name,
data: response.data,
id: file.id,
isNsfw: file.isSensitive,
caption: file.comment,
),
);
} else {
files.add(
UnknownAlreadyPostedFile(
url: file.url,
id: file.id,
fileName: file.name,
isNsfw: file.isSensitive,
caption: file.comment,
),
);
}
}
final deletedNoteChannel = note.channel;
final replyTo = <User>[];
if (note.mentions.isNotEmpty) {
replyTo.addAll(
await misskey.users
.showByIds(UsersShowByIdsRequest(userIds: note.mentions)),
);
}
resultState = resultState.copyWith(
noteVisibility: note.visibility,
localOnly: note.localOnly,
files: files,
channel: deletedNoteChannel != null
? NoteCreateChannel(
id: deletedNoteChannel.id, name: deletedNoteChannel.name)
: null,
cwText: note.cw ?? "",
isCw: note.cw?.isNotEmpty == true,
text: note.text ?? "",
reactionAcceptance: note.reactionAcceptance,
replyTo: replyTo.toList(),
isVote: note.poll != null,
isVoteMultiple: note.poll?.multiple ?? false,
voteExpireType: note.poll?.expiresAt == null
? VoteExpireType.unlimited
: VoteExpireType.date,
voteContentCount: note.poll?.choices.map((e) => e.text).length ?? 2,
voteContent: note.poll?.choices.map((e) => e.text).toList() ?? [],
voteDate: note.poll?.expiresAt,
noteCreationMode: noteCreationMode,
noteId: note.id,
renote: note.renote,
reply: note.reply,
);
state = resultState;
return;
}
if (renote != null) {
resultState = resultState.copyWith(
renote: renote,
noteVisibility: NoteVisibility.min(
resultState.noteVisibility, renote.visibility));
}
if (reply != null) {
final replyTo = <User>[];
if (reply.mentions.isNotEmpty) {
replyTo.addAll(
await misskey.users
.showByIds(UsersShowByIdsRequest(userIds: reply.mentions)),
);
}
resultState = resultState.copyWith(
reply: reply,
noteVisibility:
NoteVisibility.min(resultState.noteVisibility, reply.visibility),
cwText: reply.cw ?? "",
isCw: reply.cw?.isNotEmpty == true,
replyTo: [
reply.user,
...replyTo,
]..removeWhere((element) => element.id == state.account.i.id),
);
}
// チャンネルのノートか、リプライまたはリノートが連合オフ、デフォルトで連合オフの場合、
// 返信やRenoteも強制連合オフ
if (channel != null ||
reply?.localOnly == true ||
renote?.localOnly == true) {
resultState = resultState.copyWith(localOnly: true);
}
// サイレンスの場合、ホーム以下に強制
final isSilenced = state.account.i.isSilenced;
if (isSilenced == true) {
resultState = resultState.copyWith(
noteVisibility: NoteVisibility.min(
resultState.noteVisibility, NoteVisibility.home));
}
state = resultState;
}
/// ノートを投稿する
Future<void> note(BuildContext context) async {
if (state.text.isEmpty && state.files.isEmpty && !state.isVote) {
throw EmptyNoteException();
}
if (state.isVote &&
state.voteContent.where((e) => e.isNotEmpty).length < 2) {
throw TooFewVoteChoiceException();
}
if (state.isVote &&
state.voteExpireType == VoteExpireType.date &&
state.voteDate == null) {
throw EmptyVoteExpireDateException();
}
if (state.isVote &&
state.voteExpireType == VoteExpireType.duration &&
state.voteDuration == null) {
throw EmptyVoteExpireDurationException();
}
try {
state = state.copyWith(isNoteSending: NoteSendStatus.sending);
final fileIds = <String>[];
for (final file in state.files) {
DriveFile? response;
switch (file) {
case ImageFile():
final fileName = file.fileName.toLowerCase();
var imageData = file.data;
try {
if (fileName.endsWith("jpg") ||
fileName.endsWith("jpeg") ||
fileName.endsWith("tiff") ||
fileName.endsWith("tif")) {
imageData =
await FlutterImageCompress.compressWithList(file.data);
}
} catch (e) {
print("failed to compress file");
}
response = await misskey.drive.files.createAsBinary(
DriveFilesCreateRequest(
force: true,
name: file.fileName,
isSensitive: file.isNsfw,
comment: file.caption,
),
imageData,
);
fileIds.add(response.id);
break;
case UnknownFile():
response = await misskey.drive.files.createAsBinary(
DriveFilesCreateRequest(
force: true,
name: file.fileName,
isSensitive: file.isNsfw,
comment: file.caption,
),
file.data,
);
fileIds.add(response.id);
break;
case UnknownAlreadyPostedFile():
if (file.isEdited) {
await misskey.drive.files.update(DriveFilesUpdateRequest(
fileId: file.id,
name: file.fileName,
isSensitive: file.isNsfw,
comment: file.caption,
));
}
fileIds.add(file.id);
break;
case ImageFileAlreadyPostedFile():
if (file.isEdited) {
response =
await misskey.drive.files.update(DriveFilesUpdateRequest(
fileId: file.id,
name: file.fileName,
isSensitive: file.isNsfw,
comment: file.caption,
));
}
fileIds.add(file.id);
break;
}
if (response?.isSensitive == true &&
!file.isNsfw &&
!state.account.i.alwaysMarkNsfw) {
if (context.mounted) {
final confirmResult = await SimpleConfirmDialog.show(
context: context,
message: S.of(context).unexpectedSensitive,
primary: S.of(context).staySensitive,
secondary: S.of(context).unsetSensitive,
);
if (confirmResult == false) {
await misskey.drive.files.update(
DriveFilesUpdateRequest(
fileId: fileIds.last,
isSensitive: false,
),
);
}
}
}
}
if (!mounted) return;
final nodes = const MfmParser().parse(state.text);
final userList = <MfmMention>[];
void findMfmMentions(List<MfmNode> nodes) {
for (final node in nodes) {
if (node is MfmMention) {
userList.add(node);
}
findMfmMentions(node.children ?? []);
}
}
findMfmMentions(nodes);
// 連合オフなのに他のサーバーの人がメンションに含まれている
if (state.localOnly &&
userList.any((element) =>
element.host != null &&
element.host != misskey.apiService.host)) {
throw MentionToRemoteInLocalOnlyNoteException();
}
final mentionTargetUsers = [
for (final user in userList)
await misskey.users.showByName(UsersShowByUserNameRequest(
userName: user.username, host: user.host))
];
final visibleUserIds = state.replyTo.map((e) => e.id).toList();
visibleUserIds.addAll(mentionTargetUsers.map((e) => e.id));
final baseText =
"${state.replyTo.map((e) => "@${e.username}${e.host == null ? " " : "@${e.host} "}").join("")}${state.text}";
final postText = baseText.isNotEmpty ? baseText : null;
final durationType = state.voteDurationType;
final voteDuration = Duration(
days: durationType == VoteExpireDurationType.day
? state.voteDuration ?? 0
: 0,
hours: durationType == VoteExpireDurationType.hours
? state.voteDuration ?? 0
: 0,
minutes: durationType == VoteExpireDurationType.minutes
? state.voteDuration ?? 0
: 0,
seconds: durationType == VoteExpireDurationType.seconds
? state.voteDuration ?? 0
: 0,
);
final poll = NotesCreatePollRequest(
choices: state.voteContent,
multiple: state.isVoteMultiple,
expiresAt: state.voteExpireType == VoteExpireType.date
? state.voteDate
: null,
expiredAfter: state.voteExpireType == VoteExpireType.duration
? voteDuration
: null);
if (state.noteCreationMode == NoteCreationMode.update) {
await misskey.notes.update(NotesUpdateRequest(
noteId: state.noteId!,
text: postText ?? "",
cw: state.isCw ? state.cwText : null,
));
noteRepository.registerNote(noteRepository.notes[state.noteId!]!
.copyWith(
text: postText ?? "", cw: state.isCw ? state.cwText : null));
} else {
await misskey.notes.create(NotesCreateRequest(
visibility: state.noteVisibility,
text: postText,
cw: state.isCw ? state.cwText : null,
localOnly: state.localOnly,
replyId: state.reply?.id,
renoteId: state.renote?.id,
channelId: state.channel?.id,
fileIds: fileIds.isEmpty ? null : fileIds,
visibleUserIds: visibleUserIds.toSet().toList(), //distinct list
reactionAcceptance: state.reactionAcceptance,
poll: state.isVote ? poll : null,
));
}
if (!mounted) return;
state = state.copyWith(isNoteSending: NoteSendStatus.finished);
} catch (e) {
state = state.copyWith(isNoteSending: NoteSendStatus.error);
rethrow;
}
}
/// メディアを選択する
Future<void> chooseFile(BuildContext context) async {
final result = await showModalBottomSheet<DriveModalSheetReturnValue?>(
context: context, builder: (context) => const DriveModalSheet());
if (result == DriveModalSheetReturnValue.drive) {
if (!mounted) return;
final result = await showDialog<List<DriveFile>?>(
context: context,
builder: (context) => DriveFileSelectDialog(
account: state.account,
allowMultiple: true,
),
);
if (result == null) return;
final files = await Future.wait(
result.map((file) async {
if (file.type.startsWith("image")) {
final fileContentResponse = await dio.get<Uint8List>(
file.url,
options: Options(responseType: ResponseType.bytes),
);
return ImageFileAlreadyPostedFile(
data: fileContentResponse.data!,
id: file.id,
fileName: file.name,
isNsfw: file.isSensitive,
caption: file.comment,
);
}
return UnknownAlreadyPostedFile(
url: file.url,
id: file.id,
fileName: file.name,
isNsfw: file.isSensitive,
caption: file.comment,
);
}),
);
if (!mounted) return;
state = state.copyWith(
files: [
...state.files,
...files,
],
);
} else if (result == DriveModalSheetReturnValue.upload) {
final result = await FilePicker.platform.pickFiles(
type: FileType.image,
allowMultiple: true,
);
if (result == null || result.files.isEmpty) return;
final fsFiles = result.files.map((file) {
final path = file.path;
if (path != null) {
return fileSystem.file(path);
}
return null;
}).nonNulls;
final files = await Future.wait(
fsFiles.map(
(file) async => ImageFile(
data: await file.readAsBytes(),
fileName: file.basename,
),
),
);
if (!mounted) return;
state = state.copyWith(
files: [
...state.files,
...files,
],
);
}
}
/// メディアの内容を変更する
void setFileContent(MisskeyPostFile file, Uint8List? content) {
if (content == null) return;
final files = state.files.toList();
switch (file) {
case ImageFile():
files[files.indexOf(file)] = ImageFile(
data: content,
fileName: file.fileName,
caption: file.caption,
isNsfw: file.isNsfw);
break;
case ImageFileAlreadyPostedFile():
files[files.indexOf(file)] = ImageFile(
data: content,
fileName: file.fileName,
caption: file.caption,
isNsfw: file.isNsfw);
break;
case UnknownFile():
files[files.indexOf(file)] = ImageFile(
data: content,
fileName: file.fileName,
caption: file.caption,
isNsfw: file.isNsfw);
break;
case UnknownAlreadyPostedFile():
files[files.indexOf(file)] = ImageFile(
data: content,
fileName: file.fileName,
caption: file.caption,
isNsfw: file.isNsfw);
break;
}
state = state.copyWith(files: files);
}
/// ファイルのメタデータを変更する
void setFileMetaData(int index, FileSettingsDialogResult result) {
final files = state.files.toList();
final file = state.files[index];
switch (file) {
case ImageFile():
files[index] = ImageFile(
data: file.data,
fileName: result.fileName,
caption: result.caption,
isNsfw: result.isNsfw,
);
break;
case ImageFileAlreadyPostedFile():
files[index] = ImageFileAlreadyPostedFile(
data: file.data,
id: file.id,
fileName: result.fileName,
isNsfw: result.isNsfw,
caption: result.caption,
isEdited: true,
);
break;
case UnknownFile():
files[index] = UnknownFile(
data: file.data,
fileName: result.fileName,
isNsfw: result.isNsfw,
caption: result.caption);
break;
case UnknownAlreadyPostedFile():
files[index] = UnknownAlreadyPostedFile(
url: file.url,
id: file.id,
fileName: result.fileName,
isNsfw: result.isNsfw,
caption: result.caption,
isEdited: true,
);
break;
}
state = state.copyWith(files: files);
}
/// メディアを削除する
void deleteFile(int index) {
final list = state.files.toList();
list.removeAt(index);
state = state.copyWith(files: list);
}
/// リプライ先ユーザーを追加する
Future<void> addReplyUser(BuildContext context) async {
final user = await showDialog<User?>(
context: context,
builder: (context) => UserSelectDialog(account: state.account));
if (user != null) {
state = state.copyWith(replyTo: [...state.replyTo, user]);
}
}
void deleteReplyUser(User user) async {
final list = state.replyTo.toList();
state = state.copyWith(replyTo: list..remove(user));
}
/// CWの表示を入れ替える
void toggleCw() {
state = state.copyWith(isCw: !state.isCw);
}
bool validateNoteVisibility(NoteVisibility visibility, BuildContext context) {
final replyVisibility = state.reply?.visibility;
if (replyVisibility == NoteVisibility.specified ||
replyVisibility == NoteVisibility.followers ||
replyVisibility == NoteVisibility.home) {
SimpleMessageDialog.show(
context,
S.of(context).cannotPublicReplyToPrivateNote(
replyVisibility!.displayName(context),
),
);
return false;
}
if (state.account.i.isSilenced == true) {
SimpleMessageDialog.show(
context,
S.of(context).cannotPublicNoteBySilencedUser,
);
return false;
}
return true;
}
/// ノートの公開範囲を設定する
void setNoteVisibility(NoteVisibility visibility) {
state = state.copyWith(noteVisibility: visibility);
}
/// ノートの連合オン・オフを設定する
void toggleLocalOnly(BuildContext context) {
// チャンネルのノートは強制ローカルから変えられない
if (state.channel != null) {
errorNotifier.state = (
SpecifiedException(S.of(context).cannotFederateNoteToChannel),
context
);
return;
}
if (state.reply?.localOnly == true) {
errorNotifier.state = (
SpecifiedException(S.of(context).cannotFederateReplyToLocalOnlyNote),
context
);
return;
}
if (state.renote?.localOnly == true) {
errorNotifier.state = (
SpecifiedException(S.of(context).cannotFederateRenoteToLocalOnlyNote),
context
);
return;
}
state = state.copyWith(localOnly: !state.localOnly);
}
/// リアクションの受け入れを設定する
void setReactionAcceptance(ReactionAcceptance? reactionAcceptance) {
state = state.copyWith(reactionAcceptance: reactionAcceptance);
}
/// 注釈のテキストを設定する
void setCwText(String text) {
state = state.copyWith(cwText: text);
}
/// 本文を設定する
void setContentText(String text) {
state = state.copyWith(text: text);
}
/// 本文へのフォーカスを設定する
void setContentTextFocused(bool isFocus) {
state = state.copyWith(isTextFocused: isFocus);
}
/// 投票をトグルする
void toggleVote() {
state = state.copyWith(isVote: !state.isVote);
}
void toggleVoteMultiple() {
state = state.copyWith(isVoteMultiple: !state.isVoteMultiple);
}
/// 投票を追加する
void addVoteContent() {
if (state.voteContentCount == 10) return;
final list = state.voteContent.toList();
list.add("");
state = state.copyWith(
voteContentCount: state.voteContentCount + 1, voteContent: list);
}
/// 投票の行を削除する
void deleteVoteContent(int index) {
if (state.voteContentCount == 2) return;
final list = state.voteContent.toList();
list.removeAt(index);
state = state.copyWith(
voteContentCount: state.voteContentCount - 1, voteContent: list);
}
/// 投票の内容を設定する
void setVoteContent(int index, String text) {
final list = state.voteContent.toList();
list[index] = text;
state = state.copyWith(voteContent: list);
}
void setVoteExpireDate(DateTime date) {
state = state.copyWith(voteDate: date);
}
void setVoteExpireType(VoteExpireType type) {
state = state.copyWith(voteExpireType: type);
}
void setVoteDuration(int time) {
state = state.copyWith(voteDuration: time);
}
void setVoteDurationType(VoteExpireDurationType type) {
state = state.copyWith(voteDurationType: type);
}
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/note_create_page/note_create_state_notifier.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'note_create_state_notifier.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$NoteCreate {
Account get account => throw _privateConstructorUsedError;
NoteVisibility get noteVisibility => throw _privateConstructorUsedError;
bool get localOnly => throw _privateConstructorUsedError;
List<User> get replyTo => throw _privateConstructorUsedError;
List<MisskeyPostFile> get files => throw _privateConstructorUsedError;
NoteCreateChannel? get channel => throw _privateConstructorUsedError;
Note? get reply => throw _privateConstructorUsedError;
Note? get renote => throw _privateConstructorUsedError;
ReactionAcceptance? get reactionAcceptance =>
throw _privateConstructorUsedError;
bool get isCw => throw _privateConstructorUsedError;
String get cwText => throw _privateConstructorUsedError;
String get text => throw _privateConstructorUsedError;
bool get isTextFocused => throw _privateConstructorUsedError;
NoteSendStatus? get isNoteSending => throw _privateConstructorUsedError;
bool get isVote => throw _privateConstructorUsedError;
List<String> get voteContent => throw _privateConstructorUsedError;
int get voteContentCount => throw _privateConstructorUsedError;
VoteExpireType get voteExpireType => throw _privateConstructorUsedError;
bool get isVoteMultiple => throw _privateConstructorUsedError;
DateTime? get voteDate => throw _privateConstructorUsedError;
int? get voteDuration => throw _privateConstructorUsedError;
VoteExpireDurationType get voteDurationType =>
throw _privateConstructorUsedError;
NoteCreationMode? get noteCreationMode => throw _privateConstructorUsedError;
String? get noteId => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$NoteCreateCopyWith<NoteCreate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $NoteCreateCopyWith<$Res> {
factory $NoteCreateCopyWith(
NoteCreate value, $Res Function(NoteCreate) then) =
_$NoteCreateCopyWithImpl<$Res, NoteCreate>;
@useResult
$Res call(
{Account account,
NoteVisibility noteVisibility,
bool localOnly,
List<User> replyTo,
List<MisskeyPostFile> files,
NoteCreateChannel? channel,
Note? reply,
Note? renote,
ReactionAcceptance? reactionAcceptance,
bool isCw,
String cwText,
String text,
bool isTextFocused,
NoteSendStatus? isNoteSending,
bool isVote,
List<String> voteContent,
int voteContentCount,
VoteExpireType voteExpireType,
bool isVoteMultiple,
DateTime? voteDate,
int? voteDuration,
VoteExpireDurationType voteDurationType,
NoteCreationMode? noteCreationMode,
String? noteId});
$AccountCopyWith<$Res> get account;
$NoteCreateChannelCopyWith<$Res>? get channel;
$NoteCopyWith<$Res>? get reply;
$NoteCopyWith<$Res>? get renote;
}
/// @nodoc
class _$NoteCreateCopyWithImpl<$Res, $Val extends NoteCreate>
implements $NoteCreateCopyWith<$Res> {
_$NoteCreateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? account = null,
Object? noteVisibility = null,
Object? localOnly = null,
Object? replyTo = null,
Object? files = null,
Object? channel = freezed,
Object? reply = freezed,
Object? renote = freezed,
Object? reactionAcceptance = freezed,
Object? isCw = null,
Object? cwText = null,
Object? text = null,
Object? isTextFocused = null,
Object? isNoteSending = freezed,
Object? isVote = null,
Object? voteContent = null,
Object? voteContentCount = null,
Object? voteExpireType = null,
Object? isVoteMultiple = null,
Object? voteDate = freezed,
Object? voteDuration = freezed,
Object? voteDurationType = null,
Object? noteCreationMode = freezed,
Object? noteId = freezed,
}) {
return _then(_value.copyWith(
account: null == account
? _value.account
: account // ignore: cast_nullable_to_non_nullable
as Account,
noteVisibility: null == noteVisibility
? _value.noteVisibility
: noteVisibility // ignore: cast_nullable_to_non_nullable
as NoteVisibility,
localOnly: null == localOnly
? _value.localOnly
: localOnly // ignore: cast_nullable_to_non_nullable
as bool,
replyTo: null == replyTo
? _value.replyTo
: replyTo // ignore: cast_nullable_to_non_nullable
as List<User>,
files: null == files
? _value.files
: files // ignore: cast_nullable_to_non_nullable
as List<MisskeyPostFile>,
channel: freezed == channel
? _value.channel
: channel // ignore: cast_nullable_to_non_nullable
as NoteCreateChannel?,
reply: freezed == reply
? _value.reply
: reply // ignore: cast_nullable_to_non_nullable
as Note?,
renote: freezed == renote
? _value.renote
: renote // ignore: cast_nullable_to_non_nullable
as Note?,
reactionAcceptance: freezed == reactionAcceptance
? _value.reactionAcceptance
: reactionAcceptance // ignore: cast_nullable_to_non_nullable
as ReactionAcceptance?,
isCw: null == isCw
? _value.isCw
: isCw // ignore: cast_nullable_to_non_nullable
as bool,
cwText: null == cwText
? _value.cwText
: cwText // ignore: cast_nullable_to_non_nullable
as String,
text: null == text
? _value.text
: text // ignore: cast_nullable_to_non_nullable
as String,
isTextFocused: null == isTextFocused
? _value.isTextFocused
: isTextFocused // ignore: cast_nullable_to_non_nullable
as bool,
isNoteSending: freezed == isNoteSending
? _value.isNoteSending
: isNoteSending // ignore: cast_nullable_to_non_nullable
as NoteSendStatus?,
isVote: null == isVote
? _value.isVote
: isVote // ignore: cast_nullable_to_non_nullable
as bool,
voteContent: null == voteContent
? _value.voteContent
: voteContent // ignore: cast_nullable_to_non_nullable
as List<String>,
voteContentCount: null == voteContentCount
? _value.voteContentCount
: voteContentCount // ignore: cast_nullable_to_non_nullable
as int,
voteExpireType: null == voteExpireType
? _value.voteExpireType
: voteExpireType // ignore: cast_nullable_to_non_nullable
as VoteExpireType,
isVoteMultiple: null == isVoteMultiple
? _value.isVoteMultiple
: isVoteMultiple // ignore: cast_nullable_to_non_nullable
as bool,
voteDate: freezed == voteDate
? _value.voteDate
: voteDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
voteDuration: freezed == voteDuration
? _value.voteDuration
: voteDuration // ignore: cast_nullable_to_non_nullable
as int?,
voteDurationType: null == voteDurationType
? _value.voteDurationType
: voteDurationType // ignore: cast_nullable_to_non_nullable
as VoteExpireDurationType,
noteCreationMode: freezed == noteCreationMode
? _value.noteCreationMode
: noteCreationMode // ignore: cast_nullable_to_non_nullable
as NoteCreationMode?,
noteId: freezed == noteId
? _value.noteId
: noteId // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$AccountCopyWith<$Res> get account {
return $AccountCopyWith<$Res>(_value.account, (value) {
return _then(_value.copyWith(account: value) as $Val);
});
}
@override
@pragma('vm:prefer-inline')
$NoteCreateChannelCopyWith<$Res>? get channel {
if (_value.channel == null) {
return null;
}
return $NoteCreateChannelCopyWith<$Res>(_value.channel!, (value) {
return _then(_value.copyWith(channel: value) as $Val);
});
}
@override
@pragma('vm:prefer-inline')
$NoteCopyWith<$Res>? get reply {
if (_value.reply == null) {
return null;
}
return $NoteCopyWith<$Res>(_value.reply!, (value) {
return _then(_value.copyWith(reply: value) as $Val);
});
}
@override
@pragma('vm:prefer-inline')
$NoteCopyWith<$Res>? get renote {
if (_value.renote == null) {
return null;
}
return $NoteCopyWith<$Res>(_value.renote!, (value) {
return _then(_value.copyWith(renote: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$NoteCreateImplCopyWith<$Res>
implements $NoteCreateCopyWith<$Res> {
factory _$$NoteCreateImplCopyWith(
_$NoteCreateImpl value, $Res Function(_$NoteCreateImpl) then) =
__$$NoteCreateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{Account account,
NoteVisibility noteVisibility,
bool localOnly,
List<User> replyTo,
List<MisskeyPostFile> files,
NoteCreateChannel? channel,
Note? reply,
Note? renote,
ReactionAcceptance? reactionAcceptance,
bool isCw,
String cwText,
String text,
bool isTextFocused,
NoteSendStatus? isNoteSending,
bool isVote,
List<String> voteContent,
int voteContentCount,
VoteExpireType voteExpireType,
bool isVoteMultiple,
DateTime? voteDate,
int? voteDuration,
VoteExpireDurationType voteDurationType,
NoteCreationMode? noteCreationMode,
String? noteId});
@override
$AccountCopyWith<$Res> get account;
@override
$NoteCreateChannelCopyWith<$Res>? get channel;
@override
$NoteCopyWith<$Res>? get reply;
@override
$NoteCopyWith<$Res>? get renote;
}
/// @nodoc
class __$$NoteCreateImplCopyWithImpl<$Res>
extends _$NoteCreateCopyWithImpl<$Res, _$NoteCreateImpl>
implements _$$NoteCreateImplCopyWith<$Res> {
__$$NoteCreateImplCopyWithImpl(
_$NoteCreateImpl _value, $Res Function(_$NoteCreateImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? account = null,
Object? noteVisibility = null,
Object? localOnly = null,
Object? replyTo = null,
Object? files = null,
Object? channel = freezed,
Object? reply = freezed,
Object? renote = freezed,
Object? reactionAcceptance = freezed,
Object? isCw = null,
Object? cwText = null,
Object? text = null,
Object? isTextFocused = null,
Object? isNoteSending = freezed,
Object? isVote = null,
Object? voteContent = null,
Object? voteContentCount = null,
Object? voteExpireType = null,
Object? isVoteMultiple = null,
Object? voteDate = freezed,
Object? voteDuration = freezed,
Object? voteDurationType = null,
Object? noteCreationMode = freezed,
Object? noteId = freezed,
}) {
return _then(_$NoteCreateImpl(
account: null == account
? _value.account
: account // ignore: cast_nullable_to_non_nullable
as Account,
noteVisibility: null == noteVisibility
? _value.noteVisibility
: noteVisibility // ignore: cast_nullable_to_non_nullable
as NoteVisibility,
localOnly: null == localOnly
? _value.localOnly
: localOnly // ignore: cast_nullable_to_non_nullable
as bool,
replyTo: null == replyTo
? _value._replyTo
: replyTo // ignore: cast_nullable_to_non_nullable
as List<User>,
files: null == files
? _value._files
: files // ignore: cast_nullable_to_non_nullable
as List<MisskeyPostFile>,
channel: freezed == channel
? _value.channel
: channel // ignore: cast_nullable_to_non_nullable
as NoteCreateChannel?,
reply: freezed == reply
? _value.reply
: reply // ignore: cast_nullable_to_non_nullable
as Note?,
renote: freezed == renote
? _value.renote
: renote // ignore: cast_nullable_to_non_nullable
as Note?,
reactionAcceptance: freezed == reactionAcceptance
? _value.reactionAcceptance
: reactionAcceptance // ignore: cast_nullable_to_non_nullable
as ReactionAcceptance?,
isCw: null == isCw
? _value.isCw
: isCw // ignore: cast_nullable_to_non_nullable
as bool,
cwText: null == cwText
? _value.cwText
: cwText // ignore: cast_nullable_to_non_nullable
as String,
text: null == text
? _value.text
: text // ignore: cast_nullable_to_non_nullable
as String,
isTextFocused: null == isTextFocused
? _value.isTextFocused
: isTextFocused // ignore: cast_nullable_to_non_nullable
as bool,
isNoteSending: freezed == isNoteSending
? _value.isNoteSending
: isNoteSending // ignore: cast_nullable_to_non_nullable
as NoteSendStatus?,
isVote: null == isVote
? _value.isVote
: isVote // ignore: cast_nullable_to_non_nullable
as bool,
voteContent: null == voteContent
? _value._voteContent
: voteContent // ignore: cast_nullable_to_non_nullable
as List<String>,
voteContentCount: null == voteContentCount
? _value.voteContentCount
: voteContentCount // ignore: cast_nullable_to_non_nullable
as int,
voteExpireType: null == voteExpireType
? _value.voteExpireType
: voteExpireType // ignore: cast_nullable_to_non_nullable
as VoteExpireType,
isVoteMultiple: null == isVoteMultiple
? _value.isVoteMultiple
: isVoteMultiple // ignore: cast_nullable_to_non_nullable
as bool,
voteDate: freezed == voteDate
? _value.voteDate
: voteDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
voteDuration: freezed == voteDuration
? _value.voteDuration
: voteDuration // ignore: cast_nullable_to_non_nullable
as int?,
voteDurationType: null == voteDurationType
? _value.voteDurationType
: voteDurationType // ignore: cast_nullable_to_non_nullable
as VoteExpireDurationType,
noteCreationMode: freezed == noteCreationMode
? _value.noteCreationMode
: noteCreationMode // ignore: cast_nullable_to_non_nullable
as NoteCreationMode?,
noteId: freezed == noteId
? _value.noteId
: noteId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$NoteCreateImpl implements _NoteCreate {
const _$NoteCreateImpl(
{required this.account,
required this.noteVisibility,
required this.localOnly,
final List<User> replyTo = const [],
final List<MisskeyPostFile> files = const [],
this.channel,
this.reply,
this.renote,
required this.reactionAcceptance,
this.isCw = false,
this.cwText = "",
this.text = "",
this.isTextFocused = false,
this.isNoteSending,
this.isVote = false,
final List<String> voteContent = const ["", ""],
this.voteContentCount = 2,
this.voteExpireType = VoteExpireType.unlimited,
this.isVoteMultiple = false,
this.voteDate,
this.voteDuration,
this.voteDurationType = VoteExpireDurationType.seconds,
this.noteCreationMode,
this.noteId})
: _replyTo = replyTo,
_files = files,
_voteContent = voteContent;
@override
final Account account;
@override
final NoteVisibility noteVisibility;
@override
final bool localOnly;
final List<User> _replyTo;
@override
@JsonKey()
List<User> get replyTo {
if (_replyTo is EqualUnmodifiableListView) return _replyTo;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_replyTo);
}
final List<MisskeyPostFile> _files;
@override
@JsonKey()
List<MisskeyPostFile> get files {
if (_files is EqualUnmodifiableListView) return _files;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_files);
}
@override
final NoteCreateChannel? channel;
@override
final Note? reply;
@override
final Note? renote;
@override
final ReactionAcceptance? reactionAcceptance;
@override
@JsonKey()
final bool isCw;
@override
@JsonKey()
final String cwText;
@override
@JsonKey()
final String text;
@override
@JsonKey()
final bool isTextFocused;
@override
final NoteSendStatus? isNoteSending;
@override
@JsonKey()
final bool isVote;
final List<String> _voteContent;
@override
@JsonKey()
List<String> get voteContent {
if (_voteContent is EqualUnmodifiableListView) return _voteContent;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_voteContent);
}
@override
@JsonKey()
final int voteContentCount;
@override
@JsonKey()
final VoteExpireType voteExpireType;
@override
@JsonKey()
final bool isVoteMultiple;
@override
final DateTime? voteDate;
@override
final int? voteDuration;
@override
@JsonKey()
final VoteExpireDurationType voteDurationType;
@override
final NoteCreationMode? noteCreationMode;
@override
final String? noteId;
@override
String toString() {
return 'NoteCreate(account: $account, noteVisibility: $noteVisibility, localOnly: $localOnly, replyTo: $replyTo, files: $files, channel: $channel, reply: $reply, renote: $renote, reactionAcceptance: $reactionAcceptance, isCw: $isCw, cwText: $cwText, text: $text, isTextFocused: $isTextFocused, isNoteSending: $isNoteSending, isVote: $isVote, voteContent: $voteContent, voteContentCount: $voteContentCount, voteExpireType: $voteExpireType, isVoteMultiple: $isVoteMultiple, voteDate: $voteDate, voteDuration: $voteDuration, voteDurationType: $voteDurationType, noteCreationMode: $noteCreationMode, noteId: $noteId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NoteCreateImpl &&
(identical(other.account, account) || other.account == account) &&
(identical(other.noteVisibility, noteVisibility) ||
other.noteVisibility == noteVisibility) &&
(identical(other.localOnly, localOnly) ||
other.localOnly == localOnly) &&
const DeepCollectionEquality().equals(other._replyTo, _replyTo) &&
const DeepCollectionEquality().equals(other._files, _files) &&
(identical(other.channel, channel) || other.channel == channel) &&
(identical(other.reply, reply) || other.reply == reply) &&
(identical(other.renote, renote) || other.renote == renote) &&
(identical(other.reactionAcceptance, reactionAcceptance) ||
other.reactionAcceptance == reactionAcceptance) &&
(identical(other.isCw, isCw) || other.isCw == isCw) &&
(identical(other.cwText, cwText) || other.cwText == cwText) &&
(identical(other.text, text) || other.text == text) &&
(identical(other.isTextFocused, isTextFocused) ||
other.isTextFocused == isTextFocused) &&
(identical(other.isNoteSending, isNoteSending) ||
other.isNoteSending == isNoteSending) &&
(identical(other.isVote, isVote) || other.isVote == isVote) &&
const DeepCollectionEquality()
.equals(other._voteContent, _voteContent) &&
(identical(other.voteContentCount, voteContentCount) ||
other.voteContentCount == voteContentCount) &&
(identical(other.voteExpireType, voteExpireType) ||
other.voteExpireType == voteExpireType) &&
(identical(other.isVoteMultiple, isVoteMultiple) ||
other.isVoteMultiple == isVoteMultiple) &&
(identical(other.voteDate, voteDate) ||
other.voteDate == voteDate) &&
(identical(other.voteDuration, voteDuration) ||
other.voteDuration == voteDuration) &&
(identical(other.voteDurationType, voteDurationType) ||
other.voteDurationType == voteDurationType) &&
(identical(other.noteCreationMode, noteCreationMode) ||
other.noteCreationMode == noteCreationMode) &&
(identical(other.noteId, noteId) || other.noteId == noteId));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
account,
noteVisibility,
localOnly,
const DeepCollectionEquality().hash(_replyTo),
const DeepCollectionEquality().hash(_files),
channel,
reply,
renote,
reactionAcceptance,
isCw,
cwText,
text,
isTextFocused,
isNoteSending,
isVote,
const DeepCollectionEquality().hash(_voteContent),
voteContentCount,
voteExpireType,
isVoteMultiple,
voteDate,
voteDuration,
voteDurationType,
noteCreationMode,
noteId
]);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NoteCreateImplCopyWith<_$NoteCreateImpl> get copyWith =>
__$$NoteCreateImplCopyWithImpl<_$NoteCreateImpl>(this, _$identity);
}
abstract class _NoteCreate implements NoteCreate {
const factory _NoteCreate(
{required final Account account,
required final NoteVisibility noteVisibility,
required final bool localOnly,
final List<User> replyTo,
final List<MisskeyPostFile> files,
final NoteCreateChannel? channel,
final Note? reply,
final Note? renote,
required final ReactionAcceptance? reactionAcceptance,
final bool isCw,
final String cwText,
final String text,
final bool isTextFocused,
final NoteSendStatus? isNoteSending,
final bool isVote,
final List<String> voteContent,
final int voteContentCount,
final VoteExpireType voteExpireType,
final bool isVoteMultiple,
final DateTime? voteDate,
final int? voteDuration,
final VoteExpireDurationType voteDurationType,
final NoteCreationMode? noteCreationMode,
final String? noteId}) = _$NoteCreateImpl;
@override
Account get account;
@override
NoteVisibility get noteVisibility;
@override
bool get localOnly;
@override
List<User> get replyTo;
@override
List<MisskeyPostFile> get files;
@override
NoteCreateChannel? get channel;
@override
Note? get reply;
@override
Note? get renote;
@override
ReactionAcceptance? get reactionAcceptance;
@override
bool get isCw;
@override
String get cwText;
@override
String get text;
@override
bool get isTextFocused;
@override
NoteSendStatus? get isNoteSending;
@override
bool get isVote;
@override
List<String> get voteContent;
@override
int get voteContentCount;
@override
VoteExpireType get voteExpireType;
@override
bool get isVoteMultiple;
@override
DateTime? get voteDate;
@override
int? get voteDuration;
@override
VoteExpireDurationType get voteDurationType;
@override
NoteCreationMode? get noteCreationMode;
@override
String? get noteId;
@override
@JsonKey(ignore: true)
_$$NoteCreateImplCopyWith<_$NoteCreateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$NoteCreateChannel {
String get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$NoteCreateChannelCopyWith<NoteCreateChannel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $NoteCreateChannelCopyWith<$Res> {
factory $NoteCreateChannelCopyWith(
NoteCreateChannel value, $Res Function(NoteCreateChannel) then) =
_$NoteCreateChannelCopyWithImpl<$Res, NoteCreateChannel>;
@useResult
$Res call({String id, String name});
}
/// @nodoc
class _$NoteCreateChannelCopyWithImpl<$Res, $Val extends NoteCreateChannel>
implements $NoteCreateChannelCopyWith<$Res> {
_$NoteCreateChannelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$NoteCreateChannelImplCopyWith<$Res>
implements $NoteCreateChannelCopyWith<$Res> {
factory _$$NoteCreateChannelImplCopyWith(_$NoteCreateChannelImpl value,
$Res Function(_$NoteCreateChannelImpl) then) =
__$$NoteCreateChannelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String id, String name});
}
/// @nodoc
class __$$NoteCreateChannelImplCopyWithImpl<$Res>
extends _$NoteCreateChannelCopyWithImpl<$Res, _$NoteCreateChannelImpl>
implements _$$NoteCreateChannelImplCopyWith<$Res> {
__$$NoteCreateChannelImplCopyWithImpl(_$NoteCreateChannelImpl _value,
$Res Function(_$NoteCreateChannelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
}) {
return _then(_$NoteCreateChannelImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$NoteCreateChannelImpl implements _NoteCreateChannel {
const _$NoteCreateChannelImpl({required this.id, required this.name});
@override
final String id;
@override
final String name;
@override
String toString() {
return 'NoteCreateChannel(id: $id, name: $name)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NoteCreateChannelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name));
}
@override
int get hashCode => Object.hash(runtimeType, id, name);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NoteCreateChannelImplCopyWith<_$NoteCreateChannelImpl> get copyWith =>
__$$NoteCreateChannelImplCopyWithImpl<_$NoteCreateChannelImpl>(
this, _$identity);
}
abstract class _NoteCreateChannel implements NoteCreateChannel {
const factory _NoteCreateChannel(
{required final String id,
required final String name}) = _$NoteCreateChannelImpl;
@override
String get id;
@override
String get name;
@override
@JsonKey(ignore: true)
_$$NoteCreateChannelImplCopyWith<_$NoteCreateChannelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/photo_edit_page/photo_edit_state_notifier.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'photo_edit_state_notifier.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$PhotoEdit {
bool get clipMode => throw _privateConstructorUsedError;
bool get colorFilterMode => throw _privateConstructorUsedError;
List<ColorFilterPreview> get colorFilterPreviewImages =>
throw _privateConstructorUsedError;
List<String> get adaptivePresets => throw _privateConstructorUsedError;
bool get isInitialized => throw _privateConstructorUsedError;
Uint8List? get initialImage => throw _privateConstructorUsedError;
Uint8List? get editedImage => throw _privateConstructorUsedError;
Offset get cropOffset => throw _privateConstructorUsedError;
Size get cropSize => throw _privateConstructorUsedError;
Size get defaultSize => throw _privateConstructorUsedError;
Size get actualSize => throw _privateConstructorUsedError;
int get angle => throw _privateConstructorUsedError;
List<EditedEmojiData> get emojis => throw _privateConstructorUsedError;
int? get selectedEmojiIndex => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$PhotoEditCopyWith<PhotoEdit> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PhotoEditCopyWith<$Res> {
factory $PhotoEditCopyWith(PhotoEdit value, $Res Function(PhotoEdit) then) =
_$PhotoEditCopyWithImpl<$Res, PhotoEdit>;
@useResult
$Res call(
{bool clipMode,
bool colorFilterMode,
List<ColorFilterPreview> colorFilterPreviewImages,
List<String> adaptivePresets,
bool isInitialized,
Uint8List? initialImage,
Uint8List? editedImage,
Offset cropOffset,
Size cropSize,
Size defaultSize,
Size actualSize,
int angle,
List<EditedEmojiData> emojis,
int? selectedEmojiIndex});
}
/// @nodoc
class _$PhotoEditCopyWithImpl<$Res, $Val extends PhotoEdit>
implements $PhotoEditCopyWith<$Res> {
_$PhotoEditCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? clipMode = null,
Object? colorFilterMode = null,
Object? colorFilterPreviewImages = null,
Object? adaptivePresets = null,
Object? isInitialized = null,
Object? initialImage = freezed,
Object? editedImage = freezed,
Object? cropOffset = null,
Object? cropSize = null,
Object? defaultSize = null,
Object? actualSize = null,
Object? angle = null,
Object? emojis = null,
Object? selectedEmojiIndex = freezed,
}) {
return _then(_value.copyWith(
clipMode: null == clipMode
? _value.clipMode
: clipMode // ignore: cast_nullable_to_non_nullable
as bool,
colorFilterMode: null == colorFilterMode
? _value.colorFilterMode
: colorFilterMode // ignore: cast_nullable_to_non_nullable
as bool,
colorFilterPreviewImages: null == colorFilterPreviewImages
? _value.colorFilterPreviewImages
: colorFilterPreviewImages // ignore: cast_nullable_to_non_nullable
as List<ColorFilterPreview>,
adaptivePresets: null == adaptivePresets
? _value.adaptivePresets
: adaptivePresets // ignore: cast_nullable_to_non_nullable
as List<String>,
isInitialized: null == isInitialized
? _value.isInitialized
: isInitialized // ignore: cast_nullable_to_non_nullable
as bool,
initialImage: freezed == initialImage
? _value.initialImage
: initialImage // ignore: cast_nullable_to_non_nullable
as Uint8List?,
editedImage: freezed == editedImage
? _value.editedImage
: editedImage // ignore: cast_nullable_to_non_nullable
as Uint8List?,
cropOffset: null == cropOffset
? _value.cropOffset
: cropOffset // ignore: cast_nullable_to_non_nullable
as Offset,
cropSize: null == cropSize
? _value.cropSize
: cropSize // ignore: cast_nullable_to_non_nullable
as Size,
defaultSize: null == defaultSize
? _value.defaultSize
: defaultSize // ignore: cast_nullable_to_non_nullable
as Size,
actualSize: null == actualSize
? _value.actualSize
: actualSize // ignore: cast_nullable_to_non_nullable
as Size,
angle: null == angle
? _value.angle
: angle // ignore: cast_nullable_to_non_nullable
as int,
emojis: null == emojis
? _value.emojis
: emojis // ignore: cast_nullable_to_non_nullable
as List<EditedEmojiData>,
selectedEmojiIndex: freezed == selectedEmojiIndex
? _value.selectedEmojiIndex
: selectedEmojiIndex // ignore: cast_nullable_to_non_nullable
as int?,
) as $Val);
}
}
/// @nodoc
abstract class _$$PhotoEditImplCopyWith<$Res>
implements $PhotoEditCopyWith<$Res> {
factory _$$PhotoEditImplCopyWith(
_$PhotoEditImpl value, $Res Function(_$PhotoEditImpl) then) =
__$$PhotoEditImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{bool clipMode,
bool colorFilterMode,
List<ColorFilterPreview> colorFilterPreviewImages,
List<String> adaptivePresets,
bool isInitialized,
Uint8List? initialImage,
Uint8List? editedImage,
Offset cropOffset,
Size cropSize,
Size defaultSize,
Size actualSize,
int angle,
List<EditedEmojiData> emojis,
int? selectedEmojiIndex});
}
/// @nodoc
class __$$PhotoEditImplCopyWithImpl<$Res>
extends _$PhotoEditCopyWithImpl<$Res, _$PhotoEditImpl>
implements _$$PhotoEditImplCopyWith<$Res> {
__$$PhotoEditImplCopyWithImpl(
_$PhotoEditImpl _value, $Res Function(_$PhotoEditImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? clipMode = null,
Object? colorFilterMode = null,
Object? colorFilterPreviewImages = null,
Object? adaptivePresets = null,
Object? isInitialized = null,
Object? initialImage = freezed,
Object? editedImage = freezed,
Object? cropOffset = null,
Object? cropSize = null,
Object? defaultSize = null,
Object? actualSize = null,
Object? angle = null,
Object? emojis = null,
Object? selectedEmojiIndex = freezed,
}) {
return _then(_$PhotoEditImpl(
clipMode: null == clipMode
? _value.clipMode
: clipMode // ignore: cast_nullable_to_non_nullable
as bool,
colorFilterMode: null == colorFilterMode
? _value.colorFilterMode
: colorFilterMode // ignore: cast_nullable_to_non_nullable
as bool,
colorFilterPreviewImages: null == colorFilterPreviewImages
? _value._colorFilterPreviewImages
: colorFilterPreviewImages // ignore: cast_nullable_to_non_nullable
as List<ColorFilterPreview>,
adaptivePresets: null == adaptivePresets
? _value._adaptivePresets
: adaptivePresets // ignore: cast_nullable_to_non_nullable
as List<String>,
isInitialized: null == isInitialized
? _value.isInitialized
: isInitialized // ignore: cast_nullable_to_non_nullable
as bool,
initialImage: freezed == initialImage
? _value.initialImage
: initialImage // ignore: cast_nullable_to_non_nullable
as Uint8List?,
editedImage: freezed == editedImage
? _value.editedImage
: editedImage // ignore: cast_nullable_to_non_nullable
as Uint8List?,
cropOffset: null == cropOffset
? _value.cropOffset
: cropOffset // ignore: cast_nullable_to_non_nullable
as Offset,
cropSize: null == cropSize
? _value.cropSize
: cropSize // ignore: cast_nullable_to_non_nullable
as Size,
defaultSize: null == defaultSize
? _value.defaultSize
: defaultSize // ignore: cast_nullable_to_non_nullable
as Size,
actualSize: null == actualSize
? _value.actualSize
: actualSize // ignore: cast_nullable_to_non_nullable
as Size,
angle: null == angle
? _value.angle
: angle // ignore: cast_nullable_to_non_nullable
as int,
emojis: null == emojis
? _value._emojis
: emojis // ignore: cast_nullable_to_non_nullable
as List<EditedEmojiData>,
selectedEmojiIndex: freezed == selectedEmojiIndex
? _value.selectedEmojiIndex
: selectedEmojiIndex // ignore: cast_nullable_to_non_nullable
as int?,
));
}
}
/// @nodoc
class _$PhotoEditImpl implements _PhotoEdit {
const _$PhotoEditImpl(
{this.clipMode = false,
this.colorFilterMode = false,
final List<ColorFilterPreview> colorFilterPreviewImages = const [],
final List<String> adaptivePresets = const [],
this.isInitialized = false,
this.initialImage,
this.editedImage,
this.cropOffset = const Offset(0, 0),
this.cropSize = Size.zero,
this.defaultSize = Size.zero,
this.actualSize = Size.zero,
this.angle = 0,
final List<EditedEmojiData> emojis = const [],
this.selectedEmojiIndex})
: _colorFilterPreviewImages = colorFilterPreviewImages,
_adaptivePresets = adaptivePresets,
_emojis = emojis;
@override
@JsonKey()
final bool clipMode;
@override
@JsonKey()
final bool colorFilterMode;
final List<ColorFilterPreview> _colorFilterPreviewImages;
@override
@JsonKey()
List<ColorFilterPreview> get colorFilterPreviewImages {
if (_colorFilterPreviewImages is EqualUnmodifiableListView)
return _colorFilterPreviewImages;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_colorFilterPreviewImages);
}
final List<String> _adaptivePresets;
@override
@JsonKey()
List<String> get adaptivePresets {
if (_adaptivePresets is EqualUnmodifiableListView) return _adaptivePresets;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_adaptivePresets);
}
@override
@JsonKey()
final bool isInitialized;
@override
final Uint8List? initialImage;
@override
final Uint8List? editedImage;
@override
@JsonKey()
final Offset cropOffset;
@override
@JsonKey()
final Size cropSize;
@override
@JsonKey()
final Size defaultSize;
@override
@JsonKey()
final Size actualSize;
@override
@JsonKey()
final int angle;
final List<EditedEmojiData> _emojis;
@override
@JsonKey()
List<EditedEmojiData> get emojis {
if (_emojis is EqualUnmodifiableListView) return _emojis;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_emojis);
}
@override
final int? selectedEmojiIndex;
@override
String toString() {
return 'PhotoEdit(clipMode: $clipMode, colorFilterMode: $colorFilterMode, colorFilterPreviewImages: $colorFilterPreviewImages, adaptivePresets: $adaptivePresets, isInitialized: $isInitialized, initialImage: $initialImage, editedImage: $editedImage, cropOffset: $cropOffset, cropSize: $cropSize, defaultSize: $defaultSize, actualSize: $actualSize, angle: $angle, emojis: $emojis, selectedEmojiIndex: $selectedEmojiIndex)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PhotoEditImpl &&
(identical(other.clipMode, clipMode) ||
other.clipMode == clipMode) &&
(identical(other.colorFilterMode, colorFilterMode) ||
other.colorFilterMode == colorFilterMode) &&
const DeepCollectionEquality().equals(
other._colorFilterPreviewImages, _colorFilterPreviewImages) &&
const DeepCollectionEquality()
.equals(other._adaptivePresets, _adaptivePresets) &&
(identical(other.isInitialized, isInitialized) ||
other.isInitialized == isInitialized) &&
const DeepCollectionEquality()
.equals(other.initialImage, initialImage) &&
const DeepCollectionEquality()
.equals(other.editedImage, editedImage) &&
(identical(other.cropOffset, cropOffset) ||
other.cropOffset == cropOffset) &&
(identical(other.cropSize, cropSize) ||
other.cropSize == cropSize) &&
(identical(other.defaultSize, defaultSize) ||
other.defaultSize == defaultSize) &&
(identical(other.actualSize, actualSize) ||
other.actualSize == actualSize) &&
(identical(other.angle, angle) || other.angle == angle) &&
const DeepCollectionEquality().equals(other._emojis, _emojis) &&
(identical(other.selectedEmojiIndex, selectedEmojiIndex) ||
other.selectedEmojiIndex == selectedEmojiIndex));
}
@override
int get hashCode => Object.hash(
runtimeType,
clipMode,
colorFilterMode,
const DeepCollectionEquality().hash(_colorFilterPreviewImages),
const DeepCollectionEquality().hash(_adaptivePresets),
isInitialized,
const DeepCollectionEquality().hash(initialImage),
const DeepCollectionEquality().hash(editedImage),
cropOffset,
cropSize,
defaultSize,
actualSize,
angle,
const DeepCollectionEquality().hash(_emojis),
selectedEmojiIndex);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PhotoEditImplCopyWith<_$PhotoEditImpl> get copyWith =>
__$$PhotoEditImplCopyWithImpl<_$PhotoEditImpl>(this, _$identity);
}
abstract class _PhotoEdit implements PhotoEdit {
const factory _PhotoEdit(
{final bool clipMode,
final bool colorFilterMode,
final List<ColorFilterPreview> colorFilterPreviewImages,
final List<String> adaptivePresets,
final bool isInitialized,
final Uint8List? initialImage,
final Uint8List? editedImage,
final Offset cropOffset,
final Size cropSize,
final Size defaultSize,
final Size actualSize,
final int angle,
final List<EditedEmojiData> emojis,
final int? selectedEmojiIndex}) = _$PhotoEditImpl;
@override
bool get clipMode;
@override
bool get colorFilterMode;
@override
List<ColorFilterPreview> get colorFilterPreviewImages;
@override
List<String> get adaptivePresets;
@override
bool get isInitialized;
@override
Uint8List? get initialImage;
@override
Uint8List? get editedImage;
@override
Offset get cropOffset;
@override
Size get cropSize;
@override
Size get defaultSize;
@override
Size get actualSize;
@override
int get angle;
@override
List<EditedEmojiData> get emojis;
@override
int? get selectedEmojiIndex;
@override
@JsonKey(ignore: true)
_$$PhotoEditImplCopyWith<_$PhotoEditImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$ColorFilterPreview {
String get name => throw _privateConstructorUsedError;
Uint8List? get image => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ColorFilterPreviewCopyWith<ColorFilterPreview> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ColorFilterPreviewCopyWith<$Res> {
factory $ColorFilterPreviewCopyWith(
ColorFilterPreview value, $Res Function(ColorFilterPreview) then) =
_$ColorFilterPreviewCopyWithImpl<$Res, ColorFilterPreview>;
@useResult
$Res call({String name, Uint8List? image});
}
/// @nodoc
class _$ColorFilterPreviewCopyWithImpl<$Res, $Val extends ColorFilterPreview>
implements $ColorFilterPreviewCopyWith<$Res> {
_$ColorFilterPreviewCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? image = freezed,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as Uint8List?,
) as $Val);
}
}
/// @nodoc
abstract class _$$ColorFilterPreviewImplCopyWith<$Res>
implements $ColorFilterPreviewCopyWith<$Res> {
factory _$$ColorFilterPreviewImplCopyWith(_$ColorFilterPreviewImpl value,
$Res Function(_$ColorFilterPreviewImpl) then) =
__$$ColorFilterPreviewImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String name, Uint8List? image});
}
/// @nodoc
class __$$ColorFilterPreviewImplCopyWithImpl<$Res>
extends _$ColorFilterPreviewCopyWithImpl<$Res, _$ColorFilterPreviewImpl>
implements _$$ColorFilterPreviewImplCopyWith<$Res> {
__$$ColorFilterPreviewImplCopyWithImpl(_$ColorFilterPreviewImpl _value,
$Res Function(_$ColorFilterPreviewImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? image = freezed,
}) {
return _then(_$ColorFilterPreviewImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as Uint8List?,
));
}
}
/// @nodoc
class _$ColorFilterPreviewImpl implements _ColorFilterPreview {
const _$ColorFilterPreviewImpl({required this.name, this.image});
@override
final String name;
@override
final Uint8List? image;
@override
String toString() {
return 'ColorFilterPreview(name: $name, image: $image)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ColorFilterPreviewImpl &&
(identical(other.name, name) || other.name == name) &&
const DeepCollectionEquality().equals(other.image, image));
}
@override
int get hashCode => Object.hash(
runtimeType, name, const DeepCollectionEquality().hash(image));
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ColorFilterPreviewImplCopyWith<_$ColorFilterPreviewImpl> get copyWith =>
__$$ColorFilterPreviewImplCopyWithImpl<_$ColorFilterPreviewImpl>(
this, _$identity);
}
abstract class _ColorFilterPreview implements ColorFilterPreview {
const factory _ColorFilterPreview(
{required final String name,
final Uint8List? image}) = _$ColorFilterPreviewImpl;
@override
String get name;
@override
Uint8List? get image;
@override
@JsonKey(ignore: true)
_$$ColorFilterPreviewImplCopyWith<_$ColorFilterPreviewImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$EditedEmojiData {
MisskeyEmojiData get emoji => throw _privateConstructorUsedError;
double get scale => throw _privateConstructorUsedError;
Offset get position => throw _privateConstructorUsedError;
double get angle => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$EditedEmojiDataCopyWith<EditedEmojiData> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $EditedEmojiDataCopyWith<$Res> {
factory $EditedEmojiDataCopyWith(
EditedEmojiData value, $Res Function(EditedEmojiData) then) =
_$EditedEmojiDataCopyWithImpl<$Res, EditedEmojiData>;
@useResult
$Res call(
{MisskeyEmojiData emoji, double scale, Offset position, double angle});
}
/// @nodoc
class _$EditedEmojiDataCopyWithImpl<$Res, $Val extends EditedEmojiData>
implements $EditedEmojiDataCopyWith<$Res> {
_$EditedEmojiDataCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? emoji = null,
Object? scale = null,
Object? position = null,
Object? angle = null,
}) {
return _then(_value.copyWith(
emoji: null == emoji
? _value.emoji
: emoji // ignore: cast_nullable_to_non_nullable
as MisskeyEmojiData,
scale: null == scale
? _value.scale
: scale // ignore: cast_nullable_to_non_nullable
as double,
position: null == position
? _value.position
: position // ignore: cast_nullable_to_non_nullable
as Offset,
angle: null == angle
? _value.angle
: angle // ignore: cast_nullable_to_non_nullable
as double,
) as $Val);
}
}
/// @nodoc
abstract class _$$EditedEmojiDataImplCopyWith<$Res>
implements $EditedEmojiDataCopyWith<$Res> {
factory _$$EditedEmojiDataImplCopyWith(_$EditedEmojiDataImpl value,
$Res Function(_$EditedEmojiDataImpl) then) =
__$$EditedEmojiDataImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{MisskeyEmojiData emoji, double scale, Offset position, double angle});
}
/// @nodoc
class __$$EditedEmojiDataImplCopyWithImpl<$Res>
extends _$EditedEmojiDataCopyWithImpl<$Res, _$EditedEmojiDataImpl>
implements _$$EditedEmojiDataImplCopyWith<$Res> {
__$$EditedEmojiDataImplCopyWithImpl(
_$EditedEmojiDataImpl _value, $Res Function(_$EditedEmojiDataImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? emoji = null,
Object? scale = null,
Object? position = null,
Object? angle = null,
}) {
return _then(_$EditedEmojiDataImpl(
emoji: null == emoji
? _value.emoji
: emoji // ignore: cast_nullable_to_non_nullable
as MisskeyEmojiData,
scale: null == scale
? _value.scale
: scale // ignore: cast_nullable_to_non_nullable
as double,
position: null == position
? _value.position
: position // ignore: cast_nullable_to_non_nullable
as Offset,
angle: null == angle
? _value.angle
: angle // ignore: cast_nullable_to_non_nullable
as double,
));
}
}
/// @nodoc
class _$EditedEmojiDataImpl implements _EditedEmojiData {
const _$EditedEmojiDataImpl(
{required this.emoji,
required this.scale,
required this.position,
required this.angle});
@override
final MisskeyEmojiData emoji;
@override
final double scale;
@override
final Offset position;
@override
final double angle;
@override
String toString() {
return 'EditedEmojiData(emoji: $emoji, scale: $scale, position: $position, angle: $angle)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$EditedEmojiDataImpl &&
(identical(other.emoji, emoji) || other.emoji == emoji) &&
(identical(other.scale, scale) || other.scale == scale) &&
(identical(other.position, position) ||
other.position == position) &&
(identical(other.angle, angle) || other.angle == angle));
}
@override
int get hashCode => Object.hash(runtimeType, emoji, scale, position, angle);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$EditedEmojiDataImplCopyWith<_$EditedEmojiDataImpl> get copyWith =>
__$$EditedEmojiDataImplCopyWithImpl<_$EditedEmojiDataImpl>(
this, _$identity);
}
abstract class _EditedEmojiData implements EditedEmojiData {
const factory _EditedEmojiData(
{required final MisskeyEmojiData emoji,
required final double scale,
required final Offset position,
required final double angle}) = _$EditedEmojiDataImpl;
@override
MisskeyEmojiData get emoji;
@override
double get scale;
@override
Offset get position;
@override
double get angle;
@override
@JsonKey(ignore: true)
_$$EditedEmojiDataImplCopyWith<_$EditedEmojiDataImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/photo_edit_page/image_meta_dialog.dart | import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
part 'image_meta_dialog.freezed.dart';
@freezed
class ImageMeta with _$ImageMeta {
const factory ImageMeta({
required String fileName,
required bool isNsfw,
required String caption,
}) = _ImageMeta;
}
class ImageMetaDialog extends ConsumerStatefulWidget {
const ImageMetaDialog({super.key, required this.initialMeta});
final ImageMeta initialMeta;
@override
ConsumerState<ConsumerStatefulWidget> createState() => ImageMetaDialogState();
}
class ImageMetaDialogState extends ConsumerState<ImageMetaDialog> {
late final TextEditingController fileNameController = TextEditingController()
..text = widget.initialMeta.fileName;
late bool isNsfw = widget.initialMeta.isNsfw;
late final TextEditingController captionController = TextEditingController()
..text = widget.initialMeta.caption;
@override
void dispose() {
fileNameController.dispose();
captionController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AlertDialog(
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.8,
child: Column(
children: [
Text(S.of(context).fileName),
TextField(
controller: fileNameController,
decoration:
const InputDecoration(prefixIcon: Icon(Icons.file_present)),
),
CheckboxListTile(
value: isNsfw,
onChanged: (value) => setState(() {
isNsfw = !isNsfw;
}),
title: Text(S.of(context).markAsSensitive),
),
Text(S.of(context).caption),
TextField(
controller: fileNameController,
decoration:
const InputDecoration(prefixIcon: Icon(Icons.file_present)),
minLines: 5,
maxLines: null,
),
],
)),
);
}
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/photo_edit_page/image_meta_dialog.freezed.dart | // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'image_meta_dialog.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
mixin _$ImageMeta {
String get fileName => throw _privateConstructorUsedError;
bool get isNsfw => throw _privateConstructorUsedError;
String get caption => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ImageMetaCopyWith<ImageMeta> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ImageMetaCopyWith<$Res> {
factory $ImageMetaCopyWith(ImageMeta value, $Res Function(ImageMeta) then) =
_$ImageMetaCopyWithImpl<$Res, ImageMeta>;
@useResult
$Res call({String fileName, bool isNsfw, String caption});
}
/// @nodoc
class _$ImageMetaCopyWithImpl<$Res, $Val extends ImageMeta>
implements $ImageMetaCopyWith<$Res> {
_$ImageMetaCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? fileName = null,
Object? isNsfw = null,
Object? caption = null,
}) {
return _then(_value.copyWith(
fileName: null == fileName
? _value.fileName
: fileName // ignore: cast_nullable_to_non_nullable
as String,
isNsfw: null == isNsfw
? _value.isNsfw
: isNsfw // ignore: cast_nullable_to_non_nullable
as bool,
caption: null == caption
? _value.caption
: caption // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$ImageMetaImplCopyWith<$Res>
implements $ImageMetaCopyWith<$Res> {
factory _$$ImageMetaImplCopyWith(
_$ImageMetaImpl value, $Res Function(_$ImageMetaImpl) then) =
__$$ImageMetaImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String fileName, bool isNsfw, String caption});
}
/// @nodoc
class __$$ImageMetaImplCopyWithImpl<$Res>
extends _$ImageMetaCopyWithImpl<$Res, _$ImageMetaImpl>
implements _$$ImageMetaImplCopyWith<$Res> {
__$$ImageMetaImplCopyWithImpl(
_$ImageMetaImpl _value, $Res Function(_$ImageMetaImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? fileName = null,
Object? isNsfw = null,
Object? caption = null,
}) {
return _then(_$ImageMetaImpl(
fileName: null == fileName
? _value.fileName
: fileName // ignore: cast_nullable_to_non_nullable
as String,
isNsfw: null == isNsfw
? _value.isNsfw
: isNsfw // ignore: cast_nullable_to_non_nullable
as bool,
caption: null == caption
? _value.caption
: caption // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$ImageMetaImpl implements _ImageMeta {
const _$ImageMetaImpl(
{required this.fileName, required this.isNsfw, required this.caption});
@override
final String fileName;
@override
final bool isNsfw;
@override
final String caption;
@override
String toString() {
return 'ImageMeta(fileName: $fileName, isNsfw: $isNsfw, caption: $caption)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ImageMetaImpl &&
(identical(other.fileName, fileName) ||
other.fileName == fileName) &&
(identical(other.isNsfw, isNsfw) || other.isNsfw == isNsfw) &&
(identical(other.caption, caption) || other.caption == caption));
}
@override
int get hashCode => Object.hash(runtimeType, fileName, isNsfw, caption);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ImageMetaImplCopyWith<_$ImageMetaImpl> get copyWith =>
__$$ImageMetaImplCopyWithImpl<_$ImageMetaImpl>(this, _$identity);
}
abstract class _ImageMeta implements ImageMeta {
const factory _ImageMeta(
{required final String fileName,
required final bool isNsfw,
required final String caption}) = _$ImageMetaImpl;
@override
String get fileName;
@override
bool get isNsfw;
@override
String get caption;
@override
@JsonKey(ignore: true)
_$$ImageMetaImplCopyWith<_$ImageMetaImpl> get copyWith =>
throw _privateConstructorUsedError;
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/photo_edit_page/photo_edit_state_notifier.dart | import 'dart:math';
import 'dart:typed_data';
import 'dart:ui';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:image_editor/image_editor.dart';
import 'package:miria/model/account.dart';
import 'package:miria/model/image_file.dart';
import 'package:miria/model/misskey_emoji_data.dart';
import 'package:miria/state_notifier/photo_edit_page/color_filter_preset.dart';
import 'package:miria/view/photo_edit_page/license_confirm_dialog.dart';
import 'package:miria/view/reaction_picker_dialog/reaction_picker_dialog.dart';
part 'photo_edit_state_notifier.freezed.dart';
@freezed
class PhotoEdit with _$PhotoEdit {
const factory PhotoEdit({
@Default(false) bool clipMode,
@Default(false) bool colorFilterMode,
@Default([]) List<ColorFilterPreview> colorFilterPreviewImages,
@Default([]) List<String> adaptivePresets,
@Default(false) bool isInitialized,
Uint8List? initialImage,
Uint8List? editedImage,
@Default(Offset(0, 0)) Offset cropOffset,
@Default(Size.zero) Size cropSize,
@Default(Size.zero) Size defaultSize,
@Default(Size.zero) Size actualSize,
@Default(0) int angle,
@Default([]) List<EditedEmojiData> emojis,
int? selectedEmojiIndex,
}) = _PhotoEdit;
}
@freezed
class ColorFilterPreview with _$ColorFilterPreview {
const factory ColorFilterPreview({required String name, Uint8List? image}) =
_ColorFilterPreview;
}
@freezed
class EditedEmojiData with _$EditedEmojiData {
const factory EditedEmojiData({
required MisskeyEmojiData emoji,
required double scale,
required Offset position,
required double angle,
}) = _EditedEmojiData;
}
class PhotoEditStateNotifier extends StateNotifier<PhotoEdit> {
static final List<String> _acceptReactions = [];
PhotoEditStateNotifier(super.state);
/// 状態を初期化する
Future<void> initialize(MisskeyPostFile file) async {
if (state.isInitialized) return;
Uint8List initialImage;
switch (file) {
case ImageFile():
initialImage = file.data;
break;
case ImageFileAlreadyPostedFile():
initialImage = file.data;
break;
default:
throw UnsupportedError("$file is unsupported.");
}
final imageData = await ImageDescriptor.encoded(
await ImmutableBuffer.fromUint8List(initialImage),
);
final defaultSize =
Size(imageData.width.toDouble(), imageData.height.toDouble());
state = state.copyWith(
isInitialized: true,
initialImage: initialImage,
editedImage: initialImage,
defaultSize: defaultSize,
cropSize: defaultSize,
);
}
Future<Uint8List?> _drawImage(PhotoEdit attemptState) async {
final initialImage = state.initialImage;
if (initialImage == null) return null;
final editorOption = ImageEditorOption();
if (attemptState.angle != 0) {
editorOption.addOption(RotateOption(attemptState.angle));
}
if (!attemptState.clipMode) {
final offset = attemptState.cropOffset;
final size = attemptState.cropSize;
editorOption.addOption(
ClipOption(
x: offset.dx,
y: offset.dy,
width: size.width,
height: size.height,
),
);
}
final presets = ColorFilterPresets().presets;
for (final colorPreset in attemptState.adaptivePresets) {
editorOption.addOptions(
presets.firstWhere((element) => element.name == colorPreset).option,
);
}
final result = await ImageEditor.editImage(
image: initialImage,
imageEditorOption: editorOption,
);
return result;
}
/// 画像の描画を反映する
Future<void> draw(PhotoEdit attemptState) async {
final editedImage = await _drawImage(attemptState);
if (editedImage == null) return;
state = attemptState.copyWith(editedImage: editedImage);
}
Future<Uint8List?> createSaveData(GlobalKey renderingAreaKey) async {
// RenderObjectを取得
final boundary = renderingAreaKey.currentContext?.findRenderObject()
as RenderRepaintBoundary?;
if (boundary == null) return null;
final image = await boundary.toImage();
final byteData = await image.toByteData(format: ImageByteFormat.png);
final resultImage = byteData?.buffer.asUint8List();
if (resultImage == null) return null;
final padding = 20 * state.defaultSize.width / state.actualSize.width;
final removedPaddingImage = await ImageEditor.editImage(
image: resultImage,
imageEditorOption: ImageEditorOption()
..addOptions([
ClipOption(
x: padding + (state.defaultSize.width - state.cropSize.width) / 2,
y: padding + (state.defaultSize.height - state.cropSize.height) / 2,
width: state.cropSize.width,
height: state.cropSize.height,
),
]),
);
return removedPaddingImage;
}
Offset resolveRotatedOffset(
Offset cropOffset,
Size cropSize,
Size defaultSize,
int angle,
) {
final rotatedX = defaultSize.width - cropSize.width - cropOffset.dx;
return Offset(cropOffset.dy, rotatedX);
}
/// 画像を回転する
void rotate() {
final angle = ((state.angle - 90) % 360).abs();
draw(
state.copyWith(
angle: angle,
defaultSize: Size(state.defaultSize.height, state.defaultSize.width),
cropSize: Size(state.cropSize.height, state.cropSize.width),
cropOffset: resolveRotatedOffset(
state.cropOffset,
state.cropSize,
state.defaultSize,
angle,
),
emojis: [
for (final emoji in state.emojis)
emoji.copyWith(
angle: emoji.angle - pi / 2,
position: Offset(
emoji.position.dy,
state.defaultSize.width - emoji.scale - emoji.position.dx,
),
),
],
selectedEmojiIndex: null,
),
);
}
/// 画像を切り取る
void crop() {
draw(
state.copyWith(
clipMode: !state.clipMode,
colorFilterMode: false,
selectedEmojiIndex: null,
),
);
}
void decideDrawArea(Size size) {
state = state.copyWith(actualSize: size);
}
/// 画像の切り取り範囲を制限する
PhotoEdit validateCrop(PhotoEdit state) {
final size = state.cropSize;
final defaultSize = state.defaultSize;
final offset = state.cropOffset;
final validatedOffset = Offset(
max(0, min(offset.dx, defaultSize.width)),
max(0, min(offset.dy, defaultSize.height)),
);
final validatedCropSize = Size(
max(1, min(size.width, defaultSize.width - validatedOffset.dx)),
max(1, min(size.height, defaultSize.height - validatedOffset.dy)),
);
return state.copyWith(
cropSize: validatedCropSize,
cropOffset: validatedOffset,
);
}
/// 画像の切り取り範囲の左上を移動する
void cropMoveLeftTop(PointerMoveEvent detail) {
state = validateCrop(
state.copyWith(
cropOffset: state.cropOffset + detail.localDelta,
cropSize: Size(
state.cropSize.width - detail.localDelta.dx,
state.cropSize.height - detail.localDelta.dy,
),
),
);
}
/// 画像の切り取り範囲の右上を移動する
void cropMoveRightTop(PointerMoveEvent detail) {
state = validateCrop(
state.copyWith(
cropOffset: Offset(
state.cropOffset.dx,
state.cropOffset.dy + detail.localDelta.dy,
),
cropSize: Size(
state.cropSize.width + detail.localDelta.dx,
state.cropSize.height - detail.localDelta.dy,
),
),
);
}
/// 画像の切り取り範囲の左下を移動する
void cropMoveLeftBottom(PointerMoveEvent detail) {
state = validateCrop(
state.copyWith(
cropOffset: Offset(
state.cropOffset.dx + detail.localDelta.dx,
state.cropOffset.dy,
),
cropSize: Size(
state.cropSize.width - detail.localDelta.dx,
state.cropSize.height + detail.localDelta.dy,
),
),
);
}
/// 画像の切り取り範囲の右下を移動する
void cropMoveRightBottom(PointerMoveEvent detail) {
state = validateCrop(
state.copyWith(
cropOffset: Offset(state.cropOffset.dx, state.cropOffset.dy),
cropSize: Size(
state.cropSize.width + detail.localDelta.dx,
state.cropSize.height + detail.localDelta.dy,
),
),
);
}
/// 画像の色調補正のプレビューを切り替える
Future<void> colorFilter() async {
state = state.copyWith(
clipMode: false,
selectedEmojiIndex: null,
colorFilterMode: !state.colorFilterMode,
);
if (!state.colorFilterMode) return;
createPreviewImage();
}
Future<void> createPreviewImage() async {
final editedImage = state.editedImage;
if (editedImage == null) return;
final previewImage = await ImageEditor.editImage(
image: editedImage,
imageEditorOption: ImageEditorOption()
..addOption(const ScaleOption(300, 300, keepRatio: true)),
);
if (previewImage == null) return;
final result = [
for (final preset in ColorFilterPresets().presets)
ColorFilterPreview(
name: preset.name,
image: await ImageEditor.editImage(
image: previewImage,
imageEditorOption: ImageEditorOption()..addOptions(preset.option),
),
),
].whereNotNull();
state = state.copyWith(colorFilterPreviewImages: result.toList());
}
/// 画像の色調補正を設定する
Future<void> selectColorFilter(String name) async {
if (state.adaptivePresets.any((element) => element == name)) {
final list = state.adaptivePresets.toList();
list.removeWhere((element) => element == name);
await draw(state.copyWith(adaptivePresets: list));
} else {
await draw(
state.copyWith(adaptivePresets: [...state.adaptivePresets, name]),
);
}
await createPreviewImage();
}
/// リアクションを追加する
Future<void> addReaction(Account account, BuildContext context) async {
final reaction = await showDialog<MisskeyEmojiData?>(
context: context,
builder: (context) =>
ReactionPickerDialog(account: account, isAcceptSensitive: true),
);
if (reaction == null) return;
switch (reaction) {
case CustomEmojiData():
// カスタム絵文字の場合、ライセンスを確認する
if (_acceptReactions.none((e) => e == reaction.baseName)) {
if (!mounted) return;
final dialogResult = await showDialog<bool?>(
context: context,
builder: (context) => LicenseConfirmDialog(
emoji: reaction.baseName,
account: account,
),
);
if (dialogResult != true) return;
_acceptReactions.add(reaction.baseName);
}
break;
case UnicodeEmojiData():
break;
default:
return;
}
state = state.copyWith(
emojis: [
...state.emojis,
EditedEmojiData(
emoji: reaction,
scale: 100,
position: Offset(
state.cropOffset.dx + (state.cropSize.width) / 2 - 50,
state.cropOffset.dy + (state.cropSize.height) / 2 - 50,
),
angle: 0,
),
],
selectedEmojiIndex: state.emojis.length,
clipMode: false,
);
}
double _startScale = 0;
double _startAngle = 0;
/// リアクションを拡大・縮小・回転する イベントの開始
void reactionScaleStart(ScaleStartDetails detail) {
final selectedIndex = state.selectedEmojiIndex;
if (selectedIndex == null) return;
_startScale = state.emojis[selectedIndex].scale;
_startAngle = state.emojis[selectedIndex].angle;
}
/// リアクションを拡大・縮小・回転する イベントの実施中
void reactionScaleUpdate(ScaleUpdateDetails detail) {
final selectedIndex = state.selectedEmojiIndex;
if (selectedIndex == null) return;
final emojis = state.emojis.toList();
emojis[selectedIndex] = emojis[selectedIndex].copyWith(
scale: _startScale * detail.scale,
angle: _startAngle + detail.rotation,
);
state = state.copyWith(emojis: emojis, clipMode: false);
}
/// リアクションを移動する
void reactionMove(PointerMoveEvent event) {
final selectedIndex = state.selectedEmojiIndex;
if (selectedIndex == null) return;
final emojis = state.emojis.toList();
emojis[selectedIndex] = emojis[selectedIndex].copyWith(
position: Offset(
emojis[selectedIndex].position.dx + event.localDelta.dx,
emojis[selectedIndex].position.dy + event.localDelta.dy,
),
);
state = state.copyWith(emojis: emojis);
}
/// リアクションを選択する
void selectReaction(int index) {
state = state.copyWith(
clipMode: false,
colorFilterMode: false,
selectedEmojiIndex: index,
);
}
void clearSelectMode() {
draw(
state.copyWith(
selectedEmojiIndex: null,
colorFilterMode: false,
clipMode: false,
),
);
}
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/photo_edit_page/color_filter_preset.dart | import 'dart:math';
import 'package:image_editor/image_editor.dart';
class ColorFilterPresets {
final List<ColorFilterPreset> presets;
ColorFilterPresets()
: presets = [
ColorFilterPreset(
name: "clarendon",
option: [_brightness(.1), _contrast(.1), _saturation(.15)]),
ColorFilterPreset(
name: "addictiveRed", option: [_addictiveColor(50, 0, 0)]),
ColorFilterPreset(
name: "addictiveGreen", option: [_addictiveColor(0, 50, 0)]),
ColorFilterPreset(
name: "addictiveBlue", option: [_addictiveColor(0, 0, 50)]),
ColorFilterPreset(
name: "gingham", option: [_sepia(.04), _contrast(-.15)]),
ColorFilterPreset(
name: "moon",
option: [_grayscale(), _contrast(-.04), _brightness(0.1)]),
ColorFilterPreset(name: "lark", option: [
_brightness(0.08),
_grayscale(),
_contrast(-.04),
]),
ColorFilterPreset(
name: "Reyes",
option: [_sepia(0.4), _brightness(0.13), _contrast(-.06)]),
ColorFilterPreset(
name: "Juno",
option: [_rgbScale(1.01, 1.04, 1), _saturation(0.3)]),
ColorFilterPreset(
name: "Slumber", option: [_brightness(.1), _saturation(-0.5)]),
ColorFilterPreset(
name: "Crema",
option: [_rgbScale(1.04, 1, 1.02), _saturation(-0.05)]),
ColorFilterPreset(
name: "Ludwig", option: [_brightness(.05), _saturation(-0.03)]),
ColorFilterPreset(
name: "Aden",
option: [_colorOverlay(228, 130, 225, 0.13), _saturation(-0.2)]),
ColorFilterPreset(
name: "Perpetua", option: [_rgbScale(1.05, 1.1, 1)]),
ColorFilterPreset(name: "Amaro", option: [
_saturation(0.3),
_brightness(0.15),
]),
ColorFilterPreset(
name: "Mayfair",
option: [_colorOverlay(230, 115, 108, 0.05), _saturation(0.15)]),
ColorFilterPreset(name: "Rise", option: [
_colorOverlay(255, 170, 0, 0.1),
_brightness(0.09),
_saturation(0.1)
]),
ColorFilterPreset(name: "Hudson", option: [
_rgbScale(1, 1, 1.25),
_contrast(0.1),
_brightness(0.15)
]),
ColorFilterPreset(name: "Valencia", option: [
_colorOverlay(255, 255, 80, 0.8),
_saturation(0.1),
_contrast(0.05),
]),
ColorFilterPreset(name: "X-Pro II", option: [
_colorOverlay(255, 255, 0, 0.7),
_saturation(0.2),
_contrast(0.15)
]),
ColorFilterPreset(
name: "Sierra", option: [_contrast(-0.15), _saturation(0.1)]),
ColorFilterPreset(
name: "Lo-Fi", option: [_contrast(0.15), _saturation(0.2)]),
ColorFilterPreset(name: "InkWell", option: [_grayscale()]),
ColorFilterPreset(
name: "Hefe", option: [_contrast(0.1), _saturation(0.15)]),
ColorFilterPreset(
name: "Nashville",
option: [_colorOverlay(220, 115, 188, 0.12), _contrast(-0.05)]),
ColorFilterPreset(
name: "Stinson", option: [_brightness(0.1), _sepia(0.3)]),
ColorFilterPreset(name: "Vesper", option: [
_colorOverlay(225, 225, 0, 0.5),
_brightness(0.06),
_contrast(0.06)
]),
ColorFilterPreset(
name: "Earlybird",
option: [_colorOverlay(255, 165, 40, 0.2), _saturation(0.15)]),
ColorFilterPreset(
name: "Brannan",
option: [_contrast(0.2), _colorOverlay(140, 10, 185, 0.1)]),
ColorFilterPreset(
name: "Sutro", option: [_brightness(-0.1), _saturation(-0.1)]),
ColorFilterPreset(
name: "Toaster",
option: [_sepia(0.1), _colorOverlay(255, 145, 0, 0.2)]),
ColorFilterPreset(
name: "Walden",
option: [_brightness(0.1), _colorOverlay(255, 255, 0, 0.2)]),
ColorFilterPreset(
name: "1997",
option: [_colorOverlay(255, 25, 0, 0.15), _brightness(0.1)]),
ColorFilterPreset(name: "Kelvin", option: [
_colorOverlay(255, 140, 0, 0.1),
_rgbScale(1.15, 1.05, 1),
_saturation(0.35)
]),
ColorFilterPreset(name: "Maven", option: [
_colorOverlay(225, 240, 0, 0.1),
_saturation(0.25),
_contrast(0.05)
]),
ColorFilterPreset(
name: "Ginza", option: [_sepia(0.06), _brightness(0.1)]),
ColorFilterPreset(
name: "Skyline", option: [_saturation(0.35), _brightness(0.1)]),
ColorFilterPreset(
name: "Dogpatch", option: [_contrast(0.15), _brightness(0.1)]),
ColorFilterPreset(
name: "Brooklyn",
option: [_colorOverlay(25, 240, 252, 0.05), _sepia(0.3)]),
ColorFilterPreset(
name: "Helena",
option: [_colorOverlay(208, 208, 86, 0.2), _contrast(0.15)]),
ColorFilterPreset(
name: "Ashby",
option: [_colorOverlay(255, 160, 25, 0.1), _brightness(0.1)]),
ColorFilterPreset(
name: "Charmes",
option: [_colorOverlay(255, 50, 80, 0.12), _contrast(0.05)])
];
}
class ColorFilterPreset {
final String name;
final List<ColorOption> option;
const ColorFilterPreset({required this.name, required this.option});
}
ColorOption _colorOverlay(double red, double green, double blue, double scale) {
return ColorOption(matrix: [
(1 - scale),
0,
0,
0,
-1 * red * scale,
0,
(1 - scale),
0,
0,
-1 * green * scale,
0,
0,
(1 - scale),
0,
-1 * blue * scale,
0,
0,
0,
1,
0
]);
}
ColorOption _rgbScale(double r, double g, double b) {
return ColorOption(matrix: [
r,
0,
0,
0,
0,
0,
g,
0,
0,
0,
0,
0,
b,
0,
0,
0,
0,
0,
1,
0,
]);
}
ColorOption _addictiveColor(double r, double g, double b) {
return ColorOption(matrix: [
1,
0,
0,
0,
r,
0,
1,
0,
0,
g,
0,
0,
1,
0,
b,
0,
0,
0,
1,
0,
]);
}
ColorOption _grayscale() {
return ColorOption(matrix: [
0.2126,
0.7152,
0.0722,
0,
0,
0.2126,
0.7152,
0.0722,
0,
0,
0.2126,
0.7152,
0.0722,
0,
0,
0,
0,
0,
1,
0,
]);
}
ColorOption _sepia(double value) {
return ColorOption(matrix: [
(1 - (0.607 * value)),
0.769 * value,
0.189 * value,
0,
0,
0.349 * value,
(1 - (0.314 * value)),
0.168 * value,
0,
0,
0.272 * value,
0.534 * value,
(1 - (0.869 * value)),
0,
0,
0,
0,
0,
1,
0,
]);
}
ColorOption _invert() {
return ColorOption(matrix: [
-1,
0,
0,
0,
255,
0,
-1,
0,
0,
255,
0,
0,
-1,
0,
255,
0,
0,
0,
1,
0,
]);
}
ColorOption _hue(double value) {
value = value * pi;
if (value == 0) {
return ColorOption(matrix: [
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
]);
}
var cosVal = cos(value);
var sinVal = sin(value);
var lumR = 0.213;
var lumG = 0.715;
var lumB = 0.072;
return ColorOption(
matrix: List<double>.from(<double>[
(lumR + (cosVal * (1 - lumR))) + (sinVal * (-lumR)),
(lumG + (cosVal * (-lumG))) + (sinVal * (-lumG)),
(lumB + (cosVal * (-lumB))) + (sinVal * (1 - lumB)),
0,
0,
(lumR + (cosVal * (-lumR))) + (sinVal * 0.143),
(lumG + (cosVal * (1 - lumG))) + (sinVal * 0.14),
(lumB + (cosVal * (-lumB))) + (sinVal * (-0.283)),
0,
0,
(lumR + (cosVal * (-lumR))) + (sinVal * (-(1 - lumR))),
(lumG + (cosVal * (-lumG))) + (sinVal * lumG),
(lumB + (cosVal * (1 - lumB))) + (sinVal * lumB),
0,
0,
0,
0,
0,
1,
0,
]).map((i) => i.toDouble()).toList());
}
ColorOption _brightness(double value) {
if (value <= 0) {
value = value * 255;
} else {
value = value * 100;
}
if (value == 0) {
return ColorOption(matrix: [
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
]);
}
return ColorOption(
matrix: List<double>.from(<double>[
1,
0,
0,
0,
value,
0,
1,
0,
0,
value,
0,
0,
1,
0,
value,
0,
0,
0,
1,
0
]).map((i) => i.toDouble()).toList());
}
ColorOption _contrast(double value) {
// RGBA contrast(RGBA color, num adj) {
// adj *= 255;
// double factor = (259 * (adj + 255)) / (255 * (259 - adj));
// return new RGBA(
// red: (factor * (color.red - 128) + 128),
// green: (factor * (color.green - 128) + 128),
// blue: (factor * (color.blue - 128) + 128),
// alpha: color.alpha,
// );
// }
double adj = value * 255;
double factor = (259 * (adj + 255)) / (255 * (259 - adj));
return ColorOption(matrix: [
factor,
0,
0,
0,
128 * (1 - factor),
0,
factor,
0,
0,
128 * (1 - factor),
0,
0,
factor,
0,
128 * (1 - factor),
0,
0,
0,
1,
0,
]);
}
ColorOption _saturation(double value) {
value = value * 100;
if (value == 0) {
return ColorOption(matrix: [
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
]);
}
var x =
((1 + ((value > 0) ? ((3 * value) / 100) : (value / 100)))).toDouble();
var lumR = 0.3086;
var lumG = 0.6094;
var lumB = 0.082;
return ColorOption(
matrix: List<double>.from(<double>[
(lumR * (1 - x)) + x,
lumG * (1 - x),
lumB * (1 - x),
0,
0,
lumR * (1 - x),
(lumG * (1 - x)) + x,
lumB * (1 - x),
0,
0,
lumR * (1 - x),
lumG * (1 - x),
(lumB * (1 - x)) + x,
0,
0,
0,
0,
0,
1,
0,
]).map((i) => i.toDouble()).toList());
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/common/misskey_server_list_notifier.dart | import 'package:collection/collection.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:misskey_dart/misskey_dart.dart';
final _queryProvider = StateProvider.autoDispose((ref) {
return "";
});
final _instanceInfosProvider = AsyncNotifierProvider.autoDispose<_InstanceInfos,
List<JoinMisskeyInstanceInfo>>(
_InstanceInfos.new,
);
class _InstanceInfos
extends AutoDisposeAsyncNotifier<List<JoinMisskeyInstanceInfo>> {
@override
Future<List<JoinMisskeyInstanceInfo>> build() async {
final response =
await JoinMisskey(host: "instanceapp.misskey.page").instances();
return response.instancesInfos
.sortedByCompare(
(info) => info.nodeInfo?.usage?.users?.total ?? 0,
(a, b) => a.compareTo(b),
)
.reversed
.toList();
}
}
class MisskeyServerListNotifier
extends AutoDisposeAsyncNotifier<List<JoinMisskeyInstanceInfo>> {
@override
Future<List<JoinMisskeyInstanceInfo>> build() async {
final query = ref.watch(_queryProvider);
final instances = await ref.watch(_instanceInfosProvider.future);
if (query.isEmpty) {
return instances;
}
final filtered = instances.where(
(e) => e.name.toLowerCase().contains(query) || e.url.contains(query),
);
final grouped = filtered.groupListsBy(
(e) => e.name.toLowerCase().startsWith(query) || e.url.startsWith(query),
);
return [...grouped[true] ?? [], ...grouped[false] ?? []];
}
void setQuery(String query) {
ref.read(_queryProvider.notifier).state = query.trim().toLowerCase();
}
}
| 0 |
mirrored_repositories/miria/lib/state_notifier/common | mirrored_repositories/miria/lib/state_notifier/common/misskey_notes/misskey_note_notifier.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/account.dart';
import 'package:miria/providers.dart';
import 'package:miria/router/app_router.dart';
import 'package:miria/view/common/account_select_dialog.dart';
import 'package:misskey_dart/misskey_dart.dart';
class OpenLocalOnlyNoteFromRemoteException implements Exception {}
class MisskeyNoteNotifier extends FamilyNotifier<void, Account> {
@override
void build(Account arg) {
return;
}
Account get _account => arg;
/// 指定したアカウントから見たNoteを返す
Future<Note> lookupNote({
required Account account,
required Note note,
}) async {
if (account.host == _account.host) {
return note;
}
if (note.localOnly) {
throw OpenLocalOnlyNoteFromRemoteException();
}
final host = note.user.host ?? _account.host;
try {
// まず、自分のサーバーの直近のノートに該当のノートが含まれているか見る
final user = await ref.read(misskeyProvider(account)).users.showByName(
UsersShowByUserNameRequest(
userName: note.user.username,
host: host,
),
);
final userNotes = await ref.read(misskeyProvider(account)).users.notes(
UsersNotesRequest(
userId: user.id,
untilDate: note.createdAt.add(const Duration(seconds: 1)),
),
);
return userNotes
.firstWhere((e) => e.uri?.pathSegments.lastOrNull == note.id);
} catch (e) {
// 最終手段として、連合で照会する
final response = await ref.read(misskeyProvider(account)).ap.show(
ApShowRequest(
uri: note.uri ??
Uri(
scheme: "https",
host: host,
pathSegments: ["notes", note.id],
),
),
);
return Note.fromJson(response.object);
}
}
/// 指定したアカウントから見たUserを返す
Future<User> lookupUser({
required Account account,
required User user,
}) async {
if (account.host == _account.host) {
return user;
}
final host = user.host ?? _account.host;
try {
return ref.read(misskeyProvider(account)).users.showByName(
UsersShowByUserNameRequest(
userName: user.username,
host: host,
),
);
} catch (e) {
// 最終手段として、連合で照会する
// `users/show` で自動的に照会されるから必要ない
final response = await ref.read(misskeyProvider(account)).ap.show(
ApShowRequest(
uri: Uri(
scheme: "https",
host: user.host,
pathSegments: ["@$host"],
),
),
);
return UserDetailed.fromJson(response.object);
}
}
Future<void> navigateToNoteDetailPage(
BuildContext context,
Note note,
Account? loginAs,
) async {
final foundNote = loginAs == null
? note
: await lookupNote(
note: note,
account: loginAs,
);
if (!context.mounted) return;
context.pushRoute(
NoteDetailRoute(
note: foundNote,
account: loginAs ?? _account,
),
);
}
Future<void> navigateToUserPage(
BuildContext context,
User user,
Account? loginAs,
) async {
final foundUser = loginAs == null
? user
: await lookupUser(
account: loginAs,
user: user,
);
if (!context.mounted) return;
context.pushRoute(
UserRoute(
userId: foundUser.id,
account: loginAs ?? _account,
),
);
}
Future<void> openNoteInOtherAccount(BuildContext context, Note note) async {
final selectedAccount = await showDialog<Account?>(
context: context,
builder: (context) => AccountSelectDialog(
host: note.localOnly ? _account.host : null,
),
);
if (selectedAccount == null) return;
if (!context.mounted) return;
await navigateToNoteDetailPage(context, note, selectedAccount);
}
Future<void> openUserInOtherAccount(BuildContext context, User user) async {
final selectedAccount = await showDialog<Account?>(
context: context,
builder: (context) => const AccountSelectDialog(),
);
if (selectedAccount == null) return;
if (!context.mounted) return;
await navigateToUserPage(context, user, selectedAccount);
}
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/antenna_page/antennas_notifier.dart | import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/antenna_settings.dart';
import 'package:misskey_dart/misskey_dart.dart';
class AntennasNotifier
extends AutoDisposeFamilyAsyncNotifier<List<Antenna>, Misskey> {
@override
Future<List<Antenna>> build(Misskey arg) async {
final response = await _misskey.antennas.list();
return response.toList();
}
Misskey get _misskey => arg;
Future<void> create(AntennaSettings settings) async {
final antenna = await _misskey.antennas.create(
AntennasCreateRequest(
name: settings.name,
src: settings.src,
keywords: settings.keywords,
excludeKeywords: settings.excludeKeywords,
users: settings.users,
caseSensitive: settings.caseSensitive,
withReplies: settings.withReplies,
withFile: settings.withFile,
notify: settings.notify,
localOnly: settings.localOnly,
),
);
state = AsyncValue.data([...?state.valueOrNull, antenna]);
}
Future<void> delete(String antennaId) async {
await _misskey.antennas.delete(AntennasDeleteRequest(antennaId: antennaId));
state = AsyncValue.data(
state.valueOrNull?.where((e) => e.id != antennaId).toList() ?? [],
);
}
Future<void> updateAntenna(
String antennaId,
AntennaSettings settings,
) async {
await _misskey.antennas.update(
AntennasUpdateRequest(
antennaId: antennaId,
name: settings.name,
src: settings.src,
keywords: settings.keywords,
excludeKeywords: settings.excludeKeywords,
users: settings.users,
caseSensitive: settings.caseSensitive,
withReplies: settings.withReplies,
withFile: settings.withFile,
notify: settings.notify,
localOnly: settings.localOnly,
),
);
state = AsyncValue.data(
state.valueOrNull
?.map(
(antenna) => (antenna.id == antennaId)
? antenna.copyWith(
name: settings.name,
src: settings.src,
keywords: settings.keywords,
excludeKeywords: settings.excludeKeywords,
users: settings.users,
caseSensitive: settings.caseSensitive,
withReplies: settings.withReplies,
withFile: settings.withFile,
notify: settings.notify,
localOnly: settings.localOnly,
)
: antenna,
)
.toList() ??
[],
);
}
}
| 0 |
mirrored_repositories/miria/lib/state_notifier | mirrored_repositories/miria/lib/state_notifier/user_list_page/users_lists_notifier.dart | import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:miria/model/users_list_settings.dart';
import 'package:misskey_dart/misskey_dart.dart';
class UsersListsNotifier
extends AutoDisposeFamilyAsyncNotifier<List<UsersList>, Misskey> {
@override
Future<List<UsersList>> build(Misskey arg) async {
final response = await _misskey.users.list.list();
return response.toList();
}
Misskey get _misskey => arg;
Future<void> create(UsersListSettings settings) async {
final list = await _misskey.users.list.create(
UsersListsCreateRequest(
name: settings.name,
),
);
if (settings.isPublic) {
await _misskey.users.list.update(
UsersListsUpdateRequest(
listId: list.id,
isPublic: settings.isPublic,
),
);
}
state = AsyncValue.data([...?state.valueOrNull, list]);
}
Future<void> delete(String listId) async {
await _misskey.users.list.delete(UsersListsDeleteRequest(listId: listId));
state = AsyncValue.data(
state.valueOrNull?.where((e) => e.id != listId).toList() ?? [],
);
}
Future<void> push(
String listId,
User user,
) async {
await _misskey.users.list.push(
UsersListsPushRequest(
listId: listId,
userId: user.id,
),
);
state = AsyncValue.data(
state.valueOrNull
?.map(
(list) => (list.id == listId)
? list.copyWith(
userIds: [...list.userIds, user.id],
)
: list,
)
.toList() ??
[],
);
}
Future<void> pull(
String listId,
User user,
) async {
await _misskey.users.list.pull(
UsersListsPullRequest(
listId: listId,
userId: user.id,
),
);
state = AsyncValue.data(
state.valueOrNull
?.map(
(list) => (list.id == listId)
? list.copyWith(
userIds: list.userIds
.where((userId) => userId != user.id)
.toList(),
)
: list,
)
.toList() ??
[],
);
}
}
| 0 |
mirrored_repositories/miria/test/repository | mirrored_repositories/miria/test/repository/account_repository/open_mi_auth_test.dart | import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:miria/providers.dart';
import 'package:miria/repository/account_repository.dart';
import 'package:misskey_dart/misskey_dart.dart';
import 'package:mockito/mockito.dart';
import '../../test_util/mock.mocks.dart';
import '../../test_util/test_datas.dart';
import 'auth_test_data.dart';
void main() {
test("誤ったホスト名を入力するとエラーを返すこと", () async {
final provider = ProviderContainer(
overrides: [dioProvider.overrideWithValue(MockDio())],
);
final accountRepository = provider.read(accountRepositoryProvider.notifier);
expect(() => accountRepository.openMiAuth("https://misskey.io/"),
throwsA(isA<InvalidServerException>()));
});
test("Activity Pub非対応サーバーの場合、エラーを返すこと", () {
final dio = MockDio();
when(dio.getUri(any)).thenAnswer((_) async => throw TestData.response404);
final provider =
ProviderContainer(overrides: [dioProvider.overrideWithValue(dio)]);
final accountRepository = provider.read(accountRepositoryProvider.notifier);
expect(() async => await accountRepository.openMiAuth("sawakai.space"),
throwsA(isA<ServerIsNotMisskeyException>()));
verify(dio.getUri(argThat(equals(Uri(
scheme: "https",
host: "sawakai.space",
pathSegments: [".well-known", "nodeinfo"])))));
});
// test("非対応のソフトウェアの場合、エラーを返すこと", () async {
// final dio = MockDio();
// when(dio.getUri(any)).thenAnswer((_) async => Response(
// requestOptions: RequestOptions(), data: AuthTestData.calckeyNodeInfo));
// when(dio.get(any)).thenAnswer((realInvocation) async => Response(
// requestOptions: RequestOptions(), data: AuthTestData.calckeyNodeInfo2));
// final mockMisskey = MockMisskey();
// final provider = ProviderContainer(
// overrides: [
// dioProvider.overrideWithValue(dio),
// misskeyProvider.overrideWith((ref, arg) => mockMisskey),
// ],
// );
// final accountRepository = provider.read(accountRepositoryProvider.notifier);
// await expectLater(
// () async => await accountRepository.openMiAuth("calckey.jp"),
// throwsA(isA<SoftwareNotCompatibleException>()));
// verifyInOrder([
// dio.getUri(argThat(equals(Uri(
// scheme: "https",
// host: "calckey.jp",
// pathSegments: [".well-known", "nodeinfo"])))),
// dio.get(argThat(equals("https://calckey.jp/nodeinfo/2.1")))
// ]);
// });
test("Misskeyの場合でも、バージョンが古い場合、エラーを返すこと", () async {
final dio = MockDio();
when(dio.getUri(any)).thenAnswer((_) async => Response(
requestOptions: RequestOptions(),
data: AuthTestData.oldVerMisskeyNodeInfo));
when(dio.get(any)).thenAnswer((realInvocation) async => Response(
requestOptions: RequestOptions(),
data: AuthTestData.oldVerMisskeyNodeInfo2));
final mockMisskey = MockMisskey();
when(mockMisskey.endpoints()).thenAnswer((_) async => []);
when(mockMisskey.meta()).thenAnswer((_) async =>
MetaResponse.fromJson(jsonDecode(AuthTestData.oldVerMisskeyMeta)));
final provider = ProviderContainer(
overrides: [
dioProvider.overrideWithValue(dio),
misskeyProvider.overrideWith((ref, arg) => mockMisskey),
misskeyWithoutAccountProvider.overrideWith((ref, arg) => mockMisskey),
],
);
final accountRepository = provider.read(accountRepositoryProvider.notifier);
await expectLater(
() async => await accountRepository.openMiAuth("misskey.dev"),
throwsA(isA<SoftwareNotCompatibleException>()));
});
}
| 0 |
mirrored_repositories/miria/test/repository | mirrored_repositories/miria/test/repository/account_repository/auth_test_data.dart | class AuthTestData {
static Map<String, dynamic> calckeyNodeInfo = {
"links": [
{
"rel": "http://nodeinfo.diaspora.software/ns/schema/2.1",
"href": "https://calckey.jp/nodeinfo/2.1"
},
{
"rel": "http://nodeinfo.diaspora.software/ns/schema/2.0",
"href": "https://calckey.jp/nodeinfo/2.0"
}
]
};
static Map<String, dynamic> calckeyNodeInfo2 = {
"version": "2.0",
"software": {
"name": "calckey",
"version": "14.0.0-rc2c-jp3",
"homepage": "https://calckey.org/"
},
"protocols": ["activitypub"],
"services": {
"inbound": [],
"outbound": ["atom1.0", "rss2.0"]
},
"openRegistrations": false,
"usage": {
"users": {"total": 447, "activeHalfyear": 445, "activeMonth": 237},
"localPosts": 53977,
"localComments": 0
},
"metadata": {
"nodeName": "Calckey.jp",
"nodeDescription":
"分散型SNS、Calckeyへようこそ!ここは日本語を話すユーザー向けの非公式サーバーです。利用規約を遵守していただく限り、自由にご利用いただけます。 Welcome to Calckey! This unofficial instance is for Japanese speakers, also welcoming those who are interested in or learning Japanese!\nただいま招待制となっております。招待コードは個別に発行しておりますので、お気軽に @[email protected] までご連絡ください。こちらで他のサーバーを探すこともできます: https://calckey.org/ja/join/",
"maintainer": {"name": "Namekuji", "email": "[email protected]"},
"langs": [],
"tosUrl": "https://media.calckey.jp/tos/coc.html",
"repositoryUrl": "https://codeberg.org/calckey/calckey",
"feedbackUrl": "https://codeberg.org/calckey/calckey/issues",
"disableRegistration": true,
"disableLocalTimeline": false,
"disableRecommendedTimeline": true,
"disableGlobalTimeline": false,
"emailRequiredForSignup": true,
"enableHcaptcha": true,
"enableRecaptcha": false,
"maxNoteTextLength": 5000,
"maxCaptionTextLength": 1500,
"enableTwitterIntegration": false,
"enableGithubIntegration": false,
"enableDiscordIntegration": false,
"enableEmail": true,
"enableServiceWorker": true,
"proxyAccountName": "proxy",
"themeColor": "#31748f"
}
};
static Map<String, dynamic> oldVerMisskeyNodeInfo = {
"links": [
{
"rel": "http://nodeinfo.diaspora.software/ns/schema/2.0",
"href": "https://misskey.dev/nodeinfo/2.0"
}
]
};
static Map<String, dynamic> oldVerMisskeyNodeInfo2 = {
"version": "2.0",
"software": {"name": "misskey", "version": "11.37.1-20230209223723"},
"protocols": ["activitypub"],
"services": {
"inbound": [],
"outbound": ["atom1.0", "rss2.0"]
},
"openRegistrations": true,
"usage": {"users": {}},
"metadata": {
"nodeName": "misskey.dev",
"nodeDescription":
r'''<h3>Misskey for Developers and any people!</h3>\n<div style=\"margin:-8px 0;\">テクノロジーが好きにゃ人もそうじゃにゃい人も大歓迎!にゃMisskey<span style=\"font-size:0.8rem\">(ミスキー)</span>サーバー<span style=\"font-size:0.8rem\">(旧:インスタンス)</span>です。内容はフリートークでOK!当サーバーでは現在、Misskey めいv11が稼働しております。<div class=\"h4\" style=\"font-size:1.2rem;\"><a href=\"https://s.misskey.dev/howtouse\">How to Use</a> \n | <a href=\"https://s.misskey.dev/howtouse-jp\">使い方</a>\n | <a href=\"https://misskey.dev/@cv_k/pages/info\">Info・情報<small style=\"font-size:80%\">(登録前に確認!)</small></a></div><div style=\"margin:0px 0 10px 0;\"><span style=\"line-height:1.2;font-size:70%;color:#ff4a4a\">注意:misskey.devには横長絵文字、とある歌人等の絵文字はなく導入する予定もありません。それらの絵文字を使いたい場合は<a href=\"https://join.misskey.page/ja-JP/instances\" style=\"color:#ff0033\" target=\"_blank\" rel=\"noopener\">他のサーバー</a>をご利用ください</span></div>''',
"maintainer": {"name": "cv_k", "email": r"sitesupport$live.jp"},
"langs": [],
"ToSUrl": "https://misskey.dev/@cv_k/pages/tos",
"repositoryUrl": "https://github.com/syuilo/misskey",
"feedbackUrl": "https://github.com/syuilo/misskey/issues/new",
"announcements": [
{
"text":
"✨ 最新のお知らせは ?[#misskeydevinfo](https://misskey.dev/tags/misskeydevinfo)をご確認ください :smiling_ai:\n**【必ずご確認ください】[サーバーの移行に伴う重要なお知らせ](https://misskey.dev/notes/9e6e8didf7)**\n\n詳しい情報は ?[info](https://misskey.dev/@cv_k/pages/info) ページをご確認ください\n運営費の寄付・支援は https://fantia.jp/takimura で受付しています。\n\nアイコンの変更方法は https://misskey.dev/notes/8w71u4lo9w をご覧ください。",
"image": null,
"title": "Misskeyへようこそ"
},
{
"text":
"⭐Approved as a pinned account\n⭐More request to add custom icons<small>(free user:1icon per month)</small>\n⭐User name posted on ?[info](https://misskey.dev/@cv_k/pages/info)page\n<center>[*** Donate ***](https://liberapay.com/misskey.dev)</center>\n⭐ピン留めアカウントとして公認\n⭐より多くのカスタム絵文字の追加リクエスト<small>(非会員は一ヶ月につき1個まで)</small>\n⭐?[info](https://misskey.dev/@cv_k/pages/info)ページにてユーザー名の掲載\n\n支払いにはクレジットカード及びコンビニ決済をご利用いただけます。\n**New** Premiumの特典がないお得な100円プラン始めました。✌✌✌\n\n<center>[*** 詳細・登録はこちら ***](https://fantia.jp/takimura)</center>\nFantia招待コード:9A848327\n\n以下からBraveを30日間ご利用いただくことでも支援していただけます!\nhttps://brave.com/mis911",
"image": null,
"title": "misskey.dev Premium"
},
{
"text":
"How to Use \nhttps://misskey.dev/notes/5c79e2a0fe0a36003970239f\nTerms of service\nhttps://misskey.dev/@cv_k/pages/tos\nInfo\nhttps://misskey.dev/@cv_k/pages/info\n<center>-----</center>使い方\nhttps://misskey.dev/notes/5c79e505c9c298003288f8c8\n利用規約\nhttps://misskey.dev/@cv_k/pages/tos\nInfoページ\nhttps://misskey.dev/@cv_k/pages/info",
"image": null,
"title": "Misskey Information"
},
{
"text":
"カスタム絵文字の依頼について:128x128px以上のpngもしくはsvg画像を添付し、 @cv_k までReplyまたはDMしてください。追加の検討を致します。\n\nRegarding local accounts and remote accounts : Accounts that repeat posts that violate the laws of Japan are freezed.\n<center>-----</center>アカウント/リモートアカウントに関して : 日本国の法律に抵触する投稿を繰り返し行うアカウントは凍結されます。",
"image": null,
"title": "Misskey Information 2"
}
],
"disableRegistration": false,
"disableLocalTimeline": false,
"disableGlobalTimeline": false,
"enableRecaptcha": true,
"maxNoteTextLength": 2048,
"enableTwitterIntegration": true,
"enableGithubIntegration": true,
"enableDiscordIntegration": true,
"enableEmail": false,
"enableServiceWorker": true
}
};
static String oldVerMisskeyMeta = r'''
{
"maintainerName": "cv_k",
"maintainerEmail": "sitesupport$live.jp",
"version": "11.37.1-20231128072711",
"name": "misskey.dev",
"uri": "https://misskey.dev",
"description": "<h3>Misskey for ALL Technology Lover and any people!</h3>\n<div style=\"margin:-8px 0;\">テクノロジーが好きにゃ人もそうじゃにゃい人も大歓迎!にゃMisskey<span style=\"font-size:0.8rem\">(ミスキー)</span>サーバー<span style=\"font-size:0.8rem\">(旧:インスタンス)</span>です。内容はフリートークでOK!当サーバーでは現在、Misskey めいv11が稼働しております。 <div class=\"h4\" style=\"font-size:1.2rem;\"><a href=\"https://s.misskey.dev/howtouse\">How to Use</a> \n | <a href=\"https://s.misskey.dev/howtouse-jp\">使い方</a>\n | <a href=\"https://misskey.dev/@cv_k/pages/info\">Info・情報<small style=\"font-size:80%\">(登録前に確認!)</small></a></div><div style=\"margin:0px 0 10px 0;\"><span style=\"line-height:1.2;font-size:70%;color:#ff4a4a\">注意:misskey.devには横長絵文字、とある歌人等の絵文字はなく導入する予定もありません。それらの絵文字を使いたい場合は<a href=\"https://join.misskey.page/ja-JP/instances\" style=\"color:#ff0033\" target=\"_blank\" rel=\"noopener\">他のサーバー</a>をご利用ください</span>",
"langs": [],
"ToSUrl": "https://misskey.dev/@cv_k/pages/tos",
"repositoryUrl": "https://github.com/mei23/misskey-v11",
"feedbackUrl": "https://github.com/mei23/misskey-v11/issues/new",
"machine": "i-18100000501653",
"os": "linux",
"node": "v18.18.2",
"psql": "15.4 (Ubuntu 15.4-2.pgdg22.04+1)",
"redis": "7.2.1",
"cpu": {
"model": "Intel Xeon E312xx (Sandy Bridge)",
"cores": 6
},
"announcements": [
{
"text": "✨ 最新のお知らせは ?[#misskeydevinfo](https://misskey.dev/tags/misskeydevinfo)をご確認ください :smiling_ai:\n<small>※高負荷になった際は随時再起動が行われます※</small>\n\n詳しい情報は ?[info](https://misskey.dev/@cv_k/pages/info) ページをご確認ください\n運営費の寄付・支援は https://fantia.jp/takimura で受付しています。\n\n?[📄 ページ機能を開く](https://misskey.dev/i/pages)\nアイコンの変更方法は https://misskey.dev/notes/8w71u4lo9w をご覧ください。",
"image": null,
"title": "Misskeyへようこそ"
},
{
"text": "⭐Approved as a pinned account\n⭐More request to add custom icons<small>(free user:1icon per month)</small>\n⭐User name posted on ?[info](https://misskey.dev/@cv_k/pages/info)page\n<center>[*** Donate ***](https://liberapay.com/misskey.dev)</center>\n⭐ピン留めアカウントとして公認\n⭐より多くのカスタム絵文字の追加リクエスト<small>(非会員は一ヶ月につき1個まで)</small>\n⭐?[info](https://misskey.dev/@cv_k/pages/info)ページにてユーザー名の掲載\n\n支払いにはクレジットカード及びコンビニ決済をご利用いただけます。\n**New** Premiumの特典がないお得な100円プラン始めました。✌✌✌\n\n<center>[*** 詳細・登録はこちら ***](https://fantia.jp/takimura)</center>\nFantia招待コード:9A848327\n\n以下からBraveを30日間ご利用いただくことでも支援していただけます!\nhttps://brave.com/mis911",
"image": null,
"title": "misskey.dev Premium"
},
{
"text": "How to Use \nhttps://misskey.dev/notes/5c79e2a0fe0a36003970239f\nTerms of service\nhttps://misskey.dev/@cv_k/pages/tos\nInfo\nhttps://misskey.dev/@cv_k/pages/info\n<center>-----</center>使い方\nhttps://misskey.dev/notes/5c79e505c9c298003288f8c8\n利用規約\nhttps://misskey.dev/@cv_k/pages/tos\nInfoページ\nhttps://misskey.dev/@cv_k/pages/info",
"image": null,
"title": "Misskey Information"
},
{
"text": "カスタム絵文字の依頼について:128x128px以上のpngもしくはsvg画像を添付し、 @cv_k までReplyまたはDMしてください。追加の検討を致します。\n\nRegarding local accounts and remote accounts : Accounts that repeat posts that violate the laws of Japan are freezed.\n<center>-----</center>アカウント/リモートアカウントに関して : 日本国の法律に抵触する投稿を繰り返し行うアカウントは凍結されます。",
"image": null,
"title": "Misskey Information 2"
}
],
"disableRegistration": false,
"disableLocalTimeline": false,
"disableGlobalTimeline": false,
"enableEmojiReaction": true,
"driveCapacityPerLocalUserMb": 20480,
"driveCapacityPerRemoteUserMb": 10,
"cacheRemoteFiles": false,
"proxyRemoteFiles": true,
"enableRecaptcha": true,
"recaptchaSiteKey": "6Le3u5UUAAAAADtRvaX8rU9nh1WWYhJqym1f9M5k",
"swPublickey": "BOaqdTf3jyuCFGQKYpkcmq8sKorMyBoKbv7JPsW-ByuklgTfyARytgnNmy82TERiZKaid21CkXWxjwc-ToBP4zg",
"mascotImageUrl": "/assets/ai.png",
"bannerUrl": "https://media.misskey.dev/dev/90c4dcb5-e806-4ee2-ad3d-b35e83a56a9f.png",
"errorImageUrl": "https://media.misskey.dev/dev/89ea71c3-51b7-419d-9f43-e469a6f91693.png#https://xn--931a.moe/aiart/yubitun.png",
"iconUrl": "https://media.misskey.dev/dev/d40110c1-34f1-4d3a-b315-c3feae4a24dc.ico",
"maxNoteTextLength": 2048,
"emojis": [
{
"id": "7zjl9qnx8l",
"aliases": [
"藍"
],
"name": "ai",
"category": "01.Ai-chan / 藍ちゃん",
"url": "https://raw.githubusercontent.com/tkmrgit/misskey-emoji/main/emoji/49e595ae-d8ef-4587-b216-d35ef281a214.svg"
}
],
"enableEmail": false,
"enableTwitterIntegration": true,
"enableGithubIntegration": true,
"enableDiscordIntegration": true,
"enableServiceWorker": true,
"features": {
"registration": true,
"localTimeLine": true,
"globalTimeLine": true,
"elasticsearch": false,
"recaptcha": true,
"objectStorage": true,
"twitter": true,
"github": true,
"discord": true,
"serviceWorker": true
}
}
''';
}
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.