Skip to content

Commit

Permalink
Fixes #2192 #1602 , Improving Filters UI (#2245)
Browse files Browse the repository at this point in the history
* Add:Filters

* Add:Documentation

* Add:MultiLingual Support

* Fix:Format

* Reduced: Lines of Codes

* Fixed:Tests

* Add:Fix Failing test case

* Add:Tests for requested lines

* Add:test for filter changing

* Fixed:changes requested

* Add:Changes

* Fix:Documentation

* Fix:Dart version

* Fixed:spacing

* Remove: useless docs

* Remove:Spaces

* Removed:spaces

* Fix:Constant Sizes

* Fix:Format issues

* Minor FIx

* Fix:format

* Fix:Dynamic size

* Fix:Dynamic size

* Fix:Failing test

* Fix:Failing test
  • Loading branch information
AyushRaghuvanshi authored and Abhisheksainii committed Jan 3, 2024
1 parent 270ad70 commit 9438a45
Show file tree
Hide file tree
Showing 17 changed files with 460 additions and 74 deletions.
10 changes: 10 additions & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions lang/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "मेरे कार्यक्रम",
Expand Down
9 changes: 9 additions & 0 deletions lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "私のイベント",
Expand Down
9 changes: 9 additions & 0 deletions lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 12 additions & 3 deletions lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "名字姓氏",
Expand Down
31 changes: 31 additions & 0 deletions lib/services/navigation_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:talawa/widgets/talawa_error_snackbar.dart';
/// * `showTalawaErrorDialog`
/// * `pop`
class NavigationService {
/// Key for Navigator State.
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

/// Pushes a Screen.
Expand Down Expand Up @@ -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),
Expand All @@ -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,
Expand All @@ -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!,
Expand All @@ -153,6 +178,12 @@ class NavigationService {
}

/// This function pops the current state.
///
/// **params**:
/// None
///
/// **returns**:
/// None
void pop() {
return navigatorKey.currentState!.pop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class LikeButtonViewModel extends BaseModel {
// ignore: unused_field
late StreamSubscription _updatePostSubscription;

// Getters
///Getters.
bool get isLiked => _isLiked;
List<LikedBy> get likedBy => _likedBy;
int get likesCount => _likedBy.length;
Expand Down
150 changes: 150 additions & 0 deletions lib/views/after_auth_screens/events/event_filter_bottomsheet.dart
Original file line number Diff line number Diff line change
@@ -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<String, String> 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,
),
),
],
),
),
),
),
);
},
),
],
),
);
},
),
),
);
}
Loading

0 comments on commit 9438a45

Please sign in to comment.