diff --git a/lib/apptheme.dart b/lib/apptheme.dart index 3dce605575..d0ba0edfa7 100644 --- a/lib/apptheme.dart +++ b/lib/apptheme.dart @@ -1,88 +1,117 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; - // import 'package:flutter_screenutil/flutter_screenutil.dart'; -/// This class will be use to uniform the apptheme of the app in future. + +/// Apptheme class. +/// class AppTheme { // Text Styles + /// Custom theme for the app. + /// static TextStyle title = const TextStyle( fontSize: 20, fontWeight: FontWeight.w600, color: blackPrimary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle headline1 = const TextStyle( fontSize: 24, fontWeight: FontWeight.w600, color: blackPrimary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle headline2 = const TextStyle( fontSize: 18, fontWeight: FontWeight.w600, color: blackPrimary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle headline3 = const TextStyle( fontSize: 16, fontWeight: FontWeight.w600, color: blackPrimary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle headline4 = const TextStyle( fontSize: 14, fontWeight: FontWeight.w600, color: blackPrimary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle headline5 = const TextStyle( fontSize: 12, fontWeight: FontWeight.w600, color: blackPrimary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle headline6 = const TextStyle( fontSize: 10, fontWeight: FontWeight.w600, color: blackPrimary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle subtitle1 = const TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: blackSecondary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle subtitle2 = const TextStyle( fontSize: 12, fontWeight: FontWeight.w500, color: blackSecondary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle bodyText1 = const TextStyle( fontSize: 12, fontWeight: FontWeight.w400, color: blackSecondary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle bodyText2 = const TextStyle( fontSize: 8, fontWeight: FontWeight.w400, color: blackSecondary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle bodyText3 = const TextStyle( fontSize: 10, fontWeight: FontWeight.w400, color: blackSecondary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle overline = const TextStyle( fontSize: 6, fontWeight: FontWeight.w400, color: blackSecondary, fontFamily: 'OpenSans', ); + + /// Custom theme for the app. static TextStyle button = const TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -90,19 +119,47 @@ class AppTheme { fontFamily: 'OpenSans', ); - // Colors + /// Colors. + /// + /// Custom colors for the app. static const Color primary = Color(0xFFFFC107); + + /// Custom colors for the app. static const Color secondary = Color(0xFF795548); + + /// Custom colors for the app. static const Color tertiary = Color(0xFFA16938); + + /// Custom colors for the app. static const Color white = Color(0xFFFFFFFF); + + /// Custom colors for the app. static const Color red = Color(0xFFEB5757); + + /// Custom colors for the app. static const Color blue = Color(0xFF2196F3); + + /// Custom colors for the app. static const Color yellow = Color(0xffF6BA18); + + /// Custom colors for the app. static const Color green = Color(0xFF2ACC00); + + /// Custom colors for the app. static const Color grey = Color(0xFFD2D2D2); + + /// Custom colors for the app. static const Color lightGrey = Color(0xFFECECEC); + + /// Custom colors for the app. static const Color blackPrimary = Color(0xFF3E3E3E); + + /// Custom colors for the app. static const Color blackSecondary = Color(0xFF636363); + + /// Custom colors for the app. static const Color blackTertiary = Color(0xFFAEAEAE); + + /// Custom colors for the app. static const Color shadow = Color(0x408E8E8E); } diff --git a/lib/models/organization/org_info.dart b/lib/models/organization/org_info.dart index bc4b6ba828..a72873f562 100644 --- a/lib/models/organization/org_info.dart +++ b/lib/models/organization/org_info.dart @@ -58,6 +58,14 @@ class OrgInfo { ); } + /// The conventional function to parse json, check flutter docs to know more. + /// + /// + /// **params**: + /// * `json`: Passing the json to be parsed. + /// + /// **returns**: + /// * `List`: returning the OrgInfo object containing the json data List fromJsonToList(List json) { final List orgList = []; json.forEach((element) { @@ -70,20 +78,35 @@ class OrgInfo { return orgList; } + /// contains the Image url. @HiveField(0) String? image; + + /// The org id. @HiveField(1) String? id; + + /// The org name. @HiveField(2) String? name; + + /// The org admins. @HiveField(3) List? admins; + + /// The org name. @HiveField(4) List? members; + + /// The org descriptions. @HiveField(5) String? description; + + /// The org visibility. @HiveField(6) bool? isPublic; + + /// The org creatorInfo. @HiveField(7) User? creatorInfo; } diff --git a/lib/router.dart b/lib/router.dart index a5d7a4a5fc..f56ac3b5ba 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -40,10 +40,17 @@ import 'package:talawa/views/pre_auth_screens/set_url.dart'; import 'package:talawa/views/pre_auth_screens/signup_details.dart'; import 'package:talawa/views/pre_auth_screens/waiting_to_join_private_org.dart'; -/// The MaterialApp provides us with a property called generateRoute where -/// we can pass in a Function that returns a Route and takes in RouteSettings +/// The MaterialApp provides us with a property called generateRoute where. +/// /// +/// we can pass in a Function that returns a Route and takes in RouteSettings /// Thus for this purpose, we create a function named generateRoute +/// +/// **params**: +/// * `settings`: RouteSetting have been passed +/// +/// **returns**: +/// * `Route`: Return a Route Route generateRoute(RouteSettings settings) { // The settings contains the route information of the requested route. // It provides two key things to us: the name, and the arguments. diff --git a/lib/utils/queries.dart b/lib/utils/queries.dart index 5176a2cfe3..8a91298f44 100644 --- a/lib/utils/queries.dart +++ b/lib/utils/queries.dart @@ -1,6 +1,18 @@ ///This class returns some queries for the application. class Queries { //Returns a query to register a user. + + /// Mutation to register a user. + /// + /// + /// **params**: + /// * `firstName`: user's data. + /// * `lastName`: user's data. + /// * `email`: user's data. + /// * `password`: user's data. + /// + /// **returns**: + /// * `String`: Return the mutation in string type to be passed to graphql client. String registerUser( String firstName, String lastName, @@ -70,6 +82,14 @@ class Queries { } //Returns a query to login the user + /// mutation to login the user. + /// + /// **params**: + /// * `email`: user's data + /// * `password`: user's data + /// + /// **returns**: + /// * `String`: mutation in string form, to be passed on to graphql client. String loginUser(String email, String password) { return """ mutation { @@ -148,6 +168,13 @@ class Queries { """; } + /// to update user profile. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: return a mutation String updateUserProfile() { return """ mutation UpdateUserProfile( @@ -166,6 +193,13 @@ class Queries { """; } + /// To save fcm token the backend fro notification. + /// + /// **params**: + /// * `token`: fcm token, read firebase docs for more info + /// + /// **returns**: + /// * `String`: return the mutation String saveFcmToken(String? token) { return """ mutation { @@ -174,6 +208,13 @@ class Queries { """; } + /// logout muiation. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: simple mutation String logout() { return """ mutation { @@ -182,6 +223,8 @@ class Queries { """; } + /// getter for joined org. + /// String get fetchJoinInOrg { return """ query organizationsConnection(\$first: Int, \$skip: Int){ @@ -204,6 +247,7 @@ class Queries { """; } + /// getter for fetchJoinInOrgByName. String get fetchJoinInOrgByName { return """ query organizationsConnection( @@ -235,6 +279,14 @@ class Queries { """; } + /// make mutation string for joiining org by ord.id. + /// + /// + /// **params**: + /// * `orgId`: refer org object. + /// + /// **returns**: + /// * `String`: returns a string for client String joinOrgById(String orgId) { return ''' mutation { @@ -258,6 +310,14 @@ class Queries { '''; } + /// mutation to send the member request. + /// + /// + /// **params**: + /// * `orgId`: refer org object + /// + /// **returns**: + /// * `String`: mutation in string form, to be passed on to graphql client. String sendMembershipRequest(String orgId) { return ''' mutation { @@ -280,6 +340,7 @@ class Queries { '''; } + /// mutation in string form, to be passed on to graphql client.. String fetchUserInfo = ''' query Users(\$id: ID!){ users(where: { id: \$id }) { @@ -336,6 +397,13 @@ class Queries { } '''; + /// mutation for refresh token. + /// + /// **params**: + /// * `refreshToken`: related to auth, token based authentication, mutation to refresh the token + /// + /// **returns**: + /// * `String`: mutation in string form, to be passed on to graphql client. String refreshToken(String refreshToken) { return ''' mutation{ @@ -347,6 +415,13 @@ class Queries { '''; } + /// lang update mutation. + /// + /// **params**: + /// * `languageCode`: lang code to identify the lang, refer lang jsons + /// + /// **returns**: + /// * `String`: mutation in string form, to be passed on to graphql client. String updateLanguage(String languageCode) { return ''' mutation { @@ -359,6 +434,14 @@ class Queries { '''; } + /// fetching org details with the help of id. + /// + /// + /// **params**: + /// * `orgId`: Org identifier + /// + /// **returns**: + /// * `String`: mutation in string form, to be passed on to graphql client. String fetchOrgById(String orgId) { return ''' query{ @@ -377,6 +460,14 @@ class Queries { '''; } + /// query to fetch user lang. + /// + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: query in string form, to be passed on to graphql client. String userLanguage() { return ''' query{ @@ -385,6 +476,14 @@ class Queries { '''; } + /// query for new user language . + /// + /// + /// **params**: + /// * `userId`: user identifier + /// + /// **returns**: + /// * `String`: query in string form, to be passed on to graphql client. String newUserLanguage(String userId) { return ''' query{ @@ -393,6 +492,13 @@ class Queries { '''; } + /// query to fetch org details. + /// + /// **params**: + /// * `orgId`: org identifier + /// + /// **returns**: + /// * `String`: query in string form, to be passed on to graphql client. String fetchOrgDetailsById(String orgId) { return ''' query{ @@ -421,7 +527,14 @@ class Queries { '''; } - ///`getPluginList` queries all properties of pluginList from the server + ///`getPluginList` queries all properties of pluginList from the server. + /// + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: query in string form, to be passed on to graphql client. String getPluginsList() { return ''' query { @@ -437,7 +550,20 @@ query { '''; } - /// `createDonation` creates a new donation transaction by taking the userId ,orgId ,nameOfOrg ,nameOfUser as parameters + /// `createDonation` creates a new donation transaction by taking the userId ,orgId ,nameOfOrg ,nameOfUser as parameters. + /// + /// more_info_if_required + /// + /// **params**: + /// * `userId`: user identifier + /// * `orgId`: org identifier + /// * `nameOfOrg`: org data + /// * `nameOfUser`: user data + /// * `payPalId`: for payment + /// * `amount`: amount + /// + /// **returns**: + /// * `String`: mutation in string form, to be passed on to graphql client. String createDonation( String userId, String orgId, diff --git a/lib/view_model/access_request_view_model.dart b/lib/view_model/access_request_view_model.dart index 385578eced..16f5dd9e7c 100644 --- a/lib/view_model/access_request_view_model.dart +++ b/lib/view_model/access_request_view_model.dart @@ -6,16 +6,39 @@ import 'package:talawa/locator.dart'; import 'package:talawa/models/organization/org_info.dart'; import 'package:talawa/view_model/base_view_model.dart'; +/// AccessScreenViewModel widget. class AccessScreenViewModel extends BaseModel { + /// selectedOrganization list. late OrgInfo selectedOrganization = OrgInfo(id: '-1'); + + /// organizations list. late List organizations = []; + + /// org identifier. late String orgId; + + /// text controller for optional message during the request. final optionalMessageController = TextEditingController(); + /// initialization function. + /// + /// + /// **params**: + /// * `org`: Org to send request to. + /// + /// **returns**: + /// * `Future`: None Future initialise(OrgInfo org) async { selectedOrganization = org; } + /// sending member ship request function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: define_the_return Future sendMembershipRequest() async { //TODO: Implement Message arg for below function final result = await databaseFunctions.gqlAuthMutation( diff --git a/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart b/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart index 7abf0dca27..13ad834da7 100644 --- a/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart +++ b/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart @@ -38,6 +38,8 @@ class AddPostViewModel extends BaseModel { /// returns: /// * `File?`: The image file File? get imageFile => _imageFile; + + /// Getter to access the base64 type. String? get imageInBase64 => _imageInBase64; /// The Username. @@ -89,6 +91,14 @@ class AddPostViewModel extends BaseModel { _dbFunctions = locator(); } + /// to convert the image in base64. + /// + /// + /// **params**: + /// * `file`: file of image clicked. + /// + /// **returns**: + /// * `Future`: Future string containing the base 64 format image Future convertToBase64(File file) async { try { final List bytes = await file.readAsBytes(); diff --git a/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart b/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart index 5a8077f13f..aa2b9efa0c 100644 --- a/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart +++ b/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart @@ -11,26 +11,49 @@ import 'package:talawa/view_model/base_view_model.dart'; /// Methods include: /// * `getImageFromGallery` class EditProfilePageViewModel extends BaseModel { + /// current user. final user = userConfig.currentUser; late MultiMediaPickerService _multiMediaPickerService; + + /// profile image. late File? imageFile; + + /// first name controller. TextEditingController firstNameTextController = TextEditingController(); + + /// last name controller. TextEditingController lastNameTextController = TextEditingController(); + + /// Focus node tpo control focus. FocusNode firstNameFocus = FocusNode(); + + /// Focus node tpo control focus. FocusNode lastNameFocus = FocusNode(); + + /// Graphql client. final databaseService = databaseFunctions; - // initialiser + /// initialization function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None void initialize() { imageFile = null; _multiMediaPickerService = locator(); } /// This function is used to get the image from gallery. + /// /// The function uses the `_multiMediaPickerService` services. /// - /// params: - /// * [camera] : if true then open camera for image, else open gallery to select image. + /// **params**: + /// * `camera`: if true then open camera for image, else open gallery to select image. + /// + /// **returns**: + /// * `Future`: None Future getImageFromGallery({bool camera = false}) async { final image = await _multiMediaPickerService.getPhotoFromGallery(camera: camera); @@ -40,10 +63,13 @@ class EditProfilePageViewModel extends BaseModel { } } - /// This function is used to convert the image into Base64 format + /// This function is used to convert the image into Base64 format. /// - /// params: - /// * [file] : Takes the iimage in format of file. + /// **params**: + /// * `file`: Takes the image in format of file. + /// + /// **returns**: + /// * `Future`: image in string format Future convertToBase64(File file) async { try { final List bytes = await file.readAsBytes(); @@ -58,6 +84,12 @@ class EditProfilePageViewModel extends BaseModel { } /// This function remove the selected image. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None void removeImage() { imageFile = null; notifyListeners(); diff --git a/lib/view_model/pre_auth_view_models/select_organization_view_model.dart b/lib/view_model/pre_auth_view_models/select_organization_view_model.dart index 7f35f19e8b..52fc7ed2e5 100644 --- a/lib/view_model/pre_auth_view_models/select_organization_view_model.dart +++ b/lib/view_model/pre_auth_view_models/select_organization_view_model.dart @@ -9,27 +9,53 @@ import 'package:talawa/models/mainscreen_navigation_args.dart'; import 'package:talawa/models/organization/org_info.dart'; import 'package:talawa/view_model/base_view_model.dart'; -/// SelectOrganizationViewModel class helps to interact with model to serve data -/// and react to user's input in Select Organization View. +/// SelectOrganizationViewModel class helps to interact with model to serve data and react to user's input in Select Organization View. /// /// Methods include: /// * `selectOrg` /// * `onTapJoin` class SelectOrganizationViewModel extends BaseModel { // variables + /// Organization selection required data. final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); + + /// Organization selection required data. late Barcode result; + + /// Organization selection required data. final ScrollController allOrgController = ScrollController(); + + /// Organization selection required data. final ScrollController controller = ScrollController(); + + /// Organization selection required data. final FocusNode searchFocus = FocusNode(); + + /// Organization selection required data. final TextEditingController searchController = TextEditingController(); + + /// Organization selection required data. late OrgInfo selectedOrganization = OrgInfo(id: '-1'); + + /// Organization selection required data. late List organizations = []; + + /// Organization selection required data. bool searching = false; + + /// Organization selection required data. late Widget showSearchOrgList = Container(); + + /// Organization selection required data. late String orgId; - // if the search box is on tap + /// if search is enabled. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None void searchActive() { if (searchFocus.hasFocus) { organizations = []; @@ -38,7 +64,13 @@ class SelectOrganizationViewModel extends BaseModel { } } - // initialiser + /// initializer. + /// + /// **params**: + /// * `initialData`: data + /// + /// **returns**: + /// * `Future`: None Future initialise(String initialData) async { searchFocus.addListener(searchActive); if (!initialData.contains('-1')) { @@ -61,8 +93,11 @@ class SelectOrganizationViewModel extends BaseModel { /// This function select the organization. /// - /// params: - /// * [item] : Selected organization data. + /// **params**: + /// * `item`: Selected organization data. + /// + /// **returns**: + /// * `Future`: None Future selectOrg(OrgInfo item) async { print(item.id); bool orgAlreadyJoined = false; @@ -117,7 +152,13 @@ class SelectOrganizationViewModel extends BaseModel { } } - // Helper for listener to check if user can tap on continue option or not. + /// Helper for listener to check if user can tap on continue option or not. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None void onTapContinue() { // if user selected any organization. if (selectedOrganization.id != '-1') { @@ -135,7 +176,15 @@ class SelectOrganizationViewModel extends BaseModel { } /// This function make user to join the selected organization. - /// The function uses `joinOrgById` graph QL query. + /// + /// + /// The function uses `joinOrgById` graph QL query + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: None Future onTapJoin() async { // if `selectedOrganization` is public. if (selectedOrganization.isPublic == true) { @@ -191,6 +240,14 @@ class SelectOrganizationViewModel extends BaseModel { } /// This function fetch more option. + /// + /// + /// **params**: + /// * `fetchMore`: client function + /// * `organizations`: org list + /// + /// **returns**: + /// None void fetchMoreHelper(FetchMore fetchMore, List organizations) { fetchMore( FetchMoreOptions( diff --git a/lib/views/after_auth_screens/feed/organization_feed.dart b/lib/views/after_auth_screens/feed/organization_feed.dart index 145ecfef78..517f1967ff 100644 --- a/lib/views/after_auth_screens/feed/organization_feed.dart +++ b/lib/views/after_auth_screens/feed/organization_feed.dart @@ -12,7 +12,11 @@ class OrganizationFeed extends StatelessWidget { this.homeModel, this.forTest = false, }) : super(key: key); + + /// MainScreenViewModel. final MainScreenViewModel? homeModel; + + /// To implement the test. final bool forTest; @override diff --git a/lib/views/after_auth_screens/join_org_after_auth/access_request_screen.dart b/lib/views/after_auth_screens/join_org_after_auth/access_request_screen.dart index 28a76f96ce..0a3b4a539d 100644 --- a/lib/views/after_auth_screens/join_org_after_auth/access_request_screen.dart +++ b/lib/views/after_auth_screens/join_org_after_auth/access_request_screen.dart @@ -4,13 +4,15 @@ import 'package:talawa/models/organization/org_info.dart'; import 'package:talawa/view_model/access_request_view_model.dart'; import 'package:talawa/views/base_view.dart'; -///requestAccess +///requestAccess. class SendAccessRequest extends StatelessWidget { const SendAccessRequest({ Key? key, required this.org, // required this.model }) : super(key: key); + + /// OrgInfo object. final OrgInfo org; @override Widget build(BuildContext context) { diff --git a/lib/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart b/lib/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart index 92296b8843..6c0f5361a1 100644 --- a/lib/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart +++ b/lib/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart @@ -15,6 +15,9 @@ import 'package:vibration/vibration.dart'; class JoinOrganisationAfterAuth extends StatelessWidget { const JoinOrganisationAfterAuth({Key? key, required this.orgId}) : super(key: key); + + /// org identifier. + /// final String orgId; @override @@ -75,6 +78,13 @@ class JoinOrganisationAfterAuth extends StatelessWidget { } /// scanQR returns a widget that is use in joining the organization via the QR code. + /// + /// **params**: + /// * `context`: Build context to perform context related operation + /// * `model`: Viewmodel + /// + /// **returns**: + /// None void scanQR(BuildContext context, SelectOrganizationViewModel model) { showModalBottomSheet( context: context, @@ -131,6 +141,14 @@ class JoinOrganisationAfterAuth extends StatelessWidget { ); } + /// To handle to qr. + /// + /// **params**: + /// * `controller`: Controller to manage qr activity + /// * `model`: Viewmodel + /// + /// **returns**: + /// None void _onQRViewCreated( QRViewController controller, SelectOrganizationViewModel model, diff --git a/lib/views/after_auth_screens/profile/profile_page.dart b/lib/views/after_auth_screens/profile/profile_page.dart index 12b2af1204..17225bb54c 100644 --- a/lib/views/after_auth_screens/profile/profile_page.dart +++ b/lib/views/after_auth_screens/profile/profile_page.dart @@ -20,6 +20,9 @@ class ProfilePage extends StatelessWidget { required Key key, this.homeModel, }) : super(key: key); + + /// MainScreenViewModel. + /// final MainScreenViewModel? homeModel; @override @@ -319,7 +322,14 @@ class ProfilePage extends StatelessWidget { ); } - // donate widget, this widget is used in donate custom tile. + /// donate widget, this widget is used in donate custom tile. + /// + /// **params**: + /// * `context`: Build context to perform context related operation + /// * `model`: Viewmodel + /// + /// **returns**: + /// None void donate(BuildContext context, ProfilePageViewModel model) { showModalBottomSheet( context: context, diff --git a/lib/views/pre_auth_screens/login.dart b/lib/views/pre_auth_screens/login.dart index 7383041a6b..2fc9b39fab 100644 --- a/lib/views/pre_auth_screens/login.dart +++ b/lib/views/pre_auth_screens/login.dart @@ -10,6 +10,7 @@ import 'package:talawa/widgets/raised_round_edge_button.dart'; import 'package:talawa/widgets/rich_text.dart'; /// This is the login widget. +/// /// There are two input fiels. The first one takes in the email and /// the second one takes in the password of the user. /// There is also a "Forgot Password" text button, which directs to diff --git a/lib/widgets/custom_avatar.dart b/lib/widgets/custom_avatar.dart index 3dc5768b33..0e329b0e64 100644 --- a/lib/widgets/custom_avatar.dart +++ b/lib/widgets/custom_avatar.dart @@ -4,6 +4,7 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:shimmer/shimmer.dart'; /// Creates a custom avatar. +/// /// The avatar is created using the image provided, /// or the first alphabet with a standard background color. class CustomAvatar extends StatelessWidget { @@ -16,11 +17,23 @@ class CustomAvatar extends StatelessWidget { this.fontSize = 40, this.maxRadius = 16, }) : super(key: key); + + /// Custom avatar data. final bool isImageNull; + + /// Custom avatar data. final String? firstAlphabet; + + /// Custom avatar data. final String? imageUrl; + + /// Custom avatar data. final double? fontSize; + + /// Custom avatar data. final double? maxRadius; + + /// Custom avatar data. final BaseCacheManager? cacheManager; @override diff --git a/lib/widgets/custom_list_tile.dart b/lib/widgets/custom_list_tile.dart index 5c856d6d39..fa1ff470b5 100644 --- a/lib/widgets/custom_list_tile.dart +++ b/lib/widgets/custom_list_tile.dart @@ -20,26 +20,33 @@ class CustomListTile extends StatelessWidget { this.onTapOption, this.option, }) : super(key: key); + /// Index int of tiles. -final int index; + final int index; + /// Tiletype object to specify tle type. -final TileType type; + final TileType type; /// Object containing all the necessary info regarding the org. -final OrgInfo? orgInfo; + final OrgInfo? orgInfo; + /// Object containing all the necessary info regarding the user. -final User? userInfo; + final User? userInfo; /// Object containing all the necessary info regarding the options. -final Options? option; + final Options? option; + /// Object containing all the necessary info regarding the onTapOption. -final Function? onTapOption; + final Function? onTapOption; + /// Function to handle the tap on user info. -final Function()? onTapUserInfo; + final Function()? onTapUserInfo; + /// Function to handle the tap on org info. -final Function(OrgInfo)? onTapOrgInfo; + final Function(OrgInfo)? onTapOrgInfo; + /// Flag to determine whether thge Icons should be shown. -final bool showIcon; + final bool showIcon; @override Widget build(BuildContext context) { diff --git a/lib/widgets/post_container.dart b/lib/widgets/post_container.dart index 0ceba3f5a8..4516e88789 100644 --- a/lib/widgets/post_container.dart +++ b/lib/widgets/post_container.dart @@ -3,11 +3,16 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:visibility_detector/visibility_detector.dart'; +/// the widget which contains the actual image. +/// class PostContainer extends StatefulWidget { const PostContainer({ Key? key, required this.photoUrl, }) : super(key: key); + + /// image url. + /// final String? photoUrl; @override @@ -15,7 +20,12 @@ class PostContainer extends StatefulWidget { } class PostContainerState extends State { + /// video was removed for mvp. + /// bool startedPlaying = false; + + /// same as above. + /// bool inView = true; @override @@ -29,7 +39,13 @@ class PostContainerState extends State { super.dispose(); } + /// manage the carousel. + /// + final PageController controller = PageController(initialPage: 0); + + /// to manage the image index in carousel. + /// int pindex = 0; @override Widget build(BuildContext context) { diff --git a/lib/widgets/post_detailed_page.dart b/lib/widgets/post_detailed_page.dart index 98d453757c..4e3fa64d7e 100644 --- a/lib/widgets/post_detailed_page.dart +++ b/lib/widgets/post_detailed_page.dart @@ -2,11 +2,15 @@ import 'package:flutter/material.dart'; import 'package:talawa/utils/app_localization.dart'; /// This class sets up the post page. +/// /// To implement the "show less" and "show more" functions for the text, /// we divide the text into two parts: firstHalf and secondHalf. A flag is set to /// track whether to display either the firstHalf or both(the entire text). class DescriptionTextWidget extends StatefulWidget { const DescriptionTextWidget({required this.text}); + + /// actual description to be displayed. + /// final String text; @override @@ -14,10 +18,20 @@ class DescriptionTextWidget extends StatefulWidget { } class _DescriptionTextWidgetState extends State { + /// before clicking show more. + /// + /// late String firstHalf; + + /// After the show more. + /// + /// late String secondHalf; //setting the flag to true initially + /// is show more turned on. + /// + /// bool flag = true; @override diff --git a/lib/widgets/post_list_widget.dart b/lib/widgets/post_list_widget.dart index e2112f1ef8..75adf47159 100644 --- a/lib/widgets/post_list_widget.dart +++ b/lib/widgets/post_list_widget.dart @@ -9,7 +9,14 @@ class PostListWidget extends StatelessWidget { required this.posts, this.function, }) : super(key: key); + + /// lis of all the post. + /// final List posts; + + /// This function is passed for the handling the action to be performed when the comment button is clicked. + /// + /// to see the function check the place where the widget is called. final Function(Post)? function; @override diff --git a/lib/widgets/video_widget.dart b/lib/widgets/video_widget.dart index 05a85dc72d..4afbf1fcd5 100644 --- a/lib/widgets/video_widget.dart +++ b/lib/widgets/video_widget.dart @@ -1,11 +1,20 @@ import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; +/// currently not part of MVP. +/// /// This class creates a video widget. class VideoWidget extends StatefulWidget { const VideoWidget({Key? key, required this.url, required this.play}) : super(key: key); + + /// a_line_ending_with_end_punctuation. + /// + /// more_info_if_required final String url; + + /// Is the video playing. + /// final bool play; @override @@ -17,6 +26,8 @@ class _VideoWidgetState extends State { late VideoPlayerController _controller; late Future _initializeVideoPlayerFuture; //setting the mute variable to true initially + /// Is the Video muted. + /// bool mute = true; @override @@ -55,10 +66,9 @@ class _VideoWidgetState extends State { } @override - - /// This function returns a GestureDetector for controlling the volume. - /// On tap, the volume is either set to 1 or 0 depending on the previous value. Widget build(BuildContext context) { + /// This function returns a GestureDetector for controlling the volume. + ///On tap, the volume is either set to 1 or 0 depending on the previous value. return FutureBuilder( future: _initializeVideoPlayerFuture, builder: (context, snapshot) { diff --git a/pubspec.lock b/pubspec.lock index a0a34283aa..1590f863c0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -274,7 +274,7 @@ packages: source: hosted version: "0.3.3+5" crypto: - dependency: transitive + dependency: "direct main" description: name: crypto sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab diff --git a/pubspec.yaml b/pubspec.yaml index 239975e012..1ed72c2ad9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,6 +25,7 @@ dependencies: connectivity_plus: ^4.0.2 contained_tab_bar_view: ^0.8.0 + crypto: any cupertino_icons: ^1.0.3 currency_picker: ^2.0.16 ############## Remove ########## @@ -61,8 +62,8 @@ dependencies: intl: ^0.18.0 json_annotation: ^4.7.0 mockito: ^5.4.2 - nock: ^1.2.3 network_image_mock: ^2.1.1 + nock: ^1.2.3 path_provider: ^2.1.1 permission_handler: ^11.0.0 plugin_platform_interface: ^2.1.6 diff --git a/test/view_model_tests/pre_auth_view_models/select_organization_view_model_test.dart b/test/view_model_tests/pre_auth_view_models/select_organization_view_model_test.dart index ca51eac385..e68acb87ed 100644 --- a/test/view_model_tests/pre_auth_view_models/select_organization_view_model_test.dart +++ b/test/view_model_tests/pre_auth_view_models/select_organization_view_model_test.dart @@ -763,7 +763,7 @@ void main() { expect(expected, { 'organizationsConnection': [ [1, 2], - [3, 4] + [3, 4], ], }); }); diff --git a/test/widget_tests/widgets/post_widget_test.dart b/test/widget_tests/widgets/post_widget_test.dart index 98596c108c..4fefe46ccd 100644 --- a/test/widget_tests/widgets/post_widget_test.dart +++ b/test/widget_tests/widgets/post_widget_test.dart @@ -59,7 +59,8 @@ Widget createPostContainerWidget() { home: const Scaffold( body: PostContainer( key: postContainerKey, - photoUrl: "https://dcblog.b-cdn.net/wp-content/uploads/2021/02/Full-form-of-URL-1-1024x824.jpg", + photoUrl: + "https://dcblog.b-cdn.net/wp-content/uploads/2021/02/Full-form-of-URL-1-1024x824.jpg", ), ), ); @@ -110,6 +111,7 @@ void main() { final column2Finder = columnFinder.at(2); final secondColumnWidget = tester.firstWidget(column2Finder) as Column; + print(secondColumnWidget); // final thirdPaddingWidget = secondColumnWidget.children[2] as Padding; // @@ -142,6 +144,7 @@ void main() { final column2Finder = columnFinder.at(2); final secondColumnWidget = tester.firstWidget(column2Finder) as Column; + print(secondColumnWidget); // final firstPaddingWidget = secondColumnWidget.children[0] as Padding; // final firstGestureDetectorFinder = find.descendant( // of: find.byWidget(firstPaddingWidget), @@ -344,7 +347,7 @@ void main() { expect( containerWidget.color, - null, + null, ); final postContainerFinder = find.descendant( @@ -373,7 +376,7 @@ void main() { final secondColumnWidget = tester.firstWidget(column2Finder) as Column; - + print(secondColumnWidget); // Testing if all direct children of column are there // expect(secondColumnWidget.children[0], isA()); // expect(secondColumnWidget.children[1], isA()); @@ -420,6 +423,7 @@ void main() { of: find.byWidget(firstPaddingWidget), matching: find.byType(GestureDetector), ); + print(firstGestureDetectorFinder); // final firstGestureDetectorWidget = tester // .firstWidget(firstGestureDetectorFinder) as GestureDetector; // expect(firstGestureDetectorWidget.onTap, isNotNull); @@ -440,6 +444,7 @@ void main() { of: find.byWidget(firstPaddingWidget), matching: find.byType(GestureDetector), ); + print(secondGestureDetectorFinder); // final secondGestureDetectorWidget = // tester.firstWidget(secondGestureDetectorFinder.last) // as GestureDetector; @@ -463,8 +468,7 @@ void main() { final column2Finder = columnFinder.at(2); final secondColumnWidget = tester.firstWidget(column2Finder) as Column; - final secondPaddingWidget = - secondColumnWidget.children[1] as Text; + final secondPaddingWidget = secondColumnWidget.children[1] as Text; print(secondPaddingWidget); }); }); @@ -480,7 +484,7 @@ void main() { final column2Finder = columnFinder.at(2); final secondColumnWidget = tester.firstWidget(column2Finder) as Column; - + print(secondColumnWidget); // final thirdPaddingWidget = // secondColumnWidget.children[2] as Padding; // expect(