diff --git a/lang/de.json b/lang/de.json index 740a2fb83d..a68bed5a8c 100644 --- a/lang/de.json +++ b/lang/de.json @@ -89,6 +89,16 @@ "Cancel": "Abbrechen", "Done": "Fertig", "Explore Events": "Veranstaltungen erkunden", + "Filters": "Filter", + "Filter by Date": "Filtern nach Datum", + "All Events": "Alle Veranstaltungen", + "Show all events": "Alle Veranstaltungen anzeigen", + "Show all events created by you": "Alle Veranstaltungen anzeigen, die von Ihnen erstellt wurden", + "Registered Events": "Registrierte Veranstaltungen", + "Show all events you have registered": "Alle Veranstaltungen anzeigen, für die Sie sich registriert haben", + "Show events for all": "Alle Veranstaltungen anzeigen", + "Show invite-only events": "Nur Einladungsveranstaltungen anzeigen", + "Add Date": "Datum hinzufügen", "Event": "Vorfall", "My Events": "Meine Veranstaltungen", diff --git a/lang/en.json b/lang/en.json index c7cf4c0b77..2588cffeb7 100644 --- a/lang/en.json +++ b/lang/en.json @@ -95,6 +95,15 @@ "Cancel": "Cancel", "Done": "Done", "Explore Events": "Explore Events", + "Filters": "Filters", + "Filter by Date": "Filter by Date", + "All Events": "All Events", + "Show all events": "Show all events", + "Show all events created by you": "Show all events created by you", + "Registered Events": "Registered Events", + "Show all events you have registered": "Show all events you have registered", + "Show events for all": "Show events for all", + "Show invite-only events": "Show invite-only events", "Add Date": "Add Date", "Event": "Event", "My Events": "My Events", diff --git a/lang/es.json b/lang/es.json index 9401739d42..6c6e705f3a 100644 --- a/lang/es.json +++ b/lang/es.json @@ -90,6 +90,15 @@ "Cancel": "Cancelar", "Done": "Hecho", "Explore Events": "Explorar eventos", + "Filters": "Filtros", + "Filter by Date": "Filtrar por fecha", + "All Events": "Todos los eventos", + "Show all events": "Mostrar todos los eventos", + "Show all events created by you": "Mostrar todos los eventos creados por ti", + "Registered Events": "Eventos registrados", + "Show all events you have registered": "Mostrar todos los eventos en los que te has registrado", + "Show events for all": "Mostrar eventos para todos", + "Show invite-only events": "Mostrar eventos solo por invitación", "Add Date": "Agregar fecha", "Event": "Evento", "My Events": "Mis Eventos", diff --git a/lang/fr.json b/lang/fr.json index 8bea3b769d..3ed1ff2ab6 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -95,6 +95,15 @@ "Cancel": "Annuler", "Done": "Fait", "Explore Events": "Explorer les événements", + "Filters": "Filtres", + "Filter by Date": "Filtrer par date", + "All Events": "Tous les événements", + "Show all events": "Afficher tous les événements", + "Show all events created by you": "Afficher tous les événements créés par vous", + "Registered Events": "Événements enregistrés", + "Show all events you have registered": "Afficher tous les événements auxquels vous êtes inscrit", + "Show events for all": "Afficher les événements pour tous", + "Show invite-only events": "Afficher les événements sur invitation uniquement", "Add Date": "Ajouter une date", "Event": "Événement", "My Events": "Mes événements", diff --git a/lang/hi.json b/lang/hi.json index 3e3ca23c4c..8ae54f08e5 100644 --- a/lang/hi.json +++ b/lang/hi.json @@ -90,6 +90,15 @@ "Cancel": "रद्द करना", "Done": "किया हुआ", "Explore Events": "घटनाओं का अन्वेषण करें", + "Filters": "फ़िल्टर", + "Filter by Date": "तारीख़ से फ़िल्टर करें", + "All Events": "सभी घटनाएँ", + "Show all events": "सभी घटनाएँ दिखाएं", + "Show all events created by you": "आपके द्वारा बनाई गई सभी घटनाएँ दिखाएं", + "Registered Events": "रजिस्टर की गई घटनाएँ", + "Show all events you have registered": "आपने जिन घटनाओं में पंजीकृत हुए हैं, उन सभी घटनाएँ दिखाएं", + "Show events for all": "सभी के लिए घटनाएँ दिखाएं", + "Show invite-only events": "आमंत्रित लोगों के लिए घटनाएँ दिखाएं", "Add Date": "तिथि जोड़ें", "Event": "प्रतिस्पर्धा", "My Events": "मेरे कार्यक्रम", diff --git a/lang/ja.json b/lang/ja.json index 22953de4f8..6a57e49f7c 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -90,6 +90,15 @@ "Cancel": "キャンセル", "Done": "終わり", "Explore Events": "イベントを探索する", + "Filters": "フィルター", + "Filter by Date": "日付で絞り込む", + "All Events": "すべてのイベント", + "Show all events": "すべてのイベントを表示", + "Show all events created by you": "あなたが作成したすべてのイベントを表示", + "Registered Events": "登録済みイベント", + "Show all events you have registered": "あなたが登録したすべてのイベントを表示", + "Show events for all": "すべてのイベントを表示", + "Show invite-only events": "招待限定イベントを表示", "Add Date": "日付を追加", "Event": "イベント", "My Events": "私のイベント", diff --git a/lang/pt.json b/lang/pt.json index 1dafd483fa..1b156b3b68 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -90,6 +90,15 @@ "Cancel": "Cancelar", "Done": "Feita", "Explore Events": "Explorar eventos", + "Filters": "Filtros", + "Filter by Date": "Filtrar por data", + "All Events": "Todos os eventos", + "Show all events": "Mostrar todos os eventos", + "Show all events created by you": "Mostrar todos os eventos criados por você", + "Registered Events": "Eventos registrados", + "Show all events you have registered": "Mostrar todos os eventos em que você se registrou", + "Show events for all": "Mostrar eventos para todos", + "Show invite-only events": "Mostrar apenas eventos com convite", "Add Date": "Adicionar Data", "Event": "Evento", "My Events": "Meus Eventos", diff --git a/lang/zh.json b/lang/zh.json index 3f587f4cfe..42d7157e05 100644 --- a/lang/zh.json +++ b/lang/zh.json @@ -90,11 +90,20 @@ "Cancel": "取消", "Done": "完成", "Explore Events": "探索事件", - "Add Date": "添加日期", - "Event": "事件", + "Filters": "过滤器", + "Filter by Date": "按日期过滤", + "All Events": "所有活动", + "Show all events": "显示所有活动", "My Events": "我的活动", - "Public Events": "公共事件", + "Show all events created by you": "显示由您创建的所有活动", + "Registered Events": "已注册活动", + "Show all events you have registered": "显示您已注册的所有活动", + "Public Events": "公共活动", + "Show events for all": "显示所有人的活动", "Private Events": "私人活动", + "Show invite-only events": "仅显示邀请活动", + "Add Date": "添加日期", + "Event": "事件", "Liked by": "喜欢的人", "Comments": "评论", "FirstName LastName": "名字姓氏", diff --git a/lib/services/navigation_service.dart b/lib/services/navigation_service.dart index ae9260dbad..805bcc7680 100644 --- a/lib/services/navigation_service.dart +++ b/lib/services/navigation_service.dart @@ -16,6 +16,7 @@ import 'package:talawa/widgets/talawa_error_snackbar.dart'; /// * `showTalawaErrorDialog` /// * `pop` class NavigationService { + /// Key for Navigator State. GlobalKey navigatorKey = GlobalKey(); /// Pushes a Screen. @@ -106,6 +107,13 @@ class NavigationService { } /// This is used for the quick alert of `duration: 2 seconds` with text message(passed). + /// + /// **params**: + /// * `message`: Message would be shown on snackbar + /// * `duration`: Duration of Snackbar + /// + /// **returns**: + /// None void showSnackBar( String message, { Duration duration = const Duration(seconds: 2), @@ -119,6 +127,15 @@ class NavigationService { ); } + /// This is used for the quick error of `duration: 2 seconds`. + /// + /// **params**: + /// * `errorMessage`: Error Message shown in snackbar + /// * `messageType`: Type of Message + /// * `duration`: Duration of snackbar + /// + /// **returns**: + /// None void showTalawaErrorSnackBar( String errorMessage, MessageType messageType, @@ -138,6 +155,14 @@ class NavigationService { ); } + /// Shows an Error Dialog Box. + /// + /// **params**: + /// * `errorMessage`: Message shown in dialog + /// * `messageType`: Type of Message + /// + /// **returns**: + /// None void showTalawaErrorDialog(String errorMessage, MessageType messageType) { showDialog( context: navigatorKey.currentContext!, @@ -153,6 +178,12 @@ class NavigationService { } /// This function pops the current state. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None void pop() { return navigatorKey.currentState!.pop(); } diff --git a/lib/view_model/widgets_view_models/like_button_view_model.dart b/lib/view_model/widgets_view_models/like_button_view_model.dart index f2ff2ce9fa..ee63f1e105 100644 --- a/lib/view_model/widgets_view_models/like_button_view_model.dart +++ b/lib/view_model/widgets_view_models/like_button_view_model.dart @@ -28,7 +28,7 @@ class LikeButtonViewModel extends BaseModel { // ignore: unused_field late StreamSubscription _updatePostSubscription; - // Getters + ///Getters. bool get isLiked => _isLiked; List get likedBy => _likedBy; int get likesCount => _likedBy.length; diff --git a/lib/views/after_auth_screens/events/event_filter_bottomsheet.dart b/lib/views/after_auth_screens/events/event_filter_bottomsheet.dart new file mode 100644 index 0000000000..a164521485 --- /dev/null +++ b/lib/views/after_auth_screens/events/event_filter_bottomsheet.dart @@ -0,0 +1,150 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/apptheme.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; + +/// Shows a list of dropdown taken from `model` and `context`. +/// +/// **params**: +/// * `model`: contains the events data +/// * `context`: the overall context of UI +/// +/// **returns**: +/// * `Widget`: the dropdown +Widget dropDownList( + ExploreEventsViewModel model, + BuildContext context, +) { + final Map filters = { + 'All Events': 'Show all events', + 'My Events': 'Show all events created by you', + 'Registered Events': 'Show all events you have registered', + 'Public Events': 'Show events for all', + 'Private Events': 'Show invite-only events', + }; + return SizedBox( + height: SizeConfig.screenHeight, + width: SizeConfig.screenWidth, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.safeBlockHorizontal! * 10, + ), + child: StatefulBuilder( + builder: (_, StateSetter setState) { + return SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: SizeConfig.safeBlockVertical, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + AppLocalizations.of( + context, + )! + .strictTranslate( + "Filters", + ), + style: Theme.of( + context, + ).textTheme.headlineSmall, + ), + IconButton( + key: const Key('close'), + onPressed: () { + Navigator.pop(context); + }, + icon: const Icon( + Icons.close, + ), + ), + ], + ), + ...List.generate( + filters.length, + (index) { + return Padding( + padding: EdgeInsets.symmetric( + vertical: SizeConfig.safeBlockVertical! * 2, + ), + child: GestureDetector( + onTap: () { + model.choseValueFromDropdown( + filters.keys.toList()[index], + ); + setState(() {}); + }, + child: Container( + key: Key( + filters.keys.toList()[index], + ), + decoration: BoxDecoration( + color: model.chosenValue == + filters.keys.toList()[index] + ? Theme.of(context).colorScheme.secondary + : AppTheme.white, + borderRadius: BorderRadius.all( + Radius.circular( + SizeConfig.safeBlockHorizontal! * 2, + ), + ), + ), + width: SizeConfig.screenWidth! - 60, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.safeBlockHorizontal! * 5, + vertical: SizeConfig.safeBlockVertical! / 2, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppLocalizations.of(context)!.strictTranslate( + filters.keys.toList()[index], + ), + style: Theme.of(context) + .textTheme + .labelLarge! + .copyWith( + color: model.chosenValue == + filters.keys.toList()[index] + ? AppTheme.white + : AppTheme.blackPrimary, + ), + ), + Text( + AppLocalizations.of(context)!.strictTranslate( + filters.values.toList()[index], + ), + style: Theme.of(context) + .textTheme + .labelSmall! + .copyWith( + color: model.chosenValue == + filters.keys.toList()[index] + ? AppTheme.white + : AppTheme.blackSecondary, + ), + ), + ], + ), + ), + ), + ), + ); + }, + ), + ], + ), + ); + }, + ), + ), + ); +} diff --git a/lib/views/after_auth_screens/events/explore_events.dart b/lib/views/after_auth_screens/events/explore_events.dart index ed192eaaf4..cc9d665df7 100644 --- a/lib/views/after_auth_screens/events/explore_events.dart +++ b/lib/views/after_auth_screens/events/explore_events.dart @@ -5,6 +5,7 @@ import 'package:talawa/services/size_config.dart'; import 'package:talawa/utils/app_localization.dart'; import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/event_filter_bottomsheet.dart'; import 'package:talawa/views/after_auth_screens/events/explore_event_dialogue.dart'; import 'package:talawa/views/base_view.dart'; import 'package:talawa/widgets/event_card.dart'; @@ -29,12 +30,16 @@ class ExploreEvents extends StatelessWidget { appBar: AppBar( // AppBar returns widget for the header. backgroundColor: Theme.of(context).primaryColor, - key: const Key("ExploreEventsAppBar"), + key: const Key( + "ExploreEventsAppBar", + ), elevation: 0.0, automaticallyImplyLeading: false, centerTitle: true, title: Text( - AppLocalizations.of(context)!.strictTranslate('Explore Events'), + AppLocalizations.of(context)!.strictTranslate( + 'Explore Events', + ), style: Theme.of(context).textTheme.titleLarge!.copyWith( fontWeight: FontWeight.w600, fontSize: 20, @@ -42,8 +47,12 @@ class ExploreEvents extends StatelessWidget { ), leading: IconButton( // returns a button of menu icon to redirect to home. - color: Theme.of(context).iconTheme.color, - icon: const Icon(Icons.menu), + color: Theme.of( + context, + ).iconTheme.color, + icon: const Icon( + Icons.menu, + ), onPressed: () => MainScreenViewModel.scaffoldKey.currentState!.openDrawer(), ), @@ -64,7 +73,10 @@ class ExploreEvents extends StatelessWidget { ), ); }, - icon: const Icon(Icons.search, size: 20), + icon: Icon( + Icons.search, + size: (SizeConfig.safeBlockHorizontal ?? 4) * 5, + ), ) : const SizedBox(), ), @@ -73,7 +85,9 @@ class ExploreEvents extends StatelessWidget { // if the model is still fetching the events list then renders the Circular Progress Indicator // else render refresh icon along with the list of searched events for exploration. body: model.isBusy - ? const Center(child: CircularProgressIndicator()) + ? const Center( + child: CircularProgressIndicator(), + ) : RefreshIndicator( onRefresh: () async => model.refreshEvents(), child: Stack( @@ -91,25 +105,56 @@ class ExploreEvents extends StatelessWidget { MainAxisAlignment.spaceBetween, children: [ Expanded( - flex: 3, - child: Card( - color: Theme.of(context) - .colorScheme - .onPrimary, - elevation: 2, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 20, - ), - //width: SizeConfig.screenWidth! * 0.45, - child: DropdownButtonHideUnderline( - child: dropDownList(model, context), + flex: 2, + child: GestureDetector( + onTap: () { + showModalBottomSheet( + context: context, + builder: (_) { + return dropDownList( + model, + context, + ); + }, + ); + }, + child: Card( + color: Theme.of(context) + .colorScheme + .onPrimary, + child: Container( + padding: EdgeInsets.symmetric( + vertical: (SizeConfig + .safeBlockHorizontal ?? + 4) * + 3, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate( + "Filters", + ), + ), + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), + ], + ), ), ), ), ), Expanded( - flex: 2, + flex: 3, child: GestureDetector( onTap: () { showDialog( @@ -128,27 +173,39 @@ class ExploreEvents extends StatelessWidget { .colorScheme .onPrimary, child: Container( - padding: const EdgeInsets.symmetric( - vertical: 12, + padding: EdgeInsets.symmetric( + vertical: (SizeConfig + .safeBlockHorizontal ?? + 4) * + 3, ), // width: SizeConfig.screenWidth! * 0.30, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), const Icon( Icons.calendar_today, color: Color(0xff524F4F), ), - const SizedBox( - width: 8, + SizedBox( + width: SizeConfig + .safeBlockHorizontal, ), Text( AppLocalizations.of(context)! .strictTranslate( - "Add Date", + "Filter by Date", ), ), + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), ], ), ), @@ -244,41 +301,4 @@ class ExploreEvents extends StatelessWidget { }, ); } - - /// Shows a list of dropdown taken from `model` and `context`. - /// - /// **params**: - /// * `model`: contains the events data - /// * `context`: the overall context of UI - /// - /// **returns**: - /// * `Widget`: the dropdown - Widget dropDownList(ExploreEventsViewModel model, BuildContext context) { - return DropdownButton( - key: homeModel?.keySECategoryMenu, - value: model.chosenValue, - isExpanded: true, - items: [ - 'All Events', - 'Created Events', - 'Registered Events', - 'Public Events', - 'Private Events', - ].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text( - AppLocalizations.of(context)!.strictTranslate(value), - style: Theme.of(context) - .textTheme - .titleLarge! - .copyWith(color: Theme.of(context).colorScheme.secondary), - ), - ); - }).toList(), - onChanged: (value) { - model.choseValueFromDropdown(value!); - }, - ); - } } diff --git a/lib/widgets/multi_reaction.dart b/lib/widgets/multi_reaction.dart index 2f054594c2..2abec4d95e 100644 --- a/lib/widgets/multi_reaction.dart +++ b/lib/widgets/multi_reaction.dart @@ -2,8 +2,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_reaction_button/flutter_reaction_button.dart'; import 'package:flutter_svg/flutter_svg.dart'; +/// Reaction Button with multiple Emojis. class MultiReactButton extends StatefulWidget { const MultiReactButton({super.key, required this.toggle}); + + /// Toggle Function for react Button. final VoidCallback toggle; @override diff --git a/test/service_tests/navigation_service_test.dart b/test/service_tests/navigation_service_test.dart index bb361f3929..e40d8f17e8 100644 --- a/test/service_tests/navigation_service_test.dart +++ b/test/service_tests/navigation_service_test.dart @@ -8,7 +8,13 @@ import 'package:talawa/utils/app_localization.dart'; import 'package:talawa/widgets/talawa_error_dialog.dart'; import 'package:talawa/widgets/talawa_error_snackbar.dart'; -// This methods tries to cover all the cases which can be there in future! +/// This methods tries to cover all the cases which can be there in future. +/// +/// **params**: +/// * `settings`: RouteSettings +/// +/// **returns**: +/// * `Route`: Returns Route Type Route _onGenerateTestRoute(RouteSettings settings) { if (settings.name == '/second-screen') { if (settings.arguments == null) { @@ -169,7 +175,6 @@ class _SecondTestScreenState extends State { class ThirdTestScreen extends StatefulWidget { const ThirdTestScreen({super.key, this.arguments}); final String? arguments; - @override State createState() => _ThirdTestScreenState(); } diff --git a/test/views/after_auth_screens/events/create_event_page_test.dart b/test/views/after_auth_screens/events/create_event_page_test.dart index 1cf338c8bf..1020f44d03 100644 --- a/test/views/after_auth_screens/events/create_event_page_test.dart +++ b/test/views/after_auth_screens/events/create_event_page_test.dart @@ -27,6 +27,14 @@ class MockCallbackFunction extends Mock { final setDateCallback = MockCallbackFunction(); final setTimeCallback = MockCallbackFunction(); +/// Creates a EventScreen for tests. +/// +/// **params**: +/// * `themeMode`: ThemeMode +/// * `theme`: ThemeData of App +/// +/// **returns**: +/// * `Widget`: Event Screen Widget Widget createEventScreen({ ThemeMode themeMode = ThemeMode.light, required ThemeData theme, diff --git a/test/views/after_auth_screens/events/event_filter_bottomsheet_test.dart b/test/views/after_auth_screens/events/event_filter_bottomsheet_test.dart new file mode 100644 index 0000000000..bd75c33020 --- /dev/null +++ b/test/views/after_auth_screens/events/event_filter_bottomsheet_test.dart @@ -0,0 +1,97 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:mocktail_image_network/mocktail_image_network.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/explore_events.dart'; +import 'package:talawa/widgets/custom_drawer.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +class MockCallbackFunction extends Mock { + void call(); +} + +final setDateCallback = MockCallbackFunction(); +final setTimeCallback = MockCallbackFunction(); + +/// Creates Explore Event Screen. +/// +/// **params**: +/// * `model`: Home Screen Model +/// +/// **returns**: +/// * `Widget`: Returns Explore Screen Widget +Widget createExploreEventsScreen(MainScreenViewModel model) => MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + home: Scaffold( + key: MainScreenViewModel.scaffoldKey, + drawer: CustomDrawer( + homeModel: model, + ), + body: const ExploreEvents( + key: Key('ExploreEvents'), + ), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); +void main() { + SizeConfig().test(); + testSetupLocator(); + locator.unregister(); + setUp(() { + registerServices(); + }); + tearDown(() { + unregisterServices(); + }); + group('testing filters bottomsheet', () { + testWidgets("Checking tap cross works", (tester) async { + await mockNetworkImages(() async { + locator.unregister(); + final model = ExploreEventsViewModel(); + locator.registerSingleton(model); + final homeModel = locator(); + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pumpAndSettle(); + await tester.tap(find.bySemanticsLabel('Filters')); + await tester.pumpAndSettle(); + final finder = find.byKey(const Key('close')); + expect(finder, findsOneWidget); + await tester.tap(finder); + await tester.pumpAndSettle(); + expect(find.bySemanticsLabel('Filters'), findsAtLeast(1)); + }); + }); + testWidgets("Testing if Filter button works", (tester) async { + await mockNetworkImages(() async { + locator.unregister(); + final model = ExploreEventsViewModel(); + locator.registerSingleton(model); + final homeModel = locator(); + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pumpAndSettle(); + await tester.tap(find.bySemanticsLabel('Filters')); + await tester.pumpAndSettle(); + await tester.pump(); + await tester.tap(find.byKey(const Key('Public Events'))); + await tester.pumpAndSettle(); + expect(model.chosenValue, 'Public Events'); + }); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/explore_events_test.dart b/test/widget_tests/after_auth_screens/events/explore_events_test.dart index d227dc2ecc..2d37da6cee 100644 --- a/test/widget_tests/after_auth_screens/events/explore_events_test.dart +++ b/test/widget_tests/after_auth_screens/events/explore_events_test.dart @@ -140,13 +140,12 @@ void main() { await tester.pumpWidget(createExploreEventsScreen(homeModel)); await tester.pumpAndSettle(); - await tester.tap(find.byType(DropdownButtonHideUnderline)); + await tester.tap(find.bySemanticsLabel('Filters')); await tester.pumpAndSettle(); - - await tester.tap(find.bySemanticsLabel('Created Events')); + await tester.pump(); + await tester.tap(find.byKey(const Key('Public Events'))); await tester.pumpAndSettle(); - - expect(model.chosenValue, 'Created Events'); + expect(model.chosenValue, 'Public Events'); }); }); testWidgets("Testing if tapping on calendar works", (tester) async { @@ -156,7 +155,7 @@ void main() { await tester.pumpWidget(createExploreEventsScreen(homeModel)); await tester.pumpAndSettle(); - await tester.tap(find.text('Add Date')); + await tester.tap(find.text('Filter by Date')); await tester.pump(); expect(find.byType(ExploreEventDialog), findsOneWidget);