Skip to content

Commit

Permalink
Chore: redesign the select organisation screen. (#1891)
Browse files Browse the repository at this point in the history
* Fixes #1612 No Messaging When No Organizations are Created

* Add constant time-out for loading data.

* Add constant time-out for loading data.

* chore: Add request-screen-1 with optional message.

* formatting

* feat: Added final UI comp, according to the design.

* chore: Added dart formatting

* chore: remove darker shade from app bar

* feat: Add viewmodel logic for waiting screen.

* Chore: redeisgn the select organization screen.

* formatting

* Draft Commit

* Merged All the flow of new Member Management.

* Fixed the failing test

* Fixed the failing test

* Removed the unsed imports.

* Fixed the formating

* Some last changes

* formatting

* formatting

* formatting

* added documentation

* added documentation

* added documentation

* wrote test for set_url, custon tile, select org, according to the new UI

* draft

* Add the test for select org VM and join org after auth screen according to the new implementation.

* formatting

* formatting
  • Loading branch information
Ayush0Chaudhary authored Jul 1, 2023
1 parent 1dd4b17 commit a24acc7
Show file tree
Hide file tree
Showing 19 changed files with 832 additions and 836 deletions.
Binary file added assets/images/Group 8948.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions lib/apptheme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';

class AppTheme {
// Text Styles
static TextStyle title = const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);
static TextStyle headline1 = const TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);
static TextStyle headline2 = const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);
static TextStyle headline3 = const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);
static TextStyle headline4 = const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);
static TextStyle headline5 = const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);
static TextStyle headline6 = const TextStyle(
fontSize: 10,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);
static TextStyle subtitle1 = const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: blackSecondary,
fontFamily: 'OpenSans',
);
static TextStyle subtitle2 = const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: blackSecondary,
fontFamily: 'OpenSans',
);
static TextStyle bodyText1 = const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
color: blackSecondary,
fontFamily: 'OpenSans',
);
static TextStyle bodyText2 = const TextStyle(
fontSize: 8,
fontWeight: FontWeight.w400,
color: blackSecondary,
fontFamily: 'OpenSans',
);
static TextStyle bodyText3 = const TextStyle(
fontSize: 10,
fontWeight: FontWeight.w400,
color: blackSecondary,
fontFamily: 'OpenSans',
);
static TextStyle overline = const TextStyle(
fontSize: 6,
fontWeight: FontWeight.w400,
color: blackSecondary,
fontFamily: 'OpenSans',
);
static TextStyle button = const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: primary,
fontFamily: 'OpenSans',
);

// Colors
static const Color primary = Color(0xFFFFC107);
static const Color secondary = Color(0xFF795548);
static const Color tertiary = Color(0xFFA16938);
static const Color white = Color(0xFFFFFFFF);
static const Color red = Color(0xFFEB5757);
static const Color blue = Color(0xFF2196F3);
static const Color yellow = Color(0xffF6BA18);
static const Color green = Color(0xFF2ACC00);
static const Color grey = Color(0xFFD2D2D2);
static const Color lightGrey = Color(0xFFECECEC);
static const Color blackPrimary = Color(0xFF3E3E3E);
static const Color blackSecondary = Color(0xFF636363);
static const Color blackTertiary = Color(0xFFAEAEAE);
static const Color shadow = Color(0x408E8E8E);
}
69 changes: 65 additions & 4 deletions lib/constants/routing_constants.dart
Original file line number Diff line number Diff line change
@@ -1,38 +1,99 @@
// ignore_for_file: talawa_api_doc
// ignore_for_file: talawa_good_doc_comments

///This file contains the routes.
///This file contains the routes. These can be used to make push screen call via Routes.splashScreen to access these string.
class Routes {
/// static variables.
static const String demoPageViewRoute = "/demoPageViewRoute";

/// static variables.
static const String splashScreen = "/";

/// static variables.
static const String languageSelectionRoute = "/selectLang";

/// static variables.
static const String setUrlScreen = "/setUrl";

/// static variables.
static const String loginScreen = "/login";

/// static variables.
static const String selectOrgScreen = "/selectOrg";

/// static variables.
static const String signupDetailScreen = "/signupDetails";

/// static variables.
static const String waitingScreen = "/waiting";

/// static variables.
static const String recoverScreen = "/recover";

/// static variables.
static const String updateScreen = "/update";

/// static variables.
static const String homeScreen = "/homeScreen";

/// static variables.
static const String mainScreen = "/mainScreen";

/// static variables.
static const String progressDialog = "/progress";

/// static variables.
static const String individualPost = "/individualPost";

/// static variables.
static const String pinnedPostPage = "/pinnedPostPage";

/// static variables.
static const String exploreEventsScreen = "/exploreEvents";

/// static variables.
static const String eventInfoPage = "/eventInfo";

/// static variables.
static const String createEventPage = "/createEventPage";

/// static variables.
static const String profilePage = "/profilePage";

/// static variables.
static const String editProfilePage = "/editProfilePage";

/// static variables.
static const String joinOrg = '/joinOrg';

/// static variables.
static const String requestAccess = '/requestAccess';

/// static variables.
static const String editEventPage = "/editEventPage";

/// static variables.
static const String appSettings = '/appSettingsPage';

/// static variables.
static const String chatMessageScreen = '/chatMessageScreen';

/// static variables.
static const String mapScreen = '/mapScreen';

/// static variables.
static const String calendar = '/calendar';

/// static variables.
static const String eventTasks = '/event_tasks';

/// static variables.
static const String userTasks = '/user_tasks';

/// static variables.
static const String addTask = '/addTask';

/// static variables.
static const String editTask = '/editTask';

/// static variables.
static const String selectContact = '/selectContact';
}
11 changes: 11 additions & 0 deletions lib/constants/timeout.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// Class to define constant timeout to bring consistency in the code.
class TimeOuts {
/// For small timeout, used for small data fetch.
static const small = 5;

/// For medium timeout, used for medium data fetch.
static const mediums = 100;

/// For large timeout, used for large data fetch.
static const large = 300;
}
2 changes: 2 additions & 0 deletions lib/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:talawa/services/third_party_service/multi_media_pick_service.dar
import 'package:talawa/services/user_config.dart';
import 'package:talawa/utils/queries.dart';
import 'package:talawa/utils/validators.dart';
import 'package:talawa/view_model/access_request_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart';
Expand Down Expand Up @@ -144,4 +145,5 @@ void setupLocator() {
locator.registerFactory(() => CommentsViewModel());
locator.registerFactory(() => AppTheme());
locator.registerFactory(() => DirectChatViewModel());
locator.registerFactory(() => AccessScreenViewModel());
}
14 changes: 10 additions & 4 deletions lib/router.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// ignore_for_file: talawa_api_doc
// ignore_for_file: talawa_good_doc_comments

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:talawa/constants/routing_constants.dart';
Expand All @@ -24,7 +21,8 @@ import 'package:talawa/views/after_auth_screens/events/explore_events.dart';
import 'package:talawa/views/after_auth_screens/feed/individual_post.dart';
import 'package:talawa/views/after_auth_screens/feed/organization_feed.dart';
import 'package:talawa/views/after_auth_screens/feed/pinned_post_page.dart';
import 'package:talawa/views/after_auth_screens/join_organisation_after_auth.dart';
import 'package:talawa/views/after_auth_screens/join_org_after_auth/access_request_screen.dart';
import 'package:talawa/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart';
import 'package:talawa/views/after_auth_screens/profile/edit_profile_page.dart';
import 'package:talawa/views/after_auth_screens/profile/profile_page.dart';
import 'package:talawa/views/after_auth_screens/tasks/create_task_page.dart';
Expand Down Expand Up @@ -201,6 +199,14 @@ Route<dynamic> generateRoute(RouteSettings settings) {
),
);

case Routes.requestAccess:
final OrgInfo org = settings.arguments! as OrgInfo;
return CupertinoPageRoute(
builder: (context) => SendAccessRequest(
key: const Key('Signup'),
org: org,
),
);
// Returns the EditEventPage Widget
case Routes.editEventPage:
final Event event = settings.arguments! as Event;
Expand Down
44 changes: 44 additions & 0 deletions lib/view_model/access_request_view_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:flutter/cupertino.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:talawa/constants/routing_constants.dart';
import 'package:talawa/enums/enums.dart';
import 'package:talawa/locator.dart';
import 'package:talawa/models/organization/org_info.dart';
import 'package:talawa/view_model/base_view_model.dart';

class AccessScreenViewModel extends BaseModel {
late OrgInfo selectedOrganization = OrgInfo(id: '-1');
late List<OrgInfo> organizations = [];
late String orgId;
final optionalMessageController = TextEditingController();

Future<void> initialise(OrgInfo org) async {
selectedOrganization = org;
}

Future<void> sendMembershipRequest() async {
//TODO: Implement Message arg for below function
final result = await databaseFunctions.gqlAuthMutation(
queries.sendMembershipRequest(selectedOrganization.id!),
);
if (result != null) {
final OrgInfo membershipRequest = OrgInfo.fromJson(
(((result as QueryResult).data!)['sendMembershipRequest']
as Map<String, dynamic>)['organization'] as Map<String, dynamic>,
);
userConfig.updateUserMemberRequestOrg([membershipRequest]);
if (userConfig.currentUser.joinedOrganizations!.isEmpty) {
navigationService.removeAllAndPush(
Routes.waitingScreen,
Routes.splashScreen,
);
} else {
navigationService.pop();
navigationService.showTalawaErrorSnackBar(
'Join in request sent to ${selectedOrganization.name} successfully',
MessageType.info,
);
}
}
}
}
2 changes: 1 addition & 1 deletion lib/view_model/main_screen_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class MainScreenViewModel extends BaseModel {
),
];

pluginList = (Hive.box('pluginBox').get('plugins') ?? []) as List<String>;
pluginList = (Hive.box('pluginBox').get('plugins') ?? []) as List<dynamic>;

pluginList.forEach((plugin) {
if (pluginPrototypeData.containsKey(
Expand Down
Loading

0 comments on commit a24acc7

Please sign in to comment.