repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/login_page/login_page_test.dart
import 'package:flutter_test/flutter_test.dart'; void main() { group("MiAuth", () { }); group("APIキー", () { }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/user_page/user_page_test.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; import '../../test_util/widget_tester_extension.dart'; void main() { group("ユーザー情報", () { group("全般", () { testWidgets("ユーザー情報が表示できること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse1); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse1.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect( find.textContaining(TestData.usersShowResponse1.name!, findRichText: true), findsAtLeastNWidgets(1)); }); testWidgets("リモートユーザーの場合、リモートユーザー用のタブが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse3AsRemoteUser); when(mockUser.showByName(any)) .thenAnswer((_) async => TestData.usersShowResponse3AsLocalUser); final emojiRepository = MockEmojiRepository(); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), misskeyWithoutAccountProvider .overrideWith((ref, arg) => mockMisskey), emojiRepositoryProvider.overrideWith((ref, arg) => emojiRepository) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse1.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("アカウント情報(リモート)"), findsOneWidget); expect(find.text("ノート(リモート)"), findsOneWidget); }); }); group("アカウント情報", () { group("他人のアカウント", () { testWidgets("フォローされている場合、フォローされていることが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer((_) async => TestData.usersShowResponse2.copyWith(isFollowed: true)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("フォローされています"), findsOneWidget); }); testWidgets("フォローされていない場合、フォローされている表示がされないこと", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer((_) async => TestData.usersShowResponse2.copyWith(isFollowed: false)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("フォローされています"), findsNothing); }); testWidgets("フォローしている場合、フォロー解除のボタンが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer((_) async => TestData.usersShowResponse2.copyWith(isFollowing: true)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("フォロー解除"), findsOneWidget); }); testWidgets("フォローしていない場合でフォロー申請が必要ない場合、フォローするのボタンが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer( (_) async => TestData.usersShowResponse2.copyWith( isFollowing: false, isLocked: false, ), ); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("フォローする"), findsOneWidget); }); testWidgets("フォローしていない場合でフォロー申請が必要な場合、フォロー申請のボタンが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer( (_) async => TestData.usersShowResponse2.copyWith( isFollowing: false, hasPendingFollowRequestFromYou: false, isLocked: true, isFollowed: false, ), ); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("フォロー申請"), findsOneWidget); }); testWidgets("フォロー申請中の場合、フォロー申請中の表示がされること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse2.copyWith( isFollowing: false, hasPendingFollowRequestFromYou: true, )); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("フォロー許可待ち"), findsOneWidget); }); testWidgets("ミュートしている場合、ミュート中が表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer( (_) async => TestData.usersShowResponse2.copyWith(isMuted: true)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("ミュート中"), findsOneWidget); }); testWidgets("ミュートしていない場合、ミュート中が表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer((_) async => TestData.usersShowResponse2.copyWith(isMuted: false)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); expect(find.text("ミュート中"), findsNothing); }); //TODO: ブロック }); group("自分のアカウント", () {}); }); group("メモの更新", () { testWidgets("メモの更新ができること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer((_) async => TestData.usersShowResponse2.copyWith(isFollowed: true)); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse1.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.ensureVisible(find.byIcon(Icons.edit)); await tester.tap(find.byIcon(Icons.edit)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable(), "藍ちゃん吸う"); await tester.tap(find.text("保存")); await tester.pumpAndSettle(); verify(mockUser.updateMemo(argThat(equals(UsersUpdateMemoRequest( userId: TestData.usersShowResponse2.id, memo: "藍ちゃん吸う"))))); }); }); group("ノート(ローカル)", () { testWidgets("ローカルのノートが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse2); when(mockUser.notes(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap( find.descendant(of: find.byType(Tab), matching: find.text("ノート"))); await tester.pumpAndSettle(); expect(find.textContaining(TestData.note1.text!), findsOneWidget); verify(mockUser.notes(argThat(predicate<UsersNotesRequest>((request) => request.withReplies == false && request.withFiles == false && request.includeMyRenotes == true)))).called(1); await tester.pageNation(); verify(mockUser.notes(argThat(predicate<UsersNotesRequest>((request) => request.withReplies == false && request.withFiles == false && request.includeMyRenotes == true && request.untilId == TestData.note1.id)))).called(1); }); testWidgets("「返信つき」をタップすると、返信つきのノートが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse2); when(mockUser.notes(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap( find.descendant(of: find.byType(Tab), matching: find.text("ノート"))); await tester.pumpAndSettle(); await tester.tap(find.text("返信つき")); await tester.pumpAndSettle(); verify(mockUser.notes(argThat(predicate<UsersNotesRequest>( (request) => request.withReplies == true)))).called(1); }); testWidgets("「ファイルつき」をタップすると、ファイルつきのノートが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse2); when(mockUser.notes(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap( find.descendant(of: find.byType(Tab), matching: find.text("ノート"))); await tester.pumpAndSettle(); await tester.tap(find.text("ファイルつき")); await tester.pumpAndSettle(); verify(mockUser.notes(argThat(predicate<UsersNotesRequest>( (request) => request.withFiles == true)))).called(1); }); testWidgets("「リノートも」を外すと、リノートを除外したノートが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse2); when(mockUser.notes(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap( find.descendant(of: find.byType(Tab), matching: find.text("ノート"))); await tester.pumpAndSettle(); await tester.tap(find.text("リノートも")); await tester.pumpAndSettle(); verify(mockUser.notes(argThat(predicate<UsersNotesRequest>( (request) => request.includeMyRenotes == false)))).called(1); }); testWidgets("「ハイライト」をタップすると、ハイライトのノートのみが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse2); when(mockUser.notes(any)).thenAnswer((_) async => [TestData.note1]); when(mockUser.featuredNotes(any)) .thenAnswer((_) async => [TestData.note2]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap( find.descendant(of: find.byType(Tab), matching: find.text("ノート"))); await tester.pumpAndSettle(); await tester.tap(find.text("ハイライト")); await tester.pumpAndSettle(); expect(find.textContaining(TestData.note2.text!), findsOneWidget); }); }); group("クリップ", () { testWidgets("クリップのタブでクリップが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)) .thenAnswer((_) async => TestData.usersShowResponse2); when(mockUser.clips(any)).thenAnswer((_) async => [TestData.clip]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse2.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap( find.descendant(of: find.byType(Tab), matching: find.text("クリップ"))); await tester.pumpAndSettle(); expect(find.text(TestData.clip.name!), findsOneWidget); await tester.pageNation(); verify(mockUser.clips(argThat(equals(UsersClipsRequest( userId: TestData.usersShowResponse2.id, untilId: TestData.clip.id))))); }); }); group("ページ", () { testWidgets("ページのタブでページが表示されること", (tester) async { //TODO }); }); group("リアクション", () { // TODO: なぜか失敗する // testWidgets("リアクションを公開している場合、リアクション一覧が表示されること", (tester) async { // final mockMisskey = MockMisskey(); // final mockUser = MockMisskeyUsers(); // when(mockMisskey.users).thenReturn(mockUser); // when(mockUser.show(any)).thenAnswer((_) async => // TestData.usersShowResponse2.copyWith(publicReactions: true)); // when(mockUser.reactions(any)).thenAnswer((_) async => [ // UsersReactionsResponse( // id: "id", // createdAt: DateTime.now(), // user: TestData.user1, // type: "🤯", // note: TestData.note3AsAnotherUser) // ]); // await tester.pumpWidget(ProviderScope( // overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], // child: DefaultRootWidget( // initialRoute: UserRoute( // userId: TestData.usersShowResponse2.id, // account: TestData.account), // ), // )); // await tester.pumpAndSettle(); // await tester.ensureVisible(find.text("リアクション")); // await tester.pump(); // await tester.tap(find.text("リアクション")); // await tester.pumpAndSettle(); // expect(find.text(TestData.note3AsAnotherUser.text!), findsOneWidget); // await tester.pageNation(); // verify(mockUser.reactions(argThat(equals(UsersReactionsRequest( // userId: TestData.usersShowResponse2.id, untilId: "id"))))); // }); }); group("フォロー", () { testWidgets("フォローが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer((_) async => TestData.usersShowResponse2.copyWith(isFollowed: true)); when(mockUser.following(any)).thenAnswer((_) async => [ Following( id: "id", createdAt: DateTime.now(), followeeId: TestData.usersShowResponse2.id, followerId: TestData.account.i.id, followee: TestData.detailedUser2, ) ]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse1.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.dragUntilVisible(find.text("フォロー"), find.byType(CustomScrollView), const Offset(0, -50)); await tester.pump(); await tester.tap(find.text("フォロー")); await tester.pumpAndSettle(); expect( find.textContaining(TestData.detailedUser2.name!), findsOneWidget); await tester.pageNation(); verify(mockUser.following(argThat(equals(UsersFollowingRequest( userId: TestData.usersShowResponse2.id, untilId: "id"))))); }); }); group("被フォロー", () { testWidgets("被フォローが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.show(any)).thenAnswer((_) async => TestData.usersShowResponse2.copyWith(isFollowed: true)); when(mockUser.followers(any)).thenAnswer((_) async => [ Following( id: "id", createdAt: DateTime.now(), followeeId: TestData.account.i.id, followerId: TestData.usersShowResponse2.id, follower: TestData.detailedUser2, ) ]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: UserRoute( userId: TestData.usersShowResponse1.id, account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.dragUntilVisible(find.text("フォロワー"), find.byType(CustomScrollView), const Offset(0, -50)); await tester.pump(); await tester.tap(find.text("フォロワー")); await tester.pumpAndSettle(); expect( find.textContaining(TestData.detailedUser2.name!), findsOneWidget); await tester.pageNation(); verify(mockUser.followers(argThat(equals(UsersFollowersRequest( userId: TestData.usersShowResponse2.id, untilId: "id"))))); }); }); group("Play", () { testWidgets("PlayのタブでPlayが表示されること", (tester) async { //TODO }); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/clip_detail_page/clip_detail_page_test.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; import '../../test_util/widget_tester_extension.dart'; void main() { group("クリップのノート一覧", () { testWidgets("クリップ済みノートが表示されること", (tester) async { final clip = MockMisskeyClips(); final misskey = MockMisskey(); when(misskey.clips).thenReturn(clip); when(clip.notes(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ClipDetailRoute( id: TestData.clip.id, account: TestData.account), ))); await tester.pumpAndSettle(); expect(find.text(TestData.note1.text!), findsOneWidget); await tester.pageNation(); verify(clip.notes(argThat(equals(ClipsNotesRequest( clipId: TestData.clip.id, untilId: TestData.note1.id))))) .called(1); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/clip_list_page/clip_list_page_test.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; void main() { group("クリップ一覧", () { testWidgets("クリップ一覧が表示されること", (tester) async { final clip = MockMisskeyClips(); final misskey = MockMisskey(); when(misskey.clips).thenReturn(clip); when(clip.list()).thenAnswer((_) async => [TestData.clip]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ClipListRoute(account: TestData.account), ))); await tester.pumpAndSettle(); expect(find.text(TestData.clip.name!), findsOneWidget); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/antenna_list_page/antenna_list_page_test.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; void main() { group("アンテナ一覧", () { testWidgets("アンテナ一覧が表示されること", (tester) async { final antennas = MockMisskeyAntenna(); final misskey = MockMisskey(); when(misskey.antennas).thenReturn(antennas); when(antennas.list()).thenAnswer((_) async => [TestData.antenna]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: AntennaRoute(account: TestData.account), ))); await tester.pumpAndSettle(); expect(find.text(TestData.antenna.name), findsOneWidget); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/note_create_page/note_create_page_test.dart
import 'dart:convert'; import 'dart:typed_data'; import 'package:collection/collection.dart'; import 'package:file/memory.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/extensions/string_extensions.dart'; import 'package:miria/model/account_settings.dart'; import 'package:miria/model/general_settings.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:miria/view/common/misskey_notes/custom_emoji.dart'; import 'package:miria/view/common/misskey_notes/local_only_icon.dart'; import 'package:miria/view/common/misskey_notes/network_image.dart'; import 'package:miria/view/common/note_create/input_completation.dart'; import 'package:miria/view/dialogs/simple_message_dialog.dart'; import 'package:miria/view/note_create_page/mfm_preview.dart'; import 'package:miria/view/note_create_page/reply_to_area.dart'; import 'package:miria/view/note_create_page/vote_area.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import 'package:visibility_detector/visibility_detector.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; import '../../test_util/widget_tester_extension.dart'; void main() { group("初期値", () { group("チャンネル", () { testWidgets("チャンネルからノートする場合、チャンネルのノートになること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, channel: TestData.channel1), ))); await tester.pumpAndSettle(); expect(find.text(TestData.channel1.name), findsOneWidget); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.channelId == TestData.channel1.id))))); }); testWidgets("削除されたノートを直す場合で、そのノートがチャンネルのノートの場合、チャンネルのノートになること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note1.copyWith( channelId: TestData.channel1.id, channel: NoteChannelInfo( id: TestData.channel1.id, name: TestData.channel1.name))), ))); await tester.pumpAndSettle(); expect(find.text(TestData.channel1.name), findsOneWidget); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.channelId == TestData.channel1.id))))); }); testWidgets("チャンネルのノートにリプライをする場合、そのノートもチャンネルのノートになること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1.copyWith( channelId: TestData.channel1.id, channel: NoteChannelInfo( id: TestData.channel1.id, name: TestData.channel1.name))), ))); await tester.pumpAndSettle(); expect(find.text(TestData.channel1.name), findsOneWidget); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.channelId == TestData.channel1.id))))); }); testWidgets("チャンネルのノートに引用リノートをする場合、引数のチャンネル先が選択されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, channel: TestData.channel2, renote: TestData.note1.copyWith( channelId: TestData.channel1.id, channel: NoteChannelInfo( id: TestData.channel1.id, name: TestData.channel1.name))), ))); await tester.pumpAndSettle(); expect(find.text(TestData.channel2.name), findsOneWidget); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.channelId == TestData.channel2.id))))); }); }); group("公開範囲", () { testWidgets("デフォルトの公開範囲設定が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final accountSettings = MockAccountSettingsRepository(); when(accountSettings.fromAccount(any)).thenReturn(AccountSettings( userId: TestData.account.userId, host: TestData.account.host, defaultNoteVisibility: NoteVisibility.followers)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), accountSettingsRepositoryProvider .overrideWith((ref) => accountSettings) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.visibility == NoteVisibility.followers))))); }); testWidgets("削除されたノートを直す場合、削除されたノートの公開範囲設定が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note1 .copyWith(visibility: NoteVisibility.specified)), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.visibility == NoteVisibility.specified))))); }); testWidgets("引用リノートの場合、リノート元の公開範囲設定が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, renote: TestData.note1.copyWith(visibility: NoteVisibility.home), )))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.visibility == NoteVisibility.home))))); }); testWidgets("リプライの場合、リプライ元の公開範囲設定が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1.copyWith(visibility: NoteVisibility.home), )))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.visibility == NoteVisibility.home))))); }); testWidgets("ユーザーがサイレンスの場合で、デフォルトの公開範囲設定がパブリックの場合、強制ホームになること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final accountSettings = MockAccountSettingsRepository(); when(accountSettings.fromAccount(any)).thenReturn(AccountSettings( userId: TestData.account.userId, host: TestData.account.host, defaultNoteVisibility: NoteVisibility.public)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), accountSettingsRepositoryProvider .overrideWith((ref) => accountSettings) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account.copyWith( i: TestData.account.i.copyWith(isSilenced: true))), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.visibility == NoteVisibility.home))))); }); testWidgets("ユーザーがサイレンスの場合、デフォルトの公開範囲設定がフォロワーのみの場合、デフォルトの公開範囲設定が反映されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final accountSettings = MockAccountSettingsRepository(); when(accountSettings.fromAccount(any)).thenReturn(AccountSettings( userId: TestData.account.userId, host: TestData.account.host, defaultNoteVisibility: NoteVisibility.followers)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), accountSettingsRepositoryProvider .overrideWith((ref) => accountSettings) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account.copyWith( i: TestData.account.i.copyWith(isSilenced: true))), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.visibility == NoteVisibility.followers))))); }); }); group("連合オン・オフ", () { testWidgets("デフォルトの連合範囲設定が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final accountSettings = MockAccountSettingsRepository(); when(accountSettings.fromAccount(any)).thenReturn(AccountSettings( userId: TestData.account.userId, host: TestData.account.host, defaultIsLocalOnly: true)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), accountSettingsRepositoryProvider .overrideWith((ref) => accountSettings) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.localOnly == true))))); }); testWidgets("削除されたノートを直す場合、削除されたノートの連合範囲が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note1.copyWith(localOnly: true)), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.localOnly == true))))); }); testWidgets("引用リノートの場合、リノート元の連合範囲が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, renote: TestData.note1.copyWith(localOnly: true)), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.localOnly == true))))); }); testWidgets("リプライの場合、リプライ元の連合範囲が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1.copyWith(localOnly: true), )))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.localOnly == true))))); }); group("チャンネル", () { testWidgets("チャンネルへのノートの場合、連合オフになること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final accountSettings = MockAccountSettingsRepository(); when(accountSettings.fromAccount(any)).thenReturn(AccountSettings( userId: TestData.account.userId, host: TestData.account.host)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), accountSettingsRepositoryProvider .overrideWith((ref) => accountSettings) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, channel: TestData.channel1), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.localOnly == true))))); }); }); }); group("リアクションの受け入れ", () { testWidgets("デフォルトのリアクション受け入れ設定が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final accountSettings = MockAccountSettingsRepository(); when(accountSettings.fromAccount(any)).thenReturn(AccountSettings( userId: TestData.account.userId, host: TestData.account.host, defaultReactionAcceptance: ReactionAcceptance.nonSensitiveOnly)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), accountSettingsRepositoryProvider .overrideWith((ref) => accountSettings) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.reactionAcceptance == ReactionAcceptance.nonSensitiveOnly))))); }); testWidgets("削除されたノートを直す場合、削除されたノートのリアクション受け入れ設定が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final accountSettings = MockAccountSettingsRepository(); when(accountSettings.fromAccount(any)).thenReturn(AccountSettings( userId: TestData.account.userId, host: TestData.account.host)); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), accountSettingsRepositoryProvider .overrideWith((ref) => accountSettings) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note1.copyWith( reactionAcceptance: ReactionAcceptance.likeOnly)), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.reactionAcceptance == ReactionAcceptance.likeOnly))))); }); testWidgets("引用リノートの場合、リノート元のリアクション受け入れ設定が反映され**ない**こと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, renote: TestData.note1.copyWith( reactionAcceptance: ReactionAcceptance.likeOnly)), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.reactionAcceptance == null))))); }); testWidgets("リプライの場合、リプライ元のリアクション受け入れ設定が反映され**ない**こと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1.copyWith( reactionAcceptance: ReactionAcceptance.likeOnly)), ))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.reactionAcceptance == null))))); }); }); group("注釈", () { testWidgets("初期値は空であること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField).at(0)).text, ""); }); testWidgets("削除したノートを直す場合、削除したノートの注釈が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note1.copyWith(cw: "えっちなやつ")), ))); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField).at(0)).text, "えっちなやつ"); }); testWidgets("リプライを送る場合で、リプライ元が注釈ありの場合、その注釈が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1.copyWith(cw: "えっちなやつ")), ))); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField).at(0)).text, "えっちなやつ"); }); testWidgets("引用リノートをする場合で、リノート元が注釈ありの場合、その注釈が適用され**ない**こと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, renote: TestData.note1.copyWith(cw: "えっちなやつ")), ))); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField).at(0)).text, ""); }); }); group("ノートのテキスト", () { testWidgets("初期値は空であること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField)).text, ""); }); testWidgets("削除したノートを直す場合、削除したノートのテキストが適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note1), ))); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField)).text, TestData.note1.text); }); testWidgets("テキスト共有からノート投稿をする場合、共有のテキストが適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, initialText: ":ai_yaysuperfast:"), ))); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField)).text, ":ai_yaysuperfast:"); }); }); group("メディア", () { testWidgets("初期値は空であること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.mediaIds == null))))) .called(1); }); testWidgets("削除したノートを直す場合、削除したノートのメディアが適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final mockDio = MockDio(); when(mockDio.get(any, options: anyNamed("options"))) .thenAnswer((_) async => await TestData.binaryImageResponse); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), dioProvider.overrideWith((ref) => mockDio), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note1.copyWith( files: [TestData.drive1], fileIds: [TestData.drive1.id])), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => const DeepCollectionEquality() .equals(arg.fileIds, [TestData.drive1.id])))))).called(1); }); testWidgets("画像共有からノートを投稿する場合、共有の画像が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); final mockDrive = MockMisskeyDrive(); final mockDriveFiles = MockMisskeyDriveFiles(); when(mockMisskey.notes).thenReturn(mockNote); when(mockMisskey.drive).thenReturn(mockDrive); when(mockDrive.files).thenReturn(mockDriveFiles); when(mockDriveFiles.createAsBinary(any, any)).thenAnswer( (_) async => TestData.drive1.copyWith(name: "test.png")); final mockDio = MockDio(); when(mockDio.get(any, options: anyNamed("options"))) .thenAnswer((_) async => await TestData.binaryImageResponse); final memoryFileSystem = MemoryFileSystem(); final binaryImage = await TestData.binaryImage; memoryFileSystem.file("/test.png").writeAsBytes(binaryImage); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), fileSystemProvider.overrideWith((ref) => memoryFileSystem), dioProvider.overrideWith((ref) => mockDio), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, initialMediaFiles: const ["/test.png"]), ), )); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockDriveFiles.createAsBinary( argThat( equals( const DriveFilesCreateRequest( name: "test.png", force: true, isSensitive: false, ), ), ), argThat(equals(predicate<Uint8List>((value) => const DeepCollectionEquality().equals(value, binaryImage)))))); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => const DeepCollectionEquality() .equals([TestData.drive1.id], arg.fileIds)))))); }); testWidgets("共有したファイルが画像でない場合でも、ファイルの投稿ができること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); final mockDrive = MockMisskeyDrive(); final mockDriveFiles = MockMisskeyDriveFiles(); when(mockMisskey.notes).thenReturn(mockNote); when(mockMisskey.drive).thenReturn(mockDrive); when(mockDrive.files).thenReturn(mockDriveFiles); when(mockDriveFiles.createAsBinary(any, any)).thenAnswer( (_) async => TestData.drive1.copyWith(name: "test.txt")); final mockDio = MockDio(); when(mockDio.get(any, options: anyNamed("options"))) .thenAnswer((_) async => await TestData.binaryImageResponse); final memoryFileSystem = MemoryFileSystem(); final binaryData = utf8.encode(":murakamisan_tutinoko_hasitumami_crying:"); memoryFileSystem.file("/test.txt").writeAsBytes(binaryData); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), fileSystemProvider.overrideWith((ref) => memoryFileSystem), dioProvider.overrideWith((ref) => mockDio), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, initialMediaFiles: const ["/test.txt"]), ), )); await tester.pumpAndSettle(); expect(find.text("test.txt"), findsOneWidget); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockDriveFiles.createAsBinary( argThat( equals( const DriveFilesCreateRequest( name: "test.txt", force: true, isSensitive: false, ), ), ), argThat(equals(predicate<Uint8List>((value) => const DeepCollectionEquality().equals(value, binaryData)))))); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => const DeepCollectionEquality() .equals([TestData.drive1.id], arg.fileIds)))))); }); }); group("リプライ先", () { testWidgets("リプライの場合、返信先が表示されていること", (tester) async { await tester.pumpWidget(ProviderScope( overrides: [ inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note3AsAnotherUser, ), ))); await tester.pumpAndSettle(); expect(find.text("返信先:"), findsOneWidget); expect( find.descendant( of: find.byType(ReplyToArea), matching: find.textContaining( TestData.note3AsAnotherUser.user.username, findRichText: true)), findsOneWidget); }); testWidgets("リプライにメンションが含まれている場合、両方の返信先が表示されていること", (tester) async { final misskey = MockMisskey(); final users = MockMisskeyUsers(); when(misskey.users).thenReturn(users); when(users.showByIds(any)) .thenAnswer((_) async => [TestData.usersShowResponse2]); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => misskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note5AsAnotherUser.copyWith( mentions: [TestData.detailedUser1.username], ), ), ))); await tester.pumpAndSettle(); expect(find.text("返信先:"), findsOneWidget); expect( find.descendant( of: find.byType(ReplyToArea), matching: find.text( "@${TestData.note5AsAnotherUser.user.username}", findRichText: true)), findsOneWidget); expect( find.descendant( of: find.byType(ReplyToArea), matching: find.text("@${TestData.usersShowResponse2.username}", findRichText: true)), findsOneWidget); }); testWidgets("削除したノートがリプライの場合、そのユーザーの情報が表示されていること", (tester) async { final misskey = MockMisskey(); final users = MockMisskeyUsers(); when(misskey.users).thenReturn(users); when(users.showByIds(any)) .thenAnswer((_) async => [TestData.usersShowResponse1]); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => misskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note1.copyWith(mentions: ["@ai"]), )))); await tester.pumpAndSettle(); expect(find.text("返信先:"), findsOneWidget); expect( find.descendant( of: find.byType(ReplyToArea), matching: find.text("@ai", findRichText: true)), findsOneWidget); }); testWidgets("自分自身はリプライの返信先に含まれていないこと", (tester) async { await tester.pumpWidget(ProviderScope( overrides: [ inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1)))); await tester.pumpAndSettle(); expect(find.text("返信先:"), findsNothing); }); testWidgets("リプライでない場合、返信先が表示されていないこと", (tester) async { await tester.pumpWidget(ProviderScope( overrides: [ inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); expect(find.text("返信先:"), findsNothing); }); }); group("投票", () { testWidgets("初期値はノートの投票なしであること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.poll == null))))) .called(1); }); testWidgets("削除したノートを直す場合、削除したノートの投票が適用されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note4AsVote.copyWith( poll: TestData.note4AsVote.poll?.copyWith(multiple: false)), )))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => const DeepCollectionEquality().equals( TestData.note4AsVote.poll!.choices.map((e) => e.text), arg.poll!.choices) && TestData.note4AsVote.poll!.expiresAt == arg.poll!.expiresAt && arg.poll!.expiredAfter == null && TestData.note4AsVote.poll!.multiple == arg.poll!.multiple))))); }); testWidgets("削除したノートが複数選択可能な場合、複数選択可能な状態が引き継がれていること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, note: TestData.note4AsVote.copyWith( poll: TestData.note4AsVote.poll?.copyWith(multiple: true)), )))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll!.multiple == true))))); }); }); }); group("入力・バリデーション", () { group("テキスト", () { testWidgets("ノートの内容を編集して投稿できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, )))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_bonk:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.text == ":ai_bonk:"))))).called(1); }); testWidgets("ノートの内容が空で投稿することができないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, )))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pump(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); expect(find.byType(TextField).hitTestable(), findsOneWidget); }); testWidgets("画像が添付されている場合、ノートの内容が空でも投稿できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); final mockDrive = MockMisskeyDrive(); final mockDriveFiles = MockMisskeyDriveFiles(); when(mockMisskey.notes).thenReturn(mockNote); when(mockMisskey.drive).thenReturn(mockDrive); when(mockDrive.files).thenReturn(mockDriveFiles); when(mockDriveFiles.createAsBinary(any, any)).thenAnswer( (_) async => TestData.drive1.copyWith(name: "test.txt")); final mockDio = MockDio(); when(mockDio.get(any, options: anyNamed("options"))) .thenAnswer((_) async => await TestData.binaryImageResponse); final memoryFileSystem = MemoryFileSystem(); final binaryData = utf8.encode(":murakamisan_tutinoko_hasitumami_crying:"); memoryFileSystem.file("/test.txt").writeAsBytes(binaryData); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), fileSystemProvider.overrideWith((ref) => memoryFileSystem), dioProvider.overrideWith((ref) => mockDio), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, initialMediaFiles: const ["/test.txt"]), ), )); await tester.pumpAndSettle(); expect(find.text("test.txt"), findsOneWidget); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockDriveFiles.createAsBinary( argThat( equals( const DriveFilesCreateRequest( name: "test.txt", force: true, isSensitive: false, ), ), ), argThat(equals(predicate<Uint8List>((value) => const DeepCollectionEquality().equals(value, binaryData)))))); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.text == null && const DeepCollectionEquality() .equals([TestData.drive1.id], arg.fileIds)))))); }); group("入力補完", () { testWidgets("カスタム絵文字の入力補完が可能なこと", (tester) async { final emojiRepository = MockEmojiRepository(); when(emojiRepository.emoji).thenReturn([ TestData.unicodeEmojiRepositoryData1, TestData.customEmojiRepositoryData1 ]); when(emojiRepository.defaultEmojis()).thenAnswer( (_) => [TestData.unicodeEmoji1, TestData.customEmoji1]); final generalSettingsRepository = MockGeneralSettingsRepository(); when(generalSettingsRepository.settings) .thenReturn(const GeneralSettings(emojiType: EmojiType.system)); await tester.pumpWidget(ProviderScope( overrides: [ emojiRepositoryProvider .overrideWith((ref, arg) => emojiRepository), generalSettingsRepositoryProvider .overrideWith((ref) => generalSettingsRepository), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text(":")); await tester.pumpAndSettle(); expect( find.byWidgetPredicate((widget) => widget is NetworkImageView && widget.url == TestData.customEmoji1.url.toString()), findsOneWidget); expect(find.text(TestData.unicodeEmoji1.char), findsOneWidget); await tester.tap(find.byType(NetworkImageView).at(1)); expect( tester .textEditingController(find.byType(TextField).hitTestable()) .value, TextEditingValue( text: ":${TestData.customEmoji1.baseName}:", selection: TextSelection.collapsed( offset: ":${TestData.customEmoji1.baseName}:".length))); }); testWidgets("通常の絵文字の入力補完が可能なこと", (tester) async { final emojiRepository = MockEmojiRepository(); when(emojiRepository.emoji).thenReturn([ TestData.unicodeEmojiRepositoryData1, TestData.customEmojiRepositoryData1 ]); when(emojiRepository.defaultEmojis()).thenAnswer( (_) => [TestData.unicodeEmoji1, TestData.customEmoji1]); final generalSettingsRepository = MockGeneralSettingsRepository(); when(generalSettingsRepository.settings) .thenReturn(const GeneralSettings(emojiType: EmojiType.system)); await tester.pumpWidget(ProviderScope( overrides: [ emojiRepositoryProvider .overrideWith((ref, arg) => emojiRepository), generalSettingsRepositoryProvider .overrideWith((ref) => generalSettingsRepository), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text(":")); await tester.pumpAndSettle(); await tester.tap(find.text(TestData.unicodeEmoji1.char)); expect( tester .textEditingController(find.byType(TextField).hitTestable()) .value, TextEditingValue( text: TestData.unicodeEmoji1.char, selection: TextSelection.collapsed( offset: TestData.unicodeEmoji1.char.length))); }); testWidgets( "「他のん」を押下するとリアクションピッカーが表示されること" "選択したカスタム絵文字が補完されること", (tester) async { VisibilityDetectorController.instance.updateInterval = Duration.zero; final emojiRepository = MockEmojiRepository(); when(emojiRepository.emoji).thenReturn([ TestData.unicodeEmojiRepositoryData1, TestData.customEmojiRepositoryData1 ]); when(emojiRepository.searchEmojis(any)).thenAnswer( (_) async => [TestData.unicodeEmoji1, TestData.customEmoji1]); when(emojiRepository.defaultEmojis()) .thenReturn([TestData.unicodeEmoji1, TestData.customEmoji1]); await tester.pumpWidget(ProviderScope( overrides: [ emojiRepositoryProvider .overrideWith((ref, arg) => emojiRepository) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable(), ":"); await tester.pumpAndSettle(); await tester.tap(find.text("他のん")); await tester.pumpAndSettle(); await tester.tap(find.byType(CustomEmoji).at(1)); await tester.pumpAndSettle(); expect( tester .textEditingController(find.byType(TextField).hitTestable()) .text, ":${TestData.customEmoji1.baseName}:"); }); testWidgets("MFMの関数名の入力補完が可能なこと", (tester) async { await tester.pumpWidget( ProviderScope( child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ), ), ); await tester.pumpAndSettle(); await tester.tap(find.text(r"$[")); await tester.pumpAndSettle(); expect(find.text("tada"), findsOneWidget); await tester.enterText(find.byType(TextField).hitTestable(), r"$[r"); await tester.pumpAndSettle(); await tester.tap(find.text("rainbow")); await tester.pumpAndSettle(); expect( tester .textEditingController(find.byType(TextField).hitTestable()) .text, r"$[rainbow ", ); }); testWidgets("MFMの関数の引数の入力補完が可能なこと", (tester) async { await tester.pumpWidget( ProviderScope( child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ), ), ); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), r"$[spin.s", ); await tester.pumpAndSettle(); await tester.tap(find.text("speed")); await tester.pumpAndSettle(); await tester.tap(find.text("x")); await tester.pumpAndSettle(); expect( tester .textEditingController(find.byType(TextField).hitTestable()) .text, r"$[spin.speed=1.5s,x", ); }); testWidgets("ハッシュタグの入力補完が可能なこと", (tester) async { final mockMisskey = MockMisskey(); final mockHashtags = MockMisskeyHashtags(); when(mockMisskey.hashtags).thenReturn(mockHashtags); when(mockHashtags.trend()).thenAnswer( (_) async => [ const HashtagsTrendResponse(tag: "abc", chart: [], usersCount: 0), ], ); when(mockHashtags.search(any)).thenAnswer( (_) async => ["def"], ); await tester.pumpWidget( ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey) ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ), ), ); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable(), "#"); await tester.pumpAndSettle(); expect(find.text("abc"), findsOneWidget); await tester.enterText(find.byType(TextField).hitTestable(), "#d"); await tester.pumpAndSettle(); await tester.tap(find.text("def")); await tester.pumpAndSettle(); expect( tester .textEditingController(find.byType(TextField).hitTestable()) .text, "#def ", ); }); }); group("プレビュー", () { testWidgets("プレビューのテキストはisCatの場合nyaizeされること", (tester) async { await tester.pumpWidget(ProviderScope( overrides: [ inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account .copyWith(i: TestData.account.i.copyWith(isCat: true)), )))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), "は?なんなん?"); await tester.pumpAndSettle(); expect(find.text("は?にゃんにゃん?"), findsOneWidget); }); testWidgets("プレビューのテキストはisCatでない場合nyaizeされないこと", (tester) async { await tester.pumpWidget(ProviderScope( overrides: [ inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account .copyWith(i: TestData.account.i.copyWith(isCat: false)), )))); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), "は?なんなん?"); await tester.pumpAndSettle(); // 入力テキストとプレビューで2つになる expect(find.text("は?なんなん?"), findsNWidgets(2)); }); testWidgets("リプライ先がプレビューには反映されていること", (tester) async { await tester.pumpWidget(ProviderScope( overrides: [ inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note3AsAnotherUser), ))); await tester.pumpAndSettle(); expect( find.descendant( of: find.byType(MfmPreview), matching: find.textContaining( TestData.note3AsAnotherUser.user.username.tight, findRichText: true)), findsOneWidget); }); }); }); group("注釈", () { testWidgets("注釈のアイコンのタップで表示が切り替わること", (tester) async { await tester.pumpWidget(ProviderScope( child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, )))); await tester.pumpAndSettle(); expect(find.byType(TextField), findsOneWidget); await tester.tap(find.byIcon(Icons.remove_red_eye)); await tester.pumpAndSettle(); expect(find.byType(TextField), findsNWidgets(2)); await tester.tap(find.byIcon(Icons.visibility_off)); await tester.pumpAndSettle(); expect(find.byType(TextField), findsOneWidget); }); testWidgets("注釈つきのノートが投稿できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, )))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.remove_red_eye)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(0), ":nsfw:"); await tester.enterText(find.byType(TextField).at(1), "えっちなやつ"); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.cw == ":nsfw:"))))) .called(1); }); testWidgets("内容を入力している状態で注釈を非表示にした場合、注釈なしで投稿されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, )))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.remove_red_eye)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(0), ":nsfw:"); await tester.enterText(find.byType(TextField).at(1), "えっちなやつ"); await tester.tap(find.byIcon(Icons.visibility_off)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.cw == null))))) .called(1); }); }); group("公開範囲", () { final testCases = { "パブリック": (Icons.public, NoteVisibility.public), "ホーム": (Icons.home, NoteVisibility.home), "フォロワー": (Icons.lock_outline, NoteVisibility.followers), "ダイレクト": (Icons.mail, NoteVisibility.specified) }; for (final testCase in testCases.entries) { testWidgets("公開範囲を${testCase.key}に変更して投稿できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(0), ":ai_yay:"); await tester.tap(find.byIcon(Icons.public)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(testCase.value.$1).hitTestable()); await tester.pumpAndSettle(); expect(find.byIcon(testCase.value.$1).hitTestable(), findsOneWidget); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.visibility == testCase.value.$2))))).called(1); }); } testWidgets("サイレンスユーザーがパブリック投稿にできないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account.copyWith( i: TestData.account.i.copyWith(isSilenced: true)))))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(0), ":ai_yay:"); await tester.tap(find.byIcon(Icons.home)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.public).hitTestable()); await tester.pumpAndSettle(); // エラーメッセージが表示されること expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); // 入力可能な状態に戻っていること await tester.tap(find.byIcon(Icons.home).hitTestable()); await tester.pumpAndSettle(); expect(find.byType(TextField).hitTestable(), findsOneWidget); }); testWidgets("公開範囲がパブリックでないノートに対するリプライを、パブリック投稿にできないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1 .copyWith(visibility: NoteVisibility.followers)), ))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(0), ":ai_yay:"); await tester.tap(find.byIcon(Icons.lock_outline)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.public).hitTestable()); await tester.pumpAndSettle(); // エラーメッセージが表示されること expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); // 入力可能な状態に戻っていること await tester.tap(find.byIcon(Icons.home).hitTestable()); await tester.pumpAndSettle(); expect(find.byType(TextField).hitTestable(), findsOneWidget); }); // ホームのリノートは何が正解なんだろう }); group("リアクションの受け入れ", () { final testCases = { "全て": (find.byType(SvgPicture), null), "全て(リモートはいいねのみ)": ( find.byIcon(Icons.add_reaction_outlined), ReactionAcceptance.likeOnlyForRemote ), "非センシティブのみ": ( find.byIcon(Icons.shield_outlined), ReactionAcceptance.nonSensitiveOnly ), "非センシティブのみ(リモートはいいねのみ)": ( find.byIcon(Icons.add_moderator_outlined), ReactionAcceptance.nonSensitiveOnlyForLocalLikeOnlyForRemote ), "いいねのみ": ( find.byIcon(Icons.favorite_border), ReactionAcceptance.likeOnly ) }; for (final testCase in testCases.entries) { testWidgets("リアクションの受け入れを${testCase.key}に変更して投稿できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(0), ":ai_yay:"); await tester.tap(find.byType(SvgPicture)); await tester.pumpAndSettle(); await tester.tap(testCase.value.$1.hitTestable()); await tester.pumpAndSettle(); expect(testCase.value.$1, findsOneWidget); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.reactionAcceptance == testCase.value.$2))))) .called(1); }); } }); group("連合", () { testWidgets("連合の表示が切り替わること", (tester) async { await tester.pumpWidget(ProviderScope( overrides: [ inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.rocket)); await tester.pumpAndSettle(); expect(find.byType(LocalOnlyIcon), findsOneWidget); await tester.tap(find.byType(LocalOnlyIcon)); await tester.pumpAndSettle(); expect(find.byIcon(Icons.rocket), findsOneWidget); }); testWidgets("連合がオンの場合、連合ありで投稿されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.localOnly == false))))).called(1); }); testWidgets("連合がオフに設定した場合、連合なしで投稿されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), ":ai_yay:"); await tester.tap(find.byIcon(Icons.rocket)); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.localOnly == true))))).called(1); }); testWidgets("チャンネルのノートを連合オンに設定できないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, channel: TestData.channel1)))); await tester.pumpAndSettle(); await tester.tap(find.byType(LocalOnlyIcon)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); expect(find.byType(LocalOnlyIcon), findsOneWidget); }); testWidgets("引用リノートしようとしているノートが連合オフの場合、連合オンに設定できないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, renote: TestData.note1.copyWith(localOnly: true))))); await tester.pumpAndSettle(); await tester.tap(find.byType(LocalOnlyIcon)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); expect(find.byType(LocalOnlyIcon), findsOneWidget); }); testWidgets("リプライ元のノートが連合オフの場合、連合オンに設定できないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1.copyWith(localOnly: true))))); await tester.pumpAndSettle(); await tester.tap(find.byType(LocalOnlyIcon)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); expect(find.byType(LocalOnlyIcon), findsOneWidget); }); testWidgets("メンション先がローカルユーザーのみの場合、連合オフで投稿できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); final mockUser = MockMisskeyUsers(); when(mockMisskey.notes).thenReturn(mockNote); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.showByName(any)) .thenAnswer((_) async => TestData.usersShowResponse2); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1)))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.rocket)); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField), "@oishiibot :ai_yaysuperfast:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat( predicate<NotesCreateRequest>((arg) => arg.localOnly == true)))); }); testWidgets("メンション先がリモートユーザーを含む場合、連合オフで投稿できないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, reply: TestData.note1)))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.rocket)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), "@[email protected] :ai_yaysuperfast:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); verifyNever(mockNote.notes(any)); }); }); group("リアクションピッカー", () { testWidgets("リアクションピッカーからカスタム絵文字が入力できること", (tester) async { VisibilityDetectorController.instance.updateInterval = Duration.zero; final emojiRepository = MockEmojiRepository(); when(emojiRepository.emoji).thenReturn([ TestData.unicodeEmojiRepositoryData1, TestData.customEmojiRepositoryData1 ]); when(emojiRepository.searchEmojis(any)).thenAnswer( (_) async => [TestData.unicodeEmoji1, TestData.customEmoji1]); when(emojiRepository.defaultEmojis()) .thenReturn([TestData.unicodeEmoji1, TestData.customEmoji1]); await tester.pumpWidget(ProviderScope( overrides: [ emojiRepositoryProvider .overrideWith((ref, arg) => emojiRepository), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.tag_faces)); await tester.pumpAndSettle(); await tester.tap(find.byType(NetworkImageView).at(1)); await tester.pumpAndSettle(); expect( tester .textEditingController(find.byType(TextField).hitTestable()) .value, TextEditingValue( text: ":${TestData.customEmoji1.baseName}:", selection: TextSelection.collapsed( offset: ":${TestData.customEmoji1.baseName}:".length))); }); testWidgets("リアクションピッカーからUnicodeの絵文字が入力できること", (tester) async { VisibilityDetectorController.instance.updateInterval = Duration.zero; final emojiRepository = MockEmojiRepository(); when(emojiRepository.emoji).thenReturn([ TestData.unicodeEmojiRepositoryData1, TestData.customEmojiRepositoryData1 ]); when(emojiRepository.searchEmojis(any)).thenAnswer( (_) async => [TestData.unicodeEmoji1, TestData.customEmoji1]); when(emojiRepository.defaultEmojis()) .thenReturn([TestData.unicodeEmoji1, TestData.customEmoji1]); final generalSettingsRepository = MockGeneralSettingsRepository(); when(generalSettingsRepository.settings) .thenReturn(const GeneralSettings(emojiType: EmojiType.system)); await tester.pumpWidget(ProviderScope( overrides: [ emojiRepositoryProvider .overrideWith((ref, arg) => emojiRepository), inputComplementDelayedProvider.overrideWithValue(1), generalSettingsRepositoryProvider .overrideWith((ref) => generalSettingsRepository), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.tag_faces)); await tester.pumpAndSettle(); await tester.tap(find.text(TestData.unicodeEmoji1.char)); await tester.pumpAndSettle(); expect( tester .textEditingController(find.byType(TextField).hitTestable()) .value, TextEditingValue( text: TestData.unicodeEmoji1.char, selection: TextSelection.collapsed( offset: TestData.unicodeEmoji1.char.length))); }); }); group("返信先", () { testWidgets("返信先の追加できること", (tester) async { final misskey = MockMisskey(); final note = MockMisskeyNotes(); final users = MockMisskeyUsers(); when(misskey.notes).thenReturn(note); when(misskey.users).thenReturn(users); when(users.search(any)) .thenAnswer((_) async => [TestData.detailedUser1]); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => misskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.mail_outline)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable(), "おいしいbot"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); await tester .tap(find.text(TestData.detailedUser1.name!, findRichText: true)); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); verify(note.create(argThat(equals(predicate<NotesCreateRequest>((arg) => arg.text == "@${TestData.detailedUser1.username} :ai_yay:"))))); }); testWidgets("複数の返信先を追加できること", (tester) async { final misskey = MockMisskey(); final note = MockMisskeyNotes(); final users = MockMisskeyUsers(); when(misskey.notes).thenReturn(note); when(misskey.users).thenReturn(users); var count = 0; when(users.search(any)).thenAnswer((_) async { count++; if (count == 1) return [TestData.detailedUser1]; return [TestData.detailedUser2]; }); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => misskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.mail_outline)); await tester.pumpAndSettle(); // 1人目 await tester.enterText(find.byType(TextField).hitTestable(), "おいしいbot"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); await tester .tap(find.text(TestData.detailedUser1.name!, findRichText: true)); await tester.pumpAndSettle(); // 2人目 await tester.tap(find.byIcon(Icons.mail_outline)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable(), "藍"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); await tester .tap(find.text(TestData.detailedUser2.name!, findRichText: true)); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); verify(note.create(argThat(equals(predicate<NotesCreateRequest>((arg) => arg.text == "@${TestData.detailedUser1.username} @${TestData.detailedUser2.username}@${TestData.detailedUser2.host} :ai_yay:"))))); }); testWidgets("追加した返信先を削除できること", (tester) async { final misskey = MockMisskey(); final note = MockMisskeyNotes(); final users = MockMisskeyUsers(); when(misskey.notes).thenReturn(note); when(misskey.users).thenReturn(users); when(users.search(any)) .thenAnswer((_) async => [TestData.detailedUser1]); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => misskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account)))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.mail_outline)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable(), "おいしいbot"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); await tester .tap(find.text(TestData.detailedUser1.name!, findRichText: true)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.remove)); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); verify(note.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.text == ":ai_yay:"))))); }); }); group("メディア", () { testWidgets("ドライブからメディアを投稿できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); final mockDrive = MockMisskeyDrive(); final mockDriveFolders = MockMisskeyDriveFolders(); final mockDriveFiles = MockMisskeyDriveFiles(); when(mockMisskey.notes).thenReturn(mockNote); when(mockMisskey.drive).thenReturn(mockDrive); when(mockDrive.folders).thenReturn(mockDriveFolders); when(mockDrive.files).thenReturn(mockDriveFiles); when(mockDriveFolders.folders(any)).thenAnswer((_) async => []); when(mockDriveFiles.files(any)) .thenAnswer((_) async => [TestData.drive1]); final mockDio = MockDio(); when(mockDio.get(any, options: anyNamed("options"))) .thenAnswer((_) async => await TestData.binaryImageResponse); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), dioProvider.overrideWith((ref) => mockDio), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, ), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.image)); await tester.pumpAndSettle(); await tester.tap(find.text("ドライブから")); await tester.pumpAndSettle(); await tester.tap(find.text(TestData.drive1.name), warnIfMissed: false); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.check)); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => const DeepCollectionEquality() .equals([TestData.drive1.id], arg.fileIds)))))); }); testWidgets("単一の画像のアップロードができること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); final mockDrive = MockMisskeyDrive(); final mockDriveFiles = MockMisskeyDriveFiles(); when(mockMisskey.notes).thenReturn(mockNote); when(mockMisskey.drive).thenReturn(mockDrive); when(mockDrive.files).thenReturn(mockDriveFiles); when(mockDriveFiles.createAsBinary(any, any)).thenAnswer( (_) async => TestData.drive1.copyWith(name: "test.png")); final binaryImage = await TestData.binaryImage; final filePicker = MockFilePickerPlatform(); FilePicker.platform = filePicker; when(filePicker.pickFiles( dialogTitle: anyNamed("dialogTitle"), initialDirectory: anyNamed("initialDirectory"), type: anyNamed("type"), allowedExtensions: anyNamed("allowedExtensions"), onFileLoading: anyNamed("onFileLoading"), allowCompression: anyNamed("allowCompression"), allowMultiple: anyNamed("allowMultiple"), withData: anyNamed("withData"), withReadStream: anyNamed("withReadStream"), lockParentWindow: anyNamed("lockParentWindow"), )).thenAnswer( (_) async => FilePickerResult([ PlatformFile( path: "/test.png", name: "test.png", size: binaryImage.length, bytes: binaryImage) ]), ); final fileSystem = MemoryFileSystem(); await fileSystem.file("/test.png").writeAsBytes(binaryImage); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), fileSystemProvider.overrideWith((ref) => fileSystem), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, ), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.image)); await tester.pumpAndSettle(); await tester.tap(find.text("アップロード")); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => const DeepCollectionEquality() .equals([TestData.drive1.id], arg.fileIds)))))); verify(mockDriveFiles.createAsBinary( argThat( equals( const DriveFilesCreateRequest( name: "test.png", force: true, isSensitive: false, ), ), ), argThat(equals(predicate<Uint8List>((value) => const DeepCollectionEquality().equals(value, binaryImage)))))); }); testWidgets("画像を何も選択しなかった場合、何もアップロードされないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); final filePicker = MockFilePickerPlatform(); FilePicker.platform = filePicker; when(filePicker.pickFiles( dialogTitle: anyNamed("dialogTitle"), initialDirectory: anyNamed("initialDirectory"), type: anyNamed("type"), allowedExtensions: anyNamed("allowedExtensions"), onFileLoading: anyNamed("onFileLoading"), allowCompression: anyNamed("allowCompression"), allowMultiple: anyNamed("allowMultiple"), withData: anyNamed("withData"), withReadStream: anyNamed("withReadStream"), lockParentWindow: anyNamed("lockParentWindow"), )).thenAnswer((_) async => null); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, ), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.image)); await tester.pumpAndSettle(); await tester.tap(find.text("アップロード")); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals( predicate<NotesCreateRequest>((arg) => arg.fileIds == null))))); }); }); group("投票", () { testWidgets("投票つきノートを投稿できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), "純金製ぬいぐるみ"); await tester.enterText(find.byType(TextField).at(2), "動くゼロ幅スペース"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: ["純金製ぬいぐるみ", "動くゼロ幅スペース"], multiple: false, expiresAt: null, expiredAfter: null)))))).called(1); }); testWidgets("投票は10個まで追加できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); for (var i = 0; i < 8; i++) { await tester.tap(find.text("増やす")); } for (var i = 0; i < 10; i++) { await tester.enterText(find.byType(TextField).at(i + 1), "投票$i"); } await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: [ "投票0", "投票1", "投票2", "投票3", "投票4", "投票5", "投票6", "投票7", "投票8", "投票9" ], multiple: false, expiresAt: null, expiredAfter: null)))))).called(1); }); testWidgets("追加した投票の項目を削除できること、2つ以上削除することはできないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), "投票0"); await tester.enterText(find.byType(TextField).at(2), "投票1"); await tester.tap(find.text("増やす")); await tester.tap(find.text("増やす")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(3), "投票2"); await tester.enterText(find.byType(TextField).at(4), "投票3"); await tester.pumpAndSettle(); // 投票2を削除 await tester.tap(find.byIcon(Icons.close).at(2)); await tester.pumpAndSettle(); // 投票2が削除されていること expect(tester.textEditingController(find.byType(TextField).at(1)).text, "投票0"); expect(tester.textEditingController(find.byType(TextField).at(2)).text, "投票1"); expect(tester.textEditingController(find.byType(TextField).at(3)).text, "投票3"); // 投票0を削除 await tester.tap(find.byIcon(Icons.close).at(0)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.close).at(0)); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField).at(1)).text, "投票1"); expect(tester.textEditingController(find.byType(TextField).at(2)).text, "投票3"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: ["投票1", "投票3"], multiple: false, expiresAt: null, expiredAfter: null)))))).called(1); }); testWidgets("2つ以上の投票がないと投稿できないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton).hitTestable()); // 1個だけではエラーになること await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton).hitTestable()); // 2個でエラーにならないこと await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: null, expiredAfter: null)))))).called(1); }); testWidgets("複数回答の投票をもとに戻せること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.tap(find.byType(Switch)); await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.byType(Switch)); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: null, expiredAfter: null)))))).called(1); }); testWidgets("日時指定の投票を作成できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.text("無期限")); await tester.pumpAndSettle(); await tester.tap(find.text("日時指定")); await tester.pumpAndSettle(); await tester.ensureVisible(find.byType(VoteUntilDate)); await tester.tap(find.byType(VoteUntilDate)); await tester.pumpAndSettle(); // TODO: Material3にしたときにこっちにする // await tester.tap(find.byIcon(Icons.edit_outlined)); await tester.tap(find.byIcon(Icons.edit)); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), "2099/12/31"); await tester.tap(find.text("OK")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.keyboard_outlined)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable().at(0), "3"); await tester.enterText( find.byType(TextField).hitTestable().at(1), "34"); await tester.tap(find.text("OK")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: DateTime(2099, 12, 31, 3, 34, 0, 0), expiredAfter: null)))))).called(1); }); testWidgets("日時指定の投票で日時を未入力時、投稿ができないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.text("無期限")); await tester.pumpAndSettle(); await tester.tap(find.text("日時指定")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton).hitTestable()); await tester.pumpAndSettle(); await tester.ensureVisible(find.byType(VoteUntilDate)); await tester.tap(find.byType(VoteUntilDate)); await tester.pumpAndSettle(); // TODO: Material3にしたときにこっちにする // await tester.tap(find.byIcon(Icons.edit_outlined)); await tester.tap(find.byIcon(Icons.edit)); await tester.pumpAndSettle(); await tester.enterText( find.byType(TextField).hitTestable(), "2099/12/31"); await tester.tap(find.text("OK")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.keyboard_outlined)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable().at(0), "3"); await tester.enterText( find.byType(TextField).hitTestable().at(1), "34"); await tester.tap(find.text("OK")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: DateTime(2099, 12, 31, 3, 34, 0, 0), expiredAfter: null)))))).called(1); }); testWidgets("経過指定の投票を「秒」で作成できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.text("無期限")); await tester.pumpAndSettle(); await tester.tap(find.text("期間指定")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(3), "100"); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: null, expiredAfter: Duration(seconds: 100))))))).called(1); }); testWidgets("経過指定の投票を「分」で作成できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.text("無期限")); await tester.pumpAndSettle(); await tester.tap(find.text("期間指定")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(3), "100"); await tester.ensureVisible(find.text("秒")); await tester.tap(find.text("秒")); await tester.pumpAndSettle(); await tester.tap(find.text("分")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: null, expiredAfter: Duration(minutes: 100))))))).called(1); }); testWidgets("経過指定の投票を「時」で作成できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.text("無期限")); await tester.pumpAndSettle(); await tester.tap(find.text("期間指定")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(3), "100"); await tester.ensureVisible(find.text("秒")); await tester.tap(find.text("秒")); await tester.pumpAndSettle(); await tester.tap(find.text("時間")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: null, expiredAfter: Duration(hours: 100))))))).called(1); }); testWidgets("経過指定の投票を「日」で作成できること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.text("無期限")); await tester.pumpAndSettle(); await tester.tap(find.text("期間指定")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(3), "100"); await tester.ensureVisible(find.text("秒")); await tester.tap(find.text("秒")); await tester.pumpAndSettle(); await tester.tap(find.text("日")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: null, expiredAfter: Duration(days: 100))))))).called(1); }); testWidgets("経過指定の投票の作成時、投票期間を未入力で投稿を作成できないこと", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), inputComplementDelayedProvider.overrideWithValue(1), ], child: DefaultRootWidget( initialRoute: NoteCreateRoute(initialAccount: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.how_to_vote)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).at(1), ":ai_yay:"); await tester.enterText( find.byType(TextField).at(2), ":ai_yay_superfast:"); await tester.tap(find.text("無期限")); await tester.pumpAndSettle(); await tester.tap(find.text("期間指定")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton).hitTestable()); await tester.enterText(find.byType(TextField).at(3), "100"); await tester.ensureVisible(find.text("秒")); await tester.tap(find.text("秒")); await tester.pumpAndSettle(); await tester.tap(find.text("日")); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); await tester.pumpAndSettle(); verify(mockNote.create(argThat(equals(predicate<NotesCreateRequest>( (arg) => arg.poll == const NotesCreatePollRequest( choices: [":ai_yay:", ":ai_yay_superfast:"], multiple: false, expiresAt: null, expiredAfter: Duration(days: 100))))))).called(1); }); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/channel_page/channel_page_test.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; import '../../test_util/widget_tester_extension.dart'; void main() { group("チャンネル", () { group("チャンネル検索", () { testWidgets("チャンネル検索ができること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.search(any)).thenAnswer( (_) async => [TestData.channel1.copyWith(bannerUrl: null)]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelsRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("検索")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), "ゲーム開発部"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); expect(find.text(TestData.channel1.name), findsOneWidget); verify(channel.search( argThat(equals(const ChannelsSearchRequest(query: "ゲーム開発部"))))); await tester.pageNation(); verify(channel.search(argThat(equals(ChannelsSearchRequest( query: "ゲーム開発部", untilId: TestData.channel1.id))))); }); }); group("トレンド", () { testWidgets("トレンドが表示されること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.featured()).thenAnswer( (_) async => [TestData.channel1.copyWith(bannerUrl: null)]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelsRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("トレンド")); await tester.pumpAndSettle(); expect(find.text(TestData.channel1.name), findsOneWidget); }); }); group("お気に入り", () { testWidgets("お気に入り中のチャンネルが表示されること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.myFavorite(any)).thenAnswer( (_) async => [TestData.channel1.copyWith(bannerUrl: null)]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelsRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("お気に入り")); await tester.pumpAndSettle(); expect(find.text(TestData.channel1.name), findsOneWidget); verify(channel .myFavorite(argThat(equals(const ChannelsMyFavoriteRequest())))); }); }); group("フォロー中", () { testWidgets("フォロー中のチャンネルが表示されること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.followed(any)).thenAnswer( (_) async => [TestData.channel1.copyWith(bannerUrl: null)]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelsRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("フォロー中")); await tester.pumpAndSettle(); expect(find.text(TestData.channel1.name), findsOneWidget); verify( channel.followed(argThat(equals(const ChannelsFollowedRequest())))); await tester.pageNation(); verify(channel.followed(argThat( equals(ChannelsFollowedRequest(untilId: TestData.channel1.id))))); }); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/explore_page/explore_page_test.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; import '../../test_util/widget_tester_extension.dart'; void main() { group("みつける", () { group("ハイライト", () { testWidgets("ハイライトのノートを表示できること", (tester) async { final notes = MockMisskeyNotes(); final misskey = MockMisskey(); when(misskey.notes).thenReturn(notes); when(notes.featured(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); expect(find.text(TestData.note1.text!), findsOneWidget); verify(notes.featured(argThat(equals(const NotesFeaturedRequest())))); await tester.pageNation(); verify(notes.featured(argThat(equals( NotesFeaturedRequest(untilId: TestData.note1.id, offset: 1))))); }); testWidgets("アンケートのノートを表示できること", (tester) async { final polls = MockMisskeyNotesPolls(); final notes = MockMisskeyNotes(); final misskey = MockMisskey(); when(misskey.notes).thenReturn(notes); when(notes.polls).thenReturn(polls); when(polls.recommendation(any)) .thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("アンケート")); await tester.pumpAndSettle(); expect(find.text(TestData.note1.text!), findsOneWidget); verify(polls.recommendation( argThat(equals(const NotesPollsRecommendationRequest())))); await tester.pageNation(); verify(polls.recommendation( argThat(equals(const NotesPollsRecommendationRequest(offset: 1))))); }); }); group("ユーザー", () { testWidgets("ピン留めされたユーザーを表示できること", (tester) async { final misskey = MockMisskey(); final notes = MockMisskeyNotes(); when(misskey.notes).thenReturn(notes); when(misskey.pinnedUsers()) .thenAnswer((_) async => [TestData.detailedUser1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("ユーザー")); await tester.pumpAndSettle(); expect(find.text(TestData.detailedUser1.name!), findsOneWidget); }); testWidgets("ローカルのユーザーを表示できること", (tester) async { final misskey = MockMisskey(); final notes = MockMisskeyNotes(); final users = MockMisskeyUsers(); when(misskey.notes).thenReturn(notes); when(misskey.users).thenReturn(users); when(users.users(any)) .thenAnswer((_) async => [TestData.detailedUser1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("ユーザー")); await tester.pumpAndSettle(); await tester.tap(find.text("ローカル")); await tester.pumpAndSettle(); expect(find.text(TestData.detailedUser1.name!), findsOneWidget); verify(users.users(argThat(equals(const UsersUsersRequest( state: UsersState.alive, origin: Origin.local, sort: UsersSortType.followerDescendant))))); await tester.pageNation(); verify(users.users(argThat(equals(const UsersUsersRequest( state: UsersState.alive, origin: Origin.local, sort: UsersSortType.followerDescendant, offset: 1, ))))); }); testWidgets("リモートのユーザーを表示できること", (tester) async { final misskey = MockMisskey(); final notes = MockMisskeyNotes(); final users = MockMisskeyUsers(); when(misskey.notes).thenReturn(notes); when(misskey.users).thenReturn(users); when(users.users(any)) .thenAnswer((_) async => [TestData.detailedUser1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("ユーザー")); await tester.pumpAndSettle(); await tester.tap(find.text("リモート")); await tester.pumpAndSettle(); expect(find.text(TestData.detailedUser1.name!), findsOneWidget); verify(users.users(argThat(equals(const UsersUsersRequest( state: UsersState.alive, origin: Origin.remote, sort: UsersSortType.followerDescendant))))); await tester.pageNation(); verify(users.users(argThat(equals(const UsersUsersRequest( state: UsersState.alive, origin: Origin.remote, sort: UsersSortType.followerDescendant, offset: 1, ))))); }); }); group("ロール", () { testWidgets("公開ロールを表示できること", (tester) async { final misskey = MockMisskey(); final roles = MockMisskeyRoles(); when(misskey.roles).thenReturn(roles); when(misskey.notes).thenReturn(MockMisskeyNotes()); when(roles.list()) .thenAnswer((_) async => [TestData.role.copyWith(usersCount: 495)]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("ロール")); await tester.pumpAndSettle(); expect(find.textContaining(TestData.role.name, findRichText: true), findsOneWidget); }); }); group("ハッシュタグ", () { testWidgets("トレンドのハッシュタグを表示できること", (tester) async { final misskey = MockMisskey(); final hashtags = MockMisskeyHashtags(); when(misskey.hashtags).thenReturn(hashtags); when(misskey.notes).thenReturn(MockMisskeyNotes()); when(hashtags.trend()) .thenAnswer((_) async => [TestData.hashtagTrends]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("ハッシュタグ")); await tester.pumpAndSettle(); expect(find.textContaining(TestData.hashtagTrends.tag), findsOneWidget); }); testWidgets("ローカルのハッシュタグを表示できること", (tester) async { final misskey = MockMisskey(); final hashtags = MockMisskeyHashtags(); when(misskey.hashtags).thenReturn(hashtags); when(misskey.notes).thenReturn(MockMisskeyNotes()); when(hashtags.list(any)).thenAnswer((_) async => [TestData.hashtag]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("ハッシュタグ")); await tester.pumpAndSettle(); await tester.tap(find.text("ローカル")); await tester.pumpAndSettle(); expect(find.textContaining(TestData.hashtag.tag), findsOneWidget); verify(hashtags.list(argThat(predicate<HashtagsListRequest>((request) => request.attachedToLocalUserOnly == true && request.sort == HashtagsListSortType.attachedLocalUsersDescendant)))); }); testWidgets("リモートのハッシュタグを表示できること", (tester) async { final misskey = MockMisskey(); final hashtags = MockMisskeyHashtags(); when(misskey.hashtags).thenReturn(hashtags); when(misskey.notes).thenReturn(MockMisskeyNotes()); when(hashtags.list(any)).thenAnswer((_) async => [TestData.hashtag]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ExploreRoute(account: TestData.account), ))); await tester.pumpAndSettle(); await tester.tap(find.text("ハッシュタグ")); await tester.pumpAndSettle(); await tester.tap(find.text("リモート")); await tester.pumpAndSettle(); expect(find.textContaining(TestData.hashtag.tag), findsOneWidget); verify(hashtags.list(argThat(predicate<HashtagsListRequest>((request) => request.attachedToRemoteUserOnly == true && request.sort == HashtagsListSortType.attachedRemoteUsersDescendant)))); }); }); group("よそのサーバー", () {}); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/timeline_page/antenna_timeline_test.dart
import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/tab_type.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 'timeline_page_test_util.dart'; void main() { group("アンテナタイムライン", () { testWidgets("アンテナタイムラインを表示できること", (tester) async { final timelineTester = TimelinePageTest(tabType: TabType.antenna, antennaId: "abcdefg"); when( timelineTester.mockMisskey.antennaStream( antennaId: anyNamed("antennaId"), onNoteReceived: anyNamed("onNoteReceived"), onReacted: anyNamed("onReacted"), onUnreacted: anyNamed("onUnreacted"), onDeleted: anyNamed("onDeleted"), onVoted: anyNamed("onVoted"), onUpdated: anyNamed("onUpdated"), ), ).thenReturn(timelineTester.mockSocketController); final mockMisskeyAntenna = MockMisskeyAntenna(); when(mockMisskeyAntenna.notes(any)) .thenAnswer((_) async => [TestData.note1]); when(timelineTester.mockMisskey.antennas).thenReturn(mockMisskeyAntenna); await tester.pumpWidget(timelineTester.buildWidget()); await tester.pumpAndSettle(const Duration(seconds: 1)); verify(mockMisskeyAntenna.notes(argThat(equals(const AntennasNotesRequest( antennaId: "abcdefg", limit: 30, ))))); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/timeline_page/user_list_timeline_test.dart
import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/tab_type.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/test_datas.dart'; import 'timeline_page_test_util.dart'; void main() { group("リストタイムライン", () { testWidgets("リストタイムラインを表示できること", (tester) async { final timelineTester = TimelinePageTest(tabType: TabType.userList, listId: "abcdefg"); when( timelineTester.mockMisskey.userListStream( listId: anyNamed("listId"), onNoteReceived: anyNamed("onNoteReceived"), onReacted: anyNamed("onReacted"), onUnreacted: anyNamed("onUnreacted"), onDeleted: anyNamed("onDeleted"), onVoted: anyNamed("onVoted"), onUpdated: anyNamed("onUpdated"), ), ).thenReturn(timelineTester.mockSocketController); when(timelineTester.mockMisskeyNotes.userListTimeline(any)) .thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(timelineTester.buildWidget()); await tester.pumpAndSettle(const Duration(seconds: 1)); verify(timelineTester.mockMisskeyNotes .userListTimeline(argThat(equals(const UserListTimelineRequest( listId: "abcdefg", withRenotes: false, withFiles: false, ))))); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/timeline_page/hybrid_timeline_test.dart
import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/tab_type.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/test_datas.dart'; import 'timeline_page_test_util.dart'; void main() { group("ソーシャルタイムライン", () { testWidgets("ソーシャルタイムラインを表示できること", (tester) async { final timelineTester = TimelinePageTest(tabType: TabType.hybridTimeline); when( timelineTester.mockMisskey.hybridTimelineStream( parameter: anyNamed("parameter"), onNoteReceived: anyNamed("onNoteReceived"), onReacted: anyNamed("onReacted"), onUnreacted: anyNamed("onUnreacted"), onDeleted: anyNamed("onDeleted"), onVoted: anyNamed("onVoted"), onUpdated: anyNamed("onUpdated"), ), ).thenReturn(timelineTester.mockSocketController); when(timelineTester.mockMisskeyNotes.hybridTimeline(any)) .thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(timelineTester.buildWidget()); await tester.pumpAndSettle(const Duration(seconds: 1)); verify(timelineTester.mockMisskeyNotes.hybridTimeline(argThat(equals( const NotesHybridTimelineRequest( withFiles: false, withRenotes: false, withReplies: false))))); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/timeline_page/home_timeline_test.dart
import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/tab_type.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/test_datas.dart'; import 'timeline_page_test_util.dart'; void main() { group("ホームタイムライン", () { testWidgets("ホームタイムラインを表示できること", (tester) async { final timelineTester = TimelinePageTest(tabType: TabType.homeTimeline); when( timelineTester.mockMisskey.homeTimelineStream( parameter: anyNamed("parameter"), onNoteReceived: anyNamed("onNoteReceived"), onReacted: anyNamed("onReacted"), onUnreacted: anyNamed("onUnreacted"), onDeleted: anyNamed("onDeleted"), onVoted: anyNamed("onVoted"), onUpdated: anyNamed("onUpdated"), ), ).thenReturn(timelineTester.mockSocketController); when(timelineTester.mockMisskeyNotes.homeTimeline(any)) .thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(timelineTester.buildWidget()); await tester.pumpAndSettle(const Duration(seconds: 1)); verify(timelineTester.mockMisskeyNotes.homeTimeline(argThat(equals( const NotesTimelineRequest( limit: 30, withFiles: false, withRenotes: false))))); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/timeline_page/channel_timeline_test.dart
import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/tab_type.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 'timeline_page_test_util.dart'; void main() { group("チャンネルタイムライン", () { testWidgets("チャンネルタイムラインを表示できること", (tester) async { final timelineTester = TimelinePageTest(tabType: TabType.channel, channelId: "abcdefg"); when( timelineTester.mockMisskey.channelStream( channelId: anyNamed("channelId"), onNoteReceived: anyNamed("onNoteReceived"), onReacted: anyNamed("onReacted"), onUnreacted: anyNamed("onUnreacted"), onDeleted: anyNamed("onDeleted"), onVoted: anyNamed("onVoted"), onUpdated: anyNamed("onUpdated"), ), ).thenReturn(timelineTester.mockSocketController); final mockMisskeyChannel = MockMisskeyChannels(); when(mockMisskeyChannel.timeline(any)) .thenAnswer((_) async => [TestData.note1]); when(timelineTester.mockMisskey.channels).thenReturn(mockMisskeyChannel); await tester.pumpWidget(timelineTester.buildWidget()); await tester.pumpAndSettle(const Duration(seconds: 1)); verify(mockMisskeyChannel .timeline(argThat(equals(const ChannelsTimelineRequest( channelId: "abcdefg", limit: 30, ))))); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/timeline_page/local_timeline_test.dart
import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/tab_type.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/test_datas.dart'; import 'timeline_page_test_util.dart'; void main() { group("ローカルタイムライン", () { testWidgets("ローカルタイムラインを表示できること", (tester) async { final timelineTester = TimelinePageTest(tabType: TabType.localTimeline); when( timelineTester.mockMisskey.localTimelineStream( parameter: anyNamed("parameter"), onNoteReceived: anyNamed("onNoteReceived"), onReacted: anyNamed("onReacted"), onUnreacted: anyNamed("onUnreacted"), onDeleted: anyNamed("onDeleted"), onVoted: anyNamed("onVoted"), onUpdated: anyNamed("onUpdated"), ), ).thenReturn(timelineTester.mockSocketController); when(timelineTester.mockMisskeyNotes.localTimeline(any)) .thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(timelineTester.buildWidget()); await tester.pumpAndSettle(const Duration(seconds: 1)); verify(timelineTester.mockMisskeyNotes.localTimeline(argThat(equals( const NotesLocalTimelineRequest( withFiles: false, withRenotes: false, withReplies: false))))); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/timeline_page/timeline_page_test_util.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.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/repository/account_repository.dart'; import 'package:miria/router/app_router.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; class TimelinePageTest { final mockMisskey = MockMisskey(); final mockMisskeyNotes = MockMisskeyNotes(); final mockMisskeyI = MockMisskeyI(); final mockSocketController = MockSocketController(); final mockStreamingService = MockStreamingService(); final mockAccountRepository = MockAccountRepository(); final mockTabSettingsRepository = MockTabSettingsRepository(); late final TabSetting tabSetting; TimelinePageTest({ required TabType tabType, isSubscribe = false, isIncludeReplies = false, isMediaOnly = false, String? roleId, String? antennaId, String? channelId, String? listId, bool renoteDisplay = false, }) { tabSetting = TabSetting( icon: const TabIcon(customEmojiName: ":ai_yay:"), tabType: tabType, isSubscribe: isSubscribe, isIncludeReplies: isIncludeReplies, isMediaOnly: isMediaOnly, roleId: roleId, antennaId: antennaId, channelId: channelId, listId: listId, name: "ろーかる", acct: TestData.account.acct, renoteDisplay: renoteDisplay, ).copyWith(); when(mockMisskey.notes).thenReturn(mockMisskeyNotes); when(mockMisskey.streamingService).thenReturn(mockStreamingService); when(mockMisskey.i).thenReturn(mockMisskeyI); when(mockMisskey.meta()).thenAnswer((_) async => TestData.meta); when(mockMisskeyI.i()).thenAnswer((_) async => TestData.account.i); when(mockTabSettingsRepository.tabSettings).thenReturn([tabSetting]); } Widget buildWidget({ List<Override> overrides = const [], }) { final mockAccountRepository = AccountRepository(); return ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => mockMisskey), tabSettingsRepositoryProvider .overrideWith((ref) => mockTabSettingsRepository), accountsProvider.overrideWith((ref) => [TestData.account]), accountRepositoryProvider.overrideWith(() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { mockAccountRepository.state = [TestData.account]; }); return mockAccountRepository; }), emojiRepositoryProvider .overrideWith((ref, arg) => MockEmojiRepository()) ], child: DefaultRootWidget( initialRoute: TimeLineRoute(initialTabSetting: tabSetting), ), ); } }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/timeline_page/role_timeline_test.dart
import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/tab_type.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 'timeline_page_test_util.dart'; void main() { group("ロールタイムライン", () { testWidgets("ロールタイムラインを表示できること", (tester) async { final timelineTester = TimelinePageTest(tabType: TabType.roleTimeline, roleId: "abcdefg"); when( timelineTester.mockMisskey.roleTimelineStream( roleId: anyNamed("roleId"), onNoteReceived: anyNamed("onNoteReceived"), onReacted: anyNamed("onReacted"), onUnreacted: anyNamed("onUnreacted"), onDeleted: anyNamed("onDeleted"), onVoted: anyNamed("onVoted"), //onUpdated: anyNamed("onUpdated"), ), ).thenReturn(timelineTester.mockSocketController); final mockMisskeyRoles = MockMisskeyRoles(); when(mockMisskeyRoles.notes(any)) .thenAnswer((_) async => [TestData.note1]); when(timelineTester.mockMisskey.roles).thenReturn(mockMisskeyRoles); await tester.pumpWidget(timelineTester.buildWidget()); await tester.pumpAndSettle(const Duration(seconds: 1)); verify(mockMisskeyRoles.notes(argThat(equals(const RolesNotesRequest( roleId: "abcdefg", limit: 30, ))))); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/federation_page/federation_page_test.dart
import 'package:flutter_test/flutter_test.dart'; void main() { group("サーバー情報", () {}); }
0
mirrored_repositories/miria/test/view/common
mirrored_repositories/miria/test/view/common/misskey_notes/note_modal_sheet_test.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/view/common/misskey_notes/note_modal_sheet.dart'; import 'package:miria/view/dialogs/simple_message_dialog.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../../test_util/default_root_widget.dart'; import '../../../test_util/mock.mocks.dart'; import '../../../test_util/test_datas.dart'; void main() { group("お気に入り", () { testWidgets("該当のノートがお気に入りにされていない場合、お気に入り登録ができること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); final misskeyFavorites = MockMisskeyNotesFavorites(); when(misskeyNotes.favorites).thenAnswer((e) => misskeyFavorites); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note1, targetNote: TestData.note1, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); await tester.tap(find.text("お気に入り")); verify(misskeyFavorites.create(argThat( equals(NotesFavoritesCreateRequest(noteId: TestData.note1.id))))); }); testWidgets("該当のノートがお気に入り済みの場合、お気に入り解除ができること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: true, isMutedThread: false)); final misskeyFavorites = MockMisskeyNotesFavorites(); when(misskeyNotes.favorites).thenAnswer((e) => misskeyFavorites); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note1, targetNote: TestData.note1, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); await tester.tap(find.text("お気に入り解除")); verify(misskeyFavorites.delete(argThat( equals(NotesFavoritesDeleteRequest(noteId: TestData.note1.id))))); }); }); group("削除", () { testWidgets("自分が投稿したノートの削除ができること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note1, targetNote: TestData.note1, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); await tester.ensureVisible(find.text("削除", skipOffstage: false)); await tester.pumpAndSettle(); await tester.tap(find.text("削除")); await tester.pumpAndSettle(); await tester.tap(find.byType(ElevatedButton).hitTestable()); await tester.pumpAndSettle(); verify(misskeyNotes.delete( argThat(equals(NotesDeleteRequest(noteId: TestData.note1.id))))); }); testWidgets("Renoteのみのノートは削除できないこと", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note1 .copyWith(text: null, renote: TestData.note2), targetNote: TestData.note2, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("削除", skipOffstage: false), findsNothing); expect(find.text("削除してなおす", skipOffstage: false), findsNothing); }); testWidgets("他人のノートを削除できないこと", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note3AsAnotherUser .copyWith(text: null, renote: TestData.note1), targetNote: TestData.note1, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("削除", skipOffstage: false), findsNothing); expect(find.text("削除してなおす", skipOffstage: false), findsNothing); }); testWidgets("メディアのみのノートを削除できること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); final testNote = TestData.note1.copyWith( text: null, fileIds: [TestData.drive1.id], files: [TestData.drive1], ); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: testNote, targetNote: testNote, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("削除", skipOffstage: false), findsOneWidget); }); testWidgets("投票のみのノートを削除できること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); final testNote = TestData.note1.copyWith( text: null, poll: NotePoll(choices: const [ NotePollChoice(text: ":ai_yay:", votes: 1, isVoted: false), NotePollChoice(text: ":ai_yay_superfast:", votes: 2, isVoted: false) ], multiple: false, expiresAt: DateTime.now())); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: testNote, targetNote: testNote, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("削除", skipOffstage: false), findsOneWidget); }); testWidgets("自分がした引用Renoteを削除できること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note1 .copyWith(text: "やっほー", renote: TestData.note2), targetNote: TestData.note2, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("削除", skipOffstage: false), findsOneWidget); expect(find.text("削除してなおす", skipOffstage: false), findsOneWidget); }); testWidgets("自分がしたメディアつきテキストなしの引用Renoteを削除できること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); final note = TestData.note1.copyWith( text: null, renote: TestData.note2, fileIds: [TestData.drive1.id], files: [TestData.drive1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: note, targetNote: TestData.note2, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("削除", skipOffstage: false), findsOneWidget); expect(find.text("削除してなおす", skipOffstage: false), findsOneWidget); }); testWidgets("自分がした投票つきテキストなしの引用Renoteを削除できること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); final note = TestData.note1.copyWith( text: null, renote: TestData.note2, poll: NotePoll(choices: const [ NotePollChoice(text: ":ai_yay:", votes: 1, isVoted: false), NotePollChoice(text: ":ai_yay_superfast:", votes: 2, isVoted: false) ], multiple: false, expiresAt: DateTime.now())); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: note, targetNote: TestData.note2, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("削除", skipOffstage: false), findsOneWidget); expect(find.text("削除してなおす", skipOffstage: false), findsOneWidget); }); }); group("リノート解除", () { testWidgets("自分がしたノートをリノート解除できること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note1 .copyWith(text: null, renote: TestData.note2), targetNote: TestData.note2, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); await tester.ensureVisible(find.text("リノートを解除する", skipOffstage: false)); await tester.pumpAndSettle(); await tester.tap(find.text("リノートを解除する")); await tester.pumpAndSettle(); verify(misskeyNotes.delete( argThat(equals(NotesDeleteRequest(noteId: TestData.note1.id))))); }); testWidgets("自分がした引用Renoteをリノート解除できないこと", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note1 .copyWith(text: "やっほー", renote: TestData.note2), targetNote: TestData.note2, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("リノートを解除する", skipOffstage: false), findsOneWidget); }); testWidgets("自分がしたメディアつきテキストなしの引用Renoteをリノート解除できないこと", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); final note = TestData.note1.copyWith( text: null, renote: TestData.note2, fileIds: [TestData.drive1.id], files: [TestData.drive1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: note, targetNote: TestData.note2, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("リノートを解除する", skipOffstage: false), findsNothing); }); testWidgets("自分がした投票つきテキストなしの引用Renoteをリノート解除できないこと", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); final note = TestData.note1.copyWith( text: null, renote: TestData.note2, poll: NotePoll(choices: const [ NotePollChoice(text: ":ai_yay:", votes: 1, isVoted: false), NotePollChoice(text: ":ai_yay_superfast:", votes: 2, isVoted: false) ], multiple: false, expiresAt: DateTime.now())); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: note, targetNote: TestData.note2, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("リノートを解除する", skipOffstage: false), findsNothing); }); testWidgets("他人のリノートをリノート解除できないこと", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); final note = TestData.note3AsAnotherUser .copyWith(text: null, renote: TestData.note1); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: note, targetNote: TestData.note1, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("リノートを解除する", skipOffstage: false), findsNothing); }); }); group("通報", () { testWidgets("他人のノートを通報できること", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); final misskeyUsers = MockMisskeyUsers(); when(misskey.notes).thenReturn(misskeyNotes); when(misskey.users).thenReturn(misskeyUsers); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note3AsAnotherUser, targetNote: TestData.note3AsAnotherUser, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); await tester.ensureVisible(find.text("通報する", skipOffstage: false)); await tester.pumpAndSettle(); await tester.tap(find.text("通報する")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), "このひとわるものです!"); await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); expect(find.byType(SimpleMessageDialog), findsOneWidget); await tester.tap(find.byType(ElevatedButton)); verify(misskeyUsers.reportAbuse(argThat(equals(UsersReportAbuseRequest( userId: TestData.note3AsAnotherUser.userId, comment: "このひとわるものです!"))))); }); testWidgets("自分のノートを通報できないこと", (tester) async { final misskey = MockMisskey(); final misskeyNotes = MockMisskeyNotes(); when(misskeyNotes.state(any)).thenAnswer((_) async => const NotesStateResponse(isFavorited: false, isMutedThread: false)); when(misskey.notes).thenReturn(misskeyNotes); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => misskey)], child: DefaultRootNoRouterWidget( child: Scaffold( body: NoteModalSheet( baseNote: TestData.note1, targetNote: TestData.note1, account: TestData.account, noteBoundaryKey: GlobalKey()), ), ))); await tester.pumpAndSettle(); expect(find.text("通報する", skipOffstage: false), findsNothing); }); }); }
0
mirrored_repositories/miria/test/view/common
mirrored_repositories/miria/test/view/common/misskey_notes/misskey_notes_test.dart
import 'package:flutter/material.dart'; import 'package:flutter_highlighting/flutter_highlighting.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/general_settings.dart'; import 'package:miria/providers.dart'; import 'package:miria/repository/note_repository.dart'; import 'package:miria/view/common/account_scope.dart'; import 'package:miria/view/common/misskey_notes/misskey_note.dart'; import 'package:miria/view/common/misskey_notes/network_image.dart'; import 'package:miria/view/common/misskey_notes/reaction_button.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../../test_util/default_root_widget.dart'; import '../../../test_util/mock.mocks.dart'; import '../../../test_util/test_datas.dart'; import '../../../test_util/widget_tester_extension.dart'; import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; Widget buildTestWidget({ List<Override> overrides = const [], required Note note, }) { final notesRepository = NoteRepository(MockMisskey(), TestData.account); notesRepository.registerNote(note); final mockCacheManager = MockBaseCacheManager(); return ProviderScope( overrides: [ ...overrides, cacheManagerProvider.overrideWith((ref) => mockCacheManager), notesProvider.overrideWith((ref, arg) => notesRepository) ], child: DefaultRootNoRouterWidget( child: Scaffold( body: AccountScope( account: TestData.account, child: SingleChildScrollView(child: MisskeyNote(note: note)), ), ), ), ); } void main() { group("ノート表示", () { group("ノート表示", () { testWidgets("ノートのテキストが表示されること", (tester) async { await tester.pumpWidget(buildTestWidget(note: TestData.note1)); await tester.pumpAndSettle(); expect(find.textContaining(TestData.note1.text!, findRichText: true), findsOneWidget); }); testWidgets("Renoteの場合、Renoteの表示が行われること", (tester) async { await tester.pumpWidget(buildTestWidget(note: TestData.note6AsRenote)); await tester.pumpAndSettle(); expect( find.textContaining(TestData.note6AsRenote.renote!.text!, findRichText: true), findsOneWidget); expect( find.textContaining("がリノート", findRichText: true), findsOneWidget); }); testWidgets("引用Renoteの場合、引用Renoteの表示が行われること", (tester) async { await tester.pumpWidget(buildTestWidget( note: TestData.note6AsRenote.copyWith(text: "こころがふたつある〜"))); await tester.pumpAndSettle(); expect( find.textContaining(TestData.note6AsRenote.renote!.text!, findRichText: true), findsOneWidget); expect(find.textContaining("こころがふたつある〜", findRichText: true), findsOneWidget); expect( find.textContaining("がRenote", findRichText: true), findsNothing); }); }); group("MFM", () { testWidgets("コードブロックがあった場合、コードブロックで表示されること", (tester) async { await tester .pumpWidget(buildTestWidget(note: TestData.note1.copyWith(text: r''' ```js window.ai = "@ai uneune"; ``` ```c++ printf("@ai uneune"); ``` ```java System.out.println("@ai uneune"); ``` '''))); await tester.pumpAndSettle(); expect(find.byType(HighlightView), findsNWidgets(3)); }); testWidgets("検索構文の検索を謳歌すると、検索が行われること", (tester) async { final mockUrlLauncher = MockUrlLauncherPlatform(); UrlLauncherPlatform.instance = mockUrlLauncher; await tester.pumpWidget(buildTestWidget( note: TestData.note1.copyWith(text: "藍ちゃんやっほー 検索"))); await tester.pumpAndSettle(); expect(tester.textEditingController(find.byType(TextField)).text, "藍ちゃんやっほー"); await tester.tap(find.text("検索")); await tester.pumpAndSettle(); verify(mockUrlLauncher.launchUrl( argThat(equals( "https://google.com/search?q=%E8%97%8D%E3%81%A1%E3%82%83%E3%82%93%E3%82%84%E3%81%A3%E3%81%BB%E3%83%BC")), any)) .called(1); }); }); group("注釈", () { testWidgets("注釈が設定されている場合、注釈が表示されること", (tester) async { await tester.pumpWidget( buildTestWidget(note: TestData.note1.copyWith(cw: "えっちなやつ"))); await tester.pumpAndSettle(); expect( find.textContaining("えっちなやつ", findRichText: true), findsOneWidget); expect(find.textContaining(TestData.note1.text!, findRichText: true), findsNothing); }); testWidgets("続きを見るをタップすると、本文が表示されること", (tester) async { await tester.pumpWidget( buildTestWidget(note: TestData.note1.copyWith(cw: "えっちなやつ"))); await tester.pumpAndSettle(); await tester.tap(find.text("隠してあるのんの続きを見して")); await tester.pumpAndSettle(); expect( find.textContaining("えっちなやつ", findRichText: true), findsOneWidget); expect(find.textContaining(TestData.note1.text!, findRichText: true), findsOneWidget); await tester.tap(find.text("隠す")); await tester.pumpAndSettle(); expect( find.textContaining("えっちなやつ", findRichText: true), findsOneWidget); expect(find.textContaining(TestData.note1.text!, findRichText: true), findsNothing); }); }); group("長いノートの折りたたみ", () { testWidgets("長いノートの省略が有効な場合、500文字を超えるノートが折りたたまれること", (tester) async { final generalSettingsRepository = MockGeneralSettingsRepository(); when(generalSettingsRepository.settings) .thenReturn(const GeneralSettings(enableLongTextElipsed: true)); await tester.pumpWidget(buildTestWidget( overrides: [ generalSettingsRepositoryProvider .overrideWith((ref) => generalSettingsRepository) ], note: TestData.note1.copyWith( text: Iterable.generate(500, (index) => "あ").join("")))); await tester.pumpAndSettle(); expect(find.text("続きを表示"), findsOneWidget); }); testWidgets("長いノートの省略が有効な場合、続きを表示をタップすると全てが表示されること", (tester) async { final longText = Iterable.generate(2000, (index) => "あ").join(""); final generalSettingsRepository = MockGeneralSettingsRepository(); when(generalSettingsRepository.settings) .thenReturn(const GeneralSettings(enableLongTextElipsed: true)); await tester.pumpWidget(buildTestWidget( overrides: [ generalSettingsRepositoryProvider .overrideWith((ref) => generalSettingsRepository) ], note: TestData.note1.copyWith(text: longText), )); await tester.pumpAndSettle(); expect(find.textContaining(longText, findRichText: true), findsNothing); await tester.tap(find.text("続きを表示")); await tester.pumpAndSettle(); expect( find.textContaining(longText, findRichText: true), findsOneWidget); }); }); group("投票", () { testWidgets("投票が表示されること", (tester) async { await tester.pumpWidget(buildTestWidget(note: TestData.note4AsVote)); await tester.pumpAndSettle(); for (final choice in TestData.note4AsVote.poll!.choices) { expect(find.textContaining(choice.text, findRichText: true), findsOneWidget); expect(find.textContaining("${choice.votes}票", findRichText: true), findsOneWidget); } }); }); group("メディア", () { testWidgets("閲覧注意に設定されていない場合、画像が表示されること", (tester) async { await tester.runAsync(() async { await tester.pumpWidget(buildTestWidget( note: TestData.note1.copyWith( fileIds: [TestData.drive1.id], files: [TestData.drive1.copyWith(isSensitive: false)]))); await tester.pumpAndSettle(); await Future.delayed(const Duration(seconds: 1)); await tester.pumpAndSettle(); expect( find.byWidgetPredicate((e) => e is NetworkImageView && e.type == ImageType.imageThumbnail), findsOneWidget); }); }); testWidgets("閲覧注意に設定している場合、画像が表示されないこと 閲覧注意をタップすると画像が表示されること", (tester) async { await tester.runAsync(() async { await tester.pumpWidget(buildTestWidget( note: TestData.note1.copyWith( fileIds: [TestData.drive1.id], files: [TestData.drive1.copyWith(isSensitive: true)]))); await tester.pumpAndSettle(); expect(find.text("センシティブ"), findsOneWidget); expect( find.byWidgetPredicate((e) => e is NetworkImageView && e.type == ImageType.imageThumbnail), findsNothing); await tester.tap(find.text("センシティブ")); await tester.pumpAndSettle(); await Future.delayed(const Duration(seconds: 1)); await tester.pumpAndSettle(); expect( find.byWidgetPredicate((e) => e is NetworkImageView && e.type == ImageType.imageThumbnail), findsOneWidget); }); }); }); }); group("リアクションしたユーザー一覧", () { testWidgets("リアクションを長押しすると、リアクションしたユーザーの一覧が表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockMisskeyNotes = MockMisskeyNotes(); final mockMisskeyNotesReactions = MockMisskeyNotesReactions(); when(mockMisskey.notes).thenReturn(mockMisskeyNotes); when(mockMisskeyNotes.reactions).thenReturn(mockMisskeyNotesReactions); when(mockMisskeyNotesReactions.reactions(any)).thenAnswer((_) async => [ NotesReactionsResponse( id: "reaction1", createdAt: DateTime.now(), user: UserLite.fromJson(TestData.detailedUser2.toJson()), type: ":ai_yay:") ]); await tester.pumpWidget(buildTestWidget( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], note: TestData.note1)); await tester.pumpAndSettle(); await tester.longPress(find.byType(ReactionButton).at(1)); await tester.pumpAndSettle(); expect(find.text(TestData.detailedUser2.name!, findRichText: true), findsOneWidget); await tester.pageNation(); expect(find.text(TestData.detailedUser2.name!, findRichText: true), findsNWidgets(2)); }); }); group("Renoteしたユーザー一覧", () { testWidgets("Renoteを長押しすると、Renoteしたユーザーの一覧が表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockMisskeyNotes = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockMisskeyNotes); when(mockMisskeyNotes.renotes(any)) .thenAnswer((_) async => [TestData.note6AsRenote]); await tester.pumpWidget(buildTestWidget( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], note: TestData.note1)); await tester.pumpAndSettle(); await tester.longPress(find.byType(RenoteButton)); await tester.pumpAndSettle(); expect( find.textContaining(TestData.note6AsRenote.user.username, findRichText: true), findsOneWidget); await tester.pageNation(); expect( find.textContaining(TestData.note6AsRenote.user.username, findRichText: true), findsNWidgets(2)); }); }); }
0
mirrored_repositories/miria/test/view/common
mirrored_repositories/miria/test/view/common/note_create/mfm_fn_keyboard_test.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/input_completion_type.dart'; import 'package:miria/view/common/note_create/input_completation.dart'; import 'package:miria/view/common/note_create/mfm_fn_keyboard.dart'; void main() { test("入力が空文字列のとき全ての関数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider.overrideWith((ref) => const MfmFn("")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, orderedEquals(mfmFn.keys)); final args = container.read(filteredMfmFnArgsProvider); expect(args, isEmpty); }); test("入力された文字列で始まる関数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider.overrideWith((ref) => const MfmFn("s")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, orderedEquals(["shake", "spin", "scale", "sparkle"])); final args = container.read(filteredMfmFnArgsProvider); expect(args, isEmpty); }); test("関数名が入力されたとき全ての引数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider.overrideWith((ref) => const MfmFn("spin")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, orderedEquals(["spin"])); final args = container.read(filteredMfmFnArgsProvider); expect( args, orderedEquals(const [ MfmFnArg(name: "speed", defaultValue: "1.5s"), MfmFnArg(name: "delay", defaultValue: "0s"), MfmFnArg(name: "x"), MfmFnArg(name: "y"), MfmFnArg(name: "left"), MfmFnArg(name: "alternate"), ]), ); }); test("関数名とピリオドが入力されたとき全ての引数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider.overrideWith((ref) => const MfmFn("spin.")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, isEmpty); final args = container.read(filteredMfmFnArgsProvider); expect( args, orderedEquals(const [ MfmFnArg(name: "speed", defaultValue: "1.5s"), MfmFnArg(name: "delay", defaultValue: "0s"), MfmFnArg(name: "x"), MfmFnArg(name: "y"), MfmFnArg(name: "left"), MfmFnArg(name: "alternate"), ]), ); }); test("関数名と引数名の一部が入力されたとき入力された文字列で始まる引数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider .overrideWith((ref) => const MfmFn("spin.s")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, isEmpty); final args = container.read(filteredMfmFnArgsProvider); expect( args, orderedEquals(const [ MfmFnArg(name: "speed", defaultValue: "1.5s"), ]), ); }); test("関数名と引数名が入力されたとき入力されていない引数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider .overrideWith((ref) => const MfmFn("spin.x")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, isEmpty); final args = container.read(filteredMfmFnArgsProvider); expect( args, orderedEquals(const [ MfmFnArg(name: "speed", defaultValue: "1.5s"), MfmFnArg(name: "delay", defaultValue: "0s"), MfmFnArg(name: "y"), MfmFnArg(name: "left"), MfmFnArg(name: "alternate"), ]), ); }); test("関数名と引数名とコンマが入力されたとき入力されていない引数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider .overrideWith((ref) => const MfmFn("spin.x,")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, isEmpty); final args = container.read(filteredMfmFnArgsProvider); expect( args, orderedEquals(const [ MfmFnArg(name: "speed", defaultValue: "1.5s"), MfmFnArg(name: "delay", defaultValue: "0s"), MfmFnArg(name: "y"), MfmFnArg(name: "left"), MfmFnArg(name: "alternate"), ]), ); }); test("関数名と引数名と値が入力されたとき入力されていない引数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider .overrideWith((ref) => const MfmFn("spin.speed=1.5s")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, isEmpty); final args = container.read(filteredMfmFnArgsProvider); expect( args, orderedEquals(const [ MfmFnArg(name: "delay", defaultValue: "0s"), MfmFnArg(name: "x"), MfmFnArg(name: "y"), MfmFnArg(name: "left"), MfmFnArg(name: "alternate"), ]), ); }); test("関数名と引数名と値とコンマが入力されたとき入力されていない引数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider .overrideWith((ref) => const MfmFn("spin.speed=1.5s,")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, isEmpty); final args = container.read(filteredMfmFnArgsProvider); expect( args, orderedEquals(const [ MfmFnArg(name: "delay", defaultValue: "0s"), MfmFnArg(name: "x"), MfmFnArg(name: "y"), MfmFnArg(name: "left"), MfmFnArg(name: "alternate"), ]), ); }); test("引数名が正しくない場合空のリストを返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider .overrideWith((ref) => const MfmFn("spin.xy")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, isEmpty); final args = container.read(filteredMfmFnArgsProvider); expect(args, isEmpty); }); test("2つ目の引数名の一部が入力されたとき入力された文字列で始まる引数を返す", () { final container = ProviderContainer( overrides: [ inputCompletionTypeProvider .overrideWith((ref) => const MfmFn("spin.x,s")), ], ); addTearDown(container.dispose); final names = container.read(filteredMfmFnNamesProvider); expect(names, isEmpty); final args = container.read(filteredMfmFnArgsProvider); expect( args, orderedEquals(const [ MfmFnArg(name: "speed", defaultValue: "1.5s"), ]), ); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/search_page/search_page_test.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/model/note_search_condition.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; void main() { group("ノート検索", () { testWidgets( "確定でノートの検索ができること、" "検索結果のノートが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); when(mockNote.search(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: SearchRoute(account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), "Misskey"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); verify(mockNote.search( argThat(equals(const NotesSearchRequest(query: "Misskey"))))) .called(1); expect(find.text(TestData.note1.text!), findsOneWidget); when(mockNote.search(any)).thenAnswer((_) async => [TestData.note2]); await tester.tap(find.byIcon(Icons.keyboard_arrow_down).at(1)); await tester.pumpAndSettle(); verify(mockNote.search(argThat(equals(NotesSearchRequest( query: "Misskey", untilId: TestData.note1.id))))) .called(1); expect(find.text(TestData.note2.text!), findsOneWidget); }); testWidgets("ユーザー指定ができること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); final mockUsers = MockMisskeyUsers(); when(mockMisskey.notes).thenReturn(mockNote); when(mockMisskey.users).thenReturn(mockUsers); when(mockNote.search(any)).thenAnswer((_) async => [TestData.note1]); when(mockUsers.search(any)).thenAnswer((_) async => [TestData.user1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: SearchRoute(account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.keyboard_arrow_down)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.keyboard_arrow_right).at(0)); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField).hitTestable(), "常駐AI"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); await tester.tap(find.text("藍")); await tester.pumpAndSettle(); // 指定したユーザーが表示されていること expect(find.descendant(of: find.byType(Card), matching: find.text("@ai")), findsOneWidget); // ノートが表示されていること expect(find.text(TestData.note1.text!), findsOneWidget); verify(mockNote.search(argThat(equals( NotesSearchRequest(query: "", userId: TestData.user1ExpectId))))) .called(1); }); testWidgets("チャンネル指定ができること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); final mockChannel = MockMisskeyChannels(); when(mockMisskey.notes).thenReturn(mockNote); when(mockMisskey.channels).thenReturn(mockChannel); when(mockNote.search(any)).thenAnswer((_) async => [TestData.note1]); when(mockChannel.followed(any)) .thenAnswer((_) async => [TestData.channel1]); when(mockChannel.myFavorite(any)) .thenAnswer((_) async => [TestData.channel2]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: SearchRoute(account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.keyboard_arrow_down)); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.keyboard_arrow_right).at(1)); await tester.pumpAndSettle(); await tester.tap(find.text(TestData.channel2.name)); await tester.pumpAndSettle(); // 指定したチャンネルが表示されていること expect( find.descendant( of: find.byType(Card), matching: find.text(TestData.channel2.name), ), findsOneWidget); // ノートが表示されていること expect(find.text(TestData.note1.text!), findsOneWidget); verify(mockNote.search(argThat(equals( NotesSearchRequest(query: "", channelId: TestData.channel2.id))))) .called(1); }); testWidgets("ハッシュタグを検索した場合、ハッシュタグのエンドポイントで検索されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); when(mockNote.searchByTag(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: SearchRoute(account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), "#藍ちゃん大食いチャレンジ"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); verify(mockNote.searchByTag(argThat( equals(const NotesSearchByTagRequest(tag: "藍ちゃん大食いチャレンジ"))))) .called(1); expect(find.text(TestData.note1.text!), findsOneWidget); when(mockNote.searchByTag(any)).thenAnswer((_) async => [TestData.note2]); await tester.tap(find.byIcon(Icons.keyboard_arrow_down).at(1)); await tester.pumpAndSettle(); verify(mockNote.searchByTag(argThat(equals(NotesSearchByTagRequest( tag: "藍ちゃん大食いチャレンジ", untilId: TestData.note1.id))))) .called(1); expect(find.text(TestData.note2.text!), findsOneWidget); }); }); group("ユーザー検索", () { testWidgets( "確定でユーザー検索ができること、" "検索結果のユーザーが表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.search(any)).thenAnswer((_) async => [TestData.user1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: SearchRoute(account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap(find.text("ユーザー")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), "常駐AI"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); verify(mockUser.search(argThat(equals(const UsersSearchRequest( query: "常駐AI", origin: Origin.combined))))) .called(1); expect(find.text("藍"), findsOneWidget); }); testWidgets("ローカルの場合、ローカルで検索されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.search(any)).thenAnswer((_) async => [TestData.user1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: SearchRoute(account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap(find.text("ユーザー")); await tester.pumpAndSettle(); await tester.tap(find.text("ローカル")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), "常駐AI"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); verify(mockUser.search(argThat(equals( const UsersSearchRequest(query: "常駐AI", origin: Origin.local))))) .called(1); }); testWidgets("リモートの場合、リモートで検索されること", (tester) async { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); when(mockUser.search(any)).thenAnswer((_) async => [TestData.user1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: SearchRoute(account: TestData.account), ), )); await tester.pumpAndSettle(); await tester.tap(find.text("ユーザー")); await tester.pumpAndSettle(); await tester.tap(find.text("リモート")); await tester.pumpAndSettle(); await tester.enterText(find.byType(TextField), "常駐AI"); await tester.testTextInput.receiveAction(TextInputAction.done); await tester.pumpAndSettle(); verify(mockUser.search(argThat(equals( const UsersSearchRequest(query: "常駐AI", origin: Origin.remote))))) .called(1); }); }); group("その他", () { testWidgets("ノートとチャンネルの表示が折り畳めること", (tester) async { await tester.pumpWidget(ProviderScope( child: DefaultRootWidget( initialRoute: SearchRoute(account: TestData.account), ), )); await tester.pumpAndSettle(); expect( find.descendant( of: find.byType(Card), matching: find.text("ユーザー").hitTestable()), findsNothing); expect(find.text("チャンネル").hitTestable(), findsNothing); await tester.tap(find.byIcon(Icons.keyboard_arrow_down)); await tester.pumpAndSettle(); expect( find.descendant( of: find.byType(Card), matching: find.text("ユーザー").hitTestable()), findsOneWidget); expect(find.text("チャンネル").hitTestable(), findsOneWidget); await tester.tap(find.byIcon(Icons.keyboard_arrow_up)); await tester.pumpAndSettle(); expect( find.descendant( of: find.byType(Card), matching: find.text("ユーザー").hitTestable()), findsNothing); expect(find.text("チャンネル").hitTestable(), findsNothing); }); testWidgets("引数で初期値が与えられたとき、その内容の検索結果が初期表示されること", (tester) async { final mockMisskey = MockMisskey(); final mockNote = MockMisskeyNotes(); when(mockMisskey.notes).thenReturn(mockNote); when(mockNote.search(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((ref, arg) => mockMisskey)], child: DefaultRootWidget( initialRoute: SearchRoute( account: TestData.account, initialNoteSearchCondition: const NoteSearchCondition(query: "Misskey"), ), ), )); await tester.pumpAndSettle(); expect(find.text(TestData.note1.text!), findsOneWidget); verify(mockNote.search( argThat(equals(const NotesSearchRequest(query: "Misskey"))))) .called(1); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/antenna_notes_page/antenna_notes_page_test.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; import '../../test_util/widget_tester_extension.dart'; void main() { group("アンテナノート一覧", () { testWidgets("アンテナのノート一覧が表示されること", (tester) async { final antennas = MockMisskeyAntenna(); final misskey = MockMisskey(); when(misskey.antennas).thenReturn(antennas); when(antennas.notes(any)).thenAnswer((_) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: AntennaNotesRoute( account: TestData.account, antenna: TestData.antenna), ))); await tester.pumpAndSettle(); expect(find.text(TestData.note1.text!), findsOneWidget); verify(antennas.notes(argThat( equals(AntennasNotesRequest(antennaId: TestData.antenna.id))))); await tester.pageNation(); verify(antennas.notes(argThat(equals(AntennasNotesRequest( antennaId: TestData.antenna.id, untilId: TestData.note1.id))))); }); }); }
0
mirrored_repositories/miria/test/view
mirrored_repositories/miria/test/view/channel_detail_page/channel_detail_page_test.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/mockito.dart'; import '../../test_util/default_root_widget.dart'; import '../../test_util/mock.mocks.dart'; import '../../test_util/test_datas.dart'; import '../../test_util/widget_tester_extension.dart'; void main() { group("チャンネル詳細", () { testWidgets("チャンネルの詳細情報が表示されること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.show(any)) .thenAnswer((_) async => TestData.channel1.copyWith(bannerUrl: null)); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelDetailRoute( account: TestData.account, channelId: TestData.channel1.id), ))); await tester.pumpAndSettle(); expect( find.textContaining(TestData.expectChannel1DescriptionContaining, findRichText: true), findsOneWidget); }); testWidgets("チャンネルがセンシティブの場合、センシティブである旨が表示されること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.show(any)).thenAnswer((_) async => TestData.channel1.copyWith(bannerUrl: null, isSensitive: true)); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelDetailRoute( account: TestData.account, channelId: TestData.channel1.id), ))); await tester.pumpAndSettle(); expect(find.textContaining("センシティブ"), findsOneWidget); }); testWidgets("チャンネルをお気に入りに設定していない場合、お気に入りにすることができること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.show(any)).thenAnswer((_) async => TestData.channel1.copyWith(bannerUrl: null, isFavorited: false)); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelDetailRoute( account: TestData.account, channelId: TestData.channel1.id), ))); await tester.pumpAndSettle(); await tester.tap(find.text("お気に入りに入れるで")); await tester.pumpAndSettle(); expect(find.text("お気に入り"), findsOneWidget); verify(channel.favorite(argThat( equals(ChannelsFavoriteRequest(channelId: TestData.channel1.id))))); }); testWidgets("チャンネルをお気に入りに設定している場合、お気に入りを解除できること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.show(any)).thenAnswer((_) async => TestData.channel1.copyWith(bannerUrl: null, isFavorited: true)); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelDetailRoute( account: TestData.account, channelId: TestData.channel1.id), ))); await tester.pumpAndSettle(); await tester.tap(find.text("お気に入り")); await tester.pumpAndSettle(); expect(find.text("お気に入りに入れるで"), findsOneWidget); verify(channel.unfavorite(argThat( equals(ChannelsUnfavoriteRequest(channelId: TestData.channel1.id))))); }); testWidgets("チャンネルをフォローしていない場合、フォローすることができること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.show(any)).thenAnswer((_) async => TestData.channel1.copyWith(bannerUrl: null, isFollowing: false)); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelDetailRoute( account: TestData.account, channelId: TestData.channel1.id), ))); await tester.pumpAndSettle(); await tester.tap(find.text("フォローするで")); await tester.pumpAndSettle(); expect(find.text("フォロー中"), findsOneWidget); verify(channel.follow(argThat( equals(ChannelsFollowRequest(channelId: TestData.channel1.id))))); }); testWidgets("チャンネルをフォローしている場合、フォロー解除をすることができること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.show(any)).thenAnswer((_) async => TestData.channel1.copyWith(bannerUrl: null, isFollowing: true)); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelDetailRoute( account: TestData.account, channelId: TestData.channel1.id), ))); await tester.pumpAndSettle(); await tester.tap(find.text("フォロー中")); await tester.pumpAndSettle(); expect(find.text("フォローするで"), findsOneWidget); verify(channel.unfollow(argThat( equals(ChannelsUnfollowRequest(channelId: TestData.channel1.id))))); }); }); group("チャンネル内ノート", () { testWidgets("チャンネル内のノートが表示されること", (tester) async { final channel = MockMisskeyChannels(); final misskey = MockMisskey(); when(misskey.channels).thenReturn(channel); when(channel.show(any)).thenAnswer((_) async => TestData.channel1.copyWith(bannerUrl: null, isFollowing: false)); when(channel.timeline(any)) .thenAnswer((realInvocation) async => [TestData.note1]); await tester.pumpWidget(ProviderScope( overrides: [misskeyProvider.overrideWith((_, __) => misskey)], child: DefaultRootWidget( initialRoute: ChannelDetailRoute( account: TestData.account, channelId: TestData.channel1.id), ))); await tester.pumpAndSettle(); await tester.tap(find.text("タイムライン")); await tester.pumpAndSettle(); expect(find.text(TestData.note1.text!), findsOneWidget); verify(channel.timeline(argThat(predicate<ChannelsTimelineRequest>( (e) => e.channelId == TestData.channel1.id)))); await tester.pageNation(); verify(channel.timeline(argThat(predicate<ChannelsTimelineRequest>((e) => e.channelId == TestData.channel1.id && e.untilId == TestData.note1.id)))); }); }); }
0
mirrored_repositories/miria/test
mirrored_repositories/miria/test/test_util/widget_tester_extension.dart
import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; extension WidgetTestExtension on WidgetTester { TextEditingController textEditingController(Finder finder) { final widget = finder.evaluate().first.widget; if (widget is TextField) { return widget.controller!; } else { throw Exception("$finder has not text editing controller."); } } Future<void> pageNation() async { await tap(find.descendant( of: find.descendant( of: find.byType(Center), matching: find.byType(IconButton).hitTestable()), matching: find.byIcon(Icons.keyboard_arrow_down))); await pumpAndSettle(); } }
0
mirrored_repositories/miria/test
mirrored_repositories/miria/test/test_util/mock.mocks.dart
// Mocks generated by Mockito 5.4.4 from annotations // in miria/test/test_util/mock.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i18; import 'dart:collection' as _i31; import 'dart:io' as _i12; import 'dart:typed_data' as _i28; import 'dart:ui' as _i19; import 'package:dio/dio.dart' as _i11; import 'package:file/file.dart' as _i14; import 'package:file_picker/file_picker.dart' as _i36; import 'package:flutter_cache_manager/flutter_cache_manager.dart' as _i15; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i4; import 'package:miria/model/account.dart' as _i6; import 'package:miria/model/account_settings.dart' as _i2; import 'package:miria/model/acct.dart' as _i21; import 'package:miria/model/general_settings.dart' as _i3; import 'package:miria/model/misskey_emoji_data.dart' as _i23; import 'package:miria/model/tab_setting.dart' as _i17; import 'package:miria/repository/account_repository.dart' as _i25; import 'package:miria/repository/account_settings_repository.dart' as _i20; import 'package:miria/repository/emoji_repository.dart' as _i22; import 'package:miria/repository/general_settings_repository.dart' as _i24; import 'package:miria/repository/note_repository.dart' as _i26; import 'package:miria/repository/tab_settings_repository.dart' as _i16; import 'package:misskey_dart/misskey_dart.dart' as _i5; import 'package:misskey_dart/src/data/ping_response.dart' as _i10; import 'package:misskey_dart/src/data/stats_response.dart' as _i9; import 'package:misskey_dart/src/data/streaming/streaming_request.dart' as _i30; import 'package:misskey_dart/src/enums/broadcast_event_type.dart' as _i34; import 'package:misskey_dart/src/enums/channel.dart' as _i29; import 'package:misskey_dart/src/enums/channel_event_type.dart' as _i32; import 'package:misskey_dart/src/enums/note_updated_event_type.dart' as _i33; import 'package:misskey_dart/src/misskey_flash.dart' as _i8; import 'package:misskey_dart/src/services/api_service.dart' as _i7; import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/src/dummies.dart' as _i27; import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart' as _i37; import 'package:web_socket_channel/web_socket_channel.dart' as _i13; import 'mock.dart' as _i35; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references // ignore_for_file: deprecated_member_use // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class class _FakeAccountSettings_0 extends _i1.SmartFake implements _i2.AccountSettings { _FakeAccountSettings_0( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeGeneralSettings_1 extends _i1.SmartFake implements _i3.GeneralSettings { _FakeGeneralSettings_1( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeNotifierProviderRef_2<T> extends _i1.SmartFake implements _i4.NotifierProviderRef<T> { _FakeNotifierProviderRef_2( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskey_3 extends _i1.SmartFake implements _i5.Misskey { _FakeMisskey_3( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeAccount_4 extends _i1.SmartFake implements _i6.Account { _FakeAccount_4( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeApiService_5 extends _i1.SmartFake implements _i7.ApiService { _FakeApiService_5( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeStreamingService_6 extends _i1.SmartFake implements _i5.StreamingService { _FakeStreamingService_6( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyNotes_7 extends _i1.SmartFake implements _i5.MisskeyNotes { _FakeMisskeyNotes_7( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyChannels_8 extends _i1.SmartFake implements _i5.MisskeyChannels { _FakeMisskeyChannels_8( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyUsers_9 extends _i1.SmartFake implements _i5.MisskeyUsers { _FakeMisskeyUsers_9( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyI_10 extends _i1.SmartFake implements _i5.MisskeyI { _FakeMisskeyI_10( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyClips_11 extends _i1.SmartFake implements _i5.MisskeyClips { _FakeMisskeyClips_11( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyAntenna_12 extends _i1.SmartFake implements _i5.MisskeyAntenna { _FakeMisskeyAntenna_12( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyDrive_13 extends _i1.SmartFake implements _i5.MisskeyDrive { _FakeMisskeyDrive_13( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyFollowing_14 extends _i1.SmartFake implements _i5.MisskeyFollowing { _FakeMisskeyFollowing_14( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyBlocking_15 extends _i1.SmartFake implements _i5.MisskeyBlocking { _FakeMisskeyBlocking_15( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyMute_16 extends _i1.SmartFake implements _i5.MisskeyMute { _FakeMisskeyMute_16( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyRenoteMute_17 extends _i1.SmartFake implements _i5.MisskeyRenoteMute { _FakeMisskeyRenoteMute_17( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyFederation_18 extends _i1.SmartFake implements _i5.MisskeyFederation { _FakeMisskeyFederation_18( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyRoles_19 extends _i1.SmartFake implements _i5.MisskeyRoles { _FakeMisskeyRoles_19( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyHashtags_20 extends _i1.SmartFake implements _i5.MisskeyHashtags { _FakeMisskeyHashtags_20( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyAp_21 extends _i1.SmartFake implements _i5.MisskeyAp { _FakeMisskeyAp_21( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyPages_22 extends _i1.SmartFake implements _i5.MisskeyPages { _FakeMisskeyPages_22( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyFlash_23 extends _i1.SmartFake implements _i8.MisskeyFlash { _FakeMisskeyFlash_23( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyReversi_24 extends _i1.SmartFake implements _i5.MisskeyReversi { _FakeMisskeyReversi_24( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyBubbleGame_25 extends _i1.SmartFake implements _i5.MisskeyBubbleGame { _FakeMisskeyBubbleGame_25( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeEmojisResponse_26 extends _i1.SmartFake implements _i5.EmojisResponse { _FakeEmojisResponse_26( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeEmojiResponse_27 extends _i1.SmartFake implements _i5.EmojiResponse { _FakeEmojiResponse_27( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMetaResponse_28 extends _i1.SmartFake implements _i5.MetaResponse { _FakeMetaResponse_28( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeStatsResponse_29 extends _i1.SmartFake implements _i9.StatsResponse { _FakeStatsResponse_29( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakePingResponse_30 extends _i1.SmartFake implements _i10.PingResponse { _FakePingResponse_30( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeServerInfoResponse_31 extends _i1.SmartFake implements _i5.ServerInfoResponse { _FakeServerInfoResponse_31( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeGetOnlineUsersCountResponse_32 extends _i1.SmartFake implements _i5.GetOnlineUsersCountResponse { _FakeGetOnlineUsersCountResponse_32( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeSocketController_33 extends _i1.SmartFake implements _i5.SocketController { _FakeSocketController_33( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeAntenna_34 extends _i1.SmartFake implements _i5.Antenna { _FakeAntenna_34( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeApShowResponse_35 extends _i1.SmartFake implements _i5.ApShowResponse { _FakeApShowResponse_35( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeCommunityChannel_36 extends _i1.SmartFake implements _i5.CommunityChannel { _FakeCommunityChannel_36( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeClip_37 extends _i1.SmartFake implements _i5.Clip { _FakeClip_37( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyDriveFiles_38 extends _i1.SmartFake implements _i5.MisskeyDriveFiles { _FakeMisskeyDriveFiles_38( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyDriveFolders_39 extends _i1.SmartFake implements _i5.MisskeyDriveFolders { _FakeMisskeyDriveFolders_39( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeDriveFolder_40 extends _i1.SmartFake implements _i5.DriveFolder { _FakeDriveFolder_40( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeDriveFile_41 extends _i1.SmartFake implements _i5.DriveFile { _FakeDriveFile_41( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeFederationShowInstanceResponse_42 extends _i1.SmartFake implements _i5.FederationShowInstanceResponse { _FakeFederationShowInstanceResponse_42( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyFollowingRequests_43 extends _i1.SmartFake implements _i5.MisskeyFollowingRequests { _FakeMisskeyFollowingRequests_43( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeUserLite_44 extends _i1.SmartFake implements _i5.UserLite { _FakeUserLite_44( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeHashtag_45 extends _i1.SmartFake implements _i5.Hashtag { _FakeHashtag_45( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyIRegistry_46 extends _i1.SmartFake implements _i5.MisskeyIRegistry { _FakeMisskeyIRegistry_46( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMeDetailed_47 extends _i1.SmartFake implements _i5.MeDetailed { _FakeMeDetailed_47( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyNotesReactions_48 extends _i1.SmartFake implements _i5.MisskeyNotesReactions { _FakeMisskeyNotesReactions_48( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyNotesFavorites_49 extends _i1.SmartFake implements _i5.MisskeyNotesFavorites { _FakeMisskeyNotesFavorites_49( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyNotesPolls_50 extends _i1.SmartFake implements _i5.MisskeyNotesPolls { _FakeMisskeyNotesPolls_50( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyNotesThreadMuting_51 extends _i1.SmartFake implements _i5.MisskeyNotesThreadMuting { _FakeMisskeyNotesThreadMuting_51( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeNote_52 extends _i1.SmartFake implements _i5.Note { _FakeNote_52( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeNotesStateResponse_53 extends _i1.SmartFake implements _i5.NotesStateResponse { _FakeNotesStateResponse_53( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeNotesTranslateResponse_54 extends _i1.SmartFake implements _i5.NotesTranslateResponse { _FakeNotesTranslateResponse_54( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeRolesListResponse_55 extends _i1.SmartFake implements _i5.RolesListResponse { _FakeRolesListResponse_55( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeMisskeyUsersLists_56 extends _i1.SmartFake implements _i5.MisskeyUsersLists { _FakeMisskeyUsersLists_56( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeUserDetailed_57 extends _i1.SmartFake implements _i5.UserDetailed { _FakeUserDetailed_57( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeBaseOptions_58 extends _i1.SmartFake implements _i11.BaseOptions { _FakeBaseOptions_58( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeHttpClientAdapter_59 extends _i1.SmartFake implements _i11.HttpClientAdapter { _FakeHttpClientAdapter_59( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeTransformer_60 extends _i1.SmartFake implements _i11.Transformer { _FakeTransformer_60( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeInterceptors_61 extends _i1.SmartFake implements _i11.Interceptors { _FakeInterceptors_61( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeResponse_62<T1> extends _i1.SmartFake implements _i11.Response<T1> { _FakeResponse_62( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeDuration_63 extends _i1.SmartFake implements Duration { _FakeDuration_63( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeHttpClientRequest_64 extends _i1.SmartFake implements _i12.HttpClientRequest { _FakeHttpClientRequest_64( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeWebSocketChannel_65 extends _i1.SmartFake implements _i13.WebSocketChannel { _FakeWebSocketChannel_65( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeFile_66 extends _i1.SmartFake implements _i14.File { _FakeFile_66( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } class _FakeFileInfo_67 extends _i1.SmartFake implements _i15.FileInfo { _FakeFileInfo_67( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); } /// A class which mocks [TabSettingsRepository]. /// /// See the documentation for Mockito's code generation for more information. class MockTabSettingsRepository extends _i1.Mock implements _i16.TabSettingsRepository { @override Iterable<_i17.TabSetting> get tabSettings => (super.noSuchMethod( Invocation.getter(#tabSettings), returnValue: <_i17.TabSetting>[], returnValueForMissingStub: <_i17.TabSetting>[], ) as Iterable<_i17.TabSetting>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, returnValueForMissingStub: false, ) as bool); @override _i18.Future<void> load() => (super.noSuchMethod( Invocation.method( #load, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> save(List<_i17.TabSetting>? tabSettings) => (super.noSuchMethod( Invocation.method( #save, [tabSettings], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> removeAccount(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #removeAccount, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> initializeTabSettings(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #initializeTabSettings, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], ), returnValueForMissingStub: null, ); @override void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( Invocation.method( #dispose, [], ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( Invocation.method( #notifyListeners, [], ), returnValueForMissingStub: null, ); } /// A class which mocks [AccountSettingsRepository]. /// /// See the documentation for Mockito's code generation for more information. class MockAccountSettingsRepository extends _i1.Mock implements _i20.AccountSettingsRepository { @override Iterable<_i2.AccountSettings> get accountSettings => (super.noSuchMethod( Invocation.getter(#accountSettings), returnValue: <_i2.AccountSettings>[], returnValueForMissingStub: <_i2.AccountSettings>[], ) as Iterable<_i2.AccountSettings>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, returnValueForMissingStub: false, ) as bool); @override _i18.Future<void> load() => (super.noSuchMethod( Invocation.method( #load, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> save(_i2.AccountSettings? settings) => (super.noSuchMethod( Invocation.method( #save, [settings], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> removeAccount(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #removeAccount, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i2.AccountSettings fromAcct(_i21.Acct? acct) => (super.noSuchMethod( Invocation.method( #fromAcct, [acct], ), returnValue: _FakeAccountSettings_0( this, Invocation.method( #fromAcct, [acct], ), ), returnValueForMissingStub: _FakeAccountSettings_0( this, Invocation.method( #fromAcct, [acct], ), ), ) as _i2.AccountSettings); @override _i2.AccountSettings fromAccount(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #fromAccount, [account], ), returnValue: _FakeAccountSettings_0( this, Invocation.method( #fromAccount, [account], ), ), returnValueForMissingStub: _FakeAccountSettings_0( this, Invocation.method( #fromAccount, [account], ), ), ) as _i2.AccountSettings); @override void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], ), returnValueForMissingStub: null, ); @override void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( Invocation.method( #dispose, [], ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( Invocation.method( #notifyListeners, [], ), returnValueForMissingStub: null, ); } /// A class which mocks [EmojiRepository]. /// /// See the documentation for Mockito's code generation for more information. class MockEmojiRepository extends _i1.Mock implements _i22.EmojiRepository { @override set emoji(List<_i22.EmojiRepositoryData>? _emoji) => super.noSuchMethod( Invocation.setter( #emoji, _emoji, ), returnValueForMissingStub: null, ); @override _i18.Future<void> loadFromSourceIfNeed() => (super.noSuchMethod( Invocation.method( #loadFromSourceIfNeed, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> loadFromSource() => (super.noSuchMethod( Invocation.method( #loadFromSource, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> loadFromLocalCache() => (super.noSuchMethod( Invocation.method( #loadFromLocalCache, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<List<_i23.MisskeyEmojiData>> searchEmojis( String? name, { int? limit = 30, }) => (super.noSuchMethod( Invocation.method( #searchEmojis, [name], {#limit: limit}, ), returnValue: _i18.Future<List<_i23.MisskeyEmojiData>>.value( <_i23.MisskeyEmojiData>[]), returnValueForMissingStub: _i18.Future<List<_i23.MisskeyEmojiData>>.value( <_i23.MisskeyEmojiData>[]), ) as _i18.Future<List<_i23.MisskeyEmojiData>>); @override List<_i23.MisskeyEmojiData> defaultEmojis({int? limit}) => (super.noSuchMethod( Invocation.method( #defaultEmojis, [], {#limit: limit}, ), returnValue: <_i23.MisskeyEmojiData>[], returnValueForMissingStub: <_i23.MisskeyEmojiData>[], ) as List<_i23.MisskeyEmojiData>); } /// A class which mocks [GeneralSettingsRepository]. /// /// See the documentation for Mockito's code generation for more information. class MockGeneralSettingsRepository extends _i1.Mock implements _i24.GeneralSettingsRepository { @override _i3.GeneralSettings get settings => (super.noSuchMethod( Invocation.getter(#settings), returnValue: _FakeGeneralSettings_1( this, Invocation.getter(#settings), ), returnValueForMissingStub: _FakeGeneralSettings_1( this, Invocation.getter(#settings), ), ) as _i3.GeneralSettings); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, returnValueForMissingStub: false, ) as bool); @override _i18.Future<void> load() => (super.noSuchMethod( Invocation.method( #load, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> update(_i3.GeneralSettings? settings) => (super.noSuchMethod( Invocation.method( #update, [settings], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], ), returnValueForMissingStub: null, ); @override void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( Invocation.method( #dispose, [], ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( Invocation.method( #notifyListeners, [], ), returnValueForMissingStub: null, ); } /// A class which mocks [AccountRepository]. /// /// See the documentation for Mockito's code generation for more information. class MockAccountRepository extends _i1.Mock implements _i25.AccountRepository { @override _i4.NotifierProviderRef<List<_i6.Account>> get ref => (super.noSuchMethod( Invocation.getter(#ref), returnValue: _FakeNotifierProviderRef_2<List<_i6.Account>>( this, Invocation.getter(#ref), ), returnValueForMissingStub: _FakeNotifierProviderRef_2<List<_i6.Account>>( this, Invocation.getter(#ref), ), ) as _i4.NotifierProviderRef<List<_i6.Account>>); @override List<_i6.Account> get state => (super.noSuchMethod( Invocation.getter(#state), returnValue: <_i6.Account>[], returnValueForMissingStub: <_i6.Account>[], ) as List<_i6.Account>); @override set state(List<_i6.Account>? value) => super.noSuchMethod( Invocation.setter( #state, value, ), returnValueForMissingStub: null, ); @override List<_i6.Account> build() => (super.noSuchMethod( Invocation.method( #build, [], ), returnValue: <_i6.Account>[], returnValueForMissingStub: <_i6.Account>[], ) as List<_i6.Account>); @override _i18.Future<void> load() => (super.noSuchMethod( Invocation.method( #load, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> updateI(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #updateI, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> updateMeta(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #updateMeta, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> loadFromSourceIfNeed(_i21.Acct? acct) => (super.noSuchMethod( Invocation.method( #loadFromSourceIfNeed, [acct], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> createUnreadAnnouncement( _i6.Account? account, _i5.AnnouncementsResponse? announcement, ) => (super.noSuchMethod( Invocation.method( #createUnreadAnnouncement, [ account, announcement, ], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> removeUnreadAnnouncement(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #removeUnreadAnnouncement, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> addUnreadNotification(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #addUnreadNotification, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> readAllNotification(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #readAllNotification, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> remove(_i6.Account? account) => (super.noSuchMethod( Invocation.method( #remove, [account], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> loginAsPassword( String? server, String? userId, String? password, ) => (super.noSuchMethod( Invocation.method( #loginAsPassword, [ server, userId, password, ], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> loginAsToken( String? server, String? token, ) => (super.noSuchMethod( Invocation.method( #loginAsToken, [ server, token, ], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> openMiAuth(String? server) => (super.noSuchMethod( Invocation.method( #openMiAuth, [server], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> validateMiAuth(String? server) => (super.noSuchMethod( Invocation.method( #validateMiAuth, [server], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> reorder( int? oldIndex, int? newIndex, ) => (super.noSuchMethod( Invocation.method( #reorder, [ oldIndex, newIndex, ], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override bool updateShouldNotify( List<_i6.Account>? previous, List<_i6.Account>? next, ) => (super.noSuchMethod( Invocation.method( #updateShouldNotify, [ previous, next, ], ), returnValue: false, returnValueForMissingStub: false, ) as bool); } /// A class which mocks [NoteRepository]. /// /// See the documentation for Mockito's code generation for more information. class MockNoteRepository extends _i1.Mock implements _i26.NoteRepository { @override _i5.Misskey get misskey => (super.noSuchMethod( Invocation.getter(#misskey), returnValue: _FakeMisskey_3( this, Invocation.getter(#misskey), ), returnValueForMissingStub: _FakeMisskey_3( this, Invocation.getter(#misskey), ), ) as _i5.Misskey); @override _i6.Account get account => (super.noSuchMethod( Invocation.getter(#account), returnValue: _FakeAccount_4( this, Invocation.getter(#account), ), returnValueForMissingStub: _FakeAccount_4( this, Invocation.getter(#account), ), ) as _i6.Account); @override List<List<String>> get softMuteWordContents => (super.noSuchMethod( Invocation.getter(#softMuteWordContents), returnValue: <List<String>>[], returnValueForMissingStub: <List<String>>[], ) as List<List<String>>); @override List<RegExp> get softMuteWordRegExps => (super.noSuchMethod( Invocation.getter(#softMuteWordRegExps), returnValue: <RegExp>[], returnValueForMissingStub: <RegExp>[], ) as List<RegExp>); @override List<List<String>> get hardMuteWordContents => (super.noSuchMethod( Invocation.getter(#hardMuteWordContents), returnValue: <List<String>>[], returnValueForMissingStub: <List<String>>[], ) as List<List<String>>); @override List<RegExp> get hardMuteWordRegExps => (super.noSuchMethod( Invocation.getter(#hardMuteWordRegExps), returnValue: <RegExp>[], returnValueForMissingStub: <RegExp>[], ) as List<RegExp>); @override Map<String, _i5.Note> get notes => (super.noSuchMethod( Invocation.getter(#notes), returnValue: <String, _i5.Note>{}, returnValueForMissingStub: <String, _i5.Note>{}, ) as Map<String, _i5.Note>); @override Map<String, _i26.NoteStatus> get noteStatuses => (super.noSuchMethod( Invocation.getter(#noteStatuses), returnValue: <String, _i26.NoteStatus>{}, returnValueForMissingStub: <String, _i26.NoteStatus>{}, ) as Map<String, _i26.NoteStatus>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, returnValueForMissingStub: false, ) as bool); @override void updateMute( List<_i5.MuteWord>? softMuteWords, List<_i5.MuteWord>? hardMuteWords, ) => super.noSuchMethod( Invocation.method( #updateMute, [ softMuteWords, hardMuteWords, ], ), returnValueForMissingStub: null, ); @override void updateNoteStatus( String? id, _i26.NoteStatus Function(_i26.NoteStatus)? statusPredicate, { bool? isNotify = true, }) => super.noSuchMethod( Invocation.method( #updateNoteStatus, [ id, statusPredicate, ], {#isNotify: isNotify}, ), returnValueForMissingStub: null, ); @override void registerNote(_i5.Note? note) => super.noSuchMethod( Invocation.method( #registerNote, [note], ), returnValueForMissingStub: null, ); @override void registerAll(Iterable<_i5.Note>? notes) => super.noSuchMethod( Invocation.method( #registerAll, [notes], ), returnValueForMissingStub: null, ); @override _i18.Future<void> refresh(String? noteId) => (super.noSuchMethod( Invocation.method( #refresh, [noteId], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override void delete(String? noteId) => super.noSuchMethod( Invocation.method( #delete, [noteId], ), returnValueForMissingStub: null, ); @override void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], ), returnValueForMissingStub: null, ); @override void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( Invocation.method( #dispose, [], ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( Invocation.method( #notifyListeners, [], ), returnValueForMissingStub: null, ); } /// A class which mocks [Misskey]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskey extends _i1.Mock implements _i5.Misskey { @override String get host => (super.noSuchMethod( Invocation.getter(#host), returnValue: _i27.dummyValue<String>( this, Invocation.getter(#host), ), returnValueForMissingStub: _i27.dummyValue<String>( this, Invocation.getter(#host), ), ) as String); @override _i7.ApiService get apiService => (super.noSuchMethod( Invocation.getter(#apiService), returnValue: _FakeApiService_5( this, Invocation.getter(#apiService), ), returnValueForMissingStub: _FakeApiService_5( this, Invocation.getter(#apiService), ), ) as _i7.ApiService); @override set apiService(_i7.ApiService? _apiService) => super.noSuchMethod( Invocation.setter( #apiService, _apiService, ), returnValueForMissingStub: null, ); @override _i5.StreamingService get streamingService => (super.noSuchMethod( Invocation.getter(#streamingService), returnValue: _FakeStreamingService_6( this, Invocation.getter(#streamingService), ), returnValueForMissingStub: _FakeStreamingService_6( this, Invocation.getter(#streamingService), ), ) as _i5.StreamingService); @override set streamingService(_i5.StreamingService? _streamingService) => super.noSuchMethod( Invocation.setter( #streamingService, _streamingService, ), returnValueForMissingStub: null, ); @override _i5.MisskeyNotes get notes => (super.noSuchMethod( Invocation.getter(#notes), returnValue: _FakeMisskeyNotes_7( this, Invocation.getter(#notes), ), returnValueForMissingStub: _FakeMisskeyNotes_7( this, Invocation.getter(#notes), ), ) as _i5.MisskeyNotes); @override set notes(_i5.MisskeyNotes? _notes) => super.noSuchMethod( Invocation.setter( #notes, _notes, ), returnValueForMissingStub: null, ); @override _i5.MisskeyChannels get channels => (super.noSuchMethod( Invocation.getter(#channels), returnValue: _FakeMisskeyChannels_8( this, Invocation.getter(#channels), ), returnValueForMissingStub: _FakeMisskeyChannels_8( this, Invocation.getter(#channels), ), ) as _i5.MisskeyChannels); @override set channels(_i5.MisskeyChannels? _channels) => super.noSuchMethod( Invocation.setter( #channels, _channels, ), returnValueForMissingStub: null, ); @override _i5.MisskeyUsers get users => (super.noSuchMethod( Invocation.getter(#users), returnValue: _FakeMisskeyUsers_9( this, Invocation.getter(#users), ), returnValueForMissingStub: _FakeMisskeyUsers_9( this, Invocation.getter(#users), ), ) as _i5.MisskeyUsers); @override set users(_i5.MisskeyUsers? _users) => super.noSuchMethod( Invocation.setter( #users, _users, ), returnValueForMissingStub: null, ); @override _i5.MisskeyI get i => (super.noSuchMethod( Invocation.getter(#i), returnValue: _FakeMisskeyI_10( this, Invocation.getter(#i), ), returnValueForMissingStub: _FakeMisskeyI_10( this, Invocation.getter(#i), ), ) as _i5.MisskeyI); @override set i(_i5.MisskeyI? _i) => super.noSuchMethod( Invocation.setter( #i, _i, ), returnValueForMissingStub: null, ); @override _i5.MisskeyClips get clips => (super.noSuchMethod( Invocation.getter(#clips), returnValue: _FakeMisskeyClips_11( this, Invocation.getter(#clips), ), returnValueForMissingStub: _FakeMisskeyClips_11( this, Invocation.getter(#clips), ), ) as _i5.MisskeyClips); @override set clips(_i5.MisskeyClips? _clips) => super.noSuchMethod( Invocation.setter( #clips, _clips, ), returnValueForMissingStub: null, ); @override _i5.MisskeyAntenna get antennas => (super.noSuchMethod( Invocation.getter(#antennas), returnValue: _FakeMisskeyAntenna_12( this, Invocation.getter(#antennas), ), returnValueForMissingStub: _FakeMisskeyAntenna_12( this, Invocation.getter(#antennas), ), ) as _i5.MisskeyAntenna); @override set antennas(_i5.MisskeyAntenna? _antennas) => super.noSuchMethod( Invocation.setter( #antennas, _antennas, ), returnValueForMissingStub: null, ); @override _i5.MisskeyDrive get drive => (super.noSuchMethod( Invocation.getter(#drive), returnValue: _FakeMisskeyDrive_13( this, Invocation.getter(#drive), ), returnValueForMissingStub: _FakeMisskeyDrive_13( this, Invocation.getter(#drive), ), ) as _i5.MisskeyDrive); @override set drive(_i5.MisskeyDrive? _drive) => super.noSuchMethod( Invocation.setter( #drive, _drive, ), returnValueForMissingStub: null, ); @override _i5.MisskeyFollowing get following => (super.noSuchMethod( Invocation.getter(#following), returnValue: _FakeMisskeyFollowing_14( this, Invocation.getter(#following), ), returnValueForMissingStub: _FakeMisskeyFollowing_14( this, Invocation.getter(#following), ), ) as _i5.MisskeyFollowing); @override set following(_i5.MisskeyFollowing? _following) => super.noSuchMethod( Invocation.setter( #following, _following, ), returnValueForMissingStub: null, ); @override _i5.MisskeyBlocking get blocking => (super.noSuchMethod( Invocation.getter(#blocking), returnValue: _FakeMisskeyBlocking_15( this, Invocation.getter(#blocking), ), returnValueForMissingStub: _FakeMisskeyBlocking_15( this, Invocation.getter(#blocking), ), ) as _i5.MisskeyBlocking); @override set blocking(_i5.MisskeyBlocking? _blocking) => super.noSuchMethod( Invocation.setter( #blocking, _blocking, ), returnValueForMissingStub: null, ); @override _i5.MisskeyMute get mute => (super.noSuchMethod( Invocation.getter(#mute), returnValue: _FakeMisskeyMute_16( this, Invocation.getter(#mute), ), returnValueForMissingStub: _FakeMisskeyMute_16( this, Invocation.getter(#mute), ), ) as _i5.MisskeyMute); @override set mute(_i5.MisskeyMute? _mute) => super.noSuchMethod( Invocation.setter( #mute, _mute, ), returnValueForMissingStub: null, ); @override _i5.MisskeyRenoteMute get renoteMute => (super.noSuchMethod( Invocation.getter(#renoteMute), returnValue: _FakeMisskeyRenoteMute_17( this, Invocation.getter(#renoteMute), ), returnValueForMissingStub: _FakeMisskeyRenoteMute_17( this, Invocation.getter(#renoteMute), ), ) as _i5.MisskeyRenoteMute); @override set renoteMute(_i5.MisskeyRenoteMute? _renoteMute) => super.noSuchMethod( Invocation.setter( #renoteMute, _renoteMute, ), returnValueForMissingStub: null, ); @override _i5.MisskeyFederation get federation => (super.noSuchMethod( Invocation.getter(#federation), returnValue: _FakeMisskeyFederation_18( this, Invocation.getter(#federation), ), returnValueForMissingStub: _FakeMisskeyFederation_18( this, Invocation.getter(#federation), ), ) as _i5.MisskeyFederation); @override set federation(_i5.MisskeyFederation? _federation) => super.noSuchMethod( Invocation.setter( #federation, _federation, ), returnValueForMissingStub: null, ); @override _i5.MisskeyRoles get roles => (super.noSuchMethod( Invocation.getter(#roles), returnValue: _FakeMisskeyRoles_19( this, Invocation.getter(#roles), ), returnValueForMissingStub: _FakeMisskeyRoles_19( this, Invocation.getter(#roles), ), ) as _i5.MisskeyRoles); @override set roles(_i5.MisskeyRoles? _roles) => super.noSuchMethod( Invocation.setter( #roles, _roles, ), returnValueForMissingStub: null, ); @override _i5.MisskeyHashtags get hashtags => (super.noSuchMethod( Invocation.getter(#hashtags), returnValue: _FakeMisskeyHashtags_20( this, Invocation.getter(#hashtags), ), returnValueForMissingStub: _FakeMisskeyHashtags_20( this, Invocation.getter(#hashtags), ), ) as _i5.MisskeyHashtags); @override set hashtags(_i5.MisskeyHashtags? _hashtags) => super.noSuchMethod( Invocation.setter( #hashtags, _hashtags, ), returnValueForMissingStub: null, ); @override _i5.MisskeyAp get ap => (super.noSuchMethod( Invocation.getter(#ap), returnValue: _FakeMisskeyAp_21( this, Invocation.getter(#ap), ), returnValueForMissingStub: _FakeMisskeyAp_21( this, Invocation.getter(#ap), ), ) as _i5.MisskeyAp); @override set ap(_i5.MisskeyAp? _ap) => super.noSuchMethod( Invocation.setter( #ap, _ap, ), returnValueForMissingStub: null, ); @override _i5.MisskeyPages get pages => (super.noSuchMethod( Invocation.getter(#pages), returnValue: _FakeMisskeyPages_22( this, Invocation.getter(#pages), ), returnValueForMissingStub: _FakeMisskeyPages_22( this, Invocation.getter(#pages), ), ) as _i5.MisskeyPages); @override set pages(_i5.MisskeyPages? _pages) => super.noSuchMethod( Invocation.setter( #pages, _pages, ), returnValueForMissingStub: null, ); @override _i8.MisskeyFlash get flash => (super.noSuchMethod( Invocation.getter(#flash), returnValue: _FakeMisskeyFlash_23( this, Invocation.getter(#flash), ), returnValueForMissingStub: _FakeMisskeyFlash_23( this, Invocation.getter(#flash), ), ) as _i8.MisskeyFlash); @override set flash(_i8.MisskeyFlash? _flash) => super.noSuchMethod( Invocation.setter( #flash, _flash, ), returnValueForMissingStub: null, ); @override _i5.MisskeyReversi get reversi => (super.noSuchMethod( Invocation.getter(#reversi), returnValue: _FakeMisskeyReversi_24( this, Invocation.getter(#reversi), ), returnValueForMissingStub: _FakeMisskeyReversi_24( this, Invocation.getter(#reversi), ), ) as _i5.MisskeyReversi); @override set reversi(_i5.MisskeyReversi? _reversi) => super.noSuchMethod( Invocation.setter( #reversi, _reversi, ), returnValueForMissingStub: null, ); @override _i5.MisskeyBubbleGame get bubbleGame => (super.noSuchMethod( Invocation.getter(#bubbleGame), returnValue: _FakeMisskeyBubbleGame_25( this, Invocation.getter(#bubbleGame), ), returnValueForMissingStub: _FakeMisskeyBubbleGame_25( this, Invocation.getter(#bubbleGame), ), ) as _i5.MisskeyBubbleGame); @override set bubbleGame(_i5.MisskeyBubbleGame? _bubbleGame) => super.noSuchMethod( Invocation.setter( #bubbleGame, _bubbleGame, ), returnValueForMissingStub: null, ); @override _i18.Future<Iterable<_i5.AnnouncementsResponse>> announcements( _i5.AnnouncementsRequest? request) => (super.noSuchMethod( Invocation.method( #announcements, [request], ), returnValue: _i18.Future<Iterable<_i5.AnnouncementsResponse>>.value( <_i5.AnnouncementsResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.AnnouncementsResponse>>.value( <_i5.AnnouncementsResponse>[]), ) as _i18.Future<Iterable<_i5.AnnouncementsResponse>>); @override _i18.Future<List<String>> endpoints() => (super.noSuchMethod( Invocation.method( #endpoints, [], ), returnValue: _i18.Future<List<String>>.value(<String>[]), returnValueForMissingStub: _i18.Future<List<String>>.value(<String>[]), ) as _i18.Future<List<String>>); @override _i18.Future<_i5.EmojisResponse> emojis() => (super.noSuchMethod( Invocation.method( #emojis, [], ), returnValue: _i18.Future<_i5.EmojisResponse>.value(_FakeEmojisResponse_26( this, Invocation.method( #emojis, [], ), )), returnValueForMissingStub: _i18.Future<_i5.EmojisResponse>.value(_FakeEmojisResponse_26( this, Invocation.method( #emojis, [], ), )), ) as _i18.Future<_i5.EmojisResponse>); @override _i18.Future<_i5.EmojiResponse> emoji(_i5.EmojiRequest? request) => (super.noSuchMethod( Invocation.method( #emoji, [request], ), returnValue: _i18.Future<_i5.EmojiResponse>.value(_FakeEmojiResponse_27( this, Invocation.method( #emoji, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.EmojiResponse>.value(_FakeEmojiResponse_27( this, Invocation.method( #emoji, [request], ), )), ) as _i18.Future<_i5.EmojiResponse>); @override _i18.Future<_i5.MetaResponse> meta() => (super.noSuchMethod( Invocation.method( #meta, [], ), returnValue: _i18.Future<_i5.MetaResponse>.value(_FakeMetaResponse_28( this, Invocation.method( #meta, [], ), )), returnValueForMissingStub: _i18.Future<_i5.MetaResponse>.value(_FakeMetaResponse_28( this, Invocation.method( #meta, [], ), )), ) as _i18.Future<_i5.MetaResponse>); @override _i18.Future<_i9.StatsResponse> stats() => (super.noSuchMethod( Invocation.method( #stats, [], ), returnValue: _i18.Future<_i9.StatsResponse>.value(_FakeStatsResponse_29( this, Invocation.method( #stats, [], ), )), returnValueForMissingStub: _i18.Future<_i9.StatsResponse>.value(_FakeStatsResponse_29( this, Invocation.method( #stats, [], ), )), ) as _i18.Future<_i9.StatsResponse>); @override _i18.Future<_i10.PingResponse> ping() => (super.noSuchMethod( Invocation.method( #ping, [], ), returnValue: _i18.Future<_i10.PingResponse>.value(_FakePingResponse_30( this, Invocation.method( #ping, [], ), )), returnValueForMissingStub: _i18.Future<_i10.PingResponse>.value(_FakePingResponse_30( this, Invocation.method( #ping, [], ), )), ) as _i18.Future<_i10.PingResponse>); @override _i18.Future<_i5.ServerInfoResponse> serverInfo() => (super.noSuchMethod( Invocation.method( #serverInfo, [], ), returnValue: _i18.Future<_i5.ServerInfoResponse>.value( _FakeServerInfoResponse_31( this, Invocation.method( #serverInfo, [], ), )), returnValueForMissingStub: _i18.Future<_i5.ServerInfoResponse>.value( _FakeServerInfoResponse_31( this, Invocation.method( #serverInfo, [], ), )), ) as _i18.Future<_i5.ServerInfoResponse>); @override _i18.Future<_i5.GetOnlineUsersCountResponse> getOnlineUsersCount() => (super.noSuchMethod( Invocation.method( #getOnlineUsersCount, [], ), returnValue: _i18.Future<_i5.GetOnlineUsersCountResponse>.value( _FakeGetOnlineUsersCountResponse_32( this, Invocation.method( #getOnlineUsersCount, [], ), )), returnValueForMissingStub: _i18.Future<_i5.GetOnlineUsersCountResponse>.value( _FakeGetOnlineUsersCountResponse_32( this, Invocation.method( #getOnlineUsersCount, [], ), )), ) as _i18.Future<_i5.GetOnlineUsersCountResponse>); @override _i18.Future<Iterable<_i5.GetAvatarDecorationsResponse>> getAvatarDecorations() => (super.noSuchMethod( Invocation.method( #getAvatarDecorations, [], ), returnValue: _i18.Future<Iterable<_i5.GetAvatarDecorationsResponse>>.value( <_i5.GetAvatarDecorationsResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.GetAvatarDecorationsResponse>>.value( <_i5.GetAvatarDecorationsResponse>[]), ) as _i18.Future<Iterable<_i5.GetAvatarDecorationsResponse>>); @override _i18.Future<Iterable<_i5.UserDetailed>> pinnedUsers() => (super.noSuchMethod( Invocation.method( #pinnedUsers, [], ), returnValue: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), ) as _i18.Future<Iterable<_i5.UserDetailed>>); @override _i5.SocketController homeTimelineStream({ required _i5.HomeTimelineParameter? parameter, _i18.FutureOr<void> Function(_i5.Note)? onNoteReceived, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onReacted, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onUnreacted, _i18.FutureOr<void> Function( String, DateTime, )? onDeleted, _i18.FutureOr<void> Function( String, _i5.TimelineVoted, )? onVoted, _i18.FutureOr<void> Function( String, _i5.NoteEdited, )? onUpdated, }) => (super.noSuchMethod( Invocation.method( #homeTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #homeTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #homeTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), ) as _i5.SocketController); @override _i5.SocketController localTimelineStream({ required _i5.LocalTimelineParameter? parameter, _i18.FutureOr<void> Function(_i5.Note)? onNoteReceived, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onReacted, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onUnreacted, _i18.FutureOr<void> Function( String, DateTime, )? onDeleted, _i18.FutureOr<void> Function( String, _i5.TimelineVoted, )? onVoted, _i18.FutureOr<void> Function( String, _i5.NoteEdited, )? onUpdated, }) => (super.noSuchMethod( Invocation.method( #localTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #localTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #localTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), ) as _i5.SocketController); @override _i5.SocketController globalTimelineStream({ required _i5.GlobalTimelineParameter? parameter, _i18.FutureOr<void> Function(_i5.Note)? onNoteReceived, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onReacted, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onUnreacted, _i18.FutureOr<void> Function( String, DateTime, )? onDeleted, _i18.FutureOr<void> Function( String, _i5.TimelineVoted, )? onVoted, _i18.FutureOr<void> Function( String, _i5.NoteEdited, )? onUpdated, }) => (super.noSuchMethod( Invocation.method( #globalTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #globalTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #globalTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), ) as _i5.SocketController); @override _i5.SocketController hybridTimelineStream({ required _i5.HybridTimelineParameter? parameter, _i18.FutureOr<void> Function(_i5.Note)? onNoteReceived, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onReacted, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onUnreacted, _i18.FutureOr<void> Function( String, DateTime, )? onDeleted, _i18.FutureOr<void> Function( String, _i5.TimelineVoted, )? onVoted, _i18.FutureOr<void> Function( String, _i5.NoteEdited, )? onUpdated, }) => (super.noSuchMethod( Invocation.method( #hybridTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #hybridTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #hybridTimelineStream, [], { #parameter: parameter, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), ) as _i5.SocketController); @override _i5.SocketController roleTimelineStream({ required String? roleId, _i18.FutureOr<void> Function(_i5.Note)? onNoteReceived, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onReacted, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onUnreacted, _i18.FutureOr<void> Function( String, DateTime, )? onDeleted, _i18.FutureOr<void> Function( String, _i5.TimelineVoted, )? onVoted, _i18.FutureOr<void> Function( String, _i5.NoteEdited, )? onUpdated, }) => (super.noSuchMethod( Invocation.method( #roleTimelineStream, [], { #roleId: roleId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #roleTimelineStream, [], { #roleId: roleId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #roleTimelineStream, [], { #roleId: roleId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), ) as _i5.SocketController); @override _i5.SocketController channelStream({ required String? channelId, _i18.FutureOr<void> Function(_i5.Note)? onNoteReceived, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onReacted, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onUnreacted, _i18.FutureOr<void> Function( String, DateTime, )? onDeleted, _i18.FutureOr<void> Function( String, _i5.TimelineVoted, )? onVoted, _i18.FutureOr<void> Function( String, _i5.NoteEdited, )? onUpdated, }) => (super.noSuchMethod( Invocation.method( #channelStream, [], { #channelId: channelId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #channelStream, [], { #channelId: channelId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #channelStream, [], { #channelId: channelId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), ) as _i5.SocketController); @override _i5.SocketController userListStream({ required String? listId, _i18.FutureOr<void> Function(_i5.Note)? onNoteReceived, _i18.FutureOr<void> Function(_i5.UserLite)? onUserAdded, _i18.FutureOr<void> Function(_i5.UserLite)? onUserRemoved, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onReacted, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onUnreacted, _i18.FutureOr<void> Function( String, _i5.NoteEdited, )? onUpdated, _i18.FutureOr<void> Function(DateTime)? onDeleted, _i18.FutureOr<void> Function( String, _i5.TimelineVoted, )? onVoted, }) => (super.noSuchMethod( Invocation.method( #userListStream, [], { #listId: listId, #onNoteReceived: onNoteReceived, #onUserAdded: onUserAdded, #onUserRemoved: onUserRemoved, #onReacted: onReacted, #onUnreacted: onUnreacted, #onUpdated: onUpdated, #onDeleted: onDeleted, #onVoted: onVoted, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #userListStream, [], { #listId: listId, #onNoteReceived: onNoteReceived, #onUserAdded: onUserAdded, #onUserRemoved: onUserRemoved, #onReacted: onReacted, #onUnreacted: onUnreacted, #onUpdated: onUpdated, #onDeleted: onDeleted, #onVoted: onVoted, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #userListStream, [], { #listId: listId, #onNoteReceived: onNoteReceived, #onUserAdded: onUserAdded, #onUserRemoved: onUserRemoved, #onReacted: onReacted, #onUnreacted: onUnreacted, #onUpdated: onUpdated, #onDeleted: onDeleted, #onVoted: onVoted, }, ), ), ) as _i5.SocketController); @override _i5.SocketController antennaStream({ required String? antennaId, _i18.FutureOr<void> Function(_i5.Note)? onNoteReceived, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onReacted, _i18.FutureOr<void> Function( String, _i5.TimelineReacted, )? onUnreacted, _i18.FutureOr<void> Function( String, DateTime, )? onDeleted, _i18.FutureOr<void> Function( String, _i5.TimelineVoted, )? onVoted, _i18.FutureOr<void> Function( String, _i5.NoteEdited, )? onUpdated, }) => (super.noSuchMethod( Invocation.method( #antennaStream, [], { #antennaId: antennaId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #antennaStream, [], { #antennaId: antennaId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #antennaStream, [], { #antennaId: antennaId, #onNoteReceived: onNoteReceived, #onReacted: onReacted, #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, #onUpdated: onUpdated, }, ), ), ) as _i5.SocketController); @override _i5.SocketController serverStatsLogStream( _i18.FutureOr<void> Function(List<_i5.StatsLogResponse>)? onLogReceived, _i18.FutureOr<void> Function(_i5.StatsLogResponse)? onEventReceived, ) => (super.noSuchMethod( Invocation.method( #serverStatsLogStream, [ onLogReceived, onEventReceived, ], ), returnValue: _FakeSocketController_33( this, Invocation.method( #serverStatsLogStream, [ onLogReceived, onEventReceived, ], ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #serverStatsLogStream, [ onLogReceived, onEventReceived, ], ), ), ) as _i5.SocketController); @override _i5.SocketController queueStatsLogStream( _i18.FutureOr<void> Function(List<_i5.QueueStatsLogResponse>)? onLogReceived, _i18.FutureOr<void> Function(_i5.QueueStatsLogResponse)? onEventReceived, ) => (super.noSuchMethod( Invocation.method( #queueStatsLogStream, [ onLogReceived, onEventReceived, ], ), returnValue: _FakeSocketController_33( this, Invocation.method( #queueStatsLogStream, [ onLogReceived, onEventReceived, ], ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #queueStatsLogStream, [ onLogReceived, onEventReceived, ], ), ), ) as _i5.SocketController); @override _i5.SocketController mainStream({ _i18.FutureOr<void> Function(_i5.Emoji)? onEmojiAdded, _i18.FutureOr<void> Function(Iterable<_i5.Emoji>)? onEmojiUpdated, _i18.FutureOr<void> Function(Iterable<_i5.Emoji>)? onEmojiDeleted, _i18.FutureOr<void> Function(_i5.AnnouncementsResponse)? onAnnouncementCreated, _i18.FutureOr<void> Function(_i5.INotificationsResponse)? onNotification, _i18.FutureOr<void> Function(_i5.Note)? onMention, _i18.FutureOr<void> Function(_i5.Note)? onReply, _i18.FutureOr<void> Function(_i5.Note)? onRenote, _i18.FutureOr<void> Function(_i5.UserDetailedNotMe)? onFollow, _i18.FutureOr<void> Function(_i5.UserLite)? onFollowed, _i18.FutureOr<void> Function(_i5.UserDetailedNotMe)? onUnfollow, _i18.FutureOr<void> Function(_i5.MeDetailed)? onMeUpdated, _i18.FutureOr<void> Function()? onReadAllNotifications, _i18.FutureOr<void> Function(_i5.INotificationsResponse)? onUnreadNotification, _i18.FutureOr<void> Function(String)? onUnreadMention, _i18.FutureOr<void> Function()? onReadAllUnreadMentions, _i18.FutureOr<void> Function(String)? onUnreadSpecifiedNote, _i18.FutureOr<void> Function()? onReadAllUnreadSpecifiedNotes, _i18.FutureOr<void> Function(_i5.UserLite)? onReceiveFollowRequest, _i18.FutureOr<void> Function()? onReadAllAnnouncements, }) => (super.noSuchMethod( Invocation.method( #mainStream, [], { #onEmojiAdded: onEmojiAdded, #onEmojiUpdated: onEmojiUpdated, #onEmojiDeleted: onEmojiDeleted, #onAnnouncementCreated: onAnnouncementCreated, #onNotification: onNotification, #onMention: onMention, #onReply: onReply, #onRenote: onRenote, #onFollow: onFollow, #onFollowed: onFollowed, #onUnfollow: onUnfollow, #onMeUpdated: onMeUpdated, #onReadAllNotifications: onReadAllNotifications, #onUnreadNotification: onUnreadNotification, #onUnreadMention: onUnreadMention, #onReadAllUnreadMentions: onReadAllUnreadMentions, #onUnreadSpecifiedNote: onUnreadSpecifiedNote, #onReadAllUnreadSpecifiedNotes: onReadAllUnreadSpecifiedNotes, #onReceiveFollowRequest: onReceiveFollowRequest, #onReadAllAnnouncements: onReadAllAnnouncements, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #mainStream, [], { #onEmojiAdded: onEmojiAdded, #onEmojiUpdated: onEmojiUpdated, #onEmojiDeleted: onEmojiDeleted, #onAnnouncementCreated: onAnnouncementCreated, #onNotification: onNotification, #onMention: onMention, #onReply: onReply, #onRenote: onRenote, #onFollow: onFollow, #onFollowed: onFollowed, #onUnfollow: onUnfollow, #onMeUpdated: onMeUpdated, #onReadAllNotifications: onReadAllNotifications, #onUnreadNotification: onUnreadNotification, #onUnreadMention: onUnreadMention, #onReadAllUnreadMentions: onReadAllUnreadMentions, #onUnreadSpecifiedNote: onUnreadSpecifiedNote, #onReadAllUnreadSpecifiedNotes: onReadAllUnreadSpecifiedNotes, #onReceiveFollowRequest: onReceiveFollowRequest, #onReadAllAnnouncements: onReadAllAnnouncements, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #mainStream, [], { #onEmojiAdded: onEmojiAdded, #onEmojiUpdated: onEmojiUpdated, #onEmojiDeleted: onEmojiDeleted, #onAnnouncementCreated: onAnnouncementCreated, #onNotification: onNotification, #onMention: onMention, #onReply: onReply, #onRenote: onRenote, #onFollow: onFollow, #onFollowed: onFollowed, #onUnfollow: onUnfollow, #onMeUpdated: onMeUpdated, #onReadAllNotifications: onReadAllNotifications, #onUnreadNotification: onUnreadNotification, #onUnreadMention: onUnreadMention, #onReadAllUnreadMentions: onReadAllUnreadMentions, #onUnreadSpecifiedNote: onUnreadSpecifiedNote, #onReadAllUnreadSpecifiedNotes: onReadAllUnreadSpecifiedNotes, #onReceiveFollowRequest: onReceiveFollowRequest, #onReadAllAnnouncements: onReadAllAnnouncements, }, ), ), ) as _i5.SocketController); @override _i18.Future<void> startStreaming() => (super.noSuchMethod( Invocation.method( #startStreaming, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyAntenna]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyAntenna extends _i1.Mock implements _i5.MisskeyAntenna { @override _i18.Future<_i5.Antenna> create(_i5.AntennasCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<_i5.Antenna>.value(_FakeAntenna_34( this, Invocation.method( #create, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.Antenna>.value(_FakeAntenna_34( this, Invocation.method( #create, [request], ), )), ) as _i18.Future<_i5.Antenna>); @override _i18.Future<void> delete(_i5.AntennasDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.Antenna>> list() => (super.noSuchMethod( Invocation.method( #list, [], ), returnValue: _i18.Future<Iterable<_i5.Antenna>>.value(<_i5.Antenna>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Antenna>>.value(<_i5.Antenna>[]), ) as _i18.Future<Iterable<_i5.Antenna>>); @override _i18.Future<Iterable<_i5.Note>> notes(_i5.AntennasNotesRequest? request) => (super.noSuchMethod( Invocation.method( #notes, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<_i5.Antenna> show(_i5.AntennasShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.Antenna>.value(_FakeAntenna_34( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.Antenna>.value(_FakeAntenna_34( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.Antenna>); @override _i18.Future<void> update(_i5.AntennasUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyAp]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyAp extends _i1.Mock implements _i5.MisskeyAp { @override _i18.Future<_i5.ApShowResponse> show(_i5.ApShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.ApShowResponse>.value(_FakeApShowResponse_35( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.ApShowResponse>.value(_FakeApShowResponse_35( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.ApShowResponse>); } /// A class which mocks [MisskeyBlocking]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyBlocking extends _i1.Mock implements _i5.MisskeyBlocking { @override _i18.Future<void> create(_i5.BlockCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> delete(_i5.BlockDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyChannels]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyChannels extends _i1.Mock implements _i5.MisskeyChannels { @override _i18.Future<Iterable<_i5.Note>> timeline( _i5.ChannelsTimelineRequest? request) => (super.noSuchMethod( Invocation.method( #timeline, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<_i5.CommunityChannel> show(_i5.ChannelsShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.CommunityChannel>.value(_FakeCommunityChannel_36( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.CommunityChannel>.value(_FakeCommunityChannel_36( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.CommunityChannel>); @override _i18.Future<Iterable<_i5.CommunityChannel>> followed( _i5.ChannelsFollowedRequest? request) => (super.noSuchMethod( Invocation.method( #followed, [request], ), returnValue: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), ) as _i18.Future<Iterable<_i5.CommunityChannel>>); @override _i18.Future<Iterable<_i5.CommunityChannel>> myFavorite( _i5.ChannelsMyFavoriteRequest? request) => (super.noSuchMethod( Invocation.method( #myFavorite, [request], ), returnValue: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), ) as _i18.Future<Iterable<_i5.CommunityChannel>>); @override _i18.Future<Iterable<_i5.CommunityChannel>> featured() => (super.noSuchMethod( Invocation.method( #featured, [], ), returnValue: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), ) as _i18.Future<Iterable<_i5.CommunityChannel>>); @override _i18.Future<Iterable<_i5.CommunityChannel>> owned( _i5.ChannelsOwnedRequest? request) => (super.noSuchMethod( Invocation.method( #owned, [request], ), returnValue: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), ) as _i18.Future<Iterable<_i5.CommunityChannel>>); @override _i18.Future<Iterable<_i5.CommunityChannel>> search( _i5.ChannelsSearchRequest? request) => (super.noSuchMethod( Invocation.method( #search, [request], ), returnValue: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.CommunityChannel>>.value( <_i5.CommunityChannel>[]), ) as _i18.Future<Iterable<_i5.CommunityChannel>>); @override _i18.Future<_i5.CommunityChannel> create( _i5.ChannelsCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<_i5.CommunityChannel>.value(_FakeCommunityChannel_36( this, Invocation.method( #create, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.CommunityChannel>.value(_FakeCommunityChannel_36( this, Invocation.method( #create, [request], ), )), ) as _i18.Future<_i5.CommunityChannel>); @override _i18.Future<void> update(_i5.ChannelsUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> favorite(_i5.ChannelsFavoriteRequest? request) => (super.noSuchMethod( Invocation.method( #favorite, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> unfavorite(_i5.ChannelsUnfavoriteRequest? request) => (super.noSuchMethod( Invocation.method( #unfavorite, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> follow(_i5.ChannelsFollowRequest? request) => (super.noSuchMethod( Invocation.method( #follow, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> unfollow(_i5.ChannelsUnfollowRequest? request) => (super.noSuchMethod( Invocation.method( #unfollow, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyClips]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyClips extends _i1.Mock implements _i5.MisskeyClips { @override _i18.Future<Iterable<_i5.Clip>> list() => (super.noSuchMethod( Invocation.method( #list, [], ), returnValue: _i18.Future<Iterable<_i5.Clip>>.value(<_i5.Clip>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Clip>>.value(<_i5.Clip>[]), ) as _i18.Future<Iterable<_i5.Clip>>); @override _i18.Future<Iterable<_i5.Clip>> myFavorites() => (super.noSuchMethod( Invocation.method( #myFavorites, [], ), returnValue: _i18.Future<Iterable<_i5.Clip>>.value(<_i5.Clip>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Clip>>.value(<_i5.Clip>[]), ) as _i18.Future<Iterable<_i5.Clip>>); @override _i18.Future<Iterable<_i5.Note>> notes(_i5.ClipsNotesRequest? request) => (super.noSuchMethod( Invocation.method( #notes, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<void> addNote(_i5.ClipsAddNoteRequest? request) => (super.noSuchMethod( Invocation.method( #addNote, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> removeNote(_i5.ClipsRemoveNoteRequest? request) => (super.noSuchMethod( Invocation.method( #removeNote, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<_i5.Clip> create(_i5.ClipsCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<_i5.Clip>.value(_FakeClip_37( this, Invocation.method( #create, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.Clip>.value(_FakeClip_37( this, Invocation.method( #create, [request], ), )), ) as _i18.Future<_i5.Clip>); @override _i18.Future<void> delete(_i5.ClipsDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<_i5.Clip> update(_i5.ClipsUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), returnValue: _i18.Future<_i5.Clip>.value(_FakeClip_37( this, Invocation.method( #update, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.Clip>.value(_FakeClip_37( this, Invocation.method( #update, [request], ), )), ) as _i18.Future<_i5.Clip>); @override _i18.Future<_i5.Clip> show(_i5.ClipsShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.Clip>.value(_FakeClip_37( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.Clip>.value(_FakeClip_37( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.Clip>); @override _i18.Future<void> favorite(_i5.ClipsFavoriteRequest? request) => (super.noSuchMethod( Invocation.method( #favorite, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> unfavorite(_i5.ClipsUnfavoriteRequest? request) => (super.noSuchMethod( Invocation.method( #unfavorite, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyDrive]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyDrive extends _i1.Mock implements _i5.MisskeyDrive { @override _i5.MisskeyDriveFiles get files => (super.noSuchMethod( Invocation.getter(#files), returnValue: _FakeMisskeyDriveFiles_38( this, Invocation.getter(#files), ), returnValueForMissingStub: _FakeMisskeyDriveFiles_38( this, Invocation.getter(#files), ), ) as _i5.MisskeyDriveFiles); @override _i5.MisskeyDriveFolders get folders => (super.noSuchMethod( Invocation.getter(#folders), returnValue: _FakeMisskeyDriveFolders_39( this, Invocation.getter(#folders), ), returnValueForMissingStub: _FakeMisskeyDriveFolders_39( this, Invocation.getter(#folders), ), ) as _i5.MisskeyDriveFolders); @override _i18.Future<Iterable<_i5.DriveFile>> stream( _i5.DriveStreamRequest? request) => (super.noSuchMethod( Invocation.method( #stream, [request], ), returnValue: _i18.Future<Iterable<_i5.DriveFile>>.value(<_i5.DriveFile>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.DriveFile>>.value(<_i5.DriveFile>[]), ) as _i18.Future<Iterable<_i5.DriveFile>>); } /// A class which mocks [MisskeyDriveFolders]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyDriveFolders extends _i1.Mock implements _i5.MisskeyDriveFolders { @override _i18.Future<Iterable<_i5.DriveFolder>> folders( _i5.DriveFoldersRequest? request) => (super.noSuchMethod( Invocation.method( #folders, [request], ), returnValue: _i18.Future<Iterable<_i5.DriveFolder>>.value(<_i5.DriveFolder>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.DriveFolder>>.value(<_i5.DriveFolder>[]), ) as _i18.Future<Iterable<_i5.DriveFolder>>); @override _i18.Future<_i5.DriveFolder> create(_i5.DriveFoldersCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<_i5.DriveFolder>.value(_FakeDriveFolder_40( this, Invocation.method( #create, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.DriveFolder>.value(_FakeDriveFolder_40( this, Invocation.method( #create, [request], ), )), ) as _i18.Future<_i5.DriveFolder>); @override _i18.Future<void> delete(_i5.DriveFoldersDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.DriveFolder>> find( _i5.DriveFoldersFindRequest? request) => (super.noSuchMethod( Invocation.method( #find, [request], ), returnValue: _i18.Future<Iterable<_i5.DriveFolder>>.value(<_i5.DriveFolder>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.DriveFolder>>.value(<_i5.DriveFolder>[]), ) as _i18.Future<Iterable<_i5.DriveFolder>>); @override _i18.Future<_i5.DriveFolder> show(_i5.DriveFoldersShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.DriveFolder>.value(_FakeDriveFolder_40( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.DriveFolder>.value(_FakeDriveFolder_40( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.DriveFolder>); @override _i18.Future<_i5.DriveFolder> update(_i5.DriveFoldersUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), returnValue: _i18.Future<_i5.DriveFolder>.value(_FakeDriveFolder_40( this, Invocation.method( #update, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.DriveFolder>.value(_FakeDriveFolder_40( this, Invocation.method( #update, [request], ), )), ) as _i18.Future<_i5.DriveFolder>); } /// A class which mocks [MisskeyDriveFiles]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyDriveFiles extends _i1.Mock implements _i5.MisskeyDriveFiles { @override _i18.Future<_i5.DriveFile> create( _i5.DriveFilesCreateRequest? request, _i12.File? fileContent, ) => (super.noSuchMethod( Invocation.method( #create, [ request, fileContent, ], ), returnValue: _i18.Future<_i5.DriveFile>.value(_FakeDriveFile_41( this, Invocation.method( #create, [ request, fileContent, ], ), )), returnValueForMissingStub: _i18.Future<_i5.DriveFile>.value(_FakeDriveFile_41( this, Invocation.method( #create, [ request, fileContent, ], ), )), ) as _i18.Future<_i5.DriveFile>); @override _i18.Future<_i5.DriveFile> createAsBinary( _i5.DriveFilesCreateRequest? request, _i28.Uint8List? fileContent, ) => (super.noSuchMethod( Invocation.method( #createAsBinary, [ request, fileContent, ], ), returnValue: _i18.Future<_i5.DriveFile>.value(_FakeDriveFile_41( this, Invocation.method( #createAsBinary, [ request, fileContent, ], ), )), returnValueForMissingStub: _i18.Future<_i5.DriveFile>.value(_FakeDriveFile_41( this, Invocation.method( #createAsBinary, [ request, fileContent, ], ), )), ) as _i18.Future<_i5.DriveFile>); @override _i18.Future<_i5.DriveFile> update(_i5.DriveFilesUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), returnValue: _i18.Future<_i5.DriveFile>.value(_FakeDriveFile_41( this, Invocation.method( #update, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.DriveFile>.value(_FakeDriveFile_41( this, Invocation.method( #update, [request], ), )), ) as _i18.Future<_i5.DriveFile>); @override _i18.Future<void> delete(_i5.DriveFilesDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.DriveFile>> files(_i5.DriveFilesRequest? request) => (super.noSuchMethod( Invocation.method( #files, [request], ), returnValue: _i18.Future<Iterable<_i5.DriveFile>>.value(<_i5.DriveFile>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.DriveFile>>.value(<_i5.DriveFile>[]), ) as _i18.Future<Iterable<_i5.DriveFile>>); @override _i18.Future<Iterable<_i5.DriveFile>> find( _i5.DriveFilesFindRequest? request) => (super.noSuchMethod( Invocation.method( #find, [request], ), returnValue: _i18.Future<Iterable<_i5.DriveFile>>.value(<_i5.DriveFile>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.DriveFile>>.value(<_i5.DriveFile>[]), ) as _i18.Future<Iterable<_i5.DriveFile>>); @override _i18.Future<Iterable<_i5.Note>> attachedNotes( _i5.DriveFilesAttachedNotesRequest? request) => (super.noSuchMethod( Invocation.method( #attachedNotes, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<bool> checkExistence( _i5.DriveFilesCheckExistenceRequest? request) => (super.noSuchMethod( Invocation.method( #checkExistence, [request], ), returnValue: _i18.Future<bool>.value(false), returnValueForMissingStub: _i18.Future<bool>.value(false), ) as _i18.Future<bool>); @override _i18.Future<Iterable<_i5.DriveFile>> findByHash( _i5.DriveFilesFindByHashRequest? request) => (super.noSuchMethod( Invocation.method( #findByHash, [request], ), returnValue: _i18.Future<Iterable<_i5.DriveFile>>.value(<_i5.DriveFile>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.DriveFile>>.value(<_i5.DriveFile>[]), ) as _i18.Future<Iterable<_i5.DriveFile>>); @override _i18.Future<_i5.DriveFile> show(_i5.DriveFilesShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.DriveFile>.value(_FakeDriveFile_41( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.DriveFile>.value(_FakeDriveFile_41( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.DriveFile>); @override _i18.Future<void> uploadFromUrl( _i5.DriveFilesUploadFromUrlRequest? request) => (super.noSuchMethod( Invocation.method( #uploadFromUrl, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyFederation]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyFederation extends _i1.Mock implements _i5.MisskeyFederation { @override _i18.Future<_i5.FederationShowInstanceResponse> showInstance( _i5.FederationShowInstanceRequest? request) => (super.noSuchMethod( Invocation.method( #showInstance, [request], ), returnValue: _i18.Future<_i5.FederationShowInstanceResponse>.value( _FakeFederationShowInstanceResponse_42( this, Invocation.method( #showInstance, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.FederationShowInstanceResponse>.value( _FakeFederationShowInstanceResponse_42( this, Invocation.method( #showInstance, [request], ), )), ) as _i18.Future<_i5.FederationShowInstanceResponse>); @override _i18.Future<Iterable<_i5.UserDetailed>> users( _i5.FederationUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), returnValue: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), ) as _i18.Future<Iterable<_i5.UserDetailed>>); } /// A class which mocks [MisskeyFollowing]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyFollowing extends _i1.Mock implements _i5.MisskeyFollowing { @override _i5.MisskeyFollowingRequests get requests => (super.noSuchMethod( Invocation.getter(#requests), returnValue: _FakeMisskeyFollowingRequests_43( this, Invocation.getter(#requests), ), returnValueForMissingStub: _FakeMisskeyFollowingRequests_43( this, Invocation.getter(#requests), ), ) as _i5.MisskeyFollowingRequests); @override _i18.Future<_i5.UserLite> create(_i5.FollowingCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<_i5.UserLite>.value(_FakeUserLite_44( this, Invocation.method( #create, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.UserLite>.value(_FakeUserLite_44( this, Invocation.method( #create, [request], ), )), ) as _i18.Future<_i5.UserLite>); @override _i18.Future<_i5.UserLite> delete(_i5.FollowingDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<_i5.UserLite>.value(_FakeUserLite_44( this, Invocation.method( #delete, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.UserLite>.value(_FakeUserLite_44( this, Invocation.method( #delete, [request], ), )), ) as _i18.Future<_i5.UserLite>); @override _i18.Future<_i5.UserLite> invalidate( _i5.FollowingInvalidateRequest? request) => (super.noSuchMethod( Invocation.method( #invalidate, [request], ), returnValue: _i18.Future<_i5.UserLite>.value(_FakeUserLite_44( this, Invocation.method( #invalidate, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.UserLite>.value(_FakeUserLite_44( this, Invocation.method( #invalidate, [request], ), )), ) as _i18.Future<_i5.UserLite>); @override _i18.Future<void> updateAll(_i5.FollowingUpdateAllRequest? request) => (super.noSuchMethod( Invocation.method( #updateAll, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyHashtags]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyHashtags extends _i1.Mock implements _i5.MisskeyHashtags { @override _i18.Future<Iterable<_i5.Hashtag>> list(_i5.HashtagsListRequest? request) => (super.noSuchMethod( Invocation.method( #list, [request], ), returnValue: _i18.Future<Iterable<_i5.Hashtag>>.value(<_i5.Hashtag>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Hashtag>>.value(<_i5.Hashtag>[]), ) as _i18.Future<Iterable<_i5.Hashtag>>); @override _i18.Future<Iterable<String>> search(_i5.HashtagsSearchRequest? request) => (super.noSuchMethod( Invocation.method( #search, [request], ), returnValue: _i18.Future<Iterable<String>>.value(<String>[]), returnValueForMissingStub: _i18.Future<Iterable<String>>.value(<String>[]), ) as _i18.Future<Iterable<String>>); @override _i18.Future<_i5.Hashtag> show(_i5.HashtagsShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.Hashtag>.value(_FakeHashtag_45( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.Hashtag>.value(_FakeHashtag_45( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.Hashtag>); @override _i18.Future<Iterable<_i5.HashtagsTrendResponse>> trend() => (super.noSuchMethod( Invocation.method( #trend, [], ), returnValue: _i18.Future<Iterable<_i5.HashtagsTrendResponse>>.value( <_i5.HashtagsTrendResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.HashtagsTrendResponse>>.value( <_i5.HashtagsTrendResponse>[]), ) as _i18.Future<Iterable<_i5.HashtagsTrendResponse>>); @override _i18.Future<Iterable<_i5.UserDetailed>> users( _i5.HashtagsUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), returnValue: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), ) as _i18.Future<Iterable<_i5.UserDetailed>>); } /// A class which mocks [MisskeyI]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyI extends _i1.Mock implements _i5.MisskeyI { @override _i5.MisskeyIRegistry get registry => (super.noSuchMethod( Invocation.getter(#registry), returnValue: _FakeMisskeyIRegistry_46( this, Invocation.getter(#registry), ), returnValueForMissingStub: _FakeMisskeyIRegistry_46( this, Invocation.getter(#registry), ), ) as _i5.MisskeyIRegistry); @override _i18.Future<_i5.MeDetailed> i() => (super.noSuchMethod( Invocation.method( #i, [], ), returnValue: _i18.Future<_i5.MeDetailed>.value(_FakeMeDetailed_47( this, Invocation.method( #i, [], ), )), returnValueForMissingStub: _i18.Future<_i5.MeDetailed>.value(_FakeMeDetailed_47( this, Invocation.method( #i, [], ), )), ) as _i18.Future<_i5.MeDetailed>); @override _i18.Future<Iterable<_i5.INotificationsResponse>> notifications( _i5.INotificationsRequest? request) => (super.noSuchMethod( Invocation.method( #notifications, [request], ), returnValue: _i18.Future<Iterable<_i5.INotificationsResponse>>.value( <_i5.INotificationsResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.INotificationsResponse>>.value( <_i5.INotificationsResponse>[]), ) as _i18.Future<Iterable<_i5.INotificationsResponse>>); @override _i18.Future<void> readAnnouncement(_i5.IReadAnnouncementRequest? request) => (super.noSuchMethod( Invocation.method( #readAnnouncement, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.IFavoritesResponse>> favorites( _i5.IFavoritesRequest? request) => (super.noSuchMethod( Invocation.method( #favorites, [request], ), returnValue: _i18.Future<Iterable<_i5.IFavoritesResponse>>.value( <_i5.IFavoritesResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.IFavoritesResponse>>.value( <_i5.IFavoritesResponse>[]), ) as _i18.Future<Iterable<_i5.IFavoritesResponse>>); @override _i18.Future<_i5.MeDetailed> update(_i5.IUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), returnValue: _i18.Future<_i5.MeDetailed>.value(_FakeMeDetailed_47( this, Invocation.method( #update, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.MeDetailed>.value(_FakeMeDetailed_47( this, Invocation.method( #update, [request], ), )), ) as _i18.Future<_i5.MeDetailed>); } /// A class which mocks [MisskeyNotes]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyNotes extends _i1.Mock implements _i5.MisskeyNotes { @override _i5.MisskeyNotesReactions get reactions => (super.noSuchMethod( Invocation.getter(#reactions), returnValue: _FakeMisskeyNotesReactions_48( this, Invocation.getter(#reactions), ), returnValueForMissingStub: _FakeMisskeyNotesReactions_48( this, Invocation.getter(#reactions), ), ) as _i5.MisskeyNotesReactions); @override _i5.MisskeyNotesFavorites get favorites => (super.noSuchMethod( Invocation.getter(#favorites), returnValue: _FakeMisskeyNotesFavorites_49( this, Invocation.getter(#favorites), ), returnValueForMissingStub: _FakeMisskeyNotesFavorites_49( this, Invocation.getter(#favorites), ), ) as _i5.MisskeyNotesFavorites); @override _i5.MisskeyNotesPolls get polls => (super.noSuchMethod( Invocation.getter(#polls), returnValue: _FakeMisskeyNotesPolls_50( this, Invocation.getter(#polls), ), returnValueForMissingStub: _FakeMisskeyNotesPolls_50( this, Invocation.getter(#polls), ), ) as _i5.MisskeyNotesPolls); @override _i5.MisskeyNotesThreadMuting get threadMuting => (super.noSuchMethod( Invocation.getter(#threadMuting), returnValue: _FakeMisskeyNotesThreadMuting_51( this, Invocation.getter(#threadMuting), ), returnValueForMissingStub: _FakeMisskeyNotesThreadMuting_51( this, Invocation.getter(#threadMuting), ), ) as _i5.MisskeyNotesThreadMuting); @override _i18.Future<void> create(_i5.NotesCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> update(_i5.NotesUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> delete(_i5.NotesDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.Note>> notes(_i5.NotesRequest? request) => (super.noSuchMethod( Invocation.method( #notes, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<_i5.Note> show(_i5.NotesShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.Note>.value(_FakeNote_52( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.Note>.value(_FakeNote_52( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.Note>); @override _i18.Future<Iterable<_i5.Note>> homeTimeline( _i5.NotesTimelineRequest? request) => (super.noSuchMethod( Invocation.method( #homeTimeline, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> localTimeline( _i5.NotesLocalTimelineRequest? request) => (super.noSuchMethod( Invocation.method( #localTimeline, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> hybridTimeline( _i5.NotesHybridTimelineRequest? request) => (super.noSuchMethod( Invocation.method( #hybridTimeline, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> globalTimeline( _i5.NotesGlobalTimelineRequest? request) => (super.noSuchMethod( Invocation.method( #globalTimeline, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> userListTimeline( _i5.UserListTimelineRequest? request) => (super.noSuchMethod( Invocation.method( #userListTimeline, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<_i5.NotesStateResponse> state(_i5.NotesStateRequest? request) => (super.noSuchMethod( Invocation.method( #state, [request], ), returnValue: _i18.Future<_i5.NotesStateResponse>.value( _FakeNotesStateResponse_53( this, Invocation.method( #state, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.NotesStateResponse>.value( _FakeNotesStateResponse_53( this, Invocation.method( #state, [request], ), )), ) as _i18.Future<_i5.NotesStateResponse>); @override _i18.Future<Iterable<_i5.Note>> search(_i5.NotesSearchRequest? request) => (super.noSuchMethod( Invocation.method( #search, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> searchByTag( _i5.NotesSearchByTagRequest? request) => (super.noSuchMethod( Invocation.method( #searchByTag, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> renotes(_i5.NotesRenoteRequest? request) => (super.noSuchMethod( Invocation.method( #renotes, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> replies(_i5.NotesRepliesRequest? request) => (super.noSuchMethod( Invocation.method( #replies, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> children(_i5.NotesChildrenRequest? request) => (super.noSuchMethod( Invocation.method( #children, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> conversation( _i5.NotesConversationRequest? request) => (super.noSuchMethod( Invocation.method( #conversation, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> featured(_i5.NotesFeaturedRequest? request) => (super.noSuchMethod( Invocation.method( #featured, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Note>> mentions(_i5.NotesMentionsRequest? request) => (super.noSuchMethod( Invocation.method( #mentions, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Clip>> clips(_i5.NotesClipsRequest? request) => (super.noSuchMethod( Invocation.method( #clips, [request], ), returnValue: _i18.Future<Iterable<_i5.Clip>>.value(<_i5.Clip>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Clip>>.value(<_i5.Clip>[]), ) as _i18.Future<Iterable<_i5.Clip>>); @override _i18.Future<void> unrenote(_i5.NotesUnrenoteRequest? request) => (super.noSuchMethod( Invocation.method( #unrenote, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<_i5.NotesTranslateResponse> translate( _i5.NotesTranslateRequest? request) => (super.noSuchMethod( Invocation.method( #translate, [request], ), returnValue: _i18.Future<_i5.NotesTranslateResponse>.value( _FakeNotesTranslateResponse_54( this, Invocation.method( #translate, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.NotesTranslateResponse>.value( _FakeNotesTranslateResponse_54( this, Invocation.method( #translate, [request], ), )), ) as _i18.Future<_i5.NotesTranslateResponse>); } /// A class which mocks [MisskeyNotesFavorites]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyNotesFavorites extends _i1.Mock implements _i5.MisskeyNotesFavorites { @override _i18.Future<void> create(_i5.NotesFavoritesCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> delete(_i5.NotesFavoritesDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyNotesReactions]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyNotesReactions extends _i1.Mock implements _i5.MisskeyNotesReactions { @override _i18.Future<void> create(_i5.NotesReactionsCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> delete(_i5.NotesReactionsDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.NotesReactionsResponse>> reactions( _i5.NotesReactionsRequest? request) => (super.noSuchMethod( Invocation.method( #reactions, [request], ), returnValue: _i18.Future<Iterable<_i5.NotesReactionsResponse>>.value( <_i5.NotesReactionsResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.NotesReactionsResponse>>.value( <_i5.NotesReactionsResponse>[]), ) as _i18.Future<Iterable<_i5.NotesReactionsResponse>>); } /// A class which mocks [MisskeyNotesPolls]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyNotesPolls extends _i1.Mock implements _i5.MisskeyNotesPolls { @override _i18.Future<void> vote(_i5.NotesPollsVoteRequest? request) => (super.noSuchMethod( Invocation.method( #vote, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.Note>> recommendation( _i5.NotesPollsRecommendationRequest? request) => (super.noSuchMethod( Invocation.method( #recommendation, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); } /// A class which mocks [MisskeyRenoteMute]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyRenoteMute extends _i1.Mock implements _i5.MisskeyRenoteMute { @override _i18.Future<void> create(_i5.RenoteMuteCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> delete(_i5.RenoteMuteDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [MisskeyRoles]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyRoles extends _i1.Mock implements _i5.MisskeyRoles { @override _i18.Future<Iterable<_i5.RolesListResponse>> list() => (super.noSuchMethod( Invocation.method( #list, [], ), returnValue: _i18.Future<Iterable<_i5.RolesListResponse>>.value( <_i5.RolesListResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.RolesListResponse>>.value( <_i5.RolesListResponse>[]), ) as _i18.Future<Iterable<_i5.RolesListResponse>>); @override _i18.Future<Iterable<_i5.RolesUsersResponse>> users( _i5.RolesUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), returnValue: _i18.Future<Iterable<_i5.RolesUsersResponse>>.value( <_i5.RolesUsersResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.RolesUsersResponse>>.value( <_i5.RolesUsersResponse>[]), ) as _i18.Future<Iterable<_i5.RolesUsersResponse>>); @override _i18.Future<_i5.RolesListResponse> show(_i5.RolesShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.RolesListResponse>.value(_FakeRolesListResponse_55( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.RolesListResponse>.value(_FakeRolesListResponse_55( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.RolesListResponse>); @override _i18.Future<Iterable<_i5.Note>> notes(_i5.RolesNotesRequest? request) => (super.noSuchMethod( Invocation.method( #notes, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); } /// A class which mocks [MisskeyUsers]. /// /// See the documentation for Mockito's code generation for more information. class MockMisskeyUsers extends _i1.Mock implements _i5.MisskeyUsers { @override _i5.MisskeyUsersLists get list => (super.noSuchMethod( Invocation.getter(#list), returnValue: _FakeMisskeyUsersLists_56( this, Invocation.getter(#list), ), returnValueForMissingStub: _FakeMisskeyUsersLists_56( this, Invocation.getter(#list), ), ) as _i5.MisskeyUsersLists); @override _i18.Future<_i5.UserDetailed> show(_i5.UsersShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), returnValue: _i18.Future<_i5.UserDetailed>.value(_FakeUserDetailed_57( this, Invocation.method( #show, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.UserDetailed>.value(_FakeUserDetailed_57( this, Invocation.method( #show, [request], ), )), ) as _i18.Future<_i5.UserDetailed>); @override _i18.Future<Iterable<_i5.UserDetailed>> showByIds( _i5.UsersShowByIdsRequest? request) => (super.noSuchMethod( Invocation.method( #showByIds, [request], ), returnValue: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), ) as _i18.Future<Iterable<_i5.UserDetailed>>); @override _i18.Future<_i5.UserDetailed> showByName( _i5.UsersShowByUserNameRequest? request) => (super.noSuchMethod( Invocation.method( #showByName, [request], ), returnValue: _i18.Future<_i5.UserDetailed>.value(_FakeUserDetailed_57( this, Invocation.method( #showByName, [request], ), )), returnValueForMissingStub: _i18.Future<_i5.UserDetailed>.value(_FakeUserDetailed_57( this, Invocation.method( #showByName, [request], ), )), ) as _i18.Future<_i5.UserDetailed>); @override _i18.Future<Iterable<_i5.Note>> notes(_i5.UsersNotesRequest? request) => (super.noSuchMethod( Invocation.method( #notes, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Clip>> clips(_i5.UsersClipsRequest? request) => (super.noSuchMethod( Invocation.method( #clips, [request], ), returnValue: _i18.Future<Iterable<_i5.Clip>>.value(<_i5.Clip>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Clip>>.value(<_i5.Clip>[]), ) as _i18.Future<Iterable<_i5.Clip>>); @override _i18.Future<Iterable<_i5.Following>> followers( _i5.UsersFollowersRequest? request) => (super.noSuchMethod( Invocation.method( #followers, [request], ), returnValue: _i18.Future<Iterable<_i5.Following>>.value(<_i5.Following>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Following>>.value(<_i5.Following>[]), ) as _i18.Future<Iterable<_i5.Following>>); @override _i18.Future<Iterable<_i5.Following>> following( _i5.UsersFollowingRequest? request) => (super.noSuchMethod( Invocation.method( #following, [request], ), returnValue: _i18.Future<Iterable<_i5.Following>>.value(<_i5.Following>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Following>>.value(<_i5.Following>[]), ) as _i18.Future<Iterable<_i5.Following>>); @override _i18.Future<void> reportAbuse(_i5.UsersReportAbuseRequest? request) => (super.noSuchMethod( Invocation.method( #reportAbuse, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.UsersReactionsResponse>> reactions( _i5.UsersReactionsRequest? request) => (super.noSuchMethod( Invocation.method( #reactions, [request], ), returnValue: _i18.Future<Iterable<_i5.UsersReactionsResponse>>.value( <_i5.UsersReactionsResponse>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.UsersReactionsResponse>>.value( <_i5.UsersReactionsResponse>[]), ) as _i18.Future<Iterable<_i5.UsersReactionsResponse>>); @override _i18.Future<Iterable<_i5.User>> search(_i5.UsersSearchRequest? request) => (super.noSuchMethod( Invocation.method( #search, [request], ), returnValue: _i18.Future<Iterable<_i5.User>>.value(<_i5.User>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.User>>.value(<_i5.User>[]), ) as _i18.Future<Iterable<_i5.User>>); @override _i18.Future<Iterable<_i5.UsersGetFrequentlyRepliedUsersResponse>> getFrequentlyRepliedUsers( _i5.UsersGetFrequentlyRepliedUsersRequest? request) => (super.noSuchMethod( Invocation.method( #getFrequentlyRepliedUsers, [request], ), returnValue: _i18.Future< Iterable<_i5.UsersGetFrequentlyRepliedUsersResponse>>.value( <_i5.UsersGetFrequentlyRepliedUsersResponse>[]), returnValueForMissingStub: _i18.Future< Iterable<_i5.UsersGetFrequentlyRepliedUsersResponse>>.value( <_i5.UsersGetFrequentlyRepliedUsersResponse>[]), ) as _i18 .Future<Iterable<_i5.UsersGetFrequentlyRepliedUsersResponse>>); @override _i18.Future<Iterable<_i5.User>> recommendation( _i5.UsersRecommendationRequest? request) => (super.noSuchMethod( Invocation.method( #recommendation, [request], ), returnValue: _i18.Future<Iterable<_i5.User>>.value(<_i5.User>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.User>>.value(<_i5.User>[]), ) as _i18.Future<Iterable<_i5.User>>); @override _i18.Future<Iterable<_i5.UserDetailed>> users( _i5.UsersUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), returnValue: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.UserDetailed>>.value(<_i5.UserDetailed>[]), ) as _i18.Future<Iterable<_i5.UserDetailed>>); @override _i18.Future<void> updateMemo(_i5.UsersUpdateMemoRequest? request) => (super.noSuchMethod( Invocation.method( #updateMemo, [request], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<Iterable<_i5.Flash>> flashs(_i5.UsersFlashsRequest? request) => (super.noSuchMethod( Invocation.method( #flashs, [request], ), returnValue: _i18.Future<Iterable<_i5.Flash>>.value(<_i5.Flash>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Flash>>.value(<_i5.Flash>[]), ) as _i18.Future<Iterable<_i5.Flash>>); @override _i18.Future<Iterable<_i5.Note>> featuredNotes( _i5.UsersFeaturedNotesRequest? request) => (super.noSuchMethod( Invocation.method( #featuredNotes, [request], ), returnValue: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Note>>.value(<_i5.Note>[]), ) as _i18.Future<Iterable<_i5.Note>>); @override _i18.Future<Iterable<_i5.Page>> pages(_i5.UsersPagesRequest? request) => (super.noSuchMethod( Invocation.method( #pages, [request], ), returnValue: _i18.Future<Iterable<_i5.Page>>.value(<_i5.Page>[]), returnValueForMissingStub: _i18.Future<Iterable<_i5.Page>>.value(<_i5.Page>[]), ) as _i18.Future<Iterable<_i5.Page>>); } /// A class which mocks [Dio]. /// /// See the documentation for Mockito's code generation for more information. class MockDio extends _i1.Mock implements _i11.Dio { @override _i11.BaseOptions get options => (super.noSuchMethod( Invocation.getter(#options), returnValue: _FakeBaseOptions_58( this, Invocation.getter(#options), ), returnValueForMissingStub: _FakeBaseOptions_58( this, Invocation.getter(#options), ), ) as _i11.BaseOptions); @override set options(_i11.BaseOptions? _options) => super.noSuchMethod( Invocation.setter( #options, _options, ), returnValueForMissingStub: null, ); @override _i11.HttpClientAdapter get httpClientAdapter => (super.noSuchMethod( Invocation.getter(#httpClientAdapter), returnValue: _FakeHttpClientAdapter_59( this, Invocation.getter(#httpClientAdapter), ), returnValueForMissingStub: _FakeHttpClientAdapter_59( this, Invocation.getter(#httpClientAdapter), ), ) as _i11.HttpClientAdapter); @override set httpClientAdapter(_i11.HttpClientAdapter? _httpClientAdapter) => super.noSuchMethod( Invocation.setter( #httpClientAdapter, _httpClientAdapter, ), returnValueForMissingStub: null, ); @override _i11.Transformer get transformer => (super.noSuchMethod( Invocation.getter(#transformer), returnValue: _FakeTransformer_60( this, Invocation.getter(#transformer), ), returnValueForMissingStub: _FakeTransformer_60( this, Invocation.getter(#transformer), ), ) as _i11.Transformer); @override set transformer(_i11.Transformer? _transformer) => super.noSuchMethod( Invocation.setter( #transformer, _transformer, ), returnValueForMissingStub: null, ); @override _i11.Interceptors get interceptors => (super.noSuchMethod( Invocation.getter(#interceptors), returnValue: _FakeInterceptors_61( this, Invocation.getter(#interceptors), ), returnValueForMissingStub: _FakeInterceptors_61( this, Invocation.getter(#interceptors), ), ) as _i11.Interceptors); @override void close({bool? force = false}) => super.noSuchMethod( Invocation.method( #close, [], {#force: force}, ), returnValueForMissingStub: null, ); @override _i18.Future<_i11.Response<T>> head<T>( String? path, { Object? data, Map<String, dynamic>? queryParameters, _i11.Options? options, _i11.CancelToken? cancelToken, }) => (super.noSuchMethod( Invocation.method( #head, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #head, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #head, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> headUri<T>( Uri? uri, { Object? data, _i11.Options? options, _i11.CancelToken? cancelToken, }) => (super.noSuchMethod( Invocation.method( #headUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #headUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #headUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> get<T>( String? path, { Object? data, Map<String, dynamic>? queryParameters, _i11.Options? options, _i11.CancelToken? cancelToken, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #get, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #get, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #get, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> getUri<T>( Uri? uri, { Object? data, _i11.Options? options, _i11.CancelToken? cancelToken, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #getUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #getUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #getUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> post<T>( String? path, { Object? data, Map<String, dynamic>? queryParameters, _i11.Options? options, _i11.CancelToken? cancelToken, _i11.ProgressCallback? onSendProgress, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #post, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #post, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #post, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> postUri<T>( Uri? uri, { Object? data, _i11.Options? options, _i11.CancelToken? cancelToken, _i11.ProgressCallback? onSendProgress, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #postUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #postUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #postUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> put<T>( String? path, { Object? data, Map<String, dynamic>? queryParameters, _i11.Options? options, _i11.CancelToken? cancelToken, _i11.ProgressCallback? onSendProgress, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #put, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #put, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #put, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> putUri<T>( Uri? uri, { Object? data, _i11.Options? options, _i11.CancelToken? cancelToken, _i11.ProgressCallback? onSendProgress, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #putUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #putUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #putUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> patch<T>( String? path, { Object? data, Map<String, dynamic>? queryParameters, _i11.Options? options, _i11.CancelToken? cancelToken, _i11.ProgressCallback? onSendProgress, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #patch, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #patch, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #patch, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> patchUri<T>( Uri? uri, { Object? data, _i11.Options? options, _i11.CancelToken? cancelToken, _i11.ProgressCallback? onSendProgress, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #patchUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #patchUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #patchUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> delete<T>( String? path, { Object? data, Map<String, dynamic>? queryParameters, _i11.Options? options, _i11.CancelToken? cancelToken, }) => (super.noSuchMethod( Invocation.method( #delete, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #delete, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #delete, [path], { #data: data, #queryParameters: queryParameters, #options: options, #cancelToken: cancelToken, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> deleteUri<T>( Uri? uri, { Object? data, _i11.Options? options, _i11.CancelToken? cancelToken, }) => (super.noSuchMethod( Invocation.method( #deleteUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #deleteUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #deleteUri, [uri], { #data: data, #options: options, #cancelToken: cancelToken, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<dynamic>> download( String? urlPath, dynamic savePath, { _i11.ProgressCallback? onReceiveProgress, Map<String, dynamic>? queryParameters, _i11.CancelToken? cancelToken, bool? deleteOnError = true, String? lengthHeader = r'content-length', Object? data, _i11.Options? options, }) => (super.noSuchMethod( Invocation.method( #download, [ urlPath, savePath, ], { #onReceiveProgress: onReceiveProgress, #queryParameters: queryParameters, #cancelToken: cancelToken, #deleteOnError: deleteOnError, #lengthHeader: lengthHeader, #data: data, #options: options, }, ), returnValue: _i18.Future<_i11.Response<dynamic>>.value(_FakeResponse_62<dynamic>( this, Invocation.method( #download, [ urlPath, savePath, ], { #onReceiveProgress: onReceiveProgress, #queryParameters: queryParameters, #cancelToken: cancelToken, #deleteOnError: deleteOnError, #lengthHeader: lengthHeader, #data: data, #options: options, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<dynamic>>.value(_FakeResponse_62<dynamic>( this, Invocation.method( #download, [ urlPath, savePath, ], { #onReceiveProgress: onReceiveProgress, #queryParameters: queryParameters, #cancelToken: cancelToken, #deleteOnError: deleteOnError, #lengthHeader: lengthHeader, #data: data, #options: options, }, ), )), ) as _i18.Future<_i11.Response<dynamic>>); @override _i18.Future<_i11.Response<dynamic>> downloadUri( Uri? uri, dynamic savePath, { _i11.ProgressCallback? onReceiveProgress, _i11.CancelToken? cancelToken, bool? deleteOnError = true, String? lengthHeader = r'content-length', Object? data, _i11.Options? options, }) => (super.noSuchMethod( Invocation.method( #downloadUri, [ uri, savePath, ], { #onReceiveProgress: onReceiveProgress, #cancelToken: cancelToken, #deleteOnError: deleteOnError, #lengthHeader: lengthHeader, #data: data, #options: options, }, ), returnValue: _i18.Future<_i11.Response<dynamic>>.value(_FakeResponse_62<dynamic>( this, Invocation.method( #downloadUri, [ uri, savePath, ], { #onReceiveProgress: onReceiveProgress, #cancelToken: cancelToken, #deleteOnError: deleteOnError, #lengthHeader: lengthHeader, #data: data, #options: options, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<dynamic>>.value(_FakeResponse_62<dynamic>( this, Invocation.method( #downloadUri, [ uri, savePath, ], { #onReceiveProgress: onReceiveProgress, #cancelToken: cancelToken, #deleteOnError: deleteOnError, #lengthHeader: lengthHeader, #data: data, #options: options, }, ), )), ) as _i18.Future<_i11.Response<dynamic>>); @override _i18.Future<_i11.Response<T>> request<T>( String? url, { Object? data, Map<String, dynamic>? queryParameters, _i11.CancelToken? cancelToken, _i11.Options? options, _i11.ProgressCallback? onSendProgress, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #request, [url], { #data: data, #queryParameters: queryParameters, #cancelToken: cancelToken, #options: options, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #request, [url], { #data: data, #queryParameters: queryParameters, #cancelToken: cancelToken, #options: options, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #request, [url], { #data: data, #queryParameters: queryParameters, #cancelToken: cancelToken, #options: options, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> requestUri<T>( Uri? uri, { Object? data, _i11.CancelToken? cancelToken, _i11.Options? options, _i11.ProgressCallback? onSendProgress, _i11.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( Invocation.method( #requestUri, [uri], { #data: data, #cancelToken: cancelToken, #options: options, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #requestUri, [uri], { #data: data, #cancelToken: cancelToken, #options: options, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #requestUri, [uri], { #data: data, #cancelToken: cancelToken, #options: options, #onSendProgress: onSendProgress, #onReceiveProgress: onReceiveProgress, }, ), )), ) as _i18.Future<_i11.Response<T>>); @override _i18.Future<_i11.Response<T>> fetch<T>(_i11.RequestOptions? requestOptions) => (super.noSuchMethod( Invocation.method( #fetch, [requestOptions], ), returnValue: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #fetch, [requestOptions], ), )), returnValueForMissingStub: _i18.Future<_i11.Response<T>>.value(_FakeResponse_62<T>( this, Invocation.method( #fetch, [requestOptions], ), )), ) as _i18.Future<_i11.Response<T>>); } /// A class which mocks [HttpClient]. /// /// See the documentation for Mockito's code generation for more information. class MockHttpClient extends _i1.Mock implements _i12.HttpClient { @override Duration get idleTimeout => (super.noSuchMethod( Invocation.getter(#idleTimeout), returnValue: _FakeDuration_63( this, Invocation.getter(#idleTimeout), ), returnValueForMissingStub: _FakeDuration_63( this, Invocation.getter(#idleTimeout), ), ) as Duration); @override set idleTimeout(Duration? _idleTimeout) => super.noSuchMethod( Invocation.setter( #idleTimeout, _idleTimeout, ), returnValueForMissingStub: null, ); @override set connectionTimeout(Duration? _connectionTimeout) => super.noSuchMethod( Invocation.setter( #connectionTimeout, _connectionTimeout, ), returnValueForMissingStub: null, ); @override set maxConnectionsPerHost(int? _maxConnectionsPerHost) => super.noSuchMethod( Invocation.setter( #maxConnectionsPerHost, _maxConnectionsPerHost, ), returnValueForMissingStub: null, ); @override bool get autoUncompress => (super.noSuchMethod( Invocation.getter(#autoUncompress), returnValue: false, returnValueForMissingStub: false, ) as bool); @override set autoUncompress(bool? _autoUncompress) => super.noSuchMethod( Invocation.setter( #autoUncompress, _autoUncompress, ), returnValueForMissingStub: null, ); @override set userAgent(String? _userAgent) => super.noSuchMethod( Invocation.setter( #userAgent, _userAgent, ), returnValueForMissingStub: null, ); @override set authenticate( _i18.Future<bool> Function( Uri, String, String?, )? f) => super.noSuchMethod( Invocation.setter( #authenticate, f, ), returnValueForMissingStub: null, ); @override set connectionFactory( _i18.Future<_i12.ConnectionTask<_i12.Socket>> Function( Uri, String?, int?, )? f) => super.noSuchMethod( Invocation.setter( #connectionFactory, f, ), returnValueForMissingStub: null, ); @override set findProxy(String Function(Uri)? f) => super.noSuchMethod( Invocation.setter( #findProxy, f, ), returnValueForMissingStub: null, ); @override set authenticateProxy( _i18.Future<bool> Function( String, int, String, String?, )? f) => super.noSuchMethod( Invocation.setter( #authenticateProxy, f, ), returnValueForMissingStub: null, ); @override set badCertificateCallback( bool Function( _i12.X509Certificate, String, int, )? callback) => super.noSuchMethod( Invocation.setter( #badCertificateCallback, callback, ), returnValueForMissingStub: null, ); @override set keyLog(dynamic Function(String)? callback) => super.noSuchMethod( Invocation.setter( #keyLog, callback, ), returnValueForMissingStub: null, ); @override _i18.Future<_i12.HttpClientRequest> open( String? method, String? host, int? port, String? path, ) => (super.noSuchMethod( Invocation.method( #open, [ method, host, port, path, ], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #open, [ method, host, port, path, ], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #open, [ method, host, port, path, ], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> openUrl( String? method, Uri? url, ) => (super.noSuchMethod( Invocation.method( #openUrl, [ method, url, ], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #openUrl, [ method, url, ], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #openUrl, [ method, url, ], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> get( String? host, int? port, String? path, ) => (super.noSuchMethod( Invocation.method( #get, [ host, port, path, ], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #get, [ host, port, path, ], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #get, [ host, port, path, ], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> getUrl(Uri? url) => (super.noSuchMethod( Invocation.method( #getUrl, [url], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #getUrl, [url], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #getUrl, [url], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> post( String? host, int? port, String? path, ) => (super.noSuchMethod( Invocation.method( #post, [ host, port, path, ], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #post, [ host, port, path, ], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #post, [ host, port, path, ], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> postUrl(Uri? url) => (super.noSuchMethod( Invocation.method( #postUrl, [url], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #postUrl, [url], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #postUrl, [url], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> put( String? host, int? port, String? path, ) => (super.noSuchMethod( Invocation.method( #put, [ host, port, path, ], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #put, [ host, port, path, ], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #put, [ host, port, path, ], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> putUrl(Uri? url) => (super.noSuchMethod( Invocation.method( #putUrl, [url], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #putUrl, [url], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #putUrl, [url], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> delete( String? host, int? port, String? path, ) => (super.noSuchMethod( Invocation.method( #delete, [ host, port, path, ], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #delete, [ host, port, path, ], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #delete, [ host, port, path, ], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> deleteUrl(Uri? url) => (super.noSuchMethod( Invocation.method( #deleteUrl, [url], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #deleteUrl, [url], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #deleteUrl, [url], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> patch( String? host, int? port, String? path, ) => (super.noSuchMethod( Invocation.method( #patch, [ host, port, path, ], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #patch, [ host, port, path, ], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #patch, [ host, port, path, ], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> patchUrl(Uri? url) => (super.noSuchMethod( Invocation.method( #patchUrl, [url], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #patchUrl, [url], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #patchUrl, [url], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> head( String? host, int? port, String? path, ) => (super.noSuchMethod( Invocation.method( #head, [ host, port, path, ], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #head, [ host, port, path, ], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #head, [ host, port, path, ], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override _i18.Future<_i12.HttpClientRequest> headUrl(Uri? url) => (super.noSuchMethod( Invocation.method( #headUrl, [url], ), returnValue: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #headUrl, [url], ), )), returnValueForMissingStub: _i18.Future<_i12.HttpClientRequest>.value(_FakeHttpClientRequest_64( this, Invocation.method( #headUrl, [url], ), )), ) as _i18.Future<_i12.HttpClientRequest>); @override void addCredentials( Uri? url, String? realm, _i12.HttpClientCredentials? credentials, ) => super.noSuchMethod( Invocation.method( #addCredentials, [ url, realm, credentials, ], ), returnValueForMissingStub: null, ); @override void addProxyCredentials( String? host, int? port, String? realm, _i12.HttpClientCredentials? credentials, ) => super.noSuchMethod( Invocation.method( #addProxyCredentials, [ host, port, realm, credentials, ], ), returnValueForMissingStub: null, ); @override void close({bool? force = false}) => super.noSuchMethod( Invocation.method( #close, [], {#force: force}, ), returnValueForMissingStub: null, ); } /// A class which mocks [SocketController]. /// /// See the documentation for Mockito's code generation for more information. class MockSocketController extends _i1.Mock implements _i5.SocketController { @override _i5.StreamingService get service => (super.noSuchMethod( Invocation.getter(#service), returnValue: _FakeStreamingService_6( this, Invocation.getter(#service), ), returnValueForMissingStub: _FakeStreamingService_6( this, Invocation.getter(#service), ), ) as _i5.StreamingService); @override String get id => (super.noSuchMethod( Invocation.getter(#id), returnValue: _i27.dummyValue<String>( this, Invocation.getter(#id), ), returnValueForMissingStub: _i27.dummyValue<String>( this, Invocation.getter(#id), ), ) as String); @override _i29.Channel get channel => (super.noSuchMethod( Invocation.getter(#channel), returnValue: _i29.Channel.homeTimeline, returnValueForMissingStub: _i29.Channel.homeTimeline, ) as _i29.Channel); @override bool get isDisconnected => (super.noSuchMethod( Invocation.getter(#isDisconnected), returnValue: false, returnValueForMissingStub: false, ) as bool); @override set isDisconnected(bool? _isDisconnected) => super.noSuchMethod( Invocation.setter( #isDisconnected, _isDisconnected, ), returnValueForMissingStub: null, ); @override _i13.WebSocketChannel get webSocketChannel => (super.noSuchMethod( Invocation.getter(#webSocketChannel), returnValue: _FakeWebSocketChannel_65( this, Invocation.getter(#webSocketChannel), ), returnValueForMissingStub: _FakeWebSocketChannel_65( this, Invocation.getter(#webSocketChannel), ), ) as _i13.WebSocketChannel); @override void connect() => super.noSuchMethod( Invocation.method( #connect, [], ), returnValueForMissingStub: null, ); @override void disconnect() => super.noSuchMethod( Invocation.method( #disconnect, [], ), returnValueForMissingStub: null, ); @override void reconnect() => super.noSuchMethod( Invocation.method( #reconnect, [], ), returnValueForMissingStub: null, ); @override _i18.Future<void> subNote(String? noteId) => (super.noSuchMethod( Invocation.method( #subNote, [noteId], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> unsubNote(String? noteId) => (super.noSuchMethod( Invocation.method( #unsubNote, [noteId], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> requestLog({ String? id, int? length, }) => (super.noSuchMethod( Invocation.method( #requestLog, [], { #id: id, #length: length, }, ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> send( _i5.StreamingRequestType? requestType, _i30.StreamingRequestBody? body, ) => (super.noSuchMethod( Invocation.method( #send, [ requestType, body, ], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [StreamingService]. /// /// See the documentation for Mockito's code generation for more information. class MockStreamingService extends _i1.Mock implements _i5.StreamingService { @override String get host => (super.noSuchMethod( Invocation.getter(#host), returnValue: _i27.dummyValue<String>( this, Invocation.getter(#host), ), returnValueForMissingStub: _i27.dummyValue<String>( this, Invocation.getter(#host), ), ) as String); @override _i31.HashMap<String, _i5.SocketController> get streamingChannelControllers => (super.noSuchMethod( Invocation.getter(#streamingChannelControllers), returnValue: _i27.dummyValue<_i31.HashMap<String, _i5.SocketController>>( this, Invocation.getter(#streamingChannelControllers), ), returnValueForMissingStub: _i27.dummyValue<_i31.HashMap<String, _i5.SocketController>>( this, Invocation.getter(#streamingChannelControllers), ), ) as _i31.HashMap<String, _i5.SocketController>); @override set subscription(_i18.StreamSubscription<dynamic>? _subscription) => super.noSuchMethod( Invocation.setter( #subscription, _subscription, ), returnValueForMissingStub: null, ); @override _i13.WebSocketChannel get webSocketChannel => (super.noSuchMethod( Invocation.getter(#webSocketChannel), returnValue: _FakeWebSocketChannel_65( this, Invocation.getter(#webSocketChannel), ), returnValueForMissingStub: _FakeWebSocketChannel_65( this, Invocation.getter(#webSocketChannel), ), ) as _i13.WebSocketChannel); @override _i18.Future<void> onChannelEventReceived( String? id, _i32.ChannelEventType? type, dynamic body, ) => (super.noSuchMethod( Invocation.method( #onChannelEventReceived, [ id, type, body, ], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> onNoteUpdatedEventReceived( String? id, _i33.NoteUpdatedEventType? type, Map<String, dynamic>? body, ) => (super.noSuchMethod( Invocation.method( #onNoteUpdatedEventReceived, [ id, type, body, ], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> onBroadcastEventReceived( _i34.BroadcastEventType? type, Map<String, dynamic>? body, ) => (super.noSuchMethod( Invocation.method( #onBroadcastEventReceived, [ type, body, ], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> startStreaming() => (super.noSuchMethod( Invocation.method( #startStreaming, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i5.SocketController connect({ String? id, required _i29.Channel? channel, _i18.Future<void> Function( _i32.ChannelEventType, dynamic, )? onChannelEventReceived, _i18.Future<void> Function( String, _i33.NoteUpdatedEventType, Map<String, dynamic>, )? onNoteUpdatedEventReceived, _i18.Future<void> Function( _i34.BroadcastEventType, Map<String, dynamic>, )? onBroadcastEventReceived, Map<String, dynamic>? parameters, }) => (super.noSuchMethod( Invocation.method( #connect, [], { #id: id, #channel: channel, #onChannelEventReceived: onChannelEventReceived, #onNoteUpdatedEventReceived: onNoteUpdatedEventReceived, #onBroadcastEventReceived: onBroadcastEventReceived, #parameters: parameters, }, ), returnValue: _FakeSocketController_33( this, Invocation.method( #connect, [], { #id: id, #channel: channel, #onChannelEventReceived: onChannelEventReceived, #onNoteUpdatedEventReceived: onNoteUpdatedEventReceived, #onBroadcastEventReceived: onBroadcastEventReceived, #parameters: parameters, }, ), ), returnValueForMissingStub: _FakeSocketController_33( this, Invocation.method( #connect, [], { #id: id, #channel: channel, #onChannelEventReceived: onChannelEventReceived, #onNoteUpdatedEventReceived: onNoteUpdatedEventReceived, #onBroadcastEventReceived: onBroadcastEventReceived, #parameters: parameters, }, ), ), ) as _i5.SocketController); @override _i18.Future<void> close() => (super.noSuchMethod( Invocation.method( #close, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> restart() => (super.noSuchMethod( Invocation.method( #restart, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [FakeFilePickerPlatform]. /// /// See the documentation for Mockito's code generation for more information. class MockFilePickerPlatform extends _i1.Mock implements _i35.FakeFilePickerPlatform { @override _i18.Future<_i36.FilePickerResult?> pickFiles({ String? dialogTitle, String? initialDirectory, _i36.FileType? type = _i36.FileType.any, List<String>? allowedExtensions, dynamic Function(_i36.FilePickerStatus)? onFileLoading, bool? allowCompression = true, bool? allowMultiple = false, bool? withData = false, bool? withReadStream = false, bool? lockParentWindow = false, }) => (super.noSuchMethod( Invocation.method( #pickFiles, [], { #dialogTitle: dialogTitle, #initialDirectory: initialDirectory, #type: type, #allowedExtensions: allowedExtensions, #onFileLoading: onFileLoading, #allowCompression: allowCompression, #allowMultiple: allowMultiple, #withData: withData, #withReadStream: withReadStream, #lockParentWindow: lockParentWindow, }, ), returnValue: _i18.Future<_i36.FilePickerResult?>.value(), returnValueForMissingStub: _i18.Future<_i36.FilePickerResult?>.value(), ) as _i18.Future<_i36.FilePickerResult?>); @override _i18.Future<bool?> clearTemporaryFiles() => (super.noSuchMethod( Invocation.method( #clearTemporaryFiles, [], ), returnValue: _i18.Future<bool?>.value(), returnValueForMissingStub: _i18.Future<bool?>.value(), ) as _i18.Future<bool?>); @override _i18.Future<String?> getDirectoryPath({ String? dialogTitle, bool? lockParentWindow = false, String? initialDirectory, }) => (super.noSuchMethod( Invocation.method( #getDirectoryPath, [], { #dialogTitle: dialogTitle, #lockParentWindow: lockParentWindow, #initialDirectory: initialDirectory, }, ), returnValue: _i18.Future<String?>.value(), returnValueForMissingStub: _i18.Future<String?>.value(), ) as _i18.Future<String?>); @override _i18.Future<String?> saveFile({ String? dialogTitle, String? fileName, String? initialDirectory, _i36.FileType? type = _i36.FileType.any, List<String>? allowedExtensions, bool? lockParentWindow = false, }) => (super.noSuchMethod( Invocation.method( #saveFile, [], { #dialogTitle: dialogTitle, #fileName: fileName, #initialDirectory: initialDirectory, #type: type, #allowedExtensions: allowedExtensions, #lockParentWindow: lockParentWindow, }, ), returnValue: _i18.Future<String?>.value(), returnValueForMissingStub: _i18.Future<String?>.value(), ) as _i18.Future<String?>); } /// A class which mocks [$MockBaseCacheManager]. /// /// See the documentation for Mockito's code generation for more information. class MockBaseCacheManager extends _i1.Mock implements _i35.$MockBaseCacheManager { @override _i18.Future<_i14.File> getSingleFile( String? url, { String? key, Map<String, String>? headers, }) => (super.noSuchMethod( Invocation.method( #getSingleFile, [url], { #key: key, #headers: headers, }, ), returnValue: _i18.Future<_i14.File>.value(_FakeFile_66( this, Invocation.method( #getSingleFile, [url], { #key: key, #headers: headers, }, ), )), returnValueForMissingStub: _i18.Future<_i14.File>.value(_FakeFile_66( this, Invocation.method( #getSingleFile, [url], { #key: key, #headers: headers, }, ), )), ) as _i18.Future<_i14.File>); @override _i18.Stream<_i15.FileInfo> getFile( String? url, { String? key, Map<String, String>? headers, }) => (super.noSuchMethod( Invocation.method( #getFile, [url], { #key: key, #headers: headers, }, ), returnValue: _i18.Stream<_i15.FileInfo>.empty(), returnValueForMissingStub: _i18.Stream<_i15.FileInfo>.empty(), ) as _i18.Stream<_i15.FileInfo>); @override _i18.Stream<_i15.FileResponse> getFileStream( String? url, { String? key, Map<String, String>? headers, bool? withProgress, }) => (super.noSuchMethod( Invocation.method( #getFileStream, [url], { #key: key, #headers: headers, #withProgress: withProgress, }, ), returnValue: _i18.Stream<_i15.FileResponse>.empty(), returnValueForMissingStub: _i18.Stream<_i15.FileResponse>.empty(), ) as _i18.Stream<_i15.FileResponse>); @override _i18.Future<_i15.FileInfo> downloadFile( String? url, { String? key, Map<String, String>? authHeaders, bool? force = false, }) => (super.noSuchMethod( Invocation.method( #downloadFile, [url], { #key: key, #authHeaders: authHeaders, #force: force, }, ), returnValue: _i18.Future<_i15.FileInfo>.value(_FakeFileInfo_67( this, Invocation.method( #downloadFile, [url], { #key: key, #authHeaders: authHeaders, #force: force, }, ), )), returnValueForMissingStub: _i18.Future<_i15.FileInfo>.value(_FakeFileInfo_67( this, Invocation.method( #downloadFile, [url], { #key: key, #authHeaders: authHeaders, #force: force, }, ), )), ) as _i18.Future<_i15.FileInfo>); @override _i18.Future<_i15.FileInfo?> getFileFromCache( String? key, { bool? ignoreMemCache = false, }) => (super.noSuchMethod( Invocation.method( #getFileFromCache, [key], {#ignoreMemCache: ignoreMemCache}, ), returnValue: _i18.Future<_i15.FileInfo?>.value(), returnValueForMissingStub: _i18.Future<_i15.FileInfo?>.value(), ) as _i18.Future<_i15.FileInfo?>); @override _i18.Future<_i15.FileInfo?> getFileFromMemory(String? key) => (super.noSuchMethod( Invocation.method( #getFileFromMemory, [key], ), returnValue: _i18.Future<_i15.FileInfo?>.value(), returnValueForMissingStub: _i18.Future<_i15.FileInfo?>.value(), ) as _i18.Future<_i15.FileInfo?>); @override _i18.Future<_i14.File> putFile( String? url, _i28.Uint8List? fileBytes, { String? key, String? eTag, Duration? maxAge = const Duration(days: 30), String? fileExtension = r'file', }) => (super.noSuchMethod( Invocation.method( #putFile, [ url, fileBytes, ], { #key: key, #eTag: eTag, #maxAge: maxAge, #fileExtension: fileExtension, }, ), returnValue: _i18.Future<_i14.File>.value(_FakeFile_66( this, Invocation.method( #putFile, [ url, fileBytes, ], { #key: key, #eTag: eTag, #maxAge: maxAge, #fileExtension: fileExtension, }, ), )), returnValueForMissingStub: _i18.Future<_i14.File>.value(_FakeFile_66( this, Invocation.method( #putFile, [ url, fileBytes, ], { #key: key, #eTag: eTag, #maxAge: maxAge, #fileExtension: fileExtension, }, ), )), ) as _i18.Future<_i14.File>); @override _i18.Future<_i14.File> putFileStream( String? url, _i18.Stream<List<int>>? source, { String? key, String? eTag, Duration? maxAge = const Duration(days: 30), String? fileExtension = r'file', }) => (super.noSuchMethod( Invocation.method( #putFileStream, [ url, source, ], { #key: key, #eTag: eTag, #maxAge: maxAge, #fileExtension: fileExtension, }, ), returnValue: _i18.Future<_i14.File>.value(_FakeFile_66( this, Invocation.method( #putFileStream, [ url, source, ], { #key: key, #eTag: eTag, #maxAge: maxAge, #fileExtension: fileExtension, }, ), )), returnValueForMissingStub: _i18.Future<_i14.File>.value(_FakeFile_66( this, Invocation.method( #putFileStream, [ url, source, ], { #key: key, #eTag: eTag, #maxAge: maxAge, #fileExtension: fileExtension, }, ), )), ) as _i18.Future<_i14.File>); @override _i18.Future<void> removeFile(String? key) => (super.noSuchMethod( Invocation.method( #removeFile, [key], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> emptyCache() => (super.noSuchMethod( Invocation.method( #emptyCache, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<void> dispose() => (super.noSuchMethod( Invocation.method( #dispose, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); } /// A class which mocks [$MockUrlLauncherPlatform]. /// /// See the documentation for Mockito's code generation for more information. class MockUrlLauncherPlatform extends _i1.Mock implements _i35.$MockUrlLauncherPlatform { @override _i18.Future<bool> canLaunch(String? url) => (super.noSuchMethod( Invocation.method( #canLaunch, [url], ), returnValue: _i18.Future<bool>.value(false), returnValueForMissingStub: _i18.Future<bool>.value(false), ) as _i18.Future<bool>); @override _i18.Future<bool> launch( String? url, { required bool? useSafariVC, required bool? useWebView, required bool? enableJavaScript, required bool? enableDomStorage, required bool? universalLinksOnly, required Map<String, String>? headers, String? webOnlyWindowName, }) => (super.noSuchMethod( Invocation.method( #launch, [url], { #useSafariVC: useSafariVC, #useWebView: useWebView, #enableJavaScript: enableJavaScript, #enableDomStorage: enableDomStorage, #universalLinksOnly: universalLinksOnly, #headers: headers, #webOnlyWindowName: webOnlyWindowName, }, ), returnValue: _i18.Future<bool>.value(false), returnValueForMissingStub: _i18.Future<bool>.value(false), ) as _i18.Future<bool>); @override _i18.Future<bool> launchUrl( String? url, _i37.LaunchOptions? options, ) => (super.noSuchMethod( Invocation.method( #launchUrl, [ url, options, ], ), returnValue: _i18.Future<bool>.value(false), returnValueForMissingStub: _i18.Future<bool>.value(false), ) as _i18.Future<bool>); @override _i18.Future<void> closeWebView() => (super.noSuchMethod( Invocation.method( #closeWebView, [], ), returnValue: _i18.Future<void>.value(), returnValueForMissingStub: _i18.Future<void>.value(), ) as _i18.Future<void>); @override _i18.Future<bool> supportsMode(_i37.PreferredLaunchMode? mode) => (super.noSuchMethod( Invocation.method( #supportsMode, [mode], ), returnValue: _i18.Future<bool>.value(false), returnValueForMissingStub: _i18.Future<bool>.value(false), ) as _i18.Future<bool>); @override _i18.Future<bool> supportsCloseForMode(_i37.PreferredLaunchMode? mode) => (super.noSuchMethod( Invocation.method( #supportsCloseForMode, [mode], ), returnValue: _i18.Future<bool>.value(false), returnValueForMissingStub: _i18.Future<bool>.value(false), ) as _i18.Future<bool>); }
0
mirrored_repositories/miria/test
mirrored_repositories/miria/test/test_util/test_datas.dart
import 'package:dio/dio.dart'; import 'package:flutter/services.dart'; import 'package:miria/model/account.dart'; import 'package:miria/model/misskey_emoji_data.dart'; import 'package:miria/repository/emoji_repository.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:json5/json5.dart'; class TestData { static Account account = Account( host: "example.miria.shiosyakeyakini.info", userId: "ai", i: i1, meta: meta); // i static MeDetailed i1 = MeDetailed.fromJson(JSON5.parse(r""" { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://nos3.arkjp.net/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], url: null, uri: null, movedTo: null, alsoKnownAs: null, createdAt: '2019-04-14T17:11:39.168Z', updatedAt: '2023-06-18T09:07:08.676Z', lastFetchedAt: null, bannerUrl: null, bannerBlurhash: null, isLocked: false, isSilenced: false, isSuspended: false, description: 'Misskey常駐AIの藍です!\nよろしくお願いします♪\n\n[私のサイト](https://xn--931a.moe/) | [説明書](https://github.com/syuilo/ai/blob/master/torisetu.md)\n\nRepository: [Public](https://github.com/syuilo/ai)', location: 'Misskey', birthday: '2018-03-12', lang: null, fields: [], followersCount: 10044, followingCount: 923, notesCount: 63713, pinnedNoteIds: [], pinnedNotes: [], pinnedPageId: '7uz2kemwz7', pinnedPage: { id: '7uz2kemwz7', createdAt: '2019-07-09T07:40:46.232Z', updatedAt: '2019-07-09T08:13:21.048Z', userId: '7rkr3b1c1c', user: { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://nos3.arkjp.net/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, content: [ { id: 'b6faa1ad-c38a-41df-b8fb-c1c486c40b6c', var: null, text: '私とリバーシで遊ぶ', type: 'button', event: 'inviteReversi', action: 'pushEvent', content: null, message: '招待を送信しましたよ~', primary: true, }, ], variables: [], title: 'コントロールパネル', name: 'cp', summary: null, hideTitleWhenPinned: true, alignCenter: true, font: 'sans-serif', script: '', eyeCatchingImageId: null, eyeCatchingImage: null, attachedFiles: [], likedCount: 10, isLiked: false, }, publicReactions: true, ffVisibility: 'public', twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, roles: [ { id: '9ablrt3x4q', name: '5年生', color: null, iconUrl: null, description: 'Misskey.ioを使い始めて4年経過\nドライブの容量が18GBに', isModerator: false, isAdministrator: false, displayOrder: 0, }, ], memo: null, avatarId: '9daib14i0n', bannerId: null, isModerator: false, isAdmin: false, injectFeaturedNote: true, receiveAnnouncementEmail: true, alwaysMarkNsfw: false, autoSensitive: false, carefulBot: false, autoAcceptFollowed: true, noCrawle: false, preventAiLearning: true, isExplorable: true, isDeleted: false, hideOnlineStatus: false, hasUnreadSpecifiedNotes: false, hasUnreadMentions: true, hasUnreadAnnouncement: false, hasUnreadAntenna: false, hasUnreadChannel: false, hasUnreadNotification: false, hasPendingReceivedFollowRequest: false, mutedWords: [], mutedInstances: [], mutingNotificationTypes: [], emailNotificationTypes: [], achievements: [ { name: 'profileFilled', unlockedAt: 1677997663681, }, { name: 'notes1', unlockedAt: 1677997809183, }, { name: 'following1', unlockedAt: 1677998411734, }, { name: 'notes10', unlockedAt: 1678000046923, }, { name: 'followers1', unlockedAt: 1678000047369, }, { name: 'client30min', unlockedAt: 1678000425238, }, { name: 'noteDeletedWithin1min', unlockedAt: 1678006086467, }, { name: 'markedAsCat', unlockedAt: 1678007404127, }, { name: 'myNoteFavorited1', unlockedAt: 1678046566031, }, { name: 'notes100', unlockedAt: 1678056770606, }, { name: 'login3', unlockedAt: 1678158483645, }, { name: 'followers10', unlockedAt: 1678164920521, }, { name: 'justPlainLucky', unlockedAt: 1678197492040, }, { name: 'postedAtLateNight', unlockedAt: 1678208168178, }, { name: 'notes500', unlockedAt: 1678462799750, }, { name: 'login7', unlockedAt: 1678493208768, }, { name: 'cookieClicked', unlockedAt: 1678728772558, }, { name: 'setNameToSyuilo', unlockedAt: 1678874929956, }, { name: 'following10', unlockedAt: 1679161251123, }, { name: 'login15', unlockedAt: 1679184043190, }, { name: 'viewAchievements3min', unlockedAt: 1679372673841, }, { name: 'noteFavorited1', unlockedAt: 1679397225817, }, { name: 'foundTreasure', unlockedAt: 1679403516530, }, { name: 'viewInstanceChart', unlockedAt: 1679403534059, }, { name: 'notes1000', unlockedAt: 1679523232889, }, { name: 'clickedClickHere', unlockedAt: 1679608162658, }, { name: 'followers50', unlockedAt: 1679647726001, }, { name: 'noteClipped1', unlockedAt: 1679753557164, }, { name: 'open3windows', unlockedAt: 1679825038902, }, { name: 'login30', unlockedAt: 1680481495564, }, { name: 'collectAchievements30', unlockedAt: 1680481496059, }, { name: 'selfQuote', unlockedAt: 1680753122971, }, { name: 'followers100', unlockedAt: 1681737681046, }, { name: 'following50', unlockedAt: 1682048324638, }, { name: 'postedAt0min0sec', unlockedAt: 1682373600789, }, { name: 'login60', unlockedAt: 1683073668394, }, { name: 'client60min', unlockedAt: 1683753050911, }, { name: 'iLoveMisskey', unlockedAt: 1684281873048, }, { name: 'notes5000', unlockedAt: 1685754168611, }, { name: 'login100', unlockedAt: 1686540317625, }, { name: 'loggedInOnBirthday', unlockedAt: 1686962479605, }, { name: 'following100', unlockedAt: 1687071751035, }, ], loggedInDays: 106, policies: { gtlAvailable: true, ltlAvailable: true, canPublicNote: true, canInvite: false, canManageCustomEmojis: false, canSearchNotes: true, canHideAds: true, driveCapacityMb: 51200, alwaysMarkNsfw: false, pinLimit: 10, antennaLimit: 20, wordMuteLimit: 500, webhookLimit: 10, clipLimit: 50, noteEachClipsLimit: 200, userListLimit: 20, userEachUserListsLimit: 100, rateLimitFactor: 1.5, }, email: '[email protected]', emailVerified: true, securityKeysList: [], } """)); // note /// 自身のノート(藍ちゃん)1 static Note note1 = Note.fromJson(JSON5.parse(r''' { id: '9g3rcngj3e', createdAt: '2023-06-17T16:08:52.675Z', userId: '7rkr3b1c1c', user: { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://nos3.arkjp.net/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, text: '気づいたら、健康保険証っぽいプラズマ化したつまようじの賞味期限が切れてました…', cw: null, visibility: 'public', localOnly: false, reactionAcceptance: null, renoteCount: 2, repliesCount: 0, reactions: { '❤': 1, ':aane@.:': 1, ':tsuyoi@.:': 2, ':thinkhappy@.:': 9, ':mareniyokuaru@.:': 2, ':sonnakotoarunda@.:': 1, ':hontou_ni_tabete_simattanoka@.:': 2, }, reactionEmojis: {}, fileIds: [], files: [], replyId: null, renoteId: null, } ''')); static Note note2 = Note.fromJson(JSON5.parse(r''' { id: '9g4rtxu236', createdAt: '2023-06-18T09:10:05.450Z', userId: '7rkr3b1c1c', user: { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://nos3.arkjp.net/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, text: 'みにゃさん、数取りゲームしましょう!\n0~100の中で最も大きい数字を取った人が勝ちです。他の人と被ったらだめですよ~\n制限時間は10分です。数字はこの投稿にリプライで送ってくださいね!', cw: null, visibility: 'public', localOnly: false, reactionAcceptance: null, renoteCount: 0, repliesCount: 35, reactions: { ':tondemonee_mattetanda@.:': 3, ':taisen_yorosiku_onegaisimasu@.:': 1, ':tatakau_riyuu_ha_mitukatta_ka__q@.:': 2, }, reactionEmojis: {}, fileIds: [], files: [], replyId: null, renoteId: null, } ''')); /// 自身でないノート1 static Note note3AsAnotherUser = Note.fromJson(JSON5.parse(r''' { id: '9g2ja0y8ix', createdAt: '2023-06-16T19:35:07.088Z', userId: '7z9zua5kyv', user: { id: '7z9zua5kyv', name: 'おいしいBot', username: 'oishiibot', host: null, avatarUrl: 'https://nos3.arkjp.net/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-d67529a5-4b8b-4e76-b827-7fcbb57956b6.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: false, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, text: 'ムヒヒヒヒヒョヒョヒョヒョおいしい', cw: null, visibility: 'public', localOnly: false, reactionAcceptance: null, renoteCount: 2, repliesCount: 0, reactions: { '❤': 1, ':kisei@.:': 1, ':kuruu@.:': 2, ':wheeze@.:': 2, ':kusa_wwwwww@.:': 10, ':naxanikorexe@.:': 4, ':[email protected]:': 1, }, reactionEmojis: { '[email protected]': 'https://s3.arkjp.net/misskey/f5d9e5ca-700d-4a9f-aaad-a45efc4a4486.png', }, fileIds: [], files: [], replyId: null, renoteId: null, } ''')); /// 自身のノート(投票込みのノート) static Note note4AsVote = Note.fromJson(JSON5.parse(''' { id: '9h7cbiu7ab', createdAt: '2023-07-15T08:58:52.831Z', userId: '7rkr3b1c1c', user: { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, text: 'みにゃさんは、どれが空から降ってきてほしいですか?', cw: null, visibility: 'public', localOnly: false, reactionAcceptance: null, renoteCount: 7, repliesCount: 0, reactions: { ':gaming@.:': 1, ':kirakira@.:': 3, ':5000t_hosii@.:': 4, ':twinsparrot@.:': 1, ':_question_mark@.:': 7, ':role_bisyouzyo@.:': 1, }, reactionEmojis: {}, fileIds: [], files: [], replyId: null, renoteId: null, poll: { multiple: false, expiresAt: '2023-07-15T09:13:52.831Z', choices: [ { text: '光る国民の基本的な権利', votes: 17, isVoted: false, }, { text: 'ぷるぷる自動販売機', votes: 9, isVoted: false, }, { text: '抗菌仕様金髪碧眼の美少女', votes: 27, isVoted: false, }, { text: '養殖null', votes: 8, isVoted: false, }, ], }, } ''')); /// 自身でないノート2 static Note note5AsAnotherUser = Note.fromJson(JSON5.parse(r''' { id: '9gdpe2xkeo', createdAt: '2023-06-24T15:11:41.912Z', userId: '7rkr4nmz19', user: { id: '7rkr4nmz19', name: 'お知らせ', username: 'notify', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2F3c08aa80-6a94-4417-a435-ed04cf270734.png&avatar=1', avatarBlurhash: null, isBot: false, isCat: false, emojis: {}, onlineStatus: 'active', badgeRoles: [ { name: 'Official', iconUrl: 'https://s3.arkjp.net/misskey/8df80984-86f9-4cc5-a289-1f6ab59c74b8.png', displayOrder: 1000, }, ], }, text: '【お知らせ】\nhttps://Misskey.io の総投稿数が2000万投稿を超えました!', cw: null, visibility: 'public', localOnly: false, reactionAcceptance: 'nonSensitiveOnly', renoteCount: 164, repliesCount: 0, reactions: { '❤': 8, '🎉': 17, '💾': 1, ':igyo@.:': 14, ':deltu@.:': 1, ':sugoi@.:': 11, ':igyofes@.:': 1, ':misuhai@.:': 7, ':16777216@.:': 1, ':kusodeka@.:': 1, ':nyanners@.:': 1, ':omedetou@.:': 1, ':199000man@.:': 14, ':supertada@.:': 6, ':resonyance@.:': 9, ':super_igyo@.:': 71, ':ultra_igyo@.:': 406, ':peroro_sama@.:': 1, ':score_65535@.:': 2, ':ultra_igyo2@.:': 20, ':hashtag_igyo@.:': 34, ':igyo_omurice@.:': 1, ':sugoihanashi@.:': 8, ':kiwamete_igyo@.:': 6, ':saikou_sugiru@.:': 1, ':ultimate_igyo@.:': 93, ':stack_overflow@.:': 1, ':igyo_no_tatuzin@.:': 1, ':nobel_igyo_syou@.:': 1, ':[email protected]:': 2, ':[email protected]:': 1, ':super_chat_10000yen@.:': 1, ':[email protected]:': 1, ':[email protected]:': 1, ':[email protected]:': 1, ':[email protected]:': 1, ':[email protected]:': 1, }, reactionEmojis: { '[email protected]': 'https://misskey.04.si/files/3a484c36-65b0-4677-98d2-a165f72fd25c', '[email protected]': 'https://media.nijimiss.app/null/db7ad2be-a29f-4e14-b873-50125850086d.gif', '[email protected]': 'https://nekomiya.net/storage/30b1bcb9-9b80-48e0-baf4-f38bf1f18210', '[email protected]': 'https://ikaskey-s3.bktsk.com/ikaskey/7205d272-ee8a-49a0-b64f-1515e2b9c970.png', '[email protected]': 'https://s3.yukineko.me/static/misskey/e09da08c-f603-4032-a19d-c90b7c440265.png', '[email protected]': 'https://media.nijimiss.app/null/69f7a9f9-f857-4001-9400-d8e0d36ddb56.png', '[email protected]': 'https://s3.yukineko.me/static/misskey/1902ee5b-3655-483b-938a-efc361bb3eaa.png', }, fileIds: [ '9gdpdb8wp2', ], files: [ { id: '9gdpdb8wp2', createdAt: '2023-06-24T15:11:06.032Z', name: '2023-06-25 00-11-05 1.png', type: 'image/png', md5: 'cf8cc78629e6fb6e8b4a624a0ded3c29', size: 24108, isSensitive: false, blurhash: 'e384l69XD~xuxc~pD%Rjt7oM00%4%3RjWT00_2%LM{WU9GxuxtayRj', properties: { width: 646, height: 236, }, url: 'https://s3.arkjp.net/misskey/5da55bce-9b22-4a01-97ec-6e8c180aed00.png', thumbnailUrl: 'https://s3.arkjp.net/misskey/thumbnail-813f78ab-0622-4a6e-817c-67bbbb9a7597.webp', comment: null, folderId: null, folder: null, userId: null, user: null, }, ], replyId: null, renoteId: null, myReaction: ':ultra_igyo@.:', } ''')); /// Renote static Note note6AsRenote = Note.fromJson(JSON5.parse(''' { id: '9lmbcrob34', createdAt: '2023-11-03T15:07:13.307Z', userId: '9byjlos32z', user: { id: '9byjlos32z', name: 'そらいろ:role_reaction_shooter:', username: 'shiosyakeyakini', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-5e0b7842-adf7-4d29-b04a-a6e1faa4c3c4.png&avatar=1', avatarBlurhash: 'eaN^k|,Rj%3x]_NM{t7t7jE^+tRjYR%s;MxMxIoogozxvRkRkRijE', isBot: false, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [ { name: 'Patreon Miskist', iconUrl: 'https://s3.arkjp.net/misskey/b03aec5c-4ef6-475d-b9ae-040531e77ff2.png', displayOrder: 10, }, { name: 'Misskey Supporter', iconUrl: 'https://s3.arkjp.net/misskey/dab4e89c-4ed1-4c06-918d-441db61dabaf.png', displayOrder: 10, }, { name: 'FANBOX サポーター', iconUrl: 'https://s3.arkjp.net/misskey/6e3b469e-16ed-4cc2-9098-215b441da254.png', displayOrder: 0, }, ], }, text: null, cw: null, visibility: 'public', localOnly: false, reactionAcceptance: null, renoteCount: 0, repliesCount: 0, reactions: {}, reactionEmojis: {}, fileIds: [], files: [], replyId: null, renoteId: '9lmb9yahs7', renote: { id: '9lmb9yahs7', createdAt: '2023-11-03T15:05:01.913Z', userId: '9g0ku8jkft', user: { id: '9g0ku8jkft', name: 'しゅうまい君(バカンス)', username: 'shuumai', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fe44afb80-e469-4ca2-bfd0-ddb8555e6a26.png&avatar=1', avatarBlurhash: 'eoJThjozuNozo|kpj[ofaye.y=ayVFj[Vts;ayV@j[W;WDj[jEayoz', isBot: true, isCat: false, emojis: {}, onlineStatus: 'unknown', badgeRoles: [ { name: 'Verified', iconUrl: 'https://s3.arkjp.net/misskey/8df80984-86f9-4cc5-a289-1f6ab59c74b8.png', displayOrder: 1000, }, ], }, text: 'どう考えてもおいしい冷める前のケースに使われてしまいそう」 (白いの自分が綺麗になると自分が36な', cw: null, visibility: 'public', localOnly: false, reactionAcceptance: null, renoteCount: 2, repliesCount: 0, reactions: { '❤': 1, ':miria@.:': 44, ':36kyoutei@.:': 5, }, reactionEmojis: {}, fileIds: [], files: [], replyId: null, renoteId: null, myReaction: ':miria@.:', }, } ''')); // ドライブ(フォルダ) static DriveFolder folder1 = DriveFolder.fromJson(JSON5.parse(r''' { id: '9ettn0mv95', createdAt: '2023-05-16T12:35:31.447Z', name: '秘蔵の藍ちゃんフォルダ', parentId: null, }''')); static DriveFolder folder1Child = DriveFolder.fromJson(JSON5.parse(r''' { id: '9ettn0mv95', createdAt: '2023-05-16T12:35:31.447Z', name: 'えっちなやつ', parentId: '9ettn0mv95', }''')); // ドライブ(ファイル) static DriveFile drive1 = DriveFile.fromJson(JSON5.parse(r''' { id: '9g6yuyisp3', createdAt: '2023-06-19T22:02:22.660Z', name: 'maze.png', type: 'image/png', md5: 'c2585a2f9c286c3ee1cb07b6a1041b58', size: 85317, isSensitive: false, blurhash: 'e172_xti05ti05t$kAV]azaz05ag%]afyStiazazfjV]05azylagy8', properties: { width: 4096, height: 4096, }, url: 'https://s3.arkjp.net/misskey/webpublic-5efa067b-f0f6-4e9c-afbf-25a6140b6c6a.png', thumbnailUrl: 'https://s3.arkjp.net/misskey/thumbnail-db8c0a1d-ba8c-4ea2-bbf1-be1e8f021605.webp', comment: null, folderId: null, folder: null, userId: null, user: null, } ''')); static DriveFile drive2AsVideo = DriveFile.fromJson(JSON5.parse(r''' { id: '9g0kvlw8d3', createdAt: '2023-06-15T10:44:21.272Z', name: 'RPReplay_Final1686825395.mp4', type: 'video/mp4', md5: '9e1df6b1e79796e4e4b58fbf804a9f40', size: 11400289, isSensitive: false, blurhash: null, properties: {}, url: 'https://s3.arkjp.net/misskey/e5d2aaea-6c64-4d07-b8c2-2708a955a606.mp4', thumbnailUrl: 'https://s3.arkjp.net/misskey/thumbnail-be640464-688f-46ef-90b6-8bbba80e73cb.webp', comment: null, folderId: null, folder: null, userId: null, user: null, } ''')); static Future<Uint8List> get binaryImage async => Uint8List.fromList( (await rootBundle.load("assets/images/icon.png")).buffer.asUint8List()); static Future<Response<Uint8List>> get binaryImageResponse async => Response( requestOptions: RequestOptions(), statusCode: 200, data: await binaryImage); // ユーザー情報 static UserLite user1 = UserLite.fromJson(JSON5.parse(r''' { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://nos3.arkjp.net/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], }''')); static String user1ExpectId = "7rkr3b1c1c"; static UserDetailedNotMeWithRelations detailedUser1 = UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '7z9zua5kyv', name: 'おいしいBot', username: 'oishiibot', host: null, avatarUrl: 'https://nos3.arkjp.net/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-d67529a5-4b8b-4e76-b827-7fcbb57956b6.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: false, emojis: {}, onlineStatus: 'online', badgeRoles: [], url: null, uri: null, movedTo: null, alsoKnownAs: null, createdAt: '2019-10-25T17:48:45.416Z', updatedAt: '2023-06-24T10:02:49.412Z', lastFetchedAt: null, bannerUrl: null, bannerBlurhash: null, isLocked: false, isSilenced: false, isSuspended: false, description: 'このアカウントはホームTLを見て、美味しそうなものを記憶します。\n\nTLから覚えさせる場合、このアカウントをフォローしてください。\nフォローが返ってきたら、解除しても構いません。\n\nBot属性がついたアカウントに反応しません。\nチャットも反応しません。\n\n消してほしいものがあれば @kabo まで\nお別れは /unfollow で\n\nお知らせまとめ https://misskey.io/clips/8hknysdjeu\n\n編集:2022/08/27', location: null, birthday: null, lang: null, fields: [ { name: 'オーナー', value: '@[email protected] , @[email protected]', }, { name: '詳しい使い方', value: 'https://misskey.io/@oishiibot/pages/about', }, { name: 'Hosted by', value: '@[email protected]', }, { name: 'リポジトリ', value: 'https://github.com/kabo2468/oishii-bot', }, ], followersCount: 3799, followingCount: 3699, notesCount: 59659, pinnedNoteIds: [], pinnedNotes: [], pinnedPageId: '7zcd5e96mp', pinnedPage: { id: '7zcd5e96mp', createdAt: '2019-10-27T09:36:51.306Z', updatedAt: '2020-02-15T07:13:58.312Z', userId: '7z9zua5kyv', user: { id: '7z9zua5kyv', name: 'おいしいBot', username: 'oishiibot', host: null, avatarUrl: 'https://nos3.arkjp.net/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-d67529a5-4b8b-4e76-b827-7fcbb57956b6.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: false, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, content: [ { id: 'b493be43-4e13-4080-90fb-f2fb1a02abfa', text: 'このアカウントに`美味しいものは何?`とリプライを送ると、返事が帰ってきます。\n他には、`〇〇は美味しいよ`を送ると学習させることが出来ます。\n`〇〇って美味しい?`と聞くと美味しいかどうか判断します。\n\n`お腹空いた`とリプライを送ると、おすすめの食べ物を教えます。\n\n`みんなの美味しいものは何?`とリプライを送ると、ユーザーが教えたものから美味しいものを返します。\n\n`@ピザ`とリプライを送ると、ピザのサイトを返します。\nTLに`@ピザ`と投稿しても返します。\nTLの場合、他のインスタンスのユーザーは、このアカウントをフォローしてください。\n\n`お寿司握って`とリプライを送ると、お寿司を握ってくれます。\n\n`食べ物頂戴`とリプライを送ると、食べ物を作ってくれます。\n\n// バレンタインデーを過ぎたので、チョコをあげたり受け取ったりすることはできません\nバレンタインデーの機能で、\n`チョコちょうだい!`や`チョコあげる!`でチョコをあげたり受け取ったりすることができます。', type: 'text', }, { id: '4a1562d1-6a05-4735-8e98-620d543d8886', type: 'section', title: '正規表現', children: [ { id: 'ccbb7bd8-fe1e-44fa-a190-5124122b5624', text: '```\n[Adjective] = ((おい|美味)し|(まず|マズ|不味)く(な|にゃ)|うま|旨)い|(まず|マズ|不味|(おい|美味)しく(な|にゃ)|(うま|旨)く(な|にゃ))い\n検索\n/(みん(な|にゃ)の)?([Adjective])(もの|物|の)は?(何|(な|にゃ)に)?[??]*/\n判断\n/(.+)(は|って)([Adjective])[??]+/\n学習\n/(.+)[はも]([Adjective])よ?[!!]*/\n```', type: 'text', }, { id: 'fc97974e-64d4-4d1b-b4f8-68450e4644bc', text: 'お腹空いた機能\n```\n/お?(腹|(な|にゃ)か|はら)([空すあ]い|([減へ][っり]))た?[!!]*/\n```', type: 'text', }, { id: '4d79791e-ced6-4f51-836d-54700861b03b', text: '@ピザ機能\n```\nリプライ時\n/\\s*[@@]?(ピザ|ぴざ)\\s*/\nTL時 \n/^[@@](ピザ|ぴざ)$/\n```', type: 'text', }, { id: '6dd37515-6f69-4396-b33f-1d3d59dacde9', text: '寿司機能\n```\n/^\\s*お?(寿司|すし)を?(握|にぎ)(って|れ)/\n```', type: 'text', }, { id: '7c9c11ae-6907-4ecf-9295-9e58423bbe2e', text: '食べ物機能\n```\n/^\\s*((何|(な|にゃ)に|(な|にゃ)ん)か)?[食た]べる?(物|もの)(くれ|ちょうだい|頂戴|ください)/\n```', type: 'text', }, ], }, { id: '1ca26baa-4ea5-449a-afe8-a06df802bf8f', type: 'section', title: 'コマンド', children: [ { id: 'b0c92622-d725-4c93-8e4a-329818ee6752', text: '```\n/help: コマンドリストを表示する。\n/ping: 生存確認する。\n/info: (今のところは)DBのレコード数を表示する。\n/say: なにか言わせる。(オーナーのみ)\n/follow: フォローする。\n/unfollow: フォローを解除する。\n/delete: 削除する。(オーナーのみ)\n/chart: DBのレコード数をチャートにする。(オーナーのみ)\n```', type: 'text', }, ], }, { id: '170cb06a-1dc7-4939-bafe-3dc2ce4baf31', text: '最終更新: 2020/02/15', type: 'text', }, ], variables: [], title: '説明', name: 'about', summary: null, hideTitleWhenPinned: false, alignCenter: false, font: 'sans-serif', script: '', eyeCatchingImageId: null, eyeCatchingImage: null, attachedFiles: [], likedCount: 8, isLiked: false, }, publicReactions: false, ffVisibility: 'public', twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, roles: [ { id: '9ablrbdi3h', name: '4年生', color: null, iconUrl: null, description: 'Misskey.ioを使い始めて3年経過\nドライブの容量が16GBに', isModerator: false, isAdministrator: false, displayOrder: 0, }, ], memo: null, isFollowing: false, isFollowed: false, hasPendingFollowRequestFromYou: false, hasPendingFollowRequestToYou: false, isBlocking: false, isBlocked: false, isMuted: false, isRenoteMuted: false, } ''')); static UserDetailedNotMeWithRelations detailedUser2 = UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '9gbzuv2cze', name: '藍ちゃんにおじさん構文でメンションを送るbot', username: 'ojichat_to_ai', host: 'misskey.04.si', avatarUrl: 'https://misskey.io/identicon/[email protected]', avatarBlurhash: null, isBot: true, isCat: false, instance: { name: 'りんごぱい', softwareName: 'misskey', softwareVersion: '13.13.2-pie.1', iconUrl: 'https://misskey.04.si/static-assets/icons/192.png', faviconUrl: 'https://04.si/favicons/icon-512x512.png', themeColor: '#eb349b', }, emojis: {}, onlineStatus: 'unknown', url: 'https://misskey.04.si/@ojichat_to_ai', uri: 'https://misskey.04.si/users/9gbzf7dzzl', movedTo: null, alsoKnownAs: null, createdAt: '2023-06-23T10:29:08.676Z', updatedAt: '2023-06-23T10:29:11.609Z', lastFetchedAt: '2023-06-23T10:29:08.676Z', bannerUrl: null, bannerBlurhash: null, isLocked: false, isSilenced: false, isSuspended: false, description: '名前の通り。返信機能などはありません。\n文章はojichatで生成しています。\n管理者: @[email protected]\nPC起動時のみ運用するため、かなりの頻度で停止します。', location: '藍ちゃんの隣', birthday: null, lang: null, fields: [ { name: '管理者', value: '@grj1234', }, ], followersCount: 0, followingCount: 0, notesCount: 1, pinnedNoteIds: [ '9gbzomafzn', ], pinnedNotes: [ { id: '9gbzomafzn', createdAt: '2023-06-23T10:24:17.367Z', userId: '9gbzuv2cze', user: { id: '9gbzuv2cze', name: '藍ちゃんにおじさん構文でメンションを送るbot', username: 'ojichat_to_ai', host: 'misskey.04.si', avatarUrl: 'https://misskey.io/identicon/[email protected]', avatarBlurhash: null, isBot: true, isCat: false, instance: { name: 'りんごぱい', softwareName: 'misskey', softwareVersion: '13.13.2-pie.1', iconUrl: 'https://misskey.04.si/static-assets/icons/192.png', faviconUrl: 'https://04.si/favicons/icon-512x512.png', themeColor: '#eb349b', }, emojis: {}, onlineStatus: 'unknown', }, text: '[手動] どんなアイコンを設定すれば良いか悩んでいます。是非とも皆さんのご意見をお聞きしたいと思います。', cw: null, visibility: 'public', localOnly: false, reactionAcceptance: null, renoteCount: 0, repliesCount: 0, reactions: {}, reactionEmojis: {}, emojis: {}, fileIds: [], files: [], replyId: null, renoteId: null, uri: 'https://misskey.04.si/notes/9gbzomaf1o', }, ], pinnedPageId: null, pinnedPage: null, publicReactions: true, ffVisibility: 'public', twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, roles: [], memo: null, isFollowing: false, isFollowed: false, hasPendingFollowRequestFromYou: false, hasPendingFollowRequestToYou: false, isBlocking: false, isBlocked: false, isMuted: false, isRenoteMuted: false, }''')); static String detailedUser2ExpectedId = "9gbzuv2cze"; // ユーザー情報 static UserDetailedNotMeWithRelations usersShowResponse1 = UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], url: null, uri: null, movedTo: null, alsoKnownAs: null, createdAt: '2019-04-14T17:11:39.168Z', updatedAt: '2023-07-16T09:06:10.691Z', lastFetchedAt: null, bannerUrl: null, bannerBlurhash: null, isLocked: false, isSilenced: false, isSuspended: false, description: 'Misskey常駐AIの藍です!\nよろしくお願いします♪\n\n[私のサイト](https://xn--931a.moe/) | [説明書](https://github.com/syuilo/ai/blob/master/torisetu.md)\n\nRepository: [Public](https://github.com/syuilo/ai)', location: 'Misskey', birthday: '2018-03-12', lang: null, fields: [], followersCount: 14276, followingCount: 996, notesCount: 74078, pinnedNoteIds: [], pinnedNotes: [], pinnedPageId: '7uz2kemwz7', pinnedPage: { id: '7uz2kemwz7', createdAt: '2019-07-09T07:40:46.232Z', updatedAt: '2019-07-09T08:13:21.048Z', userId: '7rkr3b1c1c', user: { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, content: [ { id: 'b6faa1ad-c38a-41df-b8fb-c1c486c40b6c', var: null, text: '私とリバーシで遊ぶ', type: 'button', event: 'inviteReversi', action: 'pushEvent', content: null, message: '招待を送信しましたよ~', primary: true, }, ], variables: [], title: 'コントロールパネル', name: 'cp', summary: null, hideTitleWhenPinned: true, alignCenter: true, font: 'sans-serif', script: '', eyeCatchingImageId: null, eyeCatchingImage: null, attachedFiles: [], likedCount: 11, isLiked: false, }, publicReactions: true, ffVisibility: 'public', twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, roles: [ { id: '9ablrt3x4q', name: '5年生', color: null, iconUrl: null, description: 'Misskey.ioを使い始めて4年経過\nドライブの容量が18GBに', isModerator: false, isAdministrator: false, displayOrder: 0, }, ], memo: null, isFollowing: true, isFollowed: true, hasPendingFollowRequestFromYou: false, hasPendingFollowRequestToYou: false, isBlocking: false, isBlocked: false, isMuted: false, isRenoteMuted: false, } ''')); static UserDetailedNotMeWithRelations usersShowResponse2 = UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '7z9zua5kyv', name: 'おいしいBot', username: 'oishiibot', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-d67529a5-4b8b-4e76-b827-7fcbb57956b6.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: false, emojis: {}, onlineStatus: 'online', badgeRoles: [], url: null, uri: null, movedTo: null, alsoKnownAs: [ '9guzhm5p6f', ], createdAt: '2019-10-25T17:48:45.416Z', updatedAt: '2023-07-16T08:35:54.004Z', lastFetchedAt: null, bannerUrl: null, bannerBlurhash: null, isLocked: false, isSilenced: false, isSuspended: false, description: 'このアカウントはホームTLを見て、美味しそうなものを記憶します。\n\nTLから覚えさせる場合、このアカウントをフォローしてください。\nフォローが返ってきたら、解除しても構いません。\n\nBot属性がついたアカウントに反応しません。\nチャットも反応しません。\n\n消してほしいものがあれば @kabo まで\nお別れは /unfollow で\n\nお知らせまとめ https://misskey.io/clips/8hknysdjeu\n\n編集:2022/08/27', location: null, birthday: null, lang: null, fields: [ { name: 'オーナー', value: '@[email protected] , @[email protected]', }, { name: '詳しい使い方', value: 'https://misskey.io/@oishiibot/pages/about', }, { name: 'Hosted by', value: '@[email protected]', }, { name: 'リポジトリ', value: 'https://github.com/kabo2468/oishii-bot', }, ], followersCount: 7200, followingCount: 7003, notesCount: 60536, pinnedNoteIds: [], pinnedNotes: [], pinnedPageId: '7zcd5e96mp', pinnedPage: { id: '7zcd5e96mp', createdAt: '2019-10-27T09:36:51.306Z', updatedAt: '2020-02-15T07:13:58.312Z', userId: '7z9zua5kyv', user: { id: '7z9zua5kyv', name: 'おいしいBot', username: 'oishiibot', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-d67529a5-4b8b-4e76-b827-7fcbb57956b6.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: false, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, content: [ { id: 'b493be43-4e13-4080-90fb-f2fb1a02abfa', text: 'このアカウントに`美味しいものは何?`とリプライを送ると、返事が帰ってきます。\n他には、`〇〇は美味しいよ`を送ると学習させることが出来ます。\n`〇〇って美味しい?`と聞くと美味しいかどうか判断します。\n\n`お腹空いた`とリプライを送ると、おすすめの食べ物を教えます。\n\n`みんなの美味しいものは何?`とリプライを送ると、ユーザーが教えたものから美味しいものを返します。\n\n`@ピザ`とリプライを送ると、ピザのサイトを返します。\nTLに`@ピザ`と投稿しても返します。\nTLの場合、他のインスタンスのユーザーは、このアカウントをフォローしてください。\n\n`お寿司握って`とリプライを送ると、お寿司を握ってくれます。\n\n`食べ物頂戴`とリプライを送ると、食べ物を作ってくれます。\n\n// バレンタインデーを過ぎたので、チョコをあげたり受け取ったりすることはできません\nバレンタインデーの機能で、\n`チョコちょうだい!`や`チョコあげる!`でチョコをあげたり受け取ったりすることができます。', type: 'text', }, { id: '4a1562d1-6a05-4735-8e98-620d543d8886', type: 'section', title: '正規表現', children: [ { id: 'ccbb7bd8-fe1e-44fa-a190-5124122b5624', text: '```\n[Adjective] = ((おい|美味)し|(まず|マズ|不味)く(な|にゃ)|うま|旨)い|(まず|マズ|不味|(おい|美味)しく(な|にゃ)|(うま|旨)く(な|にゃ))い\n検索\n/(みん(な|にゃ)の)?([Adjective])(もの|物|の)は?(何|(な|にゃ)に)?[??]*/\n判断\n/(.+)(は|って)([Adjective])[??]+/\n学習\n/(.+)[はも]([Adjective])よ?[!!]*/\n```', type: 'text', }, { id: 'fc97974e-64d4-4d1b-b4f8-68450e4644bc', text: 'お腹空いた機能\n```\n/お?(腹|(な|にゃ)か|はら)([空すあ]い|([減へ][っり]))た?[!!]*/\n```', type: 'text', }, { id: '4d79791e-ced6-4f51-836d-54700861b03b', text: '@ピザ機能\n```\nリプライ時\n/\\s*[@@]?(ピザ|ぴざ)\\s*/\nTL時 \n/^[@@](ピザ|ぴざ)$/\n```', type: 'text', }, { id: '6dd37515-6f69-4396-b33f-1d3d59dacde9', text: '寿司機能\n```\n/^\\s*お?(寿司|すし)を?(握|にぎ)(って|れ)/\n```', type: 'text', }, { id: '7c9c11ae-6907-4ecf-9295-9e58423bbe2e', text: '食べ物機能\n```\n/^\\s*((何|(な|にゃ)に|(な|にゃ)ん)か)?[食た]べる?(物|もの)(くれ|ちょうだい|頂戴|ください)/\n```', type: 'text', }, ], }, { id: '1ca26baa-4ea5-449a-afe8-a06df802bf8f', type: 'section', title: 'コマンド', children: [ { id: 'b0c92622-d725-4c93-8e4a-329818ee6752', text: '```\n/help: コマンドリストを表示する。\n/ping: 生存確認する。\n/info: (今のところは)DBのレコード数を表示する。\n/say: なにか言わせる。(オーナーのみ)\n/follow: フォローする。\n/unfollow: フォローを解除する。\n/delete: 削除する。(オーナーのみ)\n/chart: DBのレコード数をチャートにする。(オーナーのみ)\n```', type: 'text', }, ], }, { id: '170cb06a-1dc7-4939-bafe-3dc2ce4baf31', text: '最終更新: 2020/02/15', type: 'text', }, ], variables: [], title: '説明', name: 'about', summary: null, hideTitleWhenPinned: false, alignCenter: false, font: 'sans-serif', script: '', eyeCatchingImageId: null, eyeCatchingImage: null, attachedFiles: [], likedCount: 8, isLiked: false, }, publicReactions: false, ffVisibility: 'public', twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, roles: [ { id: '9ablrbdi3h', name: '4年生', color: null, iconUrl: null, description: 'Misskey.ioを使い始めて3年経過\nドライブの容量が16GBに', isModerator: false, isAdministrator: false, displayOrder: 0, }, ], memo: null, isFollowing: false, isFollowed: false, hasPendingFollowRequestFromYou: false, hasPendingFollowRequestToYou: false, isBlocking: false, isBlocked: false, isMuted: false, isRenoteMuted: false, } ''')); static UserDetailedNotMeWithRelations usersShowResponse3AsRemoteUser = UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '9i08deo0vj', name: 'あけおめらんか~', username: 'akeome', host: 'misskey.backspace.fm', avatarUrl: 'https://misskey.io/identicon/[email protected]', avatarBlurhash: null, isBot: true, isCat: false, instance: { name: 'BackspaceKey', softwareName: 'misskey', softwareVersion: '2023.9.3-bsk-2.1.2', iconUrl: 'https://s3.bskstorage.com/sakura/backspacekey/dc65f1fb-bc2b-4013-8f47-c6abd6df30ee.png', faviconUrl: 'https://s3.bskstorage.com/sakura/backspacekey/125bc5c2-7e4b-409f-b50f-331dfb3e6bde.png', themeColor: '#e4d440', }, emojis: {}, onlineStatus: 'unknown', url: 'https://misskey.backspace.fm/@akeome', uri: 'https://misskey.backspace.fm/users/9i07ia9bf0', movedTo: null, alsoKnownAs: null, createdAt: '2023-08-04T14:13:41.376Z', updatedAt: '2023-11-01T15:02:05.677Z', lastFetchedAt: '2023-11-01T14:04:12.561Z', bannerUrl: null, bannerBlurhash: null, isLocked: false, isSilenced: false, isLimited: false, isSuspended: false, description: '毎日0:00に開かれる時間競技を観測するためのbotです。\n**/follow**でこちらからフォローします。', location: null, birthday: null, lang: null, fields: [ { name: '集計ワード', value: '"あけおめ","あけましておめでとうございます",":akeome:",":sakibashiri_oniichan_ni_akeome_shite_agerunoha_atashi_kurai_desho_heart:","はるさめずるずるひょるひょるほほほー",":harusame_zuruzuru:"', }, { name: '集計に使わせていただいております', value: 'https://github.com/taichanNE30/yamag', }, { name: '集計部分の制作者', value: '@taichan', }, { name: '中の人', value: '@mirashiya37', }, ], followersCount: 0, followingCount: 0, notesCount: 197, pinnedNoteIds: [], pinnedNotes: [], pinnedPageId: null, pinnedPage: null, publicReactions: true, ffVisibility: 'public', twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, roles: [], memo: null, isFollowing: false, isFollowed: false, hasPendingFollowRequestFromYou: false, hasPendingFollowRequestToYou: false, isBlocking: false, isBlocked: false, isMuted: false, isRenoteMuted: false, } ''')); static UserDetailedNotMeWithRelations usersShowResponse3AsLocalUser = UserDetailedNotMeWithRelations.fromJson(JSON5.parse(''' { id: '9i07ia9bf0', name: 'あけおめらんか~', username: 'akeome', host: null, avatarUrl: 'https://misskey.backspace.fm/identicon/[email protected]', avatarBlurhash: null, isBot: true, isCat: false, emojis: {}, onlineStatus: 'online', badgeRoles: [], url: null, uri: null, movedTo: null, alsoKnownAs: null, createdAt: '2023-08-04T13:49:29.327Z', updatedAt: '2023-11-02T21:01:34.367Z', lastFetchedAt: null, bannerUrl: null, bannerBlurhash: null, isLocked: false, isSilenced: false, isSuspended: false, description: '毎日0:00に開かれる時間競技を観測するためのbotです。\\n**/follow**でこちらからフォローします。', location: null, birthday: null, lang: 'ja', fields: [ { name: '集計ワード', value: '"あけおめ","あけましておめでとうございます",":akeome:",":sakibashiri_oniichan_ni_akeome_shite_agerunoha_atashi_kurai_desho_heart:","はるさめずるずるひょるひょるほほほー",":harusame_zuruzuru:"', }, { name: '集計に使わせていただいております', value: 'https://github.com/taichanNE30/yamag', }, { name: '集計部分の制作者', value: '@taichan', }, { name: '中の人', value: '@mirashiya37', }, ], verifiedLinks: [], followersCount: 70, followingCount: 61, notesCount: 593, pinnedNoteIds: [], pinnedNotes: [], pinnedPageId: null, pinnedPage: null, publicReactions: true, ffVisibility: 'public', twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, roles: [ { id: '9gvf639rj8', name: '一期生', color: null, iconUrl: null, description: '', isModerator: false, isAdministrator: false, displayOrder: 0, }, ], memo: null, isFollowing: false, isFollowed: false, hasPendingFollowRequestFromYou: false, hasPendingFollowRequestToYou: false, isBlocking: false, isBlocked: false, isMuted: false, isRenoteMuted: false, notify: 'none', } ''')); // カスタム絵文字 static UnicodeEmojiData unicodeEmoji1 = const UnicodeEmojiData(char: "♥"); static CustomEmojiData customEmoji1 = CustomEmojiData( baseName: "ai_yay", hostedName: "misskey.io", url: Uri.parse("https://s3.arkjp.net/emoji/ai_yay.apng"), isCurrentServer: true, isSensitive: false); static EmojiRepositoryData unicodeEmojiRepositoryData1 = EmojiRepositoryData( emoji: unicodeEmoji1, category: "symbols", kanaName: "へあt", aliases: ["heart", "ハート"], kanaAliases: ["へあt", "ハート"]); static EmojiRepositoryData customEmojiRepositoryData1 = EmojiRepositoryData( emoji: customEmoji1, category: "02 Ai", kanaName: "あいやy", aliases: [ 'yay_ai', '藍', 'あい', 'ばんざい', 'バンザイ', 'ばんざーい', 'やった', 'やったぁ', 'わぁい', 'わーい', 'やったー', 'やったぁ', 'うれしい', 'ハッピー', 'たのしい', 'わーいわーい', 'よろこび', 'よろこぶ', '', 'happy', 'yay', 'ai', 'praise', ], kanaAliases: [ 'やyあい', '藍', 'あい', 'ばんざい', 'バンザイ', 'ばんざーい', 'やった', 'やったぁ', 'わぁい', 'わーい', 'やったー', 'やったぁ', 'うれしい', 'ハッピー', 'たのしい', 'わーいわーい', 'よろこび', 'よろこぶ', '', 'はppy', 'やy', 'あい', 'pらいせ', ]); // チャンネル static CommunityChannel channel1 = CommunityChannel.fromJson(JSON5.parse(r''' { id: '9axtmmcxuy', createdAt: '2023-02-07T13:07:28.305Z', lastNotedAt: '2023-06-18T10:43:33.672Z', name: 'ブルーアーカイ部 総合', description: '<center>ありがとうブルーアーカイブ\nブルアカに関する投稿なら何でも歓迎!ネタ投稿や雑談、MFM芸なども:yattare:!</center>\n\n投稿内容がネタや雑談よりになってしまったため、公式供給や攻略情報に関する話題など、真面目な話を行うための[サブチャンネル🔗](https://misskey.io/channels/9cpndqrb3i)を設けました。\n各自使い分けをお願いします。\n当チャンネルは引き続き自由にご利用ください。\n\nその他、他の方が作られたブルアカ関連チャンネル\n・[変態妄想垂れ流し部](https://misskey.io/channels/9c0i1s4abg)\n\n**攻略情報や質問などはサブチャンネルがオススメです!\nクリア編成報告もサブチャンネルのほうが参考にできるのでいいかも。特に低レベルクリアには需要がありますよ!**\n\n今までどおりの雑談はこちらでどうぞ!\n場合によっては引用で跨いでもいいと思います。\n\n役立ちそうなリンク集\n[公式サイト ニュースページ:bluearchive:](https://bluearchive.jp/news/newsJump)\n[公式Twitter(JP):twitter:](https://twitter.com/Blue_ArchiveJP)\n[公式Twitter(KR):twitter:](https://twitter.com/KR_BlueArchive)\n[公式YouTube(JP):youtube:](https://youtube.com/channel/UCmgf8DJrAXFnU7j3u0kklUQ)\n[公式YouTube(グロ版):youtube:](https://youtube.com/@bluearchive_Global)\n\n**※ネタバレやNSFWな内容、愚痴、偏った解釈などは「内容を隠す」機能を使ってワンクッション置くことをおすすめします。[NSFWのガイドラインはこちら](https://support.misskey.io/hc/ja/articles/6657417016463)**\n$[fg.color=red ※FA等の無断転載はやめましょう!元ツイートやノートを共有して、作者にいいねを届けましょう。]\nエッチな話は直接的なことや倫理的に危ういことなどはひかえて!みんなが見てるよ!:edasi:\n\n※バナーは公式サイトのファンキットを利用させていただいてます。', userId: '87psesv6sm', bannerUrl: 'https://s3.arkjp.net/misskey/7aa0455b-3b37-4725-8f7c-d4c846fc0aa6.jpg', pinnedNoteIds: [], color: '#00d7fb', isArchived: false, usersCount: 1095, notesCount: 67609, isFollowing: true, isFavorited: true, hasUnreadNote: false, } ''')); static String expectChannel1DescriptionContaining = "ありがとうブルーアーカイブ"; static CommunityChannel channel2 = CommunityChannel.fromJson(JSON5.parse(r''' { id: '9b3chwrm7f', createdAt: '2023-02-11T09:54:32.098Z', lastNotedAt: '2023-06-18T10:46:31.692Z', name: 'Misskeyアークナイツ部', description: 'シナリオ・オペレーター・イラスト・音楽・ガチャ報告etc…アクナイに関連するものなら🆗テラの話はこちらで🙌\n\n\n<center> $[fg **※注意事項※**]</center>\n怪文書┃R-18┃大陸版先行情報┃ネタバレ┃チクチク言葉┃などのセンシティブコンテンツは$[bg.color=0000ff $[fg.color=ffff00 **必ず注意書きで内容を明記**]]し、$[fg.color=00ff00 **CW・NSFW**]で配慮して投稿してください。\n(初心者の方も投稿を見る可能性があるのでシナリオのネタバレは配慮して頂けると助かります)\n\nリーク情報は公式の利用規約に抵触する恐れがあるためNGとします。\n\nhttps://www.arknights.jp/terms_of_service\n\nチャンネルで何かあれば @369 までどうぞ', userId: '9as52pe3nw', bannerUrl: 'https://s3.arkjp.net/misskey/webpublic-3bd34a15-bb8a-4189-b5ec-5e4b11e2bef7.jpg', pinnedNoteIds: [ '9djyt2oghv', ], color: '#01c7fc', isArchived: false, usersCount: 442, notesCount: 31600, isFollowing: true, isFavorited: true, hasUnreadNote: false, } ''')); // アンテナ static Antenna antenna = Antenna.fromJson(JSON5.parse(r''' { id: '9f7kcbzcoe', createdAt: '2023-05-26T03:24:02.856Z', name: 'ポテイモン', keywords: [ [ 'ポテイモン', ], [ '芋神', ], [ 'misscat', ], ], excludeKeywords: [ [ '応天門', ], ], src: 'all', userListId: null, users: [ '', ], caseSensitive: false, notify: false, withReplies: false, withFile: false, isActive: true, hasUnreadNote: false, } ''')); static Clip clip = Clip.fromJson(JSON5.parse(r''' { id: '9crm7l2n4k', createdAt: '2023-03-25T14:12:37.103Z', lastClippedAt: '2023-06-27T10:08:56.762Z', userId: '9byjlos32z', user: { id: '7rkr3b1c1c', name: '藍', username: 'ai', host: null, avatarUrl: 'https://proxy.misskeyusercontent.com/avatar.webp?url=https%3A%2F%2Fs3.arkjp.net%2Fmisskey%2Fwebpublic-ecc1008f-3e2e-4206-ae7e-5093221f08be.png&avatar=1', avatarBlurhash: null, isBot: true, isCat: true, emojis: {}, onlineStatus: 'online', badgeRoles: [], }, name: 'ぴょんぷっぷー', description: null, isPublic: true, favoritedCount: 0, isFavorited: false, } ''')); static RolesListResponse role = RolesListResponse.fromJson(JSON5.parse(''' { id: '9diazxez3m', createdAt: '2023-04-13T06:28:30.827Z', updatedAt: '2023-06-25T09:28:16.529Z', name: 'Super New User', description: 'アカウント作成してから1日以内のユーザー', color: '#a4850a', iconUrl: 'https://s3.arkjp.net/misskey/358069f4-e033-4366-891b-fcc4fc4d0c70.png', target: 'conditional', condFormula: { id: '83328ff6-8bdc-4516-9dee-751222897481', type: 'and', values: [ { id: 'deac20b7-2688-4d7e-a264-5d0f0345f003', type: 'isLocal', }, { id: '9959c843-b273-4edf-8632-41b103af8b88', sec: 86400, type: 'createdLessThan', }, ], }, isPublic: true, isAdministrator: false, isModerator: false, isExplorable: true, asBadge: true, canEditMembersByModerator: false, displayOrder: 0, policies: { pinLimit: { value: 3, priority: 0, useDefault: true, }, canInvite: { value: false, priority: 0, useDefault: true, }, clipLimit: { value: 10, priority: 0, useDefault: true, }, canHideAds: { value: false, priority: 0, useDefault: true, }, antennaLimit: { value: 5, priority: 0, useDefault: true, }, gtlAvailable: { value: true, priority: 0, useDefault: true, }, ltlAvailable: { value: true, priority: 0, useDefault: true, }, webhookLimit: { value: 3, priority: 0, useDefault: true, }, canPublicNote: { value: true, priority: 0, useDefault: true, }, userListLimit: { value: 5, priority: 0, useDefault: true, }, wordMuteLimit: { value: 200, priority: 0, useDefault: true, }, alwaysMarkNsfw: { value: false, priority: 0, useDefault: true, }, canSearchNotes: { value: false, priority: 0, useDefault: true, }, driveCapacityMb: { value: 10240, priority: 0, useDefault: true, }, rateLimitFactor: { value: 2, priority: 0, useDefault: true, }, noteEachClipsLimit: { value: 50, priority: 0, useDefault: true, }, canManageCustomEmojis: { value: false, priority: 0, useDefault: true, }, userEachUserListsLimit: { value: 20, priority: 0, useDefault: true, }, canCreateContent: { useDefault: true, priority: 0, value: true, }, canUpdateContent: { useDefault: true, priority: 0, value: true, }, canDeleteContent: { useDefault: true, priority: 0, value: true, }, inviteLimit: { useDefault: true, priority: 0, value: 0, }, inviteLimitCycle: { useDefault: true, priority: 0, value: 10080, }, inviteExpirationTime: { useDefault: true, priority: 0, value: 0, }, }, usersCount: 0, } ''')); static HashtagsTrendResponse hashtagTrends = HashtagsTrendResponse.fromJson(JSON5.parse(r''' { tag: 'ろぐぼチャレンジ', chart: [ 3, 2, 2, 1, 3, 4, 2, 4, 2, 4, 0, 0, 3, 2, 3, 6, 5, 4, 12, 8, ], usersCount: 15, } ''')); static Hashtag hashtag = Hashtag.fromJson(JSON5.parse(r''' { tag: 'アークナイツ', mentionedUsersCount: 531, mentionedLocalUsersCount: 3, mentionedRemoteUsersCount: 528, attachedUsersCount: 67, attachedLocalUsersCount: 2, attachedRemoteUsersCount: 65, } ''')); static MetaResponse meta = MetaResponse.fromJson(JSON5.parse(r''' { maintainerName: 'そらいろ', maintainerEmail: '[email protected]', version: '2023.12.0-beta.1', name: 'Miria検証環境サーバー', shortName: null, uri: 'https://stg.miria.shiosyakeyakini.info', description: 'このサーバーはMiria ( https://shiosyakeyakini.info/miria_web/index.html ) の検証と、ストア審査用の環境です。', langs: [], tosUrl: null, repositoryUrl: 'https://github.com/misskey-dev/misskey', feedbackUrl: 'https://github.com/misskey-dev/misskey/issues/new', impressumUrl: null, privacyPolicyUrl: null, disableRegistration: true, emailRequiredForSignup: false, enableHcaptcha: false, hcaptchaSiteKey: null, enableRecaptcha: false, recaptchaSiteKey: null, enableTurnstile: false, turnstileSiteKey: null, swPublickey: null, themeColor: null, mascotImageUrl: '/assets/ai.png', bannerUrl: null, infoImageUrl: null, serverErrorImageUrl: null, notFoundImageUrl: null, iconUrl: null, backgroundImageUrl: null, logoImageUrl: null, maxNoteTextLength: 3000, defaultLightTheme: null, defaultDarkTheme: null, ads: [ { id: '9i5sueefva', url: 'https://shiosyakeyakini.info/miria_web/index.html', place: 'square', ratio: 1, imageUrl: 'https://shiosyakeyakini.info/miria_web/ad.png', dayOfWeek: 0, }, ], notesPerOneAd: 0, enableEmail: false, enableServiceWorker: false, translatorAvailable: false, serverRules: [], policies: { gtlAvailable: true, ltlAvailable: true, canPublicNote: true, canInvite: false, inviteLimit: 0, inviteLimitCycle: 10080, inviteExpirationTime: 0, canManageCustomEmojis: false, canManageAvatarDecorations: false, canSearchNotes: false, canUseTranslator: true, canHideAds: false, driveCapacityMb: 100, alwaysMarkNsfw: false, pinLimit: 5, antennaLimit: 5, wordMuteLimit: 200, webhookLimit: 3, clipLimit: 10, noteEachClipsLimit: 200, userListLimit: 10, userEachUserListsLimit: 50, rateLimitFactor: 1, }, mediaProxy: 'https://stg.miria.shiosyakeyakini.info/proxy', cacheRemoteFiles: false, cacheRemoteSensitiveFiles: true, requireSetup: false, proxyAccountName: null, features: { registration: false, emailRequiredForSignup: false, hcaptcha: false, recaptcha: false, turnstile: false, objectStorage: false, serviceWorker: false, miauth: true, }, } ''')); // Dio static DioError response404 = DioError( requestOptions: RequestOptions(), response: Response(requestOptions: RequestOptions(), statusCode: 404), type: DioErrorType.unknown); }
0
mirrored_repositories/miria/test
mirrored_repositories/miria/test/test_util/mock.dart
import 'dart:io'; import 'package:dio/dio.dart'; import 'package:file_picker/file_picker.dart'; import 'package:miria/repository/account_repository.dart'; import 'package:miria/repository/account_settings_repository.dart'; import 'package:miria/repository/emoji_repository.dart'; import 'package:miria/repository/general_settings_repository.dart'; import 'package:miria/repository/note_repository.dart'; import 'package:miria/repository/tab_settings_repository.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; @GenerateNiceMocks([ // レポジトリ MockSpec<TabSettingsRepository>(), MockSpec<AccountSettingsRepository>(), MockSpec<EmojiRepository>(), MockSpec<GeneralSettingsRepository>(), MockSpec<AccountRepository>(), MockSpec<NoteRepository>(), // API MockSpec<Misskey>(), MockSpec<MisskeyAntenna>(), MockSpec<MisskeyAp>(), MockSpec<MisskeyBlocking>(), MockSpec<MisskeyChannels>(), MockSpec<MisskeyClips>(), MockSpec<MisskeyDrive>(), MockSpec<MisskeyDriveFolders>(), MockSpec<MisskeyDriveFiles>(), MockSpec<MisskeyFederation>(), MockSpec<MisskeyFollowing>(), MockSpec<MisskeyHashtags>(), MockSpec<MisskeyI>(), MockSpec<MisskeyNotes>(), MockSpec<MisskeyNotesFavorites>(), MockSpec<MisskeyNotesReactions>(), MockSpec<MisskeyNotesPolls>(), MockSpec<MisskeyRenoteMute>(), MockSpec<MisskeyRoles>(), MockSpec<MisskeyUsers>(), // プラグインとか MockSpec<Dio>(), MockSpec<HttpClient>(), MockSpec<SocketController>(), MockSpec<StreamingService>(), MockSpec<FakeFilePickerPlatform>(as: #MockFilePickerPlatform), MockSpec<$MockBaseCacheManager>(as: #MockBaseCacheManager), MockSpec<$MockUrlLauncherPlatform>(as: #MockUrlLauncherPlatform), ]) // ignore: unused_import import 'mock.mocks.dart'; class $MockBaseCacheManager extends Mock implements BaseCacheManager {} class FakeFilePickerPlatform extends Mock with MockPlatformInterfaceMixin implements FilePicker {} class $MockUrlLauncherPlatform extends Mock with MockPlatformInterfaceMixin implements UrlLauncherPlatform {}
0
mirrored_repositories/miria/test
mirrored_repositories/miria/test/test_util/default_root_widget.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_localizations/flutter_localizations.dart'; import 'package:miria/main.dart'; import 'package:miria/router/app_router.dart'; import 'package:miria/view/common/error_dialog_listener.dart'; import 'package:miria/view/common/sharing_intent_listener.dart'; import 'package:miria/view/themes/app_theme_scope.dart'; class DefaultRootWidget extends StatefulWidget { final AppRouter? router; final PageRouteInfo<dynamic>? initialRoute; const DefaultRootWidget({super.key, this.router, this.initialRoute}); @override State<StatefulWidget> createState() => DefaultRootWidgetState(); } class DefaultRootWidgetState extends State<DefaultRootWidget> { late final AppRouter router; @override void initState() { super.initState(); router = widget.router ?? AppRouter(); } @override Widget build(BuildContext context) { return MaterialApp.router( locale: const Locale("ja", "JP"), supportedLocales: const [ Locale("ja", "JP"), ], scrollBehavior: AppScrollBehavior(), localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], builder: (context, widget) { return AppThemeScope( child: SharingIntentListener( router: router, child: ErrorDialogListener( child: widget ?? Container(), ), ), ); }, routerConfig: router.config( deepLinkBuilder: widget.initialRoute != null ? (_) => DeepLink([widget.initialRoute!]) : null), ); } } class DefaultRootNoRouterWidget extends StatelessWidget { final Widget child; const DefaultRootNoRouterWidget({super.key, required this.child}); @override Widget build(BuildContext context) { return MaterialApp( locale: const Locale("ja", "JP"), supportedLocales: const [ Locale("ja", "JP"), ], home: child, scrollBehavior: AppScrollBehavior(), localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], builder: (context, widget) { return AppThemeScope( child: ErrorDialogListener( child: widget ?? Container(), ), ); }, ); } }
0
mirrored_repositories/miria
mirrored_repositories/miria/assets_builder/build_themes.dart
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:json5/json5.dart'; import 'package:miria/model/color_theme.dart'; import 'package:miria/model/misskey_theme.dart'; void main() { final themes = [ "l-light", "d-dark", "l-coffee", "d-persimmon", "l-apricot", "d-astro", "l-rainy", "d-future", "l-botanical", "d-botanical", "l-vivid", "d-green-lime", "l-cherry", "d-green-orange", "l-sushi", "d-cherry", "l-u0", "d-ice", "d-u0", ] .map( (name) => ColorTheme.misskey( MisskeyTheme.fromJson( JSON5.parse( File( "assets_builder/misskey/packages/frontend/src/themes/$name.json5", ).readAsStringSync(), ), ), ), ) .map( (theme) => 'ColorTheme(' 'id: "${theme.id}", ' 'name: "${theme.name}", ' 'isDarkTheme: ${theme.isDarkTheme}, ' 'primary: ${theme.primary}, ' 'primaryDarken: ${theme.primaryDarken}, ' 'primaryLighten: ${theme.primaryLighten}, ' 'accentedBackground: ${theme.accentedBackground}, ' 'background: ${theme.background}, ' 'foreground: ${theme.foreground}, ' 'renote: ${theme.renote}, ' 'mention: ${theme.mention}, ' 'hashtag: ${theme.hashtag}, ' 'link: ${theme.link}, ' 'divider: ${theme.divider}, ' 'buttonBackground: ${theme.buttonBackground}, ' 'buttonGradateA: ${theme.buttonGradateA}, ' 'buttonGradateB: ${theme.buttonGradateB}, ' 'panel: ${theme.panel}, ' 'panelBackground: ${theme.panelBackground}, ' ')', ) .toList(); // ignore: avoid_print print(themes); runApp(MaterialApp(home: Scaffold(body: SelectableText(themes.toString())))); }
0
mirrored_repositories/hyper_mart_shopping
mirrored_repositories/hyper_mart_shopping/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/pages/home_page.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return ScreenUtilInit( builder: (context, child) => MaterialApp( title: 'Hyper Mart', theme: ThemeData( primaryColor: Colors.white, textTheme: GoogleFonts.poppinsTextTheme(), ), home: child, ), child: const HomePage(), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/favourite_icon_widget.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hypermart_flutter/models/product.dart'; import 'package:hypermart_flutter/states/product_state.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class FavouriteIconWidget extends StatelessWidget { const FavouriteIconWidget({ Key? key, required this.product, required this.state, }) : super(key: key); final Product product; final ProductState state; @override Widget build(BuildContext context) { return Positioned( top: 10.sm, left: 10.sm, child: GestureDetector( onTap: () => state.favoriteStatus(product.id), child: CircleAvatar( radius: 10.r, backgroundColor: Colors.white, child: Image.asset( product.isFavorite ? AssetsIcons.heartFilledPNG : AssetsIcons.heartPNG, height: 16.sm, width: 16.sm, color: product.isFavorite ? null : Colors.black, ), ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/top_brands_widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hypermart_flutter/utils/assets.dart'; import 'package:hypermart_flutter/widgets/top_brands_image_widget.dart'; class TopBrandsWidget extends StatelessWidget { const TopBrandsWidget({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return SliverToBoxAdapter( child: Container( padding: EdgeInsets.only(left: 16.r), height: 50.sm, child: ListView( scrollDirection: Axis.horizontal, children: const [ TopBrandsImageWidget(image: AssetsBrands.hollisterPNG), TopBrandsImageWidget(image: AssetsBrands.chanelPNG), TopBrandsImageWidget(image: AssetsBrands.pradaPNG), TopBrandsImageWidget(image: AssetsBrands.hollisterPNG), TopBrandsImageWidget(image: AssetsBrands.chanelPNG), TopBrandsImageWidget(image: AssetsBrands.pradaPNG), ], ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/search_bar_widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class SearchBarWidget extends StatelessWidget { const SearchBarWidget({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return SliverToBoxAdapter( child: Container( height: 56.sm, margin: EdgeInsets.symmetric(horizontal: 16.r), padding: EdgeInsets.symmetric(horizontal: 16.r, vertical: 08.r), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12.r), color: const Color(0xFFEFF1F3), ), child: Row(children: [ Image.asset( AssetsIcons.searchPNG, height: 20.sm, width: 20.sm, ), 12.horizontalSpace, Expanded( child: TextField( decoration: InputDecoration( border: InputBorder.none, hintText: 'Search Anything...', hintStyle: GoogleFonts.dmSans(fontSize: 12.sp), ), ), ), SizedBox( height: 20.r, child: const VerticalDivider( color: Color(0xFFD8D8D8), thickness: 2, ), ), Image.asset( AssetsIcons.micPNG, // height: 22.r, // width: 16.r, ) ]), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/profile_widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class ProfileWidget extends StatelessWidget { const ProfileWidget({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return SliverToBoxAdapter( child: Row( children: [ 16.horizontalSpace, SizedBox( height: 45, width: 45, child: CircleAvatar( backgroundColor: const Color(0xFF4AB7B6), child: Image.asset(AssetsIcons.pinPNG), ), ), 10.horizontalSpace, Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Bengaluru', style: GoogleFonts.dmSans(fontSize: 10.sp), ), Text( 'BTM Layout, 500628', style: GoogleFonts.dmSans(fontSize: 12.sp), ) ], ), const Spacer(), const Icon( Icons.arrow_forward_ios_rounded, color: Color(0xFF37474F), ), 16.horizontalSpace, ], ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/appbar_widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class AppBarWidget extends StatelessWidget { const AppBarWidget({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return SliverAppBar( centerTitle: false, backgroundColor: Colors.white, title: Text.rich( TextSpan( // style: GoogleFonts.poppins(), children: [ TextSpan( text: 'Hyper', style: TextStyle( color: const Color(0xFFFDAA5D), fontSize: 18.sp, fontWeight: FontWeight.w700), ), TextSpan( text: 'Mart', style: TextStyle( fontSize: 18.sp, color: const Color(0xFF018768), fontWeight: FontWeight.w700), ), ], ), ), elevation: 0, actions: [ Row( children: [ Text( 'Eng', style: GoogleFonts.dmSans( fontSize: 12.sp, color: Colors.black, ), textAlign: TextAlign.center, ), const Icon( Icons.keyboard_arrow_down, color: Color(0xFF7D8FAB), ), 13.horizontalSpace, SizedBox( height: 32, width: 32, child: CircleAvatar( backgroundColor: const Color(0xFFE8EFF3), child: Image.asset( AssetsIcons.bellPNG, // height: 15.24, // width: 12.95, ), ), ), 16.horizontalSpace, ], ), ], ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/bottom_navigation_bar.dart
import 'package:flutter/material.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class BottomNavigationBarWidget extends StatelessWidget { const BottomNavigationBarWidget({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { final safeArea = MediaQuery.of(context).viewPadding; return Container( padding: EdgeInsets.only(bottom: safeArea.bottom), color: Colors.white, height: 63 + safeArea.bottom, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Image.asset(AssetsIcons.nav1PNG), Image.asset(AssetsIcons.nav2PNG), Image.asset( AssetsIcons.nav2PNG, color: Colors.transparent, ), Image.asset(AssetsIcons.nav3PNG), Image.asset(AssetsIcons.nav4PNG), ], ), // child: ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/carousel_slider_widget.dart
import 'package:carousel_slider/carousel_slider.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class CarouselSliderWidget extends StatelessWidget { const CarouselSliderWidget({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return SliverToBoxAdapter( child: SizedBox( height: 200.sm, width: double.infinity, child: CarouselSlider( items: [ Image.asset(AssetsImages.offerPNG), Image.asset(AssetsImages.offerPNG), Image.asset(AssetsImages.offerPNG), ], options: CarouselOptions( viewportFraction: 0.75.sm, enlargeCenterPage: true, padEnds: true, ), ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/product_items.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/pages/product_detail_page.dart'; import 'package:hypermart_flutter/utils/assets.dart'; import 'package:hypermart_flutter/models/product.dart'; import 'package:hypermart_flutter/states/product_state.dart'; import 'package:hypermart_flutter/widgets/favourite_icon_widget.dart'; class ProductItems extends StatelessWidget { const ProductItems({ Key? key, required this.product, required this.state, }) : super(key: key); final Product product; final ProductState state; @override Widget build(BuildContext context) { return GestureDetector( onTap: () => Navigator.of(context).push( MaterialPageRoute( builder: (context) => ProductDetailPage( product: product, state: state, ), ), ), child: Column( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: Stack( children: [ Container( width: double.infinity, color: product.id == '1' || product.id == '2' ? Colors.white : const Color(0xFFF2F2F2), child: Image.asset( product.image, height: 140.sm, width: 150.sm, // fit: BoxFit, ), ), FavouriteIconWidget( product: product, state: state, ) ], ), ), Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Text( product.name, style: TextStyle( fontSize: 14.sp, ), ), ), Padding( padding: const EdgeInsets.symmetric(horizontal: 12.0), child: Row( children: [ Text( '\$${product.price.toString()}', style: GoogleFonts.dmSans(fontSize: 14.sp), ), const Spacer(), Text( product.rating.toString(), style: GoogleFonts.dmSans(fontSize: 12.sp), ), 8.horizontalSpace, Image.asset( AssetsIcons.starFilledPNG, height: 13.19.sm, width: 12.62.sm, alignment: Alignment.topCenter, ), ], ), ), 14.verticalSpace, product.quantity > 0 ? Padding( padding: EdgeInsets.all(10.r), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ QuantityControlButton( text: '-', color: const Color(0xFFEA7173), callback: () => state.decreaseQuantity(product.id), ), Text( product.quantity.toString(), style: TextStyle( fontSize: 14.sp, fontWeight: FontWeight.w600, color: const Color(0xFF4AB7B6), ), ), QuantityControlButton( text: '+', color: const Color(0xFF4AB7B6), callback: () => state.increaseQuantity(product.id), ) ], ), ) : Padding( padding: EdgeInsets.all(10.r), child: SizedBox( height: 36.h, child: TextButton( style: TextButton.styleFrom( padding: EdgeInsets.symmetric(horizontal: 20.r), shape: RoundedRectangleBorder( side: const BorderSide( color: Color(0xFFFDAA5D), ), borderRadius: BorderRadius.circular(16), ), ), onPressed: () => state.increaseQuantity(product.id), child: Text( 'Add to cart', style: TextStyle( fontSize: 14.sp, fontWeight: FontWeight.w600, color: const Color(0xFFFDAA5D), ), ), ), ), ), ], ), ); } } class QuantityControlButton extends StatelessWidget { const QuantityControlButton({ Key? key, required this.text, required this.color, required this.callback, }) : super(key: key); final String text; final Color color; final VoidCallback callback; @override Widget build(BuildContext context) { return SizedBox( height: 36.h, width: 36.h, child: TextButton( style: TextButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.r), ), padding: EdgeInsets.zero, backgroundColor: color, ), onPressed: callback, child: Text( text, style: GoogleFonts.dmSans( fontSize: 24.sp, color: Colors.white, ), ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/previous_order_widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class PreviousOrderWidget extends StatelessWidget { const PreviousOrderWidget({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return SliverToBoxAdapter( child: Container( margin: EdgeInsets.symmetric(horizontal: 16.r), decoration: BoxDecoration( borderRadius: BorderRadius.circular(16.r), color: Colors.white, boxShadow: const [ BoxShadow( offset: Offset(0, 5), blurRadius: 40, color: Color(0x1F000000), ), ], ), child: Row( children: [ Expanded( child: Padding( padding: EdgeInsets.all(14.0.r), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Text( 'Delivered', style: TextStyle( fontSize: 10.sp, fontWeight: FontWeight.w700, color: const Color(0xFF14AB87), ), ), Text( 'On Wed, 27 Jul 2022', style: TextStyle(fontSize: 10.sp), ), Container( margin: EdgeInsets.symmetric(vertical: 8.r), padding: EdgeInsets.symmetric( horizontal: 15.r, vertical: 11.r), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10.r), color: const Color(0xFFF7F7F7), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Image.asset(AssetsProducts.avocadoPNG), Image.asset(AssetsProducts.platterPNG), Image.asset(AssetsProducts.saucesPNG), const Text('+5\nMore'), ]), ), Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Text( 'Order ID : # 28292999', style: TextStyle( fontSize: 10.sp, fontWeight: FontWeight.w700), ), Text( 'Final Total : \$ 123', style: GoogleFonts.dmSans( fontSize: 17.sp, fontWeight: FontWeight.w700), ) ], ), ), TextButton( onPressed: () {}, style: TextButton.styleFrom( padding: EdgeInsets.symmetric( horizontal: 14.r, vertical: 10.r, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), backgroundColor: const Color(0xFF14AB87)), child: Text( 'Order Again', style: GoogleFonts.dmSans( color: Colors.white, fontSize: 12.sp, fontWeight: FontWeight.w700, ), ), ), ], ) ], ), ), ), RotatedBox( quarterTurns: 3, child: Container( padding: EdgeInsets.all(8.r), decoration: const BoxDecoration( color: Colors.red, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(16), bottomRight: Radius.circular(16), ), ), child: Text( 'Order Again & Get Flat 10% OFF', style: GoogleFonts.dmSans( fontSize: 10.3.sp, fontWeight: FontWeight.w700, color: Colors.white, ), ), ), ) ], ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/bottom_navigation_bar_floating_button.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hypermart_flutter/models/cart.dart'; import 'package:hypermart_flutter/states/product_state.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class BottomNavigationBarFloatingButton extends StatelessWidget { const BottomNavigationBarFloatingButton({ Key? key, required this.state, }) : super(key: key); final ProductState state; @override Widget build(BuildContext context) { return Container( height: 73.sm, width: 73.sm, decoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, boxShadow: [ BoxShadow( offset: Offset(0, 4), color: Color(0x30000000), ) ]), // height: 40, child: Container( margin: const EdgeInsets.all(5), decoration: const BoxDecoration( color: Color(0xFFFDAA5D), shape: BoxShape.circle, ), child: StreamBuilder<Cart>( stream: state.cartState.cartStream, initialData: state.cartState.cart, builder: (context, snapshot) { final cart = snapshot.data!; return Stack( alignment: Alignment.center, children: [ Image.asset( AssetsIcons.cartPNG, alignment: Alignment.center, height: 22.sm, width: 24.sm, ), cart.quantity > 0 ? Positioned( top: 12.sm, right: 12.sm, child: Text( cart.quantity.toString(), style: TextStyle( fontSize: 14.sp, color: Colors.red, fontWeight: FontWeight.w700, ), ), ) : Positioned( top: 16.sm, right: 12.sm, child: Container( height: 14.sm, width: 14.sm, decoration: const BoxDecoration( color: Colors.white, shape: BoxShape.circle, ), child: Container( margin: const EdgeInsets.all(2), decoration: const BoxDecoration( color: Colors.red, shape: BoxShape.circle, ), ), ), ), ], ); }), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/widget_header.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; class WidgetHeader extends StatelessWidget { const WidgetHeader({ Key? key, required this.title, }) : super(key: key); final String title; @override Widget build(BuildContext context) { return SliverToBoxAdapter( child: Padding( padding: EdgeInsets.symmetric(horizontal: 16.0.r, vertical: 25.r), child: Row( children: [ Text( title, style: GoogleFonts.dmSans( fontSize: 16.sp, fontWeight: FontWeight.w700, ), ), const Spacer(), const Icon( Icons.arrow_forward_ios_rounded, color: Color(0xFF7D8FAB), ), ], ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/popular_deals_widget.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hypermart_flutter/models/product.dart'; import 'package:hypermart_flutter/states/product_state.dart'; import 'package:hypermart_flutter/widgets/product_banner.dart'; import 'package:hypermart_flutter/widgets/product_items.dart'; class PopularDealsWidget extends StatelessWidget { const PopularDealsWidget({ Key? key, required this.products, required this.state, }) : super(key: key); final List<Product> products; final ProductState state; @override Widget build(BuildContext context) { return SliverPadding( padding: EdgeInsets.symmetric(horizontal: 16.r), sliver: SliverGrid( delegate: SliverChildBuilderDelegate( ((context, index) { final product = products[index]; return Container( height: 260.sm, width: 150.sm, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12.r), border: Border.all(color: const Color(0xFFE8EFF3)), ), child: product.sale > 0 ? ProductBanner( product: product, state: state, ) : ProductItems( product: product, state: state, ), ); }), childCount: products.length, ), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, childAspectRatio: 15.sm / 25.sm, crossAxisSpacing: 20.r, mainAxisSpacing: 20.r, ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/top_brands_image_widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class TopBrandsImageWidget extends StatelessWidget { const TopBrandsImageWidget({ Key? key, required this.image, }) : super(key: key); final String image; @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.only(right: 10.r), child: Image.asset( image, fit: BoxFit.contain, height: 47.92, width: 95.84, ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/exclusive_beauty_deals.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/models/brand.dart'; class ExclusiveBeautyDeals extends StatelessWidget { const ExclusiveBeautyDeals({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return SliverPadding( padding: EdgeInsets.symmetric(horizontal: 16.r), sliver: SliverGrid( delegate: SliverChildBuilderDelegate( ((context, index) { final brand = exclusiveBeautyDeals[index]; return Stack( children: [ Align( alignment: Alignment.topCenter, child: Container( height: 70.w, width: 96.w, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12.r), color: const Color(0x66EAEAEA), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset(brand.image), 06.verticalSpace, ], ), ), ), Align( alignment: Alignment.bottomCenter, child: Container( height: 52.w, width: 52.w, alignment: Alignment.center, decoration: const BoxDecoration( shape: BoxShape.circle, // borderRadius: BorderRadius.circular(12.r), color: Color(0xFF4AB7B6), ), child: Text( 'Upto\n${brand.off}% OFF', textAlign: TextAlign.center, style: GoogleFonts.dmSans( fontSize: 10, color: Colors.white, fontWeight: FontWeight.w700, ), ), ), ), ], ); }), childCount: exclusiveBeautyDeals.length, ), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, // childAspectRatio: 9.r / 9.r, crossAxisSpacing: 15.r, mainAxisSpacing: 20.r, ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/product_banner.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:flutter/material.dart'; import 'package:hypermart_flutter/models/product.dart'; import 'package:hypermart_flutter/states/product_state.dart'; import 'package:hypermart_flutter/widgets/product_items.dart'; class ProductBanner extends StatelessWidget { const ProductBanner({ Key? key, required this.product, required this.state, }) : super(key: key); final Product product; final ProductState state; @override Widget build(BuildContext context) { return ClipRect( child: Banner( message: '${product.sale}% OFF', location: BannerLocation.topEnd, color: const Color(0xFFEA7173), textStyle: const TextStyle( fontSize: 12, fontWeight: FontWeight.w700, ), child: ProductItems( product: product, state: state, ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/widgets/categories_widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/models/category.dart'; class CategoriesWidget extends StatelessWidget { const CategoriesWidget({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return SliverToBoxAdapter( child: Container( padding: EdgeInsets.only(left: 16.r), height: 100.sm, child: ListView( scrollDirection: Axis.horizontal, children: categoriesList .map( (category) => Container( margin: EdgeInsets.only( right: 16.r, ), height: 90.sm, width: 96.sm, decoration: BoxDecoration( color: category.color, borderRadius: BorderRadius.circular(16.r), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset(category.image), 08.verticalSpace, Text( category.name, style: GoogleFonts.dmSans( fontSize: 12.sp, color: Colors.white, ), ) ], ), ), ) .toList(), ), ), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/pages/home_page.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/models/product.dart'; import 'package:hypermart_flutter/states/cart_state.dart'; import 'package:hypermart_flutter/states/product_state.dart'; import 'package:hypermart_flutter/widgets/appbar_widget.dart'; import 'package:hypermart_flutter/widgets/bottom_navigation_bar.dart'; import 'package:hypermart_flutter/widgets/bottom_navigation_bar_floating_button.dart'; import 'package:hypermart_flutter/widgets/carousel_slider_widget.dart'; import 'package:hypermart_flutter/widgets/categories_widget.dart'; import 'package:hypermart_flutter/widgets/exclusive_beauty_deals.dart'; import 'package:hypermart_flutter/widgets/popular_deals_widget.dart'; import 'package:hypermart_flutter/widgets/previous_order_widget.dart'; import 'package:hypermart_flutter/widgets/profile_widget.dart'; import 'package:hypermart_flutter/widgets/search_bar_widget.dart'; import 'package:hypermart_flutter/widgets/top_brands_widget.dart'; import 'package:hypermart_flutter/widgets/widget_header.dart'; class HomePage extends StatefulWidget { const HomePage({super.key}); @override State<HomePage> createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { final productState = ProductState(cartState: CartState()); @override Widget build(BuildContext context) { return StreamBuilder<List<Product>>( stream: productState.productStream, initialData: productState.products, builder: (context, snapshot) { final state = snapshot.data!; return Scaffold( floatingActionButton: BottomNavigationBarFloatingButton( state: productState, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, bottomNavigationBar: const BottomNavigationBarWidget(), backgroundColor: Colors.white, body: CustomScrollView( slivers: [ const AppBarWidget(), SliverToBoxAdapter(child: 10.verticalSpace), const ProfileWidget(), SliverToBoxAdapter(child: 20.verticalSpace), const SearchBarWidget(), const CarouselSliderWidget(), // const WidgetHeader(title: 'Categories'), SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.all(16.0), child: Row( children: [ Text( 'Categories', style: GoogleFonts.dmSans( fontSize: 16.sp, fontWeight: FontWeight.w700, ), ), const Spacer(), const Icon( Icons.arrow_forward_ios_rounded, color: Color(0xFF7D8FAB), ), ], ), ), ), const CategoriesWidget(), SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.all(16.0), child: Text( 'Previous Order', style: GoogleFonts.dmSans( fontSize: 16.sp, fontWeight: FontWeight.w700, ), ), ), ), const PreviousOrderWidget(), const WidgetHeader(title: 'Popular Deals'), PopularDealsWidget( state: productState, products: snapshot.data!, ), const WidgetHeader(title: 'Top Brands'), const TopBrandsWidget(), const WidgetHeader(title: 'Exclusive Beauty Deals'), const ExclusiveBeautyDeals(), SliverToBoxAdapter(child: 30.verticalSpace) ], ), ); }); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/pages/product_detail_page.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hypermart_flutter/models/product.dart'; import 'package:hypermart_flutter/states/product_state.dart'; import 'package:hypermart_flutter/utils/assets.dart'; import 'package:hypermart_flutter/widgets/product_items.dart'; class ProductDetailPage extends StatelessWidget { const ProductDetailPage({ Key? key, required this.product, required this.state, }) : super(key: key); final Product product; final ProductState state; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( leading: const BackButton( color: Colors.black, ), backgroundColor: Colors.white, elevation: 0, ), body: StreamBuilder<List<Product>>( stream: state.productStream, initialData: state.products, builder: (context, snapshot) { // if (snapshot.connectionState == ConnectionState.active) { // ignore: no_leading_underscores_for_local_identifiers final _product = snapshot.data!.firstWhere( (element) => element.id == product.id, ); return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Container( width: double.infinity, color: product.id == '1' || product.id == '2' ? Colors.white : const Color(0xFFF2F2F2), child: Image.asset( product.image, fit: BoxFit.cover, ), ), Padding( padding: const EdgeInsets.all(16.0), child: Row( children: [ Flexible( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Text( product.name, style: const TextStyle( fontSize: 30, fontWeight: FontWeight.w700, ), ), const Text('by AK Mart'), ], ), ), Row( mainAxisSize: MainAxisSize.min, children: [ Text( product.rating.toString(), style: GoogleFonts.dmSans(fontSize: 12.sp), ), 8.horizontalSpace, Image.asset( AssetsIcons.starFilledPNG, height: 13.19.sm, width: 12.62.sm, alignment: Alignment.topCenter, ), ], ), ], ), ), const Padding( padding: EdgeInsets.symmetric(horizontal: 16.0), child: Text( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent in posuere dui. In hac habitasse platea dictumst. Morbi vitae tincidunt leo. Etiam id libero at turpis mollis posuere consectetur.'), ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( flex: 3, child: Text( '\$${product.price.toString()}', style: GoogleFonts.dmSans(fontSize: 20.sp), textAlign: TextAlign.center, ), ), Expanded( flex: 5, child: _product.quantity > 0 ? Padding( padding: EdgeInsets.all(10.r), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ QuantityControlButton( text: '-', color: const Color(0xFFEA7173), callback: () => state.decreaseQuantity(product.id), ), Text( _product.quantity.toString(), style: TextStyle( fontSize: 14.sp, fontWeight: FontWeight.w600, color: const Color(0xFF4AB7B6), ), ), QuantityControlButton( text: '+', color: const Color(0xFF4AB7B6), callback: () => state.increaseQuantity(product.id), ) ], ), ) : Padding( padding: EdgeInsets.all(10.r), child: SizedBox( height: 36.h, child: TextButton( style: TextButton.styleFrom( padding: EdgeInsets.symmetric(horizontal: 20.r), shape: RoundedRectangleBorder( side: const BorderSide( color: Color(0xFFFDAA5D), ), borderRadius: BorderRadius.circular(16), ), ), onPressed: () => state.increaseQuantity(product.id), child: Text( 'Add to cart', style: TextStyle( fontSize: 14.sp, fontWeight: FontWeight.w600, color: const Color(0xFFFDAA5D), ), ), ), ), ), ), ], ) ], ); // } // return const Center( // child: CircularProgressIndicator(), // ); }), ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/models/brand.dart
import 'package:hypermart_flutter/utils/assets.dart'; class Brands { const Brands({ required this.image, this.off = 0, }); final String image; final int off; } const exclusiveBeautyDeals = [ Brands(image: AssetsBrands.revlonPNG, off: 10), Brands(image: AssetsBrands.lakmePNG, off: 20), Brands(image: AssetsBrands.garnierPNG, off: 15), Brands(image: AssetsBrands.maybellinePNG, off: 5), Brands(image: AssetsBrands.cliniquePNG, off: 5), Brands(image: AssetsBrands.sugarPNG, off: 60), ];
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/models/cart.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:hypermart_flutter/models/product.dart'; class Cart { const Cart({ required this.id, required this.products, required this.price, required this.quantity, }); final String id; final List<Product> products; final int price; final int quantity; Cart copyWith({ String? id, List<Product>? products, int? price, int? quantity, }) { return Cart( id: id ?? this.id, products: products ?? this.products, price: price ?? this.price, quantity: quantity ?? this.quantity, ); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/models/category.dart
import 'package:flutter/material.dart'; import 'package:hypermart_flutter/utils/assets.dart'; class Category { const Category({ required this.color, required this.image, required this.name, }); final Color color; final String image; final String name; } const categoriesList = [ Category( color: Color(0xFF4AB7B6), image: AssetsIcons.cat1PNG, name: 'Groceries', ), Category( color: Color(0xFF4B9DCB), image: AssetsIcons.cat2PNG, name: 'Appliances', ), Category( color: Color(0xD9AF558B), image: AssetsIcons.cat3PNG, name: 'Fashion', ), Category( color: Color(0xFF4AB7B6), image: AssetsIcons.cat1PNG, name: 'Groceries', ), Category( color: Color(0xFF4B9DCB), image: AssetsIcons.cat2PNG, name: 'Appliances', ), Category( color: Color(0xD9AF558B), image: AssetsIcons.cat3PNG, name: 'Fashion', ), ];
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/models/product.dart
import 'package:hypermart_flutter/utils/assets.dart'; class Product { const Product({ required this.id, required this.name, required this.image, required this.price, required this.rating, required this.sale, this.isFavorite = false, this.quantity = 0, }); final String id; final String name; final String image; final int price; final double rating; final bool isFavorite; final int sale; final int quantity; Product copyWith({ String? id, String? name, String? image, int? price, double? rating, bool? isFavorite, int? sale, int? quantity, }) { return Product( id: id ?? this.id, name: name ?? this.name, image: image ?? this.image, price: price ?? this.price, rating: rating ?? this.rating, isFavorite: isFavorite ?? this.isFavorite, sale: sale ?? this.sale, quantity: quantity ?? this.quantity, ); } } const productsList = [ Product( id: '1', name: 'Strawberries', image: AssetsProducts.strawberriesPNG, price: 10, rating: 4.8, isFavorite: false, sale: 5, quantity: 2, ), Product( id: '2', name: 'Fried Chips', image: AssetsProducts.chipsPNG, price: 12, rating: 4.8, isFavorite: false, sale: 0, ), Product( id: '3', name: 'Moder Chair', image: AssetsProducts.madorChairPNG, price: 3599, rating: 4.8, isFavorite: false, sale: 0, ), Product( id: '4', name: 'LG washing machine', image: AssetsProducts.lgWashingMachinePNG, price: 45999, rating: 4.8, isFavorite: false, sale: 0, quantity: 2, ), ];
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/states/product_state.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'dart:async'; import 'package:hypermart_flutter/models/cart.dart'; import 'package:hypermart_flutter/models/product.dart'; import 'package:hypermart_flutter/states/cart_state.dart'; class ProductState { final CartState cartState; ProductState({ required this.cartState, }); List<Product> products = [...productsList]; final _productsController = StreamController<List<Product>>.broadcast(); Stream<List<Product>> get productStream => _productsController.stream; void increaseQuantity(String id) { products = products.map((product) { if (product.id == id) { return product.copyWith(quantity: product.quantity + 1); } return product; }).toList(); cartState.totolQuantity(products); cartState.totolPrice(products); _productsController.add(products); } void decreaseQuantity(String id) { products = products.map((product) { if (product.id == id) { return product.copyWith(quantity: product.quantity - 1); } return product; }).toList(); cartState.totolQuantity(products); cartState.totolPrice(products); _productsController.add(products); } void favoriteStatus(String id) { products = products.map((product) { if (product.id == id) { return product.copyWith(isFavorite: !product.isFavorite); } return product; }).toList(); _productsController.add(products); } Future<void> dispose() async { await _productsController.close(); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/states/cart_state.dart
// ignore_for_file: public_member_api_docs, sort_constructors_first import 'dart:async'; import 'package:hypermart_flutter/models/cart.dart'; import 'package:hypermart_flutter/models/product.dart'; class CartState { Cart cart = const Cart(products: [], id: '1', price: 0, quantity: 4); final _cartController = StreamController<Cart>(); Stream<Cart> get cartStream => _cartController.stream; void totolQuantity(List<Product> products) { final quantity = products.fold( 0, (previousValue, element) => element.quantity + previousValue); cart = cart.copyWith(quantity: quantity); _cartController.add(cart); } void totolPrice(List<Product> products) { final price = products.fold(0, (previousValue, element) { return (element.price * element.quantity) + previousValue; }); cart = cart.copyWith(price: price); _cartController.add(cart); } Future<void> dispose() async { await _cartController.close(); } }
0
mirrored_repositories/hyper_mart_shopping/lib
mirrored_repositories/hyper_mart_shopping/lib/utils/assets.dart
// class Assets { // Assets._(); // static final brands = _AssetsBrands._(); // static final icons = _AssetsIcons._(); // static final images = _AssetsImages._(); // static final products = _AssetsProducts._(); // } class AssetsBrands { AssetsBrands._(); static const chanelPNG = 'assets/brands/chanel.png'; static const cliniquePNG = 'assets/brands/clinique.png'; static const garnierPNG = 'assets/brands/garnier.png'; static const hollisterPNG = 'assets/brands/hollister.png'; static const lakmePNG = 'assets/brands/lakme.png'; static const maybellinePNG = 'assets/brands/maybelline.png'; static const pradaPNG = 'assets/brands/prada.png'; static const revlonPNG = 'assets/brands/revlon.png'; static const sugarPNG = 'assets/brands/sugar.png'; } class AssetsIcons { AssetsIcons._(); static const bellPNG = 'assets/icons/bell.png'; static const cartPNG = 'assets/icons/cart.png'; static const cat1PNG = 'assets/icons/cat_1.png'; static const cat2PNG = 'assets/icons/cat_2.png'; static const cat3PNG = 'assets/icons/cat_3.png'; static const heartPNG = 'assets/icons/heart.png'; static const heartFilledPNG = 'assets/icons/heart_filled.png'; static const micPNG = 'assets/icons/mic.png'; static const nav1PNG = 'assets/icons/nav_1.png'; static const nav2PNG = 'assets/icons/nav_2.png'; static const nav3PNG = 'assets/icons/nav_3.png'; static const nav4PNG = 'assets/icons/nav_4.png'; static const pinPNG = 'assets/icons/pin.png'; static const searchPNG = 'assets/icons/search.png'; static const starPNG = 'assets/icons/star.png'; static const starFilledPNG = 'assets/icons/star_filled.png'; } class AssetsImages { AssetsImages._(); static const offerPNG = 'assets/images/offer.png'; } class AssetsProducts { AssetsProducts._(); static const avocadoPNG = 'assets/products/avocado.png'; static const chipsPNG = 'assets/products/chips.png'; static const lgWashingMachinePNG = 'assets/products/lg_washing_machine.png'; static const madorChairPNG = 'assets/products/mador_chair.png'; static const platterPNG = 'assets/products/platter.png'; static const saucesPNG = 'assets/products/sauces.png'; static const strawberriesPNG = 'assets/products/strawberries.png'; }
0
mirrored_repositories/hyper_mart_shopping
mirrored_repositories/hyper_mart_shopping/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:hypermart_flutter/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/homepage.dart
import 'package:fitness_web_ui/widgets/dashboard.dart'; import 'package:fitness_web_ui/utils/responsive.dart'; import 'package:fitness_web_ui/utils/MenuController.dart'; import 'package:fitness_web_ui/widgets/drawer.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class HomePage extends StatefulWidget { const HomePage({Key key}) : super(key: key); @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { @override Widget build(BuildContext context) { return Scaffold( key: context.read<MenuController>().scaffoldKey, drawer: SideMenu(), body: SafeArea( child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ if (Responsive.isDesktop(context)) Expanded(child: SideMenu()), Expanded( child: Dashboard(), flex: 5, ) ], ), ), ); } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/models.dart
import 'package:flutter/cupertino.dart'; class CalorieList { final String svgSource, title, subtitle; CalorieList(this.svgSource, this.title, this.subtitle); } class GridViewItems { final String image, title, buttonLabel; GridViewItems(this.image, this.title, this.buttonLabel); } class GoalItems { final double percentage; final IconData icon; final String label, percentageCompleted, goals, leftThisWeek, completed; GoalItems(this.percentage, this.icon, this.label, this.percentageCompleted, this.goals, this.leftThisWeek, this.completed); } class ChartData { ChartData(this.x, this.high, this.low); final String x; final double high, low; } class PieData { PieData(this.xData, this.yData, [this.text]); final String xData; final num yData; final String text; }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/main.dart
import 'package:fitness_web_ui/homepage.dart'; import 'package:fitness_web_ui/utils/MenuController.dart'; import 'package:fitness_web_ui/utils/constants.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'MyFitness', theme: ThemeData( textTheme: GoogleFonts.montserratTextTheme(Theme.of(context).textTheme).apply( bodyColor: drawerTextColor, ), //textTheme: GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme).apply(bodyColor: Colors.white), primarySwatch: Colors.blue, ), home: MultiProvider( providers: [ChangeNotifierProvider(create: (context) => MenuController())], child: HomePage()), ); } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/widgets/right_column.dart
import 'package:fitness_web_ui/utils/constants.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; import '../models.dart'; class RightColumn extends StatelessWidget { const RightColumn({Key key}) : super(key: key); @override Widget build(BuildContext context) { List<CalorieList> calorieList = [ CalorieList("assets/fruits/apple.svg", "Apple", "45"), CalorieList("assets/fruits/banana.svg", "Banana", "80"), CalorieList("assets/fruits/apricot.svg", "Apricot", "17"), CalorieList("assets/fruits/blueberry.svg", "Blueberries", "51"), CalorieList("assets/fruits/carrot.svg", "Carrot", "78"), CalorieList("assets/fruits/strawberry.svg", "Strawberry", "37"), CalorieList("assets/fruits/grapes.svg", "Grapes", "66"), ]; return Container( padding: EdgeInsets.all(defaultPadding / 2), decoration: BoxDecoration( color: Colors.transparent, borderRadius: BorderRadius.circular(10), ), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("Heart Rate", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)), Container( padding: EdgeInsets.all(10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), child: Icon(Icons.menu), ) ], ), SizedBox( height: defaultPadding, ), Container( child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "+1.50%", style: Theme.of(context).textTheme.bodyText1.apply(color: TextColor), ), Text( "Stats", style: Theme.of(context).textTheme.headline5.apply(color: Colors.white), ), ], ), Container( padding: EdgeInsets.fromLTRB(10, 5, 0, 5), decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)), child: Row( children: [ Text( "Month", style: TextStyle(fontWeight: FontWeight.bold), ), Icon(Icons.keyboard_arrow_down) ], ), ) ], ), SfCartesianChart( plotAreaBorderWidth: 0, primaryYAxis: NumericAxis( isVisible: false, majorGridLines: MajorGridLines(width: 0), axisLine: AxisLine(width: 0)), primaryXAxis: CategoryAxis(majorGridLines: MajorGridLines(width: 0), axisLine: AxisLine(width: 0)), series: <RangeColumnSeries>[ RangeColumnSeries<ChartData, String>( dataSource: <ChartData>[ ChartData('Sun', 60, 80), ChartData('Mon', 55, 75), ChartData('Tue', 60, 90), ChartData('Wed', 60, 117), ChartData('Thu', 55, 120), ChartData('Fri', 50, 85), ChartData('Sat', 58, 75), ], color: Colors.white, width: 0.5, borderRadius: BorderRadius.circular(defaultPadding - 5), xValueMapper: (ChartData sales, _) => sales.x, lowValueMapper: (ChartData sales, _) => sales.low, highValueMapper: (ChartData sales, _) => sales.high, ) ]), ], ), padding: EdgeInsets.all(defaultPadding), margin: EdgeInsets.only(bottom: defaultPadding), decoration: BoxDecoration(borderRadius: BorderRadius.circular(10.0), color: drawerTextColor), ), Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("Calories", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)), Container( padding: EdgeInsets.all(10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), child: Icon(Icons.menu), ) ]), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.white, ), margin: EdgeInsets.only(top: defaultPadding), padding: EdgeInsets.all(defaultPadding), child: ListView.separated( physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemCount: calorieList.length, itemBuilder: (context, index) { return ListTile( leading: Container( padding: EdgeInsets.all(10), child: SvgPicture.asset( calorieList[index].svgSource, height: 35, width: 35, ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), ), title: Text( calorieList[index].title, style: TextStyle(fontWeight: FontWeight.bold), ), subtitle: Text( "Calories: " + calorieList[index].subtitle, style: TextStyle(fontSize: 12), ), trailing: Icon(Icons.chevron_right), ); }, separatorBuilder: (BuildContext context, int index) { return Divider( color: Colors.grey.withOpacity(0.2), ); }, )) ], ), ); } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/widgets/goal_cards.dart
import 'package:fitness_web_ui/utils/responsive.dart'; import 'package:fitness_web_ui/utils/constants.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:percent_indicator/linear_percent_indicator.dart'; class GoalCards extends StatelessWidget { const GoalCards( {Key key, this.icon, this.label, this.percentageCompleted, this.goal, this.leftThisWeek, this.completed, this.percent}) : super(key: key); final double percent; final IconData icon; final String label, percentageCompleted, goal, leftThisWeek, completed; @override Widget build(BuildContext context) { final Size _size = MediaQuery.of(context).size; return Stack( alignment: Alignment.center, children: [ if (!Responsive.isMobile(context)) Container( margin: EdgeInsets.only(left: 20), padding: EdgeInsets.all(defaultPadding), decoration: BoxDecoration( color: backgroundColor, borderRadius: BorderRadius.circular(defaultPadding)), height: 120, child: Align( alignment: Alignment.centerRight, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( percentageCompleted, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), ), Text( goal, style: TextStyle(color: TextColor), textAlign: TextAlign.center, ) ], ), ), ), Container( padding: EdgeInsets.fromLTRB(20, 10, 10, 10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( padding: const EdgeInsets.only(left: defaultPadding, bottom: defaultPadding), child: Text( label, style: Theme.of(context).textTheme.headline6, ), ), Flexible( child: LinearPercentIndicator( padding: EdgeInsets.only(left: defaultPadding, top: 5), width: _size.width * 0.3, animation: true, lineHeight: 10.0, animationDuration: 2500, percent: percent, linearStrokeCap: LinearStrokeCap.roundAll, progressColor: Colors.green, ), ), ], ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( padding: const EdgeInsets.only(right: defaultPadding), child: Text( completed, style: TextStyle(color: TextColor), ), ), Container( margin: EdgeInsets.only(top: 10), padding: EdgeInsets.all(5), child: ElevatedButton( onPressed: () {}, child: Text( leftThisWeek, style: TextStyle(color: Colors.pink, fontSize: 12), ), style: ElevatedButton.styleFrom( primary: Colors.pink[100], shape: new RoundedRectangleBorder( borderRadius: new BorderRadius.circular(50.0), ), ), ), ), ], ), ), ], ), decoration: BoxDecoration(boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], color: Colors.white, borderRadius: BorderRadius.circular(defaultPadding)), height: 120, margin: EdgeInsets.only(right: Responsive.isMobile(context) ? 0 : 120, left: 20)), Align( alignment: Alignment.centerLeft, child: Container( padding: EdgeInsets.all(10), decoration: BoxDecoration( color: drawerTextColor, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), child: Icon( icon, color: Colors.white, ), ), ) ], ); } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/widgets/dashboard_body_header.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class DashboardBodyHeader extends StatelessWidget { const DashboardBodyHeader({Key key, this.label}) : super(key: key); final String label; @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(label, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)), Container( padding: EdgeInsets.all(10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), child: Icon(Icons.menu), ) ], ); } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/widgets/dashboard_kpi.dart
import 'package:fitness_web_ui/utils/constants.dart'; import 'package:flutter/material.dart'; import '../models.dart'; class GridItems extends StatelessWidget { const GridItems({Key key, this.crossAxisCount = 4, this.aspectRatio = 1}) : super(key: key); final int crossAxisCount; final double aspectRatio; @override Widget build(BuildContext context) { List<GridViewItems> gridviewItems = [ GridViewItems("assets/images/running.png", "Steps per Week", "8000"), GridViewItems("assets/images/walking.png", "Walking distance", "12 mil"), GridViewItems("assets/images/heartrate.png", "Average Heart rate", "75"), GridViewItems("assets/images/goal.png", "Goals Completed", "4"), ]; return GridView.builder( physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: crossAxisCount, mainAxisSpacing: 10.0, crossAxisSpacing: defaultPadding, childAspectRatio: aspectRatio), itemCount: gridviewItems.length, shrinkWrap: true, itemBuilder: (context, index) { return Container( child: Stack( alignment: Alignment.topCenter, children: [ Container( width: MediaQuery.of(context).size.width * 0.4, margin: EdgeInsets.only(top: 30), decoration: BoxDecoration( color: backgroundColor, borderRadius: BorderRadius.circular(10), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ SizedBox( height: 30, ), Text( gridviewItems[index].title, style: TextStyle(color: TextColor, fontWeight: FontWeight.bold), textAlign: TextAlign.center, ), Padding( padding: const EdgeInsets.all(6.0), child: TextButton( onPressed: () {}, child: Text( gridviewItems[index].buttonLabel, style: TextStyle(fontSize: 20, color: drawerTextColor, fontWeight: FontWeight.bold), ), style: ElevatedButton.styleFrom( primary: Colors.white, padding: EdgeInsets.fromLTRB(30, 10, 30, 10), shape: new RoundedRectangleBorder( borderRadius: new BorderRadius.circular(5.0), ), ), ), ), ], ), ), Image.asset( gridviewItems[index].image, height: 60, ) ], ), ); }); } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/widgets/dashboard.dart
import 'package:fitness_web_ui/widgets/dashboard_kpi.dart'; import 'package:fitness_web_ui/widgets/header.dart'; import 'package:fitness_web_ui/utils/constants.dart'; import 'package:fitness_web_ui/widgets/dashboard_body_header.dart'; import 'package:fitness_web_ui/widgets/goal_cards.dart'; import 'package:fitness_web_ui/widgets/right_column.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; import '../models.dart'; import '../utils/responsive.dart'; import '../utils/constants.dart'; class Dashboard extends StatefulWidget { const Dashboard({Key key}) : super(key: key); @override _DashboardState createState() => _DashboardState(); } class _DashboardState extends State<Dashboard> { @override Widget build(BuildContext context) { final Size _size = MediaQuery.of(context).size; List<GoalItems> goalsItems = [ GoalItems(0.5, Icons.directions_bike, "Bicycle", "50%", "36 Km / week", "3 days left", "17 km"), GoalItems(0.3, Icons.directions_run, "Jogging", "30%", "8000 steps \n/ day", "2 days left", "3600 steps"), GoalItems(0.8, Icons.flag, "My Goals", "80%", "8 goals / week", "4 days left", "4 goals"), ]; List <Widget> widgetList = [ ]; return SafeArea( child: SingleChildScrollView( padding: EdgeInsets.all(defaultPadding), child: Column( children: [ Header(), SizedBox( height: defaultPadding, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Column( children: [ Responsive( mobile: GridItems( crossAxisCount: _size.width < 650 ? 2 : 4, aspectRatio: _size.width < 650 ? 1.3 : 1, ), desktop: GridItems( aspectRatio: _size.width < 1400 ? 1.1 : 1.4, ), tablet: GridItems(), ), SizedBox( height: defaultPadding, ), Container( padding: EdgeInsets.all(defaultPadding), decoration: BoxDecoration( color: secondaryColor, borderRadius: BorderRadius.circular(10), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ DashboardBodyHeader( label: "My Goals", ), SizedBox( height: 20, ), ListView.separated( physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemCount: goalsItems.length, itemBuilder: (context, index) { return GoalCards( percent: goalsItems[index].percentage, icon: goalsItems[index].icon, label: goalsItems[index].label, percentageCompleted: goalsItems[index].percentageCompleted, goal: goalsItems[index].goals, leftThisWeek: goalsItems[index].leftThisWeek, completed: goalsItems[index].completed, ); }, separatorBuilder: (BuildContext context, int index) { return SizedBox( height: 20, ); }, ), ], ), ), SizedBox( height: defaultPadding, ), Responsive(mobile: Column( children: [ Container( padding: EdgeInsets.all(defaultPadding), decoration: BoxDecoration( color: secondaryColor, borderRadius: BorderRadius.circular(10), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ DashboardBodyHeader( label: "Daily Activity", ), Container( child: SfCircularChart( legend: Legend(isVisible: true), series: <CircularSeries<PieData, String>>[ DoughnutSeries<PieData, String>( explode: true, explodeIndex: 0, dataSource: [ PieData("Stamina", 40), PieData("Cardio", 20), PieData("Strength", 30), PieData("Stretching", 10) ], xValueMapper: (PieData data, _) => data.xData, yValueMapper: (PieData data, _) => data.yData, ), ])), ], ), ), SizedBox( height: defaultPadding, ), Container( padding: EdgeInsets.all(defaultPadding), decoration: BoxDecoration( color: secondaryColor, borderRadius: BorderRadius.circular(10), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ DashboardBodyHeader( label: "Your Trainers", ), SizedBox( height: 20, ), ListTile( leading: Container( padding: EdgeInsets.all(10), child: SvgPicture.asset( "assets/icons/coach1.svg", height: 35, width: 35, ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), ), title: Text( "Dwayne Johnson", style: TextStyle(fontWeight: FontWeight.bold), ), subtitle: Text( "Wrestling Coach", style: TextStyle(fontSize: 12), ), trailing: Icon( Icons.message_rounded, color: Colors.blue, ), ), SizedBox( height: 20, ), ListTile( leading: Container( padding: EdgeInsets.all(10), child: SvgPicture.asset( "assets/icons/coach2.svg", height: 35, width: 35, ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), ), title: Text( "Mike Tyson", style: TextStyle(fontWeight: FontWeight.bold), ), subtitle: Text( "Boxing Coach", style: TextStyle(fontSize: 12), ), trailing: Icon( Icons.message_rounded, color: Colors.grey, ), ) ], ), ), ], ), desktop: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Container( padding: EdgeInsets.all(defaultPadding), decoration: BoxDecoration( color: secondaryColor, borderRadius: BorderRadius.circular(10), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ DashboardBodyHeader( label: "Daily Activity", ), Container( child: SfCircularChart( legend: Legend(isVisible: true), series: <CircularSeries<PieData, String>>[ DoughnutSeries<PieData, String>( explode: true, explodeIndex: 0, dataSource: [ PieData("Stamina", 40), PieData("Cardio", 20), PieData("Strength", 30), PieData("Stretching", 10) ], xValueMapper: (PieData data, _) => data.xData, yValueMapper: (PieData data, _) => data.yData, ), ])), ], ), ), ), SizedBox( width: defaultPadding, ), Expanded( child: Container( padding: EdgeInsets.all(defaultPadding), decoration: BoxDecoration( color: secondaryColor, borderRadius: BorderRadius.circular(10), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ DashboardBodyHeader( label: "Your Trainers", ), SizedBox( height: 20, ), ListTile( leading: Container( padding: EdgeInsets.all(10), child: SvgPicture.asset( "assets/fruits/apple.svg", height: 35, width: 35, ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), ), title: Text( "Dwayne Johnson", style: TextStyle(fontWeight: FontWeight.bold), ), subtitle: Text( "Wrestling Coach", style: TextStyle(fontSize: 12), ), trailing: Icon( Icons.message_rounded, color: Colors.blue, ), ), SizedBox( height: 20, ), ListTile( leading: Container( padding: EdgeInsets.all(10), child: SvgPicture.asset( "assets/fruits/apple.svg", height: 35, width: 35, ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], ), ), title: Text( "Dwayne Johnson", style: TextStyle(fontWeight: FontWeight.bold), ), subtitle: Text( "Wrestling Coach", style: TextStyle(fontSize: 12), ), trailing: Icon( Icons.message_rounded, color: Colors.grey, ), ) ], ), ), ), ], ),), if (Responsive.isMobile(context)) SizedBox( height: defaultPadding, ), if (Responsive.isMobile(context)) RightColumn() ], ), flex: 5, ), if (!Responsive.isMobile(context)) SizedBox( width: defaultPadding, ), if (!Responsive.isMobile(context)) Expanded( child: RightColumn(), flex: 2, ) ], ) ], ), )); } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/widgets/drawer.dart
import 'package:fitness_web_ui/utils/constants.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; class SideMenu extends StatelessWidget { const SideMenu({Key key}) : super(key: key); @override Widget build(BuildContext context) { final List<RadialChartData> chartData = <RadialChartData>[ RadialChartData('Calories', 75, const Color.fromRGBO(235, 97, 143, 1)), RadialChartData('Steps', 80, const Color.fromRGBO(145, 132, 202, 1)), RadialChartData('SpO2', 98, const Color.fromRGBO(69, 187, 161, 1)), ]; return Drawer( child: LayoutBuilder( builder: (context, constraints) { return SingleChildScrollView( child: Container( child: ConstrainedBox( constraints: constraints.copyWith( minHeight: constraints.maxHeight, maxHeight: double.infinity, ), child: IntrinsicHeight( child: SafeArea( child: Column( children: [ Column( children: <Widget>[ DrawerHeader( child: Container( child: SfCircularChart( legend: Legend(isVisible: true, position: LegendPosition.bottom,overflowMode: LegendItemOverflowMode.wrap), series: <CircularSeries<RadialChartData, String>>[ RadialBarSeries<RadialChartData, String>( enableTooltip: true, maximumValue: 100, radius: '100%', gap: '10%', dataSource: chartData, cornerStyle: CornerStyle.bothCurve, xValueMapper: (RadialChartData data, _) => data.x, yValueMapper: (RadialChartData data, _) => data.y, pointColorMapper: (RadialChartData data, _) => data.color) ]))), DrawerListTile( opacityGrade: 1.0, title: "Activity", svgSrc: "assets/icons/activity.svg", press: () {}, ), DrawerListTile( title: "BMI", svgSrc: "assets/icons/bmi.svg", press: () {}, ), DrawerListTile( title: "Heart", svgSrc: "assets/icons/heart.svg", press: () {}, ), DrawerListTile( title: "Sleep", svgSrc: "assets/icons/sleep.svg", press: () {}, ), DrawerListTile( title: "Goals", svgSrc: "assets/icons/goals.svg", press: () {}, ), DrawerListTile( title: "Workout", svgSrc: "assets/icons/workout.svg", press: () {}, ), ], ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ Image.asset( "assets/images/nav_img.png", ), Padding( padding: const EdgeInsets.all(8.0), child: Text( "Change dashboard settings from here", style: TextStyle(color: TextColor, fontSize: 12.0), textAlign: TextAlign.center, ), ), Container( margin: EdgeInsets.fromLTRB(10, 10, 10, 20), child: ElevatedButton( onPressed: () {}, child: Text("Settings"), style: ElevatedButton.styleFrom( primary: drawerTextColor, padding: EdgeInsets.fromLTRB(40, 20, 40, 20), elevation: 10, shape: new RoundedRectangleBorder( borderRadius: new BorderRadius.circular(10.0), ), ), ), ), ], ), ) ], ), ), ), ), ), ); }, ), ); } } class DrawerListTile extends StatelessWidget { const DrawerListTile({Key key, this.title, this.svgSrc, this.press, this.opacityGrade = 0.5}) : super(key: key); final String title, svgSrc; final double opacityGrade; final VoidCallback press; @override Widget build(BuildContext context) { return Opacity( opacity: opacityGrade, child: ListTile( onTap: press, horizontalTitleGap: 0.0, leading: SvgPicture.asset( svgSrc, color: drawerTextColor, height: 16, ), title: Text( title, style: TextStyle(fontWeight: FontWeight.bold), ), ), ); } } class RadialChartData { RadialChartData(this.x, this.y, this.color); final String x; final double y; final Color color; }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/widgets/header.dart
import 'package:fitness_web_ui/utils/MenuController.dart'; import 'package:fitness_web_ui/utils/constants.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; import '../utils/responsive.dart'; class Header extends StatelessWidget { const Header({Key key}) : super(key: key); @override Widget build(BuildContext context) { return Row( children: [ if (!Responsive.isDesktop(context)) IconButton( icon: Icon(Icons.menu), onPressed: () { context.read<MenuController>().controlMenu(); }), if (!Responsive.isMobile(context)) Text( "Dashboard", style: Theme.of(context).textTheme.headline6, ), if (!Responsive.isMobile(context)) Spacer( flex: Responsive.isDesktop(context) ? 2 : 1, ), Expanded( child: SearchField(), ), ProfileCard() ], ); } } class ProfileCard extends StatelessWidget { const ProfileCard({Key key}) : super(key: key); @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(left: defaultPadding), padding: EdgeInsets.symmetric(horizontal: defaultPadding, vertical: defaultPadding / 2), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.white, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 15, offset: Offset(0, 3), ), ], border: Border.all(color: Colors.white54)), child: Row( children: [ SvgPicture.asset( "assets/icons/avatar.svg", height: 35, width: 35, ), if (!Responsive.isMobile(context)) Padding( padding: EdgeInsets.symmetric(horizontal: defaultPadding / 2), child: Text("Ananta Jolil"), ), ], ), ); } } class SearchField extends StatelessWidget { const SearchField({Key key}) : super(key: key); @override Widget build(BuildContext context) { return TextField( decoration: InputDecoration( hintText: "Search", suffixIcon: GestureDetector( onTap: (){}, child: Container( margin: EdgeInsets.symmetric(horizontal: defaultPadding / 2), child: SvgPicture.asset("assets/icons/search.svg",color: drawerTextColor,), padding: EdgeInsets.all(defaultPadding * 0.75), decoration: BoxDecoration(color: primaryColor, borderRadius: const BorderRadius.all(Radius.circular(10)),), ), ), //fillColor: secondaryColor, filled: true, border: OutlineInputBorder( borderSide: BorderSide.none, borderRadius: const BorderRadius.all(Radius.circular(10)))), ); } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/utils/responsive.dart
import 'package:flutter/material.dart'; class Responsive extends StatelessWidget { final Widget mobile; final Widget tablet; final Widget desktop; const Responsive({ Key key, @required this.mobile, this.tablet, @required this.desktop, }) : super(key: key); static bool isMobile(BuildContext context) => MediaQuery.of(context).size.width < 850; static bool isTablet(BuildContext context) => MediaQuery.of(context).size.width < 1100 && MediaQuery.of(context).size.width >= 850; static bool isDesktop(BuildContext context) => MediaQuery.of(context).size.width >= 1100; @override Widget build(BuildContext context) { final Size _size = MediaQuery.of(context).size; // If our width is more than 1100 then we consider it a desktop if (_size.width >= 1100) { return desktop; } // If width it less then 1100 and more then 850 we consider it as tablet else if (_size.width >= 850 && tablet != null) { return tablet; } // Or less then that we called it mobile else { return mobile; } } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/utils/MenuController.dart
import 'package:flutter/material.dart'; class MenuController extends ChangeNotifier { final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); GlobalKey<ScaffoldState> get scaffoldKey => _scaffoldKey; void controlMenu() { if (!_scaffoldKey.currentState.isDrawerOpen) { _scaffoldKey.currentState.openDrawer(); } } }
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/lib/utils/constants.dart
import 'package:flutter/cupertino.dart'; const primaryColor = Color(0xFFFFFFFF); const backgroundColor = Color(0xFFF8EEE5); const drawerTextColor = Color(0xFF141A2F); const TextColor = Color(0xFF8E8E8E); const secondaryColor = Color(0xFFFFFFFF); const defaultPadding = 15.0;
0
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard
mirrored_repositories/Flutter-Responsive-UI-Fitness-Dashboard/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:fitness_web_ui/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/flutter-sqflite-example
mirrored_repositories/flutter-sqflite-example/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_sqflite_example/pages/home_page.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter SQFLite Example', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.teal, accentColor: Colors.tealAccent, ), home: HomePage(), ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/common_widgets/color_picker.dart
import 'package:flutter/material.dart'; class ColorPicker extends StatelessWidget { const ColorPicker({ Key? key, required this.colors, required this.selectedIndex, required this.onChanged, }) : super(key: key); final List<Color> colors; final int selectedIndex; final Function(int) onChanged; @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Select color', style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.w500, ), ), SizedBox(height: 12.0), Container( height: 40.0, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: colors.length, itemBuilder: (context, index) { return GestureDetector( onTap: () => onChanged(index), child: Container( height: 40.0, width: 40.0, margin: const EdgeInsets.only(right: 12.0), decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( width: 3.0, color: selectedIndex == index ? Colors.teal : Colors.black, ), color: colors[index], ), child: selectedIndex == index ? Icon( Icons.done, color: Colors.tealAccent, ) : SizedBox(), ), ); }, ), ), ], ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/common_widgets/breed_selector.dart
import 'package:flutter/material.dart'; class BreedSelector extends StatelessWidget { const BreedSelector({ Key? key, required this.breeds, required this.selectedIndex, required this.onChanged, }) : super(key: key); final List<String> breeds; final int selectedIndex; final Function(int) onChanged; @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Select breed', style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.w500, ), ), SizedBox(height: 12.0), Container( height: 40.0, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: breeds.length, itemBuilder: (context, index) { return GestureDetector( onTap: () => onChanged(index), child: Container( height: 40.0, padding: EdgeInsets.symmetric(horizontal: 12.0), margin: const EdgeInsets.only(right: 12.0), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8.0), border: Border.all( width: 3.0, color: selectedIndex == index ? Colors.teal : Colors.black, ), ), child: Text(breeds[index]), ), ); }, ), ), ], ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/common_widgets/age_slider.dart
import 'package:flutter/material.dart'; class AgeSlider extends StatelessWidget { const AgeSlider({ Key? key, required this.max, required this.selectedAge, required this.onChanged, }) : super(key: key); final double max; final double selectedAge; final Function(double) onChanged; @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Select age', style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.w500, ), ), SizedBox(height: 8.0), Row( children: [ Expanded( child: Slider( min: 0.0, max: max, divisions: max.toInt(), value: selectedAge, onChanged: onChanged, ), ), Container( padding: const EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.grey[300], borderRadius: BorderRadius.circular(4.0), ), child: Text( selectedAge.toInt().toString(), style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.w500, ), ), ), SizedBox(width: 12.0), ], ), ], ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/common_widgets/dog_builder.dart
import 'package:flutter/material.dart'; import 'package:flutter_sqflite_example/models/dog.dart'; import 'package:flutter_sqflite_example/services/database_service.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class DogBuilder extends StatelessWidget { const DogBuilder({ Key? key, required this.future, required this.onEdit, required this.onDelete, }) : super(key: key); final Future<List<Dog>> future; final Function(Dog) onEdit; final Function(Dog) onDelete; Future<String> getBreedName(int id) async { final DatabaseService _databaseService = DatabaseService(); final breed = await _databaseService.breed(id); return breed.name; } @override Widget build(BuildContext context) { return FutureBuilder<List<Dog>>( future: future, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Center( child: CircularProgressIndicator(), ); } return Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), child: ListView.builder( itemCount: snapshot.data!.length, itemBuilder: (context, index) { final dog = snapshot.data![index]; return _buildDogCard(dog, context); }, ), ); }, ); } Widget _buildDogCard(Dog dog, BuildContext context) { return Card( child: Padding( padding: const EdgeInsets.all(12.0), child: Row( children: [ Container( height: 40.0, width: 40.0, decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.grey[200], ), alignment: Alignment.center, child: FaIcon(FontAwesomeIcons.dog, size: 18.0), ), SizedBox(width: 20.0), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( dog.name, style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.w500, ), ), SizedBox(height: 4.0), FutureBuilder<String>( future: getBreedName(dog.breedId), builder: (context, snapshot) { return Text('Breed: ${snapshot.data}'); }, ), SizedBox(height: 4.0), Row( children: [ Text('Age: ${dog.age.toString()}, Color: '), Container( height: 15.0, width: 15.0, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4.0), color: dog.color, border: Border.all( color: Colors.black, width: 1.5, ), ), ), ], ), ], ), ), SizedBox(width: 20.0), GestureDetector( onTap: () => onEdit(dog), child: Container( height: 40.0, width: 40.0, decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.grey[200], ), alignment: Alignment.center, child: Icon(Icons.edit, color: Colors.orange[800]), ), ), SizedBox(width: 20.0), GestureDetector( onTap: () => onDelete(dog), child: Container( height: 40.0, width: 40.0, decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.grey[200], ), alignment: Alignment.center, child: Icon(Icons.delete, color: Colors.red[800]), ), ), ], ), ), ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/common_widgets/breed_builder.dart
import 'package:flutter/material.dart'; import 'package:flutter_sqflite_example/models/breed.dart'; class BreedBuilder extends StatelessWidget { const BreedBuilder({ Key? key, required this.future, }) : super(key: key); final Future<List<Breed>> future; @override Widget build(BuildContext context) { return FutureBuilder<List<Breed>>( future: future, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Center( child: CircularProgressIndicator(), ); } return Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), child: ListView.builder( itemCount: snapshot.data!.length, itemBuilder: (context, index) { final breed = snapshot.data![index]; return _buildBreedCard(breed, context); }, ), ); }, ); } Widget _buildBreedCard(Breed breed, BuildContext context) { return Card( child: Padding( padding: const EdgeInsets.all(12.0), child: Row( children: [ Container( height: 40.0, width: 40.0, decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.grey[300], ), alignment: Alignment.center, child: Text( breed.id.toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), SizedBox(width: 20.0), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( breed.name, style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.w500, ), ), SizedBox(height: 4.0), Text(breed.description), ], ), ), ], ), ), ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/pages/home_page.dart
import 'package:flutter/material.dart'; import 'package:flutter_sqflite_example/common_widgets/dog_builder.dart'; import 'package:flutter_sqflite_example/common_widgets/breed_builder.dart'; import 'package:flutter_sqflite_example/models/breed.dart'; import 'package:flutter_sqflite_example/models/dog.dart'; import 'package:flutter_sqflite_example/pages/breed_form_page.dart'; import 'package:flutter_sqflite_example/pages/dog_form_page.dart'; import 'package:flutter_sqflite_example/services/database_service.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { final DatabaseService _databaseService = DatabaseService(); Future<List<Dog>> _getDogs() async { return await _databaseService.dogs(); } Future<List<Breed>> _getBreeds() async { return await _databaseService.breeds(); } Future<void> _onDogDelete(Dog dog) async { await _databaseService.deleteDog(dog.id!); setState(() {}); } @override Widget build(BuildContext context) { return DefaultTabController( length: 2, child: Scaffold( appBar: AppBar( title: Text('Dog Database'), centerTitle: true, bottom: TabBar( tabs: [ Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Text('Dogs'), ), Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: Text('Breeds'), ), ], ), ), body: TabBarView( children: [ DogBuilder( future: _getDogs(), onEdit: (value) { { Navigator.of(context) .push( MaterialPageRoute( builder: (_) => DogFormPage(dog: value), fullscreenDialog: true, ), ) .then((_) => setState(() {})); } }, onDelete: _onDogDelete, ), BreedBuilder( future: _getBreeds(), ), ], ), floatingActionButton: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ FloatingActionButton( onPressed: () { Navigator.of(context) .push( MaterialPageRoute( builder: (_) => BreedFormPage(), fullscreenDialog: true, ), ) .then((_) => setState(() {})); }, heroTag: 'addBreed', child: FaIcon(FontAwesomeIcons.plus), ), SizedBox(height: 12.0), FloatingActionButton( onPressed: () { Navigator.of(context) .push( MaterialPageRoute( builder: (_) => DogFormPage(), fullscreenDialog: true, ), ) .then((_) => setState(() {})); }, heroTag: 'addDog', child: FaIcon(FontAwesomeIcons.paw), ), ], ), ), ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/pages/dog_form_page.dart
import 'package:flutter/material.dart'; import 'package:flutter_sqflite_example/common_widgets/age_slider.dart'; import 'package:flutter_sqflite_example/common_widgets/breed_selector.dart'; import 'package:flutter_sqflite_example/common_widgets/color_picker.dart'; import 'package:flutter_sqflite_example/models/breed.dart'; import 'package:flutter_sqflite_example/models/dog.dart'; import 'package:flutter_sqflite_example/services/database_service.dart'; class DogFormPage extends StatefulWidget { const DogFormPage({Key? key, this.dog}) : super(key: key); final Dog? dog; @override _DogFormPageState createState() => _DogFormPageState(); } class _DogFormPageState extends State<DogFormPage> { final TextEditingController _nameController = TextEditingController(); static final List<Color> _colors = [ Color(0xFF000000), Color(0xFFFFFFFF), Color(0xFF947867), Color(0xFFC89234), Color(0xFF862F07), Color(0xFF2F1B15), ]; static final List<Breed> _breeds = []; final DatabaseService _databaseService = DatabaseService(); int _selectedAge = 0; int _selectedColor = 0; int _selectedBreed = 0; @override void initState() { super.initState(); if (widget.dog != null) { _nameController.text = widget.dog!.name; _selectedAge = widget.dog!.age; _selectedColor = _colors.indexOf(widget.dog!.color); } } Future<List<Breed>> _getBreeds() async { final breeds = await _databaseService.breeds(); if (_breeds.length == 0) _breeds.addAll(breeds); if (widget.dog != null) { _selectedBreed = _breeds.indexWhere((e) => e.id == widget.dog!.breedId); } return _breeds; } Future<void> _onSave() async { final name = _nameController.text; final age = _selectedAge; final color = _colors[_selectedColor]; final breed = _breeds[_selectedBreed]; // Add save code here widget.dog == null ? await _databaseService.insertDog( Dog(name: name, age: age, color: color, breedId: breed.id!), ) : await _databaseService.updateDog( Dog( id: widget.dog!.id, name: name, age: age, color: color, breedId: breed.id!, ), ); Navigator.pop(context); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('New Dog Record'), centerTitle: true, ), body: Padding( padding: const EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ TextField( controller: _nameController, decoration: InputDecoration( border: OutlineInputBorder(), hintText: 'Enter name of the dog here', ), ), SizedBox(height: 16.0), // Age Slider AgeSlider( max: 30.0, selectedAge: _selectedAge.toDouble(), onChanged: (value) { setState(() { _selectedAge = value.toInt(); }); }, ), SizedBox(height: 16.0), // Color Picker ColorPicker( colors: _colors, selectedIndex: _selectedColor, onChanged: (value) { setState(() { _selectedColor = value; }); }, ), SizedBox(height: 24.0), // Breed Selector FutureBuilder<List<Breed>>( future: _getBreeds(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Text("Loading breeds..."); } return BreedSelector( breeds: _breeds.map((e) => e.name).toList(), selectedIndex: _selectedBreed, onChanged: (value) { setState(() { _selectedBreed = value; }); }, ); }, ), SizedBox(height: 24.0), SizedBox( height: 45.0, child: ElevatedButton( onPressed: _onSave, child: Text( 'Save the Dog data', style: TextStyle( fontSize: 16.0, ), ), ), ), ], ), ), ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/pages/breed_form_page.dart
import 'package:flutter/material.dart'; import 'package:flutter_sqflite_example/models/breed.dart'; import 'package:flutter_sqflite_example/services/database_service.dart'; class BreedFormPage extends StatefulWidget { const BreedFormPage({Key? key}) : super(key: key); @override _BreedFormPageState createState() => _BreedFormPageState(); } class _BreedFormPageState extends State<BreedFormPage> { final TextEditingController _nameController = TextEditingController(); final TextEditingController _descController = TextEditingController(); final DatabaseService _databaseService = DatabaseService(); Future<void> _onSave() async { final name = _nameController.text; final description = _descController.text; await _databaseService .insertBreed(Breed(name: name, description: description)); Navigator.pop(context); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Add a new breed'), centerTitle: true, ), body: Padding( padding: const EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ TextField( controller: _nameController, decoration: InputDecoration( border: OutlineInputBorder(), hintText: 'Enter name of the breed here', ), ), SizedBox(height: 16.0), TextField( controller: _descController, maxLines: 7, decoration: InputDecoration( border: OutlineInputBorder(), hintText: 'Enter description about the breed here', ), ), SizedBox(height: 16.0), SizedBox( height: 45.0, child: ElevatedButton( onPressed: _onSave, child: Text( 'Save the Breed', style: TextStyle( fontSize: 16.0, ), ), ), ), ], ), ), ); } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/models/breed.dart
import 'dart:convert'; class Breed { final int? id; final String name; final String description; Breed({ this.id, required this.name, required this.description, }); // Convert a Breed into a Map. The keys must correspond to the names of the // columns in the database. Map<String, dynamic> toMap() { return { 'id': id, 'name': name, 'description': description, }; } factory Breed.fromMap(Map<String, dynamic> map) { return Breed( id: map['id']?.toInt() ?? 0, name: map['name'] ?? '', description: map['description'] ?? '', ); } String toJson() => json.encode(toMap()); factory Breed.fromJson(String source) => Breed.fromMap(json.decode(source)); // Implement toString to make it easier to see information about // each breed when using the print statement. @override String toString() => 'Breed(id: $id, name: $name, description: $description)'; }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/models/dog.dart
import 'dart:convert'; import 'package:flutter/widgets.dart'; class Dog { final int? id; final String name; final int age; final Color color; final int breedId; Dog({ this.id, required this.name, required this.age, required this.color, required this.breedId, }); // Convert a Dog into a Map. The keys must correspond to the names of the // columns in the database. Map<String, dynamic> toMap() { return { 'id': id, 'name': name, 'age': age, 'color': color.value, 'breedId': breedId, }; } factory Dog.fromMap(Map<String, dynamic> map) { return Dog( id: map['id']?.toInt() ?? 0, name: map['name'] ?? '', age: map['age']?.toInt() ?? 0, color: Color(map['color']), breedId: map['breedId']?.toInt() ?? 0, ); } String toJson() => json.encode(toMap()); factory Dog.fromJson(String source) => Dog.fromMap(json.decode(source)); // Implement toString to make it easier to see information about // each dog when using the print statement. @override String toString() { return 'Dog(id: $id, name: $name, age: $age, color: $color, breedId: $breedId)'; } }
0
mirrored_repositories/flutter-sqflite-example/lib
mirrored_repositories/flutter-sqflite-example/lib/services/database_service.dart
import 'package:flutter_sqflite_example/models/breed.dart'; import 'package:flutter_sqflite_example/models/dog.dart'; import 'package:path/path.dart'; import 'package:sqflite/sqflite.dart'; class DatabaseService { // Singleton pattern static final DatabaseService _databaseService = DatabaseService._internal(); factory DatabaseService() => _databaseService; DatabaseService._internal(); static Database? _database; Future<Database> get database async { if (_database != null) return _database!; // Initialize the DB first time it is accessed _database = await _initDatabase(); return _database!; } Future<Database> _initDatabase() async { final databasePath = await getDatabasesPath(); // Set the path to the database. Note: Using the `join` function from the // `path` package is best practice to ensure the path is correctly // constructed for each platform. final path = join(databasePath, 'flutter_sqflite_database.db'); // Set the version. This executes the onCreate function and provides a // path to perform database upgrades and downgrades. return await openDatabase( path, onCreate: _onCreate, version: 1, onConfigure: (db) async => await db.execute('PRAGMA foreign_keys = ON'), ); } // When the database is first created, create a table to store breeds // and a table to store dogs. Future<void> _onCreate(Database db, int version) async { // Run the CREATE {breeds} TABLE statement on the database. await db.execute( 'CREATE TABLE breeds(id INTEGER PRIMARY KEY, name TEXT, description TEXT)', ); // Run the CREATE {dogs} TABLE statement on the database. await db.execute( 'CREATE TABLE dogs(id INTEGER PRIMARY KEY, name TEXT, age INTEGER, color INTEGER, breedId INTEGER, FOREIGN KEY (breedId) REFERENCES breeds(id) ON DELETE SET NULL)', ); } // Define a function that inserts breeds into the database Future<void> insertBreed(Breed breed) async { // Get a reference to the database. final db = await _databaseService.database; // Insert the Breed into the correct table. You might also specify the // `conflictAlgorithm` to use in case the same breed is inserted twice. // // In this case, replace any previous data. await db.insert( 'breeds', breed.toMap(), conflictAlgorithm: ConflictAlgorithm.replace, ); } Future<void> insertDog(Dog dog) async { final db = await _databaseService.database; await db.insert( 'dogs', dog.toMap(), conflictAlgorithm: ConflictAlgorithm.replace, ); } // A method that retrieves all the breeds from the breeds table. Future<List<Breed>> breeds() async { // Get a reference to the database. final db = await _databaseService.database; // Query the table for all the Breeds. final List<Map<String, dynamic>> maps = await db.query('breeds'); // Convert the List<Map<String, dynamic> into a List<Breed>. return List.generate(maps.length, (index) => Breed.fromMap(maps[index])); } Future<Breed> breed(int id) async { final db = await _databaseService.database; final List<Map<String, dynamic>> maps = await db.query('breeds', where: 'id = ?', whereArgs: [id]); return Breed.fromMap(maps[0]); } Future<List<Dog>> dogs() async { final db = await _databaseService.database; final List<Map<String, dynamic>> maps = await db.query('dogs'); return List.generate(maps.length, (index) => Dog.fromMap(maps[index])); } // A method that updates a breed data from the breeds table. Future<void> updateBreed(Breed breed) async { // Get a reference to the database. final db = await _databaseService.database; // Update the given breed await db.update( 'breeds', breed.toMap(), // Ensure that the Breed has a matching id. where: 'id = ?', // Pass the Breed's id as a whereArg to prevent SQL injection. whereArgs: [breed.id], ); } Future<void> updateDog(Dog dog) async { final db = await _databaseService.database; await db.update('dogs', dog.toMap(), where: 'id = ?', whereArgs: [dog.id]); } // A method that deletes a breed data from the breeds table. Future<void> deleteBreed(int id) async { // Get a reference to the database. final db = await _databaseService.database; // Remove the Breed from the database. await db.delete( 'breeds', // Use a `where` clause to delete a specific breed. where: 'id = ?', // Pass the Breed's id as a whereArg to prevent SQL injection. whereArgs: [id], ); } Future<void> deleteDog(int id) async { final db = await _databaseService.database; await db.delete('dogs', where: 'id = ?', whereArgs: [id]); } }
0
mirrored_repositories/flutter-sqflite-example
mirrored_repositories/flutter-sqflite-example/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_sqflite_example/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/-FlutterDemos
mirrored_repositories/-FlutterDemos/lib/MyCode.dart
import 'package:flutter/material.dart'; class MyCode extends StatefulWidget { @override MyCodeState createState()=>new MyCodeState(); } class MyCodeState extends State<MyCode> { @override Widget build(BuildContext context) { return new Scaffold( appBar: AppBar( title:new Text("Code"), ), body: Text("Code Page"), ); } }
0
mirrored_repositories/-FlutterDemos
mirrored_repositories/-FlutterDemos/lib/login.dart
import 'package:flutter/material.dart'; import 'package:alertdialog/dialog.dart'; class MyLogin extends StatefulWidget { @override _MyloginState createState() => new _MyloginState(); } class _MyloginState extends State<MyLogin> { var leftRightPadding = 50.0; var topBottomPadding = 4.0; var textTips = new TextStyle(fontSize: 16.0, color: Colors.black); var hintTips = new TextStyle(fontSize: 15.0, color: Colors.black26); static const LOGO = "images/zpmc.png"; var _userPassController = new TextEditingController(); var _userNameController = new TextEditingController(); //对话框点击事件,将对话框选项值传入,打印点击结果,关闭对话框 void _dialogResult(String value) { print('You Selectd $value'); //点击后关闭对话框 Navigator.pop(context); } //Alert处理事件函数,将textField输入值传入, void _showAlert(String value) { //没有输入值,直接返回不处理 if (value.isEmpty) return; //创建AlertDialog对话框 AlertDialog dialog = new AlertDialog( //设置对话框内容content为传入值,样式style为字号30.0 title: new Text("登陆",style: new TextStyle(fontSize: 30.0),), content: new Center( widthFactor: 0.1, heightFactor: 0.01, child: new Text( value, style: new TextStyle(fontSize: 20.0), ), ), //设置actions选项为FlatButton,指定事件处理函数和显示内容,并设置字号为20.0 actions: <Widget>[ //选项yes new FlatButton( onPressed: () { _dialogResult(Options.yes); // Navigator.pushNamed(context, '/Home'); }, child: new Text( '关闭', style: new TextStyle(fontSize: 20.0), )), ], ); showDialog(context: context, child: dialog); } @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text("登录", style: new TextStyle(color: Colors.white)), centerTitle: true, iconTheme: new IconThemeData(color: Colors.white), ), body: new Column( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ new Padding( padding: new EdgeInsets.fromLTRB( leftRightPadding, 50.0, leftRightPadding, 10.0), child: new Image.asset(LOGO), ), new Padding( padding: new EdgeInsets.fromLTRB( leftRightPadding, 50.0, leftRightPadding, topBottomPadding), child: new TextField( style: hintTips, controller: _userNameController, decoration: new InputDecoration(hintText: "请输入用户名"), obscureText: false, ), ), new Padding( padding: new EdgeInsets.fromLTRB( leftRightPadding, 30.0, leftRightPadding, topBottomPadding), child: new TextField( style: hintTips, controller: _userPassController, decoration: new InputDecoration(hintText: "请输入用户密码"), obscureText: true, ), ), new Container( width: 360.0, margin: new EdgeInsets.fromLTRB(10.0, 40.0, 10.0, 0.0), padding: new EdgeInsets.fromLTRB(leftRightPadding, topBottomPadding, leftRightPadding, topBottomPadding), child: new Card( color: Colors.green, elevation: 6.0, child: new FlatButton( onPressed: () { if (_userNameController.text == 'yangchunsong' && _userPassController.text == '123456') { _showAlert("登录成功!"); } else { _showAlert("登录失败!"); } }, child: new Padding( padding: new EdgeInsets.all(10.0), child: new Text( '马上登录', style: new TextStyle(color: Colors.white, fontSize: 16.0), ), ), ), ), ) ], ), ); } }
0
mirrored_repositories/-FlutterDemos
mirrored_repositories/-FlutterDemos/lib/main.dart
import 'package:flutter/material.dart'; import 'package:alertdialog/login.dart'; import 'package:alertdialog/home.dart'; import 'package:alertdialog/MyCode.dart'; //app入口函数,返回设计APP void main() => runApp(new MaterialApp( home: new MyLogin(), routes: <String, WidgetBuilder>{ '/MyLogin': (BuildContext context) => new MyLogin(), '/Home': (BuildContext context) => new Home(), '/MyCode': (BuildContext context) => new MyCode(), }, ));
0
mirrored_repositories/-FlutterDemos
mirrored_repositories/-FlutterDemos/lib/home.dart
import 'package:flutter/material.dart'; class Home extends StatefulWidget { @override MyHome createState()=>new MyHome(); } class MyHome extends State<Home> { @override Widget build(BuildContext context) { return new Scaffold( appBar: AppBar( title:new Text("Home"), ), body: Text("Home Page"), ); } }
0
mirrored_repositories/-FlutterDemos
mirrored_repositories/-FlutterDemos/lib/dialog.dart
import 'package:flutter/material.dart'; class Dialog extends StatefulWidget { @override DialogState createState()=>new DialogState(); } //设置对话框点击选项 // enum MyDialogAction { // yes, // no, // maybe, // } class Options { static const String yes="接受"; static const String no="放弃"; static const String maybe="考虑一下"; } //创建状态Widget class DialogState extends State<Dialog> { //设置显示内容变量 String _text = ""; //textfield onchange事件函数,将输入值赋值给_text void _onChange(String value) { setState(() { _text = value; }); } //对话框点击事件,将对话框选项值传入,打印点击结果,关闭对话框 void _dialogResult(String value) { print('You Selectd $value'); //点击后关闭对话框 Navigator.pop(context); } //Alert处理事件函数,将textField输入值传入, void _showAlert(String value) { //没有输入值,直接返回不处理 if (value.isEmpty) return; //创建AlertDialog对话框 AlertDialog dialog = new AlertDialog( //设置对话框内容content为传入值,样式style为字号30.0 content: new Text( value, style: new TextStyle(fontSize: 30.0), ), //设置actions选项为FlatButton,指定事件处理函数和显示内容,并设置字号为20.0 actions: <Widget>[ //选项yes new FlatButton( onPressed: () { _dialogResult(Options.yes); }, child: new Text('Yes',style: new TextStyle(fontSize:20.0),)), //选项no new FlatButton( onPressed: () { _dialogResult(Options.no); }, child: new Text('No',style: new TextStyle(fontSize:20.0),)), //选项maybe new FlatButton( onPressed: () { _dialogResult(Options.maybe); }, child: new Text('Maybe',style: new TextStyle(fontSize:20.0),)), ], ); showDialog(context: context, child: dialog); } @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('Alert Dialog Demo'), ), body: new Container( child: new Center( child: new Column( children: <Widget>[ new TextField( onChanged: (String value) { _onChange(value); }, ), new RaisedButton( child: new Text('AlertDialog'), onPressed: () { _showAlert(_text); }, ), ], ))), ); } }
0
mirrored_repositories/flutterdemo
mirrored_repositories/flutterdemo/lib/main.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutterdemoapp/listview/my_listView_with_api.dart'; import 'package:flutterdemoapp/widget/widgets.dart'; import 'package:http/http.dart' as http; import 'package:flutter/foundation.dart'; import 'package:flutterdemoapp/listview/my_listView.dart'; import 'package:async_loader/async_loader.dart'; // https://github.com/brianegan/flutter_architecture_samples/tree/master/example/vanilla // https://github.com/Solido/awesome-flutter // app will start from main void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return new MaterialApp( title: 'Flutter Demo', theme: new ThemeData( primarySwatch: Colors.red, ), home: new SplashScreen(), ); } } // https://stackoverflow.com/questions/45936084/what-difference-between-stateless-and-stateful-widgets /** * above url for stateless and state ful widget */ class SplashScreen extends StatefulWidget{ @override _SplashScreenState createState() => new _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin { AnimationController _iconAnimationController; CurvedAnimation _iconAnimation; void handleTimeout() { Navigator.of(context).pushReplacement(new MaterialPageRoute( builder: (BuildContext context) => new MyHomePage(title: 'Flutter Demo'))); } startTimeout() async { var duration = const Duration(seconds: 4); return new Timer(duration, handleTimeout); } @override void initState() { // TODO: implement initState super.initState(); _iconAnimationController = new AnimationController( vsync: this, duration: new Duration(milliseconds: 4000)); _iconAnimation = new CurvedAnimation( parent: _iconAnimationController, curve: Curves.easeIn); _iconAnimation.addListener(() => this.setState(() {})); _iconAnimationController.forward(); startTimeout(); } @override Widget build(BuildContext context) { return new Scaffold( body: new Scaffold( body: new Center( child: new Image( image: new AssetImage("images/new_logo.png"), width: _iconAnimation.value * 300, height: _iconAnimation.value * 300, ) ), ), ); } } /** * username password field screen */ class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { final formKey = new GlobalKey<FormState>(); String _email; String _password; TextEditingController _controlleremail=new TextEditingController(); TextEditingController _controllerpassword=new TextEditingController(); CircularProgressIndicator circularProgressIndicator; final GlobalKey<AsyncLoaderState> _asyncLoaderState = new GlobalKey<AsyncLoaderState>(); @override Widget build(BuildContext context) { return new Scaffold( /*appBar: new AppBar( title: new Text(widget.title), ),*/ body: new Builder( builder: (BuildContext context) { return new Center( child: new Padding( padding: const EdgeInsets.all(20.0), child: new Form( key: formKey, child: new Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ new Padding( padding: new EdgeInsets.fromLTRB(0.0,15.0,0.0,0.0), child: new Image( image: new AssetImage("images/new_logo.png"), width: 100.0, height: 100.0, ), ), new TextFormField( maxLengthEnforced: false, maxLines: 1, controller: _controlleremail, decoration: new InputDecoration( // hintText: 'User name', labelText: 'Email', ), validator: (value) { _email=value; if (value.isEmpty) { return 'Please enter email'; } if(!isEmailInvalid(value)){ return 'Please enter valid email'; } }, ), new TextFormField( maxLengthEnforced: false, maxLines: 1, obscureText: true, // it's like input type password controller: _controllerpassword, decoration: new InputDecoration( labelText: 'Password', ), validator: (value) { _password=value; if (value.isEmpty) { return 'Please enter password'; } }, ), /** * submit button press */ new Padding( padding: new EdgeInsets.fromLTRB(0.0,20.0,0.0,0.0), child: new RaisedButton( color:Colors.red, elevation: 5.0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8.0))), onPressed: (){ _submit(context); }, child: new Text('Submit / Call Login Api'), textColor: Colors.white, ), ), new Padding( padding: new EdgeInsets.fromLTRB(0.0,20.0,0.0,0.0), child: new RaisedButton( color:Colors.red, elevation: 5.0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8.0))), onPressed: () { fun_listview_with_api_screen(context); }, child: new ListViewButton(), // can create common class for button property textColor: Colors.white, ), ), ], ), ), ), ); }, ), ); } /** * submit click */ void _submit(BuildContext context) { final form = formKey.currentState; if (form.validate()) { form.save(); // Email & password matched our validation rules // and are saved to _email and _password fields. _performLogin(context); } } /** * if all filed are validate then api call */ void _performLogin(BuildContext context) { /* String dataURL = "https://api.github.com/orgs/raywenderlich/members"; http.Response response = await http.get(dataURL); setState(() { _members = JSON.decode(response.body); }); */ var url = 'https://reqres.in/api/login'; http.post(url, body: {'username': _email,'password':_password}) .then((response) { var statusCode = response.statusCode; print("Response status: ${response.statusCode}"); print("Response body: ${response.body}"); if(statusCode < 200 || statusCode >= 300 || response.body == null) { fun_snackbar(context,"Error while login"); }else{ _controlleremail.clear(); _controllerpassword.clear(); fun_listview_screen(context); } }); // http.read("http://example.com/foobar.txt").then(print); } /** * validates email using regex */ bool isEmailInvalid(String email) { RegExp exp = new RegExp(r"^[_A-Za-z0-9-+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$"); return exp.hasMatch(email); } } /** * function for click on next screen (listview with api call) */ void fun_listview_with_api_screen(BuildContext context){ Navigator.push( context, new MaterialPageRoute(builder: (context) => new MyLisViewWithApi()), ); } /** * function for static listview screen */ void fun_listview_screen(BuildContext context){ Navigator.push( context, new MaterialPageRoute(builder: (context) => new MyListView()), ); } /** * for show message */ void fun_snackbar(BuildContext context,String message){ final snackBar = new SnackBar( content: new Text(message) ); Scaffold.of(context).showSnackBar(snackBar); // OR /*Scaffold.of(context).showSnackBar(new SnackBar( content: new Text('Hello!'), ));*/ }
0
mirrored_repositories/flutterdemo/lib
mirrored_repositories/flutterdemo/lib/widget/widgets.dart
import 'package:flutter/material.dart'; /*class SplashImage extends StatelessWidget{ @override Widget build(BuildContext context) { // TODO: implement build var assetsImage=new AssetImage('assets/new_logo.png'); var image=new Image(image: assetsImage); return new Container(child: image); } }*/ /** * here can create common widget . * and also can use multiple time */ class ListViewButton extends StatelessWidget{ @override Widget build(BuildContext context) { // TODO: implement build return new Container(child: new Text("Listview With Api")); } }
0
mirrored_repositories/flutterdemo/lib
mirrored_repositories/flutterdemo/lib/listview/my_listView_with_api.dart
import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; class MyLisViewWithApi extends StatefulWidget { @override MyLisViewWithApiSample createState() => new MyLisViewWithApiSample(); } class MyLisViewWithApiSample extends State<MyLisViewWithApi> { final String url="https://jsonplaceholder.typicode.com/users"; List data; @override void initState() { // TODO: implement initState super.initState(); this.getJsonData(); } /** * get data by calling api */ Future<String> getJsonData() async{ var response=await http.get( Uri.encodeFull(url), headers: {"Accept":"application/json"} ); print(response.body); setState(() { var convertDataToJSon=JSON.decode(response.body); data=convertDataToJSon; }); return "Success"; } @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text("ListView Example"), ), /** * here checking -> if data is null than loader will show */ body: data !=null ? new ListView.builder( itemCount: data == null ? 0 : data.length, itemBuilder: (BuildContext context,int index){ return new Container( child: new Center( child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch , children: <Widget>[ new Card( child: new ListTile( title: new Text(data[index]['name']), subtitle: new Text(data[index]['email']), ) ) ], ), ), ); }, ) : new Center(child:new CircularProgressIndicator( strokeWidth: 3.0, )), ); } }
0
mirrored_repositories/flutterdemo/lib
mirrored_repositories/flutterdemo/lib/listview/my_listView.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:http/http.dart' as http; class MyListView extends StatefulWidget { @override MyListViewSample createState() => new MyListViewSample(); } class MyListViewSample extends State<MyListView> { final GlobalKey<AnimatedListState> _listKey = new GlobalKey<AnimatedListState>(); ListModel<int> _list; ListModel<String> _listasdasd; int _selectedItem; int _nextItem; // The next item inserted when the user presses the '+' button. @override void initState() { super.initState(); _list = new ListModel<int>( listKey: _listKey, initialItems: <int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], removedItemBuilder: _buildRemovedItem, ); _nextItem = 9; } // Used to build list items that haven't been removed. Widget _buildItem(BuildContext context, int index, Animation<double> animation) { return new CardItem( animation: animation, item: _list[index], selected: _selectedItem == _list[index], onTap: () { setState(() { _selectedItem = _selectedItem == _list[index] ? null : _list[index]; }); }, ); } // Used to build an item after it has been removed from the list. This method is // needed because a removed item remains visible until its animation has // completed (even though it's gone as far this ListModel is concerned). // The widget will be used by the [AnimatedListState.removeItem] method's // [AnimatedListRemovedItemBuilder] parameter. Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) { return new CardItem( animation: animation, item: item, selected: false, // No gesture detector here: we don't want removed items to be interactive. ); } @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text("Animated ListView Example"), ), body: new Padding( padding: const EdgeInsets.all(16.0), child: new AnimatedList( key: _listKey, initialItemCount: _list.length, itemBuilder: _buildItem, ), ), ); } } class ListModel<E> { ListModel({ @required this.listKey, @required this.removedItemBuilder, Iterable<E> initialItems, }) : assert(listKey != null), assert(removedItemBuilder != null), _items = new List<E>.from(initialItems ?? <E>[]); final GlobalKey<AnimatedListState> listKey; final dynamic removedItemBuilder; final List<E> _items; int get length => _items.length; E operator [](int index) => _items[index]; int indexOf(E item) => _items.indexOf(item); } class CardItem extends StatelessWidget { const CardItem({ Key key, @required this.animation, this.onTap, @required this.item, this.selected: false }) : assert(animation != null), assert(item != null && item >= 0), assert(selected != null), super(key: key); final Animation<double> animation; final VoidCallback onTap; final int item; final bool selected; @override Widget build(BuildContext context) { TextStyle textStyle = Theme.of(context).textTheme.display1; if (selected) textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]); return new Padding( padding: const EdgeInsets.all(2.0), child: new SizeTransition( axis: Axis.vertical, sizeFactor: animation, child: new GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Scaffold.of(context).showSnackBar(new SnackBar( content: new Text('You pressed snackbar $item\'s action.') )); print("listview click"); // Navigator.pushNamed(context, "myRoute"); }, child: new SizedBox( height: 100.0, child: new Card( color: Colors.primaries[item % Colors.primaries.length], child: new Center( child: new Text('Item $item', style: textStyle), ), ), ), ), ), ); } }
0
mirrored_repositories/flutterdemo
mirrored_repositories/flutterdemo/test/widget_test.dart
// This is a basic Flutter widget test. // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to // find child widgets in the widget tree, read text, and verify that the values of widget properties // are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutterdemoapp/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(new MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Visitor-Tracker
mirrored_repositories/Visitor-Tracker/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hive/hive.dart'; import 'package:path_provider/path_provider.dart' as path_provider; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:visitor_tracker/screens/administrator/a_upload.dart'; import 'package:visitor_tracker/screens/administrator/admin_option.dart'; import 'package:visitor_tracker/screens/administrator/a_qr_scan.dart'; import 'package:visitor_tracker/screens/administrator/a_uploaded_data.dart'; import 'package:visitor_tracker/screens/homescreen.dart'; import 'package:visitor_tracker/screens/login.dart'; import 'package:visitor_tracker/screens/signup.dart'; import 'package:visitor_tracker/screens/visitor/models/visitor_model.dart'; import 'package:visitor_tracker/screens/visitor/visitor_option.dart'; import 'package:visitor_tracker/screens/visitor/v_detail_entry.dart'; import 'package:visitor_tracker/screens/visitor/v_qr_gen.dart'; import 'package:visitor_tracker/services/auth_state.dart'; import 'package:visitor_tracker/utils/spalsh_screen.dart'; const AndroidNotificationChannel channel = AndroidNotificationChannel( 'high_importance_channel', // id 'High Importance Notifications', // title 'This channel is used for important notifications.', // description importance: Importance.high, playSound: true); final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async { await Firebase.initializeApp(); print('A bg message just showed up : ${message.messageId}'); } Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); final appDocumentDirectory = await path_provider.getApplicationDocumentsDirectory(); Hive.init(appDocumentDirectory.path); Hive.registerAdapter(VisitorAdapter()); await Firebase.initializeApp(); FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); await flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< AndroidFlutterLocalNotificationsPlugin>() ?.createNotificationChannel(channel); await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( alert: true, badge: true, sound: true, ); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]) .then((_) { runApp(MyApp()); }); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { @override void initState() { super.initState(); FirebaseMessaging.onMessage.listen((RemoteMessage message) { RemoteNotification notification = message.notification; AndroidNotification android = message.notification?.android; if (notification != null && android != null) { flutterLocalNotificationsPlugin.show( notification.hashCode, notification.title, notification.body, NotificationDetails( android: AndroidNotificationDetails( channel.id, channel.name, channel.description, color: Colors.blue, playSound: true, icon: '@mipmap/ic_launcher', ), )); showDialog( context: context, builder: (ctx) { return AlertDialog( title: Text(notification.title), content: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [Text(notification.body)], ), ), actions: [ TextButton( onPressed: () { Navigator.of(ctx).pop(); }, child: Text("OK"), ), ], ); }); } }); FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { print('A new onMessageOpenedApp event was published!'); RemoteNotification notification = message.notification; AndroidNotification android = message.notification?.android; if (notification != null && android != null) { showDialog( context: context, builder: (ctx) { return AlertDialog( title: Text(notification.title), content: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [Text(notification.body)], ), ), actions: [ TextButton( onPressed: () { Navigator.of(ctx).pop(); }, child: Text("OK"), ), ], ); }); } }); } @override void dispose() { Hive.box('visitor').compact(); Hive.close(); super.dispose(); } Widget buildError(BuildContext context, FlutterErrorDetails error) { return Scaffold( body: Stack( fit: StackFit.expand, children: [ Image.asset( "assets/images/Error.png", fit: BoxFit.cover, ), ], ), ); } @override Widget build(BuildContext context) { return MaterialApp( // themeMode: ThemeMode.system, title: "Visitor-Tracker", theme: ThemeData( fontFamily: GoogleFonts.rubik().fontFamily, visualDensity: VisualDensity.adaptivePlatformDensity, ), debugShowCheckedModeBanner: false, builder: (BuildContext context, Widget widget) { ErrorWidget.builder = (FlutterErrorDetails errorDetails) { return buildError(context, errorDetails); }; return widget; }, home: SplashScreenPage(), routes: { "/home": (context) => HomeScreen(), "/login": (context) => LoginScreen(), "/signup": (context) => SignUpScreen(), "/auth": (context) => Auth(), "/visitoroption": (context) => VisitorOption(), "/visitordetails": (context) => FutureBuilder( future: Hive.openBox( 'visitor', compactionStrategy: (int total, int deleted) { return deleted > 35; }, ), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done) { if (snapshot.hasError) return Text(snapshot.error.toString()); else return VisitorDetailEntry(); } else return Scaffold(); }, ), "/qrcodegenerator": (context) => FutureBuilder( future: Hive.openBox( 'visitor', compactionStrategy: (int total, int deleted) { return deleted > 35; }, ), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done) { if (snapshot.hasError) return Text(snapshot.error.toString()); else return QRCodeGenerator(); } else return Scaffold(); }, ), "/adminoption": (context) => AdminOption(), "/qrcodescanner": (context) => QRCodeScanner(), "/uploaddata": (context) => UploadData(), "/uploadeddata": (context) => UploadedData(), }, ); } }
0
mirrored_repositories/Visitor-Tracker/lib
mirrored_repositories/Visitor-Tracker/lib/utils/onboarding.dart
import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:introduction_screen/introduction_screen.dart'; import 'package:visitor_tracker/services/auth_state.dart'; class OnBoardingPage extends StatefulWidget { @override _OnBoardingPageState createState() => _OnBoardingPageState(); } class _OnBoardingPageState extends State<OnBoardingPage> { final introKey = GlobalKey<IntroductionScreenState>(); void _onIntroEnd(context) { Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute(builder: (context) => Auth()), (route) => false, ); } Widget _buildImage(String assetName, [double width = 350]) { return Image.asset("assets/images/$assetName", width: width); } @override Widget build(BuildContext context) { const bodyStyle = TextStyle(fontSize: 19.0); const pageDecoration = const PageDecoration( titleTextStyle: TextStyle( fontSize: 28.0, fontWeight: FontWeight.w700, color: Color(0xff6C63FF), ), bodyTextStyle: bodyStyle, descriptionPadding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 16.0), pageColor: Colors.white, imagePadding: EdgeInsets.zero, ); return IntroductionScreen( key: introKey, globalBackgroundColor: Colors.white, pages: [ PageViewModel( title: "Welcome to VisitorTracker", body: "A modern solution to register your footprints at public places", image: _buildImage('welcome.png'), decoration: pageDecoration, ), PageViewModel( title: "You choose what you need", body: "Use application either as Admin or Visitor depending upon your need", image: _buildImage('both.png'), decoration: pageDecoration, ), PageViewModel( title: "Pass your details as Visitor", body: "Enter and locally save your details. Generate and show QR code at public places to mark your footprint", image: _buildImage('ovisitor.png'), decoration: pageDecoration, ), PageViewModel( title: "Collect visitor details as Admin", body: "Collect visitor details by scanning their QR code and upload them to the online database", image: _buildImage('oadmin.png'), decoration: pageDecoration, ), PageViewModel( title: "Manage and Notify your visitors", body: "Manage your visitors as Admin and send push notifications to the visitors in case of any emergency", image: _buildImage('local-notif.png'), decoration: pageDecoration, ), ], onDone: () => _onIntroEnd(context), //onSkip: () => _onIntroEnd(context), // You can override onSkip callback showSkipButton: true, skipFlex: 0, nextFlex: 0, //rtl: true, // Display as right-to-left skip: InkWell( child: const Text( 'Skip', style: TextStyle( fontSize: 20, color: Colors.grey, fontWeight: FontWeight.bold, ), ), onTap: () => _onIntroEnd(context), ), next: const Icon( Icons.arrow_forward, size: 30, color: Color(0xff6C63FF), ), done: const Text('Done', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, color: Color(0xff6C63FF), )), curve: Curves.fastLinearToSlowEaseIn, controlsMargin: const EdgeInsets.all(16), controlsPadding: kIsWeb ? const EdgeInsets.all(12.0) : const EdgeInsets.fromLTRB(8.0, 4.0, 8.0, 4.0), dotsDecorator: const DotsDecorator( size: Size(10.0, 10.0), color: Colors.grey, activeColor: Color(0xff6C63FF), activeSize: Size(22.0, 10.0), activeShape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(25.0)), ), ), dotsContainerDecorator: const ShapeDecoration( color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(8.0)), ), ), ); } }
0
mirrored_repositories/Visitor-Tracker/lib
mirrored_repositories/Visitor-Tracker/lib/utils/spalsh_screen.dart
import 'package:flutter/material.dart'; import 'package:splashscreen/splashscreen.dart'; import 'package:visitor_tracker/utils/onboarding.dart'; class SplashScreenPage extends StatelessWidget { @override Widget build(BuildContext context) { return SplashScreen( seconds: 4, navigateAfterSeconds: OnBoardingPage(), backgroundColor: Colors.white, title: Text( 'Visitor Tracker', style: TextStyle( color: Color(0xff6C63FF), fontSize: 30, ), ), image: Image.asset("assets/images/splash.png"), loadingText: Text( "Initializing", style: TextStyle( color: Colors.black, fontSize: 24, ), ), photoSize: 100.0, loaderColor: Color(0xff6C63FF), ); } }
0
mirrored_repositories/Visitor-Tracker/lib
mirrored_repositories/Visitor-Tracker/lib/utils/MyTheme.dart
// import 'package:flutter/material.dart'; // class MyTheme { // }
0
mirrored_repositories/Visitor-Tracker/lib
mirrored_repositories/Visitor-Tracker/lib/services/auth_state.dart
import 'package:flutter/material.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:visitor_tracker/screens/homescreen.dart'; import 'package:visitor_tracker/screens/login.dart'; class Auth extends StatefulWidget { @override _AuthState createState() => _AuthState(); } class _AuthState extends State<Auth> { final FirebaseAuth _auth = FirebaseAuth.instance; @override Widget build(BuildContext context) { return Scaffold( body: StreamBuilder( stream: _auth.authStateChanges(), builder: (ctx, AsyncSnapshot<User> snapshot) { if (snapshot.hasData) { User user = snapshot.data; if (user != null) { return HomeScreen(); } else { return LoginScreen(); } } return LoginScreen(); }, ), ); } }
0
mirrored_repositories/Visitor-Tracker/lib
mirrored_repositories/Visitor-Tracker/lib/screens/homescreen.dart
import 'package:flutter/material.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:google_sign_in/google_sign_in.dart'; class HomeScreen extends StatelessWidget { final FirebaseAuth _auth = FirebaseAuth.instance; final GoogleSignIn _googleSignIn = GoogleSignIn(); @override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; return Scaffold( body: SingleChildScrollView( child: Container( height: height, width: width, color: Colors.white, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: 25, ), Text( "WELCOME", style: TextStyle( fontSize: 36, fontWeight: FontWeight.bold, color: Color(0xff6C63FF), ), ), SizedBox( height: 20, ), Padding( padding: const EdgeInsets.all(15.0), child: Image.asset( "assets/images/option.png", fit: BoxFit.contain, ), ), SizedBox( height: 45, ), Text( "Select type of User", style: TextStyle( fontSize: 22, ), ), SizedBox( height: 25, ), Padding( padding: const EdgeInsets.all(5.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Flexible( child: Container( height: height * 0.15, width: width * 0.35, decoration: BoxDecoration( color: Color(0xffC6C7C4).withOpacity(0.4), borderRadius: BorderRadius.circular(21), ), // ignore: deprecated_member_use child: FlatButton( onPressed: () { Navigator.pushNamed(context, "/adminoption"); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.admin_panel_settings_outlined, color: Color(0xff6C63FF), size: 45, ), SizedBox( height: 10, ), Text( "Admin", style: TextStyle( color: Color(0xff6C63FF), fontSize: 16, ), ), ], ), ), ), ), SizedBox( width: 35, ), Flexible( child: Container( height: height * 0.15, width: width * 0.35, decoration: BoxDecoration( color: Color(0xffC6C7C4).withOpacity(0.4), borderRadius: BorderRadius.circular(21), ), // ignore: deprecated_member_use child: FlatButton( onPressed: () { Navigator.pushNamed(context, "/visitoroption"); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.person, color: Color(0xff6C63FF), size: 45, ), SizedBox( height: 10, ), Text( "Visitor", style: TextStyle( color: Color(0xff6C63FF), fontSize: 16, ), ), ], ), ), ), ), ], ), ), SizedBox( height: 25, ), Padding( padding: const EdgeInsets.all(5.0), child: Column( children: [ Container( height: height * 0.08, width: width * 0.8, child: ElevatedButton( onPressed: () async { await _auth.signOut(); _googleSignIn.signOut(); }, child: Center( child: Text( "LOGOUT", style: TextStyle( fontSize: 20, color: Colors.white, ), ), ), style: TextButton.styleFrom( backgroundColor: Color(0xff6C63FF), elevation: 0.0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(21), ), ), ), ), ], ), ), ], ), ), ), ); } }
0
mirrored_repositories/Visitor-Tracker/lib
mirrored_repositories/Visitor-Tracker/lib/screens/login.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:google_sign_in/google_sign_in.dart'; class LoginScreen extends StatefulWidget { @override _LoginScreenState createState() => _LoginScreenState(); } class _LoginScreenState extends State<LoginScreen> { final TextEditingController _emailController = TextEditingController(); final TextEditingController _passwordController = TextEditingController(); final FirebaseAuth _auth = FirebaseAuth.instance; final GoogleSignIn _googleSignIn = GoogleSignIn(); final FirebaseFirestore _db = FirebaseFirestore.instance; @override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; return Scaffold( body: SingleChildScrollView( child: Container( height: height, width: width, color: Colors.white, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: 30, ), Text( "LOGIN", style: TextStyle( fontSize: 28, fontWeight: FontWeight.bold, color: Color(0xff6C63FF), ), ), SizedBox( height: 25, ), Padding( padding: const EdgeInsets.all(20.0), child: Container( width: width * 0.8, child: Image.asset( "assets/images/login.png", fit: BoxFit.cover, ), ), ), SizedBox( height: 5, ), Padding( padding: const EdgeInsets.all(5.0), child: Column( // mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Padding( padding: const EdgeInsets.symmetric( vertical: 10.0, ), child: Container( height: height * 0.07, width: width * 0.8, decoration: BoxDecoration( borderRadius: BorderRadius.circular(21), color: Color(0xffC6C7C4).withOpacity(0.5), ), child: Center( child: TextFormField( controller: _emailController, cursorColor: Color(0xff6C63FF), decoration: InputDecoration( border: InputBorder.none, hintText: "Enter Email", hintStyle: TextStyle( fontSize: 16, color: Colors.grey, ), prefixIcon: Padding( padding: const EdgeInsets.symmetric( horizontal: 20.0, ), child: Icon( Icons.email_outlined, color: Colors.grey, size: 25, ), ), ), style: TextStyle( fontSize: 18, color: Colors.grey, ), textInputAction: TextInputAction.next, keyboardType: TextInputType.emailAddress, ), ), ), ), Padding( padding: const EdgeInsets.symmetric( vertical: 10.0, ), child: Container( height: height * 0.07, width: width * 0.8, decoration: BoxDecoration( borderRadius: BorderRadius.circular(21), color: Color(0xffC6C7C4).withOpacity(0.5), ), child: Center( child: TextFormField( controller: _passwordController, cursorColor: Color(0xff6C63FF), decoration: InputDecoration( border: InputBorder.none, hintText: "Enter Password", hintStyle: TextStyle( fontSize: 16, color: Colors.grey, ), prefixIcon: Padding( padding: const EdgeInsets.symmetric( horizontal: 20.0, ), child: Icon( Icons.lock, color: Colors.grey, size: 25, ), ), ), style: TextStyle( fontSize: 18, color: Colors.grey, ), textInputAction: TextInputAction.next, obscureText: true, ), ), ), ), SizedBox( height: 25, ), Container( height: height * 0.08, width: width * 0.8, child: ElevatedButton( child: Text("LOGIN"), onPressed: () { _signIn(); }, style: TextButton.styleFrom( elevation: 0.0, backgroundColor: Color(0xff6C63FF), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(21), ), textStyle: TextStyle( fontSize: 24, ), padding: EdgeInsets.all(8.0), ), ), ), SizedBox( height: 10, ), TextButton( child: Text( "New here? Sign Up using Email", style: TextStyle( fontSize: 18, color: Color(0xff6C63FF), ), ), onPressed: () { Navigator.pushNamed(context, "/signup"); }, ), SizedBox( height: 5, ), Row(children: <Widget>[ Expanded( child: new Container( margin: const EdgeInsets.only(left: 40.0, right: 10.0), child: Divider( color: Colors.black, height: 26, )), ), Text("OR"), Expanded( child: new Container( margin: const EdgeInsets.only(left: 10.0, right: 40.0), child: Divider( color: Colors.black, height: 26, )), ), ]), SizedBox( height: 5, ), InkWell( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ FaIcon( FontAwesomeIcons.google, color: Colors.red, size: 22, ), SizedBox( width: 7, ), TextButton( child: Text( 'Login using Google', style: TextStyle( fontSize: 20, color: Colors.red, ), ), onPressed: () { _signInUsingGoogle(); }, ), ], ), onTap: () {}, ), ], ), ), ], ), ), ), ); } void _signIn() async { String email = _emailController.text.trim(); String password = _passwordController.text; if (email.isNotEmpty && password.isNotEmpty) { _auth .signInWithEmailAndPassword(email: email, password: password) .then((user) { _db.collection("users").doc(user.user.uid).set({ "email": email, "last_seen": DateTime.now(), "signup_method": user.user.providerData[0].providerId }); showDialog( context: context, builder: (ctx) { return AlertDialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), title: Text("Success"), content: Text("Sign In Success"), actions: <Widget>[ // ignore: deprecated_member_use FlatButton( child: Text( "OK", style: TextStyle( color: Color(0xff6C63FF), ), ), onPressed: () { Navigator.of(ctx).pop(); }, ), ], ); }); }).catchError((e) { showDialog( context: context, builder: (ctx) { return AlertDialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), title: Text("Error"), content: Text("${e.message}"), actions: <Widget>[ // ignore: deprecated_member_use FlatButton( child: Text( "Cancel", style: TextStyle( color: Colors.red, ), ), onPressed: () { Navigator.of(ctx).pop(); }, ), ], ); }); }); } else { showDialog( context: context, builder: (ctx) { return AlertDialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), title: Text("Error"), content: Text("Please provide Email and Password!"), actions: <Widget>[ // ignore: deprecated_member_use FlatButton( child: Text( "Cancel", style: TextStyle( color: Colors.red, ), ), onPressed: () { Navigator.of(ctx).pop(); }, ), // ignore: deprecated_member_use FlatButton( child: Text( "OK", style: TextStyle( color: Color(0xff6C63FF), ), ), onPressed: () { _emailController.text = ""; _passwordController.text = ""; Navigator.of(ctx).pop(); }, ), ], ); }); } } void _signInUsingGoogle() async { try { // Trigger the authentication flow final GoogleSignInAccount googleUser = await _googleSignIn.signIn(); // Obtain the auth details from the request final GoogleSignInAuthentication googleAuth = await googleUser.authentication; // Create a new credential final AuthCredential credential = GoogleAuthProvider.credential( accessToken: googleAuth.accessToken, idToken: googleAuth.idToken, ); // Once signed in, return the UserCredential final User user = (await _auth.signInWithCredential(credential)).user; print("Signed In " + user.displayName); if (user != null) { //Successful signup _db.collection("users").doc(user.uid).set({ "displayName": user.displayName, "email": user.email, "last_seen": DateTime.now(), "signup_method": user.providerData[0].providerId }); } } catch (e) { showDialog( context: context, builder: (ctx) { return AlertDialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), title: Text("Error"), content: Text("${e.message}"), actions: <Widget>[ // ignore: deprecated_member_use FlatButton( child: Text( "Cancel", style: TextStyle( color: Colors.red, ), ), onPressed: () { Navigator.of(ctx).pop(); }, ), ], ); }); } } }
0