diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 000000000..08e1985ae --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +language: "en-US" +early_access: false +reviews: + profile: "chill" + request_changes_workflow: true + high_level_summary: true + poem: true + review_status: true + collapse_walkthrough: false + auto_review: + enabled: true + drafts: false + base_branches: + - develop + - main +chat: + auto_reply: true diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 000000000..d9f95c0d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,36 @@ +--- +name: Bug Report +about: Create a report to help us improve. +title: Bug Report +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. +2. +3. +4. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Actual behavior** +A clear and concise description of how the code performed w.r.t expectations. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional details** +Add any other context or screenshots about the feature request here. + +**Potential internship candidates** + +Please read this if you are planning to apply for a Palisadoes Foundation internship +- https://github.com/PalisadoesFoundation/talawa/issues/359 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index ccbb9c4d8..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve. -title: Bug report -labels: Bug -assignees: "" ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: - -1. -2. -3. -4. - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Actual behavior** -A clear and concise description of how the code performed w.r.t expectations. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Additional details** diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 000000000..51aea0e9d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,28 @@ +--- +name: Feature Request +about: Suggest an idea for this project +title: Feature Request +labels: feature request +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Approach to be followed (optional)** +A clear and concise description of approach to be followed. + +**Additional context** +Add any other context or screenshots about the feature request here. + +**Potential internship candidates** + +Please read this if you are planning to apply for a Palisadoes Foundation internship +- https://github.com/PalisadoesFoundation/talawa/issues/359 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 1c93611c4..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: Feature request -labels: Feature -assignees: "" ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Approach to be followed (optional)** -A clear and concise description of approach to be followed. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 000000000..85ca88d0d --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,15 @@ +version: 2 +updates: + # Enable version updates for flutter's pub package manager + - package-ecosystem: "pub" + # Look for `pubspec.yaml` and `pubspec.lock` files in the `root` directory + directory: "/" + # Check the pub.dev registry for updates every day (weekdays) + schedule: + interval: "monthly" + target-branch: "develop-postgres" + # # Add default reviewers + # reviewers: + # - "palisadoes" + # - "randomUserName" + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b3f679554..2672715df 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,13 +1,40 @@ - + + + **What kind of change does this PR introduce?** +**Issue Number:** + +Fixes # + **Did you add tests for your changes?** + + +**Snapshots/Videos:** + + + **If relevant, did you update the documentation?** + + **Summary** @@ -18,3 +45,9 @@ **Other information** + + + +**Have you read the [contributing guide](https://github.com/PalisadoesFoundation/talawa/blob/master/CONTRIBUTING.md)?** + + diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 000000000..1e9a81eaf --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,47 @@ +# Talawa GitHub Workflows Guidelines + +Follow these guidelines when contributing to this directory. + +## General + +Any changes to files in this directory are flagged when pull requests are run. Make changes only on the advice of a contributor. + +## YAML Workflow Files + +The YAML files in this directory have very specific roles depending on the type of workflow. + +Whenever possible you must ensure that: +1. The file roles below are maintained +1. The sequence of the jobs in the workflows are maintained using [GitHub Action dependencies](https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows). + +### File Roles +Follow these guidelines when creating new YAML defined GitHub actions. This is done to make troubleshooting easier. + +1. `Issue` Workflows: + 1. Place all actions related to issues in the `issues.yml` file. +1. `Pull Request` workflows to be run by: + 1. Workflows to run **First Time** repo contributors: + 1. Place all actions related to to this in the `pull-request-target.yml` file. + 1. Workflows to be run by **ALL** repo contributors: + 1. Place all actions related to pull requests in the `pull-request.yml` file. +1. `Push` workflows: + 1. Place all actions related to pushes in the `push.yml` file. + +#### File Role Exceptions + +There are some exceptions to these rules in which jobs can be placed in dedicated separate files: +1. Jobs that require unique `cron:` schedules +1. Jobs that require unique `paths:` statements that operate only when files in a specific path are updated. +1. Jobs only work correctly if they have a dedicated file (eg. `CodeQL`) + +## Scripts + +Follow these guidelines when creating or modifying scripts in this directory. + +1. All scripts in this directory must be written in python3 for consistency. +1. The python3 scripts must follow the following coding standards. Run these commands against your scripts before submitting PRs that modify or create python3 scripts in this directory. + 1. Pycodestyle + 1. Pydocstyle + 1. Pylint + 1. Flake8 +1. All scripts must run a main() function. diff --git a/.github/workflows/check_ignore.py b/.github/workflows/check_ignore.py new file mode 100755 index 000000000..a8679b601 --- /dev/null +++ b/.github/workflows/check_ignore.py @@ -0,0 +1,192 @@ +#! /usr/bin/python3.10 + +import argparse +import os +import subprocess +import sys + +def _arg_parser_resolver(): + """Resolve the CLI arguments provided by the user. + + Args: + None + + Returns: + result: Parsed argument object + + """ + # Initialize parser and add the CLI options we should expect + parser = argparse.ArgumentParser() + + # Getting merge branch name + parser.add_argument( + '--merge_branch_name', type=str, required=True, + help='Name of the merging to branch') + + # Github repository + parser.add_argument( + '--repository', type=str, required=True, + help='Name of the GitHub repository in the format "/"') + + # Getting root directory of repository + parser.add_argument( + '--directory', type=str, required=False, + default=os.getcwd(), + help='The parent directory of files to analyze.') + + # Return parser + return parser.parse_args() + + +def _filepaths_in_directories(directories): + """Create a list of full file paths based on input directories. + + Args: + directories: A list of directories + + Returns: + result: A list of full file paths + + """ + # Initialize key variables + result = [] + + # Iterate and analyze each directory + for directory in directories: + for root, _, files in os.walk(directory, topdown=False): + for name in files: + # Read each file and count the lines found + result.append(os.path.join(root, name)) + # Return + return result + + +def _check_for_ignore_directive(filePath): + """Analyzes a given file and checks for presence of ignore directive corresponding + to any of the custom lint rules. + + A valid ignore directive consists of exactly 3 parts. + + - `//...`: where `...` represents that `/` can occur any number of times > 2. + - `ignore:` or `ignore_for_file:`: The part that distinguishes a normal comment from a + ignore directive. + - `name_of_lint_rule`: The rule that it is ignoring. + + These 3 parts may or may not have whitespace between them, but should strictly not have + any extra character. So + + - `//ignore:my_lint`, `/////ignore:my_lint`, `//ignore: my_lint` etc are all valid + ignore directives. + - `// / ignore: my_lint`, `// sdf ignore: my_lint` etc are all invalid ones. + + Args: + Path of the file to analyze + + Returns: + boolean: Whether the file contains ignore directive or not. + + """ + + # Either it is a non-code file, or the file does not exist. This can happen when + # `develop` gets ahead of your branch and has some files which you don't have + + if (not filePath.startswith('lib') or not filePath.endswith('.dart') or not os.path.exists(filePath)): + return False + + with open(filePath, "r") as file: + lines = file.readlines() + + for index, line in enumerate(lines): + # Remove any leading or trailing whitespace + content = line.strip() + + # If the line is empty or is a documentation (`///`) + if (content.endswith('/') or content == ''): + continue + + # Points to the character just after '/' ends. + # This is required because '/' can occur many times. + non_comment_pos = 0 + + while content[non_comment_pos] == '/': + non_comment_pos += 1 + + # Remove whitespace from non '/' part and split to whitespace + content = (content[non_comment_pos:].strip()).split(' ') + + # filter out empty strings, which happen because of 'sdf sdf' + # .split(' ') adds these whitespaces to the token list too. + content = [token for token in content if token != ''] + + # if somehow we still ended up with whitespaces. + if (len(content) == 0): + break + + # After removing the '/'s, only two possibilities remain + # 1. The `ignore...:` and `lint_rule_name` have no whitespace between them + # 2. They have some whitespace(s) between them + + if ((len(content) == 1 and + (content[0] == 'ignore_for_file:talawa_api_doc' + or content[0] == 'ignore:talawa_api_doc' + or content[0] == 'ignore_for_file:talawa_good_doc_comments' + or content[0] == 'ignore:talawa_good_doc_comments')) + or (len(content) == 2 and + ((content[0] == 'ignore_for_file:' and content[1] == 'talawa_api_doc') + or (content[0] == 'ignore:' and content[1] == 'talawa_api_doc') + or (content[0] == 'ignore_for_file:' and content[1] == 'talawa_good_doc_comments') + or (content[0] == 'ignore:' and content[1] == 'talawa_good_doc_comments')))): + + print(("Ignore directive found at line {}, which suppresses a custom lint rule.\n" + "Please remove this suppression and add valid documentation for the respective field(s).").format(index)) + + return True + + return False + + +def main(): + """Analyze dart files for custom lint rule suppression. + + Analyzes and prints the files that contain suppression for any custom + lint rule + + Returns: + None + + """ + + print(subprocess.check_output(['git', 'branch']).decode('utf-8').strip('\n')) + + current_branch = subprocess.check_output(['git', 'branch', '--show-current']).decode('utf-8').strip('\n') + print(current_branch) + changed_files = subprocess.check_output(['git', 'diff', '--name-only', 'develop', current_branch]).decode('utf-8').splitlines() + print(changed_files) + + + args = _arg_parser_resolver() + + # List of files where ignore directive is found + err = [] + + # Iterate and analyze each directory + for filepath in changed_files: + if _check_for_ignore_directive(filepath): + err.append(filepath) + + # If no changed/modified contains ignore directive for any custom lint rule + if len(err) == 0: + print( + '''🚀 {} Hurrah! No ignore directive found in any modified/added file(s)'''.format('\033[92m')) + sys.exit(0) + else: + print( + '''🔍 {}Ignore directive for custom lint rule found. Please remove them and add valid documentation.'''.format( + '\033[91m')) + for failing_file in err: + print('''>>> File name: {}\n'''.format(failing_file)) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/.github/workflows/compare_translations.py b/.github/workflows/compare_translations.py new file mode 100644 index 000000000..d8c0aff79 --- /dev/null +++ b/.github/workflows/compare_translations.py @@ -0,0 +1,168 @@ +""" +Script to encourage more efficient coding practices. + +Methodology: + + Utility for comparing translations between default and other languages. + + This module defines a function to compare two translations + and print any missing keys in the other language's translation. +Attributes: + + FileTranslation : Named tuple to represent a combination of file and missing translations. + + Fields: + - file (str): The file name. + - missing_translations (list): List of missing translations. + +Functions: + compare_translations(default_translation, other_translation): + Compare two translations and print missing keys. + + load_translation(filepath): + Load translation from a file. + + check_translations(): + Load the default translation and compare it with other translations. + + main(): + The main function to run the script. + Parses command-line arguments, checks for the existence of the specified directory, + and then calls check_translations with the provided or default directory. + + +Usage: + This script can be executed to check and print missing + translations in other languages based on the default English translation. + +Example: + python compare_translations.py +NOTE: + This script complies with our python3 coding and documentation standards + and should be used as a reference guide. It complies with: + + 1) Pylint + 2) Pydocstyle + 3) Pycodestyle + 4) Flake8 + +""" +# standard imports +import argparse +import json +import os +import sys +from collections import namedtuple + +# Named tuple for file and missing translations combination +FileTranslation = namedtuple("FileTranslation", ["file", "missing_translations"]) + + +def compare_translations(default_translation, other_translation, default_file, other_file): + """Compare two translations and return detailed info about missing/mismatched keys. + + Args: + default_translation (dict): The default translation (en.json). + other_translation (dict): The other language translation. + default_file (str): The name of the default translation file. + other_file (str): The name of the other translation file. + + Returns: + list: A list of detailed error messages for each missing/mismatched key. + """ + errors = [] + + # Check for missing keys in other_translation + for key in default_translation: + if key not in other_translation: + error_msg = f"Missing Key: '{key}' - This key from '{default_file}' is missing in '{other_file}'." + errors.append(error_msg) + + # Check for keys in other_translation that don't match any in default_translation + for key in other_translation: + if key not in default_translation: + error_msg = f"Error Key: '{key}' - This key in '{other_file}' does not match any key in '{default_file}'." + errors.append(error_msg) + + return errors + + + + +def load_translation(filepath): + """Load translation from a file. + + Args: + filepath: Path to the translation file + + Returns: + translation: Loaded translation + """ + with open(filepath, "r", encoding="utf-8") as file: + translation = json.load(file) + return translation + + + +def check_translations(directory): + """Load default translation and compare with other translations. + + Args: + directory (str): The directory containing translation files. + + Returns: + None + """ + default_file = "en.json" + default_translation = load_translation(os.path.join(directory, default_file)) + translations = os.listdir(directory) + translations.remove(default_file) # Exclude default translation + + error_found = False + + for translation_file in translations: + other_file = os.path.join(directory, translation_file) + other_translation = load_translation(other_file) + + # Compare translations and get detailed error messages + errors = compare_translations(default_translation, other_translation, default_file, translation_file) + if errors: + error_found = True + print(f"File {translation_file} has missing translations for:") + for error in errors: + print(f" - {error}") + + if error_found: + sys.exit(1) # Exit with an error status code + else: + print("All translations are present") + sys.exit(0) + + +def main(): + """ + Parse command-line arguments, check for the existence of the specified directory, + and call check_translations with the provided or default directory. + + """ + parser = argparse.ArgumentParser( + description="Check and print missing translations for all non-default languages." + ) + parser.add_argument( + "--directory", + type=str, + nargs="?", + default=os.path.join(os.getcwd(), "lang"), + help="Directory containing translation files(relative to the root directory).", + ) + args = parser.parse_args() + + if not os.path.exists(args.directory): + print(f"Error: The specified directory '{args.directory}' does not exist.") + sys.exit(1) + + check_translations(args.directory) + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/countline.py b/.github/workflows/countline.py new file mode 100755 index 000000000..d0b03c503 --- /dev/null +++ b/.github/workflows/countline.py @@ -0,0 +1,297 @@ +#!/usr/bin/env python3 +# -*- coding: UTF-8 -*- +"""Script to encourage more efficient coding practices. + +Methodology: + + Analyses the `lib` and `test` directories to find files that exceed a + pre-defined number of lines of code. + + This script was created to help improve code quality by encouraging + contributors to create reusable code. + +NOTE: + + This script complies with our python3 coding and documentation standards + and should be used as a reference guide. It complies with: + + 1) Pylint + 2) Pydocstyle + 3) Pycodestyle + 4) Flake8 + + Run these commands from the CLI to ensure the code is compliant for all + your pull requests. + +""" + +# Standard imports +import os +import sys +import argparse +from collections import namedtuple + + +def _valid_filename(filepath): + """Determine whether filepath has the correct filename. + + Args: + filepath: Filepath to check + + Returns: + result: True if valid + + """ + # Initialize key variables + invalid_filenames = [".test.", ".spec."] + result = True + + # Test + for invalid_filename in invalid_filenames: + if invalid_filename.lower() not in filepath.lower(): + continue + result = False + + return result + + +def _valid_extension(filepath): + """Determine whether filepath has the correct extension. + + Args: + filepath: Filepath to check + + Returns: + result: True if valid + + """ + # Initialize key variables + invalid_extensions = [".css", ".jpg", ".png", ".jpeg"] + result = True + + # Test + for invalid_extension in invalid_extensions: + if filepath.lower().endswith(invalid_extension.lower()) is False: + continue + result = False + + return result + + +def _valid_exclusions(excludes): + """Create a list of full file paths to exclude from the analysis. + + Args: + excludes: Excludes object + + Returns: + result: A list of full file paths + + """ + # Initialize key variables + result = [] + filenames = [] + more_filenames = [] + + # Create a list of files to ignore + if bool(excludes.files): + filenames = excludes.files + if bool(excludes.directories): + more_filenames = _filepaths_in_directories(excludes.directories) + filenames.extend(more_filenames) + + # Remove duplicates + filenames = list(set(filenames)) + + # Process files + for filename in filenames: + # Ignore files that appear to be full paths because they start + # with a '/' or whatever the OS uses to distinguish directories + if filename.startswith(os.sep): + continue + + # Create a file path + filepath = "{}{}{}".format(os.getcwd(), os.sep, filename) + if os.path.isfile(filepath) is True: + result.append(filepath) + + # Return + return result + + +def _filepaths_in_directories(directories): + """Create a list of full file paths based on input directories. + + Args: + directories: A list of directories + + Returns: + result: A list of full file paths + + """ + # Initialize key variables + result = [] + + # Iterate and analyze each directory + for directory in directories: + for root, _, files in os.walk(directory, topdown=False): + for name in files: + # Read each file and count the lines found + result.append(os.path.join(root, name)) + # Return + return result + + +def _arg_parser_resolver(): + """Resolve the CLI arguments provided by the user. + + Args: + None + + Returns: + result: Parsed argument object + + """ + # Initialize parser and add the CLI options we should expect + parser = argparse.ArgumentParser() + parser.add_argument( + "--lines", + type=int, + required=False, + default=300, + help="The maximum number of lines of code to accept.", + ) + parser.add_argument( + "--directory", + type=str, + required=False, + default=os.getcwd(), + help="The parent directory of files to analyze.", + ) + parser.add_argument( + "--exclude_files", + type=str, + required=False, + nargs="*", + default=None, + const=None, + help="""An optional space separated list of \ +files to exclude from the analysis.""", + ) + parser.add_argument( + "--exclude_directories", + type=str, + required=False, + nargs="*", + default=None, + const=None, + help="""An optional space separated list of \ +directories to exclude from the analysis.""", + ) + + # Return parser + result = parser.parse_args() + return result + + +def main(): + """Analyze dart files. + + This function finds, and prints the files that exceed the CLI + defined defaults. + + Args: + None + + Returns: + None + + """ + # Initialize key variables + lookup = {} + errors_found = False + file_count = 0 + Excludes = namedtuple("Excludes", "files directories") + + # Get the CLI arguments + args = _arg_parser_resolver() + + # Define the directories of interest + directories = [ + os.path.expanduser(os.path.join(args.directory, "lib")), + os.path.expanduser(os.path.join(args.directory, "src")), + os.path.expanduser(os.path.join(args.directory, "test")), + ] + + # Get a corrected list of filenames to exclude + exclude_list = _valid_exclusions( + Excludes( + files=args.exclude_files, directories=args.exclude_directories + ) + ) + + # Get interesting filepaths + repo_filepath_list = _filepaths_in_directories(directories) + + # Iterate and analyze each directory + for filepath in repo_filepath_list: + # Skip excluded files + if filepath in exclude_list: + continue + + # Skip /node_modules/ sub directories + if "{0}node_modules{0}".format(os.sep) in filepath: + continue + + # Ignore invalid file extensions + if _valid_extension(filepath) is False: + continue + + # Ignore invalid file filenames + if _valid_filename(filepath) is False: + continue + + # Process the rest + with open(filepath, encoding="latin-1") as code: + line_count = sum( + 1 + for line in code + if line.strip() + and not ( + line.strip().startswith("#") + or line.strip().startswith("/") + ) + ) + lookup[filepath] = line_count + + # If the line rule is voilated then the value is changed to 1 + for filepath, line_count in lookup.items(): + if line_count > args.lines: + errors_found = True + file_count += 1 + if file_count == 1: + print( + """ +LINE COUNT ERROR: Files with excessive lines of code have been found\n""" + ) + + print(" Line count: {:>5} File: {}".format(line_count, filepath)) + + # Evaluate and exit + if bool(errors_found) is True: + print( + """ +The {} files listed above have more than {} lines of code. + +Please fix this. It is a pre-requisite for pull request approval. +""".format( + file_count, args.lines + ) + ) + sys.exit(1) + else: + sys.exit(0) + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/countline.sh b/.github/workflows/countline.sh deleted file mode 100755 index a8282567a..000000000 --- a/.github/workflows/countline.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -maxLine=$1; - -# Listing of Files which have more line of code that maxLine -# if you need to exclude files or directory use this ':!:' -# Please have a look at this if you have doubt https://stackoverflow.com/questions/36753573/how-do-i-exclude-files-from-git-ls-files -files=$(git ls-files '*.dart' ':!:lib/services/*.dart' | xargs wc -l | awk -v max=$maxLine '$1 > max' | sed '$d' | sort -rn) - -# No. of Files which have more line of code that maxLine -no_of_files=$(git ls-files '*.dart' ':!:lib/services/*.dart' | xargs wc -l | awk -v max=$maxLine '$1 > max' | sed '$d' | wc -l | sort -rn) - -# Checking if no_of_files is 0 -if [[ "$no_of_files" -eq 0 ]] - then - exit 0 - else - echo "Below $no_of_files files have more than $maxLine lines" - echo "Lines Path" - echo "$files" - exit 1 -fi - diff --git a/.github/workflows/countlines.yml b/.github/workflows/countlines.yml deleted file mode 100644 index 6ad6c6d3a..000000000 --- a/.github/workflows/countlines.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Count Lines -on: [pull_request] - -jobs: - count-lines-of-code: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - # Making the Script File excutable - - run: chmod +x ./.github/workflows/countline.sh - - # Running the Script File with max no. of lines limit - - run: ./.github/workflows/countline.sh 300 \ No newline at end of file diff --git a/.github/workflows/documentationcheck.py b/.github/workflows/documentationcheck.py new file mode 100755 index 000000000..7bac9592d --- /dev/null +++ b/.github/workflows/documentationcheck.py @@ -0,0 +1,186 @@ +"""Script to encourage documentation addition of changes incurred + +Methodology: + + Getting latest commit from merging branch and feature branch + Getting all differences in files under lib directory + Checking if documentation status is missing, not_updated or updated + + This script is to help better document the functionality + +NOTE: + + This script complies with our python3 coding and documentation standards + and should be used as a reference guide. It complies with: + + 1) Pylint + 2) Pydocstyle + 3) Pycodestyle + 4) Flake8 + + Run these commands from the CLI to ensure the code is compliant for all + your pull requests. +""" + +# Standard imports +import argparse +import os +import sys + +import git +import enum + + +class DocumentationStatus(enum.Enum): + unknown = 0 + updated = 1 + not_updated = 2 + missing = 3 + + +def _arg_parser_resolver(): + """Resolve the CLI arguments provided by the user. + + Args: + None + + Returns: + result: Parsed argument object + + """ + # Initialize parser and add the CLI options we should expect + parser = argparse.ArgumentParser() + # getting merge branch name + parser.add_argument( + '--merge_branch_name', type=str, required=True, + help='Name of the merging to branch') + # Github repository + parser.add_argument( + '--repository', type=str, required=True, + help='Name of the GitHub repository in the format "/"') + # getting root directory of repository + parser.add_argument( + '--directory', type=str, required=False, + default=os.getcwd(), + help='The parent directory of files to analyze.') + # Return parser + result = parser.parse_args() + return result + + +def check_for_documentation(diff_item): + """Determine the documentation status + + Args: + diff_item: Diff to check + + Returns: + doc_status: DocumentationStatus + + """ + # Extracting the changes made + file_diffs = diff_item.diff.decode("utf-8") + # Setting documentation status flag to unknown + doc_status = DocumentationStatus.unknown + # Splitting the changes for line by line iteration + lines = file_diffs.split('\n') + # Setting updated doc line count + edited_doc_line_count = 0 + # Looping over differences + for line in lines: + # checking if the line was updated and contains documentation + if line.strip() and line.startswith('+') and line.__contains__('///'): + # updating the flag by one + edited_doc_line_count += 1 + # Checking if no doc was changed + if edited_doc_line_count == 0: + # Setting the flag to not_updated + doc_status = DocumentationStatus.not_updated + + # Reading complete file to check if not documentation exist + # Reading the complete file + file = diff_item.b_blob.data_stream.read().decode('utf-8') + # Splitting the line to check if documentation is present or not + lines = file.split('\n') + # Setting the documentation line count flag + doc_lines = 0 + # Looping over the file lines + for line in lines: + # Checking if the line contains any documentation or not + if line.strip() and line.__contains__('///'): + # updating the flag by 1 + doc_lines += 1 + # Checking if the documentation lines were present or not + if doc_lines == 0: + # Updating the flag to missing + doc_status = DocumentationStatus.missing + # Checking if the doc was updated + elif edited_doc_line_count > 0: + # Setting the flag to documentation updated + doc_status = DocumentationStatus.updated + # return the file documentation status + return doc_status + + +def main(): + """Analyze dart files. + + This function finds, and prints the files that exceed the CLI + defined defaults. + + Returns: + None + + """ + # Parsing the command line arguments + args = _arg_parser_resolver() + # Getting the git repo + repo_feature = git.Repo(args.directory) + (_, repository_directory) = args.repository.split("/") + repo_merge = git.Repo.clone_from("https://github.com/{}.git".format(args.repository), "{}/{}".format(args.directory, repository_directory)) + + # Do nothing if the branch has a "/" in it + if '/' in args.merge_branch_name: + return + + # Getting latest commit on latest branch + commit_dev = repo_merge.commit(args.merge_branch_name) + # Getting latest commit on feature branch + feature_commit = repo_feature.commit() + # Loading differences between the two commits + diff_index = commit_dev.diff(feature_commit, create_patch=True) + # Setting a flag to keep record of files and their documentation + lookup = {} + # Lopping over differences in modified files + for diff_item in diff_index.iter_change_type('M'): + # Getting file path of difference + file_path = diff_item.b_path + # Checking if a file under codebase(lib) directory was modified + if file_path.startswith('lib'): + # Getting file documentation status + lookup[file_path] = check_for_documentation(diff_item) + # Lopping over differences in added files + for diff_item in diff_index.iter_change_type('A'): + # Getting file path of difference + file_path = diff_item.b_path + # Checking if a file under codebase(lib) directory was added + if file_path.startswith('lib'): + # Getting file documentation status + lookup[file_path] = check_for_documentation(diff_item) + # Filtering files whose documentation status != updated + filtered_lookup = {k: v for (k, v) in lookup.items() if DocumentationStatus.updated != v} + # Checking if documentation was updated for all changed files + if len(filtered_lookup) == 0: + print('''🚀 {} Hurrah! documentation was updated in all modified/added files'''.format('\033[92m')) + sys.exit(0) + else: + print( + '''🔍 {}DOCUMENTATION NOT UPDATED: Files with missing or not updated DartDoc documentation found'''.format( + '\033[91m')) + for failing_file in filtered_lookup: + print('''>>> File name: {}\n\t{}\n'''.format(failing_file, filtered_lookup[failing_file])) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml deleted file mode 100644 index d8773df26..000000000 --- a/.github/workflows/greetings.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Greetings - -on: [pull_request, issues] - -jobs: - greeting: - runs-on: ubuntu-latest - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "Congratulations on making your first Issue! :confetti_ball: If you haven't already, check out our [Contributing Guidelines](https://github.com/PalisadoesFoundation/talawa/blob/master/CONTRIBUTING.md) and [Issue Reporting Guidelines](https://github.com/PalisadoesFoundation/talawa/blob/master/issue-guidelines.md) to ensure that you are following our guidelines for contributing and making issues." diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml deleted file mode 100644 index 6104d8fc3..000000000 --- a/.github/workflows/issue.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Issue Auto label -on: - issues: - types: ['opened'] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: Renato66/auto-label@v2.2.0 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - ignore-comments: true - default-labels: '["unapproved"]' \ No newline at end of file diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml new file mode 100644 index 000000000..ed8521f23 --- /dev/null +++ b/.github/workflows/issues.yml @@ -0,0 +1,34 @@ +############################################################################## +############################################################################## +# +# NOTE! +# +# Please read the README.md file in this directory that defines what should +# be placed in this file +# +############################################################################## +############################################################################## + +name: Issues Workflow +on: + issues: + types: ['opened'] +jobs: + Opened-issue-label: + name: Adding Issue Label + runs-on: ubuntu-latest + steps: + - uses: Renato66/auto-label@v2.3.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + ignore-comments: true + default-labels: '["unapproved"]' + + Issue-Greeting: + name: Greeting Message to User + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Congratulations on making your first Issue! :confetti_ball: If you haven't already, check out our [Contributing Guidelines](https://github.com/PalisadoesFoundation/talawa/blob/develop/CONTRIBUTING.md) and [Issue Reporting Guidelines](https://github.com/PalisadoesFoundation/talawa/blob/develop/ISSUE_GUIDELINES.md) to ensure that you are following our guidelines for contributing and making issues." diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 79a567538..000000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Lint Code Base -on: [pull_request] - -jobs: - package-analysis: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: axel-op/dart-package-analyzer@v3 - with: - # Required: - githubToken: ${{ secrets.GITHUB_TOKEN }} - - uses: subosito/flutter-action@v1 - with: - channel: 'beta' - - - run: flutter format --set-exit-if-changed . \ No newline at end of file diff --git a/.github/workflows/pull-request-target.yml b/.github/workflows/pull-request-target.yml new file mode 100644 index 000000000..3868f5a2f --- /dev/null +++ b/.github/workflows/pull-request-target.yml @@ -0,0 +1,69 @@ +############################################################################## +############################################################################## +# +# NOTE! +# +# Please read the README.md file in this directory that defines what should +# be placed in this file +# +############################################################################## +############################################################################## + +name: PR Target Workflow +on: + pull_request_target: + +jobs: + PR-Greeting: + name: Pull Request Target + runs-on: ubuntu-latest + steps: + - name: Add the PR Review Policy + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: pr_review_policy + message: | + ## Our Pull Request Approval Process + + Thanks for contributing! + + ### Testing Your Code + + Remember, your PRs won't be reviewed until these criteria are met: + + 1. We don't merge PRs with poor code quality. + 1. Follow coding best practices such that CodeRabbit.ai approves your PR. + 1. We don't merge PRs with failed tests. + 1. When tests fail, click on the `Details` link to learn more. + 1. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository + 1. Tests may fail if you edit sensitive files. Ask to add the `ignore-sensitive-files-pr` label if the edits are necessary. + 1. We cannot merge PRs with conflicting files. These must be fixed. + + Our policies make our code better. + + ### Reviewers + + Do not assign reviewers. Our Queue Monitors will review your PR and assign them. + When your PR has been assigned reviewers contact them to get your code reviewed and approved via: + + 1. comments in this PR or + 1. our slack channel + + #### Reviewing Your Code + + Your reviewer(s) will have the following roles: + + 1. arbitrators of future discussions with other contributors about the validity of your changes + 2. point of contact for evaluating the validity of your work + 3. person who verifies matching issues by others that should be closed. + 4. person who gives general guidance in fixing your tests + + ## Other + + :dart: Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise. + + - name: Greeting Message to User + uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + pr-message: "Congratulations on making your first PR! :confetti_ball: If you haven't already, check out our [Contributing Guidelines](https://github.com/PalisadoesFoundation/talawa/blob/develop/CONTRIBUTING.md) and [PR Reporting Guidelines](https://github.com/PalisadoesFoundation/talawa/blob/develop/PR_GUIDELINES.md) to ensure that you are following our guidelines for contributing and creating PR." diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..be05c8718 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,260 @@ +############################################################################## +############################################################################## +# +# NOTE! +# +# Please read the README.md file in this directory that defines what should +# be placed in this file +# +############################################################################## +############################################################################## + +name: PR Workflow +on: + pull_request: + branches-ignore: + - "master" + +env: + CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }} + +jobs: + Flutter-Codebase-Check: + name: Checking codebase + runs-on: ubuntu-latest + #needs: PR-Greeting + steps: + - uses: actions/checkout@v4 + with: + # ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - uses: actions/setup-java@v3 + with: + distribution: "zulu" # See 'Supported distributions' for available options + java-version: "12.0" + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.3" + channel: "stable" # or: 'beta', 'dev' or 'master' + - name: Set default branch. + run: git remote set-head origin --auto + shell: bash + - name: Running pub get in talawa_lint + run: cd talawa_lint && flutter pub get && cd .. + - name: Running pub get to fetch dependencies + run: flutter pub get + - name: Checking for correct formatting of code + run: dart format --set-exit-if-changed . + - name: Count lines of code in each file + run: chmod +x ./.github/workflows/countline.py + - name: Running count lines + run: ./.github/workflows/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart lib/views/after_auth_screens/org_info_screen.dart lib/views/after_auth_screens/events/manage_volunteer_group.dart lib/views/after_auth_screens/events/create_agenda_item_page.dart lib/views/after_auth_screens/events/edit_agenda_item_page.dart lib/utils/event_queries.dart + - name: setup python + uses: actions/setup-python@v5 + - name: Check for presence of ignore directives corresponding to custom lints + run: chmod +x ./.github/workflows/check_ignore.py + - name: Run check_ignore + run: | + git branch + git checkout -b temp_branch + git branch + git stash push -m lock_file pubspec.lock + git checkout develop + git pull + git branch + git diff --name-only develop..HEAD + git checkout temp_branch + pip install GitPython + python ./.github/workflows/check_ignore.py --repository ${{github.repository}} --merge_branch_name ${{github.head_ref}} + - name: Compare translation files + run: | + chmod +x .github/workflows/compare_translations.py + python .github/workflows/compare_translations.py --directory lang + + - name: Analysing codebase for default linting + run: flutter analyze --no-pub + - name: Analysing codebase for custom linting + run: dart run custom_lint + - name: Changed Files + id: changed-files + uses: tj-actions/changed-files@v41 + - name: List all changed files + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "$file was changed" + done + + - name: Check if the source and target branches are different + if: ${{ github.event.pull_request.base.ref == github.event.pull_request.head.ref }} + run: | + echo "Source Branch ${{ github.event.pull_request.head.ref }}" + echo "Target Branch ${{ github.event.pull_request.base.ref }}" + echo "Error: Source and Target Branches are the same. Please ensure they are different." + exit 1 + + # - name: Echo the GitHub environment for troubleshooting + # run: echo "$GITHUB_CONTEXT" + # - name: Echo the GitHub context for troubleshooting + # run: echo "${{ toJSON(github) }}" + # - name: setup python + # uses: actions/setup-python@v5 + # - name: Granting permission to documentationcheck.py + # run: chmod +x ./.github/workflows/documentationcheck.py + # - name: execute py script + # # For more information on the GitHub context used for the "--repository" flag used by this script visit: + # # https://docs.github.com/en/actions/learn-github-actions/contexts + # run: | + # git branch + # pip install GitPython + # python ./.github/workflows/documentationcheck.py --repository ${{github.repository}} --merge_branch_name ${{github.ref_name}} + + Flutter-Testing: + name: Testing codebase + runs-on: ubuntu-latest + needs: Flutter-Codebase-Check + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + distribution: "zulu" # See 'Supported distributions' for available options + java-version: "12.0" + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.3" + channel: "stable" # or: 'beta', 'dev' or 'master' + - name: Running pub get to fetch dependencies + run: flutter pub get + - name: Codebase testing + run: flutter test --coverage + - name: Present and upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}} + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false + name: "${{env.CODECOV_UNIQUE_NAME}}" + - name: Test acceptable level of code coverage + uses: VeryGoodOpenSource/very_good_coverage@v2 + with: + path: "./coverage/lcov.info" + min_coverage: 92.0 + + Android-Build: + name: Testing build for android + runs-on: ubuntu-latest + needs: Flutter-Codebase-Check + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + distribution: "zulu" # See 'Supported distributions' for available options + java-version: "12.0" + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.3" + channel: "stable" # or: 'beta', 'dev' or 'master' + - name: Running pub get to fetch dependencies + run: flutter pub get + - name: Building for android + run: flutter build apk + + iOS-Build: + name: Testing build for iOS + runs-on: macos-latest + needs: Flutter-Codebase-Check + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.3" + channel: "stable" # or: 'beta', 'dev' or 'master' + architecture: x64 + - name: Building for ios + run: flutter build ios --release --no-codesign + + Branch-check: + if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} + name: "Base branch check" + runs-on: ubuntu-latest + steps: + - name: "Check if base branch is develop" + if: github.event.pull_request.base.ref != 'develop' + run: | + echo "PR is not against develop branch. Please refer PR_GUIDELINES.md" + exit 1 + + Check-Sensitive-Files: + if: ${{ github.actor != 'dependabot[bot]' }} + name: Checks if sensitive files have been changed without authorization + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get Changed Unauthorized files + id: changed-unauth-files + uses: tj-actions/changed-files@v40 + with: + files: | + .github/** + env.example + .node-version + .husky/** + scripts/** + package.json + tsconfig.json + .gitignore + .eslintrc.json + .eslintignore + vite.config.ts + docker-compose.yaml + Dockerfile + CODEOWNERS + LICENSE + setup.ts + .coderabbit.yaml + CODE_OF_CONDUCT.md + CONTRIBUTING.md + DOCUMENTATION.md + INSTALLATION.md + ISSUE_GUIDELINES.md + PR_GUIDELINES.md + README.md + + - name: List all changed unauthorized files + if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' + env: + CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} + run: | + for file in ${CHANGED_UNAUTH_FILES}; do + echo "$file is unauthorized to change/delete" + done + exit 1 + + Count-Changed-Files: + if: ${{ github.actor != 'dependabot[bot]' }} + name: Checks if number of files changed is acceptable + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v40 + + - name: Echo number of changed files + env: + CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} + run: | + echo "Number of files changed: $CHANGED_FILES_COUNT" + - name: Check if the number of changed files is less than 100 + if: steps.changed-files.outputs.all_changed_files_count > 100 + env: + CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} + run: | + echo "Error: Too many files (greater than 100) changed in the pull request." + echo "Possible issues:" + echo "- Contributor may be merging into an incorrect branch." + echo "- Source branch may be incorrect please use develop as source branch." + exit 1 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 000000000..a48b221fa --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,184 @@ +############################################################################## +############################################################################## +# +# NOTE! +# +# Please read the README.md file in this directory that defines what should +# be placed in this file +# +############################################################################## +############################################################################## + +name: PUSH Workflow +on: + push: + # branches: + # - develop + + branches-ignore: + - 'master' + + tags: + - "*" + +env: + CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }} + +jobs: + + Flutter-Codebase-Check: + if: ${{ github.actor != 'dependabot[bot]' }} + name: Checking Codebase + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # This is important to fetch all history for all branches and tags. + # This could be important for our documentation generation process. + # See: https://github.com/actions/checkout + fetch-depth: 0 + - uses: actions/setup-java@v3 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '12.0' + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.22.3' + channel: 'stable' # or: 'beta', 'dev' or 'master' + - name: Running pub get in talawa_lint + run: cd talawa_lint && flutter pub get && cd .. + - name: Running pub get to fetch dependencies + run: flutter pub get + - name: Checking for correct formatting of code + run: dart format --set-exit-if-changed . + - name: setup python + uses: actions/setup-python@v5 + - name: Check for presence of ignore directives corresponding to custom lints + run: chmod +x ./.github/workflows/check_ignore.py + - name: Run check_ignore + run: | + git branch + git checkout develop + git pull + git branch + git checkout - + pip install GitPython + python ./.github/workflows/check_ignore.py --repository ${{github.repository}} --merge_branch_name ${{github.ref_name}} + - name: Analysing codebase for default linting + run: flutter analyze --no-pub + - name: Analysing codebase for custom linting + run: dart run custom_lint +# - name: Echo the GitHub environment for troubleshooting +# run: echo "$GITHUB_CONTEXT" +# - name: Echo the GitHub context for troubleshooting +# run: echo "${{ toJSON(github) }}" + + + Flutter-Testing: + if: ${{ github.actor != 'dependabot[bot]' }} + name: Testing codebase + runs-on: ubuntu-latest + needs: Flutter-Codebase-Check + # needs: Update-Documentation + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '12.0' + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.22.3' + channel: 'stable' # or: 'beta', 'dev' or 'master' + - name: Running pub get in talawa_lint + run: cd talawa_lint && flutter pub get && cd .. + - name: Running pub get to fetch dependencies + run: flutter pub get + - name: Codebase testing + run: flutter test --coverage + - name: Present and upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}} + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false + name: '${{env.CODECOV_UNIQUE_NAME}}' + + Android-Build-and-Release: + if: ${{ github.actor != 'dependabot[bot]' }} + name: Testing build for android + permissions: + contents: write + environment: TALAWA_ENVIRONMENT + runs-on: ubuntu-latest + needs: Flutter-Testing + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '12.0' + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.22.3' + channel: 'stable' # or: 'beta', 'dev' or 'master' + - name: Running pub get in talawa_lint + run: cd talawa_lint && flutter pub get && cd .. + - name: Running pub get to fetch dependencies + run: flutter pub get + - name: Building for android + run: flutter build apk + + ################################################### + ## Release the built apk as an automated release ## + ################################################### + + - uses: ncipollo/release-action@v1 + with: + name: "Automated Android Release" + artifacts: "./build/app/outputs/flutter-apk/app-release.apk" + allowUpdates: "true" + generateReleaseNotes: false + tag: "automated" + body: | + This is an automated release, triggered by a recent push. + This may or may not be stable, so please have a look at the stable release(s). + + iOS-Build: + if: ${{ github.actor != 'dependabot[bot]' }} + name: iOS Build and Relaese + runs-on: macos-latest + needs: Flutter-Testing + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.22.3' + channel: 'stable' # or: 'beta', 'dev' or 'master' + architecture: x64 + - name: Building for ios + run: flutter build ios --release --no-codesign + # '--no-codesign' is used for building without code signing. + # For actual distribution, proper code signing is required. + + ######################################################## + ## Package the app as an .ipa and create a release ## + ######################################################## + + - name: Releasing for iOS + run: | + mkdir Payload + cp -r build/ios/iphoneos/Runner.app Payload/Runner.app + zip -r app.ipa Payload + # This packages the Runner.app into an .ipa file + + - uses: ncipollo/release-action@v1 + with: + name: "Automated iOS Release" + artifacts: "app-release.ipa" + allowUpdates: "true" + generateReleaseNotes: false + tag: "automated" + body: | + This is an automated release, triggered by a recent push. + This may or may not be stable, so please have a look at the stable release(s). diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..24667f8e0 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,43 @@ +############################################################################## +############################################################################## +# +# NOTE! +# +# Please read the README.md file in this directory that defines what should +# be placed in this file +# +############################################################################## +############################################################################## + +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 0 * * *" + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v8 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.' + stale-pr-message: 'This pull request did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.' + close-issue-message: 'This issue did not get any activity in the past 180 days and thus has been closed. Please check if the newest release or develop branch has it fixed. Please, create a new issue if the issue is not fixed.' + close-pr-message: 'This pull request did not get any activity in the past 180 days and thus has been closed.' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' + days-before-stale: 10 + days-before-close: 180 + remove-stale-when-updated: true + exempt-all-milestones: true + exempt-pr-labels: 'wip' + exempt-issue-labels: 'wip' + operations-per-run: 30 diff --git a/.github/workflows/talawa_mobile_md_mdx_format_adjuster.py b/.github/workflows/talawa_mobile_md_mdx_format_adjuster.py new file mode 100644 index 000000000..4903fe1f2 --- /dev/null +++ b/.github/workflows/talawa_mobile_md_mdx_format_adjuster.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +# -*- coding: UTF-8 -*- +""" +Script to adjust Dart documentation for MDX compatibility in Docusaurus. + +This script scans Dart-generated Markdown files and modifies special characters, +code blocks, and Dart-specific symbols to comply with the MDX syntax used in +Docusaurus v3. It ensures compatibility with the markdown processor by making +adjustments like escaping certain characters and modifying code blocks. + +This script complies with: + 1) Pylint + 2) Pydocstyle + 3) Pycodestyle + 4) Flake8 +""" +import os +import argparse +import re + +def escape_mdx_characters(text): + """ + Escape special characters (<, >, {, }) in Dart docs to make them MDX compatible. + + Args: + text (str): The text content to be processed. + + Returns: + str: The modified string with escaped MDX characters. + """ + # Replace unescaped <, >, {, } with their escaped equivalents + patterns = { + "<": r"(?": r"(?", + "{": r"(?`. + +1. Fork the Talawa repository and branch off `develop`. +1. Your newly forked repository can be cloned locally using `git clone `. +1. Make the Palisadoes Foundation's repo your `git upstream` for your local repo. 1. Make the desired changes to the Talawa source. -1. Run the app and test your changes. -1. If you've added code that should be tested, write tests. -1. Ensure that your code is appropriately formatted before making your submission. Submissions which are not properly formatted will be rejected if they are not fixed by the contributor. - 1. **In your IDE:** - 1. *Visual Studio Code:* There is a setting which allows your code to be formatted [automatically when you save](https://stackoverflow.com/a/66538607/15290492), or you may manually trigger it using `Ctrl + Shift + P` or `Cmd + Shift + P` and typing `Format Document`. - 1. *IntelliJ*, *Android Studio*, and other *Jetbrains*-based IDEs. Use the `Ctrl + Alt + L` or `Cmd + Opt + L` to trigger code formatting. - 1. **On the command line before committing**: Run this command from the root of your repository directory tree. - ``` - flutter format --set-exit-if-changed . - ``` -1. Ensure that **your code should not more than 300 lines**. It is there to make the code more modular and readable. Submissions that are not properly maintained will be rejected if the contributor does not fix them. Otherwise, the contributor will have to explain the need for it. -1. After making changes you can add them to git locally using `git add `(to add changes only in a particular file) or `git add .` (to add all changes). -1. After adding the changes you need to commit them using `git commit -m ''`(look at the commit guidelines below for commit messages). +1. Setup a local instance of Talawa-API on your local machine using the steps outlined in our [INSTALLATION.md](INSTALLATION.md) file. +1. Run the app: + 1. Enter Talawa-API URL for your local instance oulined in the [INSTALLATION.md](INSTALLATION.md) file. This is also the URL you should use for your Talawa-Admin configuration. +1. Test your changes. +1. If you've added code, then test suites must be added. + 1. **_General_:** + 1. We need to get to 100% test coverage for the app. We periodically increase the desired test coverage for our pull requests to meet this goal. + 1. Pull requests that don't meet the minimum test coverage levels will not be accepted. This may mean that you will have to create tests for code you did not write. You can decide which part of the code base needs additional tests if this happens to you. + 1. **_Testing_:** + 1. Test using the `flutter test` command. + 1. Review [Flutter's official introduction to unit testing](https://docs.flutter.dev/cookbook/testing/unit/introduction) + 1. Here are some useful flutter test videos + 1. [State Management With Provider](https://www.raywenderlich.com/6373413-state-management-with-provider) + 1. [Unit Testing With Flutter: Getting Started](https://www.raywenderlich.com/6926998-unit-testing-with-flutter-getting-started) + 1. [How to Unit Test in Flutter - Guide](https://www.youtube.com/watch?v=5BFlo9k3KNU) + 1. **_Test Code Coverage_:** + 1. _General Information_ + 1. The current code coverage of the repo is: [![codecov](https://codecov.io/gh/PalisadoesFoundation/talawa/branch/develop/graph/badge.svg?token=3PJXIKRS1S)](https://codecov.io/gh/PalisadoesFoundation/talawa) + 1. You can determine the percentage test coverage of your code by running these two commands in sequence: + ``` + flutter test --coverage + genhtml coverage/lcov.info -o coverage + ``` + 1. The coverage rate will be visible on the penultimate line of the `genhtml` command's output. + 1. The `genhtml` command is part of the linux `lcov` package. Similar packages can be found for Windows and MacOS. + 1. The currently acceptable coverage rate can be found in the [GitHub Pull Request file](.github/workflows/pull-request.yml). Search for the value below the line containing `min_coverage`. + 1. _Creating your code coverage account_ + 1. You can also see your code coverage online for your fork of the repo. This is provided by `codecov.io` + 1. Go to this link: `https://app.codecov.io/gh/XXXX/YYYY` where XXXX is your GitHub account username and YYYY is the name of the repository + 1. Login to `codecov.io` using your GitHub account, and add your **repo** and **branches** to the `codecov.io` dashboard. + 1. Remember to add the `Repository Upload Token` for your forked repo. This can be found under `Settings` of your `codecov.io` account. + 1. Use the value of this token to create a secret named CODE_COV for your forked repo. + 1. You will see your code coverage reports with every push to your repo after following these steps + +1. Author is required to write complete documentation for any file(s) changed in the respective PR + + 1. **General:** + + 1. Every field, i.e., `class`, `method`, `attribute`, `variable` should be documentation with some logical exceptions being `A class that extends State`, `class methods that override the respective base method`, etc as they don't necessarily need their own documentation. + 1. The documentation written should follow [Dart's official documentation guidelines](https://dart.dev/guides/language/effective-dart/documentation). + 1. For now, the non-documented files are marked with `// ignore_for_file: talawa_api_doc` and` + // ignore_for_file: talawa_good_doc_comments` directives to suppress these lint warning. It is expected from the author to remove these two lines from the files they have modified and add corresponding documentation in the expected format. + + 1. **In your IDE:** + + 1. If you followed [INSTALLATION.md](INSTALLATION.md) carefully, you should see lint errors/warnings in your IDE itself, after removing the ignore directives on the top of the file. + 1. Use the lint warnings your IDE states and write documentation accordingly. It will make the process easier. + + 1. **On the command line:** + + 1. Run `.github/workflows/check_ignore.py` and it will report if you have removed the ignore directives from changed files or not. + ```bash + python .github/workflows/check_ignore.py + ``` + + 1. If it states any error, remove ignore directives from the files it states, and write proper documentation. + + 1. When done writing documentation, run + ``` + flutter pub run custom_lint + ``` + + to check whether you documentation follows the format we expect, though you will get warnings in your IDE itself if it doesn't. + +1. Ensure that your code is appropriately formatted before making your submission. Submissions that are not properly formatted will be rejected if they are not fixed by the contributor. + 1. **_In your IDE_:** + + 1. _Visual Studio Code:_ There is a setting that allows your code to be formatted [automatically when you save](https://stackoverflow.com/a/66538607/15290492), or you may manually trigger it using `Ctrl + Shift + P` or `Cmd + Shift + P` and typing `Format Document`. + 1. _IntelliJ_, _Android Studio_, and other _Jetbrains_-based IDEs. Use the `Ctrl + Alt + L` or `Cmd + Opt + L` to trigger code formatting. + 1. **_On the command line before committing_**: Run this command from the root of your repository directory tree. + ``` + dart format --set-exit-if-changed . + ``` + +1. Ensure that your code should not be more than **_300 lines_**. It is there to make the code more modular and readable. Submissions that are not properly maintained will be rejected if the contributor does not fix them. Otherwise, the contributor will have to explain the need for it. + +1. After making changes, you can add them to git locally using `git add `(to add changes only in a particular file) or `git add .` (to add all changes). + +1. After adding the changes, you need to commit them using `git commit -m ''`(look at the commit guidelines below for commit messages). 1. You can link and automatically close the issue tied to your pull request by [using a supported keyword in either the pull request's description or in a commit message.](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue) This is a very useful feature that helps to prevent zombie issues that never die. -1. Once you have successfully commited your changes, you need to push the changes to the forked repo on github using: `git push origin `.(Here branch name must be name of the branch you want to push the changes to.) + +1. Once you have successfully committed your changes, you need to push the changes to the forked repo on GitHub using: `git push origin `.(Here, the branch name must be the name of the branch you want to push the changes to.) + 1. Now create a pull request to the Talawa repository from your forked repo. Open an issue regarding the same and link your PR to it. -1. Ensure the test suite passes, either locally or on CI once a PR has been created. + +1. Ensure the test suite passes, either locally or on CI, once a PR has been created. + 1. Review and address comments on your pull request if requested. -### General Guidelines +## General Guidelines + +Please also follow these general rules. + +### Folder Definition + +- `controllers`: The folder contains all the files responsible for managing the state. + ``` + 1. Files contain codes for all the business logic related to any screen. + 2. Files also contain the client-side query & mutation calls and server-side side response. + 3. Before adding any controller, make sure whether it already exists or not. + ``` +- `enum`: The folder contains all the enumerators used in the entire project. + ``` + 1. File contains an enum that is either used with controllers or widgets. + 2. Before creating new enum files, check if the existing enum can be modified to fulfill your requirements. + ``` +- `model`: The folder contains all the data models files. + ``` + 1. Files contain a data model that is used in the controller file that contains the server-side response in an organised form. + 2. These data models are used to effectively organise projects and render the data on widgets. + 3. In the controller file, convert every response to a particular data model type. + ``` +- `utils`: The folder contains all the external utility files. + ``` + 1. Codes related to an external utility like validator, UI-scaling, constant strings, etc. + 2. Any utility-related files should be created here if not already present. + ``` +- `views`: The folder contains all the files related to the UI display. + ``` + 1. Pages: Folder that contains all the pages related to sub-folder and code. + 2. Widgets: Folder that contains widget file for pages to avoid code duplication + ``` -#### Project structure +### File Definition + +- Filename should be created with lowercase and underscore letters +- The business logic & UI-based files should be separated from each other. + - `controllers`: Folder that contains all business logic files + - `views`: Folder that contains UI specific files +- If it is UI based file, try to use as much `stateless widget` as possible. +- Don't use the `print` statement in your code; instead use `debugPrint`. +- Constructor should be present just after the class declaration. +- Make sure to add proper `keyword` (final or const) and data types for any variable. +- In your files, structure code this way inside your widget class: + ``` + -- constructor + -- explicitly defined variables using its type (private if possible) + -- build method (Inside build(), use sub methods like _buildAppBar() + -- sub-build methods + -- other methods + -- utility methods + ``` + +**_Note: Don't use constant numerical value anywhere in your UI-related code. Use SizeConfig class to assign the constant value. SizeConfig class does the job of scaling the UI based on the device size._** + +Example: + +``` +Incorrect Way: +SizedBox(height: 8, width: 4) + +Correct Way: +SizedBox(height: SizeConfig.safeBlockVertical, width: SizeConfig.safeBlockHorizontal) +``` + +The value of `safeBlockVertical` and `safeBlockHorizontal` will be displayed in your `console` and varies based on the device being used. + +### PR Preparation: + + - All your file should contain at max `300` lines of code. + - Follow proper code formatting and run `flutter format .` before your PR. + - Run `flutter analyze` before your PR and make sure to resolve all the found issues. + +### Project Structure ``` app @@ -85,48 +277,24 @@ core - utils: utility classes ``` -#### Structure code this way - -``` -// Inside widget class --- constructor --- explicitly defined variables using its type (private if possible) --- build method (Inside build(), use sub methods like _buildAppBar() --- sub-build methods --- other methods --- utility methods -``` - -#### Other Information - -``` --- file should be named using lowercase and underscore --- const and final keywords should be specified along with the widget --- Use SizeConfig class for assigning constant height, width and whitespace (Example: SizedBox(width:SizeConfig.safeBlockHorizontal * 2.5)) -``` - -#### Commit guidelines +### Commit Guidelines ``` feat: (addition of a new feature) rfac: (refactoring the code: optimization/ different logic of existing code - output doesn't change, just the way of execution changes) docs: (documenting the code, be it readme, or extra comments) bfix: (bug fixing) -chor: (chore - beautifying code, indents, spaces, camelcasing, changing variable names to have an appropriate meaning) +chor: (chore - beautifying code, indents, spaces, camelCasing, changing variable names to have an appropriate meaning) ptch: (patches - small changes in code, mainly UI, for example color of a button, increasing size of text, etc) conf: (configurational settings - changing directory structure, updating gitignore, add libraries, changing manifest etc) ``` -### Internships - -We have internship partnerships with a number of organizations. See below for more details. - -#### GSoC -If you are participating in the 2021 Summer of Code, please read more about us and our processes [here](https://palisadoesfoundation.github.io/talawa-docs/docs/internships/gsoc/gsoc-introduction) +## Internships -#### GitHub Externship -If you are participating in the 2021 GitHub Externship, please read more about us and our processes [here](https://palisadoesfoundation.github.io/talawa-docs/docs/internships/github/github-introduction) +If you are participating in any of the various internship programs we ar members of then please read the [introduction guides on our documentation website](https://docs.talawa.io/docs/). +## Community +There are many ways to communicate with the community. -### Community -The Palisadoes Foundation has a Slack channel where members can assist with support and clarification. Click [here](https://join.slack.com/t/thepalisadoes-dyb6419/shared_invite/zt-nk79xxlg-OxTdlrD7RLaswu8EO_Q5rg) to join our slack channel. +1. The Palisadoes Foundation has a Slack channel where members can assist with support and clarification. Visit the [Talawa GitHub repository home page](https://github.com/PalisadoesFoundation/talawa) for the link to join our slack channel. +1. We also have a technical email list run by [freelists.org](https://www.freelists.org/). Search for "palisadoes" and join. Members on this list are also periodically added to our marketing email list that focuses on less technical aspects of our work. diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md new file mode 100644 index 000000000..aecf8cc13 --- /dev/null +++ b/DOCUMENTATION.md @@ -0,0 +1,21 @@ +# Documentation +Welcome to our documentation guide. Here are some useful tips you need to know! +## Where to find our documentation + +Our documentation can be found in ONLY TWO PLACES: + +1. ***Inline within the repository's code files***: We have automated processes to extract this information and place it in our Talawa documentation site [docs.talawa.io](https://docs.talawa.io/). +1. ***In our `talawa-docs` repository***: Our [Talawa-Docs](https://github.com/PalisadoesFoundation/talawa-docs) repository contains user edited markdown files that are automatically integrated into our Talawa documentation site [docs.talawa.io](https://docs.talawa.io/) using the [Docusaurus](https://docusaurus.io/) package. + +## How to use Docusaurus +The process in easy: +1. Install `talawa-docs` on your system +1. Launch docusaurus on your system according to the `talawa-docs`documentation. + - A local version of `docs.talawa.io` should automatically launched in your browser at http://localhost:3000/ +1. Add/modify the markdown documents to the `docs/` directory of the `talawa-docs` repository +1. If adding a file, then you will also need to edit the `sidebars.js` which is used to generate the [docs.talawa.io](https://docs.talawa.io/) menus. +1. Always monitor the local website in your brower to make sure the changes are acceptable. + - You'll be able to see errors that you can use for troubleshooting in the CLI window you used to launch the local website. + +## Other information +***PLEASE*** do not add markdown files in this repository. Add them to `talawa-docs`! diff --git a/INSTALLATION.md b/INSTALLATION.md new file mode 100644 index 000000000..227e549f2 --- /dev/null +++ b/INSTALLATION.md @@ -0,0 +1,68 @@ +# Installation for Developers +Welcome to our installation guide for developers. Jump in and contribute! + +# Table of Contents + +1. [Pre-Requisites For Developers](#prerequisites-for-developers) + - [Talawa-API and Talawa-Admin](#talawa-api-and-talawa-admin) + - [Talawa Mobile App](#talawa-mobile-app) +1. [Installation](#installation) +1. [Operation](#operation) + +# Prerequisites for Developers +We recommend that you follow these steps before beginning development work on the Talawa mobile app. +## Talawa-API and Talawa-Admin + +For best results you should setup your own **_local instances_** of: +1. [Talawa-API](https://github.com/PalisadoesFoundation/talawa-api): The API system that the mobile app uses for accessing data. +1. [Talawa-admin](https://github.com/PalisadoesFoundation/talawa-admin): The system used by Administrators to manage user information. This is important as you will occasionally need to do administrative functions that cannot be done in the mobile app. + +The INSTALLATION.md files in both repositories show you how. The Talawa-API INSTALLATION.md will also show you the Organization URL to use when you first login to Talawa mobile. + +### Talawa Mobile App +**Note:** If you are an Android user, you may choose to directly use the `apk` file provided in this repo, and skip the manual setup part. For more information about this, see the [Installation section](#Installation). But if you want to setup the development environment for yourself, read along. + +You'll need to set up the IDE and mobile device emulator on your local system and have access to a system running the Talawa API, which the mobile needs to access to operate properly. + +1. **Development Environment**: You'll need to have the following installed: + 1. [Flutter SDK](https://flutter.dev/docs/get-started/install) + 1. [Android Studio](https://developer.android.com/studio) +1. **API Environment**: This part is very important. + 1. Make sure Talawa-API is up and running. + 1. You will need to enter the URL of the API server in the Talawa app when it first starts up. The URL could be active on a system you control or in our test environment. The Talawa-API INSTALLATION.md will provide that information. + +# Installation + +You can start using Talawa by any of the two methods: + +1. Install the `apk` provided in the release section of this repo. It is built against the latest codebase. Please note that the release is provided only for Android. For iOS, you will still need to build the app yourself. + - Head over to the [release section](https://github.com/PalisadoesFoundation/talawa/releases) of Talawa repository. + - You will find a release with the name of `Automated Android Release`. Scroll a bit and you will find a file named `app-release.apk`. Click on it and have it downloaded. + - Head over to the downloads of your browser and then click on `app-release.apk` there. That will ask you to install the app. Click on `Install`. + - Once done, you can find `Talawa` in your apps list. Start using it from right there :) +2. Manually build the app by below described steps. + +## Manual Build and Installation + +We have tried to make the process simple. Here's what you need to do. + +1. Clone and change into the project. + ```sh + $ git clone https://github.com/PalisadoesFoundation/talawa.git + $ cd talawa + ``` +1. Install packages. + ```sh + $ cd talawa_lint + $ flutter pub get + $ cd .. + $ flutter pub get + ``` +1. Start developing! + +# Operation + +The Talawa Mobile app communicates with a Talawa-API server to get all its data. This access is provided via a URL. +When you first run the Talawa Mobile App you'll be prompted for the organization URL of a Talawa-API server. The URL to use will vary depending on the way you are using the Talawa Mobile app. + +For a list of organization URLs for each scenario, please refer to the Talawa-API [INSTALLATION.md](https://github.com/PalisadoesFoundation/talawa-api/blob/-/INSTALLATION.md) file diff --git a/ISSUE_GUIDELINES.md b/ISSUE_GUIDELINES.md new file mode 100644 index 000000000..6c8bfe8cf --- /dev/null +++ b/ISSUE_GUIDELINES.md @@ -0,0 +1,59 @@ +# Issue Report Guidelines + +:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: + +In order to give everyone a chance to submit a issues reports and contribute to the Talawa project, we have put restrictions in place. This section outlines the guidelines that should be imposed upon issue reports in the Talawa project. + +___ +## Table of Contents + + +- [Issue Report Guidelines](#issue-report-guidelines) + - [Table of Contents](#table-of-contents) + - [Issue Management](#issue-management) + - [New Issues](#new-issues) + - [Existing Issues](#existing-issues) + - [Feature Request Issues](#feature-request-issues) + - [Monitoring the Creation of New Issues](#monitoring-the-creation-of-new-issues) + - [General Guidelines](#general-guidelines) + + +___ +## Issue Management + +In all cases please use the [GitHub open issue search](https://github.com/PalisadoesFoundation/talawa/issues) to check whether the issue has already been reported. + +### New Issues +To create new issues follow these steps: + +1. Your issue may have already been created. Search for duplicate open issues before submitting yours.for similar deficiencies in the code.duplicate issues are created. +1. Verify whether the issue has been fixed by trying to reproduce it using the latest master or development branch in the repository. +1. Click on the [`New Issue`](https://github.com/PalisadoesFoundation/talawa/issues/new/choose) button +1. Use the templates to create a standardized report of what needs to be done and why. +1. If you want to be assigned the issue that you have created, then add a comment immediately after submitting it. + +We welcome contributors who find new ways to make the code better. + +### Existing Issues + +You can also be a valuable contributor by searching for dormant issues. Here's how you can do that: + +1. **Previously Assigned Issues**: We regularly review issues and add a [`no-issue-activity`](https://github.com/PalisadoesFoundation/talawa/issues?q=is%3Aissue+is%3Aopen+label%3Ano-issue-activity) label to them. Use the issue comments to ask whether the assignee is still working on the issue, and if not, ask for the issue to be assigned to you. +1. **Unassigned Issues**: If the issue is already reported and [not assigned to anyone](https://github.com/PalisadoesFoundation/talawa/issues?q=is%3Aissue+is%3Aopen+no%3Aassignee) and you are interested in working on the issue then: + 1. Ask for the issue to be assigned to you in the issue comments + 2. Ask our contributors to assign it to you in `#talawa` slack channel. + +Working on these types of existing issues is a good way of getting started with the community. + +### Feature Request Issues + +Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the mentors of the merits of this feature. Please provide as much detail and context as possible. + +### Monitoring the Creation of New Issues +1. Join our `#talawa-github` slack channel for automatic issue and pull request updates + +## General Guidelines + +1. Discuss issues in our various slack channels when necessary +2. Please do not derail or troll issues. +3. Keep the discussion on topic and respect the opinions of others. diff --git a/PR-guidelines.md b/PR-guidelines.md deleted file mode 100644 index 80047d4ad..000000000 --- a/PR-guidelines.md +++ /dev/null @@ -1,21 +0,0 @@ -# Pull Request Guidelines - -:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: - -In order to give everyone a chance to submit a pull request and contribute to the Talawa project, we have put restrictions in place. This section outlines the guidelines that should be imposed upon pull requests in the Talawa project. - -1. Do not start working on any open issue and raise a PR unless it is assigned to you. -3. Pull requests must be based on [open issues](https://github.com/PalisadoesFoundation/talawa/issues) available. -4. [Use this method to automatically close the issue when the PR is completed.](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue) -5. Each contributor may only create one pull request at a time. We have this rule in place due to our limited resources - if everyone was allowed to post multiple pull requests we will not be able to review them properly. It is also better for contributors because you can focus on creating one quality PR - so spend time making sure it is as good as it can be. -6. If the pull request's code quality is not up to par, or it would break the app, it will more likely be closed. So please be careful when creating a PR. -7. Please follow the [PR template](https://github.com/PalisadoesFoundation/talawa/blob/master/.github/PR_TEMPLATE/pr-template.md). Ensure the PR title clearly describes the problem it is solving. In the description, include the relevant issue number, snapshots and videos after changes added. -8. If you are borrowing code, please disclose it. It is fine and sometimes even recommended to borrow code, but we need to know about it to assess your work. If we find out that your pull request contains a lot of code copied from elsewhere, we will close the pull request. -9. All pull request must have test units. If for some reason it is not possible to add tests, please let us know and explain why. In that case, you'll need to tell us what steps you followed to manually test your changes. -10. No Work In Progress. ONLY completed and working pull requests, and with test units, will be accepted. A WIP would fall under rule 4 and be closed immediately. -11. Please do not @mention contributors and mentors. Sometimes it takes time before we can review your pull request or answer your questions but we'll get to it sooner or later. @mentioning someone just adds to the pile of notifications we get and it won't make us look at your issue faster. -12. Do not force push. If you make changes to your pull request, please simply add a new commit as that makes it easy for us to review your new changes. If you force push, we'll have to review everything from the beginning. -13. PR should be small, easy to review and should follow standard coding styles. -14. If PR has conflicts because of recently added changes to the same file, resolve issues, test new changes and submit PR again for review. -15. PRs should be atomic. That is, they should address one item (issue or feature) -16. After submitting PR, if you are not replying within 48 hours then in that case we may need to assign issue to other contributors based on priority of the issue. diff --git a/PR_GUIDELINES.md b/PR_GUIDELINES.md new file mode 100644 index 000000000..d7742a8c8 --- /dev/null +++ b/PR_GUIDELINES.md @@ -0,0 +1,36 @@ +# Pull Request Guidelines + +:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: + +In order to give everyone a chance to submit a pull request and contribute to the Talawa project, we have put restrictions in place. This section outlines the guidelines that should be imposed upon pull requests in the Talawa project. + +## Pull Requests and Issues +1. Do not start working on any open issue and raise a PR unless the issue is assigned to you. PRs that don't meet these guidelines will be closed. +1. Pull requests must be based on [open issues](https://github.com/PalisadoesFoundation/talawa/issues) available. +1. [Use this method to automatically close the issue when the PR is completed.](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue) + +## Testing +1. All pull requests must have test units. If, for some reason, it is not possible to add tests, please let us know and explain why. In that case, you'll need to tell us what steps you followed to manually test your changes. +1. Please read our [CONTRIBUTING.md](CONTRIBUTING.md) document for details on our testing policy. + +## Pull Request Processing +These are key guidelines for the procedure: + +### Only submit PRs against our `develop` branch, not the default `main` branch + +1. Only submit PRs against our `develop` branch. The default is `main`, so you will have to modify this before submitting your PR for review. PRs made against `main` will be closed. +1. We do not accept draft Pull Requests. They will be closed if submitted. We focus on work that is ready for immediate review. +1. Removing assigned reviewers from your Pull Request will cause it to be closed. The quality of our code is very important to us. Therefore we make experienced maintainers of our code base review your code. Removing these assigned persons is not in the best interest of this goal. +1. If you have not done so already, please read the `Pull Requests and Issues` and `Testing` sections above. +1. Each contributor may only create one pull request at a time. We have this rule in place due to our limited resources - if everyone was allowed to post multiple pull requests, we would not be able to review them properly. It is also better for contributors because you can focus on creating one quality PR - so spend time making sure it is as good as it can be. +1. Upon successful push to the fork, check if all tests are passing; if not, fix the issues and then create a pull request. +1. If the pull request's code quality is not up to par, or it would break the app, it will more likely be closed. So please be careful when creating a PR. +1. Please follow the PR template provided. Ensure the PR title clearly describes the problem it is solving. In the description, include the relevant issue number, snapshots, and videos after changes are added. +1. If you are borrowing a code, please disclose it. It is fine and sometimes even recommended to borrow code, but we need to know about it to assess your work. If we find out that your pull request contains a lot of code copied from elsewhere, we will close the pull request. +1. No Work In Progress. ONLY completed and working pull requests and with respective test units will be accepted. A WIP would fall under rule 4 and be closed immediately. +1. Please do not @mention contributors and mentors. Sometimes it takes time before we can review your pull request or answer your questions, but we'll get to it sooner or later. @mentioning someone just adds to the pile of notifications we get and it won't make us look at your issue faster. +1. Do not force push. If you make changes to your pull request, please simply add a new commit, as that makes it easy for us to review your new changes. If you force push, we'll have to review everything from the beginning. +1. PR should be small, easy to review and should follow standard coding styles. +1. If PR has conflicts because of recently added changes to the same file, resolve issues, test new changes, and submit PR again for review. +1. PRs should be atomic. That is, they should address one item (issue or feature) +1. After submitting PR, if you are not replying within 48 hours, then in that case, we may need to assign the issue to other contributors based on the priority of the issue. diff --git a/README.md b/README.md index 057715c74..351e606e3 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,18 @@ # Talawa -[![Build Status](https://travis-ci.org/PalisadoesFoundation/talawa.svg?branch=master)](http://www.palisadoes.org/) + +[💬 Join the community on Slack](https://github.com/PalisadoesFoundation/) + +![talawa-logo-lite-200x200](https://github.com/PalisadoesFoundation/talawa-admin/assets/16875803/26291ec5-d3c1-4135-8bc7-80885dff613d) + + [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![GitHub stars](https://img.shields.io/github/stars/PalisadoesFoundation/talawa.svg?style=social&label=Star&maxAge=2592000)](https://github.com/PalisadoesFoundation/talawa) [![GitHub forks](https://img.shields.io/github/forks/PalisadoesFoundation/talawa.svg?style=social&label=Fork&maxAge=2592000)](https://github.com/PalisadoesFoundation/talawa) +[![codecov](https://codecov.io/gh/PalisadoesFoundation/talawa/graph/badge.svg?token=3PJXIKRS1S)](https://codecov.io/gh/PalisadoesFoundation/talawa) -[![N|Solid](images/talawa-logo-lite-200x200.png)](https://github.com/PalisadoesFoundation/talawa) +**Talawa** is a comprehensive platform that aims to revolutionize the way organizations manage and interact with their data and content. Talawa empowers administrators to access and manage content with ease through the Talawa Admin interface, ensuring that information remains up-to-date and accessible to the platform's members. -Talawa is a modular open source project to manage group activities of both non-profit organizations and businesses. +With the Talawa API facilitating smooth communication between all parts of the platform, Talawa offers a cohesive and exceptional user experience for both administrators and members, making it a powerful tool for data management and content delivery seamlessly. Talawa is a modular open source project to manage group activities of both non-profit organizations and businesses. Core features include: @@ -28,36 +34,17 @@ Core features include: 1. **talawa-docs**: [The online documentation website](https://github.com/PalisadoesFoundation/talawa-docs) # Documentation - - The talawa documentation can be found [here](https://palisadoesfoundation.github.io/talawa-docs/). - - Want to contribute? Look at [CONTRIBUTING.md](https://github.com/PalisadoesFoundation/talawa/blob/master/CONTRIBUTING.md) to get started. - - Visit the [Talawa GitHub](https://github.com/PalisadoesFoundation/talawa) to see the code. - -# Installation for Developers - -You can test talawa in your own development environment. This section shows you how. - -## Prerequisites - -You'll need to setup the IDE and mobile device emulator on your local system, and have access to a system running the Talawa API which the mobile needs to access to operate properly. - -1. **Development Environment**: You'll need to have the following installed: - 1. [Flutter SDK](https://flutter.dev/docs/get-started/install) - 1. [Android Studio](https://developer.android.com/studio) -1. **API Environment**: You will need to enter the URL of the API server in the Talawa app when it first starts up. The URL could be active on a system you control or in our test environment. - 1. *Your API Server:* Check the [Talawa API repository](https://github.com/PalisadoesFoundation/talawa-api) for information on how to setup the API on your local machine or a machine under your legitimate control. There is a section in the README.md file that discusses installation. - 2. *Our API Server for Talawa Contributors*: We also have a test environment that our open source contributors use. Try it if you are not inclined to setup or customize your own API server.This is a development environment. The data stored on this server may be modified or deleted without warning. Information about this server can be found in the [Talawa documentation site](https://palisadoesfoundation.github.io/talawa-docs/) - -## Command Line Steps - -We have tried to make the process simple. Here's what you need to do. - -1. Clone and change into the project. - ```sh - $ git clone https://github.com/PalisadoesFoundation/talawa.git - $ cd talawa - ``` -1. Install packages - ```sh - $ flutter pub get - ``` -1. Start developing! + +1. You can install the software for this repository using the steps in our [INSTALLATION.md](INSTALLATION.md) file. +1. Do you want to contribute to our code base? Look at our [CONTRIBUTING.md](CONTRIBUTING.md) file to get started. There you'll also find links to: + 1. Our code of conduct documentation in the [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) file. + 1. How we handle the processing of new and existing issues in our [ISSUE_GUIDELINES.md](ISSUE_GUIDELINES.md) file. + 1. The methodologies we use to manage our pull requests in our [PR_GUIDELINES.md](PR_GUIDELINES.md) file. +1. The `talawa` documentation can be found at our [docs.talawa.io](https://docs.talawa.io) site. + 1. It is automatically generated from the markdown files stored in our [Talawa-Docs GitHub repository](https://github.com/PalisadoesFoundation/talawa-docs). This makes it easy for you to update our documenation. + +# Videos + +1. Visit our [YouTube Channel playlists](https://www.youtube.com/@PalisadoesOrganization/playlists) for more insights + 1. The "Getting Started - Developers" videos are extremely helpful for new open source contributors. + diff --git a/analysis_options.yaml b/analysis_options.yaml index 284646877..2aef38bdb 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,5 +1,20 @@ include: package:lint/analysis_options.yaml +analyzer: + exclude: + - lib/generated_plugin_registrant.dart + - test/helpers/test_helpers.mocks.dart + + plugins: + - custom_lint + +custom_lint: + rules: + - talawa_lint + + exclude: + - test + linter: rules: # Make constructors the first thing in every class @@ -13,17 +28,23 @@ linter: avoid_redundant_argument_values: false - # Unessary use of this in contructors should not be done + # Unnecessary use of this in constructors should not be done unnecessary_this: false # source files name using lowercase_with_underscores - lowercase_with_underscores: true + file_names: true leading_newlines_in_multiline_strings: false - always_declare_return_types: false + # Forces explicit return type declaration + always_declare_return_types: true type_annotate_public_apis: false + + # To make a quick navigation to particular files + always_use_package_imports: true + + directives_ordering: true # In case of production should be set to true avoid_print: false @@ -34,4 +55,34 @@ linter: avoid_function_literals_in_foreach_calls: false - join_return_with_assignment: false \ No newline at end of file + join_return_with_assignment: false + + prefer_const_literals_to_create_immutables: false + + depend_on_referenced_packages: true + + # This new lint rule advises to use methods on dynamic objects + # only after properly type casting. It's quite good and will avoid + # null errors. + # For now, it affects the whole code base; wherever we have done + # something like + # + # ``` + # var obj = json_data['obj']; + # obj.fun_call(param); + # ``` + # + # To fix: Turn on this lint and type cast the object of your file as + # + # ``` + # MyObj obj = json_data['obj'] as MyObj; + # ``` + + avoid_dynamic_calls: true + + ############################################# + ################### REMOVE ################## + ############################################# + unreachable_from_main: false + implicit_call_tearoffs: false + dangling_library_doc_comments: false diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 000000000..0a741cb43 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index f437a4862..000000000 --- a/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir= -eclipse.preferences.version=1 -gradle.user.home= -java.home=C\:/Program Files/Java/jdk-13 -jvm.arguments= -offline.mode=false -override.workspace.settings=true -show.console.view=true -show.executions.view=true diff --git a/android/android.zip b/android/android.zip deleted file mode 100644 index a074bdaa6..000000000 Binary files a/android/android.zip and /dev/null differ diff --git a/android/app/.classpath b/android/app/.classpath deleted file mode 100644 index 32d669198..000000000 --- a/android/app/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/android/app/.settings/org.eclipse.buildship.core.prefs b/android/app/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index ae4bd2271..000000000 --- a/android/app/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3)) -connection.project.dir=.. -eclipse.preferences.version=1 -gradle.user.home= -java.home=C\:/Program Files/Java/jdk-13 -jvm.arguments= -offline.mode=false -override.workspace.settings=true -show.console.view=true -show.executions.view=true diff --git a/android/app/.settings/org.eclipse.jdt.core.prefs b/android/app/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8aca959e1..000000000 --- a/android/app/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=18 -org.eclipse.jdt.core.compiler.compliance=18 -org.eclipse.jdt.core.compiler.source=18 diff --git a/android/app/build.gradle b/android/app/build.gradle index 122f2de20..410706e21 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -21,37 +27,35 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + packagingOptions { + exclude 'META-INF/services/javax.annotation.processing.Processor' + } + + compileSdkVersion 34 sourceSets { main.java.srcDirs += 'src/main/kotlin' } - lintOptions { - disable 'InvalidPackage' - } - defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.talawa" - minSdkVersion 19 - targetSdkVersion 30 + minSdkVersion 21 + + targetSdkVersion 34 + multiDexEnabled true versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true } buildTypes { release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug - shrinkResources false - minifyEnabled false } } } @@ -61,8 +65,6 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' + implementation 'com.android.support:multidex:1.0.3' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.10" } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index debef2160..d1b4ad2aa 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -4,4 +4,6 @@ to allow setting breakpoints, to provide hot reload, etc. --> + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 378d83ce9..9b3375276 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,27 +1,36 @@ - - - + + + + + + + + + + + + android:icon="@mipmap/ic_launcher" + android:allowBackup="false" + android:enableOnBackInvokedCallback="true" + tools:replace="android:label"> - + - + + + + + + + + + This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> + + + + + + + + + + + - - diff --git a/android/app/src/main/kotlin/com/example/talawa/MainActivity.kt b/android/app/src/main/kotlin/com/example/talawa/MainActivity.kt index 255d2446b..7366da855 100644 --- a/android/app/src/main/kotlin/com/example/talawa/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/talawa/MainActivity.kt @@ -2,4 +2,5 @@ package com.example.talawa import io.flutter.embedding.android.FlutterActivity -class MainActivity: FlutterActivity() {} \ No newline at end of file +class MainActivity: FlutterActivity() { +} diff --git a/android/app/src/main/res/drawable-night/launch_background.xml b/android/app/src/main/res/drawable-night/launch_background.xml new file mode 100644 index 000000000..81618253b --- /dev/null +++ b/android/app/src/main/res/drawable-night/launch_background.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/assets/images/talawaLogo-noBg.png b/android/app/src/main/res/drawable-night/launch_image.png similarity index 100% rename from assets/images/talawaLogo-noBg.png rename to android/app/src/main/res/drawable-night/launch_image.png diff --git a/android/app/src/main/res/drawable-night/launcher_image.xml b/android/app/src/main/res/drawable-night/launcher_image.xml new file mode 100644 index 000000000..72ffd0710 --- /dev/null +++ b/android/app/src/main/res/drawable-night/launcher_image.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..f74085f3f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/chat_icon.png b/android/app/src/main/res/drawable/chat_icon.png new file mode 100644 index 000000000..068a4df64 Binary files /dev/null and b/android/app/src/main/res/drawable/chat_icon.png differ diff --git a/android/app/src/main/res/drawable/event_icon.png b/android/app/src/main/res/drawable/event_icon.png new file mode 100644 index 000000000..07d77b642 Binary files /dev/null and b/android/app/src/main/res/drawable/event_icon.png differ diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml index 680e83347..8b8748cca 100644 --- a/android/app/src/main/res/drawable/launch_background.xml +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -1,17 +1,10 @@ - - - - - - - + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/launch_image.png b/android/app/src/main/res/drawable/launch_image.png new file mode 100644 index 000000000..9ebc349e6 Binary files /dev/null and b/android/app/src/main/res/drawable/launch_image.png differ diff --git a/android/app/src/main/res/drawable/launcher_image.xml b/android/app/src/main/res/drawable/launcher_image.xml new file mode 100644 index 000000000..72ffd0710 --- /dev/null +++ b/android/app/src/main/res/drawable/launcher_image.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/newsfeed_icon.png b/android/app/src/main/res/drawable/newsfeed_icon.png new file mode 100644 index 000000000..ee35b8464 Binary files /dev/null and b/android/app/src/main/res/drawable/newsfeed_icon.png differ diff --git a/android/app/src/main/res/ic_launcher-web.png b/android/app/src/main/res/ic_launcher-web.png deleted file mode 100644 index 82fbc64b6..000000000 Binary files a/android/app/src/main/res/ic_launcher-web.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 036d09bc5..000000000 --- a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 036d09bc5..000000000 --- a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index 712cb626b..afb72e056 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png deleted file mode 100644 index 7fb9a850b..000000000 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 2ff7114a1..000000000 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-hdpi/launcher_icon.png b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png deleted file mode 100644 index c40ab2677..000000000 Binary files a/android/app/src/main/res/mipmap-hdpi/launcher_icon.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-ldpi/ic_launcher.png b/android/app/src/main/res/mipmap-ldpi/ic_launcher.png deleted file mode 100644 index b1d29751f..000000000 Binary files a/android/app/src/main/res/mipmap-ldpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 6296a0358..12fd512e0 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png deleted file mode 100644 index 4a19b7fe4..000000000 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index d1ee31fa4..000000000 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-mdpi/launcher_icon.png b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png deleted file mode 100644 index aca4f7905..000000000 Binary files a/android/app/src/main/res/mipmap-mdpi/launcher_icon.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index e32b72761..e4c088414 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index b9ba877ad..000000000 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index f9b021e7d..000000000 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png deleted file mode 100644 index b9a22fb38..000000000 Binary files a/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 479529e3c..3c689750f 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 71969a962..000000000 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 22d63f169..000000000 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png deleted file mode 100644 index 2539708bf..000000000 Binary files a/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index f3d9826d7..133cc242f 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 129b5f677..000000000 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 7eb60fda3..000000000 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png deleted file mode 100644 index 530da03ea..000000000 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png and /dev/null differ diff --git a/android/app/src/main/res/playstore-icon.png b/android/app/src/main/res/playstore-icon.png deleted file mode 100644 index 8fc756341..000000000 Binary files a/android/app/src/main/res/playstore-icon.png and /dev/null differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..449a9f930 --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 000000000..c88cf94be --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + #ffffff + #18191A + \ No newline at end of file diff --git a/android/app/src/main/res/values/ic_launcher_background.xml b/android/app/src/main/res/values/ic_launcher_background.xml deleted file mode 100644 index 3a127ccbc..000000000 --- a/android/app/src/main/res/values/ic_launcher_background.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #d5d4d5 - \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 65df8e081..2ba34d5e4 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,13 +1,18 @@ + + - + \ No newline at end of file diff --git a/android/app/src/main/res/xml/filepaths.xml b/android/app/src/main/res/xml/filepaths.xml new file mode 100644 index 000000000..c0f3b318d --- /dev/null +++ b/android/app/src/main/res/xml/filepaths.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index dc5cdbc9d..3d4dae489 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,31 +1,17 @@ -buildscript { - ext.kotlin_version = '1.3.50' - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:4.0.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} allprojects { repositories { google() - jcenter() + mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/android/gradle.properties b/android/gradle.properties index 2324ab5b7..4d3226abc 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,3 @@ org.gradle.jvmargs=-Xmx1536M - -android.enableR8=true android.useAndroidX=true -android.enableJetifier=true +android.enableJetifier=true \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 493072b3c..cfe88f690 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index 5a2f14fb1..61f635fea 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,15 +1,28 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.2" + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.8.10" apply false + id("com.google.gms.google-services") version "4.4.1" apply false + } + +include ":app" \ No newline at end of file diff --git a/assets/fonts/OpenSans-Bold.ttf b/assets/fonts/OpenSans-Bold.ttf new file mode 100644 index 000000000..efdd5e84a Binary files /dev/null and b/assets/fonts/OpenSans-Bold.ttf differ diff --git a/assets/fonts/OpenSans-Regular.ttf b/assets/fonts/OpenSans-Regular.ttf new file mode 100644 index 000000000..29bfd35a2 Binary files /dev/null and b/assets/fonts/OpenSans-Regular.ttf differ diff --git a/assets/fonts/OpenSans-SemiBold.ttf b/assets/fonts/OpenSans-SemiBold.ttf new file mode 100644 index 000000000..54e7059cf Binary files /dev/null and b/assets/fonts/OpenSans-SemiBold.ttf differ diff --git a/assets/fonts/ProductSans-Bold.ttf b/assets/fonts/ProductSans-Bold.ttf new file mode 100644 index 000000000..96619df92 Binary files /dev/null and b/assets/fonts/ProductSans-Bold.ttf differ diff --git a/assets/fonts/ProductSans-Medium.ttf b/assets/fonts/ProductSans-Medium.ttf new file mode 100644 index 000000000..fd818d6f5 Binary files /dev/null and b/assets/fonts/ProductSans-Medium.ttf differ diff --git a/assets/fonts/ProductSans-Regular.ttf b/assets/fonts/ProductSans-Regular.ttf new file mode 100644 index 000000000..e2c69c3fb Binary files /dev/null and b/assets/fonts/ProductSans-Regular.ttf differ diff --git a/assets/fonts/Quicksand-Medium.ttf b/assets/fonts/Quicksand-Medium.ttf deleted file mode 100644 index c0cc3b585..000000000 Binary files a/assets/fonts/Quicksand-Medium.ttf and /dev/null differ diff --git a/assets/fonts/Quicksand_Bold.otf b/assets/fonts/Quicksand_Bold.otf deleted file mode 100644 index 4f371fa92..000000000 Binary files a/assets/fonts/Quicksand_Bold.otf and /dev/null differ diff --git a/assets/fonts/Quicksand_Book.otf b/assets/fonts/Quicksand_Book.otf deleted file mode 100644 index ee8b12d77..000000000 Binary files a/assets/fonts/Quicksand_Book.otf and /dev/null differ diff --git a/assets/fonts/Quicksand_Light.otf b/assets/fonts/Quicksand_Light.otf deleted file mode 100644 index 798c1a744..000000000 Binary files a/assets/fonts/Quicksand_Light.otf and /dev/null differ diff --git a/assets/fonts/Raleway-Medium.ttf b/assets/fonts/Raleway-Medium.ttf deleted file mode 100644 index 7a71a6ff0..000000000 Binary files a/assets/fonts/Raleway-Medium.ttf and /dev/null differ diff --git a/assets/fonts/Raleway-Regular.ttf b/assets/fonts/Raleway-Regular.ttf deleted file mode 100644 index e570a2d5c..000000000 Binary files a/assets/fonts/Raleway-Regular.ttf and /dev/null differ diff --git a/assets/icons/Info.svg b/assets/icons/Info.svg new file mode 100644 index 000000000..93411f2da --- /dev/null +++ b/assets/icons/Info.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/angel.svg b/assets/icons/angel.svg new file mode 100644 index 000000000..7fa8d6c75 --- /dev/null +++ b/assets/icons/angel.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/icons/angry.svg b/assets/icons/angry.svg new file mode 100644 index 000000000..678171ffe --- /dev/null +++ b/assets/icons/angry.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/assets/icons/happy.svg b/assets/icons/happy.svg new file mode 100644 index 000000000..d883c3441 --- /dev/null +++ b/assets/icons/happy.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/icons/laugh.svg b/assets/icons/laugh.svg new file mode 100644 index 000000000..a6e532f0e --- /dev/null +++ b/assets/icons/laugh.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/icons/love.svg b/assets/icons/love.svg new file mode 100644 index 000000000..4d62a5dc3 --- /dev/null +++ b/assets/icons/love.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/icons/tear.svg b/assets/icons/tear.svg new file mode 100644 index 000000000..0d572d65f --- /dev/null +++ b/assets/icons/tear.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/Group 8948.png b/assets/images/Group 8948.png new file mode 100644 index 000000000..7dcd1b989 Binary files /dev/null and b/assets/images/Group 8948.png differ diff --git a/assets/images/Organisation_Default_Image.jpeg b/assets/images/Organisation_Default_Image.jpeg new file mode 100644 index 000000000..590eb4ca2 Binary files /dev/null and b/assets/images/Organisation_Default_Image.jpeg differ diff --git a/assets/images/Vector.svg b/assets/images/Vector.svg new file mode 100644 index 000000000..2baabbc08 --- /dev/null +++ b/assets/images/Vector.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/blank.jpg b/assets/images/blank.jpg deleted file mode 100644 index f0edff3e8..000000000 Binary files a/assets/images/blank.jpg and /dev/null differ diff --git a/assets/images/cloud1.jpg b/assets/images/cloud1.jpg deleted file mode 100644 index 196c41c67..000000000 Binary files a/assets/images/cloud1.jpg and /dev/null differ diff --git a/assets/images/comment.svg b/assets/images/comment.svg new file mode 100644 index 000000000..cd248c9fb --- /dev/null +++ b/assets/images/comment.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/dashboard.jpg b/assets/images/dashboard.jpg deleted file mode 100644 index b8023a07d..000000000 Binary files a/assets/images/dashboard.jpg and /dev/null differ diff --git a/assets/images/defaultImg.png b/assets/images/defaultImg.png new file mode 100644 index 000000000..310a79c13 Binary files /dev/null and b/assets/images/defaultImg.png differ diff --git a/assets/images/docker_1.jpg b/assets/images/docker_1.jpg deleted file mode 100644 index 7e672073d..000000000 Binary files a/assets/images/docker_1.jpg and /dev/null differ diff --git a/assets/images/docker_2.jpg b/assets/images/docker_2.jpg deleted file mode 100644 index 4cb362afd..000000000 Binary files a/assets/images/docker_2.jpg and /dev/null differ diff --git a/assets/images/docker_3.jpeg b/assets/images/docker_3.jpeg deleted file mode 100644 index a933f8774..000000000 Binary files a/assets/images/docker_3.jpeg and /dev/null differ diff --git a/assets/images/error.svg b/assets/images/error.svg deleted file mode 100644 index 5221f02e1..000000000 --- a/assets/images/error.svg +++ /dev/null @@ -1 +0,0 @@ -server down \ No newline at end of file diff --git a/assets/images/launcher_icon.png b/assets/images/launcher_icon.png new file mode 100644 index 000000000..9ebc349e6 Binary files /dev/null and b/assets/images/launcher_icon.png differ diff --git a/assets/images/login.jpg b/assets/images/login.jpg deleted file mode 100644 index 9f3af9f09..000000000 Binary files a/assets/images/login.jpg and /dev/null differ diff --git a/assets/images/map.png b/assets/images/map.png deleted file mode 100644 index 83f8f170b..000000000 Binary files a/assets/images/map.png and /dev/null differ diff --git a/assets/images/no_internet.png b/assets/images/no_internet.png new file mode 100644 index 000000000..c267a80f5 Binary files /dev/null and b/assets/images/no_internet.png differ diff --git a/assets/images/payment.jpg b/assets/images/payment.jpg deleted file mode 100644 index c991a4bde..000000000 Binary files a/assets/images/payment.jpg and /dev/null differ diff --git a/assets/images/pfp2.png b/assets/images/pfp2.png new file mode 100644 index 000000000..c267a80f5 Binary files /dev/null and b/assets/images/pfp2.png differ diff --git a/assets/images/pk.jpg b/assets/images/pk.jpg deleted file mode 100644 index 16d3449fb..000000000 Binary files a/assets/images/pk.jpg and /dev/null differ diff --git a/assets/images/profile.jpg b/assets/images/profile.jpg deleted file mode 100644 index 13851eca6..000000000 Binary files a/assets/images/profile.jpg and /dev/null differ diff --git a/assets/images/quitoBackground.jpg b/assets/images/quitoBackground.jpg deleted file mode 100644 index 82fdc0251..000000000 Binary files a/assets/images/quitoBackground.jpg and /dev/null differ diff --git a/assets/images/quitologo.png b/assets/images/quitologo.png deleted file mode 100644 index f46e27ad2..000000000 Binary files a/assets/images/quitologo.png and /dev/null differ diff --git a/assets/images/quitologo.svg b/assets/images/quitologo.svg deleted file mode 100644 index 2454e4c54..000000000 --- a/assets/images/quitologo.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/repost.svg b/assets/images/repost.svg new file mode 100644 index 000000000..036dc9442 --- /dev/null +++ b/assets/images/repost.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/setting.jpeg b/assets/images/setting.jpeg deleted file mode 100644 index 269c10948..000000000 Binary files a/assets/images/setting.jpeg and /dev/null differ diff --git a/assets/images/shopping.jpeg b/assets/images/shopping.jpeg deleted file mode 100644 index 1d7fe7f0f..000000000 Binary files a/assets/images/shopping.jpeg and /dev/null differ diff --git a/assets/images/splashscreen.jpg b/assets/images/splashscreen.jpg deleted file mode 100644 index 38ec9aae5..000000000 Binary files a/assets/images/splashscreen.jpg and /dev/null differ diff --git a/images/talawa-logo-lite-200x200.png b/assets/images/talawa-logo-lite-200x200.png similarity index 100% rename from images/talawa-logo-lite-200x200.png rename to assets/images/talawa-logo-lite-200x200.png diff --git a/assets/images/talawaLogo-dark.png b/assets/images/talawaLogo-dark.png deleted file mode 100644 index 0f308a4fd..000000000 Binary files a/assets/images/talawaLogo-dark.png and /dev/null differ diff --git a/assets/images/talawaLogo.png b/assets/images/talawaLogo.png deleted file mode 100644 index f911eee47..000000000 Binary files a/assets/images/talawaLogo.png and /dev/null differ diff --git a/assets/images/team.png b/assets/images/team.png deleted file mode 100644 index 7e063ed50..000000000 Binary files a/assets/images/team.png and /dev/null differ diff --git a/assets/images/timeline.jpeg b/assets/images/timeline.jpeg deleted file mode 100644 index 0836e7f69..000000000 Binary files a/assets/images/timeline.jpeg and /dev/null differ diff --git a/assets/images/verification.jpg b/assets/images/verification.jpg deleted file mode 100644 index 311e38716..000000000 Binary files a/assets/images/verification.jpg and /dev/null differ diff --git "a/assets/images/\360\237\246\206 icon _like_.svg" "b/assets/images/\360\237\246\206 icon _like_.svg" new file mode 100644 index 000000000..686cd5b4e --- /dev/null +++ "b/assets/images/\360\237\246\206 icon _like_.svg" @@ -0,0 +1,3 @@ + + + diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index d4bb2cbb9..000000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 2f7efbeab..000000000 --- a/docs/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-minimal \ No newline at end of file diff --git a/docs/_static/talawa-rtd.png b/docs/_static/talawa-rtd.png deleted file mode 100644 index 255cd2144..000000000 Binary files a/docs/_static/talawa-rtd.png and /dev/null differ diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 9d474a326..000000000 --- a/docs/conf.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Talawa documentation build configuration file, created by -# sphinx-quickstart on Tue Oct 22 22:23:00 2019. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['sphinxcontrib.fulltoc'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = 'Talawa' -copyright = '2019, Peter Harrison' -author = 'Peter Harrison' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '' -# The full version, including alpha/beta/rc tags. -release = '' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'alabaster' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] -html_favicon = '_static/talawa-rtd.png' -html_logo = '_static/talawa-rtd.png' - -# Custom sidebar templates, must be a dictionary that maps document names -# to template names. -# -# This is required for the alabaster theme -# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars -html_sidebars = { - '**': [ - 'globaltoc.html', - 'relations.html', # needs 'show_related': True theme option to display - 'searchbox.html', - ] -} - - -# -- Options for HTMLHelp output ------------------------------------------ - -# Output file base name for HTML help builder. -htmlhelp_basename = 'Talawadoc' - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'Talawa.tex', 'Talawa Documentation', - 'Peter Harrison', 'manual'), -] - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'talawa', 'Talawa Documentation', - [author], 1) -] - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'Talawa', 'Talawa Documentation', - author, 'Talawa', 'One line description of project.', - 'Miscellaneous'), -] diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 5452e5483..000000000 --- a/docs/index.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. talawa documentation master file, created by - sphinx-quickstart on Wed Nov 27 22:46:04 2019. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to talawa's documentation! -================================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - palisadoes - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 2119f5109..000000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/docs/palisadoes.rst b/docs/palisadoes.rst deleted file mode 100644 index bd1e9e7b7..000000000 --- a/docs/palisadoes.rst +++ /dev/null @@ -1,4 +0,0 @@ -About Talawa -============ - -``talawa`` is based on the original ``quito`` code created by the `Palisadoes Foundation `_ as part of its annual Calico Challenge program. Calico provides paid summer internships for Jamaican university students to work on selected open source projects. They are mentored by software professionals and receive stipends based on the completion of predefined milestones. Calico was started in 2015. diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 860b62346..000000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -############################################################################### -# -# Pip packages needed for sphinx extension features -# -############################################################################### -sphinxcontrib-fulltoc diff --git a/flutter_docker/.devcontainer/devcontainer.json b/flutter_docker/.devcontainer/devcontainer.json deleted file mode 100644 index 05b151659..000000000 --- a/flutter_docker/.devcontainer/devcontainer.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "flutter_docker", - "context": "..", - "dockerFile": "../Dockerfile", - "remoteUser": "developer", - "settings": { - "terminal.integrated.shell.linux": null - }, - "runArgs": ["--privileged"], - "extensions": ["dart-code.flutter"], - "workspaceMount": "source=${localWorkspaceFolder}/workspace,target=/home/developer/workspace,type=bind,consistency=delegated", - "workspaceFolder": "/home/developer/workspace" - } \ No newline at end of file diff --git a/flutter_docker/.dockerignore b/flutter_docker/.dockerignore deleted file mode 100644 index 2b3d1884e..000000000 --- a/flutter_docker/.dockerignore +++ /dev/null @@ -1,187 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -.dart_tool/ -.flutter-plugins -.packages -.pub-cache/ -.pub/ -/build/ -.flutter-plugins-dependencies - -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java - -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/Flutter/flutter_export_environment.sh -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages -# Sphinx documentation -docs/_build/ - - -############################################################################### -# Generic Python Exclusions (Provided by GitHub) -# -# Created by https://www.gitignore.io/api/python -# Edit at https://www.gitignore.io/?templates=python -############################################################################### - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ diff --git a/flutter_docker/Dockerfile b/flutter_docker/Dockerfile deleted file mode 100644 index d59028502..000000000 --- a/flutter_docker/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM ubuntu:18.04 - -# Prerequisites -RUN apt update && apt install -y curl git unzip xz-utils zip libglu1-mesa openjdk-8-jdk wget - -# Set up new user -RUN useradd -ms /bin/bash developer -USER developer -WORKDIR /home/developer - -# Prepare Android directories and system variables -RUN mkdir -p Android/sdk -ENV ANDROID_SDK_ROOT /home/developer/Android/sdk -RUN mkdir -p .android && touch .android/repositories.cfg - -# Set up Android SDK -RUN wget -O sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -RUN unzip sdk-tools.zip && rm sdk-tools.zip -RUN mv tools Android/sdk/tools -RUN cd Android/sdk/tools/bin && yes | ./sdkmanager --licenses -RUN cd Android/sdk/tools/bin && ./sdkmanager "build-tools;29.0.2" "patcher;v4" "platform-tools" "platforms;android-29" "sources;android-29" -ENV PATH "$PATH:/home/developer/Android/sdk/platform-tools" - -# Download Flutter SDK -RUN git clone https://github.com/flutter/flutter.git -ENV PATH "$PATH:/home/developer/flutter/bin" - -# Run basic check to download Dark SDK -RUN flutter doctor \ No newline at end of file diff --git a/flutter_docker/workspace/readme.md b/flutter_docker/workspace/readme.md deleted file mode 100644 index ee4958a21..000000000 --- a/flutter_docker/workspace/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -Just put the whole project inside this folder - -

1. First install Remote Development from extension

- -

2. You will see that an icon is displayed on the bottom-left corner of the VS Code window.

-     - -Click on this icon. - - -     - -

Select the option Remote-Containers: Open Folder in Container.

-   - -     - -

Select the root directory which contains the Dockerfile (along with some other settings) and click on Open to start building the Docker container. This will take some time, as it will download and set up all the tools in the container.

- - -    - -

After the build finishes, you will be taken to the bash terminal of the Docker container.

- diff --git a/images/talawa-logo-dark-200x200.png b/images/talawa-logo-dark-200x200.png deleted file mode 100644 index 11f3402ac..000000000 Binary files a/images/talawa-logo-dark-200x200.png and /dev/null differ diff --git a/images/talawa-logo-dark-600x600.png b/images/talawa-logo-dark-600x600.png deleted file mode 100644 index 37e42c7ca..000000000 Binary files a/images/talawa-logo-dark-600x600.png and /dev/null differ diff --git a/images/talawa-logo-lite-600x600.png b/images/talawa-logo-lite-600x600.png deleted file mode 100644 index e85dcca64..000000000 Binary files a/images/talawa-logo-lite-600x600.png and /dev/null differ diff --git a/images/talawa-rtd-transparent-dark.png b/images/talawa-rtd-transparent-dark.png deleted file mode 100644 index 48ca9e22b..000000000 Binary files a/images/talawa-rtd-transparent-dark.png and /dev/null differ diff --git a/images/talawa-rtd-transparent.png b/images/talawa-rtd-transparent.png deleted file mode 100644 index 2a6e2beab..000000000 Binary files a/images/talawa-rtd-transparent.png and /dev/null differ diff --git a/images/talawa-rtd.png b/images/talawa-rtd.png deleted file mode 100644 index 255cd2144..000000000 Binary files a/images/talawa-rtd.png and /dev/null differ diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 000000000..151026b91 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,33 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f78a..8d4492f97 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable App CFBundleIdentifier @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 9.0 diff --git a/ios/Podfile b/ios/Podfile index 1e8c3c90a..2c068c404 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 000000000..8d5953fa6 --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,115 @@ +PODS: + - connectivity_plus (0.0.1): + - Flutter + - Reachability + - Flutter (1.0.0) + - FMDB (2.7.5): + - FMDB/standard (= 2.7.5) + - FMDB/standard (2.7.5) + - image_cropper (0.0.4): + - Flutter + - TOCropViewController (~> 2.6.1) + - image_picker (0.0.1): + - Flutter + - MTBBarcodeScanner (5.0.11) + - path_provider_ios (0.0.1): + - Flutter + - "permission_handler (5.1.0+2)": + - Flutter + - qr_code_scanner (0.2.0): + - Flutter + - MTBBarcodeScanner + - quick_actions (0.0.1): + - Flutter + - Reachability (3.2) + - shared_preferences (0.0.1): + - Flutter + - social_share (0.0.1): + - Flutter + - sqflite (0.0.2): + - Flutter + - FMDB (>= 2.7.5) + - TOCropViewController (2.6.1) + - uni_links (0.0.1): + - Flutter + - vibration (1.7.4-nullsafety.0): + - Flutter + - video_player (0.0.1): + - Flutter + +DEPENDENCIES: + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) + - Flutter (from `Flutter`) + - image_cropper (from `.symlinks/plugins/image_cropper/ios`) + - image_picker (from `.symlinks/plugins/image_picker/ios`) + - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) + - permission_handler (from `.symlinks/plugins/permission_handler/ios`) + - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) + - quick_actions (from `.symlinks/plugins/quick_actions/ios`) + - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - social_share (from `.symlinks/plugins/social_share/ios`) + - sqflite (from `.symlinks/plugins/sqflite/ios`) + - uni_links (from `.symlinks/plugins/uni_links/ios`) + - vibration (from `.symlinks/plugins/vibration/ios`) + - video_player (from `.symlinks/plugins/video_player/ios`) + +SPEC REPOS: + trunk: + - FMDB + - MTBBarcodeScanner + - Reachability + - TOCropViewController + +EXTERNAL SOURCES: + connectivity_plus: + :path: ".symlinks/plugins/connectivity_plus/ios" + Flutter: + :path: Flutter + image_cropper: + :path: ".symlinks/plugins/image_cropper/ios" + image_picker: + :path: ".symlinks/plugins/image_picker/ios" + path_provider_ios: + :path: ".symlinks/plugins/path_provider_ios/ios" + permission_handler: + :path: ".symlinks/plugins/permission_handler/ios" + qr_code_scanner: + :path: ".symlinks/plugins/qr_code_scanner/ios" + quick_actions: + :path: ".symlinks/plugins/quick_actions/ios" + shared_preferences: + :path: ".symlinks/plugins/shared_preferences/ios" + social_share: + :path: ".symlinks/plugins/social_share/ios" + sqflite: + :path: ".symlinks/plugins/sqflite/ios" + uni_links: + :path: ".symlinks/plugins/uni_links/ios" + vibration: + :path: ".symlinks/plugins/vibration/ios" + video_player: + :path: ".symlinks/plugins/video_player/ios" + +SPEC CHECKSUMS: + connectivity_plus: 5f0eb61093bec56935f21a1699dd2758bc895587 + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a + image_cropper: 60c2789d1f1a78c873235d4319ca0c34a69f2d98 + image_picker: e06f7a68f000bd36f552c1847e33cda96ed31f1f + MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb + path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5 + permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 + qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e + quick_actions: 6cb2390c4dab0e737c94573c27e18d9666710720 + Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 + shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d + social_share: 702a5e3842addd22db515aa9e1e00a4b80a0296d + sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 + TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863 + uni_links: d97da20c7701486ba192624d99bffaaffcfc298a + vibration: 1ec279c4a1a7a646627b54039d812334b3f1114a + video_player: ecd305f42e9044793efd34846e1ce64c31ea6fcb + +PODFILE CHECKSUM: fe0e1ee7f3d1f7d00b11b474b62dd62134535aea + +COCOAPODS: 1.11.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index d5dbccf66..39eccc98c 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,21 +3,18 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 6915D38338D0ADAB147B5DB7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11EBC6466495142DFCF23943 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + AA09F252DE0CCC7E69DE3E12 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 69935DC81F37E501ACAA4312 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -27,8 +24,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -36,21 +31,26 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 11EBC6466495142DFCF23943 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 1EAE81F3FE5F67128E58B85C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 69935DC81F37E501ACAA4312 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 786A3858C1D311840AA1B4F9 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 93F84FD8134080F559F7DA61 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + C1864E0A0142AEF880972331 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + F0F18908A6BD606AFFAECAC6 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -58,20 +58,25 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + AA09F252DE0CCC7E69DE3E12 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 15ED1F9ED2C51FEC3C38506F /* Frameworks */ = { + isa = PBXGroup; + children = ( + 69935DC81F37E501ACAA4312 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -85,6 +90,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 987BE9FBF8B99A813F359646 /* Pods */, + 15ED1F9ED2C51FEC3C38506F /* Frameworks */, ); sourceTree = ""; }; @@ -103,7 +110,6 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, @@ -112,11 +118,15 @@ path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { + 987BE9FBF8B99A813F359646 /* Pods */ = { isa = PBXGroup; children = ( + 93F84FD8134080F559F7DA61 /* Pods-Runner.debug.xcconfig */, + C1864E0A0142AEF880972331 /* Pods-Runner.release.xcconfig */, + F0F18908A6BD606AFFAECAC6 /* Pods-Runner.profile.xcconfig */, ); - name = "Supporting Files"; + name = Pods; + path = Pods; sourceTree = ""; }; /* End PBXGroup section */ @@ -126,12 +136,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 7AE1B0F508BCAB74F4600E45 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + F5E55538C6E5FA6AF4D9E28D /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -148,17 +160,17 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "The Chromium Authors"; + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0910; + LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -182,7 +194,6 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -191,6 +202,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 13FF27AB0F3886FAC5A400E8 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -203,7 +236,29 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 7AE1B0F508BCAB74F4600E45 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -219,6 +274,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + F5E55538C6E5FA6AF4D9E28D /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -255,7 +327,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -295,9 +366,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -311,27 +383,18 @@ CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.talawa; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -377,7 +440,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -387,7 +450,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -427,9 +489,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -444,21 +507,13 @@ CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.talawa; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -471,20 +526,12 @@ CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.talawa; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; @@ -513,7 +560,6 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ - }; rootObject = 97C146E61CF9000F007C117D /* Project object */; -} \ No newline at end of file +} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a16e..919434a62 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140cfd..3db53b6e1 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png new file mode 100644 index 000000000..11d3da689 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png new file mode 100644 index 000000000..4ec6dfae1 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png new file mode 100644 index 000000000..f40d5e03f Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png new file mode 100644 index 000000000..37acc361b Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png new file mode 100644 index 000000000..9b1922180 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png new file mode 100644 index 000000000..463b58b71 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png new file mode 100644 index 000000000..d93204039 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png new file mode 100644 index 000000000..a6393d471 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png new file mode 100644 index 000000000..cac6dfba0 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png new file mode 100644 index 000000000..cda9658a6 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png new file mode 100644 index 000000000..fbde3620c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d36b1fab2..73d3b7f6d 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,122 +1 @@ -{ - "images" : [ - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} +{"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"}]} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index f472b67ad..dc9ada472 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 46245e454..28c6bf030 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index e7e7745f8..2ccbfd967 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index a2236424a..f091b6b0b 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 8fcdc1d45..4cde12118 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index 615992563..d0ef06e7e 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index 6ffba00de..dcdc2306c 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index e7e7745f8..2ccbfd967 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index 99f4ea17e..c8f9ed8f5 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index 2c62dd854..a6d6b8609 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index 2c62dd854..a6d6b8609 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index ab2330c7a..75b2d164a 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index 36440c208..c4df70d39 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index 85d022daf..6a84f41e1 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index cdc07c6c6..d0e1f5853 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json new file mode 100644 index 000000000..9f447e1b3 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "background.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png new file mode 100644 index 000000000..e29b3b59f Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json index 0bedcf2fd..00cabce83 100644 --- a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -1,23 +1,23 @@ { "images" : [ { - "idiom" : "universal", "filename" : "LaunchImage.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "LaunchImage@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "LaunchImage@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } } diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png index 9da19eaca..67774cf3d 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png index 9da19eaca..67774cf3d 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png index 9da19eaca..67774cf3d 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard index f2e259c7c..c9811f020 100644 --- a/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -16,13 +16,19 @@ - - + + - - + + + + + + + + @@ -33,5 +39,6 @@ + - + \ No newline at end of file diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index eefdf9b21..f7df0c453 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -1,53 +1,68 @@ - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - talawa - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - NSPhotoLibraryUsageDescription - Allow access to photo library - - NSCameraUsageDescription - Allow access to camera to capture photos - - NSMicrophoneUsageDescription - Allow access to microphone + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + talawa + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + UIStatusBarHidden + + LSApplicationQueriesSchemes + + instagram-stories + facebook-stories + facebook + instagram + twitter + whatsapp + tg + + io.flutter.embedded_views_preview + + NSCameraUsageDescription + This app needs camera access to scan QR codes + LSApplicationQueriesSchemes + + sms + tel + + NSPhotoLibraryUsageDescription + Allow access to photo library - + \ No newline at end of file diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h index 7335fdf90..308a2a560 100644 --- a/ios/Runner/Runner-Bridging-Header.h +++ b/ios/Runner/Runner-Bridging-Header.h @@ -1 +1 @@ -#import "GeneratedPluginRegistrant.h" \ No newline at end of file +#import "GeneratedPluginRegistrant.h" diff --git a/issue-guidelines.md b/issue-guidelines.md deleted file mode 100644 index 06be31f47..000000000 --- a/issue-guidelines.md +++ /dev/null @@ -1,15 +0,0 @@ -# Issue Report Guidelines - -:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: - -In order to give everyone a chance to submit a issues reports and contribute to the Talawa project, we have put restrictions in place. This section outlines the guidelines that should be imposed upon issue reports in the Talawa project. - -1. Use the [GitHub open issue search](https://github.com/PalisadoesFoundation/talawa/issues) — check if the issue has already been reported. -2. If the issue is already reported and not assigned to anyone, if you are interested to work on the issue then ask mentors to assign it to you in #talawa slack channel. -3. Check if the issue has been fixed — try to reproduce it using the latest master or development branch in the repository. -4. For newly found unfixed issues or features: - 1. Start discussing it in #gsoc-newissues channel with mentors - 2. Please do not derail or troll issues. - 3. Keep the discussion on topic and respect the opinions of others. -6. After mentor approval you can create a new issue by following [issue template](https://github.com/PalisadoesFoundation/talawa/blob/master/.github/ISSUE_TEMPLATE/issue-template.md) available here. -7. Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the mentors of the merits of this feature. Please provide as much detail and context as possible. diff --git a/lang/de.json b/lang/de.json new file mode 100644 index 000000000..d1e979820 --- /dev/null +++ b/lang/de.json @@ -0,0 +1,282 @@ +{ + "Hello": "Hallo", + "User Name": "Nutzername", + "we've": "temos", + "got you covered": "hast du abgedeckt", + "password": "Passwort", + "Enter new password": "Neues Passwort eingeben", + "Re-Enter your password": "Wiederhole die Eingabe deines Passwortes", + "Change Password": "Passwort ändern", + "Email Hint": "test@test.org", + "Enter your registered Email": "Geben Sie Ihre registrierte E-Mail-Adresse ein", + "Enter your password": "Geben Sie Ihr Passwort ein", + "Forgot password": "Passwort vergessen", + "Login": "Anmeldung", + "Sit back relax, we'll": "Lehnen Sie sich entspannt zurück, wir werden", + "Recover": "Genesen", + "your password": "Ihr Passwort", + "Recover Password": "Passwort wiederherstellen", + "Select Language": "Sprache auswählen", + "Default": "Standard", + "Select": "Auswählen", + "Selected Organization": "Ausgewählte Organisation", + "Continue": "Weitermachen", + "Enter Community URL": "Geben Sie die Community-URL ein", + "Verify": "Verifizieren", + "Sign Up": "Anmeldung", + "Change language": "Sprache ändern", + "First Name Hint": "John", + "Enter your first name": "Geben Sie Ihren Vornamen ein", + "Last Name Hint": "Carlos", + "Enter your last name": "Geben Sie Ihren Nachnamen ein", + "Confirm your password": "Bestätigen Sie Ihr Passwort", + "Next": "Nächste", + "Request Sent to": "Anfrage gesendet an", + "Log out": "Ausloggen", + "Join": "Verbinden", + "and": "und", + "Collaborate": "Zusammenarbeiten", + "with your": "mit Ihrem", + "Organizations": "Organisationen", + "Title from the viewMode GSoC branch": "Titel aus dem Ansichtsmodus GSoC-Zweig", + "Please verify URL first": "Bitte zuerst URL bestätigen", + "Enter a valid URL": "Geben Sie eine gültige URL ein", + "Firstname must not be left blank.": "Der Vorname darf nicht leer bleiben.", + "Invalid Firstname": "Ungültiger Vorname", + "Lastname must not be left blank.": "Der Nachname darf nicht leer bleiben.", + "Invalid Lastname": "Ungültiger Nachname", + "Email must not be left blank": "E-Mail darf nicht leer sein", + "Please enter a valid Email Address": "Bitte geben Sie eine gültige E-Mail-Adresse ein", + "Password must not be left blank": "Passwort darf nicht leer bleiben", + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)": "Ihr Passwort muss mindestens 8 Zeichen lang sein, mindestens eine Ziffer, einen Groß- und einen Kleinbuchstaben und ein Sonderzeichen (@, #, $, etc.) enthalten.", + "Password must not contain spaces": "Passwort darf keine Leerzeichen enthalten", + "Password does not match original": "Passwort stimmt nicht mit Original überein", + "Join Organisation": "Der Organisation beitreten", + "We're": "Wurden", + "Glad": "Froh", + "you're": "du bist", + "Back": "Zurück", + "Let's": "Lasst uns", + "get": "werden", + "you": "Sie", + "SignUp": "Anmeldung", + "Please wait": "Warten Sie mal", + "for organisation(s) to accept your invitation.": "für Organisationen, um Ihre Einladung anzunehmen.", + "Add Event Title": "Ereignistitel hinzufügen", + "Where is the event": "Wo ist die Veranstaltung", + "Add Location": "Ort hinzufügen", + "Describe the event": "Beschreiben Sie die Veranstaltung", + "Add Description": "Beschreibung hinzufügen", + "Add Event": "Ereignis hinzufügen", + "Add": "Anzeige", + "Add Image": "Bild hinzufügen", + "Select Start Date": "Startdatum auswählen", + "Select End Date": "Enddatum auswählen", + "Select Start Date and Time": "Wählen Sie Startdatum und -uhrzeit", + "Select End Date and Time": "Wählen Sie Enddatum und -uhrzeit", + "Does not repeat": "Wiederholt sich nicht", + "Keep Public": "Öffentlich halten", + "Keep Registerable": "Registrierbar bleiben", + "Event Details": "Veranstaltungsdetails", + "Register": "Registrieren", + "Created by": "Erstellt von", + "public": "öffentlich", + "private": "Privatgelände", + "Description": "Beschreibung", + "Admins": "Admins", + "Attendees": "Teilnehmerinnen", + "See all": "Alles sehen", + "Start Date": "Startdatum", + "End Date": "Endtermin", + "Cancel": "Abbrechen", + "Done": "Fertig", + "Explore Events": "Veranstaltungen erkunden", + "Filters": "Filter", + "Filter by Date": "Filtern nach Datum", + "Show all events": "Alle Veranstaltungen anzeigen", + "Show all events created by you": "Alle Veranstaltungen anzeigen, die von Ihnen erstellt wurden", + "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", + "Public Events": "Öffentliche Veranstaltungen", + "Private Events": "Private Veranstaltungen", + "Liked by": "Beliebt bei", + "Comments": "Kommentare", + "FirstName LastName": "Vorname Nachname", + "Pinned Posts": "Angepinnte Beiträge", + "Profile": "Profil", + "Email": "Email", + "Update": "Aktualisieren", + "App Settings": "App Einstellungen", + "Language": "Sprache", + "dark mode": "Dunkelmodus", + "font size": "Schriftgröße", + "Help": "Hilfe", + "Reach out to us for help": "Wenden Sie sich an uns, um Hilfe zu erhalten", + "Donate Us": "Spenden Sie uns", + "Help us to develop for you": "Helfen Sie uns, für Sie zu entwickeln", + "Log out from Talawa": "Abmelden von Talawa", + "Share News": "Neuigkeiten teilen", + "Post": "Post", + "Organization Name": "Organisationsname", + "Add hasthtag": "Hashtag hinzufügen", + "Write here what do you want to share": "Schreiben Sie hier, was Sie teilen möchten", + "Join selected organisation": "Ausgewählter Organisation beitreten", + "Home": "Heim", + "Events": "Veranstaltungen", + "Chat": "Plaudern", + "Chat Screen": "Chat-Bildschirm", + "Confirm": "Bestätigen Sie", + "Confirmation": "Bestätigung", + "Close": "Nah dran", + "Switch Organization": "Organisation wechseln", + "Join new Organization": "Treten Sie einer neuen Organisation bei", + "Leave Current Organization": "Aktuelle Organisation verlassen", + "Creator": "Schöpferin", + "Public": "Öffentlich", + "Private": "Privatgelände", + "No Internet": "Ohne Internet", + "Subscribed": "Gezeichnet", + "from": "von", + "See all Pinned news": "Alle gepinnten Nachrichten ansehen", + "show more": "Zeig mehr", + "show less": "zeige weniger", + "Likes": "Likes", + "comments": "Kommentare", + "Final": "Finale", + "Enter Details": "Details eingeben", + "Select\nOrganization": "Organisation\nauswählen", + "already selected": "bereits ausgewählt", + "Switched to": "Gewechselt zu", + "Organisation already joined": "Organisation bereits beigetreten", + "Membership request already sent": "Mitgliedsantrag bereits gesendet", + "Select one organization to continue": "Wählen Sie eine Organisation aus, um fortzufahren", + "Something went wrong": "Etwas ist schief gelaufen", + "Join in request sent to": "Beitrittsanfrage gesendet an", + "successfully": "erfolgreich", + "Are you sure you want to logout?": "Möchten Sie sich wirklich abmelden?", + "Logout": "Ausloggen", + "Settings": "Einstellungen", + "Dark Theme": "Dunkles Thema", + "Error": "Fout", + "Warning": "Waarschuwing", + "Information": "Informatie", + "No account registered with this email": "Server werkt niet/verkeerde url", + "Dismiss": "afwijzen", + "No organizations found Please contact your admin": "Geen organisaties gevonden! Neem contact op met uw beheerder", + "Notification Feature is not installed": "Meddelelsesfunktionen er ikke installeret", + "For complete access, please": "Für vollständigen Zugriff bitte", + "join an organization.": " einer Organisation beitreten.", + "JOIN": "BEITRETEN", + "Camera": "Kamera", + "Gallery": "Galerie", + "NEXT": "NÄCHSTE", + "COMPLETE": "VOLLSTÄNDIG", + "Start app tour to know talawa functioning": "Starten Sie die App-Tour, um die Funktionsweise von Talawa zu erfahren", + "Scan QR": "QR scannen", + "Add tag": "Tag hinzufügen", + "Enter the Tag": "Geben Sie das Tag ein", + "Title": "Titel", + "Where is the event?": "Wo ist das Ereignis?", + "Add Members": "Mitglieder hinzufügen", + "All Events": "Alle Veranstaltungen", + "Created Events": "Erstellte Veranstaltungen", + "Registered Events": "Registrierte Veranstaltungen", + "Send": "Senden", + "Write your comment here..": "Schreiben Sie hier Ihren Kommentar..", + "You need access": "Sie benötigen Zugang", + "Request access, or switch to an account with access": "Fordern Sie Zugang an oder wechseln Sie zu einem Konto mit Zugang", + "Request Access": "Zugang anfordern", + "Last Name": "Nachname", + "First Name": "Vorname", + "Edit Profile": "Profil bearbeiten", + "Log Out": "Ausloggen", + "Please Select an amount": "Bitte wählen Sie einen Betrag", + "Input custom amount": "Benutzerdefinierten Betrag eingeben", + "Organisation Name": "Name der Organisation", + "Choose an Organization": "Wählen Sie eine Organisation", + "Your Report has been sent to the Admin": "Ihr Bericht wurde an den Admin gesendet", + "Report the post to the Admin": "Melden Sie den Beitrag dem Admin", + "Do you really want to delete the post?": "Möchten Sie den Beitrag wirklich löschen?", + "Liked": "Gefällt", + "Looks like there aren't any events.": "Es scheint keine Veranstaltungen zu geben.", + "You have not created any event.": "Sie haben keine Veranstaltung erstellt.", + "No registered events are present": "Keine registrierten Veranstaltungen vorhanden", + "There aren't any public events.": "Es gibt keine öffentlichen Veranstaltungen.", + "There aren't any private events.": "Es gibt keine privaten Veranstaltungen.", + "Donate to the Community": "An die Gemeinschaft spenden", + "Donating to": "Spenden an", + "Are you sure you want to delete this event?": "Sind Sie sicher, dass Sie diese Veranstaltung löschen möchten?", + "Are you sure you want to exit this organization?": "Sind Sie sicher, dass Sie diese Organisation verlassen möchten?", + "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc": "Dies ist der Profil-Tab, hier können Sie alle Optionen im Zusammenhang mit dem Konto, den App-Einstellungen, der Einladung, der Hilfe usw. sehen", + "You can edit application settings like language, theme etc from here": "Sie können die Einstellungen der Anwendung wie Sprache, Thema usw. von hier aus bearbeiten", + "For any help we are always there. You can reach us from here": "Für jede Hilfe sind wir immer da. Sie können uns von hier aus erreichen", + "Current selected Organization Name": "Name der aktuell ausgewählten Organisation", + "Click this button to see options related to switching, joining and leaving organization(s)": "Klicken Sie auf diese Schaltfläche, um Optionen zum Wechseln, Beitreten und Verlassen von Organisation(en) zu sehen", + "Current selected Organization's Name appears here": "Der Name der aktuell ausgewählten Organisation erscheint hier", + "All your joined organizations appear over here you can click on them to change the current organization": "Alle beigetretenen Organisationen erscheinen hier, Sie können darauf klicken, um die aktuelle Organisation zu wechseln", + "From this button you can join other listed organizations": "Über diese Schaltfläche können Sie anderen aufgeführten Organisationen beitreten", + "To leave the current organization you can use this option": "Um die aktuelle Organisation zu verlassen, können Sie diese Option nutzen", + "This is the post card you can like and comment on the post from the options available": "Dies ist die Postkarte, Sie können den Beitrag über die verfügbaren Optionen liken und kommentieren", + "This is the Events tab here you can see all event related information of the current selected organization": "Dies ist der Veranstaltungs-Tab, hier können Sie alle ereignisbezogenen Informationen der aktuell ausgewählten Organisation sehen", + "This is the home tab here you can see the latest post from other members of the current organization": "Dies ist der Home-Tab, hier können Sie den neuesten Beitrag von anderen Mitgliedern der aktuellen Organisation sehen", + "This section displays all the important post set by the organization admin(s)": "Dieser Abschnitt zeigt alle wichtigen Beiträge, die von den Admin(s) der Organisation festgelegt wurden", + "Filter Events based on categories": "Veranstaltungen nach Kategorien filtern", + "Filter Events between selected dates": "Veranstaltungen zwischen ausgewählten Daten filtern", + "Description of event to see more details click on the card": "Beschreibung der Veranstaltung, um weitere Details zu sehen, klicken Sie auf die Karte", + "This is the Create post tab here you can add post to the current selected organization": "Dies ist der Tab 'Beitrag erstellen', hier können Sie der aktuell ausgewählten Organisation einen Beitrag hinzufügen", + "This is the Chat tab here you can see all your messages of the current selected organization": "Dies ist der Chat-Tab, hier können Sie alle Ihre Nachrichten der aktuell ausgewählten Organisation sehen", + "To help your organization grow you can support them financially from here": "Um Ihre Organisation zu unterstützen, können Sie sie finanziell von hier aus unterstützen.", + "You have no event in this organization": "Sie haben keine Veranstaltung in dieser Organisation", + "Create your first event": "Erstellen Sie Ihr erstes Event", + "You are all set to go let's get you in": "Sie sind bereit zu gehen, lassen Sie uns Ihnen helfen.", + "There are no posts in this organization": "Es gibt keine Beiträge in dieser Organisation", + "Create your first post": "Erstellen Sie Ihren ersten Beitrag", + "You have no post in this organization": "Sie haben keinen Beitrag in dieser Organisation", + "You can create a new event from here": "Hier können Sie eine neue Veranstaltung erstellen", + "You are all set to go lets get you in": "Sie sind bereit zu gehen, lassen Sie uns Sie hereinbringen", + "App Tour": "App-Tour", + "Start": "Starten", + "Skip": "Überspringen", + "Posts": "Beiträge", + "Tasks": "Aufgaben", + "Or": "Oder", + "Please select any amount": "Bitte wählen Sie einen Betrag aus", + "Registered": "Registriert", + "Not Registrable": "Nicht registrierbar", + "Enter the title of your post": "Gib den Titel deines Beitrags ein", + "General": "Allgemein", + "Help & Support": "Hilfe & Support", + "Talawa Docs": "Talawa Dokumentation", + "All day": "Den ganzen Tag", + "Join an Organisation": "Einer Organisation beitreten", + "DONATE": "SPENDEN", + "Permission Denied": "Berechtigung verweigert", + "Camera permission is required, to use this feature, give permission from app settings": "Die Kamera-Berechtigung ist erforderlich, um diese Funktion zu verwenden. Erteilen Sie die Berechtigung über die App-Einstellungen.", + "SETTINGS": "EINSTELLUNGEN", + "LogOut": "Ausloggen", + "Membership request already exist": "Mitgliedsantrag existiert bereits", + "Enter a valid password": "Geben Sie ein gültiges Passwort ein", + "Organization Not Found": "Organisation nicht gefunden", + "Account with this email already registered": "Konto mit dieser E-Mail bereits registriert", + "Something went wrong!": "Etwas ist schief gelaufen!", + "URL doesn't exist/no connection please check": "URL existiert nicht/keine Verbindung, bitte überprüfen Sie", + "The QR is not Working": "Der QR-Code funktioniert nicht", + "This QR version is not Supported.": "Diese QR-Version wird nicht unterstützt.", + "Comment sent": "Kommentar gesendet", + "Server not running/wrong url": "Server wird nicht ausgeführt/falsche URL", + "Couldn't update User details": "Benutzerdetails konnten nicht aktualisiert werden", + "Image is added": "Bild hinzugefügt", + "Post is uploaded": "Beitrag hochgeladen", + "Profile updated successfully": "Profil erfolgreich aktualisiert", + "The Camera is not working": "Die Kamera funktioniert nicht", + "This QR is not for the App": "Dieser QR-Code ist nicht für die App", + "The tag was added": "Der Tag wurde hinzugefügt", + "Start time must be before end time": "Die Startzeit muss vor der Endzeit liegen", + "Organisation on different server, logout and scan qr again": "Organisation auf einem anderen Server, ausloggen und QR-Code erneut scannen", + "Post was deleted if you had the rights!": "Der Beitrag wurde gelöscht, wenn Sie die Berechtigungen hatten!", + "Members": "Mitglieder" +} diff --git a/lang/en.json b/lang/en.json new file mode 100644 index 000000000..a110b9ae4 --- /dev/null +++ b/lang/en.json @@ -0,0 +1,282 @@ +{ + "Hello": "Hello", + "User Name": "User Name", + "we've": "we've", + "got you covered": "got you covered", + "password": "password", + "Enter new password": "Enter new password", + "Re-Enter your password": "Re-Enter your password", + "Change Password": "Change Password", + "Email Hint": "test@test.org", + "Enter your registered Email": "Enter your registered Email", + "Enter your password": "Enter your password", + "Forgot password": "Forgot password", + "Login": "Login", + "Notification Feature is not installed": "Notification Feature is not installed", + "Sit back relax, we'll": "Sit back relax, we'll", + "Recover": "Recover", + "your password": "your password", + "Recover Password": "Recover Password", + "Select Language": "Select Language", + "Default": "Default", + "Select": "Select", + "Selected Organization": "Selected Organization", + "Continue": "Continue", + "Enter Community URL": "Enter Community URL", + "Verify": "Verify", + "Sign Up": "Sign Up", + "Change language": "Change language", + "First Name Hint": "John", + "Enter your first name": "Enter your first name", + "Last Name Hint": "Carlos", + "Enter your last name": "Enter your last name", + "Confirm your password": "Confirm your password", + "Next": "Next", + "Request Sent to": "Request Sent to", + "Log out": "Log out", + "Error": "Error", + "Warning": "Warning", + "Information": "Information", + "No account registered with this email": "No account registered with this email", + "Dismiss": "Dismiss", + "Join": "Join", + "and": "and", + "Collaborate": "Collaborate", + "with your": "with your", + "Organizations": "Organizations", + "Title from the viewMode GSoC branch": "Title from the viewMode GSoC branch", + "Please verify URL first": "Please verify URL first", + "Enter a valid URL": "Enter a valid URL", + "Firstname must not be left blank.": "Firstname must not be left blank.", + "Invalid Firstname": "Invalid Firstname", + "Lastname must not be left blank.": "Lastname must not be left blank.", + "Invalid Lastname": "Invalid Lastname", + "Email must not be left blank": "Email must not be left blank", + "Please enter a valid Email Address": "Please enter a valid Email Address", + "Password must not be left blank": "Password must not be left blank", + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)": "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)", + "Password must not contain spaces": "Password must not contain spaces", + "Password does not match original": "Password does not match original", + "Join Organisation": "Join Organisation", + "We're": "We're", + "Glad": "Glad", + "you're": "you're", + "Back": "Back", + "Let's": "Let's", + "get": "get", + "you": "you", + "SignUp": "SignUp", + "Please wait": "Please wait", + "for organisation(s) to accept your invitation.": "for organisation(s) to accept your invitation.", + "Add Event Title": "Add Event Title", + "Where is the event": "Where is the event", + "Add Location": "Add Location", + "Describe the event": "Describe the event", + "Add Description": "Add Description", + "Add Event": "Add Event", + "Add": "Add", + "Add Image": "Add Image", + "Select Start Date": "Select Start Date", + "Select End Date": "Select End Date", + "Select Start Date and Time": "Select Start Date and Time", + "Select End Date and Time": "Select End Date and Time", + "Does not repeat": "Does not repeat", + "Keep Public": "Keep Public", + "Keep Registerable": "Keep Registerable", + "Event Details": "Event Details", + "Register": "Register", + "Created by": "Created by", + "public": "public", + "private": "private", + "Description": "Description", + "Admins": "Admins", + "Attendees": "Attendees", + "See all": "See all", + "Start Date": "Start Date", + "End Date": "End Date", + "Cancel": "Cancel", + "Done": "Done", + "Explore Events": "Explore Events", + "Filters": "Filters", + "Filter by Date": "Filter by Date", + "Show all events": "Show all events", + "Show all events created by you": "Show all events created by you", + "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", + "Public Events": "Public Events", + "Private Events": "Private Events", + "Liked by": "Liked by", + "Comments": "Comments", + "FirstName LastName": "FirstName LastName", + "Pinned Posts": "Pinned Posts", + "Profile": "Profile", + "Email": "Email", + "Update": "Update", + "App Settings": "App Settings", + "Language": "Language", + "dark mode": "dark mode", + "font size": "font size", + "Help": "Help", + "Reach out to us for help": "Reach out to us for help", + "Donate Us": "Donate Us", + "Help us to develop for you": "Help us to develop for you", + "Log out from Talawa": "Log out from Talawa", + "Share News": "Share News", + "Post": "Post", + "Organization Name": "Organization Name", + "Add hasthtag": "Add hasthtag", + "Write here what do you want to share": "Write here what do you want to share", + "Join selected organisation": "Join selected organisation", + "Home": "Home", + "Events": "Events", + "Chat": "Chat", + "Chat Screen": "Chat Screen", + "Confirm": "Confirm", + "Confirmation": "Confirmation", + "Close": "Close", + "Switch Organization": "Switch Organization", + "Join new Organization": "Join new Organization", + "Leave Current Organization": "Leave Current Organization", + "Creator": "Creator", + "Public": "Public", + "Private": "Private", + "No Internet": "No Internet", + "Subscribed": "Subscribed", + "from": "from", + "See all Pinned news": "See all Pinned news", + "show more": "show more", + "show less": "show less", + "Likes": "Likes", + "comments": "comments", + "Final": "Final", + "Enter Details": "Enter Details", + "Select\nOrganization": "Select\nOrganization", + "already selected": "already selected", + "Switched to": "Switched to", + "Organisation already joined": "Organisation already joined", + "Membership request already sent": "Membership request already sent", + "Select one organization to continue": "Select one organization to continue", + "Something went wrong": "Something went wrong", + "Join in request sent to": "Join in request sent to", + "successfully": "successfully", + "Are you sure you want to logout?": "Are you sure you want to logout?", + "Logout": "Logout", + "Settings": "Settings", + "Dark Theme": "Dark Theme", + "No organizations found Please contact your admin": "No organizations found ! Please contact your admin", + "For complete access, please": "For complete access, please", + "join an organization.": " join an organization.", + "JOIN": "JOIN", + "Camera": "Camera", + "Gallery": "Gallery", + "NEXT": "NEXT", + "COMPLETE": "COMPLETE", + "Start app tour to know talawa functioning": "Start app tour to know talawa functioning", + "Scan QR": "Scan QR", + "Add tag": "Add tag", + "Enter the Tag": "Enter the Tag", + "Title": "Title", + "Where is the event?": "Where is the event?", + "Add Members": "Add Members", + "All Events": "All Events", + "Created Events": "Created Events", + "Registered Events": "Registered Events", + "Send": "Send", + "Write your comment here..": "Write your comment here..", + "You need access": "You need access", + "Request access, or switch to an account with access": "Request access, or switch to an account with access", + "Request Access": "Request Access", + "Last Name": "Last Name", + "First Name": "First Name", + "Edit Profile": "Edit Profile", + "Log Out": "Log Out", + "Please Select an amount": "Please Select an amount", + "Input custom amount": "Input custom amount", + "Organisation Name": "Organisation Name", + "Choose an Organization": "Choose an Organization", + "Your Report has been sent to the Admin": "Your Report has been sent to the Admin", + "Report the post to the Admin": "Report the post to the Admin", + "Do you really want to delete the post?": "Do you really want to delete the post?", + "Liked": "Liked", + "Looks like there aren't any events.": "Looks like there aren't any events.", + "You have not created any event.": "You have not created any event.", + "No registered events are present": "No registered events are present", + "There aren't any public events.": "There aren't any public events.", + "There aren't any private events.": "There aren't any private events.", + "Donate to the Community": "Donate to the Community", + "Donating to": "Donating to", + "Are you sure you want to delete this event?": "Are you sure you want to delete this event?", + "Are you sure you want to exit this organization?": "Are you sure you want to exit this organization?", + "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc": "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc.", + "You can edit application settings like language, theme etc from here": "You can edit application settings like language, theme etc from here.", + "For any help we are always there. You can reach us from here": "For any help, we are always there. You can reach us from here.", + "Current selected Organization Name": "Current selected Organization Name", + "Click this button to see options related to switching, joining and leaving organization(s)": "Click this button to see options related to switching, joining and leaving organization(s).", + "Current selected Organization's Name appears here": "Current selected Organization's Name appears here.", + "All your joined organizations appear over here you can click on them to change the current organization": "All your joined organizations appear over here you can click on them to change the current organization.", + "From this button you can join other listed organizations": "From this button you can join other listed organizations.", + "To leave the current organization you can use this option": "To leave the current organization you can use this option.", + "This is the post card you can like and comment on the post from the options available": "This is the post card you can like and comment on the post from the options available.", + "This is the Events tab here you can see all event related information of the current selected organization": "This is the Events tab here you can see all event related information of the current selected organization.", + "This is the home tab here you can see the latest post from other members of the current organization": "This is the home tab here you can see the latest post from other members of the current organization.", + "This section displays all the important post set by the organization admin(s)": "This section displays all the important post set by the organization admin(s).", + "Filter Events based on categories": "Filter Events based on categories.", + "Filter Events between selected dates": "Filter Events between selected dates.", + "Description of event to see more details click on the card": "Description of event to see more details click on the card.", + "This is the Create post tab here you can add post to the current selected organization": "This is the Create post tab here you can add post to the current selected organization.", + "This is the Chat tab here you can see all your messages of the current selected organization": "This is the Chat tab here you can see all your messages of the current selected organization.", + "To help your organization grow you can support them financially from here": "To help your organization grow you can support them financially from here.", + "You are all set to go let's get you in": "You are all set to go let's get you in.", + "You have no event in this organization": "You have no event in this organization", + "Create your first event": "Create your first event", + "There are no posts in this organization": "There are no posts in this organization", + "Create your first post": "Create your first post", + "You have no post in this organization": "You have no post in this organization", + "You can create a new event from here": "You can create a new event from here", + "You are all set to go lets get you in": "You are all set to go lets get you in", + "App Tour": "App Tour", + "Start": "Start", + "Skip": "Skip", + "Posts": "Posts", + "Tasks": "Tasks", + "Or": "Or", + "Please select any amount": "Please select any amount", + "Registered": "Registered", + "Not Registrable": "Not Registrable", + "Enter the title of your post": "Enter the title of your post", + "General": "General", + "Help & Support": "Help & Support", + "Talawa Docs": "Talawa Docs", + "All day": "All day", + "Join an Organisation": "Join an Organisation", + "DONATE": "DONATE", + "Permission Denied": "Permission Denied", + "Camera permission is required, to use this feature, give permission from app settings": "Camera permission is required, to use this feature, give permission from app settings", + "SETTINGS": "SETTINGS", + "LogOut": "LogOut", + "Membership request already exist": "Membership request already exist", + "Enter a valid password": "Enter a valid password", + "Organization Not Found": "Organization Not Found", + "Account with this email already registered": "Account with this email already registered", + "Something went wrong!": "Something went wrong!", + "URL doesn't exist/no connection please check": "URL doesn't exist/no connection please check", + "The QR is not Working": "The QR is not Working", + "This QR version is not Supported.": "This QR version is not Supported.", + "Comment sent": "Comment sent", + "Server not running/wrong url": "Server not running/wrong url", + "Couldn't update User details": "Couldn't update User details", + "Image is added": "Image is added", + "Post is uploaded": "Post is uploaded", + "Profile updated successfully": "Profile updated successfully", + "The Camera is not working": "The Camera is not working", + "This QR is not for the App": "This QR is not for the App", + "The tag was added": "The tag was added", + "Start time must be before end time": "Start time must be before end time", + "Organisation on different server, logout and scan qr again": "Organisation on different server, logout and scan qr again", + "Post was deleted if you had the rights!": "Post was deleted if you had the rights!", + "Members": "Members" +} diff --git a/lang/es.json b/lang/es.json new file mode 100644 index 000000000..9885c9af3 --- /dev/null +++ b/lang/es.json @@ -0,0 +1,282 @@ +{ + "Hello": "hola", + "User Name": "Nombre de usuario", + "we've": "tenemos", + "got you covered": "te cubrió", + "password": "contraseña", + "Enter new password": "Introduzca nueva contraseña", + "Re-Enter your password": "Vuelva a ingresar su contraseña", + "Change Password": "Cambiar contraseña", + "Email Hint": "test@test.org", + "Enter your registered Email": "Ingrese su correo electrónico registrado", + "Enter your password": "Ingresa tu contraseña", + "Forgot password": "¿Olvidaste la contraseña?", + "Login": "Acceso", + "Sit back relax, we'll": "Siéntese, ", + "Recover": "", + "Notification Feature is not installed": "La función de notificación no está instalada", + "your password": "relájese, recuperaremos su contraseña", + "Recover Password": "Recupera tu contraseña", + "Select Language": "Seleccione el idioma", + "Default": "Valor por defecto", + "Select": "Seleccione", + "Selected Organization": "Organización seleccionada", + "Continue": "Continuar", + "Enter Community URL": "Ingrese la URL de la comunidad", + "Verify": "Verificarlo", + "Sign Up": "Inscribirse", + "Change language": "Cambiar idioma", + "First Name Hint": "Isabela", + "Enter your first name": "Ponga su primer nombre", + "Last Name Hint": "Rossellini", + "Enter your last name": "Ingrese su apellido", + "Confirm your password": "Confirmar la contraseña", + "Next": "Próximo", + "Request Sent to": "Solicitud enviada a", + "Log out": "Cerrar sesión", + "Join": "Únase", + "and": "y", + "Collaborate": "colabore", + "with your": "con sus", + "Organizations": "organizaciones", + "Title from the viewMode GSoC branch": "Título de la rama viewMode GSoC", + "Please verify URL first": "Primero verifique la URL", + "Enter a valid URL": "Ingrese una URL válida", + "Firstname must not be left blank.": "El nombre no debe dejarse en blanco.", + "Invalid Firstname": "Nombre inválido", + "Lastname must not be left blank.": "El apellido no debe dejarse en blanco.", + "Invalid Lastname": "Apellido inválido", + "Email must not be left blank": "El correo electrónico no debe dejarse en blanco", + "Please enter a valid Email Address": "Por favor, introduce una dirección de correo electrónico válida", + "Password must not be left blank": "La contraseña no debe dejarse en blanco", + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)": "Su contraseña debe tener al menos 8 caracteres, contener al menos una letra numérica, una mayúscula y una minúscula y un carácter especial (@, #, $, etc.)", + "Password must not contain spaces": "La contraseña no debe contener espacios", + "Password does not match original": "La contraseña no coincide con la original", + "Join Organisation": "Unirse a la organización", + "We're": "Nos", + "Glad": "alegra que", + "you're": "hayas", + "Back": "vuelto", + "Let's": "Consigamos", + "get": "que", + "you": "te", + "SignUp": "registres", + "Please wait": "Espere por favor", + "for organisation(s) to accept your invitation.": "para que la (s) organización (es) acepten su invitación..", + "Add Event Title": "Agregar título de evento", + "Where is the event": "Donde es el evento", + "Add Location": "Añadir lugar", + "Describe the event": "Describe el evento", + "Add Description": "Añadir descripción", + "Add Event": "Añadir evento", + "Add": "Agregarlo", + "Add Image": "Añadir imagen", + "Select Start Date and Time": "Seleccione la fecha y hora de inicio", + "Select End Date and Time": "Seleccione la fecha y hora de finalización", + "Select Start Date": "Seleccionar fecha de inicio", + "Select End Date": "Seleccionar fecha de finalización", + "Does not repeat": "No se repite", + "Keep Public": "Mantener pública", + "Keep Registerable": "Mantener registrable", + "Event Details": "Detalles del evento", + "Register": "Registrarse", + "Created by": "Creado por", + "public": "pública", + "private": "privada", + "Description": "Descripción", + "Admins": "Administradoras", + "Attendees": "Asistentes", + "See all": "Ver todo", + "Start Date": "Fecha de inicio", + "End Date": "Fecha final", + "Cancel": "Cancelar", + "Done": "Hecho", + "Explore Events": "Explorar eventos", + "Filters": "Filtros", + "Filter by Date": "Filtrar por fecha", + "Show all events": "Mostrar todos los eventos", + "Show all events created by you": "Mostrar todos los eventos creados por ti", + "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", + "Public Events": "Eventos publicos", + "Private Events": "Eventos privados", + "Liked by": "Gustado por", + "Comments": "Comentarios", + "FirstName LastName": "Nombre Apellido", + "Pinned Posts": "Puestos fijadas", + "Profile": "Perfil", + "Email": "Correo electrónico", + "Update": "Actualizar", + "App Settings": "Ajustes de Aplicacion", + "Language": "Idioma", + "dark mode": "modo oscuro", + "font size": "tamaño de fuente", + "Help": "Ayudar", + "Reach out to us for help": "Comuníquese con nosotros para obtener ayuda", + "Donate Us": "Donarnos", + "Help us to develop for you": "Ayúdanos a desarrollar para ti", + "Log out from Talawa": "Cerrar sesión en Talawa", + "Share News": "Compartir noticias", + "Post": "Correo", + "Organization Name": "Nombre de la Organización", + "Add hasthtag": "Agregar hashtag", + "Write here what do you want to share": "Escribe aquí lo que quieres compartir", + "Join selected organisation": "Unirse a la organización seleccionada", + "Home": "Casa", + "Events": "Eventos", + "Chat": "Chat", + "Chat Screen": "Pantalla de chat", + "Confirm": "Confirmar", + "Confirmation": "Confirmación", + "Close": "Cerca", + "Switch Organization": "Cambiar de organización", + "Join new Organization": "Unirse a una nueva organización", + "Leave Current Organization": "Dejar la organización actual", + "Creator": "Creadora", + "Public": "Pública", + "Private": "Privada", + "No Internet": "No Internet", + "Subscribed": "Suscrita", + "from": "de", + "See all Pinned news": "Ver todas las noticias fijadas", + "show more": "mostrar más", + "show less": "Muestra menos", + "Likes": "Gustos", + "comments": "comentarios", + "Final": "Final", + "Enter Details": "Ingrese detalles", + "Select\nOrganization": "Seleccione\nOrganización", + "already selected": "ya seleccionado", + "Switched to": "Cambiado a", + "Organisation already joined": "Organización ya unida", + "Membership request already sent": "Solicitud de membresía ya enviada", + "Select one organization to continue": "Seleccione una organización para continuar", + "Something went wrong": "Algo salió mal", + "Join in request sent to": "Únase a la solicitud enviada a", + "successfully": "exitosamente", + "Are you sure you want to logout?": "¿Estás segura de que quieres cerrar sesión?", + "Logout": "Cerrar sesión", + "Settings": "Ajustes", + "Dark Theme": "Tema oscuro", + "Error": "Error", + "Warning": "Advertencia", + "Information": "Información", + "No account registered with this email": "El servidor no se está ejecutando/url", + "Dismiss": "despedir", + "No organizations found Please contact your admin": "Neniuj organizoj trovitaj! Bonvolu kontakti vian administranton", + "For complete access, please": "Para acceso completo, por favor", + "join an organization.": " unirse a una organización.", + "JOIN": "UNIRSE", + "Camera": "Cámara", + "Gallery": "Galería", + "NEXT": "SIGUIENTE", + "COMPLETE": "COMPLETO", + "Start app tour to know talawa functioning": "Inicie el recorrido por la aplicación para conocer el funcionamiento de talawa", + "Scan QR": "Escanear QR", + "Add tag": "Añadir etiqueta", + "Enter the Tag": "Ingrese la Etiqueta", + "Title": "Título", + "Where is the event?": "¿Dónde está el evento?", + "Add Members": "Añadir miembros", + "All Events": "Todos los eventos", + "Created Events": "Eventos creados", + "Registered Events": "Eventos registrados", + "Send": "Enviar", + "Write your comment here..": "Escribe tu comentario aquí..", + "You need access": "Necesitas acceso", + "Request access, or switch to an account with access": "Solicitar acceso o cambiar a una cuenta con acceso", + "Request Access": "Solicitar acceso", + "Last Name": "Apellido", + "First Name": "Nombre", + "Edit Profile": "Editar perfil", + "Log Out": "Cerrar sesión", + "Please Select an amount": "Por favor, seleccione una cantidad", + "Input custom amount": "Ingresar cantidad personalizada", + "Organisation Name": "Nombre de la organización", + "Choose an Organization": "Elija una Organización", + "Your Report has been sent to the Admin": "Su informe ha sido enviado al Administrador", + "Report the post to the Admin": "Reportar la publicación al Administrador", + "Do you really want to delete the post?": "¿Realmente quieres eliminar la publicación?", + "Liked": "Gustado", + "Looks like there aren't any events.": "Parece que no hay eventos.", + "You have not created any event.": "No has creado ningún evento.", + "No registered events are present": "No hay eventos registrados", + "There aren't any public events.": "No hay eventos públicos.", + "There aren't any private events.": "No hay eventos privados.", + "Donate to the Community": "Donar a la Comunidad", + "Donating to": "Donando a", + "Are you sure you want to delete this event?": "¿Estás seguro de que quieres eliminar este evento?", + "Are you sure you want to exit this organization?": "¿Estás seguro de que quieres salir de esta organización?", + "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc": "Esta es la pestaña de Perfil, aquí puedes ver todas las opciones relacionadas con la cuenta, configuración de la aplicación, invitación, ayuda, etc.", + "You can edit application settings like language, theme etc from here": "Puedes editar la configuración de la aplicación, como el idioma, el tema, etc., desde aquí", + "For any help we are always there. You can reach us from here": "Para cualquier ayuda, siempre estamos aquí. Puedes contactarnos desde aquí", + "Current selected Organization Name": "Nombre de la organización actualmente seleccionada", + "Click this button to see options related to switching, joining and leaving organization(s)": "Haz clic en este botón para ver opciones relacionadas con cambiar, unirse y salir de organizaciones", + "Current selected Organization's Name appears here": "El nombre de la organización actualmente seleccionada aparece aquí", + "All your joined organizations appear over here you can click on them to change the current organization": "Todas las organizaciones a las que te has unido aparecen aquí; puedes hacer clic en ellas para cambiar la organización actual", + "From this button you can join other listed organizations": "Desde este botón, puedes unirte a otras organizaciones enumeradas", + "To leave the current organization you can use this option": "Para salir de la organización actual, puedes usar esta opción", + "This is the post card you can like and comment on the post from the options available": "Esta es la tarjeta de la publicación; puedes darle me gusta y comentar en la publicación desde las opciones disponibles", + "This is the Events tab here you can see all event related information of the current selected organization": "Esta es la pestaña de Eventos; aquí puedes ver toda la información relacionada con eventos de la organización actualmente seleccionada", + "This is the home tab here you can see the latest post from other members of the current organization": "Esta es la pestaña de Inicio; aquí puedes ver la última publicación de otros miembros de la organización actual", + "This section displays all the important post set by the organization admin(s)": "Esta sección muestra todas las publicaciones importantes establecidas por el(los) administrador(es) de la organización", + "Filter Events based on categories": "Filtrar eventos según categorías", + "Filter Events between selected dates": "Filtrar eventos entre las fechas seleccionadas", + "Description of event to see more details click on the card": "Descripción del evento; para ver más detalles, haz clic en la tarjeta", + "This is the Create post tab here you can add post to the current selected organization": "Esta es la pestaña de Crear publicación; aquí puedes agregar una publicación a la organización actualmente seleccionada", + "This is the Chat tab here you can see all your messages of the current selected organization": "Esta es la pestaña de Chat; aquí puedes ver todos tus mensajes de la organización actualmente seleccionada", + "To help your organization grow you can support them financially from here": "Para ayudar a que tu organización crezca, puedes apoyarla financieramente desde aquí", + "You are all set to go let's get you in": "Estás listo para ir, vamos a empezar", + "You have no event in this organization": "No tienes ningún evento en esta organización", + "Create your first event": "Crea tu primer evento", + "There are no posts in this organization": "No hay publicaciones en esta organización", + "Create your first post": "Crea tu primera publicación", + "You have no post in this organization": "No tienes ninguna publicación en esta organización", + "You can create a new event from here": "Puede crear un nuevo evento desde aquí", + "You are all set to go lets get you in": "Ya estás listo para irte, vamos a meterte", + "App Tour": "Tour de la aplicación", + "Start": "Comenzar", + "Skip": "Saltar", + "Posts": "Publicaciones", + "Tasks": "Tareas", + "Or": "O", + "Please select any amount": "Por favor, seleccione una cantidad", + "Registered": "Registrado", + "Not Registrable": "No registrable", + "Enter the title of your post": "Ingrese el título de su publicación", + "General": "General", + "Help & Support": "Ayuda y soporte", + "Talawa Docs": "Talawa Documentos", + "All day": "Todo el día", + "Join an Organisation": "Únete a una organización", + "DONATE": "DONAR", + "Permission Denied": "Permiso denegado", + "Camera permission is required, to use this feature, give permission from app settings": "Se requiere permiso de cámara para usar esta función. Otorgue el permiso desde la configuración de la aplicación.", + "SETTINGS": "AJUSTES", + "LogOut": "Cerrar sesión", + "Membership request already exist": "Ya existe una solicitud de membresía", + "Enter a valid password": "Ingrese una contraseña válida", + "Organization Not Found": "Organización no encontrada", + "Account with this email already registered": "Cuenta con este correo electrónico ya registrada", + "Something went wrong!": "¡Algo salió mal!", + "URL doesn't exist/no connection please check": "La URL no existe/no hay conexión, verifique", + "The QR is not Working": "El código QR no funciona", + "This QR version is not Supported.": "Esta versión de QR no es compatible.", + "Comment sent": "Comentario enviado", + "Server not running/wrong url": "Servidor no en ejecución/URL incorrecta", + "Couldn't update User details": "No se pudieron actualizar los detalles del usuario", + "Image is added": "Se agregó la imagen", + "Post is uploaded": "Se subió la publicación", + "Profile updated successfully": "Perfil actualizado correctamente", + "The Camera is not working": "La cámara no funciona", + "This QR is not for the App": "Este código QR no es para la aplicación", + "The tag was added": "Se agregó la etiqueta", + "Start time must be before end time": "La hora de inicio debe ser anterior a la hora de finalización", + "Organisation on different server, logout and scan qr again": "Organización en un servidor diferente, cierre la sesión y escanee el código QR nuevamente", + "Post was deleted if you had the rights!": "¡Se eliminó la publicación si tenías los derechos!", + "Members": "Miembros" +} diff --git a/lang/fr.json b/lang/fr.json new file mode 100644 index 000000000..c6535f724 --- /dev/null +++ b/lang/fr.json @@ -0,0 +1,282 @@ +{ + "Hello": "Bonjour", + "User Name": "Nom d'utilisateur", + "we've": "on a", + "got you covered": "vous a couvert", + "password": "le mot de passe", + "Enter new password": "Entrez un nouveau mot de passe", + "Re-Enter your password": "Entrez à nouveau votre mot de passe", + "Change Password": "Changer le mot de passe", + "Email Hint": "test@test.org", + "Notification Feature is not installed": "La fonction de notification n'est pas installée", + "Enter your registered Email": "Entrez votre email enregistré", + "Enter your password": "Tapez votre mot de passe", + "Forgot password": "Mot de passe oublié", + "Login": "Connexion", + "Sit back relax, we'll": "Asseyez-vous, détendez-vous, nous récupérerons", + "Recover": "votre mot", + "your password": "de passe", + "Recover Password": "Récupérer mot de passe", + "Select Language": "Choisir la langue", + "Default": "Défaut", + "Select": "Sélectionner", + "Selected Organization": "Organisation sélectionnée", + "Continue": "Continuer", + "Enter Community URL": "Entrez l'URL de la communauté", + "Verify": "Vérifier", + "Sign Up": "S'inscrire", + "Change language": "Changer de langue", + "First Name Hint": "John", + "Enter your first name": "Entrez votre prénom", + "Last Name Hint": "Carlos", + "Enter your last name": "Entrez votre nom de famille", + "Confirm your password": "Confirmer votre mot de passe", + "Next": "Suivante", + "Request Sent to": "Demande envoyée à", + "Log out": "Se déconnecter", + "Join": "Rejoignez", + "and": "et", + "Collaborate": "collaborez", + "with your": "avec vos", + "Organizations": "organisations", + "Error": "Erreur", + "Warning": "Avertissement", + "Information": "Information", + "No account registered with this email": "Le serveur ne fonctionne pas/mauvaise URL", + "Dismiss": "Rejeter", + "Title from the viewMode GSoC branch": "Titre de la branche viewMode GSoC", + "Please verify URL first": "Veuillez d'abord vérifier l'URL", + "Enter a valid URL": "Saisissez une URL valide", + "Firstname must not be left blank.": "Le prénom ne doit pas être laissé en blanc.", + "Invalid Firstname": "Prénom invalide", + "Lastname must not be left blank.": "Le nom de famille ne doit pas être laissé vide.", + "Invalid Lastname": "Nom de famille invalide", + "Email must not be left blank": "L'e-mail ne doit pas être laissé vide", + "Please enter a valid Email Address": "S'il vous plaît, mettez une adresse email valide", + "Password must not be left blank": "Le mot de passe ne doit pas être laissé vide", + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)": "Votre mot de passe doit comporter au moins 8 caractères, contenir au moins un chiffre, une lettre majuscule et une lettre minuscule et un caractère spécial (@, #, $, etc.)", + "Password must not contain spaces": "Le mot de passe ne doit pas contenir d'espaces", + "Password does not match original": "Le mot de passe ne correspond pas à l'original", + "Join Organisation": "Rejoindre l'organisation", + "We're": "Nous sommes", + "Glad": "heureux que vous", + "you're": "soyez de", + "Back": "retour", + "Let's": "Laissez-nous vous inscrire", + "get": "", + "you": "vous", + "SignUp": "inscrire", + "Please wait": "S'il vous plaît, attendez", + "for organisation(s) to accept your invitation.": "pour que les organisations acceptent votre invitation.", + "Add Event Title": "Ajouter le titre de l'événement", + "Where is the event": "Où est l'événement", + "Add Location": "Ajouter un emplacement", + "Describe the event": "Décrivez l'événement", + "Add Description": "Ajouter une description", + "Add Event": "Ajouter un évènement", + "Add": "Ajoutez-le", + "Add Image": "Ajouter une image", + "Select Start Date": "Sélectionner la date de début", + "Select End Date": "Sélectionner la date de fin", + "Select Start Date and Time": "Sélectionnez la date et l'heure de début", + "Select End Date and Time": "Sélectionnez la date et l'heure de fin", + "Does not repeat": "ça ne se répète pas", + "Keep Public": "Garder public", + "Keep Registerable": "Garder enregistrable", + "Event Details": "Détails de l'évènement", + "Register": "S'inscrire", + "Created by": "Créé par", + "public": "publique", + "private": "privée", + "Description": "La description", + "Admins": "Administratrices", + "Attendees": "Participantes", + "See all": "Voir tout", + "Start Date": "Date de début", + "End Date": "Date de fin", + "Cancel": "Annuler", + "Done": "Fait", + "Explore Events": "Explorer les événements", + "Filters": "Filtres", + "Filter by Date": "Filtrer par date", + "Show all events": "Afficher tous les événements", + "Show all events created by you": "Afficher tous les événements créés par vous", + "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", + "Public Events": "Événements publics", + "Private Events": "Événements privés", + "Liked by": "Aimé par", + "Comments": "commentaires", + "FirstName LastName": "Prénom nom de famille", + "Pinned Posts": "Messages épinglés", + "Profile": "Profil", + "Email": "E-mail", + "Update": "Mettre à jour", + "App Settings": "Paramètres de l'application", + "Language": "Langue", + "dark mode": "mode sombre", + "font size": "taille de police", + "Help": "Aider", + "Reach out to us for help": "Contactez-nous pour obtenir de l'aide", + "Donate Us": "Faites-nous un don", + "Help us to develop for you": "Aidez-nous à développer pour vous", + "Log out from Talawa": "Se déconnecter de Talawa", + "Share News": "Partager Nouvelles", + "Post": "Poster", + "Organization Name": "nom de l'organisation", + "Add hasthtag": "Ajouter un hashtag", + "Write here what do you want to share": "Écrivez ici ce que vous voulez partager", + "Join selected organisation": "Rejoindre l'organisation sélectionnée", + "Home": "Domicile", + "Events": "Événements", + "Chat": "Discuter", + "Chat Screen": "Écran de discussion", + "Confirm": "Confirmer", + "Confirmation": "Confirmation", + "Close": "Fermer", + "Switch Organization": "Changer d'organisation", + "Join new Organization": "Rejoindre une nouvelle organisation", + "Leave Current Organization": "Quitter l'organisation actuelle", + "Creator": "Créatrice", + "Public": "Publique", + "Private": "Privée", + "No Internet": "Sans Internet", + "Subscribed": "Abonnée", + "from": "de", + "See all Pinned news": "Voir toutes les actualités épinglées", + "show more": "montre plus", + "show less": "Montrer moins", + "Likes": "Aime", + "comments": "commentaires", + "Final": "Finale", + "Enter Details": "Entrez les détails", + "Select\nOrganization": "Sélectionner\nOrganisation", + "already selected": "déjà sélectionné", + "Switched to": "Basculé vers", + "Organisation already joined": "Organisation déjà adhérée", + "Membership request already sent": "Demande d'adhésion déjà envoyée", + "Select one organization to continue": "Sélectionnez une organisation pour continuer", + "Something went wrong": "Quelque chose s'est mal passé", + "Join in request sent to": "Demande d'adhésion envoyée à", + "successfully": "avec succès", + "Are you sure you want to logout?": "Êtes-vous sûr de vouloir vous déconnecter?", + "Logout": "Se déconnecter", + "Settings": "Paramètres", + "Dark Theme": "Thème sombre", + "No organizations found Please contact your admin": "Aucune organisation trouvée ! Veuillez contacter votre administrateur", + "For complete access, please": "Pour un accès complet, veuillez", + "join an organization.": " rejoindre une organisation.", + "JOIN": "REJOINDRE", + "Camera": "Caméra", + "Gallery": "Galerie", + "NEXT": "SUIVANT", + "COMPLETE": "COMPLÉTER", + "Start app tour to know talawa functioning": "Démarrez la visite de l'application pour connaître le fonctionnement de talawa", + "Scan QR": "Scanner QR", + "Add tag": "Ajouter un tag", + "Enter the Tag": "Entrez le Tag", + "Title": "Titre", + "Where is the event?": "Où se trouve l'événement?", + "Add Members": "Ajouter des membres", + "All Events": "Tous les événements", + "Created Events": "Événements créés", + "Registered Events": "Événements enregistrés", + "Send": "Envoyer", + "Write your comment here..": "Écrivez votre commentaire ici..", + "You need access": "Vous avez besoin d'accès", + "Request access, or switch to an account with access": "Demander un accès ou passer à un compte avec accès", + "Request Access": "Demander l'accès", + "Last Name": "Nom de famille", + "First Name": "Prénom", + "Edit Profile": "Modifier le profil", + "Log Out": "Se déconnecter", + "Please Select an amount": "Veuillez sélectionner un montant", + "Input custom amount": "Entrer un montant personnalisé", + "Organisation Name": "Nom de l'organisation", + "Choose an Organization": "Choisissez une Organisation", + "Your Report has been sent to the Admin": "Votre rapport a été envoyé à l'Admin", + "Report the post to the Admin": "Signaler le post à l'Admin", + "Do you really want to delete the post?": "Voulez-vous vraiment supprimer le post?", + "Liked": "Aimé", + "Looks like there aren't any events.": "On dirait qu'il n'y a pas d'événements.", + "You have not created any event.": "Vous n'avez créé aucun événement.", + "No registered events are present": "Aucun événement enregistré n'est présent", + "There aren't any public events.": "Il n'y a pas d'événements publics.", + "There aren't any private events.": "Il n'y a pas d'événements privés.", + "Donate to the Community": "Faire un don à la Communauté", + "Donating to": "Don à", + "Are you sure you want to delete this event?": "Êtes-vous sûr de vouloir supprimer cet événement?", + "Are you sure you want to exit this organization?": "Êtes-vous sûr de vouloir quitter cette organisation?", + "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc": "Ceci est l'onglet Profil où vous pouvez voir toutes les options liées au compte, aux paramètres de l'application, à l'invitation, à l'aide, etc.", + "You can edit application settings like language, theme etc from here": "Vous pouvez modifier les paramètres de l'application comme la langue, le thème, etc. depuis ici", + "For any help we are always there. You can reach us from here": "Pour toute aide, nous sommes toujours là. Vous pouvez nous joindre depuis ici", + "Current selected Organization Name": "Nom de l'organisation actuellement sélectionnée", + "Click this button to see options related to switching, joining and leaving organization(s)": "Cliquez sur ce bouton pour voir les options liées au changement, à l'adhésion et au départ d'organisation(s)", + "Current selected Organization's Name appears here": "Le nom de l'organisation actuellement sélectionnée apparaît ici", + "All your joined organizations appear over here you can click on them to change the current organization": "Toutes les organisations auxquelles vous avez adhéré apparaissent ici, vous pouvez cliquer sur elles pour changer l'organisation actuelle", + "From this button you can join other listed organizations": "À partir de ce bouton, vous pouvez rejoindre d'autres organisations répertoriées", + "To leave the current organization you can use this option": "Pour quitter l'organisation actuelle, vous pouvez utiliser cette option", + "This is the post card you can like and comment on the post from the options available": "Ceci est la carte de publication, vous pouvez aimer et commenter la publication à partir des options disponibles", + "This is the Events tab here you can see all event related information of the current selected organization": "Ceci est l'onglet Événements, ici vous pouvez voir toutes les informations liées aux événements de l'organisation actuellement sélectionnée", + "This is the home tab here you can see the latest post from other members of the current organization": "Ceci est l'onglet Accueil, ici vous pouvez voir le dernier post des autres membres de l'organisation actuelle", + "This section displays all the important post set by the organization admin(s)": "Cette section affiche tous les posts importants définis par le(s) administrateur(s) de l'organisation", + "Filter Events based on categories": "Filtrer les événements en fonction des catégories", + "Filter Events between selected dates": "Filtrer les événements entre les dates sélectionnées", + "Description of event to see more details click on the card": "Description de l'événement, pour voir plus de détails, cliquez sur la carte", + "This is the Create post tab here you can add post to the current selected organization": "Ceci est l'onglet Créer une publication, ici vous pouvez ajouter une publication à l'organisation actuellement sélectionnée", + "This is the Chat tab here you can see all your messages of the current selected organization": "Ceci est l'onglet Chat, ici vous pouvez voir tous vos messages de l'organisation actuellement sélectionnée", + "To help your organization grow you can support them financially from here": "Pour aider votre organisation à se développer, vous pouvez les soutenir financièrement depuis ici.", + "You are all set to go let's get you in": "Vous êtes prêt à partir, laissez-nous vous aider.", + "You have no event in this organization": "Vous n'avez aucun événement dans cette organisation", + "Create your first event": "Créez votre premier événement", + "There are no posts in this organization": "Il n'y a aucun article dans cette organisation", + "Create your first post": "Créez votre premier article", + "You have no post in this organization": "Vous n'avez aucun article dans cette organisation", + "You can create a new event from here": "Vous pouvez créer un nouvel événement à partir d'ici", + "You are all set to go lets get you in": "Vous êtes prêt à partir, laissez-nous vous faire entrer", + "App Tour": "Visite guidée de l'application", + "Start": "Démarrer", + "Skip": "Ignorer", + "Posts": "Publications", + "Tasks": "Tâches", + "Or": "Ou", + "Please select any amount": "Veuillez sélectionner un montant", + "Registered": "Enregistré", + "Not Registrable": "Non enregistrable", + "Enter the title of your post": "Entrez le titre de votre publication", + "General": "Général", + "Help & Support": "Aide et support", + "Talawa Docs": "Talawa Docs", + "All day": "Toute la journée", + "Join an Organisation": "Rejoindre une organisation", + "DONATE": "FAIRE UN DON", + "Permission Denied": "Autorisation refusée", + "Camera permission is required, to use this feature, give permission from app settings": "L'autorisation de la caméra est requise pour utiliser cette fonctionnalité. Accordez l'autorisation à partir des paramètres de l'application.", + "SETTINGS": "PARAMÈTRES", + "LogOut": "Se déconnecter", + "Membership request already exist": "La demande d'adhésion existe déjà", + "Enter a valid password": "Entrez un mot de passe valide", + "Organization Not Found": "Organisation non trouvée", + "Account with this email already registered": "Compte avec cet e-mail déjà enregistré", + "Something went wrong!": "Quelque chose s'est mal passé !", + "URL doesn't exist/no connection please check": "L'URL n'existe pas/pas de connexion, veuillez vérifier", + "The QR is not Working": "Le code QR ne fonctionne pas", + "This QR version is not Supported.": "Cette version de code QR n'est pas prise en charge.", + "Comment sent": "Commentaire envoyé", + "Server not running/wrong url": "Serveur non en cours d'exécution/mauvaise URL", + "Couldn't update User details": "Impossible de mettre à jour les détails de l'utilisateur", + "Image is added": "L'image a été ajoutée", + "Post is uploaded": "Le message a été téléchargé", + "Profile updated successfully": "Profil mis à jour avec succès", + "The Camera is not working": "La caméra ne fonctionne pas", + "This QR is not for the App": "Ce code QR n'est pas pour l'application", + "The tag was added": "La balise a été ajoutée", + "Start time must be before end time": "L'heure de début doit être antérieure à l'heure de fin", + "Organisation on different server, logout and scan qr again": "Organisation sur un serveur différent, déconnectez-vous et scannez à nouveau le code QR", + "Post was deleted if you had the rights!": "Le message a été supprimé si vous aviez les droits !", + "Members": " Membres" +} diff --git a/lang/hi.json b/lang/hi.json new file mode 100644 index 000000000..4cc46c1cc --- /dev/null +++ b/lang/hi.json @@ -0,0 +1,282 @@ +{ + "Hello": "नमस्ते", + "User Name": "उपयोगकर्ता नाम", + "we've": "हमने", + "got you covered": "आपको कवर कर लिया है", + "password": "पास वर्ड दर्ज करें", + "Enter new password": "नया पासवर्ड दर्ज करें", + "Re-Enter your password": "दुबारापासवडृ िलखो", + "Change Password": "पासवर्ड बदलें", + "Email Hint": "test@test.org", + "Enter your registered Email": "अपना पंजीकृत ईमेल दर्ज करें", + "Enter your password": "अपना पासवर्ड डालें", + "Forgot password": "क्या आप पासवर्ड भूल गए", + "Login": "लॉग इन करें", + "Sit back relax, we'll": "आराम से बैठें, हम", + "Recover": "रिकवर कर लेंगे", + "your password": "आपका पासवर्ड", + "Recover Password": "पासवर्ड पुनः प्राप्त करना", + "Select Language": "भाषा का चयन करें", + "Default": "डिफ़ॉल्ट मान", + "Select": "चुनते हैं", + "Notification Feature is not installed": "अधिसूचना सुविधा स्थापित नहीं है", + "Selected Organization": "चयनित संगठन", + "Continue": "जारी रखें", + "Enter Community URL": "समुदाय URL दर्ज करें", + "Verify": "सत्यापित करें", + "Sign Up": "साइन अप करें", + "Change language": "भाषा बदलें", + "First Name Hint": "राहुल", + "Enter your first name": "अपना पहला नाम दर्ज करें", + "Last Name Hint": "कुमार", + "Enter your last name": "अपना अंतिम नाम दर्ज करें", + "Confirm your password": "अपने पासवर्ड की पुष्टि करें", + "Next": "अगला", + "Request Sent to": "अनुरोध भेजा गया", + "Log out": "लॉग आउट", + "Join": "अपने संगठनों", + "and": "से", + "Collaborate": "जुड़ें", + "with your": "और सहयोग करें", + "Organizations": "", + "Title from the viewMode GSoC branch": "व्यूमोड जीएसओसी शाखा से शीर्षक", + "Please verify URL first": "कृपया पहले URL सत्यापित करें", + "Enter a valid URL": "एक मान्य यूआरएल दर्ज करें", + "Firstname must not be left blank.": "प्रथम नाम खाली नहीं छोड़ा जाना चाहिए।", + "Invalid Firstname": "अमान्य प्रथम नाम", + "Lastname must not be left blank.": "उपनाम खाली नहीं छोड़ा जाना चाहिए।", + "Invalid Lastname": "अमान्य अंतिम नाम", + "Email must not be left blank": "ईमेल खाली नहीं छोड़ना चाहिए", + "Please enter a valid Email Address": "कृपया एक वैध ई - मेल एड्रेस डालें", + "Password must not be left blank": "पासवर्ड खाली नहीं छोड़ना चाहिए", + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)": "आपका पासवर्ड कम से कम 8 वर्णों का होना चाहिए, जिसमें कम से कम एक संख्यात्मक, एक अपरकेस और एक लोअरकेस अक्षर और एक विशेष वर्ण (@,#,$, आदि) हो।", + "Password must not contain spaces": "पासवर्ड में रिक्त स्थान नहीं होना चाहिए", + "Password does not match original": "पासवर्ड मूल से मेल नहीं खाता", + "Join Organisation": "संगठन में शामिल हों", + "We're": "हमें", + "Glad": "खुशी है कि", + "you're": "आप", + "Back": "वापस आ गए हैं", + "Let's": "आइए", + "get": "आपको", + "you": "साइनअप", + "SignUp": "कराते हैं", + "Please wait": "कृपया प्रतीक्षा कीजिये", + "for organisation(s) to accept your invitation.": "संगठन (ओं) के लिए आपका निमंत्रण स्वीकार करने के लिए।", + "Add Event Title": "घटना का शीर्षक जोड़ें", + "Where is the event": "घटना कहाँ है", + "Add Location": "स्थान जोड़ना", + "Describe the event": "घटना का वर्णन करें", + "Add Description": "विवरण जोड़ें", + "Add Event": "कार्यक्रम जोड़ें", + "Add": "इसे जोड़ें", + "Add Image": "छवि जोड़ें", + "Select Start Date": "शुरूआत की तिथि का चयन करें", + "Select End Date": "समाप्ति की तिथि का चयन करें", + "Select Start Date and Time": "प्रारंभ दिनांक और समय चुनें", + "Select End Date and Time": "समाप्ति तिथि और समय चुनें", + "Does not repeat": "यह दोहराता नहीं है", + "Keep Public": "सार्वजनिक रखें", + "Keep Registerable": "पंजीकरण योग्य रखें", + "Event Details": "घटना की जानकारी", + "Register": "पंजीकरण करें", + "Created by": "के द्वारा बनाई गई", + "public": "सह लोक", + "private": "निजी", + "Description": "विवरण", + "Admins": "व्यवस्थापक", + "Attendees": "सहभागी", + "See all": "सभी देखें", + "Start Date": "आरंभ करने की तिथि", + "End Date": "समाप्ति तिथि", + "Cancel": "रद्द करना", + "Done": "किया हुआ", + "Explore Events": "घटनाओं का अन्वेषण करें", + "Filters": "फ़िल्टर", + "Filter by Date": "तारीख़ से फ़िल्टर करें", + "Show all events": "सभी घटनाएँ दिखाएं", + "Show all events created by you": "आपके द्वारा बनाई गई सभी घटनाएँ दिखाएं", + "Show all events you have registered": "आपने जिन घटनाओं में पंजीकृत हुए हैं, उन सभी घटनाएँ दिखाएं", + "Show events for all": "सभी के लिए घटनाएँ दिखाएं", + "Show invite-only events": "आमंत्रित लोगों के लिए घटनाएँ दिखाएं", + "Add Date": "तिथि जोड़ें", + "Event": "इवेंट्स", + "My Events": "मेरे कार्यक्रम", + "Public Events": "सार्वजनिक कार्यक्रम", + "Private Events": "निजी कार्यक्रम", + "Liked by": "द्वारा पसंद किया गया", + "Comments": "टिप्पणियाँ", + "FirstName LastName": "प्रथम नाम अंतिम नाम", + "Pinned Posts": "चिपके पत्र", + "Profile": "प्रोफ़ाइल", + "Email": "ईमेल", + "Update": "अपडेट करें", + "App Settings": "एप्लिकेशन सेटिंग", + "Language": "भाषा: हिन्दी", + "dark mode": "डार्क मोड", + "font size": "फ़ॉन्ट आकार", + "Help": "मदद", + "Reach out to us for help": "मदद के लिए हमसे संपर्क करें", + "Donate Us": "हमें दान करें", + "Help us to develop for you": "आपके लिए विकास करने में हमारी सहायता करें", + "Log out from Talawa": "तलवा से लॉग आउट करें", + "Share News": "समाचार साझा करें", + "Post": "पद", + "Organization Name": "संगठन का नाम", + "Add hasthtag": "हैशटैग जोड़ें", + "Write here what do you want to share": "यहां लिखें कि आप क्या साझा करना चाहते हैं", + "Join selected organisation": "चयनित संगठन से जुड़ें", + "Home": "घर", + "Events": "इवेंट्स", + "Chat": "चैट", + "Chat Screen": "चैट स्क्रीन", + "Confirm": "पुष्टि करें", + "Confirmation": "पुष्टीकरण", + "Close": "बंद करे", + "Switch Organization": "संगठन स्विच करें", + "Join new Organization": "नए संगठन में शामिल हों", + "Leave Current Organization": "वर्तमान संगठन छोड़ें", + "Creator": "निर्माता", + "Public": "सार्वजनिक", + "Private": "निजी", + "No Internet": "कोई इंटरनेट नहीं", + "Subscribed": "सदस्यता ली गई", + "from": "से", + "See all Pinned news": "सभी पिन किए गए समाचार देखें", + "show more": "अधिक दिखाएं", + "show less": "कम दिखाएं", + "Likes": "पसंद", + "comments": "टिप्पणियां", + "Final": "फाइनल", + "Enter Details": "विवरण दर्ज करें", + "Select\nOrganization": "चुनते हैं\nसंगठन", + "already selected": "पहले से चयनित", + "Switched to": "इस पर स्विच किया गया", + "Organisation already joined": "संगठन पहले ही शामिल हो चुका है", + "Membership request already sent": "सदस्यता अनुरोध पहले ही भेजा जा चुका है", + "Select one organization to continue": "जारी रखने के लिए एक संगठन चुनें", + "Something went wrong": "कुछ गलत हो गया", + "Join in request sent to": "ज्वाइन इन रिक्वेस्ट इन को भेजा गया", + "successfully": "सफलतापूर्वक", + "Are you sure you want to logout?": "क्या आप वाकई लॉगआउट करना चाहते हैं?", + "Logout": "लॉगआउट", + "Settings": "अपनी सेटिंग्स बदलें", + "Dark Theme": "डार्क थीम", + "Error": "गलती", + "Warning": "चेतावनी", + "Information": "जानकारी", + "No account registered with this email": "सर्वर नहीं चल रहा/गलत url", + "Dismiss": "नकार", + "No organizations found Please contact your admin": "कोई संगठन नहीं मिला! कृपया अपने व्यवस्थापक से संपर्क करें", + "For complete access, please": "पूर्ण पहुंच के लिए, कृपया", + "join an organization.": " किसी संगठन से जुड़ें.", + "JOIN": "जोड़ना", + "Camera": "कैमरा", + "Gallery": "गैलरी", + "NEXT": "अगला", + "COMPLETE": "पूर्ण", + "Start app tour to know talawa functioning": "Talawa कार्यप्रणाली जानने के लिए ऐप टूर शुरू करें", + "Scan QR": "QR स्कैन करें", + "Add tag": "टैग जोड़ें", + "Enter the Tag": "टैग दर्ज करें", + "Title": "शीर्षक", + "Where is the event?": "इवेंट कहाँ है?", + "Add Members": "सदस्य जोड़ें", + "All Events": "सभी ईवेंट्स", + "Created Events": "बनाए गए ईवेंट्स", + "Registered Events": "पंजीकृत ईवेंट्स", + "Send": "भेजें", + "Write your comment here..": "यहां अपनी टिप्पणी लिखें..", + "You need access": "आपको पहुँच की आवश्यकता है", + "Request access, or switch to an account with access": "पहुँच का अनुरोध करें, या पहुँच वाले खाते में स्विच करें", + "Request Access": "पहुँच का अनुरोध करें", + "Last Name": "अंतिम नाम", + "First Name": "पहला नाम", + "Edit Profile": "प्रोफ़ाइल संपादित करें", + "Log Out": "लॉग आउट", + "Please Select an amount": "कृपया एक राशि चुनें", + "Input custom amount": "कस्टम राशि दर्ज करें", + "Organisation Name": "संगठन का नाम", + "Choose an Organization": "एक संगठन चुनें", + "Your Report has been sent to the Admin": "आपकी रिपोर्ट एडमिन को भेज दी गई है", + "Report the post to the Admin": "पोस्ट को एडमिन को रिपोर्ट करें", + "Do you really want to delete the post?": "क्या आप वाकई पोस्ट को हटाना चाहते हैं?", + "Liked": "पसंद किया", + "Looks like there aren't any events.": "लगता है कि कोई इवेंट नहीं हैं।", + "You have not created any event.": "आपने कोई इवेंट नहीं बनाया है।", + "No registered events are present": "कोई पंजीकृत इवेंट मौजूद नहीं हैं", + "There aren't any public events.": "कोई सार्वजनिक इवेंट नहीं हैं।", + "There aren't any private events.": "कोई निजी इवेंट नहीं हैं।", + "Donate to the Community": "समुदाय को दान करें", + "Donating to": "को दान देना", + "Are you sure you want to delete this event?": "क्या आप वाकई इस इवेंट को हटाना चाहते हैं?", + "Are you sure you want to exit this organization?": "क्या आप वाकई इस संगठन से बाहर जाना चाहते हैं?", + "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc": "यह प्रोफाइल टैब है जहाँ आप खाता, ऐप सेटिंग, आमंत्रण, सहायता आदि से संबंधित सभी विकल्प देख सकते हैं", + "You can edit application settings like language, theme etc from here": "आप यहाँ से भाषा, थीम आदि जैसी एप्लिकेशन सेटिंग्स को संपादित कर सकते हैं", + "For any help we are always there. You can reach us from here": "किसी भी मदद के लिए हम हमेशा यहाँ होते हैं। आप हमसे यहाँ संपर्क कर सकते हैं", + "Current selected Organization Name": "वर्तमान चयनित संगठन का नाम", + "Click this button to see options related to switching, joining and leaving organization(s)": "स्विचिंग, ज्वाइनिंग और ऑर्गनाइजेशन छोड़ने से संबंधित विकल्प देखने के लिए इस बटन पर क्लिक करें।", + "Current selected Organization's Name appears here": "वर्तमान चयनित संगठन का नाम यहाँ दिखाई देता है।", + "All your joined organizations appear over here you can click on them to change the current organization": "यहाँ सभी आपके जुड़े हुए संगठन दिखाई देते हैं, आप इन पर क्लिक करके वर्तमान संगठन को बदल सकते हैं।", + "From this button you can join other listed organizations": "इस बटन से आप अन्य सूचीबद्ध संगठनों में शामिल हो सकते हैं।", + "To leave the current organization you can use this option": "वर्तमान संगठन छोड़ने के लिए आप इस विकल्प का उपयोग कर सकते हैं।", + "This is the post card you can like and comment on the post from the options available": "यह वह पोस्ट कार्ड है जिस पर आप उपलब्ध विकल्पों से पसंद और टिप्पणी कर सकते हैं।", + "This is the Events tab here you can see all event related information of the current selected organization": "यहाँ इवेंट्स टैब है जहाँ आप वर्तमान चयनित संगठन की सभी इवेंट संबंधित जानकारी देख सकते हैं।", + "This is the home tab here you can see the latest post from other members of the current organization": "यहाँ होम टैब है जहाँ आप वर्तमान संगठन के अन्य सदस्यों के नवीनतम पोस्ट देख सकते हैं।", + "This section displays all the important post set by the organization admin(s)": "यह खंड वह सभी महत्वपूर्ण पोस्ट दिखाता है जो संगठन एडमिन द्वारा निर्धारित की गई हैं।", + "Filter Events based on categories": "श्रेणियों के आधार पर इवेंट्स को फ़िल्टर करें।", + "Filter Events between selected dates": "चयनित तिथियों के बीच इवेंट्स को फ़िल्टर करें।", + "Description of event to see more details click on the card": "इवेंट का विवरण और विवरण देखने के लिए कार्ड पर क्लिक करें।", + "This is the Create post tab here you can add post to the current selected organization": "यह यहाँ से तैयार करें पोस्ट टैब है जहाँ आप वर्तमान चयनित संगठन में पोस्ट जोड़ सकते हैं।", + "This is the Chat tab here you can see all your messages of the current selected organization": "यहाँ चैट टैब है जहाँ आप वर्तमान चयनित संगठन के सभी संदेश देख सकते हैं।", + "To help your organization grow you can support them financially from here": "अपने संगठन को बढ़ावा देने के लिए आप उन्हें यहाँ से वित्तपोषण दे सकते हैं।", + "You are all set to go let's get you in": "आप तैयार हैं जाने के लिए, चलो आपको एंटर करते हैं।", + "You have no event in this organization": "इस संगठन में आपका कोई इवेंट नहीं है", + "Create your first event": "अपना पहला इवेंट बनाएं", + "There are no posts in this organization": "इस संगठन में कोई पोस्ट नहीं है", + "Create your first post": "अपनी पहली पोस्ट बनाएं", + "You have no post in this organization": "इस संगठन में आपका कोई पोस्ट नहीं है", + "You can create a new event from here": "यहां से आप एक नया इवेंट बना सकते हैं", + "You are all set to go lets get you in": "आप सभी सेट हैं जाने के लिए, चलो आपको भेजते हैं", + "App Tour": "ऐप टूर", + "Start": "शुरू करें", + "Skip": "छोड़ दें", + "Posts": "पोस्ट्स", + "Tasks": "टास्क", + "Or": "या", + "Please select any amount": "कृपया कोई राशि का चयन करें", + "Registered": "पंजीकृत", + "Not Registrable": "पंजीकरण योग्य नहीं", + "Enter the title of your post": "अपने पोस्ट का शीर्षक दर्ज करें", + "General": "सामान्य", + "Help & Support": "सहायता और समर्थन", + "Talawa Docs": "Talawa दस्तावेज", + "All day": "पूरा दिन", + "Join an Organisation": "एक संगठन से जुड़ें", + "DONATE": "दान करें", + "Permission Denied": "अनुमति अस्वीकृत", + "Camera permission is required, to use this feature, give permission from app settings": "कैमरे की अनुमति आवश्यक है, इस फ़ीचर का उपयोग करने के लिए, ऐप सेटिंग्स से अनुमति दें", + "SETTINGS": "सेटिंग्स", + "LogOut": "लॉगआउट", + "Membership request already exist": "सदस्यता अनुरोध पहले से ही मौजूद है", + "Enter a valid password": "कृपया एक मान्य पासवर्ड दर्ज करें", + "Organization Not Found": "संगठन नहीं मिला", + "Account with this email already registered": "इस ईमेल से पहले से ही खाता रजिस्टर किया गया है", + "Something went wrong!": "कुछ गलत हो गया!", + "URL doesn't exist/no connection please check": "URL मौजूद नहीं है/कृपया कनेक्शन की जाँच करें", + "The QR is not Working": "QR काम नहीं कर रहा है", + "This QR version is not Supported.": "यह QR वेर्जन समर्थित नहीं है।", + "Comment sent": "टिप्पणी भेज दी गई", + "Server not running/wrong url": "सर्वर रन नहीं हो रहा/गलत URL", + "Couldn't update User details": "उपयोगकर्ता विवरण अपडेट नहीं किये जा सके", + "Image is added": "छवि जोड़ी गई", + "Post is uploaded": "पोस्ट अपलोड किया गया", + "Profile updated successfully": "प्रोफ़ाइल सफलतापूर्वक अपडेट की गई", + "The Camera is not working": "कैमरा काम नहीं कर रहा है", + "This QR is not for the App": "यह QR ऐप के लिए नहीं है", + "The tag was added": "टैग जोड़ा गया था", + "Start time must be before end time": "शुरू समय अंत समय से पहले होना चाहिए", + "Organisation on different server, logout and scan qr again": "संगठन अलग सर्वर पर है, लॉगआउट करें और फिर से QR स्कैन करें", + "Post was deleted if you had the rights!": "यदि आपके पास अधिकार थे तो पोस्ट हटा दिया गया था!", + "Members": " सदस्य" +} diff --git a/lang/ja.json b/lang/ja.json new file mode 100644 index 000000000..75dd81dee --- /dev/null +++ b/lang/ja.json @@ -0,0 +1,282 @@ +{ + "Hello": "こんにちは", + "User Name": "ユーザー名", + "we've": "我々は持っています", + "got you covered": "あなたをカバーしました", + "password": "パスワード", + "Enter new password": "新しいパスワードを入力してください", + "Re-Enter your password": "パスワードを再入力してください", + "Change Password": "パスワードを変更する", + "Email Hint": "test@test.org", + "Enter your registered Email": "登録したメールアドレスを入力してください", + "Enter your password": "パスワードを入力してください", + "Forgot password": "パスワードをお忘れですか", + "Login": "ログイン", + "Sit back relax, we'll": "ゆったりとおくつろぎください。", + "Recover": "回復", + "Notification Feature is not installed": "通知機能がインストールされていません", + "your password": "あなたのパスワード", + "Recover Password": "パスワードを回復", + "Select Language": "言語を選択する", + "Default": "ディフォルト", + "Select": "選択する", + "Selected Organization": "選択した組織", + "Continue": "継続する", + "Enter Community URL": "コミュニティの URL を入力してください", + "Verify": "確認", + "Sign Up": "サインアップ", + "Change language": "言語を変更", + "First Name Hint": "John", + "Enter your first name": "名を入力してください", + "Last Name Hint": "Carlos", + "Enter your last name": "姓を入力してください", + "Confirm your password": "あなたのパスワードを確認", + "Next": "次", + "Request Sent to": "送信先のリクエスト", + "Log out": "ログアウト", + "Join": "加入", + "and": "と", + "Collaborate": "コラボレーション", + "with your": "あなたと", + "Organizations": "組織", + "Title from the viewMode GSoC branch": "ビューモードGSoCブランチからのタイトル", + "Please verify URL first": "最初にURLを確認してください", + "Enter a valid URL": "有効なURLを入力してください", + "Firstname must not be left blank.": "名を空白のままにしないでください。", + "Invalid Firstname": "無効な名", + "Lastname must not be left blank.": "姓を空白のままにしないでください。", + "Invalid Lastname": "無効な姓", + "Email must not be left blank": "メールを空白のままにしないでください", + "Please enter a valid Email Address": "有効なメールアドレスを入力してください", + "Password must not be left blank": "パスワードは空白のままにしないでください", + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)": "パスワードは8文字以上で、数字が1つ、大文字と小文字が1つ、特殊文字(@、#、$など)が1つ含まれている必要があります。", + "Password must not contain spaces": "パスワードにスペースを含めることはできません", + "Password does not match original": "パスワードが元のパスワードと一致しません", + "Join Organisation": "組織に参加する", + "We're": "私たちです", + "Glad": "嬉しい", + "you're": "あなたは", + "Back": "戻る", + "Let's": "しましょう", + "get": "得る", + "you": "あなた", + "SignUp": "サインアップ", + "Please wait": "お待ちください", + "for organisation(s) to accept your invitation.": "組織があなたの招待を受け入れるために。", + "Add Event Title": "イベントタイトルを追加", + "Where is the event": "イベントはどこですか", + "Add Location": "場所を追加", + "Describe the event": "イベントについて説明する", + "Add Description": "説明を追加", + "Add Event": "イベントを追加", + "Add": "追加", + "Add Image": "画像を追加", + "Select Start Date": "開始日を選択", + "Select End Date": "終了日を選択", + "Select Start Date and Time": "開始日時を選択します", + "Select End Date and Time": "終了日時を選択します", + "Does not repeat": "繰り返さない", + "Keep Public": "公開する", + "Keep Registerable": "登録可能に保つ", + "Event Details": "イベントの詳細", + "Register": "登録", + "Created by": "によって作成された", + "public": "公衆", + "private": "プライベート", + "Description": "説明", + "Admins": "管理者", + "Attendees": "参加者", + "See all": "すべてを見る", + "Start Date": "開始日", + "End Date": "終了日", + "Cancel": "キャンセル", + "Done": "終わり", + "Explore Events": "イベントを探索する", + "Filters": "フィルター", + "Filter by Date": "日付で絞り込む", + "Show all events": "すべてのイベントを表示", + "Show all events created by you": "あなたが作成したすべてのイベントを表示", + "Show all events you have registered": "あなたが登録したすべてのイベントを表示", + "Show events for all": "すべてのイベントを表示", + "Show invite-only events": "招待限定イベントを表示", + "Add Date": "日付を追加", + "Event": "イベント", + "My Events": "私のイベント", + "Public Events": "公開イベント", + "Private Events": "プライベートイベント", + "Liked by": "によって好まれる", + "Comments": "コメント", + "FirstName LastName": "名前苗字", + "Pinned Posts": "固定された投稿", + "Profile": "プロフィール", + "Email": "Eメール", + "Update": "アップデート", + "App Settings": "アプリの設定", + "Language": "言語", + "dark mode": "ダークモード", + "font size": "フォントサイズ", + "Help": "ヘルプ", + "Reach out to us for help": "助けを求めて私たちに連絡してください", + "Donate Us": "寄付してください", + "Help us to develop for you": "あなたのために開発するのを手伝ってください", + "Log out from Talawa": "タラワからログアウトする", + "Share News": "ニュースを共有する", + "Post": "役職", + "Organization Name": "組織名", + "Add hasthtag": "ハッシュタグを追加", + "Write here what do you want to share": "ここに何を共有したいですか", + "Join selected organisation": "選択した組織に参加する", + "Home": "家", + "Events": "イベント", + "Chat": "チャット", + "Chat Screen": "チャット画面", + "Confirm": "確認", + "Confirmation": "確認", + "Close": "選ぶ", + "Switch Organization": "組織の切り替え", + "Join new Organization": "新しい組織に参加する", + "Leave Current Organization": "現在の組織を離れる", + "Creator": "クリエイター", + "Public": "公衆", + "Private": "プライベート", + "No Internet": "インターネットなし", + "Subscribed": "購読済み", + "from": "から", + "See all Pinned news": "ピン留めされたニュースをすべて表示", + "show more": "もっと見せる", + "show less": "表示を減らす", + "Likes": "いいね", + "comments": "コメント", + "Final": "最後の", + "Enter Details": "詳細を入力", + "Select\nOrganization": "組織を選択", + "already selected": "すでに選択済み", + "Switched to": "に切り替え", + "Organisation already joined": "組織はすでに参加しています", + "Membership request already sent": "メンバーシップリクエストはすでに送信されています", + "Select one organization to continue": "続行するには組織を1つ選択してください", + "Something went wrong": "何かがうまくいかなかった", + "Join in request sent to": "に送信されたリクエストに参加する", + "successfully": "正常に", + "Are you sure you want to logout?": "ログアウトしてもよろしいですか?", + "Logout": "ログアウト", + "Settings": "設定", + "Dark Theme": "暗いテーマ", + "Error": "エラー", + "Warning": "警告", + "Information": "情報", + "No account registered with this email": "サーバーが実行されていない/間違った URL", + "Dismiss": "解散", + "No organizations found Please contact your admin": "組織が見つかりません!管理者に連絡してください", + "For complete access, please": "完全にアクセスするには、", + "join an organization.": " 組織に参加します。", + "JOIN": "参加する", + "Camera": "カメラ", + "Gallery": "ギャラリー", + "NEXT": "次へ", + "COMPLETE": "完了", + "Start app tour to know talawa functioning": "タラワの機能を知るためにアプリツアーを開始する", + "Scan QR": "QRをスキャン", + "Add tag": "タグを追加する", + "Enter the Tag": "タグを入力してください", + "Title": "タイトル", + "Where is the event?": "イベントはどこですか?", + "Add Members": "メンバーを追加する", + "All Events": "すべてのイベント", + "Created Events": "作成されたイベント", + "Registered Events": "登録されたイベント", + "Send": "送信", + "Write your comment here..": "ここにコメントを書いてください..", + "You need access": "アクセスが必要です", + "Request access, or switch to an account with access": "アクセスを要求するか、アクセス権のあるアカウントに切り替える", + "Request Access": "アクセスをリクエストする", + "Last Name": "苗字", + "First Name": "名", + "Edit Profile": "プロフィールを編集", + "Log Out": "ログアウト", + "Please Select an amount": "金額を選択してください", + "Input custom amount": "カスタム金額を入力", + "Organisation Name": "組織の名前", + "Choose an Organization": "組織を選択する", + "Your Report has been sent to the Admin": "あなたのレポートは管理者に送信されました", + "Report the post to the Admin": "投稿を管理者に報告する", + "Do you really want to delete the post?": "本当に投稿を削除しますか?", + "Liked": "いいね", + "Looks like there aren't any events.": "イベントがないようです。", + "You have not created any event.": "あなたはどんなイベントも作成していません。", + "No registered events are present": "登録されたイベントは存在しません", + "There aren't any public events.": "公開イベントはありません。", + "There aren't any private events.": "プライベートイベントはありません。", + "Donate to the Community": "コミュニティに寄付する", + "Donating to": "に寄付する", + "Are you sure you want to delete this event?": "このイベントを削除してもよろしいですか?", + "Are you sure you want to exit this organization?": "この組織を退出してもよろしいですか?", + "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc": "これはプロファイルタブです。ここでは、アカウント、アプリの設定、招待、ヘルプなどに関連するすべてのオプションを見ることができます。", + "You can edit application settings like language, theme etc from here": "ここから言語、テーマなどのアプリケーションの設定を編集できます。", + "For any help we are always there. You can reach us from here": "お手伝いが必要な場合はいつでもお手伝いします。ここからお問い合わせいただけます。", + "Current selected Organization Name": "現在選択されている組織の名前", + "Click this button to see options related to switching, joining and leaving organization(s)": "組織の切り替え、参加、退出に関連するオプションを見るには、このボタンをクリックしてください。", + "Current selected Organization's Name appears here": "現在選択されている組織の名前がここに表示されます。", + "All your joined organizations appear over here you can click on them to change the current organization": "参加したすべての組織がここに表示され、現在の組織を変更するにはそれらをクリックできます。", + "From this button you can join other listed organizations": "このボタンから他のリストされた組織に参加できます。", + "To leave the current organization you can use this option": "現在の組織を退出するには、このオプションを使用できます。", + "This is the post card you can like and comment on the post from the options available": "これは投稿カードです。利用可能なオプションから投稿にいいねやコメントをすることができます。", + "This is the Events tab here you can see all event related information of the current selected organization": "これはイベントタブです。ここでは、現在選択されている組織の関連するすべてのイベント情報を見ることができます。", + "This is the home tab here you can see the latest post from other members of the current organization": "これはホームタブです。ここでは、現在の組織の他のメンバーの最新の投稿を見ることができます。", + "This section displays all the important post set by the organization admin(s)": "このセクションには組織の管理者によって設定されたすべての重要な投稿が表示されます。", + "Filter Events based on categories": "カテゴリに基づいてイベントをフィルタリング", + "Filter Events between selected dates": "選択した日付の間でイベントをフィルタリング", + "Description of event to see more details click on the card": "詳細を見るには、イベントの説明をクリックしてください。", + "This is the Create post tab here you can add post to the current selected organization": "これは投稿を作成するタブです。ここでは、現在選択されている組織に投稿を追加できます。", + "This is the Chat tab here you can see all your messages of the current selected organization": "これはチャットタブです。ここでは、現在選択されている組織のすべてのメッセージを見ることができます。", + "To help your organization grow you can support them financially from here": "組織の成長をサポートするためには、ここから経済的にサポートできます。", + "You are all set to go let's get you in": "準備が整いました。さあ、始めましょう。", + "You have no event in this organization": "この組織にはイベントがありません", + "Create your first event": "最初のイベントを作成してください", + "There are no posts in this organization": "この組織には投稿がありません", + "Create your first post": "最初の投稿を作成してください", + "You have no post in this organization": "この組織には投稿がありません", + "You can create a new event from here": "ここから新しいイベントを作成できます", + "You are all set to go lets get you in": "あなたは完全に準備が整いました。入れてあげましょう。", + "App Tour": "アプリトール", + "Start": "開始", + "Skip": "スキップ", + "Posts": "投稿", + "Tasks": "タスク", + "Or": "または", + "Please select any amount": "金額を選択してください", + "Registered": "登録済み", + "Not Registrable": "登録不可", + "Enter the title of your post": "投稿タイトルを入力してください", + "General": "一般", + "Help & Support": "ヘルプとサポート", + "Talawa Docs": "Talawa ドキュメント", + "All day": "1日中", + "Join an Organisation": "団体に参加する", + "DONATE": "寄付する", + "Permission Denied": "許可が拒否されました", + "Camera permission is required, to use this feature, give permission from app settings": "この機能を使用するには、カメラの許可が必要です。アプリの設定から許可を与えてください。", + "SETTINGS": "設定", + "LogOut": "ログアウト", + "Membership request already exist": "メンバーシップリクエストはすでに存在しています", + "Enter a valid password": "有効なパスワードを入力してください", + "Organization Not Found": "組織が見つかりません", + "Account with this email already registered": "このメールアドレスではすでにアカウントが登録されています", + "Something went wrong!": "何かが間違っています!", + "URL doesn't exist/no connection please check": "URLが存在しない/接続がないため、確認してください", + "The QR is not Working": "QRコードが動作していません", + "This QR version is not Supported.": "このQRバージョンはサポートされていません。", + "Comment sent": "コメントを送信しました", + "Server not running/wrong url": "サーバーが実行されていません/URLが違います", + "Couldn't update User details": "ユーザーの詳細を更新できませんでした", + "Image is added": "画像が追加されました", + "Post is uploaded": "投稿がアップロードされました", + "Profile updated successfully": "プロファイルを正常に更新しました", + "The Camera is not working": "カメラが動作していません", + "This QR is not for the App": "このQRコードはアプリには使用できません", + "The tag was added": "タグが追加されました", + "Start time must be before end time": "開始時間は終了時間より前でなければなりません", + "Organisation on different server, logout and scan qr again": "異なるサーバー上の組織です。ログアウトして、QRコードを再びスキャンしてください。", + "Post was deleted if you had the rights!": "権限がある場合、投稿は削除されました!", + "Members": " メンバー " +} diff --git a/lang/pt.json b/lang/pt.json new file mode 100644 index 000000000..861139a63 --- /dev/null +++ b/lang/pt.json @@ -0,0 +1,282 @@ +{ + "Hello": "Olá", + "User Name": "Nome do usuário", + "we've": "wir haben", + "got you covered": "te cobrimos", + "password": "senha", + "Enter new password": "Insira a nova senha", + "Re-Enter your password": "Digite sua senha novamente", + "Change Password": "Mudar senha", + "Email Hint": "test@test.org", + "Enter your registered Email": "Digite seu e-mail cadastrado", + "Enter your password": "Coloque sua senha", + "Forgot password": "Esqueceu sua senha", + "Login": "Conecte-se", + "Sit back relax, we'll": "Sente-se relaxe, vamos", + "Notification Feature is not installed": "O recurso de notificação não está instalado", + "Recover": "Recuperar", + "your password": "sua senha", + "Recover Password": "Recuperar senha", + "Select Language": "Selecione o idioma", + "Default": "Predefinição", + "Select": "Selecione", + "Selected Organization": "Organização Selecionada", + "Continue": "Prosseguir", + "Enter Community URL": "Insira o URL da sua comunidade", + "Verify": "Verificar", + "Sign Up": "Inscrever-se", + "Change language": "Mudar idioma", + "First Name Hint": "John", + "Enter your first name": "Digite seu primeiro nome", + "Last Name Hint": "Carlos", + "Enter your last name": "Digite seu sobrenome", + "Confirm your password": "Confirme sua senha", + "Next": "Próxima", + "Request Sent to": "Pedido enviado para", + "Log out": "Sair", + "Join": "Juntar", + "and": "e", + "Collaborate": "Colaborar", + "with your": "com o seu", + "Organizations": "Organizações", + "Title from the viewMode GSoC branch": "Título da ramificação viewMode GSoC", + "Please verify URL first": "Verifique o URL primeiro", + "Enter a valid URL": "Insira um URL válido", + "Firstname must not be left blank.": "O nome não deve ser deixado em branco.", + "Invalid Firstname": "Nome Inválido", + "Lastname must not be left blank.": "O sobrenome não deve ser deixado em branco.", + "Invalid Lastname": "Sobrenome inválido", + "Email must not be left blank": "O e-mail não deve ser deixado em branco", + "Please enter a valid Email Address": "Por favor insira um endereço de e-mail válido", + "Password must not be left blank": "A senha não deve ser deixada em branco", + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)": "Sua senha deve ter pelo menos 8 caracteres, conter pelo menos um número, uma letra maiúscula e uma minúscula e um caractere especial (@,#,$,etc.)", + "Password must not contain spaces": "A senha não deve conter espaços", + "Password does not match original": "A senha não corresponde ao original", + "Join Organisation": "Junte-se à organização", + "We're": "Estamos", + "Glad": "Alegre", + "you're": "você é", + "Back": "Voltar", + "Let's": "Vamos", + "get": "pegue", + "you": "tu", + "SignUp": "Inscrever-se", + "Please wait": "Por favor, espere", + "for organisation(s) to accept your invitation.": "para a (s) organização (ões) aceitarem o seu convite.", + "Add Event Title": "Adicionar Título do Evento", + "Where is the event": "Onde é o evento", + "Add Location": "Adicionar local", + "Describe the event": "Descreva o evento", + "Add Description": "Adicionar descrição", + "Add Event": "Adicionar Evento", + "Add": "Adicionar", + "Add Image": "Adicionar imagem", + "Select Start Date": "Selecionar data de início", + "Select End Date": "Selecionar data de término", + "Select Start Date and Time": "Selecione a data e hora de início", + "Select End Date and Time": "Selecione a data e hora de término", + "Does not repeat": "Não repete", + "Keep Public": "Manter público", + "Keep Registerable": "Manter registrável", + "Event Details": "detalhes do evento", + "Register": "Registro", + "Created by": "Created by", + "public": "pública", + "private": "privada", + "Description": "Descrição", + "Admins": "Admins", + "Attendees": "Participantes", + "See all": "Ver tudo", + "Start Date": "Data de início", + "End Date": "Data final", + "Cancel": "Cancelar", + "Done": "Feita", + "Explore Events": "Explorar eventos", + "Filters": "Filtros", + "Filter by Date": "Filtrar por data", + "Show all events": "Mostrar todos os eventos", + "Show all events created by you": "Mostrar todos os eventos criados por você", + "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", + "Public Events": "Eventos Públicos", + "Private Events": "Eventos Privados", + "Liked by": "Curtido por", + "Comments": "Comentários", + "FirstName LastName": "Primeiro nome, ultimo nome", + "Pinned Posts": "Postagens fixadas", + "Profile": "Perfil", + "Email": "O email", + "Update": "Atualizar", + "App Settings": "Configurações do aplicativo", + "Language": "Língua", + "dark mode": "modo escuro", + "font size": "tamanho da fonte", + "Help": "Ajuda", + "Reach out to us for help": "Entre em contato conosco para obter ajuda", + "Donate Us": "Doe-nos", + "Help us to develop for you": "Ajude-nos a desenvolver para você", + "Log out from Talawa": "Saia de Talawa", + "Share News": "Compartilhe notícias", + "Post": "Publicar", + "Organization Name": "Nome da organização", + "Add hasthtag": "Adicionar hashtag", + "Write here what do you want to share": "Escreva aqui o que você deseja compartilhar", + "Join selected organisation": "Junte-se à organização selecionada", + "Home": "Casa", + "Events": "Eventos", + "Chat": "Bate-papo", + "Chat Screen": "Tela de bate-papo", + "Confirm": "confirme", + "Confirmation": "Confirmação", + "Close": "Fechar", + "Switch Organization": "Mudar de organização", + "Join new Organization": "Junte-se a uma nova organização", + "Leave Current Organization": "Sair da Organização Atual", + "Creator": "Criadora", + "Public": "Pública", + "Private": "Privada", + "No Internet": "Sem internet", + "Subscribed": "Subscrito", + "from": "a partir de", + "See all Pinned news": "Ver todas as notícias fixadas", + "show more": "mostre mais", + "show less": "mostre menos", + "Likes": "Gosta", + "comments": "comentários", + "Final": "Final", + "Enter Details": "Insira os detalhes", + "Select\nOrganization": "Selecione a Organização", + "already selected": "já selecionado", + "Switched to": "Transferido para", + "Organisation already joined": "Organização já aderiu", + "Membership request already sent": "Pedido de adesão já enviado", + "Select one organization to continue": "Selecione uma organização para continuar", + "Something went wrong": "Algo deu errado", + "Join in request sent to": "Solicitação de adesão enviada para", + "successfully": "com sucesso", + "Are you sure you want to logout?": "Tem certeza que deseja sair?", + "Logout": "Sair", + "Settings": "Definições", + "Dark Theme": "Tema escuro", + "Error": "Erro", + "Warning": "Aviso", + "Information": "Informação", + "No account registered with this email": "Servidor não está em execução/url errado", + "Dismiss": "liberar", + "No organizations found Please contact your admin": "Neniuj organizoj trovitaj! Bonvolu kontakti vian administranton", + "For complete access, please": "Para acesso completo, por favor", + "join an organization.": " ingressar em uma organização.", + "JOIN": "ENTRAR", + "Camera": "Câmera", + "Gallery": "Galeria", + "NEXT": "PRÓXIMO", + "COMPLETE": "COMPLETO", + "Start app tour to know talawa functioning": "Inicie o tour do aplicativo para conhecer o funcionamento do talawa", + "Scan QR": "Escanear QR", + "Add tag": "Adicionar tag", + "Enter the Tag": "Digite a Tag", + "Title": "Título", + "Where is the event?": "Onde é o evento?", + "Add Members": "Adicionar membros", + "All Events": "Todos os eventos", + "Created Events": "Eventos criados", + "Registered Events": "Eventos registrados", + "Send": "Enviar", + "Write your comment here..": "Escreva seu comentário aqui..", + "You need access": "Você precisa de acesso", + "Request access, or switch to an account with access": "Solicitar acesso ou mudar para uma conta com acesso", + "Request Access": "Solicitar acesso", + "Last Name": "Sobrenome", + "First Name": "Nome", + "Edit Profile": "Editar perfil", + "Log Out": "Sair", + "Please Select an amount": "Por favor, selecione um valor", + "Input custom amount": "Inserir valor personalizado", + "Organisation Name": "Nome da Organização", + "Choose an Organization": "Escolha uma Organização", + "Your Report has been sent to the Admin": "Seu relatório foi enviado ao Administrador", + "Report the post to the Admin": "Reportar a postagem ao Administrador", + "Do you really want to delete the post?": "Você realmente quer deletar a postagem?", + "Liked": "Curtido", + "Looks like there aren't any events.": "Parece que não há eventos.", + "You have not created any event.": "Você não criou nenhum evento.", + "No registered events are present": "Não há eventos registrados", + "There aren't any public events.": "Não há eventos públicos.", + "There aren't any private events.": "Não há eventos privados.", + "Donate to the Community": "Doar para a Comunidade", + "Donating to": "Doando para", + "Are you sure you want to delete this event?": "Tem certeza de que deseja excluir este evento?", + "Are you sure you want to exit this organization?": "Tem certeza de que deseja sair desta organização?", + "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc": "Esta é a aba de Perfil, onde você pode ver todas as opções relacionadas à conta, configurações do aplicativo, convites, ajuda, etc.", + "You can edit application settings like language, theme etc from here": "Você pode editar as configurações do aplicativo, como idioma, tema, etc., a partir daqui", + "For any help we are always there. You can reach us from here": "Para qualquer ajuda, estamos sempre aqui. Você pode nos contatar a partir daqui", + "Current selected Organization Name": "Nome da organização atualmente selecionada", + "Click this button to see options related to switching, joining and leaving organization(s)": "Clique neste botão para ver opções relacionadas a trocar, juntar-se e sair de organizações", + "Current selected Organization's Name appears here": "O nome da organização atualmente selecionada aparece aqui", + "All your joined organizations appear over here you can click on them to change the current organization": "Todas as organizações às quais você se juntou aparecem aqui; você pode clicar nelas para mudar a organização atual", + "From this button you can join other listed organizations": "A partir deste botão, você pode se juntar a outras organizações listadas", + "To leave the current organization you can use this option": "Para sair da organização atual, você pode usar esta opção", + "This is the post card you can like and comment on the post from the options available": "Este é o cartão de postagem; você pode curtir e comentar na postagem a partir das opções disponíveis", + "This is the Events tab here you can see all event related information of the current selected organization": "Esta é a aba de Eventos; aqui você pode ver todas as informações relacionadas a eventos da organização atualmente selecionada", + "This is the home tab here you can see the latest post from other members of the current organization": "Esta é a aba Início; aqui você pode ver a última postagem de outros membros da organização atual", + "This section displays all the important post set by the organization admin(s)": "Esta seção exibe todas as postagens importantes definidas pelos administradores da organização", + "Filter Events based on categories": "Filtre eventos com base em categorias", + "Filter Events between selected dates": "Filtre eventos entre as datas selecionadas", + "Description of event to see more details click on the card": "Descrição do evento; para ver mais detalhes, clique no cartão", + "This is the Create post tab here you can add post to the current selected organization": "Esta é a aba de Criar postagem; aqui você pode adicionar uma postagem à organização atualmente selecionada", + "This is the Chat tab here you can see all your messages of the current selected organization": "Esta é a aba de Chat; aqui você pode ver todas as suas mensagens da organização atualmente selecionada", + "To help your organization grow you can support them financially from here": "Para ajudar sua organização a crescer, você pode apoiá-la financeiramente a partir daqui", + "You are all set to go let's get you in": "Você está pronto para ir; vamos começar", + "You have no event in this organization": "Você não tem nenhum evento nesta organização", + "Create your first event": "Crie seu primeiro evento", + "There are no posts in this organization": "Não há posts nesta organização", + "Create your first post": "Crie sua primeira postagem", + "You have no post in this organization": "Você não tem nenhuma postagem nesta organização", + "You can create a new event from here": "Você pode criar um novo evento aqui", + "You are all set to go lets get you in": "Você está tudo pronto para ir, vamos te levar", + "App Tour": "Tour do aplicativo", + "Start": "Iniciar", + "Skip": "Pular", + "Posts": "Postagens", + "Tasks": "Tarefas", + "Or": "Ou", + "Please select any amount": "Por favor, selecione uma quantia", + "Registered": "Registado", + "Not Registrable": "Não registrável", + "Enter the title of your post": "Insira o título do seu post", + "General": "Geral", + "Help & Support": "Ajuda e suporte", + "Talawa Docs": "Talawa Documentos", + "All day": "Todo o dia", + "Join an Organisation": "Junte-se a uma organização", + "DONATE": "DOAR", + "Permission Denied": "Permissão negada", + "Camera permission is required, to use this feature, give permission from app settings": "É necessária permissão de câmera para usar este recurso. Conceda permissão pelas configurações do aplicativo.", + "SETTINGS": "CONFIGURAÇÕES", + "LogOut": "Sair", + "Membership request already exist": "Solicitação de associação já existe", + "Enter a valid password": "Insira uma senha válida", + "Organization Not Found": "Organização não encontrada", + "Account with this email already registered": "Conta com este e-mail já está registrada", + "Something went wrong!": "Algo deu errado!", + "URL doesn't exist/no connection please check": "A URL não existe/não há conexão, verifique", + "The QR is not Working": "O código QR não está funcionando", + "This QR version is not Supported.": "Esta versão do QR não é suportada.", + "Comment sent": "Comentário enviado", + "Server not running/wrong url": "Servidor não está em execução/URL errada", + "Couldn't update User details": "Não foi possível atualizar os detalhes do usuário", + "Image is added": "Imagem adicionada", + "Post is uploaded": "Postagem enviada", + "Profile updated successfully": "Perfil atualizado com sucesso", + "The Camera is not working": "A câmera não está funcionando", + "This QR is not for the App": "Este código QR não é para o aplicativo", + "The tag was added": "A tag foi adicionada", + "Start time must be before end time": "O horário de início deve ser anterior ao horário de término", + "Organisation on different server, logout and scan qr again": "Organização em servidor diferente, faça logout e escaneie o QR novamente", + "Post was deleted if you had the rights!": "A postagem foi excluída se você tiver os direitos!", + "Members": "Membros" +} diff --git a/lang/zh.json b/lang/zh.json new file mode 100644 index 000000000..68e3dc825 --- /dev/null +++ b/lang/zh.json @@ -0,0 +1,282 @@ +{ + "Hello": "你好", + "User Name": "用户名", + "we've": "我们已经", + "got you covered": "为您服务", + "password": "输入您的密码", + "Enter new password": "输入新密码", + "Re-Enter your password": "重新输入您的密码", + "Change Password": "更改密码", + "Email Hint": "test@test.org", + "Enter your registered Email": "输入您的注册邮箱", + "Enter your password": "输入您的密码", + "Forgot password": "你忘记密码了吗", + "Login": "登录", + "Sit back relax, we'll": "高枕无忧, ", + "Recover": "", + "Notification Feature is not installed": "未安装通知功能\n", + "your password": "我们会找回您的密码", + "Recover Password": "恢复你的密码", + "Select Language": "选择语言", + "Default": "默认值", + "Select": "选择", + "Selected Organization": "选定组织", + "Continue": "继续", + "Enter Community URL": "输入您的社区网址", + "Verify": "验证一下", + "Sign Up": "报名", + "Change language": "改变语言", + "First Name Hint": "杰基", + "Enter your first name": "输入您的名字", + "Last Name Hint": "陈", + "Enter your last name": "输入您的姓氏", + "Confirm your password": "确认你的密码", + "Next": "下一个", + "Request Sent to": "请求发送至", + "Log out": "登出", + "Join": "加入您的组织并与之协作", + "and": "", + "Collaborate": "", + "with your": "", + "Organizations": "", + "Title from the viewMode GSoC branch": "来自 viewMode GSoC 分支的标题", + "Please verify URL first": "请先验证网址", + "Enter a valid URL": "输入有效的网址", + "Firstname must not be left blank.": "名字不能留空。", + "Invalid Firstname": "名字无效", + "Lastname must not be left blank.": "姓氏不能留空。", + "Invalid Lastname": "无效的姓氏", + "Email must not be left blank": "电子邮件不得留空", + "Please enter a valid Email Address": "请输入有效的电子邮件地址", + "Password must not be left blank": "密码不能为空", + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,$,etc.)": "您的密码长度必须至少为 8 个字符,至少包含 1 个数字、1 个大写和 1 个小写字母以及 1 个特殊字符(@、#、$ 等)", + "Password must not contain spaces": "密码不能包含空格", + "Password does not match original": "密码与原密码不符", + "Join Organisation": "加入组织", + "We're": "我们很高兴", + "Glad": "", + "you're": "你回来了", + "Back": "", + "Let's": "让我们", + "get": "帮", + "you": "", + "SignUp": "你注册", + "Please wait": "请稍等", + "for organisation(s) to accept your invitation.": "以便组织接受您的邀请。", + "Add Event Title": "添加活动标题", + "Where is the event": "活动地点", + "Add Location": "添加位置", + "Describe the event": "描述事件", + "Add Description": "添加描述", + "Add Event": "添加事件", + "Add": "添加", + "Add Image": "添加图片", + "Select Start Date": "选择开始日期", + "Select End Date": "选择结束日期", + "Select Start Date and Time": "选择开始日期和时间", + "Select End Date and Time": "选择结束日期和时间", + "Does not repeat": "不重复", + "Keep Public": "保持公开", + "Keep Registerable": "保持注册", + "Event Details": "活动详情", + "Register": "注册", + "Created by": "创建者", + "public": "公开", + "private": "私人", + "Description": "说明", + "Admins": "管理员", + "Attendees": "与会者", + "See all": "查看全部", + "Start Date": "开始日期", + "End Date": "结束日期", + "Cancel": "取消", + "Done": "完成", + "Explore Events": "探索事件", + "Filters": "过滤器", + "Filter by Date": "按日期过滤", + "Show all events": "显示所有活动", + "My Events": "我的活动", + "Show all events created by you": "显示由您创建的所有活动", + "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": "名字姓氏", + "Pinned Posts": "已标记的帖子", + "Profile": "简介", + "Email": "电子邮件", + "Update": "更新", + "App Settings": "应用设置", + "Language": "语言", + "dark mode": "黑暗模式", + "font size": "字体大小", + "Help": "帮助", + "Reach out to us for help": "联系我们寻求帮助", + "Donate Us": "捐赠我们", + "Help us to develop for you": "帮助我们为您开发", + "Log out from Talawa": "从 Talawa 注销", + "Share News": "分享新闻", + "Post": "邮政", + "Organization Name": "机构名称", + "Add hasthtag": "添加主题标签", + "Write here what do you want to share": "在这里写下您想分享的内容", + "Join selected organisation": "加入选定的组织", + "Home": "家", + "Events": "事件", + "Chat": "聊天", + "Chat Screen": "聊天画面", + "Confirm": "确认", + "Confirmation": "确认", + "Close": "关闭", + "Switch Organization": "切换组织", + "Join new Organization": "加入新组织", + "Leave Current Organization": "离开当前组织", + "Creator": "创造者", + "Public": "公共", + "Private": "私人", + "No Internet": "没有互联网", + "Subscribed": "订阅", + "from": "来自", + "See all Pinned news": "查看所有置顶新闻", + "show more": "显示更多", + "show less": "显示较少", + "Likes": "喜欢", + "comments": "评论", + "Final": "最终", + "Enter Details": "输入详细信息", + "Select\nOrganization": "Select\nOrganization", + "already selected": "已选", + "Switched to": "切换到", + "Organisation already joined": "组织已加入", + "Membership request already sent": "会员申请已发送", + "Select one organization to continue": "选择一个组织继续", + "Something went wrong": "出问题了", + "Join in request sent to": "加入请求发送至", + "successfully": "成功", + "Are you sure you want to logout?": "您确定要退出吗?", + "Logout": "登出", + "Settings": "设置", + "Dark Theme": "黑暗主题", + "Error": "错误", + "Warning": "警告", + "Information": "信息", + "No account registered with this email": "服务器未运行/网址错误", + "Dismiss": "解雇", + "No organizations found Please contact your admin": "未找到任何组织。请联系您的管理员。", + "For complete access, please": "如需完整访问,请", + "join an organization.": " 加入一个组织。", + "JOIN": "加入", + "Camera": "相机", + "Gallery": "画廊", + "NEXT": "下一个", + "COMPLETE": "完成", + "Start app tour to know talawa functioning": "启动应用程序导览以了解塔拉瓦的功能", + "Scan QR": "扫描QR码", + "Add tag": "添加标签", + "Enter the Tag": "输入标签", + "Title": "标题", + "Where is the event?": "事件在哪里?", + "Add Members": "添加成员", + "All Events": "所有活动", + "Created Events": "创建的活动", + "Registered Events": "注册的活动", + "Send": "发送", + "Write your comment here..": "在此处写下您的评论..", + "You need access": "您需要访问权限", + "Request access, or switch to an account with access": "请求访问权限,或切换到有访问权限的账户", + "Request Access": "请求访问", + "Last Name": "姓氏", + "First Name": "名字", + "Edit Profile": "编辑个人资料", + "Log Out": "登出", + "Please Select an amount": "请选择一个金额", + "Input custom amount": "输入自定义金额", + "Organisation Name": "组织名称", + "Choose an Organization": "选择一个组织", + "Your Report has been sent to the Admin": "您的报告已发送给管理员", + "Report the post to the Admin": "向管理员举报帖子", + "Do you really want to delete the post?": "您真的想要删除这个帖子吗?", + "Liked": "喜欢", + "Looks like there aren't any events.": "看起来没有任何活动。", + "You have not created any event.": "您还没有创建任何活动。", + "No registered events are present": "没有注册的活动", + "There aren't any public events.": "没有公开的活动。", + "There aren't any private events.": "没有私人活动。", + "Donate to the Community": "向社区捐款", + "Donating to": "捐赠给", + "Are you sure you want to delete this event?": "您确定要删除此活动吗?", + "Are you sure you want to exit this organization?": "您确定要退出这个组织吗?", + "This is the Profile tab here you can see all options related to account, app setting, invitation, help etc": "这是个人资料选项卡,您可以在此处查看与帐户、应用设置、邀请、帮助等相关的所有选项。", + "You can edit application settings like language, theme etc from here": "您可以从这里编辑应用程序设置,如语言、主题等。", + "For any help we are always there. You can reach us from here": "任何帮助我们都会在这里。您可以通过这里联系我们。", + "Current selected Organization Name": "当前选择的组织名称", + "Click this button to see options related to switching, joining and leaving organization(s)": "单击此按钮以查看与切换、加入和离开组织相关的选项。", + "Current selected Organization's Name appears here": "当前选择的组织名称将显示在此处。", + "All your joined organizations appear over here you can click on them to change the current organization": "您加入的所有组织都会显示在这里,您可以单击它们以更改当前的组织。", + "From this button you can join other listed organizations": "您可以通过此按钮加入其他列出的组织。", + "To leave the current organization you can use this option": "要离开当前组织,您可以使用此选项。", + "This is the post card you can like and comment on the post from the options available": "这是帖子卡片,您可以从可用的选项中点赞并评论帖子。", + "This is the Events tab here you can see all event related information of the current selected organization": "这是活动选项卡,您可以在此处查看当前选择组织的所有与活动相关的信息。", + "This is the home tab here you can see the latest post from other members of the current organization": "这是主页选项卡,您可以在此处查看当前组织其他成员的最新帖子。", + "This section displays all the important post set by the organization admin(s)": "此部分显示由组织管理员设置的所有重要帖子。", + "Filter Events based on categories": "基于类别筛选事件", + "Filter Events between selected dates": "在选定的日期之间筛选事件", + "Description of event to see more details click on the card": "事件描述以查看更多详情,请单击卡片。", + "This is the Create post tab here you can add post to the current selected organization": "这是创建帖子选项卡,您可以在此处向当前选择的组织添加帖子。", + "This is the Chat tab here you can see all your messages of the current selected organization": "这是聊天选项卡,您可以在此处查看当前选择组织的所有消息。", + "To help your organization grow you can support them financially from here": "要帮助您的组织成长,您可以从这里提供财务支持。", + "You are all set to go let's get you in": "您已经准备好了,让我们开始吧。", + "You have no event in this organization": "您在此组织中没有活动", + "Create your first event": "创建您的第一个活动", + "There are no posts in this organization": "此组织中没有帖子", + "Create your first post": "创建您的第一篇帖子", + "You have no post in this organization": "您在此组织中没有帖子", + "You can create a new event from here": "您可以从这里创建一个新活动", + "You are all set to go lets get you in": "您已经准备好出发了,让我们带您进去", + "App Tour": "应用导览", + "Start": "开始", + "Skip": "跳过", + "Posts": "帖子", + "Tasks": "任务", + "Or": "或者", + "Please select any amount": "请选择任何金额", + "Registered": "已注册", + "Not Registrable": "不可注册", + "Enter the title of your post": "请输入您的帖子标题", + "General": "普通", + "Help & Support": "帮助和支持", + "Talawa Docs": "Talawa 文档", + "All day": "一整天", + "Join an Organisation": "加入一个组织", + "DONATE": "捐赠", + "Permission Denied": "权限被拒绝", + "Camera permission is required, to use this feature, give permission from app settings": "使用此功能需要摄像头权限。请从应用设置中授予权限。", + "SETTINGS": "设置", + "LogOut": "登出", + "Membership request already exist": "已存在会员请求", + "Enter a valid password": "请输入有效密码", + "Organization Not Found": "未找到组织", + "Account with this email already registered": "该电子邮件已注册帐户", + "Something went wrong!": "出错了!", + "URL doesn't exist/no connection please check": "URL不存在/没有连接,请检查", + "The QR is not Working": "二维码无法使用", + "This QR version is not Supported.": "不支持此二维码版本。", + "Comment sent": "已发送评论", + "Server not running/wrong url": "服务器未运行/URL错误", + "Couldn't update User details": "无法更新用户详细信息", + "Image is added": "已添加图像", + "Post is uploaded": "已上传帖子", + "Profile updated successfully": "已成功更新资料", + "The Camera is not working": "相机无法使用", + "This QR is not for the App": "此二维码不适用于本应用", + "The tag was added": "已添加标签", + "Start time must be before end time": "开始时间必须在结束时间之前", + "Organisation on different server, logout and scan qr again": "组织在不同的服务器上,请注销并重新扫描二维码", + "Post was deleted if you had the rights!": "如果您有权限,则已删除帖子!", + "Members": "成员" +} diff --git a/lib/apptheme.dart b/lib/apptheme.dart new file mode 100644 index 000000000..c036bf6bc --- /dev/null +++ b/lib/apptheme.dart @@ -0,0 +1,165 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; + +/// 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', + decorationThickness: 0, + ); + + /// 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, + color: primary, + fontFamily: 'OpenSans', + ); + + /// 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/constants/app_strings.dart b/lib/constants/app_strings.dart new file mode 100644 index 000000000..b0ec7b2b0 --- /dev/null +++ b/lib/constants/app_strings.dart @@ -0,0 +1,84 @@ +/// Talawa Custom error strings. +class TalawaErrors { + /// GraphQL error for handling: User not found. + static const String userNotFound = 'User not found'; + + /// GraphQL error for handling: User is not authenticated. + static const String userNotAuthenticated = 'User is not authenticated'; + + /// GraphQL error for handling: Email address already exists. + static const String emailAccountPresent = 'Email address already exists'; + + /// GraphQL error for handling: Invalid credentials. + static const String wrongCredentials = 'Invalid credentials'; + + /// GraphQL error for handling: Organization not found. + static const String organizationNotFound = 'Organization not found'; + + /// GraphQL error for handling: Access Token has expired. Please refresh session. + static const String refreshAccessTokenExpiredException = + 'Access Token has expired. Please refresh session.'; + + /// GraphQL error for handling: Membership Request already exists. + static const String memberRequestExist = 'Membership Request already exists'; + + /// GraphQL error for handling: Failed to determine project ID. + static const String failedToDetermineProject = + 'Failed to determine project ID: Error while making request: getaddrinfo ENOTFOUND metadata.google.internal. Error code: ENOTFOUND'; + + /// Error for creating a post. + static const String postCreationFailed = + 'You are offline. Failed to create post. Please try again.'; + + /// Error for updating a post. + static const String postUpdateFailed = + 'You are offline. Failed to update post. Please try again.'; + + /// Error for deleting a post. + static const String postDeletionFailed = + 'You are offline. Failed to delete post. Please try again.'; + + /// Error for creating an event. + static const String eventCreationFailed = + 'You are offline. Failed to create event. Please try again.'; + + /// Error for updating an event. + static const String eventUpdateFailed = + 'You are offline. Failed to update event. Please try again.'; + + /// Error for deleting an event. + static const String eventDeletionFailed = + 'You are offline. Failed to delete event. Please try again.'; + + /// Error for sending a chat message. + static const String chatMessageSendFailed = + 'You are offline. Failed to send chat message. Please try again.'; + + /// Error for deleting a chat message. + static const String chatMessageDeletionFailed = + 'You are offline. Failed to delete chat message. Please try again.'; + + /// Error for updating user profile. + static const String userProfileUpdateFailed = + 'You are offline. Failed to update user profile. Please try again.'; + + /// Error for deleting user profile. + static const String userProfileDeletionFailed = + 'You are offline. Failed to delete user profile. Please try again.'; + + /// Error for saving user action. + static const String userActionNotSaved = + 'You are offline. User action not saved.'; + + /// Error for login attempt when offline. + static const String youAreOfflineUnableToLogin = + 'You are offline, unable to login, please try again later.'; + + /// Error for logout attempt when offline. + static const String youAreOfflineUnableToLogout = + 'You are offline, unable to logout, please try again later.'; + + /// Error for signup attempt when offline. + static const String youAreOfflineUnableToSignUp = + 'You are offline, unable to sign up, please try again later.'; +} diff --git a/lib/constants/constants.dart b/lib/constants/constants.dart new file mode 100644 index 000000000..6e248b57b --- /dev/null +++ b/lib/constants/constants.dart @@ -0,0 +1,191 @@ +import 'package:talawa/models/language/language_model.dart'; + +/// This file contains the prototypes of all the supported languages and currencies used in the application. +/// +/// A list of [Language] objects representing the languages supported by the application. +/// +/// Each [Language] object contains the following properties: +/// * `countryCode`: The country code associated with the language. +/// * `langCode`: The language code representing the language. +/// * `langName`: The name of the language in its native script. +/// * `langSample`: A sample text phrase in the language, used for display purposes. +List languages = [ + Language( + countryCode: 'US', + langCode: 'en', + langName: 'English', + langSample: 'Welcome User', + ), + Language( + countryCode: 'IN', + langCode: 'hi', + langName: 'हिंदी', + langSample: 'स्वागत उपयोगकर्ता', + ), + Language( + countryCode: 'CN', + langCode: 'zh', + langName: '中国人', + langSample: '欢迎用户', + ), + Language( + countryCode: 'FR', + langCode: 'fr', + langName: 'français', + langSample: 'Bienvenue utilisateur', + ), + Language( + countryCode: 'ES', + langCode: 'es', + langName: 'Española', + langSample: 'Bienvenida usuario', + ), + Language( + countryCode: 'JP', + langCode: 'ja', + langName: '日本', + langSample: 'ようこそユーザー', + ), + Language( + countryCode: 'GE', + langCode: 'de', + langName: 'Deutsch', + langSample: 'Willkommen Benutzer', + ), + Language( + countryCode: 'PE', + langCode: 'pt', + langName: 'português', + langSample: 'Bem-vindo, usuário', + ), +]; + +/// A list of supported currency codes used in the application. +/// +/// Each currency code is represented as a string in the list. This list is used to ensure that the application +/// supports various currencies for transactions, conversions, or displays. +List supportedCurrencies = [ + 'AED', + 'ALL', + 'AMD', + 'ARS', + 'AUD', + 'AWG', + 'BBD', + 'BDT', + 'BMD', + 'BND', + 'BOB', + 'BSD', + 'BWP', + 'BZD', + 'CAD', + 'CHF', + 'CNY', + 'COP', + 'CRC', + 'CUP', + 'CZK', + 'DKK', + 'DOP', + 'DZD', + 'EGP', + 'ETB', + 'EUR', + 'FJD', + 'GBP', + 'GHS', + 'GIP', + 'GMD', + 'GTQ', + 'GYD', + 'HKD', + 'HNL', + 'HRK', + 'HTG', + 'HUF', + 'IDR', + 'ILS', + 'INR', + 'JMD', + 'KES', + 'KGS', + 'KHR', + 'KYD', + 'KZT', + 'LAK', + 'LBP', + 'LKR', + 'LRD', + 'LSL', + 'MAD', + 'MDL', + 'MKD', + 'MMK', + 'MNT', + 'MOP', + 'MUR', + 'MVR', + 'MWK', + 'MXN', + 'MYR', + 'NAD', + 'NGN', + 'NIO', + 'NOK', + 'NPR', + 'NZD', + 'PEN', + 'PGK', + 'PHP', + 'PKR', + 'QAR', + 'RUB', + 'SAR', + 'SCR', + 'SEK', + 'SGD', + 'SLL', + 'SOS', + 'SSP', + 'SVC', + 'SZL', + 'THB', + 'TTD', + 'TZS', + 'USD', + 'UYU', + 'UZS', + 'YER', + 'ZAR', +]; + +/// A class containing static constants representing the keys used to identify Hive boxes in the application. +/// +/// These keys are used to open or access specific Hive boxes, which store various types of data such as user information, +/// organization details, and cached actions. +class HiveKeys { + /// The key used to identify the Hive box that stores the current user information. + static const userBoxKey = 'currentUser'; + + /// The key used to identify the Hive box that stores the current organization's information. + static const orgBoxKey = 'currentOrg'; + + /// The key used to identify the Hive box that stores asymmetric keys for the user. + static const asymetricKeyBoxKey = 'user_keys'; + + /// The key used to identify the Hive box that stores plugin-related data. + static const pluginBoxKey = 'pluginBox'; + + /// The key used to identify the Hive box that stores URLs. + static const urlBoxKey = 'url'; + + /// The key used to identify the Hive box that stores the post feed data. + static const postFeedKey = 'post_feed_key'; + + /// The key used to identify the Hive box that stores the event feed data. + static const eventFeedKey = 'event_feed_key'; + + /// The key used to identify the Hive box that stores the offline action queue. + static const offlineActionQueueKey = 'offline_action_queue'; +} diff --git a/lib/constants/custom_theme.dart b/lib/constants/custom_theme.dart new file mode 100644 index 000000000..8f01eee81 --- /dev/null +++ b/lib/constants/custom_theme.dart @@ -0,0 +1,145 @@ +import 'package:flutter/material.dart'; + +///This file contains various custom themes. +/// +///For instance, lightTheme, darkTheme, _lightTextTheme, _darkTextTheme, etc. +///These are imported to other files/widgets to apply the required themes. +class TalawaTheme { + static const Color _lightCursorColor = Color(0xff34AD64); + static const Color _lightAccentColor = Color(0xff34AD64); + static const Color _lightScaffoldColor = Colors.white; + static const Color _lightPrimaryColor = Colors.white; + static const Color _lightPrimaryVariantColor = Color(0xFFe5e5e5); + static const Color _lightIconColor = Color(0xff8C8E8D); + static const Color _lightInBlack = Color(0xff000000); + static const Color _lightColorSchemePrimary = Color(0xfffabc57); + + static const Color _darkCursorColor = Color(0xff34AD64); + static const Color _darkAccentColor = Color(0xff34AD64); + static const Color _darkScaffoldColor = Color(0xff18191A); + static const Color _darkPrimaryColor = Colors.black; + static const Color _darkPrimaryVariantColor = Colors.black; + static const Color _darkIconColor = Colors.white70; + static const Color _darkInWhite = Color(0xffffffff); + static const Color _darkColorSchemePrimary = Color(0xfffabc57); + + /// Theme for light mode. + static final lightTheme = ThemeData( + scaffoldBackgroundColor: _lightScaffoldColor, + textSelectionTheme: const TextSelectionThemeData( + cursorColor: _lightCursorColor, + ), + primaryColor: _lightPrimaryColor, + iconTheme: const IconThemeData( + color: _lightIconColor, + ), + fontFamily: 'product-sans', + textTheme: _lightTextTheme, + inputDecorationTheme: _lightInputDecor, + colorScheme: const ColorScheme.light( + primaryContainer: _lightPrimaryVariantColor, + primary: _lightColorSchemePrimary, + secondary: Color(0xffF5F5F5), + onSecondary: Colors.black, + secondaryContainer: _darkScaffoldColor, + tertiary: Colors.black26, + tertiaryContainer: Color.fromARGB(255, 231, 231, 231), + ).copyWith(secondary: _lightAccentColor), + ); + + /// Theme for dark mode. + static final darkTheme = ThemeData( + textSelectionTheme: const TextSelectionThemeData( + cursorColor: _darkCursorColor, + ), + scaffoldBackgroundColor: _darkScaffoldColor, + primaryColor: _darkPrimaryColor, + iconTheme: const IconThemeData( + color: _darkIconColor, + ), + fontFamily: 'product-sans', + textTheme: _darkTextTheme, + inputDecorationTheme: _darkInputDecor, + colorScheme: const ColorScheme.dark( + primaryContainer: _darkPrimaryVariantColor, + primary: _darkColorSchemePrimary, + secondary: Colors.black, + onSecondary: Colors.white, + secondaryContainer: _lightScaffoldColor, + tertiary: Colors.white70, + tertiaryContainer: Color.fromARGB(255, 61, 61, 61), + ).copyWith(secondary: _darkAccentColor), + ); + + static const TextTheme _lightTextTheme = TextTheme( + headlineMedium: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 34, + ), + headlineSmall: TextStyle( + color: _lightInBlack, + fontSize: 20, + ), + titleLarge: TextStyle( + fontSize: 16, + color: Color(0xFF737373), + ), + bodyLarge: TextStyle(fontSize: 14, color: Color(0xFF737373)), + bodyMedium: TextStyle(fontSize: 14), + bodySmall: TextStyle( + fontWeight: FontWeight.w400, + color: Color(0xFF737373), + fontSize: 12.0, + ), + ); + + static const TextTheme _darkTextTheme = TextTheme( + headlineMedium: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 34, + ), + headlineSmall: TextStyle(color: _darkInWhite, fontSize: 20), + titleLarge: TextStyle( + fontSize: 16, + color: Color(0xFF737373), + ), + bodyLarge: TextStyle( + fontSize: 14, + color: Colors.white, + ), + bodyMedium: TextStyle( + fontSize: 14, + color: Colors.white, + ), + bodySmall: TextStyle( + fontWeight: FontWeight.w400, + color: Color(0xFF737373), + fontSize: 12.0, + ), + ); + + static const InputDecorationTheme _lightInputDecor = InputDecorationTheme( + border: InputBorder.none, + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0xFF008A37)), + ), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.grey), + ), + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + errorMaxLines: 3, + ); + static const InputDecorationTheme _darkInputDecor = InputDecorationTheme( + border: InputBorder.none, + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0xFF008A37)), + ), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.grey), + ), + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + errorMaxLines: 3, + ); +} diff --git a/lib/constants/quick_actions.dart b/lib/constants/quick_actions.dart new file mode 100644 index 000000000..690fbbd08 --- /dev/null +++ b/lib/constants/quick_actions.dart @@ -0,0 +1,32 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:quick_actions/quick_actions.dart'; + +///This file contains the shortcuts by which user can manage and interact with the +///application. quick_actions package is used for this purpose. +class ShortCutMenu { + static final quickActionsList = [ + eventAction, + feedAction, + chatAction, + ]; + + static const eventAction = ShortcutItem( + type: "events_action", + localizedTitle: "Events", + icon: "event_icon", + ); + + static const feedAction = ShortcutItem( + type: "feed_action", + localizedTitle: "NewsFeed", + icon: "newsfeed_icon", + ); + + static const chatAction = ShortcutItem( + type: "chat_action", + localizedTitle: "Messages", + icon: "chat_icon", + ); +} diff --git a/lib/constants/recurrence_values.dart b/lib/constants/recurrence_values.dart new file mode 100644 index 000000000..ff55d17c7 --- /dev/null +++ b/lib/constants/recurrence_values.dart @@ -0,0 +1,279 @@ +import 'dart:core'; +import 'package:intl/intl.dart'; + +/// Class containing constants for event intervals. +class EventIntervals { + /// Constant representing an event that occurs every day. + static const daily = 'day'; + + /// Constant representing an event that occurs every week. + static const weekly = 'week'; + + /// Constant representing an event that occurs every month. + static const monthly = 'month'; + + /// Constant representing an event that occurs every year. + static const yearly = 'year'; +} + +/// Class containing constants for event end types. +class EventEndTypes { + /// Constant representing an event that never ends. + static const never = 'never'; + + /// Constant representing an event that ends on a specific date. + static const on = 'on'; + + /// Constant representing an event that ends after a specified number of occurrences. + static const after = 'after'; +} + +/// Class containing constants for frequency options. +class Frequency { + /// Constant representing an event that occurs every day. + static const daily = 'DAILY'; + + /// Constant representing an event that occurs every week. + static const weekly = 'WEEKLY'; + + /// Constant representing an event that occurs every month. + static const monthly = 'MONTHLY'; + + /// Constant representing an event that occurs every year. + static const yearly = 'YEARLY'; +} + +/// Class containing constants for week days. +class WeekDays { + /// Constant representing Sunday. + static const sunday = 'SUNDAY'; + + /// Constant representing Monday. + static const monday = 'MONDAY'; + + /// Constant representing Tuesday. + static const tuesday = 'TUESDAY'; + + /// Constant representing Wednesday. + static const wednesday = 'WEDNESDAY'; + + /// Constant representing Thursday. + static const thursday = 'THURSDAY'; + + /// Constant representing Friday. + static const friday = 'FRIDAY'; + + /// Constant representing Saturday. + static const saturday = 'SATURDAY'; +} + +/// Class containing constants for recurrence end types. +class RecurringEventMutationType { + /// Constant representing mutation of current instance only. + static const thisInstance = 'ThisInstance'; + + /// constant representing mutation of current and following instances. + static const thisAndFollowingInstances = 'ThisAndFollowingInstances'; + + /// constant representing mutation of all instances. + static const allInstances = 'AllInstances'; +} + +/// represents all the days in a week. +List days = [ + WeekDays.monday, + WeekDays.tuesday, + WeekDays.wednesday, + WeekDays.thursday, + WeekDays.friday, + WeekDays.saturday, + WeekDays.sunday, +]; + +/// conatins all neccessary utils. +class RecurrenceUtils { + /// represents all the months. + static const List monthNames = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', + ]; + + /// represents all the week day occurences. + static const List weekDayOccurences = [ + 'First', + 'Second', + 'Third', + 'Fourth', + 'Last', + ]; + + /// represents all the week days. + static const List weekDays = [ + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday', + 'Sunday', + ]; + + /// 'getRecurrenceRuleText' return text for various recurrence rules. + /// + /// **params**: + /// * `frequency`: Frequency of the event. + /// * `weekDays`: List of week days. + /// * `interval`: Interval of the event. + /// * `count`: Count of the event. + /// * `weekDayOccurenceInMonth`: Week day occurence in month. + /// * `startDate`: Start date of the event. + /// * `endDate`: End date of the event. + /// + /// **returns**: + /// * `String`: Recurrence rule text. + static String getRecurrenceRuleText( + String frequency, + Set? weekDays, + int? interval, + int? count, + int? weekDayOccurenceInMonth, + DateTime startDate, + DateTime? endDate, + ) { + String recurrenceRuleText = ''; + + switch (frequency) { + case Frequency.daily: + if (interval != null && interval > 1) { + recurrenceRuleText = 'Every $interval days'; + } else { + recurrenceRuleText = 'Daily'; + } + break; + case Frequency.weekly: + if (weekDays == null) { + break; + } + if (interval != null && interval > 1) { + recurrenceRuleText = 'Every $interval weeks on '; + } else { + recurrenceRuleText = 'Weekly on '; + } + recurrenceRuleText += getWeekDaysString(weekDays.toList()); + break; + case Frequency.monthly: + if (interval != null && interval > 1) { + recurrenceRuleText = 'Every $interval months on '; + } else { + recurrenceRuleText = 'Monthly on '; + } + + if (weekDayOccurenceInMonth != null) { + final getOccurence = + weekDayOccurenceInMonth != -1 ? weekDayOccurenceInMonth - 1 : 4; + recurrenceRuleText += + '${weekDayOccurences[getOccurence]} ${RecurrenceUtils.weekDays[startDate.weekday - 1]}'; + } else { + recurrenceRuleText += 'Day ${startDate.day}'; + } + break; + case Frequency.yearly: + if (interval != null && interval > 1) { + recurrenceRuleText = 'Every $interval years on '; + } else { + recurrenceRuleText = 'Annually on '; + } + recurrenceRuleText += + '${monthNames[startDate.month - 1]} ${startDate.day}'; + break; + } + + if (endDate != null) { + final formatter = DateFormat('MMMM dd, yyyy'); + recurrenceRuleText += ', until ${formatter.format(endDate)}'; + } + + if (count != null) { + recurrenceRuleText += ', $count ${count > 1 ? 'times' : 'time'}'; + } + + return recurrenceRuleText; + } + + /// 'getWeekDaysString' returns string for weekDays. + /// + /// **params**: + /// * `weekDays`: List of Weekdays + /// + /// **returns**: + /// * `String`: returns string for weekDays. + static String getWeekDaysString(List weekDays) { + final fullDayNames = weekDays + .map((day) => RecurrenceUtils.weekDays[weekDays.indexOf(day)]) + .toList(); + + String weekDaysString = fullDayNames.join(', '); + + final lastCommaIndex = weekDaysString.lastIndexOf(','); + if (lastCommaIndex != -1) { + weekDaysString = + '${weekDaysString.substring(0, lastCommaIndex)} &${weekDaysString.substring(lastCommaIndex + 1)}'; + } + + return weekDaysString; + } + + /// 'getWeekDayOccurenceInMonth' returns the week day occurence in month. + /// + /// **params**: + /// * `date`: Date of the event. + /// + /// **returns**: + /// * `int`: Week day occurence in month. + static int getWeekDayOccurenceInMonth(DateTime date) { + final dayOfMonth = date.day; + + // Calculate the current occurrence + final occurrence = (dayOfMonth / 7).ceil(); + + return occurrence; + } + + /// Function to check whether cuurent event instance is Last occurence of Week Day. + /// + /// **params**: + /// * `date`: Date of the event. + /// + /// **returns**: + /// * `bool`: Returns true if the current event instance is the last occurence of the week day. + static bool isLastOccurenceOfWeekDay(DateTime date) { + final currentDay = date.weekday; + + DateTime lastOccurenceInMonth = DateTime( + date.year, + date.month + 1, + 0, + ); + + // set the lastOccurenceInMonth to that day's last occurence + while (lastOccurenceInMonth.weekday != currentDay) { + lastOccurenceInMonth = DateTime( + lastOccurenceInMonth.year, + lastOccurenceInMonth.month, + lastOccurenceInMonth.day - 1, + ); + } + + return date.day == lastOccurenceInMonth.day; + } +} diff --git a/lib/constants/routing_constants.dart b/lib/constants/routing_constants.dart new file mode 100644 index 000000000..912213978 --- /dev/null +++ b/lib/constants/routing_constants.dart @@ -0,0 +1,123 @@ +///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 demoHomeScreen = "/demoHomeScreen"; + + /// 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 demoExploreEventsScreen = "/demoExploreEvents"; + + /// static variables. + static const String eventInfoPage = "/eventInfo"; + + /// static variables. + static const String createEventPage = "/createEventPage"; + + /// static variables. + static const String customRecurrencePage = "/customRecurrencePage"; + + /// static variables. + static const String profilePage = "/profilePage"; + + /// static variables. + static const String demoProfilePage = "/demoProfilePage"; + + /// 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 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'; + + /// static variable to access pinnedpostscreen. + static const String pinnedPostScreen = '/pinnedpostscreen'; + + /// static variable to access addPostScreen. + static const String addPostScreen = '/addpostscreen'; + + /// static variable to access org info screen. + static const String orgInfoScreen = '/OrganisationInfoScreen'; + + ///static variable to access volunteer groups screen. + static const String volunteerGroupScreen = '/volunteerScreen'; + + ///static variable to access Manage volunteer group screen. + static const String manageVolunteerGroup = '/manageVolunteerScreen'; +} diff --git a/lib/constants/timeout.dart b/lib/constants/timeout.dart new file mode 100644 index 000000000..810a3c944 --- /dev/null +++ b/lib/constants/timeout.dart @@ -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; +} diff --git a/lib/controllers/auth_controller.dart b/lib/controllers/auth_controller.dart deleted file mode 100644 index 8997de739..000000000 --- a/lib/controllers/auth_controller.dart +++ /dev/null @@ -1,48 +0,0 @@ -//flutter packages to be called here -import 'package:flutter/material.dart'; - -//pages are called here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/model/token.dart'; -import 'package:talawa/utils/uidata.dart'; - -class AuthController with ChangeNotifier { - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final Queries _queries = Queries(); - final Preferences _pref = Preferences(); - String imgSrc; - - //function that uses refresh token to get new access token and refresh token when access token is expired - Future getNewToken() async { - final String refreshToken = await _pref.getRefreshToken(); - - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(_queries.refreshToken(refreshToken)))); - - if (result.hasException) { - print(result.exception); - } else if (!result.hasException && !result.loading) { - final Token accessToken = Token( - tokenString: result.data['refreshToken']['accessToken'].toString()); - await _pref.saveToken(accessToken); - final Token refreshToken = Token( - tokenString: result.data['refreshToken']['refreshToken'].toString()); - await _pref.saveRefreshToken(refreshToken); - } else { - return; - } - } - - //clears user and org details and pages stack - Future logout(BuildContext context) async { - await Preferences.clearUser(); - super.dispose(); - Navigator.pushNamedAndRemoveUntil( - context, UIData.loginPageRoute, (r) => false); - } -} diff --git a/lib/controllers/org_controller.dart b/lib/controllers/org_controller.dart deleted file mode 100644 index 919b33242..000000000 --- a/lib/controllers/org_controller.dart +++ /dev/null @@ -1,17 +0,0 @@ -//flutter packages are called here -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; - -//pages are called here -import 'package:talawa/services/preferences.dart'; - -class OrgController with ChangeNotifier { - final Preferences _pref = Preferences(); - - Future setNewOrg( - BuildContext context, String newOrgId, String newOrgName) async { - await Preferences.removeOrg(); - await _pref.saveCurrentOrgId(newOrgId); - await _pref.saveCurrentOrgName(newOrgName); - } -} diff --git a/lib/controllers/post_controller.dart b/lib/controllers/post_controller.dart deleted file mode 100644 index 19937d0f4..000000000 --- a/lib/controllers/post_controller.dart +++ /dev/null @@ -1,119 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/api_functions.dart'; - -class PostController with ChangeNotifier { - PostController() { - getPosts(); - } - List posts = []; - Preferences preferences = Preferences(); - ApiFunctions apiFunctions = ApiFunctions(); - String currentUserID; - Map likePostMap = {}; - Timer timer; - - // void : function function to all posts - void addAllPost(List posts) { - this.posts = posts; - notifyListeners(); - } - - void switchOrg() { - print(posts); - posts.clear(); - getPosts(); - } - - // void : function to get all Posts - Future getPosts() async { - final DateTime d1 = DateTime.now(); - final String currentOrgID = await preferences.getCurrentOrgId(); - final String currentUserID = await preferences.getUserId(); - this.currentUserID = currentUserID; - final String query = Queries().getPostsById(currentOrgID); - final Map result = await apiFunctions.gqlquery(query); - print(DateTime.now().difference(d1)); - if (result != null) { - print(posts.isEmpty); - updateLikepostMap(currentUserID); - posts.isEmpty - ? addAllPost(result['postsByOrganization'].reversed.toList() as List) - : updatePosts( - result['postsByOrganization'].reversed.toList() as List); - updateLikepostMap(currentUserID); - } - } - - // void : function to addlike - Future addLike(int index, String postID) async { - final String mutation = Queries().addLike(postID) as String; - final Map result = await apiFunctions.gqlmutation(mutation) as Map; - print(result); - posts[index]["likeCount"]++; - print(index); - posts[index]['likedBy'].add({'_id': currentUserID}); - print(posts[index]["likeCount"]); - likePostMap[posts[index]['_id'] as String] = true; - notifyListeners(); - } - - // void : function to remove the likes - Future removeLike(int index, String postID) async { - final String mutation = Queries().removeLike(postID) as String; - final Map result = await apiFunctions.gqlmutation(mutation) as Map; - print(result); - posts[index]["likeCount"]--; - posts[index]['likedBy'].remove(posts[index]['likedCount']); - print(posts[index]["likeCount"]); - likePostMap[posts[index]['_id'] as String] = false; - notifyListeners(); - } - - void addComment(int index, Map comment) { - posts[index]["commentCount"]++; - posts[index]['comments'].add(comment); - notifyListeners(); - } - - // void : function to update Posts - void updatePosts(List updatedposts) { - int insertAt = 0; - updatedposts.forEach((element) { - if (int.parse(element['createdAt'] as String) > - int.parse(posts.first['createdAt'] as String)) { - posts.insert(insertAt, element); - insertAt++; - } else { - notifyListeners(); - return; - } - }); - } - - // void : function to set the map of userLikedPost - void updateLikepostMap(String currentUserID) { - // traverse through post objects. - for (var item in posts) { - item = item as Map; - likePostMap[item['_id'] as String] = false; - //Get userIds who liked the post. - final _likedBy = item['likedBy']; - for (final user in _likedBy) { - if (user['_id'] == currentUserID) { - //if(userId is in the list we make value true;) - likePostMap[item['_id'] as String] = true; - } - } - } - return; - } - - // bool : Method to get (true/false) if a user has liked a post or Not. - bool hasUserLiked(String postId) { - return likePostMap[postId]; - } -} diff --git a/lib/custom_painters/language_icon.dart b/lib/custom_painters/language_icon.dart new file mode 100644 index 000000000..dbc2d1d87 --- /dev/null +++ b/lib/custom_painters/language_icon.dart @@ -0,0 +1,330 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; + +///This class draws the language icon using custom paint. +///CustomPaint is a widget from the Flutter SDK, which enables +/// you to use a canvas to draw different shapes. +class LanguageIcon extends CustomPainter { + @override + void paint(Canvas canvas, Size size) { + final Path path_0 = Path(); + path_0.moveTo(size.width * 0.2376568, size.height * 0.4381250); + path_0.cubicTo( + size.width * 0.2321886, + size.height * 0.4003127, + size.width * 0.2254689, + size.height * 0.3343750, + size.width * 0.2254689, + size.height * 0.3343750, + ); + path_0.lineTo(size.width * 0.2246875, size.height * 0.3343750); + path_0.cubicTo( + size.width * 0.2246875, + size.height * 0.3343750, + size.width * 0.2179686, + size.height * 0.4003127, + size.width * 0.2125000, + size.height * 0.4381250, + ); + path_0.lineTo(size.width * 0.1951561, size.height * 0.5553136); + path_0.lineTo(size.width * 0.2546886, size.height * 0.5553136); + path_0.lineTo(size.width * 0.2376568, size.height * 0.4381250); + path_0.close(); + path_0.moveTo(size.width * 0.9625000, 0); + path_0.lineTo(size.width * 0.5250000, 0); + path_0.lineTo(size.width * 0.5250000, size.height); + path_0.lineTo(size.width * 0.9625000, size.height); + path_0.cubicTo( + size.width * 0.9832818, + size.height, + size.width, + size.height * 0.9665636, + size.width, + size.height * 0.9250000, + ); + path_0.lineTo(size.width, size.height * 0.07500000); + path_0.cubicTo( + size.width, + size.height * 0.03343750, + size.width * 0.9832818, + 0, + size.width * 0.9625000, + 0, + ); + path_0.close(); + path_0.moveTo(size.width * 0.9250000, size.height * 0.3750000); + path_0.cubicTo( + size.width * 0.9250000, + size.height * 0.3956250, + size.width * 0.9165636, + size.height * 0.4125000, + size.width * 0.9062500, + size.height * 0.4125000, + ); + path_0.lineTo(size.width * 0.8884364, size.height * 0.4125000); + path_0.cubicTo( + size.width * 0.8776568, + size.height * 0.4862500, + size.width * 0.8545318, + size.height * 0.5606227, + size.width * 0.8217182, + size.height * 0.6309364, + ); + path_0.cubicTo( + size.width * 0.8348432, + size.height * 0.6509364, + size.width * 0.8484364, + size.height * 0.6700000, + size.width * 0.8625000, + size.height * 0.6871864, + ); + path_0.cubicTo( + size.width * 0.8710932, + size.height * 0.6978136, + size.width * 0.8739068, + size.height * 0.7200000, + size.width * 0.8689068, + size.height * 0.7378136, + ); + path_0.lineTo(size.width * 0.8565636, size.height * 0.7812500); + path_0.cubicTo( + size.width * 0.8512500, + size.height * 0.7996864, + size.width * 0.8395318, + size.height * 0.8056227, + size.width * 0.8304682, + size.height * 0.7946864, + ); + path_0.cubicTo( + size.width * 0.8107818, + size.height * 0.7703136, + size.width * 0.7921886, + size.height * 0.7443727, + size.width * 0.7751568, + size.height * 0.7168727, + ); + path_0.cubicTo( + size.width * 0.7581250, + size.height * 0.7440636, + size.width * 0.7396886, + size.height * 0.7703136, + size.width * 0.7198432, + size.height * 0.7946864, + ); + path_0.cubicTo( + size.width * 0.7107818, + size.height * 0.8056227, + size.width * 0.6990636, + size.height * 0.7996864, + size.width * 0.6937500, + size.height * 0.7812500, + ); + path_0.lineTo(size.width * 0.6814068, size.height * 0.7378136); + path_0.cubicTo( + size.width * 0.6764068, + size.height * 0.7203136, + size.width * 0.6792182, + size.height * 0.6978136, + size.width * 0.6879682, + size.height * 0.6871864, + ); + path_0.cubicTo( + size.width * 0.7025000, + size.height * 0.6693727, + size.width * 0.7160932, + size.height * 0.6506273, + size.width * 0.7287500, + size.height * 0.6309364, + ); + path_0.cubicTo( + size.width * 0.7164068, + size.height * 0.6046864, + size.width * 0.7054682, + size.height * 0.5778136, + size.width * 0.6959386, + size.height * 0.5506273, + ); + path_0.cubicTo( + size.width * 0.6896886, + size.height * 0.5328136, + size.width * 0.6925000, + size.height * 0.5081273, + size.width * 0.7017182, + size.height * 0.4971864, + ); + path_0.lineTo(size.width * 0.7118750, size.height * 0.4850000); + path_0.lineTo(size.width * 0.7232818, size.height * 0.4715636); + path_0.cubicTo( + size.width * 0.7317182, + size.height * 0.4615636, + size.width * 0.7426568, + size.height * 0.4662500, + size.width * 0.7482818, + size.height * 0.4821864, + ); + path_0.cubicTo( + size.width * 0.7560932, + size.height * 0.5040636, + size.width * 0.7651568, + size.height * 0.5259364, + size.width * 0.7754682, + size.height * 0.5475000, + ); + path_0.cubicTo( + size.width * 0.7965614, + size.height * 0.5031273, + size.width * 0.8126568, + size.height * 0.4571864, + size.width * 0.8223432, + size.height * 0.4125000, + ); + path_0.lineTo(size.width * 0.6437500, size.height * 0.4125000); + path_0.cubicTo( + size.width * 0.6334386, + size.height * 0.4125000, + size.width * 0.6250000, + size.height * 0.3956250, + size.width * 0.6250000, + size.height * 0.3750000, + ); + path_0.lineTo(size.width * 0.6250000, size.height * 0.3250000); + path_0.cubicTo( + size.width * 0.6250000, + size.height * 0.3043750, + size.width * 0.6334386, + size.height * 0.2875000, + size.width * 0.6437500, + size.height * 0.2875000, + ); + path_0.lineTo(size.width * 0.7437500, size.height * 0.2875000); + path_0.lineTo(size.width * 0.7437500, size.height * 0.2375000); + path_0.cubicTo( + size.width * 0.7437500, + size.height * 0.2168750, + size.width * 0.7521886, + size.height * 0.2000000, + size.width * 0.7625000, + size.height * 0.2000000, + ); + path_0.lineTo(size.width * 0.7875000, size.height * 0.2000000); + path_0.cubicTo( + size.width * 0.7978136, + size.height * 0.2000000, + size.width * 0.8062500, + size.height * 0.2168750, + size.width * 0.8062500, + size.height * 0.2375000, + ); + path_0.lineTo(size.width * 0.8062500, size.height * 0.2875000); + path_0.lineTo(size.width * 0.9062500, size.height * 0.2875000); + path_0.cubicTo( + size.width * 0.9165636, + size.height * 0.2875000, + size.width * 0.9250000, + size.height * 0.3043750, + size.width * 0.9250000, + size.height * 0.3250000, + ); + path_0.lineTo(size.width * 0.9250000, size.height * 0.3750000); + path_0.close(); + path_0.moveTo(0, size.height * 0.07500000); + path_0.lineTo(0, size.height * 0.9250000); + path_0.cubicTo( + 0, + size.height * 0.9665636, + size.width * 0.01671875, + size.height, + size.width * 0.03750000, + size.height, + ); + path_0.lineTo(size.width * 0.4750000, size.height); + path_0.lineTo(size.width * 0.4750000, 0); + path_0.lineTo(size.width * 0.03750000, 0); + path_0.cubicTo( + size.width * 0.01671875, + 0, + 0, + size.height * 0.03343750, + 0, + size.height * 0.07500000, + ); + path_0.close(); + path_0.moveTo(size.width * 0.09203136, size.height * 0.7503136); + path_0.lineTo(size.width * 0.1818750, size.height * 0.2218750); + path_0.cubicTo( + size.width * 0.1845314, + size.height * 0.2065623, + size.width * 0.1915625, + size.height * 0.1965623, + size.width * 0.1996875, + size.height * 0.1965623, + ); + path_0.lineTo(size.width * 0.2504682, size.height * 0.1965623); + path_0.cubicTo( + size.width * 0.2584386, + size.height * 0.1965623, + size.width * 0.2656250, + size.height * 0.2068750, + size.width * 0.2682818, + size.height * 0.2218750, + ); + path_0.lineTo(size.width * 0.3581250, size.height * 0.7503136); + path_0.cubicTo( + size.width * 0.3621864, + size.height * 0.7746864, + size.width * 0.3532818, + size.height * 0.8000000, + size.width * 0.3403136, + size.height * 0.8000000, + ); + path_0.lineTo(size.width * 0.3045318, size.height * 0.8000000); + path_0.cubicTo( + size.width * 0.3004886, + size.height * 0.7999955, + size.width * 0.2965523, + size.height * 0.7973727, + size.width * 0.2933159, + size.height * 0.7925318, + ); + path_0.cubicTo( + size.width * 0.2900773, + size.height * 0.7876864, + size.width * 0.2877091, + size.height * 0.7808818, + size.width * 0.2865614, + size.height * 0.7731227, + ); + path_0.lineTo(size.width * 0.2718750, size.height * 0.6734364); + path_0.lineTo(size.width * 0.1778125, size.height * 0.6734364); + path_0.lineTo(size.width * 0.1635936, size.height * 0.7728136); + path_0.cubicTo( + size.width * 0.1612500, + size.height * 0.7887500, + size.width * 0.1539061, + size.height * 0.8000000, + size.width * 0.1456250, + size.height * 0.8000000, + ); + path_0.lineTo(size.width * 0.1098439, size.height * 0.8000000); + path_0.cubicTo( + size.width * 0.09703136, + size.height * 0.8000000, + size.width * 0.08796886, + size.height * 0.7746864, + size.width * 0.09203136, + size.height * 0.7503136, + ); + path_0.close(); + + final Paint paint0fill = Paint()..style = PaintingStyle.fill; + paint0fill.color = const Color(0xff737373).withOpacity(1.0); + canvas.drawPath(path_0, paint0fill); + } + + @override + bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; + } +} diff --git a/lib/custom_painters/talawa_logo.dart b/lib/custom_painters/talawa_logo.dart new file mode 100644 index 000000000..f10f32b7e --- /dev/null +++ b/lib/custom_painters/talawa_logo.dart @@ -0,0 +1,433 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; + +///This class draws the app logo using custom paint. +///CustomPaint is a widget from the Flutter SDK, which enables +/// you to use a canvas to draw different shapes. +class AppLogo extends CustomPainter { + @override + void paint(Canvas canvas, Size size) { + final Path path_0 = Path(); + path_0.moveTo(size.width * 0.6581984, size.height * 0.6200040); + path_0.cubicTo( + size.width * 0.6951984, + size.height * 0.6792024, + size.width * 0.7321984, + size.height * 0.7386032, + size.width * 0.7695992, + size.height * 0.7978016, + ); + path_0.cubicTo( + size.width * 0.7737976, + size.height * 0.8044008, + size.width * 0.7730000, + size.height * 0.8070040, + size.width * 0.7664008, + size.height * 0.8112024, + ); + path_0.cubicTo( + size.width * 0.7314008, + size.height * 0.8330040, + size.width * 0.6964008, + size.height * 0.8552024, + size.width * 0.6617976, + size.height * 0.8776032, + ); + path_0.cubicTo( + size.width * 0.6560000, + size.height * 0.8814008, + size.width * 0.6534008, + size.height * 0.8820040, + size.width * 0.6491984, + size.height * 0.8750040, + ); + path_0.cubicTo( + size.width * 0.5995992, + size.height * 0.7930040, + size.width * 0.5495992, + size.height * 0.7112024, + size.width * 0.4997976, + size.height * 0.6292024, + ); + path_0.cubicTo( + size.width * 0.4941984, + size.height * 0.6198016, + size.width * 0.4940000, + size.height * 0.6200040, + size.width * 0.4884008, + size.height * 0.6292024, + ); + path_0.cubicTo( + size.width * 0.4380000, + size.height * 0.7114008, + size.width * 0.3873992, + size.height * 0.7938016, + size.width * 0.3371992, + size.height * 0.8762024, + ); + path_0.cubicTo( + size.width * 0.3337992, + size.height * 0.8818016, + size.width * 0.3317992, + size.height * 0.8816032, + size.width * 0.3267992, + size.height * 0.8784008, + ); + path_0.cubicTo( + size.width * 0.2913992, + size.height * 0.8558016, + size.width * 0.2559992, + size.height * 0.8334008, + size.width * 0.2203992, + size.height * 0.8112024, + ); + path_0.cubicTo( + size.width * 0.2165992, + size.height * 0.8088016, + size.width * 0.2131992, + size.height * 0.8076032, + size.width * 0.2167992, + size.height * 0.8018016, + ); + path_0.cubicTo( + size.width * 0.2547992, + size.height * 0.7420040, + size.width * 0.2923992, + size.height * 0.6818016, + size.width * 0.3301992, + size.height * 0.6218016, + ); + path_0.cubicTo( + size.width * 0.3575992, + size.height * 0.5766032, + size.width * 0.3853992, + size.height * 0.5320040, + size.width * 0.4130000, + size.height * 0.4870040, + ); + path_0.cubicTo( + size.width * 0.4191984, + size.height * 0.4768016, + size.width * 0.4255992, + size.height * 0.4666032, + size.width * 0.4317976, + size.height * 0.4564008, + ); + path_0.cubicTo( + size.width * 0.4347976, + size.height * 0.4516032, + size.width * 0.4377976, + size.height * 0.4468016, + size.width * 0.4441984, + size.height * 0.4458016, + ); + path_0.cubicTo( + size.width * 0.4541984, + size.height * 0.4452024, + size.width * 0.4640000, + size.height * 0.4472024, + size.width * 0.4740000, + size.height * 0.4474008, + ); + path_0.cubicTo( + size.width * 0.4960000, + size.height * 0.4482024, + size.width * 0.5167976, + size.height * 0.4438016, + size.width * 0.5377976, + size.height * 0.4382024, + ); + path_0.cubicTo( + size.width * 0.5435992, + size.height * 0.4374008, + size.width * 0.5470000, + size.height * 0.4408016, + size.width * 0.5497976, + size.height * 0.4454008, + ); + path_0.cubicTo( + size.width * 0.5830000, + size.height * 0.5002024, + size.width * 0.6170000, + size.height * 0.5546032, + size.width * 0.6497976, + size.height * 0.6096032, + ); + path_0.cubicTo( + size.width * 0.6517976, + size.height * 0.6136032, + size.width * 0.6544008, + size.height * 0.6172024, + size.width * 0.6581984, + size.height * 0.6200040, + ); + path_0.close(); + + final Paint paint0fill = Paint()..style = PaintingStyle.fill; + paint0fill.color = const Color(0xff31BB6B).withOpacity(1.0); + canvas.drawPath(path_0, paint0fill); + + final Path path_1 = Path(); + path_1.moveTo(size.width * 0.5405992, size.height * 0.4396032); + path_1.cubicTo( + size.width * 0.5084008, + size.height * 0.4512024, + size.width * 0.4754008, + size.height * 0.4532024, + size.width * 0.4418016, + size.height * 0.4472024, + ); + path_1.cubicTo( + size.width * 0.4292024, + size.height * 0.4490000, + size.width * 0.4184008, + size.height * 0.4428016, + size.width * 0.4078016, + size.height * 0.4382024, + ); + path_1.cubicTo( + size.width * 0.3772004, + size.height * 0.4248016, + size.width * 0.3516004, + size.height * 0.4048016, + size.width * 0.3326004, + size.height * 0.3768020, + ); + path_1.cubicTo( + size.width * 0.3302004, + size.height * 0.3732020, + size.width * 0.3276004, + size.height * 0.3696020, + size.width * 0.3278004, + size.height * 0.3650020, + ); + path_1.cubicTo( + size.width * 0.3124004, + size.height * 0.3368020, + size.width * 0.3032004, + size.height * 0.3070020, + size.width * 0.3040004, + size.height * 0.2746020, + ); + path_1.cubicTo( + size.width * 0.3056004, + size.height * 0.2126020, + size.width * 0.3322004, + size.height * 0.1636020, + size.width * 0.3842004, + size.height * 0.1300020, + ); + path_1.cubicTo( + size.width * 0.4872024, + size.height * 0.06320198, + size.width * 0.6244008, + size.height * 0.1212020, + size.width * 0.6494008, + size.height * 0.2418020, + ); + path_1.cubicTo( + size.width * 0.6554008, + size.height * 0.2704020, + size.width * 0.6535992, + size.height * 0.2994020, + size.width * 0.6452024, + size.height * 0.3276020, + ); + path_1.cubicTo( + size.width * 0.6444008, + size.height * 0.3302020, + size.width * 0.6440000, + size.height * 0.3328020, + size.width * 0.6434008, + size.height * 0.3354020, + ); + path_1.cubicTo( + size.width * 0.6380000, + size.height * 0.3574020, + size.width * 0.6260000, + size.height * 0.3756020, + size.width * 0.6118016, + size.height * 0.3924020, + ); + path_1.cubicTo( + size.width * 0.5960000, + size.height * 0.4108016, + size.width * 0.5770000, + size.height * 0.4252024, + size.width * 0.5548016, + size.height * 0.4354008, + ); + path_1.cubicTo( + size.width * 0.5500000, + size.height * 0.4376032, + size.width * 0.5455992, + size.height * 0.4394008, + size.width * 0.5405992, + size.height * 0.4396032, + ); + path_1.close(); + + final Paint paint1fill = Paint()..style = PaintingStyle.fill; + paint1fill.color = const Color(0xffFEBC59).withOpacity(1.0); + canvas.drawPath(path_1, paint1fill); + + final Path path_2 = Path(); + path_2.moveTo(size.width * 0.5405992, size.height * 0.4395992); + path_2.cubicTo( + size.width * 0.5880000, + size.height * 0.4200000, + size.width * 0.6224008, + size.height * 0.3870008, + size.width * 0.6410000, + size.height * 0.3386008, + ); + path_2.cubicTo( + size.width * 0.6414008, + size.height * 0.3374008, + size.width * 0.6425992, + size.height * 0.3364008, + size.width * 0.6434008, + size.height * 0.3354008, + ); + path_2.cubicTo( + size.width * 0.6850000, + size.height * 0.4020000, + size.width * 0.7265992, + size.height * 0.4688016, + size.width * 0.7685992, + size.height * 0.5352024, + ); + path_2.cubicTo( + size.width * 0.7742024, + size.height * 0.5440000, + size.width * 0.7724008, + size.height * 0.5470000, + size.width * 0.7642024, + size.height * 0.5520000, + ); + path_2.cubicTo( + size.width * 0.7285992, + size.height * 0.5740000, + size.width * 0.6924008, + size.height * 0.5954008, + size.width * 0.6584008, + size.height * 0.6200000, + ); + path_2.cubicTo( + size.width * 0.6535992, + size.height * 0.6225992, + size.width * 0.6520000, + size.height * 0.6190000, + size.width * 0.6502024, + size.height * 0.6158016, + ); + path_2.cubicTo( + size.width * 0.6158016, + size.height * 0.5590000, + size.width * 0.5814008, + size.height * 0.5022024, + size.width * 0.5470000, + size.height * 0.4455992, + ); + path_2.cubicTo( + size.width * 0.5452024, + size.height * 0.4430000, + size.width * 0.5440000, + size.height * 0.4402024, + size.width * 0.5405992, + size.height * 0.4395992, + ); + path_2.close(); + + final Paint paint2fill = Paint()..style = PaintingStyle.fill; + paint2fill.color = const Color(0xff737373).withOpacity(1.0); + canvas.drawPath(path_2, paint2fill); + + final Path path_3 = Path(); + path_3.moveTo(size.width * 0.3277992, size.height * 0.3651976); + path_3.cubicTo( + size.width * 0.3541992, + size.height * 0.4085992, + size.width * 0.3929992, + size.height * 0.4351984, + size.width * 0.4417976, + size.height * 0.4471984, + ); + path_3.cubicTo( + size.width * 0.4287976, + size.height * 0.4623968, + size.width * 0.4197976, + size.height * 0.4803968, + size.width * 0.4094008, + size.height * 0.4973968, + ); + path_3.cubicTo( + size.width * 0.3847992, + size.height * 0.5373968, + size.width * 0.3591992, + size.height * 0.5765992, + size.width * 0.3361992, + size.height * 0.6173968, + ); + path_3.cubicTo( + size.width * 0.3347992, + size.height * 0.6197976, + size.width * 0.3333992, + size.height * 0.6219960, + size.width * 0.3301992, + size.height * 0.6215992, + ); + path_3.cubicTo( + size.width * 0.3235992, + size.height * 0.6143968, + size.width * 0.3149992, + size.height * 0.6097976, + size.width * 0.3069992, + size.height * 0.6045992, + ); + path_3.cubicTo( + size.width * 0.2783992, + size.height * 0.5863968, + size.width * 0.2493992, + size.height * 0.5685992, + size.width * 0.2205992, + size.height * 0.5507976, + ); + path_3.cubicTo( + size.width * 0.2163992, + size.height * 0.5481984, + size.width * 0.2131992, + size.height * 0.5465992, + size.width * 0.2169992, + size.height * 0.5403968, + ); + path_3.cubicTo( + size.width * 0.2535992, + size.height * 0.4825992, + size.width * 0.2899992, + size.height * 0.4243968, + size.width * 0.3263992, + size.height * 0.3663976, + ); + path_3.cubicTo( + size.width * 0.3265992, + size.height * 0.3659976, + size.width * 0.3271992, + size.height * 0.3655976, + size.width * 0.3277992, + size.height * 0.3651976, + ); + path_3.close(); + + final Paint paint3fill = Paint()..style = PaintingStyle.fill; + paint3fill.color = const Color(0xff737373).withOpacity(1.0); + canvas.drawPath(path_3, paint3fill); + } + + @override + bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; + } +} diff --git a/lib/custom_painters/telegram_logo.dart b/lib/custom_painters/telegram_logo.dart new file mode 100644 index 000000000..7519d7bb4 --- /dev/null +++ b/lib/custom_painters/telegram_logo.dart @@ -0,0 +1,123 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:ui' as ui; + +import 'package:flutter/material.dart'; + +///This class draws the telegram logo using custom paint. +///CustomPaint is a widget from the Flutter SDK, which enables +/// you to use a canvas to draw different shapes. + +//Copy this CustomPainter code to the Bottom of the File +class TelegramLogo extends CustomPainter { + @override + void paint(Canvas canvas, Size size) { + final Paint paint0Fill = Paint()..style = PaintingStyle.fill; + paint0Fill.shader = ui.Gradient.linear( + Offset(size.width * 0.6670000, size.height * 0.1670000), + Offset(size.width * 0.4170000, size.height * 0.7500000), [ + const Color(0xff37aee2).withOpacity(1), + const Color(0xff1e96c8).withOpacity(1), + ], [ + 0, + 1, + ]); + canvas.drawCircle( + Offset(size.width * 0.5000000, size.height * 0.5000000), + size.width * 0.5000000, + paint0Fill, + ); + + final Path path_1 = Path(); + path_1.moveTo(size.width * 0.4083333, size.height * 0.7291667); + path_1.cubicTo( + size.width * 0.3921333, + size.height * 0.7291667, + size.width * 0.3948875, + size.height * 0.7230500, + size.width * 0.3893000, + size.height * 0.7076250, + ); + path_1.lineTo(size.width * 0.3416667, size.height * 0.5508625); + path_1.lineTo(size.width * 0.7083333, size.height * 0.3333333); + + final Paint paint1Fill = Paint()..style = PaintingStyle.fill; + paint1Fill.color = const Color(0xffc8daea).withOpacity(1.0); + canvas.drawPath(path_1, paint1Fill); + + final Path path_2 = Path(); + path_2.moveTo(size.width * 0.4083333, size.height * 0.7291667); + path_2.cubicTo( + size.width * 0.4208333, + size.height * 0.7291667, + size.width * 0.4263542, + size.height * 0.7234500, + size.width * 0.4333333, + size.height * 0.7166667, + ); + path_2.lineTo(size.width * 0.5000000, size.height * 0.6518417); + path_2.lineTo(size.width * 0.4168417, size.height * 0.6016958); + + final Paint paint2Fill = Paint()..style = PaintingStyle.fill; + paint2Fill.color = const Color(0xffa9c9dd).withOpacity(1.0); + canvas.drawPath(path_2, paint2Fill); + + final Path path_3 = Path(); + path_3.moveTo(size.width * 0.4168333, size.height * 0.6017083); + path_3.lineTo(size.width * 0.6183333, size.height * 0.7505792); + path_3.cubicTo( + size.width * 0.6413292, + size.height * 0.7632667, + size.width * 0.6579208, + size.height * 0.7566958, + size.width * 0.6636500, + size.height * 0.7292333, + ); + path_3.lineTo(size.width * 0.7456708, size.height * 0.3427208); + path_3.cubicTo( + size.width * 0.7540667, + size.height * 0.3090542, + size.width * 0.7328375, + size.height * 0.2937792, + size.width * 0.7108375, + size.height * 0.3037667, + ); + path_3.lineTo(size.width * 0.2292125, size.height * 0.4894792); + path_3.cubicTo( + size.width * 0.1963375, + size.height * 0.5026667, + size.width * 0.1965333, + size.height * 0.5210083, + size.width * 0.2232208, + size.height * 0.5291792, + ); + path_3.lineTo(size.width * 0.3468167, size.height * 0.5677583); + path_3.lineTo(size.width * 0.6329542, size.height * 0.3872375); + path_3.cubicTo( + size.width * 0.6464625, + size.height * 0.3790458, + size.width * 0.6588625, + size.height * 0.3834458, + size.width * 0.6486875, + size.height * 0.3924792, + ); + + final Paint paint3Fill = Paint()..style = PaintingStyle.fill; + paint3Fill.shader = ui.Gradient.linear( + Offset(size.width * 0.6600000, size.height * 0.4370000), + Offset(size.width * 0.8510000, size.height * 0.8020000), [ + const Color(0xffeff7fc).withOpacity(1), + const Color(0xffffffff).withOpacity(1), + ], [ + 0, + 1, + ]); + canvas.drawPath(path_3, paint3Fill); + } + + @override + bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; + } +} diff --git a/lib/custom_painters/whatsapp_logo.dart b/lib/custom_painters/whatsapp_logo.dart new file mode 100644 index 000000000..fb150dd35 --- /dev/null +++ b/lib/custom_painters/whatsapp_logo.dart @@ -0,0 +1,433 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; + +///This class draws the whatsapp logo using custom paint. +///CustomPaint is a widget from the Flutter SDK, which enables +/// you to use a canvas to draw different shapes. +class WhatsappLogo extends CustomPainter { + @override + void paint(Canvas canvas, Size size) { + final Path path_0 = Path(); + path_0.moveTo(size.width * 0.3580000, size.height * 0.1673307); + path_0.cubicTo( + size.width * 0.4170000, + size.height * 0.1406375, + size.width * 0.4836000, + size.height * 0.1314741, + size.width * 0.5480000, + size.height * 0.1400398, + ); + path_0.cubicTo( + size.width * 0.6134000, + size.height * 0.1486056, + size.width * 0.6760000, + size.height * 0.1764940, + size.width * 0.7260000, + size.height * 0.2193227, + ); + path_0.cubicTo( + size.width * 0.7740000, + size.height * 0.2595618, + size.width * 0.8106000, + size.height * 0.3129482, + size.width * 0.8308000, + size.height * 0.3719124, + ); + path_0.cubicTo( + size.width * 0.8540000, + size.height * 0.4390438, + size.width * 0.8558000, + size.height * 0.5133466, + size.width * 0.8360000, + size.height * 0.5810757, + ); + path_0.arcToPoint( + Offset(size.width * 0.7034000, size.height * 0.7677291), + radius: + Radius.elliptical(size.width * 0.3520000, size.height * 0.3505976), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_0.arcToPoint( + Offset(size.width * 0.5662000, size.height * 0.8264940), + radius: + Radius.elliptical(size.width * 0.3500000, size.height * 0.3486056), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_0.cubicTo( + size.width * 0.4822000, + size.height * 0.8424303, + size.width * 0.3930000, + size.height * 0.8268924, + size.width * 0.3202000, + size.height * 0.7826693, + ); + path_0.cubicTo( + size.width * 0.3156000, + size.height * 0.7806773, + size.width * 0.3112000, + size.height * 0.7756972, + size.width * 0.3058000, + size.height * 0.7778884, + ); + path_0.lineTo(size.width * 0.1780000, size.height * 0.8107570); + path_0.lineTo(size.width * 0.2120000, size.height * 0.6864542); + path_0.cubicTo( + size.width * 0.2140000, + size.height * 0.6820717, + size.width * 0.2100000, + size.height * 0.6784861, + size.width * 0.2080000, + size.height * 0.6745020, + ); + path_0.cubicTo( + size.width * 0.1694000, + size.height * 0.6159363, + size.width * 0.1494000, + size.height * 0.5454183, + size.width * 0.1514000, + size.height * 0.4752988, + ); + path_0.cubicTo( + size.width * 0.1534000, + size.height * 0.3318725, + size.width * 0.2454000, + size.height * 0.2183267, + size.width * 0.3574000, + size.height * 0.1665339, + ); + + final Paint paint0Fill = Paint()..style = PaintingStyle.fill; + paint0Fill.color = const Color(0xff40c351).withOpacity(1.0); + canvas.drawPath(path_0, paint0Fill); + + final Path path_1 = Path(); + path_1.moveTo(size.width * 0.3760000, size.height * 0.2908367); + path_1.cubicTo( + size.width * 0.3854000, + size.height * 0.2910359, + size.width * 0.3916000, + size.height * 0.2994024, + size.width * 0.3952000, + size.height * 0.3067729, + ); + path_1.cubicTo( + size.width * 0.4072000, + size.height * 0.3326693, + size.width * 0.4168000, + size.height * 0.3593625, + size.width * 0.4282000, + size.height * 0.3854582, + ); + path_1.cubicTo( + size.width * 0.4306000, + size.height * 0.3908367, + size.width * 0.4322000, + size.height * 0.3968127, + size.width * 0.4302000, + size.height * 0.4025896, + ); + path_1.cubicTo( + size.width * 0.4242000, + size.height * 0.4195219, + size.width * 0.4102000, + size.height * 0.4316733, + size.width * 0.3990000, + size.height * 0.4452191, + ); + path_1.cubicTo( + size.width * 0.3950000, + size.height * 0.4498008, + size.width * 0.3954000, + size.height * 0.4563745, + size.width * 0.3986000, + size.height * 0.4611554, + ); + path_1.arcToPoint( + Offset(size.width * 0.5456000, size.height * 0.5876494), + radius: + Radius.elliptical(size.width * 0.2600000, size.height * 0.2589641), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.cubicTo( + size.width * 0.5516000, + size.height * 0.5902390, + size.width * 0.5588000, + size.height * 0.5896414, + size.width * 0.5630000, + size.height * 0.5844622, + ); + path_1.arcToPoint( + Offset(size.width * 0.5970000, size.height * 0.5428287), + radius: + Radius.elliptical(size.width * 0.5640000, size.height * 0.5617530), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.cubicTo( + size.width * 0.6062000, + size.height * 0.5308765, + size.width * 0.6142000, + size.height * 0.5342629, + size.width * 0.6262000, + size.height * 0.5392430, + ); + path_1.lineTo(size.width * 0.7030000, size.height * 0.5760956); + path_1.cubicTo( + size.width * 0.7090000, + size.height * 0.5786853, + size.width * 0.7150000, + size.height * 0.5830677, + size.width * 0.7144000, + size.height * 0.5900398, + ); + path_1.cubicTo( + size.width * 0.7184000, + size.height * 0.6418327, + size.width * 0.6718000, + size.height * 0.6820717, + size.width * 0.6230000, + size.height * 0.6836653, + ); + path_1.cubicTo( + size.width * 0.4970000, + size.height * 0.6745020, + size.width * 0.4110000, + size.height * 0.6047809, + size.width * 0.3490000, + size.height * 0.5243028, + ); + path_1.cubicTo( + size.width * 0.3286000, + size.height * 0.4960159, + size.width * 0.3070000, + size.height * 0.4675299, + size.width * 0.2958000, + size.height * 0.4338645, + ); + path_1.cubicTo( + size.width * 0.2852000, + size.height * 0.4043825, + size.width * 0.2848000, + size.height * 0.3707171, + size.width * 0.2974000, + size.height * 0.3416335, + ); + path_1.cubicTo( + size.width * 0.3168000, + size.height * 0.3027888, + size.width * 0.3338000, + size.height * 0.2878486, + size.width * 0.3766000, + size.height * 0.2902390, + ); + path_1.close(); + path_1.moveTo(size.width * 0.2580000, size.height * 0.1422311); + path_1.cubicTo( + size.width * 0.3504000, + size.height * 0.07649402, + size.width * 0.4700000, + size.height * 0.05139442, + size.width * 0.5820000, + size.height * 0.07370518, + ); + path_1.arcToPoint( + Offset(size.width * 0.7774000, size.height * 0.1699203), + radius: + Radius.elliptical(size.width * 0.4180000, size.height * 0.4163347), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.arcToPoint( + Offset(size.width * 0.9178000, size.height * 0.4368526), + radius: + Radius.elliptical(size.width * 0.4200000, size.height * 0.4183267), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.arcToPoint( + Offset(size.width * 0.8918000, size.height * 0.6380478), + radius: + Radius.elliptical(size.width * 0.4220000, size.height * 0.4203187), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.cubicTo( + size.width * 0.8622000, + size.height * 0.7137450, + size.width * 0.8098000, + size.height * 0.7802789, + size.width * 0.7434000, + size.height * 0.8272908, + ); + path_1.arcToPoint( + Offset(size.width * 0.5254000, size.height * 0.9039841), + radius: + Radius.elliptical(size.width * 0.4180000, size.height * 0.4163347), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.arcToPoint( + Offset(size.width * 0.2994000, size.height * 0.8541833), + radius: + Radius.elliptical(size.width * 0.4200000, size.height * 0.4183267), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.lineTo(size.width * 0.07540000, size.height * 0.9119522); + path_1.lineTo(size.width * 0.1344000, size.height * 0.6968127); + path_1.cubicTo( + size.width * 0.1356000, + size.height * 0.6942231, + size.width * 0.1338000, + size.height * 0.6920319, + size.width * 0.1324000, + size.height * 0.6900398, + ); + path_1.arcToPoint( + Offset(size.width * 0.08240000, size.height * 0.4310757), + radius: + Radius.elliptical(size.width * 0.4200000, size.height * 0.4183267), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.arcToPoint( + Offset(size.width * 0.2574000, size.height * 0.1422311), + radius: + Radius.elliptical(size.width * 0.4260000, size.height * 0.4243028), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.moveTo(size.width * 0.3568000, size.height * 0.1673307); + path_1.cubicTo( + size.width * 0.2898000, + size.height * 0.1972112, + size.width * 0.2328000, + size.height * 0.2486056, + size.width * 0.1964000, + size.height * 0.3121514, + ); + path_1.cubicTo( + size.width * 0.1676000, + size.height * 0.3619522, + size.width * 0.1516000, + size.height * 0.4187251, + size.width * 0.1504000, + size.height * 0.4760956, + ); + path_1.cubicTo( + size.width * 0.1484000, + size.height * 0.5462151, + size.width * 0.1684000, + size.height * 0.6165339, + size.width * 0.2070000, + size.height * 0.6752988, + ); + path_1.cubicTo( + size.width * 0.2090000, + size.height * 0.6788845, + size.width * 0.2126000, + size.height * 0.6826693, + size.width * 0.2110000, + size.height * 0.6872510, + ); + path_1.lineTo(size.width * 0.1770000, size.height * 0.8115538); + path_1.cubicTo( + size.width * 0.2196000, + size.height * 0.8007968, + size.width * 0.2622000, + size.height * 0.7892430, + size.width * 0.3050000, + size.height * 0.7784861, + ); + path_1.cubicTo( + size.width * 0.3104000, + size.height * 0.7764940, + size.width * 0.3150000, + size.height * 0.7808765, + size.width * 0.3194000, + size.height * 0.7832669, + ); + path_1.arcToPoint( + Offset(size.width * 0.5654000, size.height * 0.8272908), + radius: + Radius.elliptical(size.width * 0.3500000, size.height * 0.3486056), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.7026000, size.height * 0.7685259), + radius: + Radius.elliptical(size.width * 0.3460000, size.height * 0.3446215), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.8352000, size.height * 0.5818725), + radius: + Radius.elliptical(size.width * 0.3520000, size.height * 0.3505976), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.8300000, size.height * 0.3727092), + radius: + Radius.elliptical(size.width * 0.3500000, size.height * 0.3486056), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.7252000, size.height * 0.2201195), + radius: + Radius.elliptical(size.width * 0.3500000, size.height * 0.3486056), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.5470000, size.height * 0.1408367), + radius: + Radius.elliptical(size.width * 0.3480000, size.height * 0.3466135), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.cubicTo( + size.width * 0.4830000, + size.height * 0.1322709, + size.width * 0.4162000, + size.height * 0.1414343, + size.width * 0.3570000, + size.height * 0.1681275, + ); + path_1.close(); + + final Paint paint1fill = Paint()..style = PaintingStyle.fill; + paint1fill.color = const Color(0xfffcfcfc).withOpacity(1.0); + canvas.drawPath(path_1, paint1fill); + } + + @override + bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; + } +} diff --git a/lib/demo_server_data/direct_chat_demo_data.dart b/lib/demo_server_data/direct_chat_demo_data.dart new file mode 100644 index 000000000..7bd545d36 --- /dev/null +++ b/lib/demo_server_data/direct_chat_demo_data.dart @@ -0,0 +1,167 @@ +/// This file contains demo data. +/// +/// It contains a list of type Map and sample data of chats. +const directChatDemoData = [ + { + "sender": { + "name": "Sender 1", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Last message from the sender.", + "bool": "True", + }, + "unreadCount": 6, + }, + { + "sender": { + "name": "Sender 2", + "id": "sadiufghbasdqwuibnnads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Last message from the sender.", + "bool": "True", + }, + "unreadCount": 6, + }, + { + "sender": { + "name": "Sender 8", + "id": "sadiusfgafghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True", + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 7", + "id": "sasdasddiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True", + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 6", + "id": "sadiufghbassadasddqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True", + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 5", + "id": "sadiufghbasdqwsaduibnuads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender 5", + "id": "sadiufghbasdqwdfdibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True", + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 4", + "id": "sadiufghbsdasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True", + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 41", + "id": "sadiufghbadgsdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True", + }, + "unreadCount": 1, + }, + { + "sender": { + "name": "Sender 13", + "id": "sadiufghbadsfsdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url", + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True", + }, + "unreadCount": 8, + }, +]; diff --git a/lib/demo_server_data/events_demo_data.dart b/lib/demo_server_data/events_demo_data.dart new file mode 100644 index 000000000..9d22b4ef9 --- /dev/null +++ b/lib/demo_server_data/events_demo_data.dart @@ -0,0 +1,223 @@ +/// 'eventsDemoData' is a list of events that are used to display the events in the app. +/// +/// Each event has the following properties: +/// - title: The title of the event. +/// - description: The description of the event. +/// - location: The location of the event. +/// - recurring: Whether the event is recurring or not. +/// - allDay: Whether the event is an all-day event or not. +/// - startDate: The start date of the event. +/// - endDate: The end date of the event. +/// - startTime: The start time of the event. +/// - endTime: The end time of the event. +/// - recurrence: The recurrence of the event. +/// - isPublic: Whether the event is public or not. +/// - isSubscribed: Whether the user is subscribed to the event or not. +/// - isRegisterable: Whether the event is registerable or not. +/// - creator: The creator of the event. +/// - attendees: The attendees of the event. +/// - admins: The admins of the event. +/// - organization: The organization of the event. + +const eventsDemoData = [ + { + "title": "Calculus", + "description": + "This course introduces calculus using analytic geometry functions. Topics include limits and continuity, derivatives, optimization, related rates, graphing and other applications of derivatives, definite and indefinite integrals, and numerical integration.", + "location": "Lostilos", + "recurring": "false", + "allDay": "true", + "startDate": "1 Aug", + "endDate": "15 Aug", + "startTime": "11am", + "endTime": "3pm", + "recurrence": "MONTHLY", + "isPublic": "true", + "isSubscribed": "false", + "isRegisterable": "true", + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "_id": "asdasdasd", + }, + "attendees": [ + {"id": "attendee1", "firstName": "firstName1", "lastName": "lastName1"}, + {"id": "attendee2", "firstName": "firstName2", "lastName": "lastName2"}, + {"id": "attendee3", "firstName": "firstName3", "lastName": "lastName3"}, + {"id": "attendee4", "firstName": "firstName4", "lastName": "lastName4"}, + {"id": "attendee5", "firstName": "firstName5", "lastName": "lastName5"}, + {"id": "attendee6", "firstName": "firstName6", "lastName": "lastName6"}, + {"id": "attendee7", "firstName": "firstName7", "lastName": "lastName7"}, + {"id": "attendee8", "firstName": "firstName8", "lastName": "lastName8"}, + {"id": "attendee9", "firstName": "firstName9", "lastName": "lastName9"}, + { + "id": "attendee10", + "firstName": "firstName10", + "lastName": "lastName10", + }, + ], + "admins": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + ], + "organization": { + "_id": '1', + "name": 'Mathematicians', + "image": ' ', + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "_id": "asdasdasd", + }, + }, + }, + { + "title": "UI/UX", + "description": + "UX design refers to the term “user experience design”, while UI stands for “user interface design”. Both elements are crucial to a product and work closely together.", + "location": "Tokyo, Japan", + "recurring": "false", + "allDay": "true", + "startDate": "5 May", + "endDate": "13 May", + "startTime": "2am", + "endTime": "3pm", + "recurrence": "MONTHLY", + "isPublic": "true", + "isSubscribed": "true", + "isRegisterable": "true", + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "_id": "asdasdasd", + }, + "attendees": [ + {"id": "attendee1", "firstName": "firstName1", "lastName": "lastName1"}, + {"id": "attendee2", "firstName": "firstName2", "lastName": "lastName2"}, + {"id": "attendee3", "firstName": "firstName3", "lastName": "lastName3"}, + {"id": "attendee4", "firstName": "firstName4", "lastName": "lastName4"}, + {"id": "attendee5", "firstName": "firstName5", "lastName": "lastName5"}, + {"id": "attendee6", "firstName": "firstName6", "lastName": "lastName6"}, + {"id": "attendee7", "firstName": "firstName7", "lastName": "lastName7"}, + {"id": "attendee8", "firstName": "firstName8", "lastName": "lastName8"}, + {"id": "attendee9", "firstName": "firstName9", "lastName": "lastName9"}, + { + "id": "attendee10", + "firstName": "firstName10", + "lastName": "lastName10", + }, + ], + "admins": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + ], + "organization": { + "_id": '1', + "name": 'Courses', + "image": ' ', + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "_id": "asdasdasd", + }, + }, + }, + { + "title": "System Design", + "description": + "Systems design is the process of defining the architecture, product design, modules, interfaces, and data for a system to satisfy specified requirements. Systems design could be seen as the application of systems theory to product development.", + "location": "Shimla, India", + "recurring": "false", + "allDay": "true", + "startDate": "15 Dec", + "endDate": "18 Aug", + "startTime": "8am", + "endTime": "3pm", + "recurrence": "MONTHLY", + "isPublic": "false", + "isSubscribed": "false", + "isRegisterable": "true", + "creator": { + "firstName": "Ritik", + "lastName": "Srivastav", + "_id": "asdasdasd", + }, + "attendees": [ + {"id": "attendee1", "firstName": "firstName1", "lastName": "lastName1"}, + {"id": "attendee2", "firstName": "firstName2", "lastName": "lastName2"}, + {"id": "attendee3", "firstName": "firstName3", "lastName": "lastName3"}, + {"id": "attendee4", "firstName": "firstName4", "lastName": "lastName4"}, + {"id": "attendee5", "firstName": "firstName5", "lastName": "lastName5"}, + {"id": "attendee6", "firstName": "firstName6", "lastName": "lastName6"}, + {"id": "attendee7", "firstName": "firstName7", "lastName": "lastName7"}, + {"id": "attendee8", "firstName": "firstName8", "lastName": "lastName8"}, + {"id": "attendee9", "firstName": "firstName9", "lastName": "lastName9"}, + { + "id": "attendee10", + "firstName": "firstName10", + "lastName": "lastName10", + }, + ], + "admins": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + ], + "organization": { + "_id": '1', + "image": ' ', + "name": 'Computer Science', + "creator": { + "firstName": "Ritik", + "lastName": "Srivastav", + "_id": "asdasdasd", + }, + }, + }, + { + "title": "Gaming", + "description": + "Cyberpunk 2077 is a 2020 action role-playing v_ideo game developed and published by CD Projekt. The story takes place in Night City, an open world set in the Cyberpunk universe.", + "location": "Nagpur, India", + "recurring": "false", + "allDay": "true", + "startDate": "1 Aug", + "endDate": "15 Aug", + "startTime": "11am", + "endTime": "3pm", + "recurrence": "MONTHLY", + "isPublic": "true", + "isSubscribed": "true", + "isRegisterable": "true", + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "_id": "asdasdasd", + }, + "attendees": [ + {"id": "attendee1", "firstName": "firstName1", "lastName": "lastName1"}, + {"id": "attendee2", "firstName": "firstName2", "lastName": "lastName2"}, + {"id": "attendee3", "firstName": "firstName3", "lastName": "lastName3"}, + {"id": "attendee4", "firstName": "firstName4", "lastName": "lastName4"}, + {"id": "attendee5", "firstName": "firstName5", "lastName": "lastName5"}, + {"id": "attendee6", "firstName": "firstName6", "lastName": "lastName6"}, + {"id": "attendee7", "firstName": "firstName7", "lastName": "lastName7"}, + {"id": "attendee8", "firstName": "firstName8", "lastName": "lastName8"}, + {"id": "attendee9", "firstName": "firstName9", "lastName": "lastName9"}, + { + "id": "attendee10", + "firstName": "firstName10", + "lastName": "lastName10", + }, + ], + "admins": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + ], + "organization": { + "_id": '1', + "image": ' ', + "name": 'Cyclone', + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "_id": "asdasdasd", + }, + }, + } +]; diff --git a/lib/demo_server_data/pinned_post_demo_data.dart b/lib/demo_server_data/pinned_post_demo_data.dart new file mode 100644 index 000000000..fad34c4b6 --- /dev/null +++ b/lib/demo_server_data/pinned_post_demo_data.dart @@ -0,0 +1,160 @@ +///This file contains demo data for pinned posts. It contains a list of type Map and sample data. + +const pinnedPostsDemoData = [ + { + "_id": "1", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": "image url string", + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"}, + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + ], + }, + { + "_id": "2", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": "image url string", + "creator": { + "firstName": "Ranchhod Das", + "lastName": "Chanchad", + "id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"}, + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + ], + }, + { + "_id": "3", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": "image url string", + "creator": { + "firstName": "Ritik", + "lastName": "Srivastav", + "id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"}, + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + ], + }, + { + "_id": "4", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": "image url string", + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"}, + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + ], + }, +]; diff --git a/lib/demo_server_data/post_demo_data.dart b/lib/demo_server_data/post_demo_data.dart new file mode 100644 index 000000000..adf832ec6 --- /dev/null +++ b/lib/demo_server_data/post_demo_data.dart @@ -0,0 +1,183 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +///This file contains demo data for posts. It contains a list of type Map +/// and sample data of posts. +const postsDemoData = [ + { + "_id": "asdasdasd", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "created at string", + "imageUrl": "image url string", + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "_id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"}, + ], + "comments": [ + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "5", "_id": "asdasdasdas"}, + }, + ], + }, + { + "_id": "asdasdasd", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Andro_id in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "created at string", + "imageUrl": "image url string", + "creator": { + "firstName": "Ranchhod Das Chhanchad", + "lastName": "Chandla", + "_id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"}, + ], + "comments": [ + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + ], + }, + { + "_id": "asdasdasd", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Andro_id in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "created at string", + "imageUrl": "image url string", + "creator": { + "firstName": "Ritik", + "lastName": "Srivastav", + "_id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"}, + ], + "comments": [ + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + ], + }, + { + "_id": "asdasdasd", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Andro_id in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "created at string", + "imageUrl": "image url string", + "creator": { + "firstName": "Utkarsh", + "lastName": "Shengde", + "_id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"}, + ], + "comments": [ + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"}, + }, + ], + }, +]; diff --git a/lib/enums/connectivity_status.dart b/lib/enums/connectivity_status.dart deleted file mode 100644 index fa3f8396e..000000000 --- a/lib/enums/connectivity_status.dart +++ /dev/null @@ -1 +0,0 @@ -enum ConnectivityStatus { wiFi, cellular, offline } diff --git a/lib/enums/enums.dart b/lib/enums/enums.dart new file mode 100644 index 000000000..01969bab6 --- /dev/null +++ b/lib/enums/enums.dart @@ -0,0 +1,122 @@ +import 'package:hive/hive.dart'; + +part 'enums.g.dart'; + +/// Represents the state of the view. +enum ViewState { + /// The view is not doing anything. + idle, + + /// The view is loading something. + busy, +} + +/// Represents the state of the chat. +enum ChatState { + /// The chat is at initial state. + initial, + + /// The chat is loading something. + loading, + + /// The chat state is complete. + complete +} + +/// Represents the type of the tile. +enum TileType { + /// Represents the tile of the user. + user, + + /// Represents the tile of the attendee. + attendee, + + /// Represents the tile of the organization. + org, + + /// Represents the tile of the option. + option +} + +/// Represents the type of the Message. +enum MessageType { + /// Represents error message. + error, + + /// Represents warning message. + warning, + + /// Represents info message. + info, + + /// Represents random message. + random +} + +/// Represents the type of CallFor. +enum CallFor { + /// Represents the call for login. + login, + + /// Represents the call for signup. + signup, + + /// Represents the call for joining Public organization. + joinPublicOrg +} + +/// Represents the type of ModalSheet. +enum ModalSheet { + /// Represents the modal sheet for donation. + donation, + + /// Represents the modal sheet for invite. + invite +} + +/// This enum defines the possible statuses for a cached user action. +/// +/// It's used with Hive to store the state of user actions locally. +@HiveType(typeId: 4) +enum CachedUserActionStatus { + /// The user action is still waiting to be processed. + @HiveField(0) + pending, + + /// The user action has been successfully completed. + @HiveField(1) + completed, +} + +/// This enum defines the different types of cached GraphQL operations. +/// +/// It's used with Hive to store information about cached queries and mutations. +@HiveType(typeId: 5) +enum CachedOperationType { + /// A GraphQL query that requires user authentication. + @HiveField(0) + gqlAuthQuery, + + /// A GraphQL mutation that requires user authentication. + @HiveField(1) + gqlAuthMutation, + + /// A GraphQL query that does not require user authentication. + @HiveField(2) + gqlNonAuthQuery, + + /// A GraphQL mutation that does not require user authentication. + @HiveField(3) + gqlNonAuthMutation, +} + +/// Enum representing the types of actions that can be performed. +enum ActionType { + /// A critical action that requires immediate attention and cannot be delayed. + critical, + + /// An optimistic action that can be performed with the assumption that it will succeed. + /// + /// even if the result is not immediately confirmed. + optimistic, +} diff --git a/lib/enums/enums.g.dart b/lib/enums/enums.g.dart new file mode 100644 index 000000000..813c6028a --- /dev/null +++ b/lib/enums/enums.g.dart @@ -0,0 +1,96 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'enums.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class CachedUserActionStatusAdapter + extends TypeAdapter { + @override + final int typeId = 4; + + @override + CachedUserActionStatus read(BinaryReader reader) { + switch (reader.readByte()) { + case 0: + return CachedUserActionStatus.pending; + case 1: + return CachedUserActionStatus.completed; + default: + return CachedUserActionStatus.pending; + } + } + + @override + void write(BinaryWriter writer, CachedUserActionStatus obj) { + switch (obj) { + case CachedUserActionStatus.pending: + writer.writeByte(0); + break; + case CachedUserActionStatus.completed: + writer.writeByte(1); + break; + } + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is CachedUserActionStatusAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class CachedOperationTypeAdapter extends TypeAdapter { + @override + final int typeId = 5; + + @override + CachedOperationType read(BinaryReader reader) { + switch (reader.readByte()) { + case 0: + return CachedOperationType.gqlAuthQuery; + case 1: + return CachedOperationType.gqlAuthMutation; + case 2: + return CachedOperationType.gqlNonAuthQuery; + case 3: + return CachedOperationType.gqlNonAuthMutation; + default: + return CachedOperationType.gqlAuthQuery; + } + } + + @override + void write(BinaryWriter writer, CachedOperationType obj) { + switch (obj) { + case CachedOperationType.gqlAuthQuery: + writer.writeByte(0); + break; + case CachedOperationType.gqlAuthMutation: + writer.writeByte(1); + break; + case CachedOperationType.gqlNonAuthQuery: + writer.writeByte(2); + break; + case CachedOperationType.gqlNonAuthMutation: + writer.writeByte(3); + break; + } + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is CachedOperationTypeAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/enums/image_from.dart b/lib/enums/image_from.dart deleted file mode 100644 index 53675396e..000000000 --- a/lib/enums/image_from.dart +++ /dev/null @@ -1,5 +0,0 @@ -enum From { - none, - camera, - gallery, -} diff --git a/lib/enums/viewstate.dart b/lib/enums/viewstate.dart deleted file mode 100644 index b4cae9b4f..000000000 --- a/lib/enums/viewstate.dart +++ /dev/null @@ -1,2 +0,0 @@ -/// Represents the state of the view -enum ViewState { idle, busy } diff --git a/lib/exceptions/critical_action_exception.dart b/lib/exceptions/critical_action_exception.dart new file mode 100644 index 000000000..6955d37dc --- /dev/null +++ b/lib/exceptions/critical_action_exception.dart @@ -0,0 +1,17 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; + +/// Exception thrown for critical actions that require special handling. +/// +/// Extends [OperationException] to integrate with GraphQL error handling. +class CriticalActionException extends OperationException { + /// Constructor for [CriticalActionException]. + /// + /// Takes a [actionError] message that describes the specific error encountered. + CriticalActionException(this.actionError); + + /// The error message associated with this critical action. + String actionError; + + @override + String toString() => 'CriticalActionException: $actionError'; +} diff --git a/lib/exceptions/graphql_exception_resolver.dart b/lib/exceptions/graphql_exception_resolver.dart new file mode 100644 index 000000000..bda26e826 --- /dev/null +++ b/lib/exceptions/graphql_exception_resolver.dart @@ -0,0 +1,184 @@ +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/exceptions/critical_action_exception.dart'; +import 'package:talawa/locator.dart'; + +/// static class to handle graphql exceptions. +class GraphqlExceptionResolver { + /// Graphql error for handling. + static GraphQLError userNotFound = + const GraphQLError(message: TalawaErrors.userNotFound); + + /// Graphql error for handling. + static GraphQLError userNotAuthenticated = + const GraphQLError(message: TalawaErrors.userNotAuthenticated); + + /// Graphql error for handling. + static GraphQLError emailAccountPresent = + const GraphQLError(message: TalawaErrors.emailAccountPresent); + + /// Graphql error for handling. + static GraphQLError wrongCredentials = + const GraphQLError(message: TalawaErrors.wrongCredentials); + + /// Graphql error for handling. + static GraphQLError organizationNotFound = + const GraphQLError(message: TalawaErrors.organizationNotFound); + + /// Graphql error for handling. + static GraphQLError refreshAccessTokenExpiredException = const GraphQLError( + message: TalawaErrors.refreshAccessTokenExpiredException, + ); + + /// Graphql error for handling. + static GraphQLError memberRequestExist = + const GraphQLError(message: TalawaErrors.memberRequestExist); + + /// Graphql error for handling. + static GraphQLError notifFeatureNotInstalled = const GraphQLError( + message: TalawaErrors.failedToDetermineProject, + ); + + /// This function is used to check if any exceptions or error encountered. The return type is [boolean]. + /// + /// **params**: + /// * `exception`: OperationException which occur when calling for graphql post request + /// * `showSnackBar`: Tell if the the place where this function is called wants a SnackBar on error + /// + /// **returns**: + /// * `bool?`: returns a bool whether or not their is error, can be null + static bool? encounteredExceptionOrError( + OperationException exception, { + bool showSnackBar = true, + }) { + // If server link is wrong. + if (exception.linkException != null) { + debugPrint(exception.linkException.toString()); + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorSnackBar( + "Server not running/wrong url", + MessageType.info, + ), + ); + } + return false; + } + + if (exception is CriticalActionException) { + debugPrint(exception.toString()); + if (showSnackBar) { + navigationService.showCustomToast(exception.actionError); + } + return false; + } + + /// Looping through graphQL errors. + debugPrint(exception.graphqlErrors.toString()); + for (int i = 0; i < exception.graphqlErrors.length; i++) { + // if the error message is "Access Token has expired. Please refresh session.: Undefined location" + if (exception.graphqlErrors[i].message == + refreshAccessTokenExpiredException.message) { + print('token refreshed'); + databaseFunctions + .refreshAccessToken(userConfig.currentUser.refreshToken!) + .then( + (value) => graphqlConfig + .getToken() + .then((value) => databaseFunctions.init()), + ); + print('client refreshed'); + return true; + } + + /// If the error message is "User is not authenticated" + if (exception.graphqlErrors[i].message == userNotAuthenticated.message) { + print('client refreshed'); + databaseFunctions + .refreshAccessToken(userConfig.currentUser.refreshToken!) + .then( + (value) => graphqlConfig + .getToken() + .then((value) => databaseFunctions.init()), + ); + return true; + } + + /// If the error message is "User not found" + if (exception.graphqlErrors[i].message == userNotFound.message) { + print(showSnackBar); + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "No account registered with this email", + MessageType.error, + ), + ); + } + return false; + } + + /// If the error message is "Membership Request already exists" + if (exception.graphqlErrors[i].message == memberRequestExist.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Membership request already exist", + MessageType.error, + ), + ); + } + return false; + } + + /// If the error message is "Invalid credentials" + if (exception.graphqlErrors[i].message == wrongCredentials.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Enter a valid password", + MessageType.error, + ), + ); + } + return false; + } + + /// If the error message is "Organization not found" + if (exception.graphqlErrors[i].message == organizationNotFound.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Organization Not Found", + MessageType.error, + ), + ); + } + return false; + } + + /// If the error message is "Email address already exists" + if (exception.graphqlErrors[i].message == emailAccountPresent.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Account with this email already registered", + MessageType.error, + ), + ); + } + return false; + } + } + // If the error is unknown + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Something went wrong!", + MessageType.error, + ), + ); + return false; + } +} diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart deleted file mode 100644 index 554788d2c..000000000 --- a/lib/generated_plugin_registrant.dart +++ /dev/null @@ -1,19 +0,0 @@ -// -// Generated file. Do not edit. -// - -// ignore_for_file: lines_longer_than_80_chars -//extra packages are called here which are being imported in the pubsec.yaml -import 'package:connectivity_for_web/connectivity_for_web.dart'; -// ignore: implementation_imports -import 'package:fluttertoast/fluttertoast_web.dart'; -import 'package:shared_preferences_web/shared_preferences_web.dart'; -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; - -// ignore: public_member_api_docs -void registerPlugins(Registrar registrar) { - ConnectivityPlugin.registerWith(registrar); - FluttertoastWebPlugin.registerWith(registrar); - SharedPreferencesPlugin.registerWith(registrar); - registrar.registerMessageHandler(); -} diff --git a/lib/locator.dart b/lib/locator.dart index 87242f0d9..7a494c893 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,12 +1,180 @@ -//Pages are called here +import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:get_it/get_it.dart'; -import 'package:talawa/view_models/swtich_org_vm.dart'; -import 'services/api_.dart'; +import 'package:image_cropper/image_cropper.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:talawa/main.dart'; +import 'package:talawa/services/caching/cache_service.dart'; +import 'package:talawa/services/chat_service.dart'; +import 'package:talawa/services/comment_service.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/image_service.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/org_service.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/session_manager.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/third_party_service/connectivity_service.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/services/user_action_handler.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/services/user_profile_service.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'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_calendar_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/settings_view_models/app_setting_view_model.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/login_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/set_url_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/signup_details_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/waiting_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/comments_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/progress_dialog_view_model.dart'; +// Instance of GetIt and storing it in a global variable +/// Intializaing the locator. GetIt locator = GetIt.instance; -void setupLocator() { - locator.registerLazySingleton(() => API()); +///GetIt for UserConfig. +final userConfig = locator(); - locator.registerFactory(() => SwitchOrgModel()); +///GetIt for NavigationService. +final navigationService = locator(); + +///GetIt for DataBaseMutationFunctions. +final databaseFunctions = locator(); + +///GetIt for GraphqlConfig. +final graphqlConfig = locator(); + +///GetIt for SizeConfig. +final sizeConfig = locator(); + +///GetIt for Queries. +final queries = locator(); + +///GetIt for Connectivity. +final connectivity = locator(); + +///GetIt for ConnectivityService. +final connectivityService = locator(); + +///GetIt for CacheService. +final cacheService = locator(); + +///GetIt for OrganizationService. +final organizationService = locator(); + +///GetIt for ImageService. +final imageService = locator(); + +///GetIt for SessionManager. +final sessionManager = locator(); + +///GetIt for ActonHandlerService. +final actionHandlerService = locator(); + +/// This function registers the widgets/objects in "GetIt". +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +Future setupLocator() async { + locator.registerSingleton(DataBaseMutationFunctions()); + + locator.registerSingleton(GraphqlConfig()); + //services + locator.registerSingleton(NavigationService()); + + //sizeConfig + locator.registerSingleton(SizeConfig()); + + locator.registerSingleton(Validator()); + + //userConfig + locator.registerSingleton(UserConfig()); + + //sessionManager + locator.registerSingleton(SessionManager()); + + locator.registerSingleton(CacheService()); + + //Services + locator.registerLazySingleton(() => PostService()); + locator.registerLazySingleton(() => EventService()); + locator.registerLazySingleton(() => CommentService()); + locator.registerLazySingleton(() => OrganizationService()); + locator.registerLazySingleton(() => MultiMediaPickerService()); + locator.registerLazySingleton(() => Connectivity()); + locator.registerLazySingleton(() => ChatService()); + locator.registerLazySingleton(() => ImageService()); + locator.registerLazySingleton(() => ImagePicker()); + locator.registerLazySingleton(() => ImageCropper()); + + //graphql + + //databaseMutationFunction + + locator.registerSingleton(ConnectivityService()); + + //queries + locator.registerSingleton(Queries()); + + locator.registerSingleton(ActionHandlerService()); + + locator.registerFactory(() => AppConnectivity()); + + //Page viewModels + locator.registerFactory(() => DemoViewModel()); + // locator.registerFactory(() => OrganizationFeedViewModel()); + locator.registerFactory(() => OrganizationFeedViewModel()); + locator.registerFactory(() => SetUrlViewModel()); + locator.registerFactory(() => LoginViewModel()); + locator.registerFactory(() => ManageVolunteerGroupViewModel()); + locator.registerFactory(() => EditAgendaItemViewModel()); + locator.registerFactory(() => SelectOrganizationViewModel()); + locator.registerFactory(() => SignupDetailsViewModel()); + locator.registerFactory(() => WaitingViewModel()); + locator.registerFactory(() => ExploreEventsViewModel()); + locator.registerFactory(() => MainScreenViewModel()); + locator.registerFactory(() => ProfilePageViewModel()); + locator.registerFactory(() => EditProfilePageViewModel()); + locator.registerFactory(() => CreateEventViewModel()); + locator.registerFactory(() => EditEventViewModel()); + locator.registerFactory(() => EventCalendarViewModel()); + locator.registerFactory(() => AddPostViewModel()); + locator.registerFactory(() => EventInfoViewModel()); + locator.registerFactory(() => AppSettingViewModel()); + + //Widgets viewModels + locator.registerFactory(() => ProgressDialogViewModel()); + locator.registerFactory(() => CustomDrawerViewModel()); + locator.registerFactory(() => LikeButtonViewModel()); + locator.registerFactory(() => AppLanguage()); + locator.registerFactory(() => CommentsViewModel()); + locator.registerFactory(() => AppTheme()); + locator.registerFactory(() => DirectChatViewModel()); + locator.registerFactory(() => AccessScreenViewModel()); + locator.registerFactory(() => UserProfileService()); } diff --git a/lib/main.dart b/lib/main.dart index c220ffa1f..8c7d73ccd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,93 +1,197 @@ -//Flutter Packages are imported here -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; +import 'dart:io'; -//Pages are imported here +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart' as fs; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:hive/hive.dart'; +import 'package:path_provider/path_provider.dart' as path; import 'package:provider/provider.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/loghelper.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/_pages.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/login_signup/set_url_page.dart'; -import 'package:talawa/views/pages/organization/create_organization.dart'; -import 'package:talawa/views/pages/organization/switch_org_page.dart'; -import 'controllers/auth_controller.dart'; -import 'controllers/org_controller.dart'; - -Preferences preferences = Preferences(); -String userID; -LogHelper logHelper = LogHelper(); +import 'package:quick_actions/quick_actions.dart'; +import 'package:talawa/constants/quick_actions.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/plugins/fetch_plugin_list.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/hive_manager.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + Future main() async { - WidgetsFlutterBinding - .ensureInitialized(); //ensuring weather the app is being initialized or not - userID = await preferences.getUserId(); //getting user id - await logHelper.init(); // To intialise FlutterLog - SystemChrome.setPreferredOrientations([ - DeviceOrientation.portraitUp - ]) //setting the orientation according to the screen it is running on - .then((_) { - runApp(MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration()), - ChangeNotifierProvider(create: (_) => OrgController()), - ChangeNotifierProvider(create: (_) => AuthController()), - ChangeNotifierProvider(create: (_) => Preferences()), - ChangeNotifierProvider(create: (_) => CommentHandler()), - ChangeNotifierProvider(create: (_) => PostProvider()), - ], - child: MyApp(), - )); - }); + // Returns an instance of the binding that implements WidgetsBinding. + WidgetsFlutterBinding.ensureInitialized(); + + final Directory dir = await path.getApplicationDocumentsDirectory(); + + await HiveManager.initializeHive(dir: dir); + + setupLocator(); + + // The runApp() function takes the given Widget and makes it the root of the widget tree. + runApp(MyApp()); } -class MyApp extends StatelessWidget { +/// Main widget that sets up the quick actions, internationalization, routing , notifications. +class MyApp extends StatefulWidget { // This widget is the root of your application. + @override + _MyAppState createState() => _MyAppState(); +} + +/// The _MyAppState class extends the State. +/// +/// All the coding related to state updation is inside this class. +class _MyAppState extends State { + /// Initializing the Quickactions to enable them on long press of app icon in device. + final quickActions = const QuickActions(); + /// Initializing the mainScreen window to 1 to show the events by default after app in opened. + late int mainScreenQuickActionindex = 0; @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - final FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus && - currentFocus.focusedChild != null) { - FocusManager.instance.primaryFocus.unfocus(); + void initState() { + // initState() is a method that is called once when the Stateful Widget + // is inserted in the widget tree. We generally override this method if + // we need to do some sort of initialization work like + // registering a listener because, unlike build(), this method is called once. + super.initState(); + + initQuickActions(); + + final urlBox = Hive.box('url'); + if (urlBox.get('url') != null) { + FetchPluginList(); + } + + fs.SystemChrome.setPreferredOrientations( + [ + fs.DeviceOrientation.portraitUp, + fs.DeviceOrientation.portraitDown, + ], + ); + } + + /// It allows to manage and interact with the application’s home screen quick actions. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + +// ignore: avoid_void_async + void initQuickActions() async { + final bool userLoggedIn = await userConfig.userLoggedIn(); + if (userLoggedIn && + userConfig.currentUser.joinedOrganizations!.isNotEmpty) { + quickActions.initialize((type) { + if (type == ShortCutMenu.eventAction.type) { + mainScreenQuickActionindex = 1; + } else if (type == ShortCutMenu.feedAction.type) { + mainScreenQuickActionindex = 0; + } else if (type == ShortCutMenu.chatAction.type) { + mainScreenQuickActionindex = 3; } + }); + + /// Registering quick action list in the app.zx + quickActions.setShortcutItems(ShortCutMenu.quickActionsList); + } + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return BaseView( + onModelReady: (connectivityModel) => + connectivityModel.initialise(), + builder: (context, connectivityModel, child) { + return MaterialApp( + locale: langModel.appLocal, + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + AppLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + title: 'Talawa', + theme: Provider.of(context).theme, + debugShowCheckedModeBanner: false, + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + localeResolutionCallback: langModel.localeResoultion, + initialRoute: '/', + onGenerateInitialRoutes: (String initialRouteName) { + return [ + router.generateRoute( + RouteSettings( + name: '/', + arguments: mainScreenQuickActionindex, + ), + ), + ]; + }, + ); + }, + ); + }, + ); }, - child: MaterialApp( - title: UIData.appName, - theme: ThemeData( - primaryColor: UIData.primaryColor, - fontFamily: UIData.quickFont, - primarySwatch: UIData.primaryColor as MaterialColor), - debugShowCheckedModeBanner: false, - showPerformanceOverlay: false, - onGenerateRoute: (RouteSettings settings) { - print( - 'build route for ${settings.name}'); //here we are building the routes for the app - final routes = { - UIData.homeRoute: (BuildContext context) => const HomePage(), - UIData.loginPageRoute: (BuildContext context) => UrlPage(), - UIData.createOrgPage: (BuildContext context) => - const CreateOrganization(), - UIData.joinOrganizationPage: (BuildContext context) => - const JoinOrganization(), - UIData.switchOrgPage: (BuildContext context) => - SwitchOrganization(), - UIData.profilePage: (BuildContext context) => const ProfilePage(), - }; - final WidgetBuilder builder = routes[settings.name]; - return MaterialPageRoute(builder: (ctx) => builder(ctx)); - }, - home: userID == null - ? UrlPage() - : const HomePage(), //checking weather the user is logged in or not + ); + } +} + +/// PageView is a scrollable list that works page by page. +/// +/// DemoPageView is demo PageView of Talawa Mobile App. +class DemoPageView extends StatelessWidget { + const DemoPageView({required Key key}) : super(key: key); + @override + Widget build(BuildContext context) { + FetchPluginList(); + return BaseView( + builder: (context, model, child) => Scaffold( + appBar: AppBar( + title: + Text(AppLocalizations.of(context)!.strictTranslate('Demo Page')), + ), + body: Container( + child: Text(model.title), + ), ), ); } } + +/// ViewModel uses property-based data binding to establish a connection. +/// +/// between the ViewModel and the View, and drives the View changes +/// through the ViewModel. DemoViewModel is the ViewModel for DemoPageView. +class DemoViewModel extends BaseModel { + /// Demo title to be used. + final String _title = "Title from the viewMode GSoC branch"; + + /// Getter function of the title. + /// + /// params: + /// None + /// returns: + /// * `String`: title of the model + String get title => _title; +} diff --git a/lib/model/comment.dart b/lib/model/comment.dart deleted file mode 100644 index da689cf0a..000000000 --- a/lib/model/comment.dart +++ /dev/null @@ -1,6 +0,0 @@ -class CommentModel { - CommentModel(this.postId, this.comment); - - final String postId; - String comment; -} diff --git a/lib/model/switch_org.dart b/lib/model/switch_org.dart deleted file mode 100644 index cb31ed058..000000000 --- a/lib/model/switch_org.dart +++ /dev/null @@ -1,115 +0,0 @@ -// To parse this JSON data, do -// -// final switchOrg = switchOrgFromJson(jsonString); - -import 'dart:convert'; - -SwitchOrg switchOrgFromJson(String str) => - SwitchOrg.fromJson(json.decode(str) as Map); - -String switchOrgToJson(SwitchOrg data) => json.encode(data.toJson()); - -class SwitchOrg { - SwitchOrg({ - this.data, - }); - - factory SwitchOrg.fromJson(Map json) => SwitchOrg( - data: Data.fromJson(json["data"] as Map), - ); - - Data data; - - Map toJson() => { - "data": data.toJson(), - }; -} - -class Data { - Data({ - this.users, - }); - - factory Data.fromJson(Map json) => Data( - users: List.from((json["users"] as List) - .map((x) => User.fromJson(x as Map))), - ); - - List users; - - Map toJson() => { - "users": List.from(users.map((x) => x.toJson())), - }; -} - -class User { - User({ - this.joinedOrganizations, - }); - - factory User.fromJson(Map json) => User( - joinedOrganizations: List.from( - (json["joinedOrganizations"] as List).map( - (x) => JoinedOrganization.fromJson(x as Map))), - ); - - List joinedOrganizations; - - Map toJson() => { - "joinedOrganizations": - List.from(joinedOrganizations.map((x) => x.toJson())), - }; -} - -class JoinedOrganization { - JoinedOrganization({ - this.image, - this.id, - this.name, - this.description, - this.creator, - }); - - factory JoinedOrganization.fromJson(Map json) => - JoinedOrganization( - image: json["image"].toString(), - id: json["_id"].toString(), - name: json["name"].toString(), - description: json["description"].toString(), - creator: Creator.fromJson(json["creator"] as Map), - ); - - String image; - String id; - String name; - String description; - Creator creator; - - Map toJson() => { - "image": image, - "_id": id, - "name": name, - "description": description, - "creator": creator.toJson(), - }; -} - -class Creator { - Creator({ - this.firstName, - this.lastName, - }); - - factory Creator.fromJson(Map json) => Creator( - firstName: json["firstName"].toString(), - lastName: json["lastName"].toString(), - ); - - String firstName; - String lastName; - - Map toJson() => { - "firstName": firstName, - "lastName": lastName, - }; -} diff --git a/lib/model/token.dart b/lib/model/token.dart deleted file mode 100644 index 5eb0b3ed3..000000000 --- a/lib/model/token.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'dart:convert'; - -//class to represent he token of an user -class Token { - Token({this.tokenString}); - String tokenString; - - String _decodeBase64(String str) { - String output = str.replaceAll('-', '+').replaceAll('_', '/'); - switch (output.length % 4) { - case 0: - break; - case 2: - output += '=='; - break; - case 3: - output += '='; - break; - default: - throw Exception('Illegal base64url string!"'); - } - return utf8.decode(base64Url.decode(output)); - } - - Map parseJwt() { - final parts = this.tokenString.split('.'); - if (parts.length != 3) { - throw Exception('invalid token'); - } - - final payload = _decodeBase64(parts[1]); - final payloadMap = json.decode(payload); - if (payloadMap is! Map) { - throw Exception('invalid payload'); - } - - return payloadMap as Map; - } -} diff --git a/lib/model/user.dart b/lib/model/user.dart deleted file mode 100644 index 37bbaaee0..000000000 --- a/lib/model/user.dart +++ /dev/null @@ -1,35 +0,0 @@ -//model class for an user -class User { - User( - {this.id = 0, - this.firstName = "", - this.lastName = "", - this.email = "", - this.userImage = "", - this.selected = false}); - - factory User.fromJson(Map json) { - return User( - id: json['id'] as int, - firstName: json['firstName'].toString(), - lastName: json['lastName'].toString(), - email: json['email'].toString(), - userImage: json['userImage'].toString(), - ); - } - - User.copy(User tUser) { - this.id = tUser.id; - this.firstName = tUser.firstName; - this.lastName = tUser.lastName; - this.email = tUser.email; - this.userImage = tUser.userImage; - } - - int id; - String firstName; - String lastName; - String email; - String userImage; - bool selected; -} diff --git a/lib/models/app_tour.dart b/lib/models/app_tour.dart new file mode 100644 index 000000000..16d5ba7b1 --- /dev/null +++ b/lib/models/app_tour.dart @@ -0,0 +1,187 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; + +/// Class that handles all the apptour routines. +class AppTour { + AppTour({ + required this.model, + }); + + ///instance of mainscreenviewmodel. + MainScreenViewModel model; + + ///instance of tutorialCoachMark. + late TutorialCoachMark tutorialCoachMark; + + /// This function show tutorial to user. + /// + /// **params**: + /// * `onClickTarget`: Its a function which is required to run desired tasks on click. + /// * `onFinish`: Its a function which is required to run desired tasks on finish + /// * `targets`: [FocusTargets] to show the tour on. + /// + /// **returns**: + /// None + + void showTutorial({ + required Function(TargetFocus) onClickTarget, + required dynamic Function() onFinish, + required List targets, + }) { + tutorialCoachMark = TutorialCoachMark( + targets: targets.map((target) => target.focusWidget).toList(), + colorShadow: Theme.of(model.context).colorScheme.secondaryContainer, + textSkip: "SKIP", + textStyleSkip: TextStyle( + color: Theme.of(model.context).colorScheme.surface, + fontSize: 20, + ), + paddingFocus: 10, + opacityShadow: 1.0, + onFinish: onFinish, + onClickTarget: onClickTarget, + onSkip: () { + if (MainScreenViewModel.scaffoldKey.currentState!.isDrawerOpen) { + navigationService.pop(); + } + model.tourSkipped = true; + model.onTabTapped(0); + return true; + }, + onClickOverlay: (target) { + onClickTarget(target); + }, + ); + if (!model.testMode) tutorialCoachMark.show(context: model.context); + } +} + +/// Class that represents FocusTarget. +class FocusTarget { + /// This returns a widget for a step in a tutorial. + /// + /// **params**: + /// * `key`: key of type GlobalKey. + /// * `keyName`: key where the widget shows. + /// * `description`: description of the step. + /// * `isCircle`: bool to specify if circle + /// * `align`: align of type ContentAlign to align button. + /// * `crossAlign`: Cross align axes + /// * `skipAlignment`: to give alignment of skip option + /// * `next`: Function` type, this show the next step or `key` to show the tour of. + /// * `nextCrossAlign`: nextCrossAlign to give alignment of next option + /// * `isEnd`: true if last step of the tour. + /// * `tutorialCoachMark`: instance of tutorialCoachMark to which this focusTarget is linked. + FocusTarget({ + required this.key, + required this.keyName, + required this.description, + required this.appTour, + this.isCircle = false, + this.align = ContentAlign.bottom, + this.crossAlign = CrossAxisAlignment.start, + this.skipAlignment = Alignment.topRight, + this.next, + this.nextCrossAlign = CrossAxisAlignment.end, + this.isEnd = false, + }) { + this.focusWidget = TargetFocus( + enableOverlayTab: true, + color: Colors.transparent, + identify: keyName, + keyTarget: key, + alignSkip: skipAlignment, + shape: isCircle ? ShapeLightFocus.Circle : ShapeLightFocus.RRect, + contents: [ + TargetContent( + align: align, + builder: (context, controller) { + return Container( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: crossAlign, + children: [ + Text( + AppLocalizations.of(context)!.strictTranslate(description), + style: TextStyle( + color: Theme.of(context).colorScheme.secondary, + fontSize: 20, + ), + ), + ], + ), + ); + }, + ), + TargetContent( + align: ContentAlign.custom, + customPosition: CustomTargetContentPosition( + bottom: SizeConfig.screenHeight! * 0.025, + ), + builder: (context, controller) { + return GestureDetector( + onTap: () { + next?.call(); + appTour.tutorialCoachMark.next(); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: nextCrossAlign, + children: [ + Text( + AppLocalizations.of(context)! + .strictTranslate(isEnd ? 'COMPLETE' : 'NEXT'), + style: TextStyle( + color: Theme.of(context).colorScheme.secondary, + fontSize: 20, + ), + ), + ], + ), + ); + }, + ), + ], + ); + } + + /// represents the key of the target that is intended to be focused. + GlobalKey key; + + /// keyName of the target in mainScreenViewModel. + String keyName; + + /// description of the target. + String description; + + /// true if focusing shape is circle. + bool isCircle; + + /// alignment of description text. + ContentAlign align; + + /// crossAxisAlignment. + CrossAxisAlignment crossAlign; + + /// skip alignment configuration. + Alignment skipAlignment; + + /// instance of AppTour. + AppTour appTour; + + /// next callback that is executed on pressing this target. + Function()? next; + + /// next target's crossAxisAlignment. + CrossAxisAlignment nextCrossAlign; + + /// true current target ends ths appTour. + bool isEnd; + + /// Target focus widget with all above properties. + late TargetFocus focusWidget; +} diff --git a/lib/models/asymetric_keys/asymetric_keys.dart b/lib/models/asymetric_keys/asymetric_keys.dart new file mode 100644 index 000000000..bdd971a77 --- /dev/null +++ b/lib/models/asymetric_keys/asymetric_keys.dart @@ -0,0 +1,15 @@ +import 'package:hive/hive.dart'; +import 'package:pointycastle/api.dart'; +part 'asymetric_keys.g.dart'; + +// This model is created to save Asymmetric Keys to the Hive as Hive doesn't allow to store objects other than Arrays, List, int, Strings etc. +@HiveType(typeId: 7) + +/// Hive Type for [AssymetricKeys]. +class AsymetricKeys extends HiveObject { + AsymetricKeys({required this.keyPair}); + @HiveField(0) + + /// The key pair to work with. + final AsymmetricKeyPair keyPair; +} diff --git a/lib/models/asymetric_keys/asymetric_keys.g.dart b/lib/models/asymetric_keys/asymetric_keys.g.dart new file mode 100644 index 000000000..5661ba4f0 --- /dev/null +++ b/lib/models/asymetric_keys/asymetric_keys.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'asymetric_keys.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class AsymetricKeysAdapter extends TypeAdapter { + @override + final int typeId = 7; + + @override + AsymetricKeys read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return AsymetricKeys( + keyPair: fields[0] as AsymmetricKeyPair, + ); + } + + @override + void write(BinaryWriter writer, AsymetricKeys obj) { + writer + ..writeByte(1) + ..writeByte(0) + ..write(obj.keyPair); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AsymetricKeysAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/models/caching/cached_user_action.dart b/lib/models/caching/cached_user_action.dart new file mode 100644 index 000000000..a5da571ee --- /dev/null +++ b/lib/models/caching/cached_user_action.dart @@ -0,0 +1,148 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; + +part 'cached_user_action.g.dart'; + +/// CachedUserAction class represents a user action that is cached for offline use. +/// +/// This class provides the following functionalities: +/// * `toJson` : converts a CachedUserAction to a JSON-compatible map. +/// * `fromJson` : creates a CachedUserAction from a JSON-compatible map. +/// * `execute` : executes the cached user action based on its operation type. +@HiveType(typeId: 3) +class CachedUserAction extends HiveObject { + CachedUserAction({ + required this.id, + required this.operation, + this.variables, + required this.timeStamp, + required this.status, + this.metaData, + required this.operationType, + required this.expiry, + }); + + /// Creates a CachedUserAction from a JSON-compatible map. + /// + /// **params**: + /// * `json` : a map representing the CachedUserAction. + /// + /// **returns**: + /// * `CachedUserAction` : a new instance of CachedUserAction. + factory CachedUserAction.fromJson(Map json) { + return CachedUserAction( + id: json['id'] as String, + operation: json['operation'] as String, + variables: json['variables'] as Map?, + timeStamp: DateTime.parse(json['timeStamp'] as String), + status: json['status'] as CachedUserActionStatus, + expiry: DateTime.parse(json['expiry'] as String), + metaData: json['metaData'] as Map?, + operationType: json['operationType'] as CachedOperationType, + ); + } + + /// Converts a CachedUserAction to a JSON-compatible map. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: a map representing the CachedUserAction. + Map toJson() { + return { + 'id': id, + 'operation': operation, + 'variables': variables, + 'timeStamp': timeStamp.toIso8601String(), + 'status': status, + 'metaData': metaData, + 'operationType': operationType, + 'expiry': expiry.toIso8601String(), + }; + } + + @override + String toString() { + return ''' + CachedUserAction( + id: $id, + operation: $operation, + variables: $variables, + timeStamp: $timeStamp, + expiry: $expiry, + status: $status, + metaData: $metaData, + operationType: $operationType, + ) + '''; + } + + /// Executes the cached user action based on its operation type. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future>`: result. + Future> execute() async { + switch (operationType) { + case CachedOperationType.gqlAuthQuery: + return await databaseFunctions.gqlAuthQuery( + operation, + variables: this.variables, + ); + case CachedOperationType.gqlAuthMutation: + return await databaseFunctions.gqlAuthMutation( + operation, + variables: this.variables, + ); + case CachedOperationType.gqlNonAuthQuery: + return await databaseFunctions.gqlNonAuthQuery( + operation, + variables: this.variables, + ); + case CachedOperationType.gqlNonAuthMutation: + return await databaseFunctions.gqlNonAuthMutation( + operation, + variables: this.variables, + ); + default: + return databaseFunctions.noData; + } + } + + /// The unique identifier for the cached user action. + @HiveField(0) + String id; + + /// The operation to be performed for the cached user action. + @HiveField(1) + String operation; + + /// The variables required for the operation, if any. + @HiveField(2) + Map? variables; + + /// The timestamp when the action was cached. + @HiveField(3) + DateTime timeStamp; + + /// The status of the cached user action. + @HiveField(4) + CachedUserActionStatus status; + + /// Any additional metadata related to the cached user action. + @HiveField(5) + Map? metaData; + + /// The type of operation for the cached user action. + @HiveField(6) + CachedOperationType operationType; + + /// The expiry date and time for the cached user action. + @HiveField(7) + DateTime expiry; +} diff --git a/lib/models/caching/cached_user_action.g.dart b/lib/models/caching/cached_user_action.g.dart new file mode 100644 index 000000000..95e0cd8f8 --- /dev/null +++ b/lib/models/caching/cached_user_action.g.dart @@ -0,0 +1,62 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'cached_user_action.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class CachedUserActionAdapter extends TypeAdapter { + @override + final int typeId = 3; + + @override + CachedUserAction read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return CachedUserAction( + id: fields[0] as String, + operation: fields[1] as String, + variables: (fields[2] as Map?)?.cast(), + timeStamp: fields[3] as DateTime, + status: fields[4] as CachedUserActionStatus, + metaData: (fields[5] as Map?)?.cast(), + operationType: fields[6] as CachedOperationType, + expiry: fields[7] as DateTime, + ); + } + + @override + void write(BinaryWriter writer, CachedUserAction obj) { + writer + ..writeByte(8) + ..writeByte(0) + ..write(obj.id) + ..writeByte(1) + ..write(obj.operation) + ..writeByte(2) + ..write(obj.variables) + ..writeByte(3) + ..write(obj.timeStamp) + ..writeByte(4) + ..write(obj.status) + ..writeByte(5) + ..write(obj.metaData) + ..writeByte(6) + ..write(obj.operationType) + ..writeByte(7) + ..write(obj.expiry); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is CachedUserActionAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/models/chats/chat_list_tile_data_model.dart b/lib/models/chats/chat_list_tile_data_model.dart new file mode 100644 index 000000000..6e0949fc8 --- /dev/null +++ b/lib/models/chats/chat_list_tile_data_model.dart @@ -0,0 +1,25 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:json_annotation/json_annotation.dart'; +import 'package:talawa/models/chats/chat_user.dart'; + +part 'chat_list_tile_data_model.g.dart'; + +@JsonSerializable() + +/// This class creates JSON code using the JsonSerializable package. +class ChatListTileDataModel { + ChatListTileDataModel(this.users, this.id); + + // Connect the generated [_$ChatListTileDataModelFromJson] function to the `fromJson` + // factory. + factory ChatListTileDataModel.fromJson(Map json) => + _$ChatListTileDataModelFromJson(json); + + // Connect the generated [_$ChatListTileDataModelToJson] function to the `toJson` method. + Map toJson() => _$ChatListTileDataModelToJson(this); + + List? users; + String? id; +} diff --git a/lib/models/chats/chat_list_tile_data_model.g.dart b/lib/models/chats/chat_list_tile_data_model.g.dart new file mode 100644 index 000000000..200e51549 --- /dev/null +++ b/lib/models/chats/chat_list_tile_data_model.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_list_tile_data_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatListTileDataModel _$ChatListTileDataModelFromJson( + Map json, +) => + ChatListTileDataModel( + (json['users'] as List?) + ?.map((e) => ChatUser.fromJson(e as Map)) + .toList(), + json['id'] as String?, + ); + +Map _$ChatListTileDataModelToJson( + ChatListTileDataModel instance, +) => + { + 'users': instance.users, + 'id': instance.id, + }; diff --git a/lib/models/chats/chat_message.dart b/lib/models/chats/chat_message.dart new file mode 100644 index 000000000..cbfd6d7b2 --- /dev/null +++ b/lib/models/chats/chat_message.dart @@ -0,0 +1,31 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:json_annotation/json_annotation.dart'; +import 'package:talawa/models/chats/chat_user.dart'; +part 'chat_message.g.dart'; + +@JsonSerializable(explicitToJson: true) + +/// This class creates JSON code for chat message using the JsonSerializable package. + +class ChatMessage { + ChatMessage( + this.id, + this.sender, + this.messageContent, + this.receiver, + ); + // Connect the generated [_$ChatMessageFromJson] function to the `fromJson` + // factory. + factory ChatMessage.fromJson(Map json) => + _$ChatMessageFromJson(json); + + // Connect the generated [_$ChatMessageToJson] function to the `toJson` method. + Map toJson() => _$ChatMessageToJson(this); + + String? id; + ChatUser? sender; + ChatUser? receiver; + String? messageContent; +} diff --git a/lib/models/chats/chat_message.g.dart b/lib/models/chats/chat_message.g.dart new file mode 100644 index 000000000..24dedabc9 --- /dev/null +++ b/lib/models/chats/chat_message.g.dart @@ -0,0 +1,26 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_message.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatMessage _$ChatMessageFromJson(Map json) => ChatMessage( + json['id'] as String?, + json['sender'] == null + ? null + : ChatUser.fromJson(json['sender'] as Map), + json['messageContent'] as String?, + json['receiver'] == null + ? null + : ChatUser.fromJson(json['receiver'] as Map), + ); + +Map _$ChatMessageToJson(ChatMessage instance) => + { + 'id': instance.id, + 'sender': instance.sender?.toJson(), + 'receiver': instance.receiver?.toJson(), + 'messageContent': instance.messageContent, + }; diff --git a/lib/models/chats/chat_user.dart b/lib/models/chats/chat_user.dart new file mode 100644 index 000000000..d12b3c51d --- /dev/null +++ b/lib/models/chats/chat_user.dart @@ -0,0 +1,24 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:json_annotation/json_annotation.dart'; +part 'chat_user.g.dart'; + +@JsonSerializable() + +/// This class creates JSON code for chat user using the JsonSerializable package. +class ChatUser { + ChatUser({this.firstName, this.id, this.image}); + + // Connect the generated [_$ChatUserFromJson] function to the `fromJson` + // factory. + factory ChatUser.fromJson(Map json) => + _$ChatUserFromJson(json); + + // Connect the generated [_$ChatUserFromJson] function to the `toJson` method. + Map toJson() => _$ChatUserToJson(this); + + String? firstName; + String? id; + String? image; +} diff --git a/lib/models/chats/chat_user.g.dart b/lib/models/chats/chat_user.g.dart new file mode 100644 index 000000000..beeef4f36 --- /dev/null +++ b/lib/models/chats/chat_user.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'chat_user.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ChatUser _$ChatUserFromJson(Map json) => ChatUser( + firstName: json['firstName'] as String?, + id: json['id'] as String?, + image: json['image'] as String?, + ); + +Map _$ChatUserToJson(ChatUser instance) => { + 'firstName': instance.firstName, + 'id': instance.id, + 'image': instance.image, + }; diff --git a/lib/models/comment/comment_model.dart b/lib/models/comment/comment_model.dart new file mode 100644 index 000000000..b82102150 --- /dev/null +++ b/lib/models/comment/comment_model.dart @@ -0,0 +1,46 @@ +import 'package:hive/hive.dart'; +import 'package:talawa/models/user/user_info.dart'; + +part 'comment_model.g.dart'; + +///This class returns a Comment instance. +@HiveType(typeId: 12) +class Comment { + Comment({this.text, this.createdAt, this.creator, this.post, this.likeCount}); + //Creating a new Comment instance from a map structure. + factory Comment.fromJson(Map json) { + return Comment( + text: json['text'] as String?, + createdAt: json['createdAt'] as String?, + creator: json['creator'] == null + ? null + //Creating a new User instance from a map structure. + : User.fromJson( + json['creator'] as Map, + fromOrg: true, + ), + post: json['post'] as String?, + likeCount: json['likeCount'] as String?, + ); + } + + /// The text of the comment. + @HiveField(0) + String? text; + + /// The creation date of the comment. + @HiveField(1) + String? createdAt; + + /// The creator of the comment. + @HiveField(2) + User? creator; + + /// The post associated with the comment. + @HiveField(3) + String? post; + + /// The like count of the comment. + @HiveField(4) + String? likeCount; +} diff --git a/lib/models/comment/comment_model.g.dart b/lib/models/comment/comment_model.g.dart new file mode 100644 index 000000000..6bd78ee0e --- /dev/null +++ b/lib/models/comment/comment_model.g.dart @@ -0,0 +1,53 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'comment_model.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class CommentAdapter extends TypeAdapter { + @override + final int typeId = 12; + + @override + Comment read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return Comment( + text: fields[0] as String?, + createdAt: fields[1] as String?, + creator: fields[2] as User?, + post: fields[3] as String?, + likeCount: fields[4] as String?, + ); + } + + @override + void write(BinaryWriter writer, Comment obj) { + writer + ..writeByte(5) + ..writeByte(0) + ..write(obj.text) + ..writeByte(1) + ..write(obj.createdAt) + ..writeByte(2) + ..write(obj.creator) + ..writeByte(3) + ..write(obj.post) + ..writeByte(4) + ..write(obj.likeCount); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is CommentAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/models/events/event_agenda_category.dart b/lib/models/events/event_agenda_category.dart new file mode 100644 index 000000000..213cf28c5 --- /dev/null +++ b/lib/models/events/event_agenda_category.dart @@ -0,0 +1,26 @@ +///This class creates an event agenda category model. +class AgendaCategory { + AgendaCategory({ + this.id, + this.name, + this.description, + }); + + /// Creates a new `AgendaCategory` instance from a JSON map. + factory AgendaCategory.fromJson(Map json) { + return AgendaCategory( + id: json['_id'] as String?, + name: json['name'] as String?, + description: json['description'] as String?, + ); + } + + /// Id of the agenda category. + final String? id; + + /// Name of the category. + final String? name; + + /// Description of the category. + final String? description; +} diff --git a/lib/models/events/event_agenda_item.dart b/lib/models/events/event_agenda_item.dart new file mode 100644 index 000000000..f0cd89cf0 --- /dev/null +++ b/lib/models/events/event_agenda_item.dart @@ -0,0 +1,94 @@ +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; + +/// enum for agenda Item type. +enum ItemType { + /// regular type agenda item. + regular, + + /// note type agenda item. + note, +} + +/// Model for Event Agenda Item. +class EventAgendaItem { + EventAgendaItem({ + this.id, + this.title, + this.description, + this.duration, + this.attachments, + this.createdBy, + this.urls, + this.relatedEvent, + this.categories, + this.sequence, + // this.itemType, + // this.isNote, + this.organization, + }); + // Factory constructor for creating an AgendaItem instance from a JSON map + factory EventAgendaItem.fromJson(Map json) { + return EventAgendaItem( + id: json['_id'] as String?, + title: json['title'] as String?, + description: json['description'] as String?, + duration: json['duration'] as String?, + attachments: (json['attachments'] as List?) + ?.map((e) => e as String) + .toList(), + createdBy: json['createdBy'] != null + ? User.fromJson( + json['createdBy'] as Map, + fromOrg: true, + ) + : null, + urls: (json['urls'] as List?)?.map((e) => e as String).toList(), + relatedEvent: json['relatedEvent'] != null + ? Event.fromJson(json['relatedEvent'] as Map) + : null, + categories: (json['categories'] as List?) + ?.map((e) => AgendaCategory.fromJson(e as Map)) + .toList(), + sequence: json['sequence'] as int?, + organization: json['organization'] != null + ? OrgInfo.fromJson(json['organization'] as Map) + : null, + ); + } + + /// Unique identifier for the agenda item. + final String? id; + + /// Title of the agenda item. + final String? title; + + /// Optional description. + final String? description; + + /// Duration of the agenda item. + final String? duration; + + /// Optional array of attachment URLs. + final List? attachments; + + /// Reference to the user who created the agenda item. + final User? createdBy; + + /// Optional array of URLs related to the agenda item. + final List? urls; + + /// Reference to the event associated with the agenda item. + final Event? relatedEvent; + + /// Optional array of agenda categories. + final List? categories; + + /// Sequence number of the agenda item. + final int? sequence; + + ///Reference to the organization associated with the agenda item. + final OrgInfo? organization; +} diff --git a/lib/models/events/event_model.dart b/lib/models/events/event_model.dart new file mode 100644 index 000000000..ed46089cc --- /dev/null +++ b/lib/models/events/event_model.dart @@ -0,0 +1,188 @@ +import 'package:hive/hive.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; + +part 'event_model.g.dart'; + +///This class creates an event model and returns an Event instance. +@HiveType(typeId: 10) +class Event { + Event({ + this.id, + this.title, + this.description, + this.attendees, + this.location, + this.recurring, + this.allDay, + this.startDate, + this.endDate, + this.startTime, + this.endTime, + this.isPublic, + this.isRegistered, + this.isRegisterable, + this.creator, + this.organization, + this.admins, + }); + //Creating a new Event instance from a map structure. + factory Event.fromJson( + Map json, + ) { + return Event( + id: json['_id'] as String, + title: json['title'] as String?, + description: json['description'] as String?, + location: json['location'] as String?, + recurring: json['recurring'] as bool?, + allDay: json['allDay'] as bool?, + startDate: json['startDate'] as String?, + endDate: json['endDate'] as String?, + startTime: json['startTime'] as String?, + endTime: json['endTime'] as String?, + isPublic: json['isPublic'] as bool?, + isRegistered: json['isRegistered'] as bool?, + isRegisterable: json['isRegisterable'] as bool?, + creator: json['creator'] == null + ? null + : User.fromJson( + json['creator'] as Map, + fromOrg: true, + ), + organization: json['organization'] == null + ? null + : OrgInfo.fromJson(json['organization'] as Map), + admins: json['admins'] == null + ? null + : (json['admins'] as List?) + ?.map( + (e) => User.fromJson(e as Map, fromOrg: true), + ) + .toList(), + attendees: (json["attendees"] as List?)?.isEmpty ?? true + ? null + : (json['attendees'] as List?) + ?.map( + (e) => Attendee.fromJson(e as Map), + ) + .toList(), + ); + } + + /// Unique identifier for the event. + @HiveField(0) + String? id; + + /// The title of the event. + @HiveField(1) + String? title; + + /// The description of the event. + @HiveField(2) + String? description; + + /// The location of the event. + @HiveField(3) + String? location; + + /// A boolean value that indicates if the event is recurring. + @HiveField(4) + bool? recurring; + + /// A boolean value that indicates if the event is an all-day event. + @HiveField(5) + bool? allDay; + + /// The start date of the event. + @HiveField(6) + String? startDate; + + /// The end date of the event. + @HiveField(7) + String? endDate; + + /// The start time of the event. + @HiveField(8) + String? startTime; + + /// The end time of the event. + @HiveField(9) + String? endTime; + + /// A boolean value that indicates if the event is public. + @HiveField(10) + bool? isPublic; + + /// A boolean value that indicates if the user is registered for the event. + @HiveField(11) + bool? isRegistered; + + /// A boolean value that indicates if the event is registerable. + @HiveField(12) + bool? isRegisterable; + + /// The creator of the event. + @HiveField(13) + User? creator; + + /// The organization of the event. + @HiveField(14) + OrgInfo? organization; + + /// The admins of the event. + @HiveField(15) + List? admins; + + /// The attendees of the event. + @HiveField(16) + List? attendees; +} + +///This class creates an attendee model and returns an Attendee instance. +@HiveType(typeId: 11) +class Attendee { + Attendee({this.id, this.firstName, this.lastName, this.image}); + + Attendee.fromJson(Map json) { + id = json['_id'] as String?; + firstName = json['firstName'] as String?; + lastName = json['lastName'] as String?; + image = json['image'] as String?; + } + + /// Unique identifier for the attendee. + @HiveField(0) + String? id; + + /// The first name of the attendee. + @HiveField(1) + String? firstName; + + /// The last name of the attendee. + @HiveField(2) + String? lastName; + + /// The image URL of the attendee. + @HiveField(3) + String? image; + + /// Converts the Attendee instance to a map structure.. + /// + /// This method is used to convert the Attendee instance to a map structure that can be converted to a JSON object. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: A map structure that can be converted to a JSON object. + + Map toJson() { + final Map data = {}; + data['_id'] = this.id; + data['firstName'] = this.firstName; + data['lastName'] = this.lastName; + data['image'] = this.image; + return data; + } +} diff --git a/lib/models/events/event_model.g.dart b/lib/models/events/event_model.g.dart new file mode 100644 index 000000000..f0547ff01 --- /dev/null +++ b/lib/models/events/event_model.g.dart @@ -0,0 +1,132 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'event_model.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class EventAdapter extends TypeAdapter { + @override + final int typeId = 10; + + @override + Event read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return Event( + id: fields[0] as String?, + title: fields[1] as String?, + description: fields[2] as String?, + attendees: (fields[16] as List?)?.cast(), + location: fields[3] as String?, + recurring: fields[4] as bool?, + allDay: fields[5] as bool?, + startDate: fields[6] as String?, + endDate: fields[7] as String?, + startTime: fields[8] as String?, + endTime: fields[9] as String?, + isPublic: fields[10] as bool?, + isRegistered: fields[11] as bool?, + isRegisterable: fields[12] as bool?, + creator: fields[13] as User?, + organization: fields[14] as OrgInfo?, + admins: (fields[15] as List?)?.cast(), + ); + } + + @override + void write(BinaryWriter writer, Event obj) { + writer + ..writeByte(17) + ..writeByte(0) + ..write(obj.id) + ..writeByte(1) + ..write(obj.title) + ..writeByte(2) + ..write(obj.description) + ..writeByte(3) + ..write(obj.location) + ..writeByte(4) + ..write(obj.recurring) + ..writeByte(5) + ..write(obj.allDay) + ..writeByte(6) + ..write(obj.startDate) + ..writeByte(7) + ..write(obj.endDate) + ..writeByte(8) + ..write(obj.startTime) + ..writeByte(9) + ..write(obj.endTime) + ..writeByte(10) + ..write(obj.isPublic) + ..writeByte(11) + ..write(obj.isRegistered) + ..writeByte(12) + ..write(obj.isRegisterable) + ..writeByte(13) + ..write(obj.creator) + ..writeByte(14) + ..write(obj.organization) + ..writeByte(15) + ..write(obj.admins) + ..writeByte(16) + ..write(obj.attendees); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is EventAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class AttendeeAdapter extends TypeAdapter { + @override + final int typeId = 11; + + @override + Attendee read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return Attendee( + id: fields[0] as String?, + firstName: fields[1] as String?, + lastName: fields[2] as String?, + image: fields[3] as String?, + ); + } + + @override + void write(BinaryWriter writer, Attendee obj) { + writer + ..writeByte(4) + ..writeByte(0) + ..write(obj.id) + ..writeByte(1) + ..write(obj.firstName) + ..writeByte(2) + ..write(obj.lastName) + ..writeByte(3) + ..write(obj.image); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AttendeeAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/models/events/event_venue.dart b/lib/models/events/event_venue.dart new file mode 100644 index 000000000..0edc779be --- /dev/null +++ b/lib/models/events/event_venue.dart @@ -0,0 +1,54 @@ +/// The `Venue` class represents a venue for events. +class Venue { + /// Constructs a `Venue` instance. + /// + /// [id] is the unique identifier of the venue. + /// [capacity] is the maximum number of people the venue can accommodate. + /// [description] provides additional details about the venue. + /// [imageUrl] is the URL of the venue's image. + /// [name] is the name of the venue. + /// [organizationId] is the identifier of the organization to which the venue belongs. + Venue({ + this.id, + this.capacity, + this.description, + this.imageUrl, + this.name, + this.organizationId, + }); + + /// Creates a `Venue` instance from a JSON object. + /// + /// The [json] parameter is a map containing the venue data. + /// + /// Returns an instance of `Venue`. + factory Venue.fromJson(Map json) { + return Venue( + id: json['_id'] as String?, + capacity: json['capacity'] as int?, + description: json['description'] as String?, + imageUrl: json['imageUrl'] as String? ?? '', + name: json['name'] as String?, + organizationId: + (json['organization'] as Map?)?['_id'] as String?, + ); + } + + /// The unique identifier of the venue. + final String? id; + + /// The maximum number of people the venue can accommodate. + final int? capacity; + + /// Provides additional details about the venue. + final String? description; + + /// The URL of the venue's image. + final String? imageUrl; + + /// The name of the venue. + final String? name; + + /// The identifier of the organization to which the venue belongs. + final String? organizationId; +} diff --git a/lib/models/events/event_volunteer.dart b/lib/models/events/event_volunteer.dart new file mode 100644 index 000000000..9a81c599c --- /dev/null +++ b/lib/models/events/event_volunteer.dart @@ -0,0 +1,72 @@ +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/user/user_info.dart'; + +/// This class creates an event volunteer model and returns an EventVolunteer instance. +class EventVolunteer { + EventVolunteer({ + this.id, + this.creator, + this.event, + this.group, + this.isAssigned, + this.isInvited, + this.response, + this.user, + }); + + // Creating a new EventVolunteer instance from a map structure. + factory EventVolunteer.fromJson(Map json) { + return EventVolunteer( + id: json['_id'] as String?, + creator: json['creator'] != null + ? User.fromJson( + json['creator'] as Map, + fromOrg: true, + ) + : null, + event: json['event'] != null + ? Event.fromJson(json['event'] as Map) + : null, + group: json['group'] != null + ? EventVolunteerGroup.fromJson(json['group'] as Map) + : null, + isAssigned: json['isAssigned'] as bool?, + isInvited: json['isInvited'] as bool?, + response: json['response'] as String?, + user: json['user'] != null + ? User.fromJson(json['user'] as Map, fromOrg: true) + : null, + ); + } + + /// Unique identifier for the event volunteer. + String? id; + + /// The creation date of the event volunteer. + String? createdAt; + + /// The creator of the event volunteer. + User? creator; + + /// The event associated with the event volunteer. + Event? event; + + /// The group associated with the event volunteer. + EventVolunteerGroup? group; + + /// A boolean value that indicates if the volunteer is assigned. + bool? isAssigned; + + /// A boolean value that indicates if the volunteer is invited. + bool? isInvited; + + /// The response of the volunteer. + String? response; + + /// The last update date of the event volunteer. + String? updatedAt; + + /// The user who is the volunteer. + User? user; +} diff --git a/lib/models/events/event_volunteer_group.dart b/lib/models/events/event_volunteer_group.dart new file mode 100644 index 000000000..b2edda023 --- /dev/null +++ b/lib/models/events/event_volunteer_group.dart @@ -0,0 +1,74 @@ +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer.dart'; +import 'package:talawa/models/user/user_info.dart'; + +/// This class creates an event volunteer group model and returns an EventVolunteerGroup instance. +class EventVolunteerGroup { + EventVolunteerGroup({ + this.id, + this.createdAt, + this.creator, + this.event, + this.leader, + this.name, + this.updatedAt, + this.volunteers, + this.volunteersRequired, + }); + + // Creating a new EventVolunteerGroup instance from a map structure. + factory EventVolunteerGroup.fromJson(Map json) { + return EventVolunteerGroup( + id: json['_id'] as String?, + createdAt: json['createdAt'] as String?, + creator: json['creator'] == null + ? null + : User.fromJson( + json['creator'] as Map, + fromOrg: true, + ), + event: json['event'] == null + ? null + : Event.fromJson(json['event'] as Map), + leader: json['leader'] == null + ? null + : User.fromJson( + json['leader'] as Map, + fromOrg: true, + ), + name: json['name'] as String?, + updatedAt: json['updatedAt'] as String?, + volunteers: (json['volunteers'] as List?) + ?.map((e) => EventVolunteer.fromJson(e as Map)) + .toList(), + volunteersRequired: json['volunteersRequired'] as int?, + ); + } + + /// Unique identifier for the event volunteer group. + String? id; + + /// The creation date of the event volunteer group. + String? createdAt; + + /// The creator of the event volunteer group. + User? creator; + + /// The event associated with the event volunteer group. + Event? event; + + /// The leader of the event volunteer group. + User? leader; + + /// The name of the event volunteer group. + String? name; + + /// The last update date of the event volunteer group. + String? updatedAt; + + /// The list of volunteers in the event volunteer group. + List? volunteers; + + /// The number of volunteers required for the event volunteer group. + int? volunteersRequired; +} diff --git a/lib/models/language/language_model.dart b/lib/models/language/language_model.dart new file mode 100644 index 000000000..15f643fc1 --- /dev/null +++ b/lib/models/language/language_model.dart @@ -0,0 +1,17 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +///This class creates an langauge model. +class Language { + Language({ + required this.countryCode, + required this.langCode, + required this.langName, + required this.langSample, + }); + + final String countryCode; + final String langCode; + final String langName; + final String langSample; +} diff --git a/lib/models/mainscreen_navigation_args.dart b/lib/models/mainscreen_navigation_args.dart new file mode 100644 index 000000000..a23caaff2 --- /dev/null +++ b/lib/models/mainscreen_navigation_args.dart @@ -0,0 +1,42 @@ +/// This class creates a MainScreenArgs model. +class MainScreenArgs { + MainScreenArgs({ + this.fromSignUp = false, + required this.mainScreenIndex, + this.toggleDemoMode = false, + }); + + /// Indicates whether the user navigated to the main screen from the signup page. + final bool fromSignUp; + + /// Represents the index of the current page. + final int mainScreenIndex; + + /// Determines if the application is in demo mode. + final bool toggleDemoMode; + + /// Overrides the equality operator to compare instances of the MainScreenArgs class. + /// + /// Checks whether the [other] object is of the same type and compares its properties: + /// If all properties match, returns `true`; otherwise, returns `false`. + /// + /// **params**: + /// * `other`: The object to compare against this MainScreenArgs instance. + /// + /// **returns**: + /// * `bool`: Returns `true` if the properties of both instances match; otherwise, `false`. + @override + bool operator ==(Object other) => + identical(this, other) || + other is MainScreenArgs && + other.fromSignUp == fromSignUp && + other.mainScreenIndex == mainScreenIndex && + other.toggleDemoMode == toggleDemoMode; + + /// Overrides the hashCode getter to generate a hash code based on the properties of the MainScreenArgs instance. + /// + /// Returns an integer value representing the combined hash codes. + @override + int get hashCode => + fromSignUp.hashCode ^ mainScreenIndex.hashCode ^ toggleDemoMode.hashCode; +} diff --git a/lib/models/options/options.dart b/lib/models/options/options.dart new file mode 100644 index 000000000..828fccb33 --- /dev/null +++ b/lib/models/options/options.dart @@ -0,0 +1,19 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; + +///This class creates a Option model. +class Options { + Options({ + required this.icon, + required this.title, + required this.subtitle, + this.trailingIconButton, + }); + + Widget icon; + String title; + String subtitle; + IconButton? trailingIconButton; +} diff --git a/lib/models/organization/org_info.dart b/lib/models/organization/org_info.dart new file mode 100644 index 000000000..961ce9965 --- /dev/null +++ b/lib/models/organization/org_info.dart @@ -0,0 +1,133 @@ +import 'package:hive/hive.dart'; +import 'package:talawa/models/organization/org_info_address.dart'; +import 'package:talawa/models/user/user_info.dart'; + +part 'org_info.g.dart'; + +@HiveType(typeId: 2) + +///This class creates an organization-information model and returns an OrgInfo instance. +class OrgInfo { + OrgInfo({ + this.admins, + this.members, + this.creatorInfo, + this.description, + this.id, + this.image, + this.userRegistrationRequired, + this.name, + this.address, + }); + + factory OrgInfo.fromJson( + Map json1, { + bool memberRequest = false, + }) { + Map json; + if (memberRequest) { + json = json1['organization'] as Map; + } else { + json = json1; + } + return OrgInfo( + id: json['_id'] != null ? json['_id'] as String : null, + image: json['image'] != null ? json['image'] as String? : null, + name: json['name'] != null ? json['name'] as String? : null, + description: + json['description'] != null ? json['description'] as String? : null, + userRegistrationRequired: json['userRegistrationRequired'] != null + ? json['userRegistrationRequired'] as bool? + : null, + creatorInfo: json['creator'] != null + ? User.fromJson( + json['creator'] as Map, + fromOrg: true, + ) + : null, + members: json['members'] != null + ? (json['members'] as List?) + ?.map( + (e) => User.fromJson(e as Map, fromOrg: true), + ) + .toList() + : null, + admins: json['admins'] != null + ? (json['admins'] as List?) + ?.map( + (e) => User.fromJson(e as Map, fromOrg: true), + ) + .toList() + : null, + address: json['address'] != null + ? Address.fromJson(json['address'] as Map) + : null, + ); + } + + /// 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(dynamic json) { + final List orgList = []; + + if (json is List) { + for (final dynamic outerElement in json) { + if (outerElement is List) { + for (final dynamic innerElement in outerElement) { + if (innerElement is Map) { + final OrgInfo org = OrgInfo.fromJson(innerElement); + orgList.add(org); + } + } + } else if (outerElement is Map) { + final OrgInfo org = OrgInfo.fromJson(outerElement); + orgList.add(org); + } + } + } + + 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 registration is required. + @HiveField(6) + bool? userRegistrationRequired; + + /// The org creatorInfo. + @HiveField(7) + User? creatorInfo; + + /// Address of the Organisation. + @HiveField(8) + Address? address; +} diff --git a/lib/models/organization/org_info.g.dart b/lib/models/organization/org_info.g.dart new file mode 100644 index 000000000..1deae17c9 --- /dev/null +++ b/lib/models/organization/org_info.g.dart @@ -0,0 +1,65 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'org_info.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class OrgInfoAdapter extends TypeAdapter { + @override + final int typeId = 2; + + @override + OrgInfo read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return OrgInfo( + admins: (fields[3] as List?)?.cast(), + members: (fields[4] as List?)?.cast(), + creatorInfo: fields[7] as User?, + description: fields[5] as String?, + id: fields[1] as String?, + image: fields[0] as String?, + userRegistrationRequired: fields[6] as bool?, + name: fields[2] as String?, + address: fields[8] as Address?, + ); + } + + @override + void write(BinaryWriter writer, OrgInfo obj) { + writer + ..writeByte(9) + ..writeByte(0) + ..write(obj.image) + ..writeByte(1) + ..write(obj.id) + ..writeByte(2) + ..write(obj.name) + ..writeByte(3) + ..write(obj.admins) + ..writeByte(4) + ..write(obj.members) + ..writeByte(5) + ..write(obj.description) + ..writeByte(6) + ..write(obj.userRegistrationRequired) + ..writeByte(7) + ..write(obj.creatorInfo) + ..writeByte(8) + ..write(obj.address); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is OrgInfoAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/models/organization/org_info_address.dart b/lib/models/organization/org_info_address.dart new file mode 100644 index 000000000..13664655f --- /dev/null +++ b/lib/models/organization/org_info_address.dart @@ -0,0 +1,52 @@ +/// Model for the address of an organisation. +class Address { + /// Constructs an Address object. + Address({ + this.city, + this.countryCode, + this.dependentLocality, + this.line1, + this.line2, + this.postalCode, + this.sortingCode, + this.state, + }); + + /// Factory method to construct an Address from a JSON object. + factory Address.fromJson(Map json) { + return Address( + city: json['city'] as String?, + countryCode: json['countryCode'] as String?, + dependentLocality: json['dependentLocality'] as String?, + line1: json['line1'] as String?, + line2: json['line2'] as String?, + postalCode: json['postalCode'] as String?, + sortingCode: json['sortingCode'] as String?, + state: json['state'] as String?, + ); + } + + /// The city of the address. + final String? city; + + /// The country code of the address. + final String? countryCode; + + /// The dependent locality of the address. + final String? dependentLocality; + + /// The first line of the address. + final String? line1; + + /// The second line of the address. + final String? line2; + + /// The postal code of the address. + final String? postalCode; + + /// The sorting code of the address. + final String? sortingCode; + + /// The state of the address. + final String? state; +} diff --git a/lib/models/post/post_model.dart b/lib/models/post/post_model.dart new file mode 100644 index 000000000..ef6488c88 --- /dev/null +++ b/lib/models/post/post_model.dart @@ -0,0 +1,187 @@ +import 'package:hive/hive.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; + +part 'post_model.g.dart'; + +///This class creates a Post model. + +@HiveType(typeId: 6) +class Post { + Post({ + required this.sId, + this.description, + this.createdAt, + this.imageUrl, + this.base64String, + this.videoUrl, + required this.creator, + this.organization, + this.likedBy, + this.comments, + }); + + ///Creating a new Post instance from a map structure. + + /// + /// params: + /// None + /// returns: + /// * `PostObject`: Dart Object for posts + Post.fromJson(Map json) { + sId = json['_id'] as String; + description = json['text'] as String?; + createdAt = DateTime.parse(json['createdAt'] as String); + imageUrl = json['imageUrl'] as String?; + base64String = json['base64String'] as String?; + videoUrl = json['videoUrl'] as String?; + creator = json['creator'] != null + ? User.fromJson(json['creator'] as Map, fromOrg: true) + : null; + organization = json['organization'] != null + ? OrgInfo.fromJson(json['organization'] as Map) + : null; + if (json['likedBy'] != null) { + likedBy = []; + (json['likedBy'] as List).forEach((v) { + likedBy?.add(LikedBy.fromJson(v as Map)); + }); + } + if (json['comments'] != null) { + comments = []; + (json['comments'] as List).forEach((v) { + comments?.add(Comments.fromJson(v as Map)); + }); + } + } + + /// unique identifier for post. + @HiveField(0) + late String sId; + + /// Description of the post. + @HiveField(1) + String? description; + + /// Creation timestamp of the post. + @HiveField(2) + DateTime? createdAt; + + /// URL of the image attached to the post. + @HiveField(3) + String? imageUrl; + + /// Base64 encoded string of an image attached to the post. + @HiveField(4) + String? base64String; + + /// URL of a video attached to the post. + @HiveField(5) + String? videoUrl; + + /// User who created the post. + @HiveField(6) + User? creator; + + /// Organization associated with the post. + @HiveField(7) + OrgInfo? organization; + + /// List of users who liked the post. + @HiveField(8) + List? likedBy; + + /// List of comments on the post. + @HiveField(9) + List? comments; + + /// this is to get duration of post. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: date is returned in ago form. + String getPostCreatedDuration() { + if (DateTime.now().difference(this.createdAt!).inSeconds < 60) { + return '${DateTime.now().difference(this.createdAt!).inSeconds} Seconds Ago'; + } else if (DateTime.now().difference(this.createdAt!).inMinutes < 60) { + return '${DateTime.now().difference(this.createdAt!).inMinutes} Minutes Ago'; + } else if (DateTime.now().difference(this.createdAt!).inHours < 24) { + return '${DateTime.now().difference(this.createdAt!).inHours} Hours Ago'; + } else if (DateTime.now().difference(this.createdAt!).inDays < 30) { + return '${DateTime.now().difference(this.createdAt!).inDays} Days Ago'; + } else if (DateTime.now().difference(this.createdAt!).inDays < 365) { + return '${DateTime.now().difference(this.createdAt!).inDays ~/ 30} Months Ago'; + } else { + return '${DateTime.now().difference(this.createdAt!).inDays ~/ 365} Years Ago'; + } + } +} + +/// This class convert between json and object for likedby. +@HiveType(typeId: 8) +class LikedBy { + LikedBy({this.sId}); + + /// JSON factory constructor. + LikedBy.fromJson(Map json) { + sId = json['_id'] as String?; + } + + /// These are dart object. + /// + /// params: + /// * `sId` : unique identifier for post + @HiveField(0) + String? sId; + + /// Convert dart object to json. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: json is returned. + Map toJson() { + final Map data = {}; + data['_id'] = this.sId; + return data; + } +} + +/// This class convert between json and object for comments. +@HiveType(typeId: 9) +class Comments { + Comments({this.sId}); + + /// Convert json to dart object. + /// + /// params: + /// None + /// returns: + /// * `Map`: Dart object is returned. + Comments.fromJson(Map json) { + sId = json['_id'] as String?; + } + + /// these are dart object. + /// + /// params: + /// * `sId` : unique identifier for post + @HiveField(0) + String? sId; + + /// Convert dart object to json. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: json is returned. + Map toJson() { + final Map data = {}; + data['_id'] = this.sId; + return data; + } +} diff --git a/lib/models/post/post_model.g.dart b/lib/models/post/post_model.g.dart new file mode 100644 index 000000000..4e473ce53 --- /dev/null +++ b/lib/models/post/post_model.g.dart @@ -0,0 +1,136 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'post_model.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class PostAdapter extends TypeAdapter { + @override + final int typeId = 6; + + @override + Post read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return Post( + sId: fields[0] as String, + description: fields[1] as String?, + createdAt: fields[2] as DateTime?, + imageUrl: fields[3] as String?, + base64String: fields[4] as String?, + videoUrl: fields[5] as String?, + creator: fields[6] as User?, + organization: fields[7] as OrgInfo?, + likedBy: (fields[8] as List?)?.cast(), + comments: (fields[9] as List?)?.cast(), + ); + } + + @override + void write(BinaryWriter writer, Post obj) { + writer + ..writeByte(10) + ..writeByte(0) + ..write(obj.sId) + ..writeByte(1) + ..write(obj.description) + ..writeByte(2) + ..write(obj.createdAt) + ..writeByte(3) + ..write(obj.imageUrl) + ..writeByte(4) + ..write(obj.base64String) + ..writeByte(5) + ..write(obj.videoUrl) + ..writeByte(6) + ..write(obj.creator) + ..writeByte(7) + ..write(obj.organization) + ..writeByte(8) + ..write(obj.likedBy) + ..writeByte(9) + ..write(obj.comments); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is PostAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class LikedByAdapter extends TypeAdapter { + @override + final int typeId = 8; + + @override + LikedBy read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return LikedBy( + sId: fields[0] as String?, + ); + } + + @override + void write(BinaryWriter writer, LikedBy obj) { + writer + ..writeByte(1) + ..writeByte(0) + ..write(obj.sId); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is LikedByAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} + +class CommentsAdapter extends TypeAdapter { + @override + final int typeId = 9; + + @override + Comments read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return Comments( + sId: fields[0] as String?, + ); + } + + @override + void write(BinaryWriter writer, Comments obj) { + writer + ..writeByte(1) + ..writeByte(0) + ..write(obj.sId); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is CommentsAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/models/user/user_info.dart b/lib/models/user/user_info.dart new file mode 100644 index 000000000..f71c98893 --- /dev/null +++ b/lib/models/user/user_info.dart @@ -0,0 +1,203 @@ +// ignore_for_file: use_setters_to_change_properties + +import 'package:flutter/material.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/models/organization/org_info.dart'; + +part 'user_info.g.dart'; + +@HiveType(typeId: 1) + +/// This class creates a User model and returns a user instance. +class User extends HiveObject { + User({ + this.adminFor, + this.createdOrganizations, + this.email, + this.firstName, + this.id, + this.image, + this.joinedOrganizations, + this.lastName, + this.authToken, + this.refreshToken, + this.membershipRequests, + }); + + factory User.fromJson(Map json1, {bool fromOrg = false}) { + Map json; + Map? appUserProfile; + if (fromOrg) { + json = json1; + appUserProfile = json1; + } else { + json = json1['user'] as Map; + appUserProfile = json1['appUserProfile'] as Map?; + } + + return User( + authToken: fromOrg ? ' ' : json1['accessToken'] as String?, + refreshToken: fromOrg ? ' ' : json1['refreshToken'] as String?, + id: json['_id'] as String?, + firstName: + json['firstName'] != null ? json['firstName'] as String? : null, + lastName: json['lastName'] != null ? json['lastName'] as String? : null, + email: json['email'] != null ? json['email'] as String? : null, + image: json['image'] != null ? json['image'] as String? : null, + adminFor: appUserProfile?['adminFor'] != null + ? (appUserProfile!['adminFor'] as List) + .map((e) => OrgInfo.fromJson(e as Map)) + .toList() + : null, + createdOrganizations: appUserProfile?['createdOrganizations'] != null + ? (appUserProfile!['createdOrganizations'] as List) + .map((e) => OrgInfo.fromJson(e as Map)) + .toList() + : null, + joinedOrganizations: json['joinedOrganizations'] != null + ? (json['joinedOrganizations'] as List) + .map((e) => OrgInfo.fromJson(e as Map)) + .toList() + : null, + membershipRequests: json['membershipRequests'] != null + ? (json['membershipRequests'] as List) + .map( + (e) => OrgInfo.fromJson( + e as Map, + memberRequest: true, + ), + ) + .toList() + : null, + ); + } + + /// Method to print the User details. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void print() { + debugPrint('authToken: ${this.authToken}'); + debugPrint('refreshToken: ${this.refreshToken}'); + debugPrint('_id: ${this.id}'); + debugPrint('firstName: ${this.firstName}'); + debugPrint('lastName: ${this.lastName}'); + debugPrint('image: ${this.image}'); + debugPrint('email: ${this.email}'); + debugPrint('joinedOrganizations: ${this.joinedOrganizations}'); + debugPrint('adminFor: ${this.adminFor}'); + debugPrint('createdOrganizations: ${this.createdOrganizations}'); + debugPrint('membershipRequests: ${this.membershipRequests}'); + } + + /// HiveField for authToken. + @HiveField(0) + String? authToken; + + /// HiveField for refreshToken. + @HiveField(1) + String? refreshToken; + + /// HiveField for userID. + @HiveField(2) + String? id; + + /// HiveField for user's first name. + @HiveField(3) + String? firstName; + + /// HiveField for user's last name. + @HiveField(4) + String? lastName; + + /// HiveField for user's Email. + @HiveField(5) + String? email; + + /// HiveField for user's avatar. + @HiveField(6) + String? image; + + /// /// HiveField for all organisations joined by user. + @HiveField(7) + List? joinedOrganizations = []; + + /// HiveField for all organisations created by user. + @HiveField(8) + List? createdOrganizations = []; + + /// HiveField for all organisations user is admin of. + @HiveField(9) + List? adminFor = []; + + /// HiveField for all organisations user has sent membership request. + @HiveField(10) + List? membershipRequests = []; + + /// Method to updated joinedOrganisation list. + /// + /// **params**: + /// * `orgList`: List of organsaitions user has joined. + /// + /// **returns**: + /// None + void updateJoinedOrg(List orgList) { + this.joinedOrganizations = orgList; + } + + /// Method to updated createdOrganisation list. + /// + /// **params**: + /// * `orgList`: List of organsaitions user has created. + /// + /// **returns**: + /// None + void updateCreatedOrg(List orgList) { + this.createdOrganizations = orgList; + } + + /// Method to update membershipRequests List. + /// + /// **params**: + /// * `orgList`: List of organisations user have sent membership request. + /// + /// **returns**: + /// None + void updateMemberRequestOrg(List orgList) { + this.membershipRequests = [...membershipRequests!, ...orgList]; + } + + /// Method to update adminFor List. + /// + /// **params**: + /// * `orgList`: List of organisations user is admin of. + /// + /// **returns**: + /// None + void updateAdminFor(List orgList) { + this.adminFor = orgList; + } + + /// Method to update the user details. + /// + /// **params**: + /// * `details`: updated user Info/details + /// + /// **returns**: + /// None + void update(User details) { + this.firstName = details.firstName; + this.lastName = details.lastName; + this.email = details.email; + this.image = details.image; + this.authToken = details.authToken; + this.refreshToken = details.refreshToken; + this.joinedOrganizations = details.joinedOrganizations; + this.createdOrganizations = details.createdOrganizations; + this.membershipRequests = details.membershipRequests; + this.adminFor = details.adminFor; + } +} diff --git a/lib/models/user/user_info.g.dart b/lib/models/user/user_info.g.dart new file mode 100644 index 000000000..3b89a5ff1 --- /dev/null +++ b/lib/models/user/user_info.g.dart @@ -0,0 +1,71 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_info.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class UserAdapter extends TypeAdapter { + @override + final int typeId = 1; + + @override + User read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return User( + adminFor: (fields[9] as List?)?.cast(), + createdOrganizations: (fields[8] as List?)?.cast(), + email: fields[5] as String?, + firstName: fields[3] as String?, + id: fields[2] as String?, + image: fields[6] as String?, + joinedOrganizations: (fields[7] as List?)?.cast(), + lastName: fields[4] as String?, + authToken: fields[0] as String?, + refreshToken: fields[1] as String?, + membershipRequests: (fields[10] as List?)?.cast(), + ); + } + + @override + void write(BinaryWriter writer, User obj) { + writer + ..writeByte(11) + ..writeByte(0) + ..write(obj.authToken) + ..writeByte(1) + ..write(obj.refreshToken) + ..writeByte(2) + ..write(obj.id) + ..writeByte(3) + ..write(obj.firstName) + ..writeByte(4) + ..write(obj.lastName) + ..writeByte(5) + ..write(obj.email) + ..writeByte(6) + ..write(obj.image) + ..writeByte(7) + ..write(obj.joinedOrganizations) + ..writeByte(8) + ..write(obj.createdOrganizations) + ..writeByte(9) + ..write(obj.adminFor) + ..writeByte(10) + ..write(obj.membershipRequests); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is UserAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/plugins/fetch_plugin_list.dart b/lib/plugins/fetch_plugin_list.dart new file mode 100644 index 000000000..5513a5e2b --- /dev/null +++ b/lib/plugins/fetch_plugin_list.dart @@ -0,0 +1,32 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/locator.dart'; + +/// This class fetch plugins list. +class FetchPluginList { + /// Constructor of the class. + FetchPluginList() { + fetchList(); + } + + /// late initialize the box. + late Box box; + + /// Fetches plugins from server and stores them in Hive `pluginBox`. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future fetchList() async { + late final GraphQLClient client = graphqlConfig.clientToQuery(); + final QueryResult result = await client.query( + QueryOptions( + document: gql(queries.getPluginsList()), + ), + ); + box = Hive.box('pluginBox'); + box.put('plugins', result.data?["getPlugins"]); + } +} diff --git a/lib/plugins/talawa_plugin_provider.dart b/lib/plugins/talawa_plugin_provider.dart new file mode 100644 index 000000000..528ad4180 --- /dev/null +++ b/lib/plugins/talawa_plugin_provider.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/user_config.dart'; + +/// TalwaPluginProvider provides ability to implement features as plugins. +class TalawaPluginProvider extends StatelessWidget { + const TalawaPluginProvider({ + super.key, + @required this.child, + required this.visible, + required this.pluginName, + }); + + ///child contains the widget for the plugin UI. + final Widget? child; + + ///visible is the property that decides visibility of the UI. + final bool visible; + + ///name of plugin preferred with underscores(_) instead of spaces. + final String pluginName; + + /// This function checks if the plugin is insatlled and therefore determine visibility of the plugin. + /// + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `bool`: define_the_return + bool checkFromPluginList() { + final UserConfig userConfig = locator(); + final Box box; + bool res = false; + box = Hive.box('pluginBox'); + final List> pluginList = + (box.get('plugins') as List>?) ?? []; + + ///mapping over the list from the server + pluginList.forEach((plugin) { + if (plugin["pluginName"] == pluginName) { + res = plugin["pluginInstallStatus"] as bool || + (plugin["installedOrgs"] as List) + .contains(userConfig.currentOrg.id); + } + }); + return res; + } + + @override + Widget build(BuildContext context) { + var serverVisible = false; + serverVisible = checkFromPluginList(); + return serverVisible || visible ? child! : Container(); + } +} diff --git a/lib/router.dart b/lib/router.dart new file mode 100644 index 000000000..99258f45d --- /dev/null +++ b/lib/router.dart @@ -0,0 +1,340 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/main.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/splash_screen.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'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/views/after_auth_screens/add_post_page.dart'; +import 'package:talawa/views/after_auth_screens/app_settings/app_settings_page.dart'; +import 'package:talawa/views/after_auth_screens/chat/chat_message_screen.dart'; +import 'package:talawa/views/after_auth_screens/chat/select_contact.dart'; +import 'package:talawa/views/after_auth_screens/events/create_custom_recurring_event.dart'; +import 'package:talawa/views/after_auth_screens/events/create_event_page.dart'; +import 'package:talawa/views/after_auth_screens/events/edit_event_page.dart'; +import 'package:talawa/views/after_auth_screens/events/event_calendar.dart'; +import 'package:talawa/views/after_auth_screens/events/event_info_page.dart'; +import 'package:talawa/views/after_auth_screens/events/explore_events.dart'; +import 'package:talawa/views/after_auth_screens/events/manage_volunteer_group.dart'; +import 'package:talawa/views/after_auth_screens/events/volunteer_groups_screen.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/feed/pinned_post_screen.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/org_info_screen.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/demo_screens/explore_events_demo.dart'; +import 'package:talawa/views/demo_screens/organization_feed_demo.dart'; +import 'package:talawa/views/demo_screens/profile_page_demo.dart'; +import 'package:talawa/views/main_screen.dart'; +import 'package:talawa/views/pre_auth_screens/change_password.dart'; +import 'package:talawa/views/pre_auth_screens/login.dart'; +import 'package:talawa/views/pre_auth_screens/recover.dart'; +import 'package:talawa/views/pre_auth_screens/select_language.dart'; +import 'package:talawa/views/pre_auth_screens/select_organization.dart'; +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_screen.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 +/// 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. + // We use the name to determine which view to return. + switch (settings.name) { + // Returns the SplashScreen + case Routes.splashScreen: + final int mainScreenIndex = settings.arguments! as int; + return MaterialPageRoute( + builder: (context) => SplashScreen( + key: const Key('SplashScreen'), + mainScreenIndex: mainScreenIndex, + ), + ); + + // Returns the SelectLanguage Widget + case Routes.languageSelectionRoute: + return MaterialPageRoute( + builder: (context) => const SelectLanguage(key: Key('SelectLanguage')), + ); + + // Returns the SetUrl Widget + case Routes.setUrlScreen: + final String uri = settings.arguments!.toString(); + return MaterialPageRoute( + builder: (context) => SetUrl( + key: const Key('SetUrl'), + uri: uri, + ), + ); + + // Returns the Login Widget + case Routes.loginScreen: + return MaterialPageRoute( + builder: (context) => const Login(key: Key('Login')), + ); + + // Returns the SelectOrganization Widget + case Routes.selectOrgScreen: + final String id = settings.arguments!.toString(); + return CupertinoPageRoute( + builder: (context) => SelectOrganization( + key: const Key('Signup'), + selectedOrgId: id, + ), + ); + + // Returns the SignUpDetails Widget + case Routes.signupDetailScreen: + final OrgInfo org = settings.arguments! as OrgInfo; + return CupertinoPageRoute( + builder: (context) => SignUpDetails( + key: const Key('Signup'), + selectedOrg: org, + ), + ); + + // Returns the WaitingPge Widget + case Routes.waitingScreen: + return CupertinoPageRoute( + builder: (context) => const WaitingPage(key: Key('Waiting')), + ); + + // Returns the Recover Widget + case Routes.recoverScreen: + return MaterialPageRoute( + builder: (context) => const Recover(key: Key('Recover')), + ); + + // Returns the ChangePass Widget + case Routes.updateScreen: + return MaterialPageRoute( + builder: (context) => const ChangePass(key: Key('Update')), + ); + + // Returns the OrganizationFeed Widget + case Routes.homeScreen: + return MaterialPageRoute( + builder: (context) => const OrganizationFeed(key: Key('HomeScreen')), + ); + + // Returns the DemoOrganizationFeed Widget + case Routes.demoHomeScreen: + return MaterialPageRoute( + builder: (context) => + const DemoOrganizationFeed(key: Key('DemoHomeScreen')), + ); + + // Returns the MainScreen Widget + case Routes.mainScreen: + final MainScreenArgs mainScreenArgs = + settings.arguments! as MainScreenArgs; + // final bool fromSignUp = settings.arguments! as bool; + return MaterialPageRoute( + builder: (context) => MainScreen( + key: const Key('MainScreen'), + mainScreenArgs: mainScreenArgs, + ), + ); + + // Returns the IndividualPostView Widget + case Routes.individualPost: + final Post post = settings.arguments! as Post; + return MaterialPageRoute( + builder: (context) => IndividualPostView( + key: const Key('IndividualPost'), + post: post, + ), + ); + + // Returns the PinnedPostPgae Widget + case Routes.pinnedPostPage: + final List pinnedPosts = settings.arguments! as List; + return MaterialPageRoute( + builder: (context) => PinnedPostPage(pinnedPosts: pinnedPosts), + ); + + // Returns the ExploreEvents Widget + case Routes.exploreEventsScreen: + return MaterialPageRoute( + builder: (context) => const ExploreEvents(key: Key('ExploreEvents')), + ); + + // Returns the DemoExploreEvents Widget + case Routes.demoExploreEventsScreen: + return MaterialPageRoute( + builder: (context) => + const DemoExploreEvents(key: Key('DemoExploreEvents')), + ); + + // Returns the EventInfoPage Widget + case Routes.eventInfoPage: + final Map args = + settings.arguments! as Map; + return MaterialPageRoute( + builder: (context) => EventInfoPage( + key: const Key('EventInfo'), + args: args, + ), + ); + + // Returns the CreateEventPage Widget + case Routes.createEventPage: + return MaterialPageRoute( + builder: (context) => const CreateEventPage(key: Key('CreateEvent')), + ); + + // Returns the CreateEventPage Widget + case Routes.customRecurrencePage: + final model = settings.arguments! as CreateEventViewModel; + return MaterialPageRoute( + builder: (context) => CustomRecurrencePage( + key: const Key('CreateEvent'), + model: model, + ), + ); + + // Returns the ProfilePage Widget + case Routes.profilePage: + return MaterialPageRoute( + builder: (context) => const ProfilePage(key: Key('Profile')), + ); + + // Return the DemoProfilePage Widget + case Routes.demoProfilePage: + return MaterialPageRoute( + builder: (context) => const DemoProfilePage(key: Key('DemoProfile')), + ); + + // Returns the EditProfilePage Widget + case Routes.editProfilePage: + return MaterialPageRoute( + builder: (context) => const EditProfilePage(key: Key('EditProfile')), + ); + + // Returns the JoinOrganizationAfterAuth Widget + case Routes.joinOrg: + final String id = settings.arguments!.toString(); + return MaterialPageRoute( + builder: (context) => JoinOrganisationAfterAuth( + key: const Key('JoinOrganisationAfterAuth'), + orgId: id, + ), + ); + + 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; + return MaterialPageRoute( + builder: (context) => EditEventPage( + key: const Key('EditEvent'), + event: event, + ), + ); + case Routes.pinnedPostScreen: + // final Map post = settings.arguments! as Map ; + final Map post = + settings.arguments! as Map; + + return MaterialPageRoute( + builder: (context) => PinnedPostScreen(post: post), + ); + // Returns the AppSettingsPage Widget + case Routes.appSettings: + return MaterialPageRoute( + builder: (context) => const AppSettingsPage(key: Key('AppSettings')), + ); + + // Returns the ChatMessageScreen Widget + case Routes.chatMessageScreen: + final List arguments = settings.arguments! as List; + final String chatId = arguments[0] as String; + final DirectChatViewModel model = arguments[1] as DirectChatViewModel; + return MaterialPageRoute( + builder: (context) => ChatMessageScreen( + key: const Key('ChatMessageScreen'), + chatId: chatId, + model: model, + ), + ); + + case Routes.calendar: + return MaterialPageRoute( + builder: (context) => EventCalendar( + settings.arguments! as List, + key: const Key('Calendar'), + ), + ); + + case Routes.selectContact: + return MaterialPageRoute( + builder: (context) => const SelectContact(key: Key('selectContact')), + ); + + case Routes.addPostScreen: + return MaterialPageRoute( + builder: (context) => const AddPost( + key: Key('AddPostPage'), + ), + ); + + case Routes.orgInfoScreen: + final OrgInfo orgInfo = settings.arguments! as OrgInfo; + return MaterialPageRoute( + builder: (context) => OrganisationInfoScreen( + orgInfo: orgInfo, + key: const Key('orginfoscreen'), + ), + ); + + case Routes.volunteerGroupScreen: + final List arguments = settings.arguments! as List; + final Event event = arguments[0] as Event; + final EventInfoViewModel model = arguments[1] as EventInfoViewModel; + return MaterialPageRoute( + builder: (context) => VolunteerGroupsScreen(event: event, model: model), + ); + + case Routes.manageVolunteerGroup: + final List arguments = settings.arguments! as List; + final Event event = arguments[0] as Event; + final EventVolunteerGroup group = arguments[1] as EventVolunteerGroup; + return MaterialPageRoute( + builder: (context) => ManageGroupScreen(group: group, event: event), + ); + + default: + return MaterialPageRoute( + builder: (context) => const DemoPageView( + key: Key("DemoPage"), + ), + ); + } +} diff --git a/lib/services/api_.dart b/lib/services/api_.dart deleted file mode 100644 index f8efd3138..000000000 --- a/lib/services/api_.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'dart:convert'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/model/switch_org.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; - -class API { - final Queries _query = Queries(); - final GraphQLConfiguration _graphQLConfiguration = GraphQLConfiguration(); - final Preferences _pref = Preferences(); - - Future> fetchUserDetails() async { - List joinedOrgs; - final String userID = await _pref.getUserId(); - final GraphQLClient _client = _graphQLConfiguration.clientToQuery(); - - final QueryResult result = await _client.query(QueryOptions( - documentNode: gql(_query.fetchUserInfo), variables: {'id': userID})); - - if (result.hasException) { - print(result.exception); - } else if (!result.hasException && !result.loading) { - print(result.data); - joinedOrgs = (json.decode( - result.data['users'][0]['joinedOrganizations'].toString()) - as List) - .map((joinedOrgs) => - SwitchOrg.fromJson(joinedOrgs as Map)) - .toList(); - print(joinedOrgs); - } - - return joinedOrgs; - } -} diff --git a/lib/services/caching/base_feed_manager.dart b/lib/services/caching/base_feed_manager.dart new file mode 100644 index 000000000..e329de467 --- /dev/null +++ b/lib/services/caching/base_feed_manager.dart @@ -0,0 +1,104 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +/// An abstract base class for managing a feed of type [T] with caching and online data fetching capabilities. +/// +/// This class provides methods for initializing a cache, loading cached data, saving data to cache, +/// and fetching new data from an API. It also handles automatic cache refreshing when online. +/// +/// **params**: +/// * `cacheKey`: A unique key for identifying the cache box in Hive. +/// +/// **methods**: +/// * `loadCachedData`: Loads the data cached in Hive for the specified [cacheKey]. +/// * `saveDataToCache`: Saves a list of data to the cache, clearing any existing data in the process. +/// * `fetchDataFromApi`: Abstract method to be implemented by subclasses for fetching data from an API. +/// * `getNewFeedAndRefreshCache`: Fetches new data from the API if online, updates the cache, and returns the data. +/// If offline, it loads and returns cached data. +abstract class BaseFeedManager { + BaseFeedManager(this.cacheKey) { + _initialize(); + } + + /// feed cacheBox key. + final String cacheKey; + + /// feed cache box. + late Box _box; + + /// Initializes the Hive box associated with the [cacheKey]. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future _initialize() async { + _box = Hive.box(cacheKey); + } + + /// Loads the data cached in Hive. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future>`: A Future containing a list of cached data. + Future> loadCachedData() async { + final data = _box.values.toList(); + return data; + } + + /// Saves a list of data to the cache, replacing any existing data. + /// + /// **params**: + /// * `data`: The list of data to be saved to the cache. + /// + /// **returns**: + /// None + Future saveDataToCache(List data) async { + debugPrint('saveToCache1'); + await _box.clear(); + debugPrint(_box.values.length.toString()); + debugPrint('saveToCache2'); + await _box.addAll(data); + debugPrint('saveToCache'); + debugPrint(_box.values.length.toString()); + debugPrint(_box.values.length.toString()); + } + + /// Abstract method to be implemented by subclasses to fetch data from an API. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future>`: A Future containing a list of data fetched from the API. + Future> fetchDataFromApi(); + + /// Fetches new data from the API if online, updates the cache, and returns the data. + /// + /// If offline, loads and returns cached data. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future>`: A Future containing a list of the latest data. + Future> getNewFeedAndRefreshCache() async { + if (AppConnectivity.isOnline) { + try { + final data = await fetchDataFromApi(); + await saveDataToCache(data); + return data; + } catch (e) { + debugPrint(e.toString()); + return loadCachedData(); + } + } else { + return loadCachedData(); + } + } +} diff --git a/lib/services/caching/cache_service.dart b/lib/services/caching/cache_service.dart new file mode 100644 index 000000000..e0d44df68 --- /dev/null +++ b/lib/services/caching/cache_service.dart @@ -0,0 +1,76 @@ +/// This class provides functionalities for caching GraphQL operations. +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/caching/cached_user_action.dart'; +import 'package:talawa/services/caching/offline_action_queue.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +/// Service to handle caching routines. +class CacheService { + /// Initializes the cache service and the offline action queue. + CacheService() { + offlineActionQueue = OfflineActionQueue(); + } + + /// Duration for which cached operations are considered valid. + final Duration _timeToLive = const Duration(hours: 24); + + /// Queue for storing user actions to be executed offline. + late final OfflineActionQueue offlineActionQueue; + + /// static graphql result when device is offline. + static final QueryResult offlineResult = QueryResult( + options: QueryOptions( + document: gql(PostQueries().addLike()), + ), + data: { + 'cached': true, + }, + source: QueryResultSource.cache, + ); + + /// Executes a GraphQL operation or caches it for offline execution. + /// + /// This function checks internet connectivity. If online, it executes the + /// provided `whenOnline` function and returns the result. If offline, it creates + /// a `CachedUserAction` object representing the operation and stores it + /// in the `offlineActionQueue`. It then returns null. + /// + /// **params**: + /// * `operation`: The GraphQL operation string. + /// * `variables`: Optional variables for the operation (Map). + /// * `operationType`: The type of the GraphQL operation (from `CachedOperationType` enum). + /// * `whenOnline`: A function that executes the operation online and returns the result (Future?>). + /// + /// **returns**: + /// * `Future>`: Returns the result of the operation. + Future> executeOrCacheOperation({ + required String operation, + Map? variables, + required CachedOperationType operationType, + required Future> Function() whenOnline, + }) async { + if (AppConnectivity.isOnline) { + final result = await whenOnline(); + return result; + } else { + // Create a CachedUserAction for offline execution + final timeStamp = DateTime.now(); + final expiry = timeStamp.add(_timeToLive); + final cachedAction = CachedUserAction( + id: 'PlaceHolder', // Placeholder for actual ID generation + operation: operation, + variables: variables, + operationType: operationType, + status: CachedUserActionStatus.pending, + timeStamp: timeStamp, + expiry: expiry, + ); + await offlineActionQueue.addAction(cachedAction); + debugPrint('cached'); + return offlineResult; + } + } +} diff --git a/lib/services/caching/offline_action_queue.dart b/lib/services/caching/offline_action_queue.dart new file mode 100644 index 000000000..f5678b5ac --- /dev/null +++ b/lib/services/caching/offline_action_queue.dart @@ -0,0 +1,158 @@ +import 'package:hive/hive.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/models/caching/cached_user_action.dart'; + +/// OfflineActionQueue class manages a queue for offline actions. +/// +/// This class provides the following functionalities: +/// * `initialize` : initializes the queue by registering adapters and opening the queue. +/// * `registerAdapters` : registers the required Hive adapters. +/// * `openQueue` : opens the Hive box for the offline action queue. +/// * `addAction` : adds an action to the queue with a TTL. +/// * `getActions` : retrieves all valid actions from the queue. +/// * `removeAction` : removes a specific action from the queue. +/// * `clearActions` : clears all actions from the queue. +/// * `removeExpiredActions` : removes expired actions from the queue. +class OfflineActionQueue { + OfflineActionQueue() { + initialize(); + } + + ///Offline Action Queue box name. + static const String boxName = HiveKeys.offlineActionQueueKey; + late final Box _actionsBox; + + /// Initializes the queue by registering adapters and opening the queue. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialize() { + openQueue(); + } + + // /// Registers the required Hive adapters. + // /// + // /// **params**: + // /// None + // /// + // /// **returns**: + // /// None + // void registerAdapters() { + + // } + + /// Opens the Hive box for the offline action queue. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void openQueue() { + _actionsBox = Hive.box(boxName); + } + + /// Adds an action to the queue with a TTL. + /// + /// **params**: + /// * `action`: the action to be added. + /// + /// **returns**: + /// * `Future`: returns true if the action was added successfully, otherwise false. + Future addAction(CachedUserAction action) async { + try { + await _actionsBox.put(action.id, action); + return true; + } catch (e) { + // Handle or log the exception + print('Failed to add action: $e'); + return false; + } + } + + /// Retrieves all valid actions from the queue. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `List`: a list of valid actions. + List getActions() { + try { + final now = DateTime.now(); + final validActions = _actionsBox.values + .where((action) => action.expiry.isAfter(now)) + .toList(); + removeExpiredActions(); + return validActions; + } catch (e) { + // Handle or log the exception + print('Failed to get actions: $e'); + return []; + } + } + + /// Removes a specific action from the queue. + /// + /// **params**: + /// * `key`: the key of the action to be removed. + /// + /// **returns**: + /// * `Future`: returns true if the action was removed successfully, otherwise false. + Future removeAction(dynamic key) async { + try { + await _actionsBox.delete(key); + return true; + } catch (e) { + // Handle or log the exception + print('Failed to remove action: $e'); + return false; + } + } + + /// Clears all actions from the queue. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: returns true if all actions were cleared successfully, otherwise false. + Future clearActions() async { + try { + await _actionsBox.clear(); + return true; + } catch (e) { + // Handle or log the exception + print('Failed to clear actions: $e'); + return false; + } + } + + /// Removes expired actions from the queue. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: returns true if expired actions were removed successfully, otherwise false. + Future removeExpiredActions() async { + try { + final now = DateTime.now(); + final expiredKeys = _actionsBox.keys.where((key) { + final CachedUserAction action = _actionsBox.get(key)!; + return action.expiry.isBefore(now); + }).toList(); + for (final key in expiredKeys) { + await _actionsBox.delete(key); + } + return true; + } catch (e) { + // Handle or log the exception + print('Failed to remove expired actions: $e'); + return false; + } + } +} diff --git a/lib/services/chat_service.dart b/lib/services/chat_service.dart new file mode 100644 index 000000000..3881ac8f2 --- /dev/null +++ b/lib/services/chat_service.dart @@ -0,0 +1,144 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/chats/chat_list_tile_data_model.dart'; +import 'package:talawa/models/chats/chat_message.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/chat_queries.dart'; + +/// Provides different services for direct chats of the user. +/// +/// Services include: +/// * `sendMessageToDirectChat` - used to send messages. +/// * `getDirectChatsByUserId` - used to get all chats by the user. +/// * `getDirectChatMessagesByChatId` - gets all chats of a user with +/// another user. +class ChatService { + ChatService() { + _dbFunctions = locator(); + _chatListStream = _chatController.stream.asBroadcastStream(); + _chatMessagesStream = _chatMessageController.stream.asBroadcastStream(); + } + + /// Database mutation functions. + late DataBaseMutationFunctions _dbFunctions; + + /// Stream for chat list data. + late Stream _chatListStream; + + /// Stream for chat messages. + late Stream _chatMessagesStream; + + /// User configuration instance. + final _userConfig = locator(); + + /// Stream for GraphQL query results. + late Stream chatStream; + + /// Controller for chat list stream. + final StreamController _chatController = + StreamController(); + + /// Controller for chat messages stream. + final StreamController _chatMessageController = + StreamController(); + + /// Getter for chat list stream. + Stream get chatListStream => _chatListStream; + + /// Getter for chat messages stream. + Stream get chatMessagesStream => _chatMessagesStream; + + // Stream getMessagesFromDirectChat() async* { + // final operation = SubscriptionOptions( + // document: gql(ChatQueries().messageSentToDirectChatsubscription), + // operationName: 'messageSentToDirectChat'); + // chatStream = graphqlConfig.clientToQuery().subscribe(operation); + + // _cha + // } + + /// Sends a message to a direct chat. + /// + /// **params**: + /// * `chatId`: The ID of the chat where the message will be sent. + /// * `messageContent`: The content of the message to be sent. + /// + /// **returns**: + /// None + Future sendMessageToDirectChat( + String chatId, + String messageContent, + ) async { + // trigger graphQL mutation to push the message in the Database. + final result = await _dbFunctions.gqlAuthMutation( + ChatQueries().sendMessageToDirectChat(), + variables: {"chatId": chatId, "messageContent": messageContent}, + ); + + final message = ChatMessage.fromJson( + result.data?['sendMessageToDirectChat'] as Map, + ); + + _chatMessageController.add(message); + + debugPrint(result.data.toString()); + } + + /// Retrieves direct chats by user ID. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future getDirectChatsByUserId() async { + final userId = _userConfig.currentUser.id; + + // trigger graphQL query to get all the chats + // of the user using [userId]. + final String query = ChatQueries().fetchDirectChatsByUserId(userId!); + + final result = await _dbFunctions.gqlAuthQuery(query); + + final directMessageList = result.data?['directChatsByUserID'] as List; + + // loop through the result [directMessageList] + // and append the element to the directChat. + directMessageList.forEach((chat) { + final directChat = + ChatListTileDataModel.fromJson(chat as Map); + + directChat.users!.forEach((element) { + if (element.id != userId) _chatController.add(directChat); + }); + }); + } + + /// This function retrieves direct chat messages by chat ID. + /// + /// **params**: + /// * `chatId`: The ID of the chat for which messages + /// are to be retrieved. + /// + /// **returns**: + /// None + Future getDirectChatMessagesByChatId(chatId) async { + // trigger graphQL query to get all the chat messages + // of a particular chat using [chatId]. + final String query = + ChatQueries().fetchDirectChatMessagesByChatId(chatId as String); + + final result = await _dbFunctions.gqlAuthQuery(query); + + final messages = result.data?['directChatsMessagesByChatID'] as List; + + messages.forEach((message) { + final chatMessage = ChatMessage.fromJson(message as Map); + _chatMessageController.add(chatMessage); + }); + } +} diff --git a/lib/services/comment.dart b/lib/services/comment.dart deleted file mode 100644 index b42b7a572..000000000 --- a/lib/services/comment.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:talawa/model/comment.dart'; - -class CommentHandler with ChangeNotifier { - final List _comments = []; - - ///Returns the comment to a given post - String comment(String postId) { - final CommentModel comment = - _comments.firstWhere((element) => element.postId == postId, orElse: () { - return CommentModel("", ""); - }); - - return comment.comment; - } - - ///Store entry of a given comment on post - void commentEntry(String postId, String comment) { - final int index = - _comments.indexWhere((element) => element.postId == postId); - - if (index == -1) { - _comments.add(CommentModel(postId, comment)); - } else { - _comments[index] = CommentModel(postId, comment); - } - } - - ///Store entry of a given comment on post - void commentCompleted(String postId, String comment) { - final int index = - _comments.indexWhere((element) => element.postId == postId); - if (index != -1) { - _comments.add(CommentModel(postId, comment)); - _comments.removeAt(index); - notifyListeners(); - } - } -} diff --git a/lib/services/comment_service.dart b/lib/services/comment_service.dart new file mode 100644 index 000000000..96b31958c --- /dev/null +++ b/lib/services/comment_service.dart @@ -0,0 +1,78 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/utils/comment_queries.dart'; + +/// CommentService class have different member functions which provides service in the context of commenting. +/// +/// Services include: +/// * `createComments` - used to add comment on the post. +/// * `getCommentsForPost` - used to get all comments on the post. +class CommentService { + CommentService() { + _dbFunctions = locator(); + _navigationService = locator(); + } + late DataBaseMutationFunctions _dbFunctions; + late NavigationService _navigationService; + + /// This function is used to add comment on the post. + /// + /// To verify things are working, check out the native platform logs. + /// **params**: + /// * `postId`: The post id on which comment is to be added. + /// * `text`: The comment text. + /// + /// **returns**: + /// None + Future createComments(String postId, String text) async { + final String createCommentQuery = CommentQueries().createComment(); + + try { + await _dbFunctions.gqlAuthMutation( + createCommentQuery, + variables: { + 'postId': postId, //Add your variables here + 'text': text, + }, + ); + + _navigationService.showTalawaErrorSnackBar( + "Comment sent", + MessageType.info, + ); + } on Exception catch (_) { + _navigationService.showTalawaErrorSnackBar( + "Something went wrong", + MessageType.error, + ); + } + } + + /// This function is used to get all comments on the post. + /// + /// To verify things are working, check out the native platform logs. + /// **params**: + /// * `postId`: The post id for which comments are to be fetched. + /// + /// **returns**: + /// * `Future>`: promise that will be fulfilled with list of comments. + /// + Future> getCommentsForPost(String postId) async { + final String getCommmentQuery = CommentQueries().getPostsComments(postId); + + final QueryResult result = + await _dbFunctions.gqlAuthMutation(getCommmentQuery); + + if (result.data == null) { + return []; + } + final resultData = result.data; + + final resultDataPostComments = (resultData?['post'] + as Map)['comments'] as List; + return resultDataPostComments; + } +} diff --git a/lib/services/database_mutation_functions.dart b/lib/services/database_mutation_functions.dart new file mode 100644 index 000000000..583a523b0 --- /dev/null +++ b/lib/services/database_mutation_functions.dart @@ -0,0 +1,315 @@ +import 'dart:async'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/exceptions/graphql_exception_resolver.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/utils/queries.dart'; +import 'package:talawa/utils/time_conversion.dart'; + +/// DataBaseMutationFunctions class provides different services that are under the context of graphQL mutations and queries. +/// +/// Services include: +/// * `encounteredExceptionOrError` +/// * `gqlAuthQuery` +/// * `gqlAuthMutation` +/// * `gqlNonAuthMutation` +/// * `gqlNonAuthQuery` +/// * `refreshAccessToken` +/// * `fetchOrgById` +class DataBaseMutationFunctions { + /// Client Auth for handling non-authenticated request. + late GraphQLClient clientNonAuth; + + /// Client Auth for handling authenticated request. + late GraphQLClient clientAuth; + + /// Query passed by fucntion calling this function. + late Queries _query; + + /// Initialization function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void init() { + clientNonAuth = graphqlConfig.clientToQuery(); + clientAuth = graphqlConfig.authClient(); + _query = Queries(); + } + + /// Initializes [clientNonAuth] function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initClientNonAuth() { + graphqlConfig.getOrgUrl(); + clientNonAuth = graphqlConfig.clientToQuery(); + _query = Queries(); + } + + /// when result has no data and null. + QueryResult noData = QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: null, + source: QueryResultSource.network, + ); + + /// This function is used to run the graph-ql query for authentication. + /// + /// **params**: + /// * `query`: query is used to fetch data in graphql, for more info read graphql docs + /// * `variables`: variables to be passed with query + /// + /// **returns**: + /// * `Future>`: it returns Future of dynamic + Future> gqlAuthQuery( + String query, { + Map? variables, + }) async { + final QueryOptions options = QueryOptions( + document: gql(query), + variables: variables ?? {}, + fetchPolicy: FetchPolicy.networkOnly, + ); + final response = await cacheService.executeOrCacheOperation( + operation: query, + variables: variables, + operationType: CachedOperationType.gqlAuthQuery, + whenOnline: () async { + final QueryResult result = await clientAuth.query(options); + // if there is an error or exception in [result] + if (result.hasException) { + final exception = + GraphqlExceptionResolver.encounteredExceptionOrError( + result.exception!, + ); + if (exception!) { + return await gqlAuthQuery(query, variables: variables); + } + } else if (result.data != null && result.isConcrete) { + // coverage:ignore-start + traverseAndConvertDates( + result.data ?? {}, + convertUTCToLocal, + splitDateTimeLocal, + ); + // coverage:ignore-end + return result; + } + return noData; + }, + ); + return response; + } + + /// This function is used to run the graph-ql mutation for authenticated user. + /// + /// **params**: + /// * `mutation`: mutation is used to change/add/delete data in graphql, for more info read graphql docs + /// * `variables`: variables to be passed with mutation + /// + /// **returns**: + /// * `Future>`: it returns Future of dynamic + Future> gqlAuthMutation( + String mutation, { + Map? variables, + }) async { + // coverage:ignore-start + if (variables != null) { + traverseAndConvertDates(variables, convertLocalToUTC, splitDateTimeUTC); + } + // coverage:ignore-end + final MutationOptions options = MutationOptions( + document: gql(mutation), + variables: variables ?? {}, + ); + final response = await cacheService.executeOrCacheOperation( + operation: mutation, + variables: variables, + operationType: CachedOperationType.gqlAuthMutation, + whenOnline: () async { + final QueryResult result = await clientAuth.mutate(options); + print(result); + // If there is an error or exception in [result] + if (result.hasException) { + GraphqlExceptionResolver.encounteredExceptionOrError( + result.exception!, + ); + } else if (result.data != null && result.isConcrete) { + return result; + } + return noData; + }, + ); + return response; + } + + /// This function is used to run the graph-ql mutation to authenticate the non signed-in user. + /// + /// + /// **params**: + /// * `mutation`: mutation is used to change/add/delete data in graphql, for more info read graphql docs + /// * `variables`: variables to be passed with mutation + /// * `reCall`: when not first fetch call + /// + /// **returns**: + /// * `Future>`: it returns Future of dynamic + Future> gqlNonAuthMutation( + String mutation, { + Map? variables, + bool reCall = true, + }) async { + // coverage:ignore-start + if (variables != null) { + traverseAndConvertDates(variables, convertLocalToUTC, splitDateTimeUTC); + } + // coverage:ignore-end + final MutationOptions options = MutationOptions( + document: gql(mutation), + variables: variables ?? {}, + ); + final response = await cacheService.executeOrCacheOperation( + operation: mutation, + variables: variables, + operationType: CachedOperationType.gqlNonAuthMutation, + whenOnline: () async { + final QueryResult result = await clientNonAuth.mutate(options); + // if there is an error or exception in [result] + if (result.hasException) { + GraphqlExceptionResolver.encounteredExceptionOrError( + result.exception!, + ); + } else if (result.data != null && result.isConcrete) { + return result; + } + return noData; + }, + ); + return response; + } + + /// This function is used to run the graph-ql query for the non signed-in user. + /// + /// **params**: + /// * `query`: query is used to fetch data in graphql, for more info read graphql docs + /// * `variables`: variables to be passed with query + /// + /// **returns**: + /// * `Future>`: it returns Future of QueryResult, contains all data + Future> gqlNonAuthQuery( + String query, { + Map? variables, + }) async { + final queryOptions = QueryOptions( + document: gql(query), + variables: variables ?? {}, + ); + final response = await cacheService.executeOrCacheOperation( + operation: query, + variables: variables, + operationType: CachedOperationType.gqlAuthQuery, + whenOnline: () async { + final result = await clientNonAuth.query(queryOptions); + // if there is an error or exception in [result] + if (result.hasException) { + GraphqlExceptionResolver.encounteredExceptionOrError( + result.exception!, + ); + } else if (result.data != null && result.isConcrete) { + // coverage:ignore-start + traverseAndConvertDates( + result.data ?? {}, + convertUTCToLocal, + splitDateTimeLocal, + ); + // coverage:ignore-end + return result; + } + return noData; + }, + ); + return response; + } + + /// This function is used to refresh the Authenication token to access the application. + /// + /// **params**: + /// * `refreshToken`: Needed for authentication + /// + /// **returns**: + /// * `Future`: it returns Future of dynamic + Future refreshAccessToken(String refreshToken) async { + // run the graphQL mutation + final QueryResult result = await clientNonAuth.mutate( + MutationOptions( + document: gql( + _query.refreshToken(refreshToken), + ), + ), + ); + // if there is an error or exception in [result] + if (result.hasException) { + final exception = GraphqlExceptionResolver.encounteredExceptionOrError( + result.exception!, + ); + if (exception!) { + refreshAccessToken(refreshToken); + } else { + navigationService.pop(); + } + } else if (result.data != null && result.isConcrete) { + userConfig.updateAccessToken( + refreshToken: (result.data!['refreshToken'] + as Map)['refreshToken'] + .toString(), + accessToken: (result.data!['refreshToken'] + as Map)['accessToken'] + .toString(), + ); + databaseFunctions.init(); + return true; + } + return false; + } + + /// This function fetch the organization using the [id] passed. + /// + /// **params**: + /// * `id`: id that identifies a particular org + /// + /// **returns**: + /// * `Future`: it returns Future of dynamic + Future fetchOrgById(String id) async { + print(id); + print(id); + final QueryResult result = await clientNonAuth + .mutate(MutationOptions(document: gql(_query.fetchOrgById(id)))); + // if there is an error or exception in [result] + if (result.hasException) { + final exception = GraphqlExceptionResolver.encounteredExceptionOrError( + result.exception!, + ); + if (exception!) { + fetchOrgById(id); + } + } else if (result.data != null && result.isConcrete) { + print(result.data!['organizations']); + return OrgInfo.fromJson( + // ignore: collection_methods_unrelated_type + (result.data!['organizations'] as List>)[0], + ); + } + return false; + } +} diff --git a/lib/services/event_service.dart b/lib/services/event_service.dart new file mode 100644 index 000000000..25de549a0 --- /dev/null +++ b/lib/services/event_service.dart @@ -0,0 +1,417 @@ +import 'dart:async'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/services/caching/base_feed_manager.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/event_queries.dart'; + +/// EventService class provides different services in the context of Event. +/// +/// Services include: +/// * `setOrgStreamSubscription` : to set organization stream subscription for user. +/// * `getEvents` : to get all events of the organization. +/// * `fetchAttendeesByEvent` : to fetch all attendees of an event. +/// * `registerForAnEvent` : to register for an event. +/// * `deleteEvent` : to delete an event. +/// * `editEvent` : to edit the event. +/// * `fetchEventVolunteers` : to fetch all volunteers of an event. +/// * `createVolunteerGroup` : to create a volunteer group. +/// * `addVolunteerToGroup` : to add a volunteer to a group. +/// * `dispose` : to cancel the stream subscription of an organization. +class EventService extends BaseFeedManager { + EventService() : super(HiveKeys.eventFeedKey) { + _eventStream = _eventStreamController.stream.asBroadcastStream(); + print(_eventStream); + _currentOrg = _userConfig.currentOrg; + _userConfig.initialiseStream(); + setOrgStreamSubscription(); + } + + // variables declaration + final _userConfig = locator(); + final _dbFunctions = locator(); + + late OrgInfo _currentOrg; + late StreamSubscription _currentOrganizationStreamSubscription; + late Stream> _eventStream; + + final StreamController> _eventStreamController = + StreamController>(); + + List _events = []; + + /// The event stream. + /// + /// params: + /// None + /// returns: + /// * `Stream`: returns the event stream + Stream> get eventStream => _eventStream; + + @override + Future> fetchDataFromApi() async { + // get current organization id + final String currentOrgID = _currentOrg.id!; + // mutation to fetch the events + final String mutation = EventQueries().fetchOrgEvents(currentOrgID); + final result = await _dbFunctions.gqlAuthQuery(mutation); + + if (result.data == null) { + throw Exception('unable to fetch data'); + } + + final eventsJson = + result.data!["eventsByOrganizationConnection"] as List; + eventsJson.forEach((eventJsonData) { + final Event event = Event.fromJson(eventJsonData as Map); + event.isRegistered = event.attendees?.any( + (attendee) => attendee.id == _userConfig.currentUser.id, + ) ?? + false; + _events.insert(0, event); + }); + return _events; + } + + /// Fetches the initial set of events, loading from the cache first, and then refreshing the feed. + /// + /// This method loads events from the cache, adds them to the event stream, and then triggers a feed refresh + /// to fetch the latest events from the API and update the stream accordingly. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future fetchEventsInitial() async { + _events = await loadCachedData(); + _eventStreamController.add(_events); + refreshFeed(); + } + + /// Refreshes the event feed by fetching the latest events from the API and updating the event stream. + /// + /// This method retrieves the latest events using the `getNewFeedAndRefreshCache` method and adds the new events + /// to the event stream. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future refreshFeed() async { + _events = await getNewFeedAndRefreshCache(); + _eventStreamController.add(_events); + } + + /// This function is used to set stream subscription for an organization. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void setOrgStreamSubscription() { + _currentOrganizationStreamSubscription = + _userConfig.currentOrgInfoStream.listen((updatedOrganization) { + _currentOrg = updatedOrganization; + }); + } + + /// This function is used to create an event using a GraphQL mutation. + /// + /// **params**: + /// * `variables`: A map of key-value pairs representing the variables required for the GraphQL mutation. + /// + /// **returns**: + /// * `Future>`: which contains the result of the GraphQL mutation. + Future> createEvent({ + required Map variables, + }) async { + final result = await databaseFunctions.gqlAuthMutation( + EventQueries().addEvent(), + variables: variables, + ); + return result; + } + + /// This function is used to fetch all the events of an organization. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future getEvents() async { + final List newEvents = await getNewFeedAndRefreshCache(); + _eventStreamController.add(newEvents); + } + + /// This function is used to fetch all registrants of an event. + /// + /// **params**: + /// * `eventId`: id of an event. + /// + /// **returns**: + /// * `Future`: Information about event registrants. + Future fetchAttendeesByEvent(String eventId) async { + final result = await _dbFunctions.gqlAuthQuery( + EventQueries().attendeesByEvent(eventId), + ); + return result; + } + + /// This function is used to register user for an event. + /// + /// **params**: + /// * `eventId`: id of an event. + /// + /// **returns**: + /// * `Future`: Information about the event registration. + Future registerForAnEvent(String eventId) async { + final Map variables = {'eventId': eventId}; + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().registerForEvent(), + variables: variables, + ); + return result; + } + + /// This function is used to delete the event. + /// + /// **params**: + /// * `eventId`: id of an event + /// + /// **returns**: + /// * `Future>`: Information about the event deletion + Future> deleteEvent(String eventId) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().deleteEvent(eventId), + ); + return result; + } + + /// This function is used to edit an event. + /// + /// **params**: + /// * `eventId`: id of an event + /// * `variables`: this will be `map` type and contain all the event details need to be update. + /// + /// **returns**: + /// * `Future>`: Information about the event deletion. + Future> editEvent({ + required String eventId, + required Map variables, + }) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().updateEvent(eventId: eventId), + variables: variables, + ); + return result; + } + + /// This function is used to create a volunteer group. + /// + /// **params**: + /// * `variables`: this will be `map` type and contain all the volunteer group details need to be created. + /// + /// **returns**: + /// * `Future`: Information about the created volunteer group. + Future createVolunteerGroup(Map variables) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().createVolunteerGroup(), + variables: {'data': variables}, + ); + return result; + } + + /// This function is used to remove a volunteer group. + /// + /// **params**: + /// * `variables`: This will be a `map` type and contain the ID of the volunteer group to be deleted. + /// + /// **returns**: + /// * `Future`: Information about the removed volunteer group. + Future removeVolunteerGroup(Map variables) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().removeEventVolunteerGroup(), + variables: variables, + ); + return result; + } + + /// This function is used to add a volunteer to a group. + /// + /// **params**: + /// * `variables`: this will be `map` type and contain all the details needed to add a volunteer to a group. + /// + /// **returns**: + /// * `Future`: Information about the added volunteer. + Future addVolunteerToGroup(Map variables) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().addVolunteerToGroup(), + variables: {'data': variables}, + ); + return result; + } + + /// This function is used to remove a volunteer from a group. + /// + /// **params**: + /// * `variables`: this will be `map` type and contain the ID of the volunteer to be removed. + /// + /// **returns**: + /// * `Future`: Information about the removed volunteer. + Future removeVolunteerFromGroup( + Map variables, + ) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().removeVolunteerMutation(), + variables: variables, + ); + return result; + } + + /// This function is used to update the information of a volunteer group. + /// + /// **params**: + /// * `variables`: This is a `Map` type that contains the ID of the volunteer group to be updated and the fields to be updated. + /// + /// **returns**: + /// * `Future`: Information about the updated volunteer group. + Future updateVolunteerGroup(Map variables) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().updateVolunteerGroupMutation(), + variables: variables, + ); + return result; + } + + /// This function is used to fetch all volunteer groups for an event. + /// + /// **params**: + /// * `eventId`: Id of the event to fetch volunteer groups. + /// + /// **returns**: + /// * `Future>`: returns the list of volunteer groups + Future> fetchVolunteerGroupsByEvent( + String eventId, + ) async { + try { + final variables = { + "where": {"eventId": eventId}, + }; + final result = await _dbFunctions.gqlAuthQuery( + EventQueries().fetchVolunteerGroups(), + variables: variables, + ); + final List groupsJson = result.data!['getEventVolunteerGroups'] as List; + + return groupsJson + .map( + (groupJson) => + EventVolunteerGroup.fromJson(groupJson as Map), + ) + .toList(); + } catch (e) { + print('Error fetching volunteer groups: $e'); + rethrow; + } + } + + /// This function is used to create an agenda item. + /// + /// **params**: + /// * `orgId`: ID of organisation to fetch categories. + /// + /// **returns**: + /// * `Future`: Information about the created agenda item. + Future fetchAgendaCategories(String orgId) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().fetchAgendaItemCategoriesByOrganization(orgId), + ); + return result; + } + + /// This function is used to create an agenda item. + /// + /// **params**: + /// * `variables`: A map of key-value pairs representing the variables required for the GraphQL mutation. + /// + /// **returns**: + /// * `Future`: Information about the created agenda item. + Future createAgendaItem(Map variables) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().createAgendaItem(), + variables: {'input': variables}, + ); + return result; + } + + /// This function is used to delete an agenda item. + /// + /// **params**: + /// * `variables`: A map of key-value pairs representing the variables required for the GraphQL mutation. + /// + /// **returns**: + /// * `Future`: Information about the deleted agenda item. + Future deleteAgendaItem(Map variables) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().deleteAgendaItem(), + variables: variables, + ); + return result; + } + + /// This function is used to update an agenda item. + /// + /// **params**: + /// * `itemId`: Id of agenda item which is to be updated + /// * `variables`: A map of key-value pairs representing the variables required for the GraphQL mutation. + /// + /// **returns**: + /// * `Future`: Information about the updated agenda item. + Future updateAgendaItem( + String itemId, + Map variables, + ) async { + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().updateAgendaItem(), + variables: { + 'updateAgendaItemId': itemId, + 'input': variables, + }, + ); + return result; + } + + /// This function is used to fetch all agenda items for a specific organization. + /// + /// **params**: + /// * `eventId`: ID of the event to fetch agenda items. + /// + /// **returns**: + /// * `Future`: A list of agenda items for the specified organization. + Future fetchAgendaItems(String eventId) async { + final result = await _dbFunctions.gqlAuthQuery( + EventQueries().fetchAgendaItemsByEvent(eventId), + ); + return result; + } + + /// This function is used to cancel the stream subscription of an organization. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void dispose() { + _currentOrganizationStreamSubscription.cancel(); + } +} diff --git a/lib/services/graphql_config.dart b/lib/services/graphql_config.dart new file mode 100644 index 000000000..374485d08 --- /dev/null +++ b/lib/services/graphql_config.dart @@ -0,0 +1,82 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:hive/hive.dart'; +import 'package:http/http.dart' as http; +import 'package:mockito/mockito.dart'; +import 'package:talawa/locator.dart'; + +/// GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. +/// Talawa uses graphQL for the integrating with the API's. +/// You can go through talawa-api, [here](https://github.com/PalisadoesFoundation/talawa-api). +/// GraphqlConfig class provides service to configure graph ql API with talawa mobile-app. +class GraphqlConfig { + // variable declaration + static const imageUrlKey = "imageUrl"; + static const urlKey = "url"; + static String? orgURI = ' '; + static String? token; + late HttpLink httpLink; + late WebSocketLink webSocketLink; + +//prefix route for showing images + String? displayImgRoute; + + /// This function is used to get user the access token. + Future getToken() async { + final authToken = userConfig.currentUser.authToken; + token = authToken; + getOrgUrl(); + return true; + } + + /// This function is used to get the organization URL. + void getOrgUrl() { + final box = Hive.box('url'); + final String? url = box.get(urlKey) as String?; + final String? imgUrl = box.get(imageUrlKey) as String?; + orgURI = url ?? ' '; + displayImgRoute = imgUrl ?? ' '; + httpLink = HttpLink(orgURI!); + } + + GraphQLClient clientToQuery() { + //TODO: Implement websocket link from OrgUrl + // final link = Link.split( + // (request) => request.isSubscription, webSocketLink, httpLink); + return GraphQLClient( + cache: GraphQLCache(partialDataPolicy: PartialDataCachePolicy.accept), + link: httpLink, + ); + } + + GraphQLClient authClient() { + final AuthLink authLink = AuthLink(getToken: () async => 'Bearer $token'); + final Link finalAuthLink = authLink.concat(httpLink); + return GraphQLClient( + cache: GraphQLCache(partialDataPolicy: PartialDataCachePolicy.accept), + link: finalAuthLink, + ); + } + + void test() { + httpLink = HttpLink( + 'https://talawa-graphql-api.herokuapp.com/graphql', + httpClient: MockHttpClient(), + ); + } +} + +/// A mock HTTP client designed for use when testing code that uses BaseClient. +class MockHttpClient extends Mock implements http.Client { + @override + Future send(http.BaseRequest? request) => + // ignore: invalid_use_of_visible_for_testing_member + super.noSuchMethod( + Invocation.method(#send, [request]), + returnValue: Future.value( + http.StreamedResponse( + Stream.fromIterable(const [[]]), + 500, + ), + ), + ) as Future; +} diff --git a/lib/services/hive_manager.dart b/lib/services/hive_manager.dart new file mode 100644 index 000000000..01626edb8 --- /dev/null +++ b/lib/services/hive_manager.dart @@ -0,0 +1,161 @@ +import 'dart:io'; + +import 'package:hive/hive.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/asymetric_keys/asymetric_keys.dart'; +import 'package:talawa/models/caching/cached_user_action.dart'; +import 'package:talawa/models/comment/comment_model.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; + +/// A manager class responsible for initializing and tearing down Hive, a local database for Flutter. +/// +/// The `HiveManager` class provides methods to initialize Hive with necessary adapters and open boxes for +/// various models used throughout the application. It also provides a method to close all opened Hive boxes +/// when they are no longer needed. +class HiveManager { + /// Initializes Hive with the specified directory. + /// + /// **params**: + /// * `dir`: A [Directory] object representing the directory where Hive will store its data files. + /// + /// **returns**: + /// None + static Future initializeHive({required Directory dir}) async { + _initHive(dir); + await registerAdapters(); + await _openBoxes(); + } + + /// Initializes Hive with the specified directory path. + /// + /// **params**: + /// * `dir`: A [Directory] object where Hive will store its data files. + /// + /// **returns**: + /// None + static void _initHive(Directory dir) { + Hive.init(dir.path); + } + + /// Registers the [adapter] named adapter. + /// + /// **params**: + /// * `adapter`: Adapter to register. + /// + /// **returns**: + /// None + static Future registerAdapter(TypeAdapter adapter) async { + try { + Hive.registerAdapter(adapter); + } catch (e) { + print('Failed to register Hive adapters: $e'); + } + } + + /// Opens the [boxName] named box. + /// + /// **params**: + /// * `boxName`: Name of the box. + /// + /// **returns**: + /// None + static Future openBox(String boxName) async { + try { + await Hive.openBox(boxName); + } catch (e) { + print('Failed to open box $boxName'); + } + } + + /// Closes the [boxName] named box. + /// + /// **params**: + /// * `boxName`: Name of the box. + /// + /// **returns**: + /// None + static Future closeBox(String boxName) async { + try { + await Hive.box(boxName).close(); + } catch (e) { + print('Failed to close the box $boxName'); + } + } + + /// Registers the necessary Hive adapters for the models used in the application. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + static Future registerAdapters() async { + registerAdapter(UserAdapter()); + registerAdapter(OrgInfoAdapter()); + registerAdapter(AsymetricKeysAdapter()); + registerAdapter(CachedUserActionAdapter()); + registerAdapter(CachedOperationTypeAdapter()); + registerAdapter(CachedUserActionStatusAdapter()); + registerAdapter(PostAdapter()); + registerAdapter(EventAdapter()); + registerAdapter(LikedByAdapter()); + registerAdapter(AttendeeAdapter()); + registerAdapter(CommentAdapter()); + registerAdapter(CommentsAdapter()); + } + + /// Opens the necessary Hive boxes for storing various types of data. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + static Future _openBoxes() async { + await openBox(HiveKeys.userBoxKey); + await openBox(HiveKeys.orgBoxKey); + await openBox(HiveKeys.asymetricKeyBoxKey); + await openBox(HiveKeys.pluginBoxKey); + await openBox(HiveKeys.urlBoxKey); + await openBox(HiveKeys.offlineActionQueueKey); + await openBox(HiveKeys.postFeedKey); + await openBox(HiveKeys.eventFeedKey); + } + + /// Closes all opened Hive boxes and the Hive instance itself. + /// + /// This method ensures that all Hive boxes are properly closed to avoid potential data corruption + /// when the application is terminated or when Hive is no longer needed. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + static Future teardownHive() async { + await _closeBoxes(); + await Hive.close(); + } + + /// Closes all opened Hive boxes. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + static Future _closeBoxes() async { + await closeBox(HiveKeys.userBoxKey); + await closeBox(HiveKeys.orgBoxKey); + await closeBox(HiveKeys.asymetricKeyBoxKey); + await closeBox(HiveKeys.pluginBoxKey); + await closeBox(HiveKeys.urlBoxKey); + await closeBox(HiveKeys.offlineActionQueueKey); + await closeBox(HiveKeys.postFeedKey); + await closeBox(HiveKeys.eventFeedKey); + } +} diff --git a/lib/services/image_service.dart b/lib/services/image_service.dart new file mode 100644 index 000000000..b8a2a1a90 --- /dev/null +++ b/lib/services/image_service.dart @@ -0,0 +1,80 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:image_cropper/image_cropper.dart'; +import 'package:talawa/locator.dart'; + +/// ImageService class provides different functions as service in the context of Images. +/// +/// Services include: +/// * `cropImage` +/// * `convertToBase64` +class ImageService { + /// Global instance of ImageCropper. + final ImageCropper _imageCropper = locator(); + + /// Crops the image selected by the user. + /// + /// **params**: + /// * `imageFile`: the image file to be cropped. + /// + /// **returns**: + /// * `Future`: the image after been cropped. + /// + /// **throws**: + /// - `Exception`: If an error occurs during the image cropping process. + Future cropImage({required File imageFile}) async { + // try, to crop the image and returns a File with cropped image path. + try { + final CroppedFile? croppedImage = await _imageCropper.cropImage( + sourcePath: imageFile.path, + aspectRatioPresets: [ + CropAspectRatioPreset.square, + CropAspectRatioPreset.original, + ], + uiSettings: [ + AndroidUiSettings( + toolbarTitle: 'Crop Image', + toolbarColor: const Color(0xff18191A), + toolbarWidgetColor: Colors.white, + backgroundColor: Colors.black, + cropGridColor: Colors.white, + initAspectRatio: CropAspectRatioPreset.original, + lockAspectRatio: false, + ), + IOSUiSettings( + minimumAspectRatio: 1.0, + ), + ], + ); + + if (croppedImage != null) { + return File(croppedImage.path); + } + } catch (e) { + throw Exception( + "ImageService : $e.", + ); + } + + return null; + } + + /// Converts the image into Base64 format. + /// + /// **params**: + /// * `file`: Image as a File object. + /// + /// **returns**: + /// * `Future`: image in string format + Future convertToBase64(File file) async { + try { + final List bytes = await file.readAsBytes(); + final String base64String = base64Encode(bytes); + return base64String; + } catch (error) { + return ''; + } + } +} diff --git a/lib/services/navigation_service.dart b/lib/services/navigation_service.dart new file mode 100644 index 000000000..c82e033ff --- /dev/null +++ b/lib/services/navigation_service.dart @@ -0,0 +1,244 @@ +import 'package:delightful_toast/delight_toast.dart'; +import 'package:delightful_toast/toast/components/toast_card.dart'; +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/talawa_error_dialog.dart'; +import 'package:talawa/widgets/talawa_error_snackbar.dart'; + +/// NavigationService class provides different functions as service in the context of navigation. +/// +/// Services include: +/// * `pushScreen` +/// * `popAndPushScreen` +/// * `pushReplacementScreen` +/// * `removeAllAndPush` +/// * `showSnackBar` +/// * `pushDialog` +/// * `showTalawaErrorWidget` +/// * `showTalawaErrorDialog` +/// * `pop` +class NavigationService { + /// Key for Navigator State. + GlobalKey navigatorKey = GlobalKey(); + + /// Pushes a Screen. + /// + /// **params**: + /// * `routeName`: Name of the Route + /// * `arguments`: Set of arguments + /// + /// **returns**: + /// * `Future`: resolves if the Screen was succesfully pushed. + Future pushScreen(String routeName, {dynamic arguments}) { + return navigatorKey.currentState! + .pushNamed(routeName, arguments: arguments); + } + + /// This function pop the initial route and push the new route to the navigator. + /// + /// **params**: + /// * `routeName`: Name of the Route + /// * `arguments`: Set of arguments + /// + /// **returns**: + /// * `Future`: resolves if the Screen was succesfully popAndPushed. + Future popAndPushScreen(String routeName, {dynamic arguments}) { + navigatorKey.currentState!.pop(); + return pushScreen(routeName, arguments: arguments); + } + + /// This function push the route and replace the screen. + /// + /// **params**: + /// * `routeName`: Name of the Route + /// * `arguments`: Set of arguments + /// + /// **returns**: + /// * `Future`: resolves if the Screen was succesfully pushedReplacementScreen. + Future pushReplacementScreen(String routeName, {dynamic arguments}) { + return navigatorKey.currentState! + .pushReplacementNamed(routeName, arguments: arguments); + } + + // void fromInviteLink(List routeNames, List arguments) { + // int i = 0; + // removeAllAndPush('/${routeNames[i]}', '/', arguments: arguments[i]); + // for (i = 1; i < routeNames.length; i++) { + // pushScreen('/${routeNames[i]}', arguments: arguments[i]); + // } + // } + + /// This function remove all the routes till the particular route and add new route. + /// + /// **params**: + /// * `routeName`: Name of the Route + /// * `tillRoute`: Route till we want to remove + /// * `arguments`: Set of arguments + /// + /// **returns**: + /// * `Future`: resolves if the Screen was succesfully removeAllAndPushed. + Future removeAllAndPush( + String routeName, + String tillRoute, { + dynamic arguments, + }) { + return navigatorKey.currentState!.pushNamedAndRemoveUntil( + routeName, + ModalRoute.withName(tillRoute), + arguments: arguments, + ); + } + + /// This function remove all the routes till the particular route and add new route. + /// + /// **params**: + /// * `dialog`: Widget to show + /// + /// **returns**: + /// None + void pushDialog(Widget dialog) { + showDialog( + context: navigatorKey.currentContext!, + barrierColor: Colors.transparent, + barrierDismissible: false, + builder: (BuildContext context) { + return dialog; + }, + ); + } + + /// 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), + }) { + ScaffoldMessenger.of(navigatorKey.currentContext!).showSnackBar( + SnackBar( + behavior: SnackBarBehavior.floating, + duration: duration, + content: Text( + AppLocalizations.of(navigatorKey.currentContext!)! + .strictTranslate(message), + ), + ), + ); + } + + /// 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, + ) { + final Duration duration = Duration(milliseconds: errorMessage.length * 80); + ScaffoldMessenger.of(navigatorKey.currentContext!).showSnackBar( + SnackBar( + padding: EdgeInsets.zero, + duration: duration, + content: TalawaErrorSnackBar( + duration: duration, + messageType: messageType, + errorMessage: errorMessage, + ), + backgroundColor: const Color.fromRGBO(65, 65, 66, 1), + ), + ); + } + + /// 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!, + barrierColor: Colors.transparent, + barrierDismissible: false, + builder: (BuildContext context) { + return TalawaErrorDialog( + errorMessage, + messageType: messageType, + ); + }, + ); + } + + /// Shows an Custom Toast. + /// + /// **params**: + /// * `msg`: Message shown in Toast + /// + /// **returns**: + /// None + void showCustomToast(String msg) { + DelightToastBar( + builder: (context) { + return ToastCard( + title: Text( + msg, + style: const TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + leading: const Icon( + Icons.error_outline, + color: Colors.redAccent, + ), + color: Colors.black.withOpacity(0.8), + ); + }, + ).show(navigatorKey.currentContext!); + } + + /// This function pops the current state. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void pop() { + if (navigatorKey.currentState?.canPop() ?? false) { + return navigatorKey.currentState!.pop(); + } + } + + /// This function prints current navigation state. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void printNavigatorState() { + final navigatorState = navigatorKey.currentState; + if (navigatorState != null) { + print('Can pop: ${navigatorState.canPop()}'); + print('Current Route: ${navigatorState.widget}'); + print('Navigator Stack: ${navigatorState.widget}'); + print( + 'Route History: ${navigatorState.widget.pages.map((page) => page.toString()).toList()}', + ); + } + } +} diff --git a/lib/services/org_service.dart b/lib/services/org_service.dart new file mode 100644 index 000000000..d6639731e --- /dev/null +++ b/lib/services/org_service.dart @@ -0,0 +1,42 @@ +import 'package:talawa/locator.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/utils/queries.dart'; + +/// Provides the Services in the context of organizations. +/// +/// Services include: +/// * `getOrgMembersList` : to get all organizations members +class OrganizationService { + // constructor + OrganizationService() { + _dbFunctions = locator(); + } + late DataBaseMutationFunctions _dbFunctions; + + /// Retrieves a list of organization members. + /// + /// **params**: + /// * `orgId`: The ID of the organization to fetch members from. + /// + /// **returns**: + /// * `Future>`: A promise that will be fulfilled + /// with the list of organization members. + Future> getOrgMembersList(String orgId) async { + final String query = Queries().fetchOrgDetailsById(orgId); + // fetching from database using graphQL mutations. + final result = await _dbFunctions.gqlAuthMutation(query); + final organizations = result.data?['organizations'] as List; + final List orgMembersResult = + (organizations[0] as Map)['members'] as List; + final List orgMembersList = []; + orgMembersResult.forEach((jsonElement) { + final User member = + User.fromJson(jsonElement as Map, fromOrg: true); + orgMembersList.add(member); + }); + + // return list + return orgMembersList; + } +} diff --git a/lib/services/post_provider.dart b/lib/services/post_provider.dart deleted file mode 100644 index 06d1eb6aa..000000000 --- a/lib/services/post_provider.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/utils/api_functions.dart'; - -class PostProvider with ChangeNotifier { - Preferences preferences = Preferences(); - ApiFunctions apiFunctions = ApiFunctions(); - - List _postList = []; - String exception; - final Map _likePostMap = {}; - - /// Get the list of post by the organization - List get getPostList { - return _postList; - } - - /// Getter checks if the server response list fetched by getPosts is Empty - bool get isPostEmpty { - return _postList.isEmpty; - } - - /// Getter for the Liked posts - Map get getLikePostMap { - return _likePostMap; - } - - /// Getter for error which might occured during fetching posts - bool get isErrorOccurred { - return exception != null; - } - - /// Function to addlike - Future addLike(String postID) async { - final Map result = await Queries().addLike(postID) as Map; - print(result); - getPosts(); - } - - /// Function to remove the likes - Future removeLike(String postID) async { - final Map result = await Queries().removeLike(postID) as Map; - print(result); - getPosts(); - } - - // void : function to set the map of userLikedPost - void updateLikepostMap(String currentUserID) { - // traverse through post objects. - for (final item in _postList) { - _likePostMap[item['_id'].toString()] = false; - //Get userIds who liked the post. - final _likedBy = item['likedBy']; - for (final user in _likedBy) { - if (user['_id'] == currentUserID) { - //if(userId is in the list we make value true;) - _likePostMap[item['_id'].toString()] = true; - } - } - } - } - - //function to get the current posts - Future getPosts() async { - final String currentOrgID = await preferences.getCurrentOrgId(); - final String currentUserID = await preferences.getUserId(); - if (currentOrgID != null) { - final String query = Queries().getPostsById(currentOrgID); - final Map result = await apiFunctions.gqlquery(query); - if (result['exception'] != null) { - exception = result['exception'] as String; - } else { - _postList = result == null - ? [] - : (result['postsByOrganization'] as List).reversed.toList(); - exception = null; - updateLikepostMap(currentUserID); - notifyListeners(); - } - } else { - _postList = []; - updateLikepostMap(currentUserID); - } - } - - // bool : Method to get (true/false) if a user has liked a post or Not. - bool hasUserLiked(String postId) { - return _likePostMap[postId]; - } -} diff --git a/lib/services/post_service.dart b/lib/services/post_service.dart new file mode 100644 index 000000000..95cd7c1df --- /dev/null +++ b/lib/services/post_service.dart @@ -0,0 +1,326 @@ +// ignore_for_file: talawa_good_doc_comments, talawa_api_doc +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/exceptions/critical_action_exception.dart'; +import 'package:talawa/exceptions/graphql_exception_resolver.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/caching/base_feed_manager.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/post_queries.dart'; + +/// PostService class provides functions in the context of a Post. +/// +/// Services include: +/// * `getPosts` : to get all posts of the organization. +/// * `addLike` : to add like to the post. +/// * `removeLike` : to remove the like from the post. + +class PostService extends BaseFeedManager { + // constructor + PostService() : super(HiveKeys.postFeedKey) { + _postStream = _postStreamController.stream.asBroadcastStream(); + _updatedPostStream = + _updatedPostStreamController.stream.asBroadcastStream(); + _currentOrg = _userConfig.currentOrg; + setOrgStreamSubscription(); + } + + // Stream for entire posts + final StreamController> _postStreamController = + StreamController>(); + late Stream> _postStream; + + //Stream for individual post update + final StreamController _updatedPostStreamController = + StreamController(); + late Stream _updatedPostStream; + + final _userConfig = locator(); + final _dbFunctions = locator(); + late OrgInfo _currentOrg; + final Set _renderedPostID = {}; + // ignore: prefer_final_fields + List _posts = []; + + Map? postInfo; + String? after; + String? before; + int? first = 5; + int? last; + + /// Getter for Stream of posts. + Stream> get postStream => _postStream; + + /// Getter for Stream of update in any post. + Stream get updatedPostStream => _updatedPostStream; + + @override + Future> fetchDataFromApi() async { + // variables + final String currentOrgID = _currentOrg.id!; + final String query = + PostQueries().getPostsById(currentOrgID, after, before, first, last); + final result = await _dbFunctions.gqlAuthQuery(query); + //Checking if the dbFunctions return the postJSON, if not return. + if (result.data == null) { + // Handle the case where the result or result.data is null + throw Exception('unable to fetch data'); + } + + final organizations = result.data!['organizations'] as List; + final Map posts = (organizations[0] + as Map)['posts'] as Map; + final List newPosts = []; + postInfo = posts['pageInfo'] as Map; + debugPrint(postInfo.toString()); + (posts['edges'] as List).forEach((postJson) { + final post = Post.fromJson( + (postJson as Map)['node'] as Map, + ); + newPosts.insert(0, post); + }); + return newPosts; + } + + ///This method sets up a stream that constantly listens to change in current org. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void setOrgStreamSubscription() { + _userConfig.currentOrgInfoStream.listen((updatedOrganization) { + if (updatedOrganization != _currentOrg) { + _renderedPostID.clear(); + _currentOrg = updatedOrganization; + getPosts(); + } + }); + } + + Future fetchPostsInitial() async { + _posts = await loadCachedData(); + debugPrint('fetchPostInitial'); + debugPrint(_posts.length.toString()); + _postStreamController.add(_posts); + refreshFeed(); + } + + /// Method used to fetch all posts of the current organisation. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: returns future void + Future getPosts() async { + final List newPosts = await getNewFeedAndRefreshCache(); + newPosts.forEach((post) { + if (!_renderedPostID.contains(post.sId)) { + _posts.insert(0, post); + _renderedPostID.add(post.sId); + } + }); + debugPrint(_posts.length.toString()); + _postStreamController.add(_posts); + } + + /// Method to refresh feed of current selected organisation. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: returns future void + Future refreshFeed() async { + final List newPosts = await getNewFeedAndRefreshCache(); + _renderedPostID.clear(); + _posts.clear(); + _posts = newPosts; + GraphqlExceptionResolver.encounteredExceptionOrError( + CriticalActionException('Feed refreshed!!!'), + ); + _postStreamController.add(_posts); + } + + ///Method to add newly created post at the very top of the feed. + /// + /// **params**: + /// * `newPost`: new post made by user to add in feed + /// + /// **returns**: + /// None + void addNewpost(Post newPost) { + if (!_posts.contains(newPost)) { + _posts.insert(0, newPost); + } + _postStreamController.add(_posts); + } + + Future> deletePost(Post post) async { + return await _dbFunctions.gqlAuthMutation( + PostQueries().removePost(), + variables: { + "id": post.sId, + }, + ); + } + + ///Method to add like on a Post. + /// + /// This method basically update likedBy list of a Post + /// in database. + /// + /// **params**: + /// * `postID`: ID of the post to add like in database + /// + /// **returns**: + /// * `Future`: define_the_return + Future addLike(String postID) async { + bool isLiked = false; + await actionHandlerService.performAction( + actionType: ActionType.optimistic, + action: () async { + final String mutation = PostQueries().addLike(); + // run the graphQl mutation. + return await _dbFunctions + .gqlAuthMutation(mutation, variables: {"postID": postID}); + // return result + }, + onValidResult: (result) async { + isLiked = (result.data?["_id"] != null); + }, + updateUI: () { + _localAddLike(postID); + }, + ); + return isLiked; + } + + /// Locally add like on a Post and updates it using updated Post Stream. + /// + /// **params**: + /// * `postID`: ID of the post to add like locally + /// + /// **returns**: + /// None + void _localAddLike(String postID) { + _posts.forEach((post) { + if (post.sId == postID) { + post.likedBy!.add(LikedBy(sId: _userConfig.currentUser.id)); + _updatedPostStreamController.add(post); + } + }); + } + + /// Method to remove like in a Post. + /// + /// This method basically update likedBy list of a Post + /// and removes the like of a user in database. + /// + /// **params**: + /// * `postID`: ID of the post to remove like in database. + /// + /// **returns**: + /// * `Future`: nothing + Future removeLike(String postID) async { + bool isLiked = false; + await actionHandlerService.performAction( + actionType: ActionType.optimistic, + action: () async { + final String mutation = PostQueries().removeLike(); + return await _dbFunctions + .gqlAuthMutation(mutation, variables: {"postID": postID}); + }, + onValidResult: (result) async { + isLiked = (result.data?["_id"] != null); + }, + updateUI: () { + _removeLocal(postID); + }, + ); + return isLiked; + } + + /// Locally removes the like of a user and update the Post UI. + /// + /// **params**: + /// * `postID`: ID of the post to remove like locally + /// + /// **returns**: + /// None + void _removeLocal(String postID) { + _posts.forEach((post) { + if (post.sId == postID) { + post.likedBy!.removeWhere( + (likeUser) => likeUser.sId == _userConfig.currentUser.id, + ); + _updatedPostStreamController.add(post); + } + }); + } + + ///Method to add comment of a user and update comments using updated Post Stream. + /// + /// **params**: + /// * `postID`: ID of the post to add comment locally + /// + /// **returns**: + /// None + void addCommentLocally(String postID) { + for (int i = 0; i < _posts.length; i++) { + if (_posts[i].sId == postID) { + _posts[i].comments!.add(Comments(sId: postID)); + _updatedPostStreamController.add(_posts[i]); + } + } + } + + /// Method to handle pagination by fetching next page of posts. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future nextPage() async { + if (postInfo!['hasNextPage'] == true) { + _posts.clear(); + _renderedPostID.clear(); + after = postInfo!['endCursor'] as String; + before = null; + first = 5; + last = null; + await getPosts(); + } + } + + /// Method to handle pagination by fetching previous page of posts. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future previousPage() async { + if (postInfo!['hasPreviousPage'] == true) { + _posts.clear(); + _renderedPostID.clear(); + before = postInfo!['startCursor'] as String; + after = null; + last = 5; + first = null; + await getPosts(); + } + } +} diff --git a/lib/services/preferences.dart b/lib/services/preferences.dart deleted file mode 100644 index 67329d2e8..000000000 --- a/lib/services/preferences.dart +++ /dev/null @@ -1,222 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:talawa/model/token.dart'; - -class Preferences with ChangeNotifier { - static const tokenKey = "token"; - static const refreshTokenKey = "refreshTokenKey"; - static const userId = "userId"; - static const currentOrgId = "currentOrgId"; - static const currentOrgImgSrc = "currentOrgImgSrc"; - static const currentOrgName = "currentOrgName"; - static const orgUrl = "orgUrl"; - static const orgImgUrl = "orgUrl"; - static const userFName = "userFirstName"; - static const userLName = "userLastName"; - - String orgName; - String orgImgSrc; - - //it saves the user first name - Future saveUserFName(String fName) async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - await preferences.setString(userFName, fName); - } - - //it gets the user first name - Future getUserFName() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - final String fname = preferences.getString(userFName); - notifyListeners(); - return fname; - } - - //saves the user last name - Future saveUserLName(String lName) async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - await preferences.setString(userLName, lName); - } - - //gets the user last name - Future getUserLName() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - final String lname = preferences.getString(userLName); - notifyListeners(); - return lname; - } - - //saves the organization url - Future saveOrgImgUrl(String url) async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - await preferences.setString(orgImgUrl, url); - } - - //get the organization url - Future getOrgImgUrl() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - final String url = preferences.getString(orgImgUrl); - notifyListeners(); - return url; - } - - //saves the organization url - Future saveOrgUrl(String url) async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - await preferences.setString(orgUrl, url); - } - - //get the organization url - Future getOrgUrl() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - final String url = preferences.getString(orgUrl); - notifyListeners(); - return url; - } - - //saves the current organization name - Future saveCurrentOrgName(String currName) async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - await preferences.setString(currentOrgName, currName); - } - - //get the current organization name - Future getCurrentOrgName() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - orgName = preferences.getString(currentOrgName); - notifyListeners(); - return orgName; - } - - //saves the current organization image source - Future saveCurrentOrgImgSrc(String currImgSrc) async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - await preferences.setString(currentOrgImgSrc, currImgSrc); - } - - //gets the current organization image source - Future getCurrentOrgImgSrc() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - orgImgSrc = preferences.getString(currentOrgImgSrc); - notifyListeners(); - return orgImgSrc; - } - - //saves the current organization id - Future saveCurrentOrgId(String currOrgId) async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - await preferences.setString(currentOrgId, currOrgId); - } - - //get the current organization id - Future getCurrentOrgId() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - final String currentId = preferences.getString(currentOrgId); - notifyListeners(); - return currentId; - } - - //saves the user id - Future saveUserId(String userID) async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - await preferences.setString(userId, userID); - } - - //gets the user id - Future getUserId() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - final String uid = preferences.getString(userId); - return uid; - } - - //saves the current token - Future saveToken(Token token) async { - const storage = FlutterSecureStorage(); - token.parseJwt(); - await storage.write( - key: tokenKey, - value: (token.tokenString != null && token.tokenString.isNotEmpty) - ? token.tokenString - : ""); - //print("Saved token"); - } - - //gets the current token - Future getToken() async { - const storage = FlutterSecureStorage(); - final String userToken = await storage.read(key: tokenKey); - //print("getToken"); - return userToken; - } - - //saves the refreshed token - Future saveRefreshToken(Token token) async { - const storage = FlutterSecureStorage(); - token.parseJwt(); - await storage.write( - key: refreshTokenKey, - value: (token.tokenString != null && token.tokenString.isNotEmpty) - ? token.tokenString - : ""); - //print("Saved refresh token"); - } - - //get the refreshed token - Future getRefreshToken() async { - const storage = FlutterSecureStorage(); - final String refreshToken = await storage.read(key: refreshTokenKey); - //print("Got refresh token"); - return refreshToken; - } - - //get the current user id - static Future getCurrentUserId() async { - const storage = FlutterSecureStorage(); - try { - final Token token = - Token(tokenString: await storage.read(key: tokenKey) ?? ""); - final Map tokenMap = token.parseJwt(); - //print("Got uid"); - return tokenMap['id'] as int; - } catch (e) { - print(e); - } - return -1; - } - - //clears the user - static Future clearUser() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - const storage = FlutterSecureStorage(); - try { - await storage.delete(key: tokenKey); - //print("Delete token"); - preferences.remove(currentOrgId); - await storage.delete(key: refreshTokenKey); - //print("Refresh token"); - preferences.remove(userId); - preferences.remove(currentOrgName); - preferences.remove(currentOrgImgSrc); - preferences.remove(orgUrl); - preferences.remove(userFName); - preferences.remove(userLName); - } catch (e) { - print(e); - return false; - } - return true; - } - - //removes the organization - static Future removeOrg() async { - final SharedPreferences preferences = await SharedPreferences.getInstance(); - try { - preferences.remove(currentOrgId); - preferences.remove(currentOrgName); - } catch (e) { - print(e); - return false; - } - return true; - } -} diff --git a/lib/services/queries_.dart b/lib/services/queries_.dart deleted file mode 100644 index 6aa8505c3..000000000 --- a/lib/services/queries_.dart +++ /dev/null @@ -1,923 +0,0 @@ -//all the queries used in the program -import 'package:flutter/material.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/utils/globals.dart'; - -class Queries { - //refresh the token - String refreshToken(String refreshToken) { - return ''' - mutation{ - refreshToken(refreshToken: "$refreshToken"){ - accessToken - refreshToken - } - } - - '''; - } - - //register the user - String registerUser( - String firstName, String lastName, String email, String password) { - return """ - mutation (\$file: Upload) { - signUp(data: {firstName: "$firstName", lastName: "$lastName", email: "$email", password: "$password"}, - file: \$file){ - accessToken - user{ - _id - firstName - lastName - joinedOrganizations{ - _id - name - } - } - refreshToken - } - } - - """; - } - - //update profile the user - String updateUserProfile() { - return """ - mutation ( - \$file: Upload, - \$firstName: String, - \$lastName: String, - \$email: String - ){ - updateUserProfile( - data: { - firstName: \$firstName, - lastName: \$lastName, - email: \$email - }, - file: \$file - ){ - firstName - lastName - email - } - } - """; - } - - //register the user without the images - String registerUserWithoutImg( - String firstName, String lastName, String email, String password) { - return """ - mutation{ - signUp(data: {firstName: "$firstName", lastName: "$lastName", email: "$email", password: "$password"}) - { - accessToken - user{ - _id - firstName - lastName - joinedOrganizations{ - _id - name - } - } - refreshToken - } - } - - """; - } - - //login the user - String loginUser(String email, String password) { - return """ - mutation { - login(data: {email: "$email", password: "$password"}){ - accessToken - user{ - _id - firstName - lastName - joinedOrganizations{ - image - _id - name - } - } - refreshToken - } - } - - """; - } - - //fetches the user info - String fetchUserInfo = ''' - query Users(\$id: ID!){ - users(id:\$id){ - _id - firstName - lastName - email - image - joinedOrganizations{ - image - _id - name - admins{ - _id - } - description - isPublic - creator{ - _id - firstName - lastName - } - } - createdOrganizations { - _id - name - } - adminFor { - _id - name - creator{ - firstName - lastName - } - } - } - } - '''; - - //fetches the info two - String fetchUserInfo2(String id) { - return ''' - query {users(id:"$id"){ - _id - firstName - lastName - email - joinedOrganizations{ - _id - name - creator{ - firstName - lastName - } - } - createdOrganizations { - _id - name - } - adminFor { - _id - name - } - } - } - '''; - } - - //fetch organization - final String fetchOrganizations = ''' - query{ - organizations(){ - image - _id - name - admins{ - _id - } - description - isPublic - creator{ - _id - firstName - lastName - } - } - } - '''; - - //fetch organization by id - String fetchOrgById(String orgId) { - return ''' - query{ - organizations(id: "$orgId"){ - image - _id - name - admins{ - _id - } - description - isPublic - creator{ - _id - firstName - lastName - } - members{ - _id - firstName - lastName - email - image - } - } - } - '''; - } - - //get the organization id - String getOrgId(String orgId) { - return ''' - mutation { - joinPublicOrganization(organizationId: "$orgId") { - joinedOrganizations{ - _id - name - } - } - } - '''; - } - - //to create a organization - String createOrg(String name, String description, String attendees, - {@required bool isPublic, @required bool visibleInSearch}) { - return ''' - mutation (\$file: Upload){ - createOrganization(data: {name: "$name", description: "$description", attendees: "$attendees", isPublic: $isPublic, visibleInSearch: $visibleInSearch}, - file: \$file), - { - image - _id - name - description - creator{ - firstName - lastName - } - } - } - '''; - } - - //create organization without image - String createOrgWithoutImg(String name, String description, String attendees, - {@required bool isPublic, @required bool visibleInSearch}) { - return ''' - mutation { - createOrganization(data: {name: "$name", description: "$description", attendees: "$attendees", isPublic: $isPublic, visibleInSearch: $visibleInSearch}), - { - image - _id - name - description - creator{ - firstName - lastName - } - } - } - '''; - } - - //update the organization - String updateOrg(String orgId, String name, String description, - {@required bool isPublic, @required bool visibleInSearch}) { - return ''' - mutation { - updateOrganization(id: "$orgId", data: {name: "$name", description: "$description", isPublic: $isPublic, visibleInSearch: $visibleInSearch}){ - _id - name - } - } - '''; - } - - //remove the organization - String removeOrg(String orgId) { - return ''' - mutation { - removeOrganization(id: "$orgId"){ - firstName - lastName - joinedOrganizations{ - _id - name - } - } - } - '''; - } - - //leave the organization - String leaveOrg(String orgId) { - return ''' - mutation { - leaveOrganization(organizationId: "$orgId"){ - firstName - lastName - joinedOrganizations{ - _id - name - } - } - } - '''; - } - - //send membership request - String sendMembershipRequest(String orgId) { - return ''' - mutation { - sendMembershipRequest(organizationId: "$orgId"){ - _id - } - } - '''; - } - - //this enables to view the membership request - String viewMembershipRequest(String orgId) { - return ''' - query { - organizations(id:"$orgId"){ - membershipRequests{ - _id - user{ - firstName - lastName - image - } - } - } - } - '''; - } - - //allows to view members - String viewMembers(String orgId) { - return ''' - query { - organizations(id:"$orgId"){ - members{ - _id - firstName - lastName - image - - } - } - } - '''; - } - - //accepts the membership request - String acceptMembershipRequest(String membershipRequestId) { - return ''' - mutation { - acceptMembershipRequest(membershipRequestId:"$membershipRequestId"){ - user{ - firstName - lastName - } - } - } - '''; - } - - //rejecting the membership request - String rejectMembershipRequest(String membershipRequestId) { - return ''' - mutation { - rejectMembershipRequest(membershipRequestId:"$membershipRequestId"){ - user{ - firstName - lastName - } - } - } - '''; - } - - //remove the members - String removeMember(String organizationId, List userIds) { - return ''' - mutation { - removeMember(data: {organizationId: "$organizationId", userIds: $userIds}) - { - _id - name - } - - } - '''; - } - - String addAdmin(String organizationId, String userId) { - return ''' - mutation { - createAdmin(data: {organizationId: "$organizationId", userId: $userId}) - { - _id - } - - } - '''; - } - -//////////////EVENTS///////////////////// - String fetchOrgEvents(String orgId) { - return """ - query { - events(id: "$orgId"){ - _id - organization { - _id - image - } - title - description - isPublic - isRegisterable - recurring - recurrance - startTime - endTime - allDay - startTime - endTime - location - isRegistered - creator{ - _id - } - } - } - """; - } - - //to update an event - String updateEvent( - {eventId, - title, - description, - location, - isPublic, - isRegisterable, - recurring, - recurrance, - allDay, - date, - startTime, - endTime}) { - return """mutation { - updateEvent( - id: "$eventId" - data:{ - title: "$title", - description: "$description", - isPublic: $isPublic, - isRegisterable: $isRegisterable, - recurring: $recurring, - recurrance: "$recurrance", - allDay: $allDay, - startTime: "$startTime" - endTime: "$endTime" - location: "$location" - }){ - _id - title - description - } - }"""; - } - - //delete any event - String deleteEvent(String id) { - return """ - mutation { - removeEvent( - id: "$id", - ){ - _id - } - } - """; - } - - //to register for an event - registerForEvent(String eventId) async { - const String registerForEventMutation = """ - mutation registerForEvent(\$eventId: ID!) { - registerForEvent(id: \$eventId) - { - _id - title - description - } - } - """; - final GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final AuthController _authController = AuthController(); - _authController.getNewToken(); - - final QueryResult _resp = await _client.mutate(MutationOptions( - documentNode: gql(registerForEventMutation), - variables: { - 'eventId': eventId, //Add your variables here - }, - )); - if (!_resp.loading) { - print(_resp.data); - print(_resp.exception); - return _resp.data; - } - } - - addEventTask( - {String eventId, - String title, - String description, - String deadline}) async { - const String createTaskMutation = """ - mutation createTask(\$eventId: ID!, \$title: String!, \$description: String, \$deadline: String) { - createTask(eventId: \$eventId, - data:{ - title: \$title, - description: \$description, - deadline: \$deadline, - } - ){ - _id - } - } - """; - - final GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final AuthController _authController = AuthController(); - _authController.getNewToken(); - - final QueryResult _resp = await _client.mutate(MutationOptions( - documentNode: gql(createTaskMutation), - variables: { - 'eventId': eventId, - 'title': title, - 'description': description, - 'deadline': deadline, //Add your variables here - }, - )); - if (!_resp.loading) { - print(_resp.data); - print(_resp.exception); - return _resp.data; - } - } - - //to get the task by any event - String getTasksByEvent(String id) { - return """ - query{ - tasksByEvent(id:"$id"){ - title - description - deadline - } - } - - """; - } - - //to get registrants for an event - String getRegistrantsByEvent(String id) { - return """ - query{ - registrantsByEvent(id:"$id"){ - firstName - lastName - email - image - } - } - """; - } - - //to add the events - addEvent( - {startDate, - endDate, - organizationId, - title, - description, - location, - isPublic, - isRegisterable, - recurring, - allDay, - recurrance, - startTime, - endTime}) async { - const String createEventMutation = """ - mutation createEvent( \$organizationId: ID!, - \$title:String!, - \$description: String!, - \$startTime: String, - \$endTime: String, - \$allDay: Boolean!, - \$recurring: Boolean!, - \$recurrance: String, - \$isPublic: Boolean!, - \$isRegisterable: Boolean!, - \$location: String, - \$startDate : String!, - \$endDate : String!, - ) { - createEvent( - data:{ - organizationId: \$organizationId, - title: \$title, - description: \$description, - isPublic: \$isPublic, - isRegisterable: \$isRegisterable, - recurring: \$recurring, - recurrance: \$recurrance, - allDay: \$allDay, - startTime: \$startTime, - endTime: \$endTime, - startDate: \$startDate, - endDate: \$endDate, - location: \$location - } - ){ - _id - title - description - } - } - """; - final GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final AuthController _authController = AuthController(); - _authController.getNewToken(); - - final QueryResult _resp = await _client.mutate(MutationOptions( - documentNode: gql(createEventMutation), - variables: { - 'startDate': startDate, - 'endDate': endDate, - 'organizationId': organizationId, - 'title': title, - 'description': description, - 'isPublic': isPublic, - 'isRegisterable': isRegisterable, - 'recurring': recurring, - 'recurrance': recurrance, - 'allDay': allDay, - 'startTime': startTime, - 'endTime': endTime, - 'location': location - }, - )); - - if (!_resp.loading) { - print(_resp.data); - print(_resp.exception); - return _resp.data as Map; - } - } - -/////////////////////MEMBERS////////////////////////////////////////////////////////////////////// - - //task by users - String tasksByUser(String id) { - return """ - query{ - tasksByUser(id:"$id"){ - _id - title - description - deadline - event{ - title - } - } - } - - """; - } - - String registeredEventsByUser(String id) { - return """ - query{ - registeredEventsByUser(id:"$id"){ - _id - title - description - } - } - - """; - } - -///////////////////NEWSFEED/////////////////////////////////////////////////////////////////////// - String getPostsById(String orgId) { - return """ - query { - postsByOrganization(id: "$orgId") - { - _id - text - createdAt - imageUrl - videoUrl - title - commentCount - likeCount - creator{ - firstName - lastName - } - organization{ - _id - } - likedBy{ - _id - } - comments{ - _id - } - } - } -"""; - } - - String getPostsComments(String postId) { - return """ -query{ - commentsByPost(id: "$postId"){ - _id - text - createdAt - creator{ - firstName - lastName - } - } -} -"""; - } - - createComments(String postId, var text) async { - print(postId); - print(text); - const String createCommentMutation = """ - mutation createComment(\$postId: ID!, \$text: String!) { - createComment(postId: \$postId, - data:{ - text: \$text, - } - ){ - _id - } - } - """; - final GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final AuthController _authController = AuthController(); - - final QueryResult _resp = await _client.mutate(MutationOptions( - documentNode: gql(createCommentMutation), - variables: { - 'postId': postId, //Add your variables here - 'text': text - }, - )); - if (_resp.exception != null && - _resp.exception.toString().contains(accessTokenException)) { - _authController.getNewToken(); - createComments(postId, text); - } - if (_resp.exception != null && - _resp.exception - .toString() - .contains(refreshAccessTokenExpiredException)) { - _authController.getNewToken(); - createComments(postId, text); - } - if (!_resp.loading) { - print(_resp.data); - print(_resp.exception); - return _resp.data; - } - } - - addPost(String text, String organizationId, String title) async { - print(text); - print(organizationId); - print(title); - const String addPostMutation = """ - mutation createPost(\$text: String!, \$organizationId: ID!, \$title: String!) { - createPost( - data: { - text: \$text, - title: \$title, - organizationId: \$organizationId, - } - ){ - _id - text - } - } - """; - - final GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final AuthController _authController = AuthController(); - _authController.getNewToken(); - - final QueryResult _resp = await _client.mutate(MutationOptions( - documentNode: gql(addPostMutation), - variables: { - 'title': title, //Add your variables here - 'text': text, - 'organizationId': organizationId - }, - )); - - if (!_resp.loading) { - print(_resp.data); - print(_resp.exception); - return _resp.data; - } - } - - addLike(String postID) async { - print(postID); - const String addLikeMutation = """ - mutation likePost(\$postID: ID!) { - likePost( id: \$postID,) - { - _id - } - } - """; - final GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final AuthController _authController = AuthController(); - _authController.getNewToken(); - - final QueryResult _resp = await _client.mutate(MutationOptions( - documentNode: gql(addLikeMutation), - variables: { - 'postID': postID, //Add your variables here - }, - )); - if (!_resp.loading) { - print(_resp.data); - print(_resp.exception); - return _resp.data; - } - } - - removeLike(String postID) async { - print(postID); - const String unLikeMutation = """ - mutation unlikePost(\$postID: ID!) { - unlikePost( id: \$postID,) - { - _id - likedBy{ - _id - } - } - } - """; - final GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final AuthController _authController = AuthController(); - _authController.getNewToken(); - - final QueryResult _resp = await _client.mutate(MutationOptions( - documentNode: gql(unLikeMutation), - variables: { - 'postID': postID, //Add your variables here - }, - )); - if (!_resp.loading) { - print(_resp.data); - print(_resp.exception); - return _resp.data; - } - } -} diff --git a/lib/services/session_manager.dart b/lib/services/session_manager.dart new file mode 100644 index 000000000..76df5bfa0 --- /dev/null +++ b/lib/services/session_manager.dart @@ -0,0 +1,52 @@ +import 'dart:async'; + +import 'package:talawa/locator.dart'; + +/// Manages user sessions and periodically refreshes access tokens. +class SessionManager { + SessionManager() { + initializeSessionRefresher(); + } + + /// returns refresh interval of Session Manager. + int get refreshInterval => _refreshInterval; + + /// refresh interval in seconds. + static const int _refreshInterval = 600; + + /// Initializes as session refresher. + /// + /// Invokes [refreshSession] periodically at regular + /// refresh intervals. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Timer`: refresh timer. + Timer initializeSessionRefresher() { + return Timer.periodic( + const Duration(seconds: _refreshInterval), + (Timer timer) async { + refreshSession(); + }, + ); + } + + /// Asynchronously refreshes the user session. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: indicates if session refresh was + /// successful. + Future refreshSession() async { + if (userConfig.loggedIn && userConfig.currentUser.refreshToken != null) { + final refreshed = await databaseFunctions + .refreshAccessToken(userConfig.currentUser.refreshToken!); + return refreshed; + } + return false; + } +} diff --git a/lib/services/size_config.dart b/lib/services/size_config.dart new file mode 100644 index 000000000..10d8c6bda --- /dev/null +++ b/lib/services/size_config.dart @@ -0,0 +1,54 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/widgets.dart'; + +/// SizeConfig class is used to initialise the height and width of the media. +class SizeConfig { + // variables + static late MediaQueryData _mediaQueryData; + static double? screenWidth; + static double? screenHeight; + static double? blockSizeHorizontal; + static double? blockSizeVertical; + static double? paddingTop; + + static late double _safeAreaHorizontal; + static late double _safeAreaVertical; + static double? safeBlockHorizontal; + static double? safeBlockVertical; + + // function to initialise the width and height. + void init(BuildContext context) { + _mediaQueryData = MediaQuery.of(context); + screenWidth = _mediaQueryData.size.width; + screenHeight = _mediaQueryData.size.height; + blockSizeHorizontal = screenWidth! / 100; + blockSizeVertical = screenHeight! / 100; + + _safeAreaHorizontal = + _mediaQueryData.padding.left + _mediaQueryData.padding.right; + _safeAreaVertical = + _mediaQueryData.padding.top + _mediaQueryData.padding.bottom; + safeBlockHorizontal = (screenWidth! - _safeAreaHorizontal) / 100; + safeBlockVertical = (screenHeight! - _safeAreaVertical) / 100; + debugPrint("safeBlockHorizontal: $safeBlockHorizontal"); + debugPrint("safeBlockVertical: $safeBlockVertical"); + } + + void test() { + _mediaQueryData = + const MediaQueryData(size: Size(360, 684), padding: EdgeInsets.zero); + screenWidth = _mediaQueryData.size.width; + screenHeight = _mediaQueryData.size.height; + blockSizeHorizontal = screenWidth! / 100; + blockSizeVertical = screenHeight! / 100; + + _safeAreaHorizontal = + _mediaQueryData.padding.left + _mediaQueryData.padding.right; + _safeAreaVertical = + _mediaQueryData.padding.top + _mediaQueryData.padding.bottom; + safeBlockHorizontal = (screenWidth! - _safeAreaHorizontal) / 100; + safeBlockVertical = (screenHeight! - _safeAreaVertical) / 100; + } +} diff --git a/lib/services/third_party_service/connectivity_service.dart b/lib/services/third_party_service/connectivity_service.dart new file mode 100644 index 000000000..d1e95ff5d --- /dev/null +++ b/lib/services/third_party_service/connectivity_service.dart @@ -0,0 +1,116 @@ +import 'dart:async'; + +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:http/http.dart' as http; +import 'package:talawa/locator.dart'; + +/// This class provides services related to network connectivity monitoring and handling. +/// +/// It includes methods for: +/// * Initializing the network service - [initConnectivity] +/// * Monitoring connectivity changes - [enableSubscription] +/// * Handling online and offline states - [handleOnline], [handleOffline] +/// * Checking reachability of a given URI - [isReachable] +/// * Handling the device's connectivity status - [handleConnection] +/// * Checking if the device has any type of network connection - [hasConnection] +class ConnectivityService { + /// Stream controller for network status changes. + late StreamController connectionStatusController; + + /// Getter for the stream of connection status changes. + Stream get connectionStream => + connectionStatusController.stream; + + /// Checks the current internet connectivity status of the device. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: indicates if the url is reachable. + Future getConnectionType() async { + final result = await connectivity.checkConnectivity(); + return result; + } + + /// Client to access internet. + late final http.Client _client; + + /// This function initializes connectivity monitoring. + /// + /// **params**: + /// * `client`: An instance of `http.Client` to make the HTTP request. + /// + /// **returns**: + /// None + Future initConnectivity({required http.Client client}) async { + _client = client; + connectionStatusController = StreamController(); + + /// Listen for future changes in connectivity + enableSubscription(); + } + + /// This function enables the subscription to connectivity changes. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future enableSubscription() async { + connectivity.onConnectivityChanged.listen( + (ConnectivityResult result) { + print(result); + connectionStatusController.add(result); + }, + onError: (error) { + // Handle errors during listening for changes + print('Error listening for connectivity changes: $error'); + }, + ); + } + + /// This function checks if a given URI is reachable within a specified timeout period. + /// + /// Specifically designed to + /// + /// **params**: + /// * `client`: An instance of `http.Client` to make the HTTP request. + /// * `uriString`: An optional `String` specifying the URI to check. + /// Defaults to 'org link' if not provided. + /// + /// **returns**: + /// * `Future`: indicates if the url is reachable. + Future isReachable({ + http.Client? client, + String? uriString, + }) async { + try { + client ??= _client; + await client + .get(Uri.parse(uriString ?? graphqlConfig.httpLink.uri.toString())) + .timeout(const Duration(seconds: 30)); + return true; + } catch (e) { + print('Timeout while checking reachability: $e'); + return false; + } + } + + /// This function checks if the device currently has any type of network connection. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: indicating whether the device has a network connection. + Future hasConnection() async { + try { + final result = await getConnectionType(); + return result != ConnectivityResult.none; + } catch (e) { + return false; + } + } +} diff --git a/lib/services/third_party_service/multi_media_pick_service.dart b/lib/services/third_party_service/multi_media_pick_service.dart new file mode 100644 index 000000000..616c0dc31 --- /dev/null +++ b/lib/services/third_party_service/multi_media_pick_service.dart @@ -0,0 +1,114 @@ +/* This is an abstraction service for picking up Photos/videos +Library used: image_picker (https://pub.dev/packages/image_picker) +Service usage: "add_post_view_model.dart" +*/ + +import 'dart:async'; +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/image_service.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; + +/// This is a third party service which provide the service to select the image from. +/// +/// gallery and then image can be cropped as well. +/// +/// Services include: +/// * `getPhotoFromGallery` - Used to select photo from gallery. +/// * `cropImage` - Used to crop the selected image. +class MultiMediaPickerService { + MultiMediaPickerService() { + _picker = locator(); + _fileStream = _fileStreamController.stream.asBroadcastStream(); + _imageService = imageService; + } + + /// Controller for handling the stream of selected files. + final StreamController _fileStreamController = StreamController(); + + /// Stream of selected files. + late Stream _fileStream; + + /// [ImagePicker] used for selecting images or videos. + late ImagePicker _picker; + + /// [ImageService] for additional image-related operations. + late ImageService _imageService; + + /// Provides a stream of selected multimedia files. + /// + /// params: + /// None. + /// + /// returns: + /// * `Stream`: Stream of files. + Stream get fileStream => _fileStream; + + /// Picks the image from gallery or to click the image from user's camera. + /// + /// First ask for the permission to access the camera, if denied then returns a message in. + /// custom Dialog Box. Returns a File type for which `camera` variable is false by default. + /// + /// **params**: + /// * `camera`: if true then open camera for image, else open gallery to select image. + /// + /// **returns**: + /// * `Future`: the image the user choosed. + Future getPhotoFromGallery({bool camera = false}) async { + // asking for user's camera access permission. + try { + // checking for the image source, it could be camera or gallery. + final image = await _picker.pickImage( + source: camera ? ImageSource.camera : ImageSource.gallery, + ); + // if image is selected or not null, call the cropImage function that provide service to crop the selected image. + if (image != null) { + return await _imageService.cropImage( + imageFile: File(image.path), + ); + } + } catch (e) { + // if the permission denied or error occurs. + if (e is PlatformException && e.code == 'camera_access_denied') { + // push the dialog alert with the message. + locator().pushDialog( + permissionDeniedDialog(), + ); + } + debugPrint( + "MultiMediaPickerService : Exception occurred while choosing photo from the gallery $e", + ); + } + + return null; + } + + /// Generates a custom alert dialog for permission denial. + /// + /// When called, it creates and returns a `CustomAlertDialog` widget with pre-defined settings. + /// This dialog prompts the user to grant camera permissions from the app settings. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `CustomAlertDialog`: Custom Alert Dialog widget. + CustomAlertDialog permissionDeniedDialog() { + return CustomAlertDialog( + success: () { + locator().pop(); + openAppSettings(); + }, + dialogTitle: 'Permission Denied', + successText: 'SETTINGS', + dialogSubTitle: + "Camera permission is required, to use this feature, give permission from app settings", + ); + } +} diff --git a/lib/services/user_action_handler.dart b/lib/services/user_action_handler.dart new file mode 100644 index 000000000..9f621ace7 --- /dev/null +++ b/lib/services/user_action_handler.dart @@ -0,0 +1,103 @@ +import 'dart:async'; + +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/exceptions/critical_action_exception.dart'; +import 'package:talawa/exceptions/graphql_exception_resolver.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +/// A service class to handle different types of actions, including API calls. +/// +/// with proper error handling and UI updates based on the action type. +class ActionHandlerService { + /// Method to execute an API action. + /// + /// **params**: + /// * `action`: A function that performs the API call and returns a `Future?>`. + /// * `onValidResult`: A function to handle the result when the API call is successful. + /// * `onActionException`: A function to handle exceptions that occur during the API call. + /// * `onActionFinally`: A function to execute regardless of the success or failure of the API call. + /// + /// **returns**: + /// * `Future`: that indicates the success (`true`), failure (`false`), or null if the result is invalid. + Future executeApiCall({ + required Future?> Function() action, + Future Function(QueryResult)? onValidResult, + Future Function(Exception e)? onActionException, + Future Function()? onActionFinally, + }) async { + try { + final result = await action(); + print(result); + if (result == null || result.data == null) return null; + + if (result.isConcrete && result.source != QueryResultSource.cache) { + await onValidResult!(result); + } + return true; + } catch (e) { + await onActionException?.call(e as Exception); + return false; + } finally { + await onActionFinally?.call(); + } + } + + /// Processes a user action based on its type, with error handling and UI update. + /// + /// **params**: + /// * `actionType`: Specifies whether the action is optimistic or critical. + /// * `action`: The action to perform, which returns a `Future?>`. + /// * `onValidResult`: A function to handle the result when the action is successful. + /// * `onActionException`: A function to handle exceptions that occur during the action. + /// * `updateUI`: A function to update the UI immediately for optimistic actions or after API call for critical actions. + /// * `apiCallSuccessUpdateUI`: A function to update the UI upon successful API call. + /// * `criticalActionFailureMessage`: The error message to use when a critical action fails. + /// * `onActionFinally`: A function to execute regardless of the success or failure of the action. + /// + /// **returns**: + /// None + Future performAction({ + required ActionType actionType, + required Future?> Function() action, + Future Function(QueryResult result)? onValidResult, + Future Function(Exception e)? onActionException, + void Function()? updateUI, + void Function()? apiCallSuccessUpdateUI, + String? criticalActionFailureMessage = TalawaErrors.userActionNotSaved, + Future Function()? onActionFinally, + }) async { + bool? success; + // optimistic + if (actionType == ActionType.optimistic) { + // Update UI immediately for optimistic actions + updateUI?.call(); + success = await executeApiCall( + action: action, + onValidResult: onValidResult, + onActionException: onActionException, + onActionFinally: onActionFinally, + ); + } else { + if (AppConnectivity.isOnline) { + // Perform critical action with UI update after API call + success = await executeApiCall( + action: action, + onValidResult: onValidResult, + onActionException: onActionException, + onActionFinally: onActionFinally, + ); + updateUI?.call(); + if (success ?? false) { + apiCallSuccessUpdateUI?.call(); + } + } else { + updateUI?.call(); + GraphqlExceptionResolver.encounteredExceptionOrError( + CriticalActionException(criticalActionFailureMessage!), + ); + } + } + } +} diff --git a/lib/services/user_config.dart b/lib/services/user_config.dart new file mode 100644 index 000000000..4a11684d1 --- /dev/null +++ b/lib/services/user_config.dart @@ -0,0 +1,312 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/constants/app_strings.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/models/user/user_info.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; +import 'package:talawa/widgets/talawa_error_dialog.dart'; + +/// Provides different services in the context of the User. +/// +/// Services include: +/// * `userLoggedIn` : helps to make user logged in to the application. +/// * `updateUserJoinedOrg` : helps to update the user joined organization. +/// * `updateUserCreatedOrg` : helps to update the user created organization. +/// * `updateUserMemberRequestOrg` : helps to update the User membership +/// request for the organization. +/// * `updateUserAdminOrg` : helps to update the Admin of the Organization. +/// * `updateAccessToken` : helps to update the access token of an user. +/// * `updateUser` : helps to update the user. +class UserConfig { + // variables + late User? _currentUser = User(id: 'null', authToken: 'null'); + late OrgInfo? _currentOrg = OrgInfo(name: 'Organization Name', id: 'null'); + late Stream _currentOrgInfoStream; + final StreamController _currentOrgInfoController = + StreamController.broadcast(); + + /// Retrieves the stream of current organization information. + Stream get currentOrgInfoStream => _currentOrgInfoStream; + + /// Retrieves the stream controller for current organization information. + StreamController get currentOrgInfoController => + _currentOrgInfoController; + + /// Retrieves the current organization information. + OrgInfo get currentOrg => _currentOrg!; + + /// Retrieves the name of the current organization. + String get currentOrgName => _currentOrg!.name!; + + /// Checks if a user is logged in. + bool get loggedIn => _currentUser?.id != 'null'; + + /// Updates the current organization information. + set currentOrg(OrgInfo org) => _currentOrg = org; + + /// Retrieves the current user. + User get currentUser => _currentUser!; + + /// Updates the current user. + set currentUser(User user) { + _currentUser = user; + } + + /// initialise. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialiseStream() { + _currentOrgInfoStream = + _currentOrgInfoController.stream.asBroadcastStream(); + } + + /// This function is used to log in the user. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: returns future of bool type. + Future userLoggedIn() async { + initialiseStream(); + final boxUser = Hive.box('currentUser'); + final boxOrg = Hive.box('currentOrg'); + _currentOrg = + boxOrg.get('org') ?? OrgInfo(name: 'Organization Name', id: 'null'); + _currentOrgInfoController.add(_currentOrg!); + + _currentUser = boxUser.get('user'); + + // if there is not currentUser then returns false. + if (_currentUser == null) { + _currentUser = User(id: 'null', authToken: 'null'); + return false; + } + // generate access token + graphqlConfig.getToken().then((value) async { + try { + databaseFunctions.init(); + await sessionManager.refreshSession(); + databaseFunctions.init(); + final QueryResult result = await databaseFunctions.gqlAuthQuery( + queries.fetchUserInfo, + variables: {'id': currentUser.id}, + ); + final List users = result.data!['users'] as List; + final User userInfo = User.fromJson( + users[0] as Map, + fromOrg: false, + ); + userInfo.authToken = userConfig.currentUser.authToken; + userInfo.refreshToken = userConfig.currentUser.refreshToken; + userConfig.updateUser(userInfo); + _currentOrg ??= _currentUser!.joinedOrganizations![0]; + _currentOrgInfoController.add(_currentOrg!); + saveUserInHive(); + return true; + } on Exception catch (e) { + print(e); + navigationService.showTalawaErrorSnackBar( + "Couldn't update User details", + MessageType.error, + ); + } + }); + return true; + } + + /// Logs out the current user. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: returns future of bool type. + Future userLogOut() async { + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.youAreOfflineUnableToLogout, + action: () async { + navigationService.pop(); + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('LogoutProgress'), + ), + ); + return await databaseFunctions.gqlAuthMutation(queries.logout()); + }, + onValidResult: (result) async { + if (result.data != null && result.data!['logout'] == true) { + // throw StateError('error'); + + final user = Hive.box('currentUser'); + final url = Hive.box('url'); + final organisation = Hive.box('currentOrg'); + // final androidFirebaseOptionsBox = Hive.box('androidFirebaseOptions'); + // final iosFirebaseOptionsBox = Hive.box('iosFirebaseOptions'); + await user.clear(); + await url.clear(); + await organisation.clear(); + // androidFirebaseOptionsBox.clear(); + // iosFirebaseOptionsBox.clear(); + // try { + // Firebase.app() + // .delete(); // Deleting app will stop all Firebase plugins + // } catch (e) { + // debugPrint("ERROR: Unable to delete firebase app $e"); + // } + _currentUser = User(id: 'null', authToken: 'null'); + } + }, + onActionException: (e) async { + navigationService.pushDialog( + const TalawaErrorDialog( + 'Unable to logout, please try again.', + key: Key('TalawaError'), + messageType: MessageType.error, + ), + ); + }, + updateUI: () { + navigationService.pop(); + }, + apiCallSuccessUpdateUI: () { + navigationService.removeAllAndPush( + Routes.setUrlScreen, + Routes.splashScreen, + arguments: '', + ); + }, + ); + } + + /// Updates the user joined organization. + /// + /// **params**: + /// * `orgDetails`: details of the organization that user joined. + /// + /// **returns**: + /// * `Future`: returns future of void type. + Future updateUserJoinedOrg(List orgDetails) async { + _currentUser!.updateJoinedOrg(orgDetails); + saveUserInHive(); + } + + /// Updates the user created organization. + /// + /// **params**: + /// * `orgDetails`: details of the organization that user joined. + /// + /// **returns**: + /// * `Future`: returns future of void type. + Future updateUserCreatedOrg(List orgDetails) async { + _currentUser!.updateCreatedOrg(orgDetails); + saveUserInHive(); + } + + /// Updates the user request to join the organization. + /// + /// **params**: + /// * `orgDetails`: details of the organization that user joined. + /// + /// **returns**: + /// * `Future`: returns future of void type. + Future updateUserMemberRequestOrg(List orgDetails) async { + _currentUser!.updateMemberRequestOrg(orgDetails); + saveUserInHive(); + } + + /// Updates the organization admin. + /// + /// **params**: + /// * `orgDetails`: details of the organization that user joined. + /// + /// **returns**: + /// * `Future`: returns future of void type. + Future updateUserAdminOrg(List orgDetails) async { + _currentUser!.updateAdminFor(orgDetails); + saveUserInHive(); + } + + /// Updates the access token of the user. + /// + /// **params**: + /// * `accessToken`: current user's accesstoken. + /// * `refreshToken`: current user's refreshtoken. + /// + /// **returns**: + /// * `Future`: returns future of void type. + Future updateAccessToken({ + required String accessToken, + required String refreshToken, + }) async { + _currentUser!.refreshToken = refreshToken; + _currentUser!.authToken = accessToken; + saveUserInHive(); + } + + /// Updates the user details. + /// + /// **params**: + /// * `updatedUserDetails`: `User` type variable containing + /// all the details of an user need to be updated. + /// + /// **returns**: + /// * `Future`: returns future of bool type. + Future updateUser(User updatedUserDetails) async { + try { + _currentUser = updatedUserDetails; + saveUserInHive(); + graphqlConfig.getToken(); + databaseFunctions.init(); + return true; + } on Exception catch (e) { + debugPrint(e.toString()); + return false; + } + } + + /// save user in hive. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void saveUserInHive() { + final box = Hive.box('currentUser'); + if (box.get('user') == null) { + box.put('user', _currentUser!); + } else { + box.put('user', _currentUser!); + } + } + + /// save current organization details in hive. + /// + /// **params**: + /// * `saveOrgAsCurrent`: instance of OrgInfo + /// + /// **returns**: + /// None + void saveCurrentOrgInHive(OrgInfo saveOrgAsCurrent) { + _currentOrg = saveOrgAsCurrent; + _currentOrgInfoController.add(_currentOrg!); + final box = Hive.box('currentOrg'); + if (box.get('org') == null) { + box.put('org', _currentOrg!); + } else { + box.put('org', _currentOrg!); + } + } +} diff --git a/lib/services/user_profile_service.dart b/lib/services/user_profile_service.dart new file mode 100644 index 000000000..410292a2b --- /dev/null +++ b/lib/services/user_profile_service.dart @@ -0,0 +1,39 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/user/user_info.dart'; + +/// Service class for handling user profile operations, including updating and retrieving user profile information. +class UserProfileService { + /// Updates the user profile using a GraphQL mutation. + /// + /// **params**: + /// * `variables`: A map of key-value pairs representing the variables required for the GraphQL mutation. + /// If `null`, the mutation is performed without additional variables. + /// + /// **returns**: + /// * `Future>`: which contains the result of the GraphQL mutation. + Future> updateUserProfile( + Map? variables, + ) { + return databaseFunctions.gqlAuthMutation( + queries.updateUserProfile(), + variables: variables, + ); + } + + /// Retrieves user profile information using a GraphQL query. + /// + /// **params**: + /// * `user`: An instance of `User` representing the user whose profile information is to be fetched. + /// The user's ID is used as a variable for the GraphQL query. + /// + /// **returns**: + /// * `Future>`: which contains the result of the GraphQL query. + Future> getUserProfileInfo(User user) async { + final QueryResult result = await databaseFunctions.gqlAuthQuery( + queries.fetchUserInfo, + variables: {'id': user.id}, + ); + return result; + } +} diff --git a/lib/splash_screen.dart b/lib/splash_screen.dart new file mode 100644 index 000000000..89290d1ee --- /dev/null +++ b/lib/splash_screen.dart @@ -0,0 +1,314 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/custom_painters/talawa_logo.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:uni_links/uni_links.dart'; + +/// This widget return the SplashScreen. Splash Screen is the first screen that we see when we run our application. It is also known as Launch Screen. +class SplashScreen extends StatefulWidget { + const SplashScreen({required Key key, this.mainScreenIndex = 0}) + : super(key: key); + + /// This is required if url requires us to push different Screen to Home Screen. + final int mainScreenIndex; + + @override + _SplashScreenState createState() => _SplashScreenState(); +} + +/// This return state for the SplashScreen Widget. +class _SplashScreenState extends State { + Uri? _initialUri; + Uri? _latestUri; + late StreamSubscription _sub; + + // Flutter supports deep linking on iOS, Android, and web browsers. + // Opening a URL displays that screen in your app. + // `_handleInitialUri` is an async function that is used to hanlde + // the initial uri of the application. + + /// Opening a URL displays that screen in your app. + /// + /// Used to handle the initial uri of the application. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future _handleInitialUri() async { + _sub = uriLinkStream.listen( + (Uri? uri) { + // After creating a State object and before calling initState, the framework + // "mounts" the State object by associating it with a BuildContext. + if (!mounted) return; + setState(() { + _latestUri = uri; + }); + }, + onError: (Object err) { + if (!mounted) return; + setState(() { + _latestUri = null; + }); + }, + ); + try { + // Retrieving the initial URI from getInitialUri function. + final uri = await getInitialUri(); + if (!mounted) return; + setState(() => _initialUri = uri); + } on PlatformException { + if (!mounted) return; + setState(() => _initialUri = null); + } on FormatException catch (err) { + debugPrint(err.toString()); + if (!mounted) return; + setState(() => _initialUri = null); + } + final bool userLoggedIn = userConfig.loggedIn; + _initialUri = null; + _latestUri = null; + if (_latestUri == null && _initialUri == null) { + _handleUserLogIn(userLoggedIn); + return; + } + + // if (_initialUri != null) { + // await _handleDeepLinks(userLoggedIn); + // } + } + + // Future _handleDeepLinks(bool userLoggedIn) async { + // final keys = _initialUri!.queryParameters.keys; + // final values = _initialUri!.queryParameters.values; + + // final fromInviteLink = navigationService.fromInviteLink; + // final showSnackBar = navigationService.showTalawaErrorSnackBar; + // final pushReplacementScreen = navigationService.pushReplacementScreen; + + // final orgURI = GraphqlConfig.orgURI!; + // final mainScreenArgs = + // MainScreenArgs(mainScreenIndex: widget.mainScreenIndex); + + // if (_initialUri!.pathSegments[1] == 'invite') { + // if (!userLoggedIn) { + // fromInviteLink( + // keys.toList(growable: false), + // values.toList(growable: false), + // ); + // return; + // } + + // final setUrl = values.toList(growable: false)[1]; + // if (setUrl.compareTo(orgURI) != 0) { + // showSnackBar( + // 'Organisation on different server! Logout and open link again', + // MessageType.error, + // ); + // return; + // } + + // if (keys.last.compareTo('selectOrg') != 0) { + // showSnackBar('Invalid url', MessageType.error); + // return; + // } + + // final routeNames = [ + // Routes.mainScreen.split('/').last, + // Routes.joinOrg.split('/').last, + // ]; + // final arguments = [ + // mainScreenArgs, + // values.last, + // ]; + // fromInviteLink(routeNames, arguments); + // return; + // } + // if (_initialUri!.pathSegments[1] == 'eventInvite') { + // if (!userLoggedIn) { + // pushReplacementScreen( + // Routes.languageSelectionRoute, + // arguments: 'en', + // ); + // return; + // } + + // final setUrl = values.toList(growable: false)[0]; + // if (setUrl.compareTo(orgURI) != 0) { + // Clipboard.setData(ClipboardData(text: setUrl)); + // showSnackBar( + // 'Organisation on different server! Url copied to clipboard.', + // MessageType.error, + // ); + // pushReplacementScreen( + // Routes.mainScreen, + // arguments: mainScreenArgs, + // ); + // return; + // } + + // final currentOrgId = userConfig.currentOrg.id!; + // if (values.toList()[1].compareTo(currentOrgId) != 0) { + // pushReplacementScreen(Routes.joinOrg, arguments: values.toList()[1]); + // return; + // } + + // final routeNames = [ + // Routes.mainScreen.split('/').last, + // Routes.eventInfoPage.split('/').last, + // ]; + + // final model = locator(); + // await model.initialise(); + + // await Future.delayed(Duration.zero); + // Event? event; + // for (final ele in model.events) { + // if (ele.id == values.last) event = ele; + // } + + // if (event == null) { + // showSnackBar('Event not found', MessageType.error); + // pushReplacementScreen( + // Routes.mainScreen, + // arguments: mainScreenArgs, + // ); + // return; + // } + + // final arguments = [ + // MainScreenArgs(mainScreenIndex: 1), + // { + // "event": event, + // "exploreEventViewModel": model, + // }, + // ]; + + // fromInviteLink(routeNames, arguments); + // return; + // } + // } + + /// Handles User Login. + /// + /// **params**: + /// * `userLoggedIn`: Bool for if user is logged in already or not + /// + /// **returns**: + /// None + void _handleUserLogIn(bool userLoggedIn) { + Future.delayed(const Duration(milliseconds: 750)).then((value) async { + final pushReplacementScreen = navigationService.pushReplacementScreen; + if (!userLoggedIn) { + pushReplacementScreen(Routes.languageSelectionRoute, arguments: 'en'); + return; + } + + final currentUser = userConfig.currentUser; + if (currentUser.joinedOrganizations!.isNotEmpty) { + final mainScreenArgs = MainScreenArgs( + mainScreenIndex: widget.mainScreenIndex, + fromSignUp: false, + ); + pushReplacementScreen(Routes.mainScreen, arguments: mainScreenArgs); + return; + } + + if (currentUser.membershipRequests!.isNotEmpty) { + pushReplacementScreen(Routes.waitingScreen, arguments: '0'); + return; + } + + pushReplacementScreen(Routes.joinOrg, arguments: '-1'); + }); + } + + @override + void initState() { + super.initState(); + _handleInitialUri(); + } + + @override + void dispose() { + _sub.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + sizeConfig.init(context); + return Scaffold( + key: const Key('SplashScreenScaffold'), + body: Stack( + children: [ + Center( + child: CustomPaint( + key: const Key('LogoPainter'), + size: Size( + SizeConfig.screenWidth! * 0.6, + SizeConfig.screenWidth! * 0.6, + ), + painter: AppLogo(), + ), + ), + Positioned( + top: SizeConfig.screenHeight! / 1.5, + left: 0.0, + right: 0.0, + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'TALAWA', + style: Theme.of(context).textTheme.headlineMedium, + ), + ], + ), + ), + Positioned( + top: SizeConfig.screenHeight! / 1.08, + left: 0.0, + right: 0.0, + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppLocalizations.of(context)!.strictTranslate('from'), + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + ), + Positioned( + top: SizeConfig.screenHeight! / 1.05, + left: 0.0, + right: 0.0, + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'PALISADOES', + style: Theme.of(context) + .textTheme + .titleSmall! + .copyWith(fontWeight: FontWeight.w700), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/utils/api_functions.dart b/lib/utils/api_functions.dart deleted file mode 100644 index c7f452f9a..000000000 --- a/lib/utils/api_functions.dart +++ /dev/null @@ -1,86 +0,0 @@ -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; - -class ApiFunctions { - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final AuthController _authController = AuthController(); - - String userAuthError = "User is not authenticated: Undefined location"; - - //this is the query used to get the token - // ignore: missing_return - Future gqlquery(String query) async { - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryOptions options = QueryOptions( - documentNode: gql(query), - variables: {}, - ); - - final QueryResult result = await _client.query(options); - if (result.hasException && - result.exception.toString().contains(accessTokenException)) { - _authController.getNewToken(); - gqlquery(query); - } else if (result.hasException && - result.exception - .toString() - .contains(refreshAccessTokenExpiredException)) { - _authController.getNewToken(); - gqlquery(query); - } else if (result.hasException) { - print(result.exception); - String message = ""; - if (result.exception.clientException != null) { - message = result.exception.clientException.message; - } else { - message = result.exception.graphqlErrors.first.message; - } - - return {"exception": message}; - } else { - return result.data as Map; - } - } - - //function to mutate the query - Future gqlmutation(String mutation) async { - final GraphQLClient _client = graphQLConfiguration.authClient(); - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(mutation), - )); - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return gqlmutation(mutation); - } else if (result.hasException && - result.exception - .toString() - .contains(refreshAccessTokenExpiredException)) { - _authController.getNewToken(); - return gqlmutation(mutation); - } else if (result.hasException) { - print(result.exception); - } else { - return result.data; - } - } - - Future sendLogs(String filePath) async { - //TODO: Add the Url and uncomment the block - // var request = http.MultipartRequest('POST', Uri.parse('')); - // request.files.add( - // http.MultipartFile( - // 'zip', - // File(filePath).readAsBytes().asStream(), - // File(filePath).lengthSync(), - // filename: filePath.split("/").last, - // ), - // ); - // var res = await request.send(); - // return res.statusCode; - } -} diff --git a/lib/utils/app_localization.dart b/lib/utils/app_localization.dart new file mode 100644 index 000000000..7446a530b --- /dev/null +++ b/lib/utils/app_localization.dart @@ -0,0 +1,102 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +///This class provides methods to localize the application so that it can be available +///to users with different languages. +class AppLocalizations { + AppLocalizations( + this.locale, { + this.isTest = false, + }); + + late Map _localizedStrings; + final Locale locale; + bool isTest; + + // Helper method to keep the code in the widgets concise + static AppLocalizations? of(BuildContext context) { + return Localizations.of(context, AppLocalizations); + } + + // Static member to have a simple access to the delegate from the MaterialApp + static const LocalizationsDelegate delegate = + AppLocalizationsDelegate(); + + Future loadTest(Locale locale) async { + return AppLocalizations(locale); + } + + Future load() async { + // Load the language JSON file from the "lang" folder + final String jsonString = + await rootBundle.loadString('lang/${locale.languageCode}.json'); + final Map jsonMap = + json.decode(jsonString) as Map; + + _localizedStrings = jsonMap.map((key, value) { + return MapEntry(key, value.toString()); + }); + + return true; + } + + // This method will be called from every widget which needs a localized text + String? translate(String? key) { + if (isTest) return key; + + // ignore: unnecessary_null_comparison + if (key == null) { + return '...'; + } + return _localizedStrings[key]; + } + + // This method will be called from every widget which needs a localized text + String strictTranslate(String key) { + if (isTest) return key; + + // ignore: unnecessary_null_comparison + if (key == null) { + return '...'; + } + + final String translate = _localizedStrings[key] ?? key; + return translate; + } +} + +class AppLocalizationsDelegate extends LocalizationsDelegate { + const AppLocalizationsDelegate({ + this.isTest = false, + }); + final bool isTest; + + @override + bool isSupported(Locale locale) { + // Include all of your supported language codes here + return ['en', 'es', 'fr', 'hi', 'zh', 'de', 'ja', 'pt'] + .contains(locale.languageCode); + } + + @override + Future load(Locale locale) async { + // AppLocalizations class is where the JSON loading actually runs + final AppLocalizations localizations = + AppLocalizations(locale, isTest: isTest); + if (isTest) { + await localizations.loadTest(locale); + } else { + await localizations.load(); + } + + return localizations; + } + + @override + bool shouldReload(AppLocalizationsDelegate old) => false; +} diff --git a/lib/utils/chat_queries.dart b/lib/utils/chat_queries.dart new file mode 100644 index 000000000..06f75da4f --- /dev/null +++ b/lib/utils/chat_queries.dart @@ -0,0 +1,87 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +///This class creates the queries dealing with chats. + +class ChatQueries { + //Returns a query to fetch direct chat using userId + String fetchDirectChatsByUserId(String userId) { + return ''' + query { + directChatsByUserID(id: "$userId") { + _id + users{ + _id + firstName + email + } + } + } + '''; + } + + //Returns query to fetch direct chat messages using chatId + String fetchDirectChatMessagesByChatId(String chatId) { + return ''' + query { + directChatsMessagesByChatID(id: "$chatId") { + _id + messageContent + sender { + _id + firstName + image + } + receiver { + _id + firstName + image + } + } + } + '''; + } + + //Gets messages sent to direct chat subscription + String get messageSentToDirectChatsubscription => ''' + subscription{ + messageSentToDirectChat{ + _id + messageContent + sender { + _id + firstName + image + } + receiver { + _id + firstName + image + } + } + } + '''; + + //Send message to direct chat. + String sendMessageToDirectChat() { + return ''' + mutation sendMessageToDirectChat( + \$chatId: ID! + \$messageContent: String! + ){ + sendMessageToDirectChat( + chatId: \$chatId + messageContent: \$messageContent + ) { + messageContent + sender{ + firstName + } + receiver{ + firstName + } + } + } + '''; + } +} diff --git a/lib/utils/comment_queries.dart b/lib/utils/comment_queries.dart new file mode 100644 index 000000000..fa11f6c18 --- /dev/null +++ b/lib/utils/comment_queries.dart @@ -0,0 +1,49 @@ +///This class creates the queries dealing with comments. +class CommentQueries { + /// Creating a comment. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: The query for creating a comment + String createComment() { + return """ + mutation createComment(\$postId: ID!, \$text: String!) { + createComment(postId: \$postId, + data:{ + text: \$text, + } + ){ + _id + } + } + """; + } + + /// Get all comments for a post. + /// + /// **params**: + /// * `postId`: The id of the post to get comments for. + /// + /// **returns**: + /// * `String`: The query for getting all comments for a post. + String getPostsComments(String postId) { + return """ + query { + post(id: "$postId") + { _id, + comments{ + _id, + text, + createdAt + creator{ + firstName + lastName + } + } + } + } +"""; + } +} diff --git a/lib/utils/encryptor.dart b/lib/utils/encryptor.dart new file mode 100644 index 000000000..becf9a455 --- /dev/null +++ b/lib/utils/encryptor.dart @@ -0,0 +1,162 @@ +import 'dart:convert'; +import 'dart:math'; +import 'dart:typed_data'; + +import 'package:crypto/crypto.dart'; +import 'package:hive/hive.dart'; +import 'package:pointycastle/asymmetric/oaep.dart'; +import 'package:pointycastle/asymmetric/rsa.dart'; +import 'package:pointycastle/key_generators/rsa_key_generator.dart'; +import 'package:pointycastle/pointycastle.dart'; +import 'package:pointycastle/random/fortuna_random.dart'; +import 'package:talawa/models/asymetric_keys/asymetric_keys.dart'; + +/// Handles all of the encryption tasks in the codebase. +class Encryptor { + /// A global switch to flag the encryption. + /// + /// Since adding encryption invalidates all of the previous + /// data, disabling it by default will help in keeping + /// other contributors working without any issue. + /// TODO: Remove this and make encryption default. + static bool shouldEncrypt = false; + + /// Encrypts a given string with SHA256 Encryption. + /// + /// **params**: + /// * `data`: The string data to encrypt + /// + /// **returns**: + /// * `String`: SHA256 encrypted data + static String encryptString(String data) { + if (!shouldEncrypt) return data; + return sha256.convert(utf8.encode(data)).toString(); + } + + /// Generates RSA Key Pairs (Public/Private). + /// + /// Should be called only during app's first initialization, + /// and any future usage should be done by getting the keys + /// from the local storage. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `AsymmetricKeyPair`: The generated + /// public and private keys. + AsymmetricKeyPair generateRSAKeyPair() { + final secureRandom = FortunaRandom(); + final random = Random.secure(); + final List seeds = []; + for (int i = 0; i < 32; i++) { + seeds.add(random.nextInt(255)); + } + secureRandom.seed(KeyParameter(Uint8List.fromList(seeds))); + final rsapars = RSAKeyGeneratorParameters(BigInt.from(65537), 2048, 64); + final params = ParametersWithRandom(rsapars, secureRandom); + final keyGenerator = RSAKeyGenerator(); + keyGenerator.init(params); + return keyGenerator.generateKeyPair(); + } + + /// Saves the generated key pair to local storage. + /// + /// Any future usage of the keys must be initiated from here. + /// + /// **params**: + /// * `keyPair`: [AsymmetricKeyPair] to save. + /// * `hive`: The [HiveInterface] to store keys in. + /// + /// **returns**: + /// None + Future saveKeyPair( + AsymmetricKeyPair keyPair, + HiveInterface hive, + ) async { + // TODO: Implement secure storage here + final Box keysBox = + await hive.openBox('user_keys'); + keysBox.put('key_pair', AsymetricKeys(keyPair: keyPair)); + } + + /// Loads secret keys from the Hive db. + /// + /// **params**: + /// * `hive`: The [HiveInterface] to load keys from. + /// + /// **returns**: + /// * `Future>`: The public and + /// private key pair + Future> loadKeyPair( + HiveInterface hive, + ) async { + final keysBox = await hive.openBox('user_keys'); + return keysBox.get('key_pair')!.keyPair; + } + + /// Encrypts the given string data with Recipient's Public Key. + /// + /// **params**: + /// * `data`: The string to encrypt + /// * `recipientPublicKey`: Key to be used to encrypt. Recipient's public + /// key in our case. + /// + /// **returns**: + /// * `String`: Encrypted string + String assymetricEncryptString(String data, RSAPublicKey recipientPublicKey) { + final cipher = OAEPEncoding(RSAEngine()) + ..init(true, PublicKeyParameter(recipientPublicKey)); + + final encryptedBytes = cipher.process(Uint8List.fromList(data.codeUnits)); + return base64Encode(encryptedBytes); + } + + /// Encrypts the given string data with user's Private Key. + /// + /// **params**: + /// * `data`: The string to decrypt + /// * `privateKey`: Key to be used to decrypt. User's private key in our case. + /// + /// **returns**: + /// * `String`: Decrypted string + String assymetricDecryptString(String data, RSAPrivateKey privateKey) { + final cipher = OAEPEncoding(RSAEngine()) + ..init(false, PrivateKeyParameter(privateKey)); + + final decryptedBytes = cipher.process(base64Decode(data)); + return String.fromCharCodes(decryptedBytes); + } + + // TODO: Use this somewhere + + /// Helper function to decrypt the message. + /// + /// Internally uses the [loadKeyPair] function to get private key and + /// [assymetricDecryptString] to decrypt the given message. + /// + /// **params**: + /// * `message`: Message object containing a field named [encryptedMessage] + /// which is supposed to contained user's message in encrypted format. + /// * `hive`: The [HiveInterface] to store things in. + /// + /// **returns**: + /// None + Future receiveMessage( + Map message, + HiveInterface hive, + ) async { + try { + final encryptedMessage = message['encryptedMessage'] as String; + final privateKey = (await loadKeyPair(hive)).privateKey; + final decryptedMessage = assymetricDecryptString( + encryptedMessage, + privateKey as RSAPrivateKey, + ); + + print('Decrypted Message: $decryptedMessage'); + } catch (e) { + throw Exception('Error'); + } + } +} diff --git a/lib/utils/event_queries.dart b/lib/utils/event_queries.dart new file mode 100644 index 000000000..749a664ab --- /dev/null +++ b/lib/utils/event_queries.dart @@ -0,0 +1,485 @@ +///This class creates queries related to the events. +class EventQueries { + /// Fetches events by organization ID. + /// + /// **params**: + /// * `orgId`: The ID of the organization to fetch events for. + /// + /// **returns**: + /// * `String`: Returns a GraphQL query string to fetch events associated with the specified organization ID. + /// + /// This function generates a GraphQL query string to retrieve events + /// based on the provided organization ID. + + String fetchOrgEvents(String orgId) { + return """ + query { + eventsByOrganizationConnection( + where: { + organization_id: "$orgId" + } + ) { + _id + organization { + _id + image + } + title + description + isPublic + isRegisterable + recurring + startDate + endDate + allDay + startTime + endTime + location + creator { + _id + firstName + lastName + } + admins { + _id + firstName + lastName + } + attendees { + _id + firstName + lastName + image + } + } + } + """; + } + + /// Fetches attendees by event ID. + /// + /// **params**: + /// * `eventId`: The ID of the event to fetch registrants for. + /// + /// **returns**: + /// * `String`: Returns a GraphQL query string to retrieve registrants associated with the specified event ID. + /// + /// This function generates a GraphQL query string to fetch registrants + /// based on the provided event ID. + String attendeesByEvent(String eventId) { + return ''' + query { + getEventAttendeesByEventId(eventId: "$eventId") { + eventId + userId + isRegistered + isInvited + isCheckedIn + isCheckedOut + } + } + '''; + } + + /// Creates a GraphQL mutation for adding an event. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to create an event. + /// + /// This function generates a GraphQL mutation string for creating an event. + String addEvent() { + return """ + mutation Mutation(\$data: EventInput!, \$recurrenceRuleData: RecurrenceRuleInput) { + createEvent(data: \$data, recurrenceRuleData: \$recurrenceRuleData) { + _id + title + description + } + } + """; + } + + /// Creates a GraphQL mutation for registering for an event. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to register for the specified event. + /// + /// This function generates a GraphQL mutation string for registering an individual for an event. + String registerForEvent() { + return """ + mutation registerForEvent(\$eventId: ID!) { + registerForEvent(id: \$eventId) { + _id + } + } + """; + } + + /// Creates a GraphQL mutation for deleting an event. + /// + /// **params**: + /// * `id`: The ID of the event to delete. + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to delete the specified event. + /// + /// This function generates a GraphQL mutation string for removing/deleting an event + /// based on the provided event ID. + String deleteEvent(String id) { + return """ + mutation { + removeEvent( + id: "$id", + ){ + _id + } + } + """; + } + + /// Creates a GraphQL mutation for updating an event. + /// + /// **params**: + /// * `eventId`: The ID of the event to update. + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to update the specified event. + /// + /// This function generates a GraphQL mutation string for updating an event + /// based on the provided parameters. It takes the event ID along with updated + /// details. + /// The mutation updates the event details and returns the ID, title, and description + /// of the updated event. + String updateEvent({ + eventId, + }) { + return """mutation updateEvent( + \$title:String!, + \$description: String!, + \$startTime: Time, + \$endTime: Time, + \$allDay: Boolean!, + \$recurring: Boolean!, + \$isPublic: Boolean!, + \$isRegisterable: Boolean!, + \$location: String, + ) { + updateEvent( + id: "$eventId" + data:{ + title: \$title, + description: \$description, + isPublic: \$isPublic, + isRegisterable: \$isRegisterable, + recurring: \$recurring, + allDay: \$allDay, + startTime: \$startTime + endTime: \$endTime + location: \$location + } + ){ + _id + title + description + } + }"""; + } + + /// Creates a GraphQL mutation for creating an event volunteer group. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to create an event volunteer group. + /// + /// This function generates a GraphQL mutation string for creating an event volunteer group. + String createVolunteerGroup() { + return ''' + mutation CreateEventVolunteerGroup(\$data: EventVolunteerGroupInput!) { + createEventVolunteerGroup(data: \$data) { + _id + name + volunteers{ + _id + } + createdAt + volunteersRequired + creator{ + _id + } + } + } + '''; + } + + /// Creates a GraphQL mutation for removing an event volunteer group. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to remove an event volunteer group. + /// + /// This function generates a GraphQL mutation string for removing an event volunteer group. + String removeEventVolunteerGroup() { + return ''' + mutation RemoveEventVolunteerGroup(\$id: ID!) { + removeEventVolunteerGroup(id: \$id) { + _id + name + } + } + '''; + } + + /// Creates a GraphQL mutation for adding a volunteer to a group. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to add a volunteer to a group. + /// + /// This function generates a GraphQL mutation string for adding a volunteer to a group. + String addVolunteerToGroup() { + return ''' + mutation CreateEventVolunteer(\$data: EventVolunteerInput!) { + createEventVolunteer(data: \$data) { + _id + isAssigned + response + creator{ + _id + } + group{ + _id + name + } + isInvited + user{ + _id + firstName + lastName + } + } + } + '''; + } + + /// Creates a GraphQL mutation for deleting a volunteer from a group. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to delete a volunteer to a group. + /// + /// This function generates a GraphQL mutation string for deleting a volunteer to a group. + String removeVolunteerMutation() { + return ''' + mutation RemoveEventVolunteer(\$id: ID!) { + removeEventVolunteer(id: \$id) { + _id + } + } + '''; + } + + /// Mutation to update volunteer group insatnce. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to update a volunteer group + String updateVolunteerGroupMutation() { + return ''' + mutation UpdateEventVolunteerGroup(\$id: ID!, \$data: UpdateEventVolunteerGroupInput!) { + updateEventVolunteerGroup(id: \$id, data: \$data) { + _id + name + volunteersRequired + } + } + '''; + } + + /// Fetches event volunteer groups based on criteria such as event ID. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL query string to fetch event volunteer groups that match the provided criteria. + String fetchVolunteerGroups() { + return ''' + query GetEventVolunteerGroups(\$where: EventVolunteerGroupWhereInput) { + getEventVolunteerGroups(where: \$where) { + _id + name + volunteersRequired + createdAt + volunteers{ + _id + response + user{ + _id + firstName + lastName + } + } + } + } + '''; + } + + /// Creates a GraphQL query for fetching agenda item categories by organization. + /// + /// **params**: + /// * `organizationId`: The ID of the organization to fetch agenda item categories for. + /// + /// **returns**: + /// * `String`: Returns a GraphQL query string to fetch agenda item categories. + String fetchAgendaItemCategoriesByOrganization(String organizationId) { + return """ + query { + agendaItemCategoriesByOrganization(organizationId: "$organizationId") { + _id + name + description + + } + } + """; + } + + /// Creates a GraphQL mutation for creating an agenda item. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to create an agenda item. + String createAgendaItem() { + return """ + mutation CreateAgendaItem(\$input: CreateAgendaItemInput!) { + createAgendaItem(input: \$input) { + _id + title + description + duration + attachments + createdBy { + _id + firstName + lastName + } + urls + categories { + _id + name + } + sequence + } + } + """; + } + + /// Creates a GraphQL mutation for updating an agenda item. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to update an agenda item. + String updateAgendaItem() { + return """ + mutation UpdateAgendaItem(\$updateAgendaItemId: ID! + \$input: UpdateAgendaItemInput! + ) { + updateAgendaItem(id: \$updateAgendaItemId, input: \$input) { + _id + title + description + duration + attachments + createdBy { + _id + firstName + lastName + } + urls + categories { + _id + name + } + sequence + } + } + """; + } + + /// Creates a GraphQL mutation for deleting an agenda item. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns a GraphQL mutation string to delete an agenda item. + String deleteAgendaItem() { + return """ + mutation RemoveAgendaItem(\$removeAgendaItemId: ID!) { + removeAgendaItem(id: \$removeAgendaItemId) { + _id + } + } + """; + } + + /// Creates a GraphQL query for fetching agenda items by organization. + /// + /// **params**: + /// * `relatedEventId`: The ID of the event to fetch agenda items for. + /// + /// **returns**: + /// * `String`: Returns a GraphQL query string to fetch agenda items. + String fetchAgendaItemsByEvent(String relatedEventId) { + return """ + query { + agendaItemByEvent(relatedEventId: "$relatedEventId") { + _id + title + description + duration + attachments + createdBy { + _id + firstName + lastName + } + urls + categories { + _id + name + } + sequence + organization { + _id + name + } + relatedEvent { + _id + title + } + } + } + """; + } +} diff --git a/lib/utils/globals.dart b/lib/utils/globals.dart deleted file mode 100644 index 3e8c459a3..000000000 --- a/lib/utils/globals.dart +++ /dev/null @@ -1,4 +0,0 @@ -//accessTokenException from server -String accessTokenException = "User is not authenticated: Undefined location"; -String refreshAccessTokenExpiredException = - "Access Token has expired. Please refresh session.: Undefined location"; diff --git a/lib/utils/gql_client.dart b/lib/utils/gql_client.dart deleted file mode 100644 index 32c6c13ba..000000000 --- a/lib/utils/gql_client.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:flutter/material.dart'; - -class GraphQLConfiguration with ChangeNotifier { - final Preferences _pref = Preferences(); - static String token; - static String orgURI; - -//prefix route for showing images - String displayImgRoute; - - getToken() async { - final id = await _pref.getToken(); - token = id; - } - - getOrgUrl() async { - final url = await _pref.getOrgUrl(); - orgURI = url; - httpLink = HttpLink( - uri: "${orgURI}graphql", - ); - final imgUrl = await _pref.getOrgImgUrl(); - displayImgRoute = imgUrl; - notifyListeners(); - print(orgURI); - } - - static HttpLink httpLink = HttpLink( - uri: "${orgURI}graphql", - ); - - static AuthLink authLink = AuthLink( - getToken: () async => 'Bearer $token', - ); - - static final Link finalAuthLink = authLink.concat(httpLink); - - GraphQLClient clientToQuery() { - return GraphQLClient( - cache: InMemoryCache(), - link: httpLink, - ); - } - - GraphQLClient authClient() { - getToken(); - return GraphQLClient( - cache: InMemoryCache(), - link: finalAuthLink, - ); - } -} diff --git a/lib/utils/graph_api.dart b/lib/utils/graph_api.dart deleted file mode 100644 index 95a7edb90..000000000 --- a/lib/utils/graph_api.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/uidata.dart'; - -class GraphAPI with ChangeNotifier { - //clears token and pages stack - Future logout(BuildContext context) async { - await Preferences.clearUser(); - Navigator.pushNamedAndRemoveUntil( - context, UIData.loginPageRoute, (r) => false); - } -} diff --git a/lib/utils/loghelper.dart b/lib/utils/loghelper.dart deleted file mode 100644 index 1d945781b..000000000 --- a/lib/utils/loghelper.dart +++ /dev/null @@ -1,126 +0,0 @@ -import 'dart:io'; - -import 'package:flutter_logs/flutter_logs.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:path_provider/path_provider.dart'; - -class LogHelper { - init() async { - await FlutterLogs.initLogs( - logLevelsEnabled: [ - LogLevel.INFO, - LogLevel.WARNING, - LogLevel.ERROR, - LogLevel.SEVERE - ], - timeStampFormat: TimeStampFormat.TIME_FORMAT_READABLE, - directoryStructure: DirectoryStructure.FOR_DATE, - logTypesEnabled: ["device", "network", "errors"], - logFileExtension: LogFileExtension.CSV, - logsWriteDirectoryName: "MyLogs", - logsExportDirectoryName: "MyLogs/Exported", - debugFileOperations: true, - isDebuggable: true, - attachTimeStamp: true, - autoClearLogs: true, - autoDeleteZipOnExport: true, - zipsRetentionPeriodInDays: 30, - logSystemCrashes: true, - ); - FlutterLogs.channel.setMethodCallHandler((call) async { - if (call.method == 'logsExported') { - final zipName = call.arguments.toString(); - Directory externalDirectory; - - if (Platform.isIOS) { - externalDirectory = await getApplicationDocumentsDirectory(); - } else { - externalDirectory = await getExternalStorageDirectory(); - } - - final File file = File("${externalDirectory.path}/$zipName"); - - if (file.existsSync()) { - // TODO: Make a api call to sever - // var responseCode = await ApiFunctions().sendLogs(file.path); - // if(responseCode == 200){ - - // } - Fluttertoast.showToast( - msg: "The Logs are saved in ${file.path}", - toastLength: Toast.LENGTH_LONG, - ); - } else { - FlutterLogs.logError( - "LogHelper", "init(logsExported)", "File not found in storage."); - } - } - }); - } - - log(LogLevel logLevel, String tag, String subTag, String logMessage, - {Error error, Exception exception}) { - switch (logLevel) { - case LogLevel.INFO: - if (error != null) { - FlutterLogs.logErrorTrace(tag, subTag, logMessage, error); - } else if (exception != null) { - FlutterLogs.logThis( - tag: tag, - subTag: subTag, - logMessage: logMessage, - exception: exception, - level: LogLevel.ERROR); - } else { - FlutterLogs.logInfo(tag, subTag, logMessage); - } - break; - case LogLevel.WARNING: - if (error != null) { - FlutterLogs.logErrorTrace(tag, subTag, logMessage, error); - } else if (exception != null) { - FlutterLogs.logThis( - tag: tag, - subTag: subTag, - logMessage: logMessage, - exception: exception, - level: LogLevel.ERROR); - } else { - FlutterLogs.logWarn(tag, subTag, logMessage); - } - break; - case LogLevel.ERROR: - if (error?.stackTrace != null) { - FlutterLogs.logErrorTrace(tag, subTag, logMessage, error); - } else if (exception != null) { - FlutterLogs.logThis( - tag: tag, - subTag: subTag, - logMessage: logMessage, - exception: exception, - level: LogLevel.ERROR); - } else { - FlutterLogs.logError(tag, subTag, logMessage); - } - break; - case LogLevel.SEVERE: - if (error?.stackTrace != null) { - FlutterLogs.logErrorTrace(tag, subTag, logMessage, error); - } else if (exception != null) { - FlutterLogs.logThis( - tag: tag, - subTag: subTag, - logMessage: logMessage, - exception: exception, - level: LogLevel.ERROR); - } else { - FlutterLogs.logError(tag, subTag, logMessage); - } - break; - } - } - - exportLogs() { - FlutterLogs.exportLogs(exportType: ExportType.WEEKS); - } -} diff --git a/lib/utils/package_info.dart b/lib/utils/package_info.dart deleted file mode 100644 index 4a9b224c3..000000000 --- a/lib/utils/package_info.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:package_info/package_info.dart'; - -class PackageDetails { - static Future> getInfo() async { - final packageInfo = await PackageInfo.fromPlatform(); - return { - 'appName': packageInfo.appName, - 'version': packageInfo.version, - 'buildNumber': packageInfo.buildNumber, - }; - } -} diff --git a/lib/utils/post_queries.dart b/lib/utils/post_queries.dart new file mode 100644 index 000000000..2b4a82ace --- /dev/null +++ b/lib/utils/post_queries.dart @@ -0,0 +1,225 @@ +///This class creates queries related to posts. +class PostQueries { + /// Getting Posts by Id. + /// + /// **params**: + /// * `orgId`: The organisation id + /// * `after`: The cursor after which the posts are to be fetched + /// * `before`: The cursor before which the posts are to be fetched + /// * `first`: The number of posts to be fetched from the start + /// * `last`: The number of posts to be fetched from the end + /// + /// **returns**: + /// * `String`: The query related to gettingPostsbyId + String getPostsById( + String orgId, + String? after, + String? before, + int? first, + int? last, + ) { + print(after); + final String? afterValue = after != null ? '"$after"' : null; + final String? beforeValue = before != null ? '"$before"' : null; + + return """ + query { + organizations(id: "$orgId") { + posts(first: $first, last:$last,after: $afterValue, before: $beforeValue) { + edges { + node { + _id + title + text + imageUrl + videoUrl + creator { + _id + firstName + lastName + email + } + createdAt + likeCount + commentCount + likedBy{ + _id + } + comments{ + _id + } + pinned + } + cursor + } + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + totalCount + } + } + } +"""; + } + + /// Getting Post by Post Id. + /// + /// **params**: + /// * `postId`: The post id + /// + /// **returns**: + /// * `String`: The query related to gettingPostsbyId + String getPostById(String postId) { + return """ + query { + post(id: "$postId") + { + _id + text + createdAt + imageUrl + videoUrl + title + commentCount + likeCount + creator{ + _id + firstName + lastName + image + } + organization{ + _id + } + likedBy{ + _id + } + comments{ + _id, + text, + createdAt + creator{ + firstName + lastName + } + } + } + } +"""; + } + + /// Add Like to a post. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: The query related to addingLike + String addLike() { + return """ + mutation likePost(\$postID: ID!) { + likePost( id: \$postID,) + { + _id + } + } + """; + } + + /// Remove Like from a post. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: The query related to removingLike + String removeLike() { + return """ + mutation unlikePost(\$postID: ID!) { + unlikePost( id: \$postID,) + { + _id + likedBy{ + _id + } + } + } + """; + } + + /// Upload a post to database. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: The query related to uploadingPost. + String uploadPost() { + return ''' + mutation CreatePost( + \$text: String! + \$title: String! + \$imageUrl: URL + \$videoUrl: URL + \$organizationId: ID! + \$file: String + ) { + createPost( + data: { + text: \$text + title: \$title + imageUrl: \$imageUrl + videoUrl: \$videoUrl + organizationId: \$organizationId + } + file: \$file + ) { + _id + text + createdAt + imageUrl + videoUrl + title + commentCount + likeCount + creator{ + _id + firstName + lastName + image + } + organization{ + _id + } + likedBy{ + _id + } + comments{ + _id + } + } + } + '''; + } + + /// Mutation to remove the post. + /// + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: query is returned + String removePost() { + return ''' + mutation RemovePost(\$id: ID!) { + removePost(id: \$id) { + _id + } + } + '''; + } +} diff --git a/lib/utils/queries.dart b/lib/utils/queries.dart new file mode 100644 index 000000000..7fc4783a5 --- /dev/null +++ b/lib/utils/queries.dart @@ -0,0 +1,616 @@ +///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. + /// * `selectedOrganization`: ID of the selected organization. + /// + /// **returns**: + /// * `String`: Return the mutation in string type to be passed to graphql client. + String registerUser( + String firstName, + String lastName, + String email, + String password, + String? selectedOrganization, + ) { + return """ + mutation{ + signUp(data: {firstName: "$firstName", lastName: "$lastName", email: "$email", password: "$password", selectedOrganization: "$selectedOrganization"}) + { + appUserProfile{ + adminFor{ + _id + name + } + createdOrganizations{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + } + user{ + _id + firstName + lastName + email + image + joinedOrganizations{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + membershipRequests{ + organization{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + } + } + refreshToken + accessToken + } + } + """; + } + + //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 { + login(data: {email: "$email", password: "$password"}){ + appUserProfile{ + adminFor{ + _id + name + } + createdOrganizations{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + } + user{ + _id + firstName + lastName + email + image + joinedOrganizations{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + membershipRequests{ + organization{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + } + } + refreshToken + accessToken + } + } + """; + } + + /// to update user profile. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: return a mutation + String updateUserProfile() { + return """ + mutation UpdateUserProfile( + \$firstName: String + \$lastName: String + \$email: EmailAddress + \$file: String + ) { + updateUserProfile( + data: { firstName: \$firstName, lastName: \$lastName, email: \$email } + file: \$file + ) { + _id + } + } + """; + } + + /// logout muiation. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: simple mutation + String logout() { + return """ + mutation { + logout + } + """; + } + + /// getter for joined org. + /// + String get fetchJoinInOrg { + return """ + query organizationsConnection(\$first: Int, \$skip: Int){ + organizationsConnection( + first: \$first, + skip: \$skip, + orderBy: name_ASC + ){ + image + _id + name + image + description + address{ + city + countryCode + state + } + userRegistrationRequired + creator{ + firstName + lastName + } + members{ + firstName + lastName + image + } + admins{ + firstName + lastName + image + } + } + } +"""; + } + + /// getter for fetchJoinInOrgByName. + String get fetchJoinInOrgByName { + return """ + query organizationsConnection( + \$first: Int, + \$skip: Int, + \$nameStartsWith: String + ){ + organizationsConnection( + where:{ + name_starts_with: \$nameStartsWith, + visibleInSearch: true, + userRegistrationRequired: true, + } + first: \$first, + skip: \$skip, + orderBy: name_ASC + ){ + image + _id + name + image + userRegistrationRequired + creator{ + firstName + lastName + } + } + } +"""; + } + + /// 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 { + joinPublicOrganization(organizationId: "$orgId") { + joinedOrganizations{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + + } + } + } + '''; + } + + /// 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 { + sendMembershipRequest(organizationId: "$orgId"){ + organization{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + } + } + '''; + } + + /// mutation in string form, to be passed on to graphql client.. + String fetchUserInfo = ''' + query Users(\$id: ID!){ + users(where: { id: \$id }) { + appUserProfile{ + adminFor{ + _id + name + } + createdOrganizations{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + } + user{ + _id + firstName + lastName + email + image + joinedOrganizations{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + membershipRequests{ + organization{ + _id + name + image + description + userRegistrationRequired + creator{ + _id + firstName + lastName + image + } + } + } + } + } + } + '''; + + /// 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{ + refreshToken(refreshToken: "$refreshToken"){ + accessToken + refreshToken + } + } + '''; + } + + /// 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 { + updateLanguage(languageCode: "$languageCode"){ + _id + firstName + appLanguageCode + } + } + '''; + } + + /// 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{ + organizations(id: "$orgId"){ + image + _id + name + image + userRegistrationRequired + creator{ + firstName + lastName + } + } + } + '''; + } + + /// query to fetch user lang. + /// + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: query in string form, to be passed on to graphql client. + String userLanguage() { + return ''' + query{ + myLanguage + } + '''; + } + + /// 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{ + userLanguage(userId:"$userId") + } + '''; + } + + /// 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{ + organizations(id: "$orgId"){ + image + _id + name + admins{ + _id + } + description + userRegistrationRequired + creator{ + _id + firstName + lastName + } + members{ + _id + firstName + lastName + image + } + } + } + '''; + } + + ///`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 { + getPlugins { + _id + pluginName + pluginCreatedBy + pluginDesc + pluginInstallStatus + installedOrgs + } +} + '''; + } + + /// `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, + String nameOfOrg, + String nameOfUser, + String payPalId, + double amount, + ) { + return ''' + mutation createDonationMutation { createDonation( + userId :"$userId" + orgId :"$orgId", + nameOfOrg:"$nameOfOrg", + nameOfUser:"$nameOfUser", + payPalId:"$payPalId" + amount :$amount + ){ + _id + payPalId + userId + orgId + payPalId + nameOfUser + } + } + '''; + } + + /// Query to get the list of Venues in an organisation. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Query in string form, to be passed to graphql client. + String venueListQuery() { + return """ + query GetVenueByOrgId(\$orgId: ID!, \$first: Int, \$orderBy: VenueOrderByInput, \$where: VenueWhereInput) { + getVenueByOrgId(orgId: \$orgId, first: \$first, orderBy: \$orderBy, where: \$where) { + _id + capacity + name + description + imageUrl + organization { + _id + } + } + } + """; + } +} diff --git a/lib/utils/time_conversion.dart b/lib/utils/time_conversion.dart new file mode 100644 index 000000000..103998d89 --- /dev/null +++ b/lib/utils/time_conversion.dart @@ -0,0 +1,162 @@ +import 'package:intl/intl.dart'; + +/// Combines the given date and time strings into a single string. +/// +/// **params**: +/// * `date`: The date string in a valid date format (e.g., 'YYYY-MM-DD'). +/// * `time`: The time string in a valid time format (e.g., 'HH:MM:SS'). +/// +/// **returns**: +/// * `String`: A string that combines the `date` and `time`, separated by a space. +String combineDateTime(String date, String time) { + return '$date $time'; +} + +/// Splits the given UTC date and time string into separate date and time strings. +/// +/// **params**: +/// * `dateTimeStr`: The UTC date and time string in a valid format. +/// +/// **returns**: +/// * `Map`: A map containing the separate date and time strings. +/// * Returns an empty map if the input is invalid. +Map splitDateTimeUTC(String dateTimeStr) { + try { + final DateTime dateTime = DateTime.parse(dateTimeStr); + return { + 'date': DateFormat('yyyy-MM-dd').format(dateTime), + 'time': DateFormat("HH:mm:ss.SSS'Z'").format(dateTime), + }; + } catch (e) { + print('Timezone Error parsing UTC date time: $e $dateTimeStr'); + return {}; + } +} + +/// Splits the given local date and time string into separate date and time strings. +/// +/// **params**: +/// * `dateTimeStr`: The local date and time string in a valid format. +/// +/// **returns**: +/// * `Map`: A map containing the separate date and time strings. +/// * Returns an empty map if the input is invalid. +Map splitDateTimeLocal(String dateTimeStr) { + try { + final DateTime dateTime = DateTime.parse(dateTimeStr); + return { + 'date': DateFormat('yyyy-MM-dd').format(dateTime), + 'time': DateFormat('HH:mm').format(dateTime), + }; + } catch (e) { + print('Timezone Error parsing local date time: $e $dateTimeStr'); + return {}; + } +} + +/// Converts the given UTC time to local time. +/// +/// **params**: +/// * `utcTime`: The UTC time string in a valid format. +/// +/// **returns**: +/// * `String`: The converted local time string. +/// * Returns an empty string if the input is invalid. +String convertUTCToLocal(String utcTime) { + try { + final DateTime dateTime = DateTime.parse(utcTime).toLocal(); + return DateFormat('yyyy-MM-ddTHH:mm:ss.SSS').format(dateTime); + } catch (e) { + print('Timezone Error converting UTC to local: $e $utcTime'); + return ''; + } +} + +/// Converts the given local time to UTC time. +/// +/// **params**: +/// * `localTime`: The local time string in a valid format. +/// +/// **returns**: +/// * `String`: The converted UTC time string. +/// * Returns an empty string if the input is invalid. +String convertLocalToUTC(String localTime) { + try { + final DateTime dateTime = DateTime.parse(localTime).toUtc(); + return DateFormat("yyyy-MM-ddTHH:mm:ss.SSS'Z'").format(dateTime); + } catch (e) { + print('Timezone Error converting local to UTC: $e $localTime'); + return ''; + } +} + +/// Traverses a nested map and converts date and time fields to the desired format. +/// +/// **params**: +/// * `obj`: The nested map to traverse and convert. +/// * `convertFn`: A function that converts a combined date and time string to the desired format. +/// * `splitFn`: A function that splits a converted date and time string into separate date and time strings. +/// +/// **returns**: +/// None +void traverseAndConvertDates( + Map obj, + String Function(String) convertFn, + Map Function(String) splitFn, +) { + obj.forEach((key, value) { + final pairedFields = + dateTimeFields['pairedFields']?.cast>(); + if (pairedFields != null) { + for (final field in pairedFields) { + if (key == field['dateField'] && obj.containsKey(field['timeField'])) { + final combinedDateTime = combineDateTime( + obj[field['dateField']] as String, + obj[field['timeField']] as String, + ); + + final convertedDateTime = convertFn(combinedDateTime); + + final splitDateTime = splitFn(convertedDateTime); + + obj[field['dateField'] ?? ''] = splitDateTime['date'] ?? ''; + obj[field['timeField'] ?? ''] = splitDateTime['time'] ?? ''; + } + } + } + + if (dateTimeFields['directFields']?.cast().contains(key) ?? false) { + obj[key] = convertFn(value as String); + } + + if (value is Map) { + traverseAndConvertDates(value, convertFn, splitFn); + } else if (value is List) { + for (final item in value) { + if (item is Map) { + traverseAndConvertDates(item, convertFn, splitFn); + } + } + } + }); +} + +/// Contains information about the date and time fields used for conversion. +const dateTimeFields = { + 'directFields': [ + 'createdAt', + 'birthDate', + 'updatedAt', + 'recurrenceStartDate', + 'recurrenceEndDate', + 'pluginCreatedBy', + 'dueDate', + 'completionDate', + 'startCursor', + 'endCursor', + ], + 'pairedFields': [ + {'dateField': 'startDate', 'timeField': 'startTime'}, + {'dateField': 'endDate', 'timeField': 'endTime'}, + ], +}; diff --git a/lib/utils/timer.dart b/lib/utils/timer.dart deleted file mode 100644 index 27a00ab5e..000000000 --- a/lib/utils/timer.dart +++ /dev/null @@ -1,62 +0,0 @@ -class Timer { - //takes a created date and returns time passed since then as a string - String hoursOrDays(String createdAt) { - String time = 'seconds'; - final DateTime now = DateTime.now(); - final Duration since = now - .difference(DateTime.fromMillisecondsSinceEpoch(int.parse(createdAt))); - int intTime = since.inSeconds; - if (since.inSeconds > 60) { - time = 'minutes'; - intTime = since.inMinutes; - } - if (since.inSeconds > 3600) { - time = 'hours'; - intTime = since.inHours; - } - if (since.inSeconds > 86400) { - time = 'days'; - intTime = since.inDays; - } - if (since.inSeconds > 604800) { - time = 'weeks'; - intTime = (since.inSeconds / 604800).round(); - } - if (since.inSeconds > 2.628e+6) { - time = 'months'; - intTime = (since.inSeconds / 2.628e+6).round(); - } - if (since.inSeconds > 3.154e+7) { - time = 'years'; - intTime = (since.inSeconds / 3.154e+7).round(); - } - return '$intTime $time ago'; - } - - isToday(DateTime date) { - final DateTime now = DateTime.now(); - if (DateTime(date.year, date.month, date.day) - .difference(DateTime(now.year, now.month, now.day)) - .inDays == - 0) { - return true; - } else { - return false; - } - } - - bool isSameDay(DateTime date1, DateTime date2) { - if (DateTime(date1.year, date1.month, date1.day) - .difference(DateTime(date2.year, date2.month, date2.day)) - .inDays == - 0) { - return true; - } else { - return false; - } - } - - bool isSameWeekDay(DateTime date1, DateTime date2) { - return date1.day % 7 == date2.day % 7; - } -} diff --git a/lib/utils/ui_scaling.dart b/lib/utils/ui_scaling.dart deleted file mode 100644 index ca78435f5..000000000 --- a/lib/utils/ui_scaling.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:flutter/widgets.dart'; - -class SizeConfig { - static MediaQueryData _mediaQueryData; - static double screenWidth; - static double screenHeight; - static double blockSizeHorizontal; - static double blockSizeVertical; - - static double _safeAreaHorizontal; - static double _safeAreaVertical; - static double safeBlockHorizontal; - static double safeBlockVertical; - - void init(BuildContext context) { - _mediaQueryData = MediaQuery.of(context); - screenWidth = _mediaQueryData.size.width; - screenHeight = _mediaQueryData.size.height; - blockSizeHorizontal = screenWidth / 100; - blockSizeVertical = screenHeight / 100; - - _safeAreaHorizontal = - _mediaQueryData.padding.left + _mediaQueryData.padding.right; - _safeAreaVertical = - _mediaQueryData.padding.top + _mediaQueryData.padding.bottom; - safeBlockHorizontal = (screenWidth - _safeAreaHorizontal) / 100; - safeBlockVertical = (screenHeight - _safeAreaVertical) / 100; - print("safeBlockHorizontal: $safeBlockHorizontal"); - print("safeBlockVertical: $safeBlockVertical"); - } -} diff --git a/lib/utils/uidata.dart b/lib/utils/uidata.dart deleted file mode 100644 index 2b20a5008..000000000 --- a/lib/utils/uidata.dart +++ /dev/null @@ -1,89 +0,0 @@ -import 'dart:math'; -import 'dart:ui'; - -import 'package:flutter/material.dart'; - -class UIData { - //routes - static const String homeRoute = "/home"; - static const String addActivityPage = "/addActivityPage"; - static const String addResponsibilityPage = "/addResponsibilityPage"; - static const String notFoundRoute = "/No Search Result"; - static const String activityDetails = "/activityDetails"; - static const String responsibilityPage = "/responsibilityPage"; - static const String contactPage = "/contactPage"; - static const String joinOrganizationPage = "/joinOrganization"; - static const String loginPageRoute = "/login"; - static const String createOrgPage = "/createOrgPage"; - static const String switchOrgPage = "/switchOrgPage"; - static const String profilePage = "/profilePage"; - - //strings - static const String appName = "Talawa"; - - //fonts - static const String quickFont = "Quicksand"; - static const String ralewayFont = "Raleway"; - static const String quickBoldFont = "Quicksand_Bold.otf"; - static const String quickNormalFont = "Quicksand_Book.otf"; - static const String quickLightFont = "Quicksand_Light.otf"; - - //images - static const String imageDir = "assets/images"; - static const String pkImage = "$imageDir/pk.jpg"; - static const String profileImage = "$imageDir/profile.jpg"; - static const String blankImage = "$imageDir/blank.jpg"; - static const String dashboardImage = "$imageDir/dashboard.jpg"; - static const String loginImage = "$imageDir/login.jpg"; - static const String paymentImage = "$imageDir/payment.jpg"; - static const String settingsImage = "$imageDir/setting.jpeg"; - static const String shoppingImage = "$imageDir/shopping.jpeg"; - static const String timelineImage = "$imageDir/timeline.jpeg"; - static const String verifyImage = "$imageDir/verification.jpg"; - static const String splashScreen = "$imageDir/splashscreen.jpg"; - static const String talawaLogo = "$imageDir/talawaLogo-noBg.png"; - static const String cloud1 = "$imageDir/cloud1.jpg"; - static const String talawaLogoDark = "$imageDir/talawaLogo-dark.png"; - static const String quitoBackground = "$imageDir/quitoBackground.jpg"; - - //gneric - static const String comingsoon = "Coming Soon"; - - // ignore: constant_identifier_names - static const MaterialColor ui_kit_color = Colors.grey; - static const lightGrey = Color.fromRGBO(242, 242, 242, 1); - - // static const Color quitoThemeColor = MaterialColor(0xFF7e1946, {50:Color.fromRGBO(126,25,70, .1), - // 100:Color.fromRGBO(126,25,70, .2), - // 200:Color.fromRGBO(126,25,70, .3), - // 300:Color.fromRGBO(126,25,70, .4), - // 400:Color.fromRGBO(126,25,70, .5), - // 500:Color.fromRGBO(126,25,70, .6), - // 600:Color.fromRGBO(126,25,70, .7), - // 700:Color.fromRGBO(126,25,70, .8), - // 800:Color.fromRGBO(126,25,70, .9), - // 900:Color.fromRGBO(126,25,70, 1)}); - static const Color primaryColor = Colors.orange; - static const Color secondaryColor = Colors.blueAccent; - -//colors - static List kitGradients = [ - // new Color.fromRGBO(103, 218, 255, 1.0), - // new Color.fromRGBO(3, 169, 244, 1.0), - // new Color.fromRGBO(0, 122, 193, 1.0), - Colors.green.shade800, - Colors.black87, - ]; - static List kitGradients2 = [ - Colors.cyan.shade600, - Colors.blue.shade900 - ]; - - //randomcolor - static final Random _random = Random(); - - /// Returns a random color. - static Color next() { - return Color(0xFF000000 + _random.nextInt(0x00FFFFFF)); - } -} diff --git a/lib/utils/user_info.dart b/lib/utils/user_info.dart deleted file mode 100644 index fda0da843..000000000 --- a/lib/utils/user_info.dart +++ /dev/null @@ -1,16 +0,0 @@ -class UserInfo { - static int userOrg = 0; - static List orgList = []; - - int get currentOrg => userOrg; - List get currentOrgList => orgList; - - set currentOrg(int val) { - userOrg = val; - } - - set currentOrgList(List val) { - orgList = val; - print(orgList); - } -} diff --git a/lib/utils/validator.dart b/lib/utils/validator.dart deleted file mode 100644 index 13b5454fc..000000000 --- a/lib/utils/validator.dart +++ /dev/null @@ -1,132 +0,0 @@ -import 'package:email_validator/email_validator.dart'; - -class Validator { - static String validateURL(String value) { - if (value.isEmpty) { - return 'Please verify URL first'.toUpperCase(); - } - return null; - } - - static String validateFirstName(String value) { - if (value.isEmpty) { - return 'Firstname must not be left blank.'; - } - return null; - } - - static String validateLastName(String value) { - if (value.isEmpty) { - return 'Lastname must not be left blank.'; - } - return null; - } - - static String validateEmail(String email) { - // If email is empty return. - if (email.isEmpty) { - return "Email must not be left blank"; - } - - final bool isValid = EmailValidator.validate(email); - if (!isValid) { - return 'Please enter a valid Email Address'; - } - return null; - } - - // static String validateEmail(String value) { - // bool emailDup = false; - // RegExp regExp = new RegExp( - // r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$", - // multiLine: false); - // if (!regExp.hasMatch(value)) { - // return 'E-mail Address must be a valid email address.'; - // } - // if(emailDup == true){ - // return 'E-mail Address already exists'; - // } - // return null; - // } - - static String validatePassword(String password) { - // If password is empty return. - if (password.isEmpty) { - return "Password must not be left blank"; - } - const String pattern = - r'^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[!@#\$&*%^~.]).{8,}$'; - final RegExp regExp = RegExp(pattern); - if (!regExp.hasMatch(password)) { - return "Invalid Password"; - } - return null; - } - - static String validatePasswordConfirm(String value, String comparator) { - if (value != comparator) { - return 'Password does not match original'; - } - return null; - } - - static String validateTitle(String value) { - if (value.length < 4) { - return 'Title must be at least 4 characters.'; - } - - return null; - } - - static String validateDateTime(DateTime value) { - if (value == null) { - return 'Date field must not be left blank.'; - } - - return null; - } - - static String validateDescription(String value) { - if (value.length < 5 || value.length > 50) { - return 'Description field must range between\n 5 and 30 characters'; - } - - return null; - } - - static String validateOrgName(String value) { - final String validatingValue = value.replaceAll(RegExp(r"\s+"), ""); - print(validatingValue.length); - if (validatingValue.isEmpty) { - return 'Organization Description must not be left blank.'; - } - if (value.length > 40) { - return 'Organization Name must not exceed 40 letters'; - } - return null; - } - - static String validateOrgDesc(String value) { - final String validatingValue = value.replaceAll(RegExp(r"\s+"), ""); - print(validatingValue.length); - if (validatingValue.isEmpty) { - return 'Organization Description must not be left blank.'; - } - if (value.length > 5000) { - return 'Organization Description must not exceed 5000 letters'; - } - return null; - } - - static String validateOrgAttendeesDesc(String value) { - final String validatingValue = value.replaceAll(RegExp(r"\s+"), ""); - print(validatingValue.length); - if (validatingValue.isEmpty) { - return 'Attendees Description must not be left blank.'; - } - if (value.length > 5000) { - return 'Attendees Description must not exceed 5000 letters'; - } - return null; - } -} diff --git a/lib/utils/validators.dart b/lib/utils/validators.dart new file mode 100644 index 000000000..bc38df304 --- /dev/null +++ b/lib/utils/validators.dart @@ -0,0 +1,194 @@ +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; + +///This class creats various validator methods for the application. +/// +///They are used to validate information given by the users. +class Validator { + /// Method to validate an organization's URL. + /// + /// **params**: + /// * `value`: the URL of the organization + /// + /// **returns**: + /// * `String?`: error message if URL is invalid. + static String? validateURL( + String value, + ) { + if (value.isEmpty) { + return 'Please verify URL first'; + } + final bool validURL = Uri.parse(value).isAbsolute; + if (!validURL) { + return 'Enter a valid URL'; + } + return null; + } + + /// Method to validate a user's first name. + /// + /// **params**: + /// * `value`: the value of the first name + /// + /// **returns**: + /// * `String?`: error message if first name is invalid. + static String? validateFirstName(String value) { + if (value.isEmpty) { + return 'Firstname must not be left blank.'; + } + // ignore: unnecessary_raw_strings + const String pattern = r'(?=.*?[A-Za-z]).+'; + final RegExp regex = RegExp(pattern); + if (!regex.hasMatch(value)) { + return "Invalid Firstname"; + } + return null; + } + + /// Method to validate a user's last name. + /// + /// **params**: + /// * `value`: the value of the last name + /// + /// **returns**: + /// * `String?`: error message if last name is invalid. + static String? validateLastName(String value) { + if (value.isEmpty) { + return 'Lastname must not be left blank.'; + } + // ignore: unnecessary_raw_strings + const String pattern = r"(?=.*?[A-Za-z]).+"; + final RegExp regex = RegExp(pattern); + if (!regex.hasMatch(value)) { + return "Invalid Lastname"; + } + return null; + } + + /// Method to validate a user's email. + /// + /// **params**: + /// * `email`: the entered email + /// + /// **returns**: + /// * `String?`: error message if email is invalid. + static String? validateEmail( + String email, + ) { + // If email is empty return. + if (email.isEmpty) { + return "Email must not be left blank"; + } + const String pattern = + r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$"; + final RegExp regex = RegExp(pattern); + if (!regex.hasMatch(email)) { + return 'Please enter a valid Email Address'; + } + return null; + } + + /// Method to validate password. + /// + /// **params**: + /// * `password`: the entered password + /// + /// **returns**: + /// * `String?`: error message if password is invalid. + static String? validatePassword( + String password, + ) { + // If password is empty return. + if (password.isEmpty) { + return "Password must not be left blank"; + } + const String pattern = + r'^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[!@#\$&*%^~.]).{8,}$'; + final RegExp regExp = RegExp(pattern); + + //Regex for no spaces allowed + const String noSpaces = r'^\S+$'; + final RegExp noSpaceRegex = RegExp(noSpaces); + + if (!noSpaceRegex.hasMatch(password)) { + return "Password must not contain spaces"; + } + if (!regExp.hasMatch(password)) { + return "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)"; + } + + return null; + } + + /// Method to valid password re-entered for confirmation. + /// + /// **params**: + /// * `value`: the entered password + /// * `comparator`: the original password + /// + /// **returns**: + /// * `String?`: error message if password is invalid. + static String? validatePasswordConfirm( + String value, + String comparator, + ) { + if (value != comparator) { + return 'Password does not match original'; + } + return null; + } + + /// Method to validate already exisiting URL. + /// + /// **params**: + /// * `url`: the entered URL + /// + /// **returns**: + /// * `Future`: true if URL exists, false otherwise. + Future validateUrlExistence(String url) async { + try { + await http.get(Uri.parse(url)); + return true; + } on Exception catch (e) { + debugPrint(e.toString()); + return false; + } + } + + /// Method to validate event form. + /// + /// **params**: + /// * `value`: the value of the field + /// * `label`: the (optional) label of the field + /// + /// **returns**: + /// * `String?`: error message if field is invalid. + static String? validateEventForm(String value, String? label) { + if (value.isEmpty) { + return '$label must not be left blank.'; + } + // ignore: unnecessary_raw_strings + const String pattern = r'(?=.*?[A-Za-z]).+'; + final RegExp regex = RegExp(pattern); + if (!regex.hasMatch(value)) { + return "Invalid $label"; + } + return null; + } + + /// Method to validate event time. + /// + /// **params**: + /// * `startTime`: the start time of the event + /// * `endTime`: the end time of the event + /// + /// **returns**: + /// * `String?`: error message if time is invalid. + static String? validateEventTime(TimeOfDay startTime, TimeOfDay endTime) { + if (startTime.hour > endTime.hour || + (startTime.hour == endTime.hour && startTime.minute > endTime.minute)) { + return 'Start time must be before or equal to end time'; + } + return null; + } +} diff --git a/lib/view_model/access_request_view_model.dart b/lib/view_model/access_request_view_model.dart new file mode 100644 index 000000000..e630a709a --- /dev/null +++ b/lib/view_model/access_request_view_model.dart @@ -0,0 +1,65 @@ +import 'package:flutter/cupertino.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'; + +/// 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**: + /// None + Future initialise(OrgInfo org) async { + selectedOrganization = org; + } + + /// Sending member ship request function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future sendMembershipRequest() async { + //TODO: Implement Message arg for below function + final result = await databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest(selectedOrganization.id!), + ); + if (result.data != null) { + final OrgInfo membershipRequest = OrgInfo.fromJson( + ((result.data!)['sendMembershipRequest'] + as Map)['organization'] as Map, + ); + 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, + ); + } + } + } +} 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 new file mode 100644 index 000000000..cba3edf28 --- /dev/null +++ b/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart @@ -0,0 +1,213 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/image_service.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +/// AddPostViewModel class have different functions. +/// +/// They are used to interact with the model to add a new post in the +/// organization. +class AddPostViewModel extends BaseModel { + AddPostViewModel({this.demoMode = false}); + + // Services + late MultiMediaPickerService _multiMediaPickerService; + late NavigationService _navigationService; + late ImageService _imageService; + + late File? _imageFile; + late String? _imageInBase64; + late OrgInfo _selectedOrg; + final TextEditingController _controller = TextEditingController(); + final TextEditingController _textHashTagController = TextEditingController(); + final TextEditingController _titleController = TextEditingController(); + + /// Whether the app is running in Demo Mode. + late bool demoMode; + + /// The image file that is to be uploaded. + /// + /// params: + /// None + /// returns: + /// * `File?`: The image file + File? get imageFile => _imageFile; + + /// Method to set image. + /// + /// + /// **params**: + /// * `file`: The file to set + /// + /// **returns**: + /// None + void setImageFile(File? file) { + _imageFile = file; + notifyListeners(); + } + + /// Getter to access the base64 type. + String? get imageInBase64 => _imageInBase64; + + /// Method to set Image in Bsse64. + /// + /// **params**: + /// * `file`: The file to convert. + /// + /// **returns**: + /// None + Future setImageInBase64(File file) async { + _imageInBase64 = await _imageService.convertToBase64(file); + notifyListeners(); + } + + /// The username of the currentUser. + String get userName => + userConfig.currentUser.firstName! + userConfig.currentUser.lastName!; + + /// User profile picture. + String? get userPic => userConfig.currentUser.image; + + /// The organisation name. + String get orgName => _selectedOrg.name!; + + /// The main text controller of the post body. + TextEditingController get controller => _controller; + + /// The main text controller of the hashtag. + TextEditingController get textHashTagController => _textHashTagController; + + /// The text controller of the title body. + TextEditingController get titleController => _titleController; + late DataBaseMutationFunctions _dbFunctions; + + /// This function is usedto do initialisation of stuff in the view model. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialise() { + _navigationService = locator(); + _imageFile = null; + _imageInBase64 = null; + _multiMediaPickerService = locator(); + _imageService = locator(); + if (!demoMode) { + _dbFunctions = locator(); + _selectedOrg = locator().currentOrg; + } + } + + /// 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. + /// + /// **returns**: + /// None + Future getImageFromGallery({bool camera = false}) async { + final image = + await _multiMediaPickerService.getPhotoFromGallery(camera: camera); + // convertImageToBase64(image!.path); + if (image != null) { + _imageFile = image; + // convertImageToBase64(image.path); + _imageInBase64 = await _imageService.convertToBase64(image); + // print(_imageInBase64); + _navigationService.showTalawaErrorSnackBar( + "Image is added", + MessageType.info, + ); + notifyListeners(); + } + } + + /// This function uploads the post finally, and navigate the success message or error message in Snack Bar. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future uploadPost() async { + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.postCreationFailed, + action: () async { + final variables = { + "text": "${_controller.text} #${_textHashTagController.text}", + "organizationId": _selectedOrg.id, + "title": _titleController.text, + if (_imageFile != null) + "file": 'data:image/png;base64,${_imageInBase64!}', + }; + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('addPostProgress'), + ), + ); + final result = await _dbFunctions.gqlAuthMutation( + PostQueries().uploadPost(), + variables: variables, + ); + return result; + }, + onValidResult: (result) async { + final Post newPost = Post.fromJson( + result.data!['createPost'] as Map, + ); + locator().addNewpost(newPost); + navigationService.pop(); + }, + apiCallSuccessUpdateUI: () { + _navigationService.showTalawaErrorSnackBar( + "Post is uploaded", + MessageType.info, + ); + }, + onActionException: (e) async { + print(e); + _navigationService.showTalawaErrorSnackBar( + "Upload failed: $e", + MessageType.error, + ); + }, + onActionFinally: () async { + removeImage(); + _controller.text = ""; + _titleController.text = ""; + notifyListeners(); + }, + ); + } + + /// This function removes the image selected. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void removeImage() { + _imageFile = null; + notifyListeners(); + } +} diff --git a/lib/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart b/lib/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart new file mode 100644 index 000000000..5a4db6a25 --- /dev/null +++ b/lib/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart @@ -0,0 +1,121 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:async'; + +import 'package:flutter/widgets.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/chats/chat_list_tile_data_model.dart'; +import 'package:talawa/models/chats/chat_message.dart'; +import 'package:talawa/models/chats/chat_user.dart'; +import 'package:talawa/services/chat_service.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// This ViewModel class have different functions that are used interact with model in the context of Direct Chat. +/// +/// Functions include: +/// * `initialise` : Initialise the states. +/// * `getChatMessages` : to get all the messages of a chat. +/// * `sendMessageToDirectChat` : to send the message to chat. +class DirectChatViewModel extends BaseModel { + final ChatService _chatService = locator(); + late StreamSubscription _chatListSubscription; + StreamSubscription? _chatMessageSubscription; + + final listKey = GlobalKey(); + + ChatState chatState = ChatState.initial; + + String? name; + + final Set _uniqueChatIds = {}; + final List _chats = []; + + List get chats => _chats; + + final Map> _chatMessagesByUser = {}; + + Map> get chatMessagesByUser => _chatMessagesByUser; + + /// This function refresh the chats. + void refreshChats() { + _chats.clear(); + _uniqueChatIds.clear(); + notifyListeners(); + _chatService.getDirectChatsByUserId(); + } + + // initialise + Future initialise() async { + setState(ViewState.busy); + chatState = ChatState.loading; + + _chatListSubscription = _chatService.chatListStream.listen((newChat) { + _uniqueChatIds.add(newChat.id!); + _chats.insert(0, newChat); + }); + + await _chatService.getDirectChatsByUserId(); + + chatState = ChatState.complete; + setState(ViewState.idle); + } + + /// This function get all messages for a chat. + /// + /// params: + /// * [chatId] : id of a chat for which messages need to be fetched. + Future getChatMessages(String chatId) async { + _chatMessagesByUser.clear(); + chatState = ChatState.loading; + // await _chatService.getMessagesFromDirectChat(); + // variable + final List messages = []; + _chatMessageSubscription = + _chatService.chatMessagesStream.listen((newMessage) { + messages.add(newMessage); + _chatMessagesByUser[chatId] = messages; + }); + // use `chatService` services + await _chatService.getDirectChatMessagesByChatId(chatId); + chatState = ChatState.complete; + notifyListeners(); + } + + /// This function send the message to Direct Chat. + /// + /// params: + /// * [chatId] : id of a chat where message need to be send. + /// * [messageContent] : content of a message. + Future sendMessageToDirectChat( + String chatId, + String messageContent, + ) async { + chatState = ChatState.loading; + _chatService.chatMessagesStream.listen((newMessage) { + _chatMessagesByUser[chatId]!.add(newMessage); + }); + await _chatService.sendMessageToDirectChat(chatId, messageContent); + chatState = ChatState.complete; + } + + @override + void dispose() { + _chatMessageSubscription?.cancel(); + _chatListSubscription.cancel(); + super.dispose(); + } + + // return chat name. + void chatName(chatId) { + final List users = + _chats.firstWhere((element) => element.id == chatId).users!; + + users.forEach((element) { + if (element.id != userConfig.currentUser.id!) { + name = element.firstName; + } + }); + } +} diff --git a/lib/view_model/after_auth_view_models/chat_view_models/select_contact_view_model.dart b/lib/view_model/after_auth_view_models/chat_view_models/select_contact_view_model.dart new file mode 100644 index 000000000..fe5e174df --- /dev/null +++ b/lib/view_model/after_auth_view_models/chat_view_models/select_contact_view_model.dart @@ -0,0 +1,43 @@ +import 'package:talawa/locator.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/org_service.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// SelectContactViewModel class have different functions to interact with model. +/// +/// Functions include: +/// * `getCurrentOrgUsersList` : to get all users of current organization. +class SelectContactViewModel extends BaseModel { + late OrganizationService _organizationService; + + /// orgMembersList is used to store all users of current organization. + late List orgMembersList = []; + + /// This function initializes the [SelectContactViewModel] class. + /// + /// more_info_if_required + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialise() { + _organizationService = locator(); + } + + /// function to get all users of current organization. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future getCurrentOrgUsersList() async { + if (orgMembersList.isEmpty) { + orgMembersList = await _organizationService + .getOrgMembersList(userConfig.currentOrg.id!); + notifyListeners(); + } + } +} diff --git a/lib/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart b/lib/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart new file mode 100644 index 000000000..6d7f44371 --- /dev/null +++ b/lib/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart @@ -0,0 +1,403 @@ +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:intl/intl.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_venue.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +/// CreateEventViewModel class have methods to interact with model in. +/// +/// the context of creating the event in the organization. +/// +/// Methods include: +/// * `createEvent` : to create an event. +/// * `getImageFromGallery` : to select image for a post. +/// * `removeImage` : to remove the image. +/// * `getCurrentOrgUsersList` : to get all user list of current organization. +/// * `removeUserFromList` : to remove a user from list. +class CreateEventViewModel extends BaseModel { + late MultiMediaPickerService _multiMediaPickerService; + late File? _imageFile; + + /// Event Title Text Controller. + TextEditingController eventTitleTextController = TextEditingController(); + + /// Event Location Text Controller. + TextEditingController eventLocationTextController = TextEditingController(); + + /// Event Description Text Controller. + TextEditingController eventDescriptionTextController = + TextEditingController(); + + /// Repeats Every count controller. + TextEditingController repeatsEveryCountController = + TextEditingController(text: '1'); + + /// Event ends After n occurences controller. + TextEditingController endOccurenceController = + TextEditingController(text: '1'); + + /// Event Start Time. + TimeOfDay eventStartTime = TimeOfDay.now(); + + /// Event End Time. + TimeOfDay eventEndTime = TimeOfDay.now().replacing( + hour: (TimeOfDay.now().hour + (TimeOfDay.now().minute >= 30 ? 1 : 0)) % 24, + minute: (TimeOfDay.now().minute + 30) % 60, + ); + + /// Event Start Date. + DateTime eventStartDate = DateTime.now(); + + /// Event End Date. + DateTime eventEndDate = DateTime.now(); + + /// Event Start Date for recurrence. + DateTime recurrenceStartDate = DateTime.now(); + + /// Event End Date for recurrence. + DateTime? recurrenceEndDate; + + /// Public Event or Not. + bool isPublicSwitch = true; + + /// If event is registerable after creation. + bool isRegisterableSwitch = true; + + /// TitleFocus FocusNode. + FocusNode titleFocus = FocusNode(); + + /// LocationFocus FocusNode. + FocusNode locationFocus = FocusNode(); + + /// DescriptionFocus FocusNode. + FocusNode descriptionFocus = FocusNode(); + + /// is an allday event. + bool isAllDay = true; + + /// Is a recurring event. + bool isRecurring = false; + + /// RecurrenceRuleData frequency. + String recurrenceInterval = EventIntervals.weekly; + + /// Event end type. + String eventEndType = EventEndTypes.never; + + /// represents the frequency of the event. + String frequency = Frequency.weekly; + + /// represents the week days of the event. + Set weekDays = { + days[DateTime.now().weekday - 1], + }; + + /// represents the interval of the event. + int interval = 1; + + /// represents the count of the event. + int? count; + + /// represents the week day occurence in Month. + int? weekDayOccurenceInMonth; + + /// represents the recurrence label. + String recurrenceLabel = 'Does not repeat'; + + //late OrganizationService _organizationService; + late final Map _memberCheckedMap = {}; + late final List _selectedMembers = []; + + /// Organisation Members List. + late List orgMembersList = []; + + /// Global FormKey. + final formKey = GlobalKey(); + final _eventService = locator(); + + /// AutoValidateMode default to disabled. + AutovalidateMode validate = AutovalidateMode.disabled; + + late OrgInfo _currentOrg; + final _userConfig = locator(); + + /// Getter to return selected members. + /// + /// params: + /// None + /// + /// returns: + /// * `List`: Returns a list of selectedMembers for events + List get selectedMembers => _selectedMembers; + + /// Getter to return members map. + /// + /// params: + /// None + /// + /// returns: + /// * `Map`: Returns a map of entries with id and boolean if they are + /// selected for events or not in bottom sheet. + Map get memberCheckedMap => _memberCheckedMap; + + /// Getter to return imageFile. + /// + /// params: + /// None + /// + /// returns: + /// * `File?`: Returns imageFile. + File? get imageFile => _imageFile; + + /// Function To Initialize. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialize() { + _currentOrg = _userConfig.currentOrg; + //_organizationService = locator(); + + _imageFile = null; + _multiMediaPickerService = locator(); + } + + /// This function is used to create the event for the organization. + /// + /// The function uses `database_mutation_functions` services to call the graphQL mutation + /// for creating an event and passes the required variables for the event. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future createEvent() async { + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.eventCreationFailed, + action: () async { + titleFocus.unfocus(); + locationFocus.unfocus(); + descriptionFocus.unfocus(); + validate = AutovalidateMode.always; + if (formKey.currentState!.validate()) { + validate = AutovalidateMode.disabled; + + // variables initialisation + final DateTime startTime = DateTime( + eventStartDate.year, + eventStartDate.month, + eventStartDate.day, + eventStartTime.hour, + eventStartTime.minute, + ); + final DateTime endTime = DateTime( + eventEndDate.year, + eventEndDate.month, + eventEndDate.day, + eventEndTime.hour, + eventEndTime.minute, + ); + // all required data for creating an event + final Map variables = { + "data": { + 'title': eventTitleTextController.text, + 'description': eventDescriptionTextController.text, + 'location': eventLocationTextController.text, + 'isPublic': isPublicSwitch, + 'isRegisterable': isRegisterableSwitch, + 'recurring': isRecurring, + 'allDay': isAllDay, + 'organizationId': _currentOrg.id, + 'startDate': DateFormat('yyyy-MM-dd').format(eventStartDate), + 'endDate': DateFormat('yyyy-MM-dd').format(eventEndDate), + 'startTime': + isAllDay ? null : DateFormat('HH:mm:ss').format(startTime), + 'endTime': + isAllDay ? null : DateFormat('HH:mm:ss').format(endTime), + }, + if (isRecurring) + 'recurrenceRuleData': { + 'recurrenceStartDate': DateFormat('yyyy-MM-dd').format( + recurrenceStartDate, + ), + 'recurrenceEndDate': recurrenceEndDate != null + ? DateFormat('yyyy-MM-dd').format(recurrenceEndDate!) + : null, + 'frequency': frequency, + 'weekDays': (frequency == Frequency.weekly || + (frequency == Frequency.monthly && + weekDayOccurenceInMonth != null)) + ? weekDays.toList() + : null, + 'interval': interval, + 'count': count, + 'weekDayOccurenceInMonth': weekDayOccurenceInMonth, + }, + }; + + print(variables); + + navigationService.pushDialog( + const CustomProgressDialog(key: Key('EventCreationProgress')), + ); + // invoke the `gqlAuthMutation` function of `databaseFunctions` + // service along with the mutation query and variable map. + final result = await _eventService.createEvent(variables: variables); + return result; + } + return databaseFunctions.noData; + }, + onValidResult: (result) async { + await _eventService.getEvents(); + }, + updateUI: () { + navigationService.pop(); + }, + apiCallSuccessUpdateUI: () { + navigationService.pop(); + }, + ); + } + + /// 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. + /// + /// **returns**: + /// None + Future getImageFromGallery({bool camera = false}) async { + final image = + await _multiMediaPickerService.getPhotoFromGallery(camera: camera); + if (image != null) { + _imageFile = image; + notifyListeners(); + } + } + + /// This function remove the selected image. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void removeImage() { + _imageFile = null; + notifyListeners(); + } + + /// This function fetch all the users in the current organization and return `List`. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future>`: Current Organization Users List + Future> getCurrentOrgUsersList() async { + if (orgMembersList.isEmpty) { + orgMembersList = await organizationService + .getOrgMembersList(userConfig.currentOrg.id!); + } + + // loop through list + orgMembersList.forEach((orgMember) { + _memberCheckedMap.putIfAbsent(orgMember.id!, () => false); + _memberCheckedMap.putIfAbsent(orgMember.id!, () => false); + }); + // return list + return orgMembersList; + } + + /// This function build the user list. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void buildUserList() { + _selectedMembers.clear(); + + // loop through the organization member list + + orgMembersList.forEach((orgMember) { + if (_memberCheckedMap[orgMember.id] == true) { + _selectedMembers.add(orgMember); + } + }); + notifyListeners(); + } + + /// This function is used to remove a user from user's list. + /// + /// **params**: + /// * `userId`: id of the user that need to be removed. + /// + /// **returns**: + /// None + void removeUserFromList({required String userId}) { + _selectedMembers.removeWhere((user) => user.id == userId); + _memberCheckedMap[userId] = false; + + notifyListeners(); + } + + /// Updates the event end date to selected event end date. + /// + /// **params**: + /// * `selectedEndDate`: new event end date selected by user. + /// + /// **returns**: + /// None + void setEventEndDate(DateTime selectedEndDate) { + eventEndDate = selectedEndDate; + notifyListeners(); + } + + /// Fetches the list of venues registered to an organisation. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future>`: Returns the list of venues in an organisation. + Future> fetchVenues() async { + final String query = queries.venueListQuery(); + final QueryResult result = await databaseFunctions.gqlAuthQuery( + query, + variables: { + "orgId": _currentOrg.id, + }, + ); + + if (result.data == null) { + return []; + } + final data = result.data!; + final List venuesList = data['getVenueByOrgId'] as List; + + final List venues = venuesList.map((venue) { + return Venue.fromJson(venue as Map); + }).toList(); + + return venues; + } +} diff --git a/lib/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart b/lib/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart new file mode 100644 index 000000000..3445fb506 --- /dev/null +++ b/lib/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart @@ -0,0 +1,230 @@ +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// a_line_ending_with_end_punctuation. +class EditAgendaItemViewModel extends BaseModel { + final _eventService = locator(); + final _multiMediaPickerService = locator(); + + late EventAgendaItem _agendaItem; + List _categories = []; + List _selectedCategories = []; + List _initialUrls = []; + List _currentUrls = []; + List _initialAttachments = []; + List _currentAttachments = []; + + /// Controller for the title input field. + TextEditingController titleController = TextEditingController(); + + /// Controller for the description input field. + TextEditingController descriptionController = TextEditingController(); + + /// Controller for the URL input field. + TextEditingController urlController = TextEditingController(); + + /// Controller for the duration input field. + TextEditingController durationController = TextEditingController(); + + /// Get the list of all available categories. + List get categories => _categories; + + /// Get the list of selected categories. + List get selectedCategories => _selectedCategories; + + /// Get the list of URLs for the agenda item. + List get urls => _currentUrls; + + /// Get the list of attachments for the agenda item. + List get attachments => _currentAttachments; + + /// aInitializes the ViewModel with the provided agenda item and categories. + /// + /// **params**: + /// * `agendaItem`: The [EventAgendaItem] to be edited. + /// * `categories`: List of all available [AgendaCategory] for the event. + /// + /// **returns**: + /// None + void initialize(EventAgendaItem agendaItem, List categories) { + _agendaItem = agendaItem; + _categories = categories; + _fillEditForm(); + } + + /// Populates the form with the current agenda item details. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void _fillEditForm() { + titleController.text = _agendaItem.title ?? ''; + descriptionController.text = _agendaItem.description ?? ''; + durationController.text = _agendaItem.duration ?? ''; + _initialUrls = List.from(_agendaItem.urls ?? []); + _currentUrls = List.from(_initialUrls); + _initialAttachments = List.from(_agendaItem.attachments ?? []); + _currentAttachments = List.from(_initialAttachments); + final agendaCategoryIds = + _agendaItem.categories?.map((cat) => cat.id).toList() ?? []; + + _selectedCategories = _categories + .where((category) => agendaCategoryIds.contains(category.id)) + .toList(); + notifyListeners(); + } + + /// Updates the selected categories in the form. + /// + /// **params**: + /// * `categories`: The list of selected [AgendaCategory]. + /// + /// **returns**: + /// None + void setSelectedCategories(List categories) { + _selectedCategories = categories; + notifyListeners(); + } + + /// Adds a URL to the agenda item. + /// + /// **params**: + /// * `url`: The URL string to be added. + /// + /// **returns**: + /// None + void addUrl(String url) { + if (url.isNotEmpty) { + _currentUrls.add(url); + notifyListeners(); + } + } + + /// Removes a URL from the agenda item. + /// + /// **params**: + /// * `url`: The URL string to be removed. + /// + /// **returns**: + /// None + void removeUrl(String url) { + _currentUrls.remove(url); + notifyListeners(); + } + + /// Removes an attachment from the agenda item. + /// + /// **params**: + /// * `image`: The base64 string representing the attachment to be removed. + /// + /// **returns**: + /// None + void removeAttachment(String image) { + _currentAttachments.remove(image); + notifyListeners(); + } + + /// Picks an attachment for the agenda item from the gallery or camera. + /// + /// **params**: + /// * `fromCamera`: If `true`, opens the camera to pick an image, otherwise opens the gallery. + /// + /// **returns**: + /// None + Future pickAttachment({bool fromCamera = false}) async { + final File? pickedFile = + await _multiMediaPickerService.getPhotoFromGallery(camera: fromCamera); + if (pickedFile != null) { + final base64PickedFile = await imageService.convertToBase64(pickedFile); + _currentAttachments.add(base64PickedFile); + notifyListeners(); + } + } + + /// Checks if there are any unsaved changes in the form. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `bool`: define_the_return + bool checkForChanges() { + final bool titleChanged = titleController.text != (_agendaItem.title ?? ''); + final bool descriptionChanged = + descriptionController.text != (_agendaItem.description ?? ''); + final bool durationChanged = + durationController.text != (_agendaItem.duration ?? ''); + + final selectedCategoryIds = + _selectedCategories.map((cat) => cat.id).toSet(); + final agendaCategoryIds = + _agendaItem.categories?.map((cat) => cat.id).toSet() ?? {}; + final bool categoriesChanged = + !setEquals(selectedCategoryIds, agendaCategoryIds); + + final bool urlsChanged = !listEquals(_initialUrls, _currentUrls); + final bool attachmentsChanged = + !listEquals(_initialAttachments, _currentAttachments); + + final bool hasChange = titleChanged || + descriptionChanged || + durationChanged || + categoriesChanged || + urlsChanged || + attachmentsChanged; + + return hasChange; + } + + /// Updates the agenda item with the modified values. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future updateAgendaItem() async { + try { + if (!checkForChanges()) return; + final List attachmentPaths = _currentAttachments; + final List categoryIds = + _selectedCategories.map((category) => category.id!).toList(); + + final updatedAgendaItem = { + 'title': titleController.text, + 'description': descriptionController.text, + 'duration': durationController.text, + 'attachments': attachmentPaths, + 'urls': _currentUrls, + 'categories': categoryIds, + }; + + await _eventService.updateAgendaItem( + _agendaItem.id!, + updatedAgendaItem, + ) as QueryResult; + } catch (e) { + print('Error updating agenda item: $e'); + } + } + + @override + void dispose() { + titleController.dispose(); + descriptionController.dispose(); + urlController.dispose(); + durationController.dispose(); + super.dispose(); + } +} diff --git a/lib/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart b/lib/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart new file mode 100644 index 000000000..1b870760d --- /dev/null +++ b/lib/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart @@ -0,0 +1,185 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +/// EditEventViewModel class have methods to interact with model in. +/// +/// the context of editing the event in the organization. +/// +/// Methods include: +/// * `updateEvent` : to update an event. +class EditEventViewModel extends BaseModel { + // Variable to hold the event details. + late Event _event; + + /// TextEditingController to handle the text input for the event title. + TextEditingController eventTitleTextController = TextEditingController(); + + /// TextEditingController to handle the text input for the event location. + TextEditingController eventLocationTextController = TextEditingController(); + + /// TextEditingController to handle the text input for the event description. + TextEditingController eventDescriptionTextController = + TextEditingController(); + + /// TimeOfDay to store the selected start time for the event. + TimeOfDay eventStartTime = TimeOfDay.now(); + + /// TimeOfDay to store the selected end time for the event. + TimeOfDay eventEndTime = TimeOfDay.now(); + + /// DateTime to store the selected start date for the event. + DateTime eventStartDate = DateTime.now(); + + /// DateTime to store the selected end date for the event. + DateTime eventEndDate = DateTime.now(); + + /// Boolean to indicate if the event is public or private. True means public. + bool isPublicSwitch = true; + + /// Boolean to indicate if the event requires registration. True means registration is required. + bool isRegisterableSwitch = false; + + /// FocusNode to manage focus for the event title text input field. + FocusNode titleFocus = FocusNode(); + + /// FocusNode to manage focus for the event location text input field. + FocusNode locationFocus = FocusNode(); + + /// FocusNode to manage focus for the event description text input field. + FocusNode descriptionFocus = FocusNode(); + + /// Form key for edit event. + final formKey = GlobalKey(); + + final _eventService = locator(); + + /// Validation flag. + AutovalidateMode validate = AutovalidateMode.disabled; + + /// Method to initialize the event and fill the edit form. + /// + /// **params**: + /// * `event`: An instance of `Event` that contains the details to initialize and fill the form. + /// + /// **returns**: + /// None + void initialize(Event event) { + _event = event; + _fillEditForm(); + } + + /// Method to populate the form fields with data from the provided event. + /// + /// This method initializes the text controllers and switches with values + /// from the `_event` instance. It also parses and sets the event's start and + /// end date and time. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void _fillEditForm() { + eventTitleTextController.text = _event.title!; + eventLocationTextController.text = _event.location!; + eventDescriptionTextController.text = _event.description!; + isPublicSwitch = _event.isPublic!; + isRegisterableSwitch = _event.isRegisterable!; + eventStartDate = DateFormat().add_yMd().parse(_event.startDate!); + eventEndDate = DateFormat().add_yMd().parse(_event.endDate!); + eventStartTime = + TimeOfDay.fromDateTime(DateFormat("h:mm a").parse(_event.startTime!)); + eventEndTime = + TimeOfDay.fromDateTime(DateFormat("h:mm a").parse(_event.endTime!)); + } + + /// Updates an existing event with the data from the form. + /// + /// This method performs the following actions: + /// 1. Unfocuses all text fields and sets form validation mode to always. + /// 2. Validates the form. If valid, it constructs a map of event details including + /// start and end dates and times, and other attributes. + /// 3. Displays a loading dialog while the API request is being processed. + /// 4. Calls the service method to update the event with the provided data. + /// 5. On success, navigates to the explore events screen. + /// 6. On success, also updates the UI and removes the loading dialog. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future updateEvent() async { + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.eventUpdateFailed, + action: () async { + titleFocus.unfocus(); + locationFocus.unfocus(); + descriptionFocus.unfocus(); + validate = AutovalidateMode.always; + if (formKey.currentState?.validate() ?? false) { + validate = AutovalidateMode.disabled; + final DateTime startTime = DateTime( + eventStartDate.year, + eventStartDate.month, + eventStartDate.day, + eventStartTime.hour, + eventStartTime.minute, + ); + final DateTime endTime = DateTime( + eventEndDate.year, + eventEndDate.month, + eventEndDate.day, + eventEndTime.hour, + eventEndTime.minute, + ); + // map for the required data to update an event. + final Map variables = { + 'title': eventTitleTextController.text, + 'description': eventDescriptionTextController.text, + 'location': eventLocationTextController.text, + 'isPublic': isPublicSwitch, + 'isRegisterable': isRegisterableSwitch, + 'recurring': false, + 'allDay': false, + 'startDate': DateFormat('yyyy-MM-dd').format(eventStartDate), + 'endDate': DateFormat('yyyy-MM-dd').format(eventEndDate), + 'startTime': '${DateFormat('HH:mm:ss').format(startTime)}Z', + 'endTime': '${DateFormat('HH:mm:ss').format(endTime)}Z', + }; + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('EditEventProgress'), + ), + ); + final result = await _eventService.editEvent( + eventId: _event.id!, + variables: variables, + ); + return result; + } + return databaseFunctions.noData; + }, + onValidResult: (result) async { + navigationService.removeAllAndPush( + Routes.exploreEventsScreen, + Routes.mainScreen, + arguments: MainScreenArgs(mainScreenIndex: 0, fromSignUp: false), + ); + }, + apiCallSuccessUpdateUI: () { + navigationService.pop(); + }, + ); + } +} diff --git a/lib/view_model/after_auth_view_models/event_view_models/event_calendar_view_model.dart b/lib/view_model/after_auth_view_models/event_view_models/event_calendar_view_model.dart new file mode 100644 index 000000000..f637ab537 --- /dev/null +++ b/lib/view_model/after_auth_view_models/event_view_models/event_calendar_view_model.dart @@ -0,0 +1,103 @@ +import 'package:flutter/scheduler.dart'; +import 'package:syncfusion_flutter_calendar/calendar.dart'; +import 'package:syncfusion_flutter_datepicker/datepicker.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// ViewModel for managing events and calendar view. +/// +/// This ViewModel handles operations related to events and calendar views. +class EventCalendarViewModel extends BaseModel { + /// List of events managed by the ViewModel. + late List _eventList = []; + + /// Controller for managing the calendar. + final CalendarController _calendarController = CalendarController(); + + /// Controller for managing the date range picker. + final DateRangePickerController _dateRangePickerController = + DateRangePickerController(); + + /// The current view of the calendar. + late CalendarView _calendarView; + + /// Getter for accessing the calendar controller. + CalendarController get calendarController => _calendarController; + + /// Getter for accessing the date range picker controller. + DateRangePickerController get dateRangePickerController => + _dateRangePickerController; + + /// Getter for accessing the current view of the calendar. + CalendarView get calendarView => _calendarView; + + /// Getter for accessing the current list of events. + List get eventList => _eventList; + + /// Initializes the view model. + /// + /// **params**: + /// * `eventList`: list of events. + /// + /// **returns**: + /// None + void initialize(List eventList) { + _eventList = eventList; + _calendarView = CalendarView.schedule; + } + + /// The function to triggered when the view is changed. + /// + /// **params**: + /// * `viewChangedDetails`: The dates that visible on the view changes in SfCalendar. type is ViewChangedDetails + /// + /// **returns**: + /// None + void viewChanged(ViewChangedDetails viewChangedDetails) { + SchedulerBinding.instance.addPostFrameCallback((timeStamp) { + _dateRangePickerController.selectedDate = + viewChangedDetails.visibleDates[0]; + _dateRangePickerController.displayDate = + viewChangedDetails.visibleDates[0]; + }); + } + + /// Changes the view of the calendar. + /// + /// **params**: + /// * `view`: String representing the desired view ("Day", "Month", "Schedule"). + /// + /// **returns**: + /// None + void changeView(String view) { + switch (view) { + case "Day": + _calendarView = CalendarView.day; + break; + case "Month": + _calendarView = CalendarView.month; + break; + case "Schedule": + _calendarView = CalendarView.schedule; + break; + default: + break; + } + calendarController.view = _calendarView; + notifyListeners(); + } + + /// function to be triggered when selection is changed. + /// + /// + /// **params**: + /// * `args`: Object of type DateRangePickerSelectionChangedArgs, The selected dates or ranges changes in the SfDateRangePicker. + /// + /// **returns**: + /// None + void selectionChanged(DateRangePickerSelectionChangedArgs args) { + SchedulerBinding.instance.addPostFrameCallback((timeStamp) { + _calendarController.displayDate = args.value as DateTime?; + }); + } +} diff --git a/lib/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart b/lib/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart new file mode 100644 index 000000000..8393c1624 --- /dev/null +++ b/lib/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart @@ -0,0 +1,383 @@ +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +/// EventInfoViewModel class helps interacting with model to serve view with the event information data. +class EventInfoViewModel extends BaseModel { + /// ExploreEventsViewModel instance to fetch the event data. + late ExploreEventsViewModel exploreEventsInstance; + + /// Event instance to store the event data. + late Event event; + + /// String type variable to store the FAB title. + late String fabTitle; + + /// List of Attendee type to store the attendees data. + late List attendees = []; + + late final List _volunteerGroups = []; + + /// List of volunteer groups of an event. + List get volunteerGroups => _volunteerGroups; + + late List _agendaItems = []; + + /// List of volunteer groups of an event. + List get agendaItems => _agendaItems; + + late List _categories = []; + late List _selectedCategories = []; + + /// List of Agenda categories in an organisation. + List get categories => _categories; + + /// List of selected Agenda categories for an agenda item. + List get selectedCategories => _selectedCategories; + + /// This function initializes the EventInfoViewModel class with the required arguments. + /// + /// **params**: + /// * `args`: A map of arguments required to initialize the EventInfoViewModel class. + /// + /// **returns**: + /// None + Future initialize({required Map args}) async { + event = args["event"] as Event; + exploreEventsInstance = + args["exploreEventViewModel"] as ExploreEventsViewModel; + fabTitle = getFabTitle(); + await fetchCategories(); + await fetchAgendaItems(); + selectedCategories.clear(); + setState(ViewState.busy); + attendees = event.attendees ?? []; + setState(ViewState.idle); + } + + /// The function allows user to register for an event. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future registerForEvent() async { + // if event registration is open and user not already registered for the event. + if (event.isRegisterable == true && event.isRegistered == false) { + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('RegisterEvent'), + ), + ); + + // use `registerForAnEvent` function provided by `EventService` service. + final registerResult = + await locator().registerForAnEvent(event.id!); + if (registerResult != null) { + event.isRegistered = true; + final userConfig = locator(); + attendees.add( + Attendee( + id: userConfig.currentUser.id, + firstName: userConfig.currentUser.firstName, + lastName: userConfig.currentUser.lastName, + image: userConfig.currentUser.image, + ), + ); + } + fabTitle = getFabTitle(); + navigationService.pop(); + notifyListeners(); + await locator().getEvents(); + } + } + + /// The funtion returns title to be displayed on Floating Action Button. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `String`: Returns the title to be displayed on Floating Action Button. + String getFabTitle() { + if (event.isRegisterable == false) { + return "Not Registrable"; + } else if (event.isRegistered == true) { + return "Registered"; + } else { + return "Register"; + } + } + + /// This function is used to create a new volunteer group for an event. + /// + /// **params**: + /// * `event`: Name of the group + /// * `groupName`: Name of the group + /// * `volunteersRequired`: Total number of volunteers required for the group + /// + /// **returns**: + /// * `Future`: returns the new volunteer group for an event + Future createVolunteerGroup( + Event event, + String groupName, + int volunteersRequired, + ) async { + try { + final variables = { + 'eventId': event.id, + 'name': groupName, + 'volunteersRequired': volunteersRequired, + }; + + final result = await locator() + .createVolunteerGroup(variables) as QueryResult; + + if (result.data == null || + result.data!['createEventVolunteerGroup'] == null) { + throw Exception('Failed to create volunteer group or no data returned'); + } + + final data = result.data!['createEventVolunteerGroup']; + final newGroup = + EventVolunteerGroup.fromJson(data as Map); + + _volunteerGroups.add(newGroup); + notifyListeners(); + + return newGroup; + } catch (e) { + print('Error creating volunteer group: $e'); + } + return null; + } + + /// Fetches all volunteer groups for the current event. + /// + /// **params**: + /// * `eventId`: The ID of the event to fetch volunteer groups for. + /// + /// **returns**: + /// None + Future fetchVolunteerGroups(String eventId) async { + try { + final result = + await locator().fetchVolunteerGroupsByEvent(eventId); + + _volunteerGroups.clear(); + _volunteerGroups.addAll(result); + notifyListeners(); + } catch (e) { + print('Error fetching volunteer groups: $e'); + setState(ViewState.idle); + } + } + + /// Method to fecth all agenda categories of an organisation. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future fetchCategories() async { + try { + final result = await locator() + .fetchAgendaCategories(userConfig.currentOrg.id!) as QueryResult; + + if (result.data == null) return; + + final List categoryJson = + result.data!['agendaItemCategoriesByOrganization'] as List; + _categories = categoryJson + .map((json) => AgendaCategory.fromJson(json as Map)) + .toList(); + + notifyListeners(); + } catch (e) { + print('Error fetching categories: $e'); + } + } + + /// method to select multiple categories. + /// + /// **params**: + /// * `categories`: define_the_param + /// + /// **returns**: + /// None + void setSelectedCategories(List categories) { + _selectedCategories = categories; + notifyListeners(); + } + + /// Method to fetch all agenda items of an organization. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future fetchAgendaItems() async { + try { + final result = await locator().fetchAgendaItems(event.id!) + as QueryResult; + + if (result.data == null) return; + final List agendaJson = result.data!['agendaItemByEvent'] as List; + _agendaItems = agendaJson + .map((json) => EventAgendaItem.fromJson(json as Map)) + .toList(); + _agendaItems.sort((a, b) => a.sequence!.compareTo(b.sequence!)); + notifyListeners(); + } catch (e) { + print('Error fetching agenda items: $e'); + } + } + + /// This function is used to create a new agenda item for an event. + /// + /// **params**: + /// * `title`: Title of the agenda item. + /// * `description`: Description of the agenda item (optional). + /// * `duration`: Duration of the agenda item. + /// * `attachments`: List of attachment URLs (optional). + /// * `urls`: List of related URLs (optional). + /// * `categories`: List of category IDs (optional). + /// * `sequence`: Sequence number of the agenda item. + /// * `itemType`: Type of the agenda item. + /// * `isNote`: Whether the agenda item is a note or not. + /// + /// **returns**: + /// * `Future`: Returns the new agenda item if creation is successful. + Future createAgendaItem({ + required String title, + String? description, + required String duration, + List? attachments, + List? urls, + List? categories, + int? sequence, + }) async { + try { + final variables = { + 'title': title, + 'description': description, + 'duration': duration, + 'attachments': attachments, + 'relatedEventId': event.id, + 'urls': urls, + 'categories': categories, + 'sequence': _agendaItems.length + 1, + 'organizationId': userConfig.currentOrg.id, + }; + final result = await locator().createAgendaItem(variables) + as QueryResult; + if (result.data == null || result.data!['createAgendaItem'] == null) { + throw Exception('Failed to create agenda item or no data returned'); + } + + final data = result.data!['createAgendaItem']; + + final newAgendaItem = + EventAgendaItem.fromJson(data as Map); + + _agendaItems.add(newAgendaItem); + selectedCategories.clear(); + notifyListeners(); + + return newAgendaItem; + } catch (e) { + print('Error creating agenda item: $e'); + } + return null; + } + + /// Method to delete an agenda item. + /// + /// more_info_if_required + /// + /// **params**: + /// * `id`: id of the gaenda item that is to be deleted + /// + /// **returns**: + /// None + Future deleteAgendaItem(String id) async { + try { + await locator() + .deleteAgendaItem({"removeAgendaItemId": id}); + _agendaItems.removeWhere((item) => item.id == id); + notifyListeners(); + } catch (e) { + print('Error deleting agenda item: $e'); + } + } + + /// Method to update the sequence of an agenda item. + /// + /// **params**: + /// * `itemId`: id of the agenda item whose sequence need to be updated + /// * `newSequence`: new sequence of the item + /// + /// **returns**: + /// None + Future updateAgendaItemSequence(String itemId, int newSequence) async { + try { + final result = await locator().updateAgendaItem( + itemId, + {'sequence': newSequence}, + ) as QueryResult; + + final updatedItem = EventAgendaItem.fromJson( + result.data!['updateAgendaItem'] as Map, + ); + final index = _agendaItems.indexWhere((item) => item.id == itemId); + if (index != -1) { + _agendaItems[index] = updatedItem; + notifyListeners(); + } + } catch (e) { + print('Error updating agenda item sequence: $e'); + } + } + + /// Method to redorder the sequence of agenda items. + /// + /// **params**: + /// * `oldIndex`: old index of the item + /// * `newIndex`: new index of the item + /// + /// **returns**: + /// None + Future reorderAgendaItems(int oldIndex, int newIndex) async { + int adjustedNewIndex = newIndex; + + if (oldIndex < adjustedNewIndex) { + adjustedNewIndex -= 1; + } + + final EventAgendaItem item = _agendaItems.removeAt(oldIndex); + _agendaItems.insert(adjustedNewIndex, item); + + // Update sequences for all items + for (int i = 0; i < _agendaItems.length; i++) { + final item = _agendaItems[i]; + if (item.sequence != i + 1) { + await updateAgendaItemSequence(item.id!, i + 1); + } + } + + notifyListeners(); + } +} diff --git a/lib/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart b/lib/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart new file mode 100644 index 000000000..9d3b73e37 --- /dev/null +++ b/lib/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart @@ -0,0 +1,273 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +/// ExploreEventsViewModel class helps to interact with model to serve data to view for event explore section. +/// +/// Methods include: +/// * `fetchNewEvents` : to fetch new events in the organization. +/// * `refreshEvents` : to refersh the event. +/// * `checkIfExistsAndAddNewEvent` : to check if the event exists or not, if now add a new event. +/// * `deleteEvent` : to delete the event. +/// * `choseValueFromDropdown` : to return the relevant message in the dropdown after any action. +class ExploreEventsViewModel extends BaseModel { + ExploreEventsViewModel({this.demoMode = false}); + + /// flag to check if the app is in demo mode. + bool demoMode; + + final _eventService = locator(); + StreamSubscription? _eventStreamSubscription; + + String _chosenValue = 'All Events'; + String _emptyListMessage = "Looks like there aren't any events."; + List _events = []; + final List _userEvents = []; + final Set _uniqueEventIds = {}; + late StreamSubscription _currentOrganizationStreamSubscription; + late final List _bufferEvents; + + /// Getter method to retrieve the list of events. + List get events => _events; + + /// Getter method to retrieve the list of User events. + List get userEvents => _userEvents; + + /// Getter method to retrieve the EventService instance. + EventService get eventService => _eventService; + + /// Getter method to retrieve the empty list message. + String get emptyListMessage => _emptyListMessage; + + /// Getter method to retrieve the chosen value. + String get chosenValue => _chosenValue; + + /// This function is used to fetch new events in the organization. + /// + /// The function uses `getEvents` method from `EventService`. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future fetchNewEvents() async { + setState(ViewState.busy); + notifyListeners(); + await _eventService.getEvents(); + setState(ViewState.idle); + } + + /// This function is used to refresh the events in the organization. + /// + /// The function uses `getEvents` method from `EventService`. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future refreshEvents() async { + setState(ViewState.busy); + _events.clear(); + _userEvents.clear(); + _uniqueEventIds.clear(); + await _eventService.getEvents(); + setState(ViewState.idle); + } + + /// initialiser. + /// + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future initialise() async { + setState(ViewState.busy); + if (!demoMode) { + _currentOrganizationStreamSubscription = userConfig.currentOrgInfoStream + .listen((updatedOrganization) => refreshEvents()); + + _eventStreamSubscription = _eventService.eventStream.listen( + (newEvents) => checkIfExistsAndAddNewEvents(newEvents), + ); + await _eventService.fetchEventsInitial(); + _bufferEvents = _events; + } + setState(ViewState.idle); + } + + /// This function add a new event if the event not exist. + /// + /// **params**: + /// * `newEvents`: `Event` type variable containing data to create a new event. + /// + /// **returns**: + /// None + Future checkIfExistsAndAddNewEvents(List newEvents) async { + // Check if the event is unique and belongs to the current organization + newEvents.forEach((newEvent) { + if (!_uniqueEventIds.contains(newEvent.id) && + newEvent.organization!.id == userConfig.currentOrg.id) { + _uniqueEventIds.add(newEvent.id!); + _events.insert(0, newEvent); + } + if (!_userEvents.any((event) => event.id == newEvent.id) && + newEvent.creator!.id == userConfig.currentUser.id) { + _userEvents.insert(0, newEvent); + } + }); + notifyListeners(); + } + + /// This function deletes the event. + /// + /// **params**: + /// * `eventId`: id of the event that need to be delete. + /// + /// **returns**: + /// None + Future deleteEvent({required String eventId}) async { + navigationService.pushDialog( + CustomAlertDialog( + reverse: true, + dialogSubTitle: 'Are you sure you want to delete this event?', + successText: 'Delete', + success: () async { + navigationService.pop(); // Close the confirmation dialog + navigationService.pushDialog( + const CustomProgressDialog(key: Key('DeleteEventProgress')), + ); + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.eventDeletionFailed, + action: () async { + Future>? result; + result = _eventService.deleteEvent(eventId); + return result; + }, + onValidResult: (result) async { + setState(ViewState.busy); + _uniqueEventIds.remove(eventId); + _events.removeWhere((element) => element.id == eventId); + _userEvents.removeWhere((element) => element.id == eventId); + await Future.delayed(const Duration(milliseconds: 500)); + navigationService.pop(); // Dismiss progress dialog + setState(ViewState.idle); + }, + updateUI: () async { + navigationService + .pop(); // Ensure progress dialog is popped in case of error + }, + ); + }, + ), + ); + } + + /// This function takes the choosen value from dropdown and return the filter events, if empty list then return relevant message. + /// + /// **params**: + /// * `value`: choosen value from dropdown. + /// + /// + /// **returns**: + /// None + Future choseValueFromDropdown(String value) async { + _chosenValue = value; + notifyListeners(); + setState(ViewState.busy); + + if (!demoMode) { + switch (_chosenValue) { + // if `_chosenValue` is "All events". + case 'All Events': + { + // all events + _events = _bufferEvents; + // if list is empty + _emptyListMessage = "Looks like there aren't any events."; + } + break; + // if `_chosenValue` is "created event". + case 'My Events': + { + // loop through the `_events` list and check + // for the creator id matched the current user id. + _events = List.from( + _bufferEvents.where( + (element) => element.creator!.id == userConfig.currentUser.id, + ), + ); + // if list is empty + _emptyListMessage = "You have not created any event."; + } + break; + // if `_chosenValue` is "Registered Events". + case 'Registered Events': + { + // loop through the `_events` list and filter elements + // if `element.isRegistered` is true and user is not the creator. + _events = List.from( + _bufferEvents.where( + (element) => + element.isRegistered == true && + element.creator!.id != userConfig.currentUser.id, + ), + ); + // if list is empty + _emptyListMessage = "No registered events are present"; + } + break; + // if `_chosenValue` is "Registered Events". + case 'Public Events': + { + // loop through the `_events` list and filter elements + // with the `isPublic` as true. + _events = _bufferEvents + .where((element) => element.isPublic == true) + .toList(); + + // if list is empty + _emptyListMessage = "There aren't any public events."; + } + break; + case 'Private Events': + { + // loop through the `_events` list and filter elements + // with the `isPublic` as false. + _events = _bufferEvents + .where((element) => element.isPublic == false) + .toList(); + // if list is empty + _emptyListMessage = "There aren't any private events."; + } + break; + + default: + { + _events = _bufferEvents; + } + } + } + await Future.delayed(const Duration(milliseconds: 500)); + setState(ViewState.idle); + } + + @override + void dispose() { + _eventStreamSubscription?.cancel(); + _currentOrganizationStreamSubscription.cancel(); + super.dispose(); + } +} diff --git a/lib/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart b/lib/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart new file mode 100644 index 000000000..bf0006ae1 --- /dev/null +++ b/lib/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart @@ -0,0 +1,205 @@ +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// A ViewModel for managing volunteer groups within an event. +/// +/// This class handles operations related to volunteer groups including +/// initializing the group, adding/removing volunteers, and updating group details. +class ManageVolunteerGroupViewModel extends BaseModel { + /// The event associated with the volunteer group. + late Event event; + + /// List of organization members. + late List orgMembersList = []; + + /// A map to track the selection state of organization members. + late final Map _memberCheckedMap = {}; + + /// Gets the map of member IDs and their selection state. + Map get memberCheckedMap => _memberCheckedMap; + + /// List of volunteers in the group. + List _volunteers = []; + + /// Gets the list of volunteers in the group. + List get volunteers => _volunteers; + + /// Indicates whether the view model is currently fetching volunteers. + final bool _isFetchingVolunteers = false; + + /// Gets whether the view model is currently fetching volunteers. + bool get isFetchingVolunteers => _isFetchingVolunteers; + + /// Initializes the view model with the given event and volunteer group. + /// + /// **params**: + /// * `parentEvent`: The event associated with the volunteer group. + /// * `group`: The volunteer group to be managed. + /// + /// **returns**: + /// None + Future initialize(Event parentEvent, EventVolunteerGroup group) async { + setState(ViewState.busy); + + event = parentEvent; + if (group.volunteers != null) { + _volunteers = List.from(group.volunteers!); + } + + setState(ViewState.idle); + } + + /// Fetches the list of current organization members. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future>`: A list of organization members. + Future> getCurrentOrgUsersList() async { + if (orgMembersList.isEmpty) { + orgMembersList = await organizationService + .getOrgMembersList(userConfig.currentOrg.id!); + } + final availableMembers = orgMembersList.where((member) { + return !volunteers.any((volunteer) => volunteer.user!.id == member.id); + }).toList(); + + for (final member in availableMembers) { + _memberCheckedMap.putIfAbsent(member.id!, () => false); + } + + return availableMembers; + } + + /// Adds a volunteer to the specified group. + /// + /// **params**: + /// * `volunteerId`: The ID of the volunteer to add. + /// * `eventId`: The ID of the event. + /// * `groupId`: The ID of the group. + /// + /// **returns**: + /// None + Future addVolunteerToGroup( + String volunteerId, + String eventId, + String groupId, + ) async { + try { + final variables = { + 'eventId': eventId, + 'userId': volunteerId, + 'groupId': groupId, + }; + final result = await locator() + .addVolunteerToGroup(variables) as QueryResult; + final data = result.data!; + final addedVolunteerData = + data['createEventVolunteer'] as Map; + final addedVolunteer = EventVolunteer.fromJson(addedVolunteerData); + _volunteers.add(addedVolunteer); + notifyListeners(); + } catch (e) { + print('Error adding volunteer to group: $e'); + } + } + + /// Deletes a volunteer group. + /// + /// **params**: + /// * `groupId`: The ID of the group to delete. + /// + /// **returns**: + /// None + Future deleteVolunteerGroup(String groupId) async { + try { + final variables = { + 'id': groupId, + }; + final result = await locator() + .removeVolunteerGroup(variables) as QueryResult; + final data = result.data; + + if (data != null && data['removeEventVolunteerGroup'] != null) { + notifyListeners(); + } + } catch (e) { + print('Error deleting volunteer group: $e'); + } + } + + /// Removes a volunteer from the group. + /// + /// **params**: + /// * `volunteerId`: The ID of the volunteer to remove. + /// + /// **returns**: + /// None + Future removeVolunteerFromGroup(String volunteerId) async { + try { + final variables = { + 'id': volunteerId, + }; + final result = await locator() + .removeVolunteerFromGroup(variables) as QueryResult; + final data = result.data; + + if (data != null && data['removeEventVolunteer'] != null) { + _volunteers.removeWhere((volunteer) => volunteer.id == volunteerId); + print('Volunteer removed successfully.'); + notifyListeners(); + } else { + print('Failed to remove volunteer.'); + } + } catch (e) { + print('Error removing volunteer: $e'); + } + } + + /// Updates the details of a volunteer group. + /// + /// **params**: + /// * `group`: The volunteer group to update. + /// * `eventId`: The ID of the event. + /// * `name`: The new name for the group. + /// * `volunteersRequired`: The new number of volunteers required. + /// + /// **returns**: + /// None + Future updateVolunteerGroup( + EventVolunteerGroup group, + String eventId, + String name, + int volunteersRequired, + ) async { + final variables = { + 'id': group.id, + 'data': { + 'eventId': eventId, + 'name': name, + 'volunteersRequired': volunteersRequired, + }, + }; + + try { + final result = await locator() + .updateVolunteerGroup(variables) as QueryResult; + + if (result.data != null) { + group.name = name; + group.volunteersRequired = volunteersRequired; + notifyListeners(); + } + } catch (e) { + print('Error updating volunteer group: $e'); + } + } +} diff --git a/lib/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart b/lib/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart new file mode 100644 index 000000000..011b25b3a --- /dev/null +++ b/lib/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart @@ -0,0 +1,332 @@ +import 'dart:async'; + +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/demo_server_data/pinned_post_demo_data.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// OrganizationFeedViewModel class helps to interact with model to serve data to view for organization feed section. +/// +/// Methods include: +/// * `setCurrentOrganizationName` : to set current organization name. +/// * `fetchNewPosts` : to fetch new posts in the organization. +/// * `navigateToIndividualPage` : to navigate to individual page. +/// * `navigateToPinnedPostPage` : to navigate to pinned post page. +/// * `addNewPost` : to add new post in the organization. +/// * `updatedPost` : to update a post in the organization. +class OrganizationFeedViewModel extends BaseModel { + // Local caching variables for a session. + // ignore: prefer_final_fields + List _posts = []; + final List _userPosts = []; + + /// flag for the test. + /// + bool istest = false; + List _pinnedPosts = + pinnedPostsDemoData.map((e) => Post.fromJson(e)).toList(); + final Set _renderedPostID = {}; + late String _currentOrgName = ""; + + // Importing services. + final NavigationService _navigationService = locator(); + final UserConfig _userConfig = locator(); + final PostService _postService = locator(); + + // Stream variables + late StreamSubscription _currentOrganizationStreamSubscription; + late StreamSubscription _postsSubscription; + late StreamSubscription _updatePostSubscription; + + // Getters + /// getter for the posts. + /// + List get posts { + // if (istest) { + // _posts = pinnedPostsDemoData.map((e) => Post.fromJson(e)).toList(); + // return _posts; + // } + return _posts; + } + + /// Getter for User Posts. + List get userPosts { + return _userPosts; + } + + /// getter for the pinned post. + /// + List get pinnedPosts { + if (istest) { + _pinnedPosts = []; + return _pinnedPosts; + } + return _pinnedPosts; + } + + /// getter for the currentOrgName. + /// + String get currentOrgName => _currentOrgName; + + bool _isFetchingPosts = false; + + /// getter for isFetchingPosts to show loading indicator. + bool get isFetchingPosts => _isFetchingPosts; + + /// This function sets the organization name after update. + /// + /// more_info_if_required + /// + /// **params**: + /// * `updatedOrganization`: updated organization name. + /// + /// **returns**: + /// None + void setCurrentOrganizationName(String updatedOrganization) { + // if `updatedOrganization` is not same to `_currentOrgName`. + if (updatedOrganization != _currentOrgName) { + _isFetchingPosts = true; + notifyListeners(); + _userPosts.clear(); + _posts.clear(); + _renderedPostID.clear(); + _currentOrgName = updatedOrganization; + notifyListeners(); + } + // _postService.getPosts(); + } + + /// This function fetches new posts in the organization. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void fetchNewPosts() { + _postService.refreshFeed(); + } + + /// To initialize the view model. + /// + /// more_info_if_required + /// + /// **params**: + /// * `isTest`: for test + /// + /// **returns**: + /// None + void initialise({ + bool isTest = false, + }) { + _isFetchingPosts = true; + + // For caching/initializing the current organization after the stream subscription has canceled and the stream is updated + _currentOrgName = _userConfig.currentOrg.name!; + // ------ + // Attaching the stream subscription to rebuild the widgets automatically + _currentOrganizationStreamSubscription = + _userConfig.currentOrgInfoStream.listen( + (updatedOrganization) => + setCurrentOrganizationName(updatedOrganization.name!), + ); + _postsSubscription = _postService.postStream.listen((newPosts) { + return buildNewPosts(newPosts); + }); + + _updatePostSubscription = + _postService.updatedPostStream.listen((post) => updatedPost(post)); + + _postService.fetchPostsInitial(); + if (isTest) { + istest = true; + } + _isFetchingPosts = false; + } + + // /// initializing the demo data. + // /// + // /// + // /// **params**: + // /// None + // /// + // /// **returns**: + // /// None + // void initializeWithDemoData() { + // // final postJsonResult = postsDemoData; + // // + // // ------ + // // // Calling function to ge the post for the only 1st time. + // // _postService.getPosts(); + // // + // // //fetching pinnedPosts + // // final pinnedPostJsonResult = pinnedPostsDemoData; + // // pinnedPostJsonResult.forEach((pinnedPostJsonData) { + // // _pinnedPosts.add(Post.fromJson(pinnedPostJsonData)); + // // }); + // } + + /// This function initialise `_posts` with `newPosts`. + /// + /// more_info_if_required + /// + /// **params**: + /// * `newPosts`: new post + /// + /// **returns**: + /// None + void buildNewPosts(List newPosts) { + _posts = newPosts; + final currentUserId = _userConfig.currentUser.id!; + _userPosts.clear(); + for (final post in newPosts) { + if (!_userPosts.any((element) => element.sId == post.sId) && + post.creator!.id == currentUserId) { + _userPosts.insert(0, post); + } + } + _isFetchingPosts = false; + notifyListeners(); + } + + /// This function navigate to individual post page.. + /// + /// **params**: + /// * `post`: define_the_param + /// + /// **returns**: + /// None + void navigateToIndividualPage(Post post) { + // uses `pushScreen` method by `navigationService` service. + _navigationService.pushScreen(Routes.individualPost, arguments: post); + } + + /// This function navigate to pinned post page. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void navigateToPinnedPostPage() { + // uses `pushScreen` method by `navigationService` service. + _navigationService.pushScreen( + Routes.pinnedPostPage, + arguments: _pinnedPosts, + ); + } + + @override + void dispose() { + // Canceling the subscription so that there will be no rebuild after the widget is disposed. + _currentOrganizationStreamSubscription.cancel(); + _postsSubscription.cancel(); + _updatePostSubscription.cancel(); + super.dispose(); + } + + /// This function adds new Post. + /// + /// **params**: + /// * `newPost`: define_the_param + /// + /// **returns**: + /// None + void addNewPost(Post newPost) { + _posts.insert(0, newPost); + notifyListeners(); + } + + /// This function updates the post. + /// + /// **params**: + /// * `post`: post object + /// + /// **returns**: + /// None + void updatedPost(Post post) { + for (int i = 0; i < _posts.length; i++) { + if (_posts[i].sId == post.sId) { + _posts[i] = post; + notifyListeners(); + break; + } + } + } + + /// function to remove the post. + /// + /// **params**: + /// * `post`: post object + /// + /// **returns**: + /// None + Future removePost(Post post) async { + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.postDeletionFailed, + action: () async { + final result = await _postService.deletePost(post); + return result; + }, + onValidResult: (result) async { + _posts.remove(post); + }, + apiCallSuccessUpdateUI: () { + navigationService.pop(); + navigationService.showTalawaErrorSnackBar( + 'Post was deleted if you had the rights!', + MessageType.info, + ); + notifyListeners(); + }, + ); + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.postDeletionFailed, + action: () async { + final result = await _postService.deletePost(post); + return result; + }, + onValidResult: (result) async { + _posts.remove(post); + }, + apiCallSuccessUpdateUI: () { + navigationService.pop(); + navigationService.showTalawaErrorSnackBar( + 'Post was deleted if you had the rights!', + MessageType.info, + ); + notifyListeners(); + }, + ); + } + + /// Method to fetch next posts. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void nextPage() { + _postService.nextPage(); + } + + /// Method to fetch previous posts. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void previousPage() { + _postService.previousPage(); + } +} 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 new file mode 100644 index 000000000..07a101f25 --- /dev/null +++ b/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart @@ -0,0 +1,182 @@ +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/services/user_profile_service.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// EditProfilePageViewModel class helps to interact with model to serve data to edit profile views. +/// +/// Methods include: +/// * `getImageFromGallery` +class EditProfilePageViewModel extends BaseModel { + /// current user. + final user = userConfig.currentUser; + late MultiMediaPickerService _multiMediaPickerService; + + /// profile image. + late File? imageFile; + + /// profile image in base64. + String? base64Image; + + /// first name controller. + late TextEditingController firstNameTextController; + + /// last name controller. + late TextEditingController lastNameTextController; + + /// Focus node tpo control focus. + FocusNode firstNameFocus = FocusNode(); + + /// Focus node tpo control focus. + FocusNode lastNameFocus = FocusNode(); + + /// Graphql client. + final databaseService = databaseFunctions; + + /// GetIt of user profile service. + final userProfileService = locator(); + + /// initialization function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialize() { + imageFile = null; + _multiMediaPickerService = locator(); + firstNameTextController = TextEditingController(text: user.firstName); + lastNameTextController = TextEditingController(text: user.lastName); + } + + /// 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. + /// + /// **returns**: + /// None + Future selectImage({bool camera = false}) async { + final image = + await _multiMediaPickerService.getPhotoFromGallery(camera: camera); + if (image != null) { + imageFile = image; + notifyListeners(); + } + } + + /// This function is used to convert the image into Base64 format. + /// + /// **params**: + /// * `file`: Takes the image in format of file. + /// + /// **returns**: + /// * `Future`: image in string format + Future convertToBase64(File file) async { + try { + base64Image = await imageService.convertToBase64(file); + return base64Image!; + } catch (error) { + print(error); + return ''; + } + } + + /// Method to update user profile. + /// + /// **params**: + /// * `firstName`: updated first name. + /// * `lastName`: updated last name. + /// * `newImage`: New profile picture that is to be updated. + /// + /// **returns**: + /// None + Future updateUserProfile({ + String? firstName, + String? lastName, + File? newImage, + }) async { + if (firstName == user.firstName && + newImage == null && + lastName == user.lastName) { + return; + } + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.userProfileUpdateFailed, + action: () async { + final Map variables = {}; + if (firstName != null) { + variables["firstName"] = firstName; + } + if (lastName != null) { + variables["lastName"] = lastName; + } + if (newImage != null) { + final String imageAsString = await convertToBase64(newImage); + print('data:image/png;base64,$imageAsString'); + variables["file"] = 'data:image/png;base64,$imageAsString'; + } + if (variables.isNotEmpty) { + await userProfileService.updateUserProfile(variables); + // Fetch updated user info from the database and save it in hivebox. + + final result = await userProfileService.getUserProfileInfo(user); + + return result; + } + return databaseFunctions.noData; + }, + onValidResult: (result) async { + final List users = result.data!['users'] as List; + + final User userInfo = User.fromJson( + users[0] as Map, + fromOrg: false, + ); + userInfo.authToken = userConfig.currentUser.authToken; + userInfo.refreshToken = userConfig.currentUser.refreshToken; + + await userConfig.updateUser(userInfo); + user.firstName = firstName ?? user.firstName; + user.lastName = lastName ?? user.lastName; + firstNameTextController.text = user.firstName!; + lastNameTextController.text = user.lastName!; + }, + apiCallSuccessUpdateUI: () { + notifyListeners(); + navigationService.showTalawaErrorSnackBar( + "Profile updated successfully", + MessageType.info, + ); + print('cccccccccccccccccccccccccccccccccccccccc'); + }, + onActionException: (_) async { + navigationService.showTalawaErrorSnackBar( + "Something went wrong", + MessageType.error, + ); + }, + ); + } + + /// This function remove the selected image. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void removeImage() { + imageFile = null; + notifyListeners(); + } +} diff --git a/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart b/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart new file mode 100644 index 000000000..b8444880b --- /dev/null +++ b/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart @@ -0,0 +1,295 @@ +import 'package:currency_picker/currency_picker.dart'; +import 'package:flutter/material.dart'; +import 'package:hive/hive.dart'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/custom_painters/talawa_logo.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; + +/// ProfilePageViewModel class helps to interact with model to serve data and react to user's input in Profile Page view. +/// +/// Methods include: +/// * `logout` +class ProfilePageViewModel extends BaseModel { + // Services + final _userConfig = locator(); + final _navigationService = locator(); + final _appLanguageService = locator(); + + /// GlobalKey for scaffoldKey. + final GlobalKey scaffoldKey = GlobalKey(); + + /// FocusNode for donationField. + final FocusNode donationField = FocusNode(); + + /// Text Controller for donation Amount. + TextEditingController donationAmount = TextEditingController(); + + /// Hive Box of user. + late final Box user; + + /// Hive Box of url. + late final Box url; + + /// Hive Box of organisation. + late final Box organisation; + + /// Holds Current Organization. + late OrgInfo currentOrg; + + /// Holds Current user. + late User currentUser; + + /// Size of Bottom Sheet Height. + double bottomSheetHeight = SizeConfig.screenHeight! * 0.68; + + /// donationCurrency. + String donationCurrency = "USD"; + + /// Currency Symbol. + String donationCurrencySymbol = "\$"; + + /// denomination. + final List denomination = ['1', '5', '10']; + + /// First function to initialize the viewmodel. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialize() { + setState(ViewState.busy); + currentOrg = _userConfig.currentOrg; + currentUser = _userConfig.currentUser; + setState(ViewState.idle); + } + + /// This method changes the currency of the user for donation purpose. + /// + /// **params**: + /// * `context`: BuildContext of the widget + /// * `setter`: Setter Function + /// + /// **returns**: + /// None + void changeCurrency( + BuildContext context, + void Function(void Function()) setter, + ) { + showCurrencyPicker( + context: context, + currencyFilter: supportedCurrencies, + onSelect: (Currency currency) { + setter(() { + donationCurrency = currency.code; + donationCurrencySymbol = currency.symbol; + }); + }, + ); + } + + /// This Function creates a QR Code for latest release . + /// + /// **params**: + /// * `context`: Build Context + /// + /// **returns**: + /// None + void invite(BuildContext context) { + _appLanguageService.initialize(); + final String qrData = + '${GraphqlConfig.orgURI}?orgid=${userConfig.currentOrg.id!}'; + + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20.0), + ), + child: Container( + padding: const EdgeInsets.all(20), + constraints: BoxConstraints( + maxHeight: MediaQuery.of(context).size.height * 0.80, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + iconButton( + CustomPaint( + size: const Size(48, 48 * 1), + painter: AppLogo(), + ), + () {}, + ), + const SizedBox(height: 20), + Text( + '${userConfig.currentOrg.name}', + style: const TextStyle( + fontSize: 22, + fontWeight: FontWeight.bold, + color: Colors.black87, + ), + ), + const SizedBox(height: 20), + QrImageView( + data: qrData, + version: QrVersions.auto, + size: 200.0, + ), + const SizedBox(height: 20), + Text( + AppLocalizations.of(context)!.strictTranslate('JOIN'), + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors.black87, + ), + ), + const SizedBox(height: 30), + ], + ), + ), + ); + }, + ); + } + + /// This widget returns the button for social media sharing option. + /// + /// **params**: + /// * `icon`: This is Widget type with icon details. + /// * `onTap`: This is Function which invoke on tap. + /// + /// **returns**: + /// * `Widget`: Icon Button + Widget iconButton(Widget icon, void Function() onTap) { + return Stack( + children: [ + IconButton( + key: const Key('iconbtn1'), + onPressed: () { + print('tapped'); + onTap(); + }, + icon: icon, + ), + ], + ); + } + + /// This widget returns button for domination. + /// + /// **params**: + /// * `amount`: donation Amount. + /// * `context`: BuildContext. + /// * `setter`: `Function` type, which on tap set the amount to `donationAmount`. + /// + /// **returns**: + /// * `Widget`: Icon Button + Widget dominationButton( + String amount, + BuildContext context, + void Function(void Function()) setter, + ) { + return InkWell( + key: Key('domBtn_$amount'), + onTap: () { + setter(() { + donationAmount.text = amount; + }); + }, + child: Container( + padding: EdgeInsets.symmetric( + vertical: SizeConfig.screenHeight! * 0.02, + horizontal: SizeConfig.screenWidth! * 0.075, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: donationAmount.text == amount + ? Theme.of(context).colorScheme.secondary + : Theme.of(context).colorScheme.primary, + ), + child: Text( + '$donationCurrencySymbol $amount', + style: Theme.of(context).textTheme.titleMedium, + ), + ), + ); + } + + /// This widget returns button for domination. + /// + /// **params**: + /// * `setter`: SetState holder. + /// + /// **returns**: + /// None + void attachListener(void Function(void Function()) setter) { + donationField.addListener(() { + if (donationField.hasFocus) { + setter(() { + bottomSheetHeight = SizeConfig.screenHeight! * 0.8725; + }); + } else { + Future.delayed(const Duration(milliseconds: 300), () { + { + setter(() { + bottomSheetHeight = SizeConfig.screenHeight! * 0.68; + }); + } + }); + } + }); + } + + /// pop the route from `navigationService`. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void popBottomSheet() { + _navigationService.pop(); + } + + /// to update the bottom sheet height. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void updateSheetHeight() { + bottomSheetHeight = SizeConfig.screenHeight! * 0.65; + notifyListeners(); + } + + /// show message on Snack Bar. + /// + /// **params**: + /// * `message`: String Message to show on snackbar + /// + /// **returns**: + /// None + void showSnackBar(String message) { + _navigationService.showTalawaErrorDialog(message, MessageType.error); + } +} diff --git a/lib/view_model/after_auth_view_models/settings_view_models/app_setting_view_model.dart b/lib/view_model/after_auth_view_models/settings_view_models/app_setting_view_model.dart new file mode 100644 index 000000000..2cafcf0c2 --- /dev/null +++ b/lib/view_model/after_auth_view_models/settings_view_models/app_setting_view_model.dart @@ -0,0 +1,32 @@ +import 'package:talawa/locator.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:url_launcher/url_launcher_string.dart'; + +/// ViewModel for the App Settings functionality. +/// +/// This ViewModel handles the logic and data for the application settings. +class AppSettingViewModel extends BaseModel { + // final _appLanguageService = locator(); + + /// This method destroys the user's session or sign out the user from app, The function asks for the confimation in Custom Alert Dialog. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future logout() async { + // push custom alert dialog with the confirmation message. + userConfig.userLogOut(); + } + + /// Launches a website using the provided URL. + /// + /// **params**: + /// * `url`: A [String] representing the URL of the website to be launched. + /// + /// **returns**: + /// * `Future`: A [Future] that resolves to a [bool] value indicating + /// whether the website launch was successful. + Future launchWebsite(String url) async => await launchUrlString(url); +} diff --git a/lib/view_model/base_view_model.dart b/lib/view_model/base_view_model.dart new file mode 100644 index 000000000..840d03bac --- /dev/null +++ b/lib/view_model/base_view_model.dart @@ -0,0 +1,17 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; + +class BaseModel extends ChangeNotifier { + ViewState _state = ViewState.idle; + + ViewState get state => _state; + bool get isBusy => _state == ViewState.busy; + + void setState(ViewState viewState) { + _state = viewState; + notifyListeners(); + } +} diff --git a/lib/view_model/connectivity_view_model.dart b/lib/view_model/connectivity_view_model.dart new file mode 100644 index 000000000..4b9bec469 --- /dev/null +++ b/lib/view_model/connectivity_view_model.dart @@ -0,0 +1,166 @@ +import 'dart:async'; + +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'package:talawa/exceptions/critical_action_exception.dart'; +import 'package:talawa/exceptions/graphql_exception_resolver.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// This class provides services related to network connectivity monitoring and handling. +/// +/// It leverages the `connectivity` package to track the device's internet connection status. +/// It offers methods to: +/// +/// * Initialize the AppConnectivity: [initialise] +/// * Subscribe to connectivity changes: [enableSubscription] +/// * Handle online and offline states: [handleOnline], [handleOffline] +/// * Handle the device's overall connectivity status: [handleConnection] +/// * Triggers the snackbar UI to show online status.: [showSnackbar] +class AppConnectivity extends BaseModel { + /// Stream from [ConnectivityService]. + late final Stream connectivityStream; + + /// Subscription of the [connectivityStream] + StreamSubscription? _subscription; + + /// flag to handle online status. + static late bool isOnline; + + /// Initializes the [AppConnectivity]. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future initialise() async { + await connectivityService.initConnectivity(client: http.Client()); + connectivityStream = connectivityService.connectionStream; + enableSubscription(); + handleConnection(await connectivityService.getConnectionType()); + } + + /// Subscribes to [connectivityStream] of [ConnectivityService]. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void enableSubscription() { + try { + _subscription = connectivityStream.listen((ConnectivityResult result) { + handleConnection(result); + }); + } catch (e) { + print("Error subscribing to connectivity stream: $e"); + } + } + + /// This function handles the device's connectivity status based on the provided [ConnectivityResult]. + /// + /// **params**: + /// * `result`: A [ConnectivityResult] indicating the current connectivity status. + /// + /// **returns**: + /// None + Future handleConnection(ConnectivityResult result) async { + if (![ConnectivityResult.none, ConnectivityResult.bluetooth] + .contains(result)) { + handleOnline(); + } else { + handleOffline(); + } + } + + /// This function handles the actions to be taken when the device is online. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future handleOnline() async { + isOnline = true; + showSnackbar(isOnline: true); + databaseFunctions.init(); + cacheService.offlineActionQueue.getActions().forEach((action) async { + final result = await action.execute(); + GraphqlExceptionResolver.encounteredExceptionOrError( + CriticalActionException('action done'), + ); + debugPrint(result.toString()); + }); + } + + /// This function handles the actions to be taken when the device is offline. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future handleOffline() async { + isOnline = false; + showSnackbar(isOnline: false); + databaseFunctions.init(); + } + + /// Triggers the snackbar UI to show online status. + /// + /// **params**: + /// * `isOnline`: online status of the device. + /// + /// **returns**: + /// None + static void showSnackbar({required bool isOnline}) { + final context = navigationService.navigatorKey.currentContext; + if (context != null) { + final TextStyle customStyle = Theme.of(context).textTheme.bodyMedium!; + if (isOnline) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + duration: const Duration(seconds: 5), + backgroundColor: Colors.green, + content: Text( + 'You are back online!', + style: customStyle, + ), + ), + ); + } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + duration: const Duration(seconds: 5), + backgroundColor: const Color.fromRGBO(65, 65, 66, 1), + content: RichText( + text: TextSpan( + children: [ + TextSpan( + text: 'You are ', + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith(color: Colors.white), + ), + TextSpan( + text: 'Offline!', + style: customStyle.copyWith(color: Colors.green), + ), + ], + ), + ), + ), + ); + } + } + } + + @override + void dispose() { + _subscription?.cancel(); + super.dispose(); + } +} diff --git a/lib/view_model/lang_view_model.dart b/lib/view_model/lang_view_model.dart new file mode 100644 index 000000000..53911ad04 --- /dev/null +++ b/lib/view_model/lang_view_model.dart @@ -0,0 +1,230 @@ +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// AppLanguage view model class interact with modal in the context of the App Language. +/// +/// The class provides methods that set's the language, change the language in the modal. +/// +/// Methods include: +/// * `fetchLocale` +/// * `changeLanguage` +/// * `selectLanguagePress` +/// * `dbLanguageUpdate` +/// * `appLanguageQuery` +/// * `userLanguageQuery` +class AppLanguage extends BaseModel { + AppLanguage({this.isTest = false}); + + /// Represents a boolean value indicating whether the current environment is a test environment. + final bool isTest; + + /// A service that provides navigation-related functionalities. + final navigationService = locator(); + + /// Functions related to database mutations. + final databaseFunctions = locator(); + + late Locale _appLocale; + + /// getter for appLocal. + Locale get appLocal => _appLocale; + + /// initialiser. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future initialize() async { + _appLocale = const Locale('en'); + await fetchLocale(); + } + + /// This function fetch the language of the user's app. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future fetchLocale() async { + final prefs = await SharedPreferences.getInstance(); + final String langCode = prefs.getString('language_code') ?? 'en'; + _appLocale = Locale(langCode); + + notifyListeners(); + } + + /// This function fetches the appropriate locale for the user's app based on the provided locale and supported locales. + /// + /// **params**: + /// * `locale`: (`Locale?`): The locale to be resolved. Can be null. + /// * `supportedLocales`: (`Iterable`): The list of supported locales in the app. + /// + /// **returns**: + /// * `Locale`: The resolved locale that matches either the language code or the country code of the provided locale. + /// If no match is found or the provided locale is null, the first supported locale is returned. + Locale localeResoultion(Locale? locale, Iterable supportedLocales) { + if (locale == null) { + debugPrint("*language locale is null!!!"); + return supportedLocales.first; + } + for (final Locale supportedLocale in supportedLocales) { + if (supportedLocale.languageCode == locale.languageCode || + supportedLocale.countryCode == locale.countryCode) { + return supportedLocale; + } + } + return supportedLocales.first; + } + + /// This function change the app default language. + /// + /// **params**: + /// * `type`: `Locale` type, the language need to be updated with. + /// + /// **returns**: + /// None + Future changeLanguage(Locale type) async { + // if the app language is of same [type]. + if (_appLocale == type) { + return; + } + + if (isTest) { + _appLocale = type; + } else { + final prefs = await SharedPreferences.getInstance(); + if (type == const Locale("es")) { + //If selected language is spanish + _appLocale = const Locale("es"); + await prefs.setString('language_code', 'es'); + await prefs.setString('countryCode', 'ES'); + } else if (type == const Locale("fr")) { + //If selected language is french + _appLocale = const Locale("fr"); + await prefs.setString('language_code', 'fr'); + await prefs.setString('countryCode', 'FR'); + } else if (type == const Locale("hi")) { + //If selected language is hindi + _appLocale = const Locale("hi"); + await prefs.setString('language_code', 'hi'); + await prefs.setString('countryCode', 'IN'); + } else if (type == const Locale("zh")) { + //If selected language is Chinese + _appLocale = const Locale("zh"); + await prefs.setString('language_code', 'zh'); + await prefs.setString('countryCode', 'CN'); + } else if (type == const Locale("de")) { + //If selected language is Chinese + _appLocale = const Locale("de"); + await prefs.setString('language_code', 'de'); + await prefs.setString('countryCode', 'GE'); + } else if (type == const Locale("ja")) { + //If selected language is Chinese + _appLocale = const Locale("ja"); + await prefs.setString('language_code', 'ja'); + await prefs.setString('countryCode', 'JP'); + } else if (type == const Locale("pt")) { + //If selected language is Chinese + _appLocale = const Locale("pt"); + await prefs.setString('language_code', 'pt'); + await prefs.setString('countryCode', 'PT'); + } else { + //If selected language is english + _appLocale = const Locale("en"); + await prefs.setString('language_code', 'en'); + await prefs.setString('countryCode', 'US'); + } + } + + /// notifying the consumers + notifyListeners(); + } + + /// Navigates the user after choosing lthe anguage. + /// + /// This function navigate user to `/appSettingsPage` route if the user + /// is authenticated else navigate to `demoMode - /MainScreenPage` route. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future selectLanguagePress() async { + if (userConfig.currentUser.id != 'null') { + dbLanguageUpdate(); + navigationService.popAndPushScreen('/appSettingsPage', arguments: ''); + } else { + navigationService.pushScreen( + Routes.mainScreen, + arguments: MainScreenArgs( + mainScreenIndex: 0, + fromSignUp: false, + toggleDemoMode: true, + ), + ); + } + } + + /// This function updates the Database Language by running the graphQL `mutations`. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future dbLanguageUpdate() async { + try { + await databaseFunctions + .gqlAuthMutation(queries.updateLanguage(_appLocale.languageCode)); + print('Language Updated in Database'); + } catch (e) { + print(e); + } + } + + /// Queries the app language. + /// + /// Performs graphQL query to check the app language. + /// The function uses `gqlAuthQuery` method provided by Database + /// Functions Services. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future appLanguageQuery() async { + try { + await databaseFunctions.gqlAuthQuery(queries.userLanguage()); + } catch (e) { + print(e); + } + } + + /// This function perform graphQL query to check the user's language in the database. + /// + /// The function uses `gqlAuthQuery` method provided by Database Functions Services. + /// + /// **params**: + /// * `userId`: user for which language need to be fetch. + /// + /// **returns**: + /// None + Future userLanguageQuery(String userId) async { + try { + await databaseFunctions.gqlAuthQuery(queries.newUserLanguage(userId)); + } catch (e) { + print(e); + } + } +} diff --git a/lib/view_model/main_screen_view_model.dart b/lib/view_model/main_screen_view_model.dart new file mode 100644 index 000000000..44830316f --- /dev/null +++ b/lib/view_model/main_screen_view_model.dart @@ -0,0 +1,761 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/app_tour.dart'; +import 'package:talawa/plugins/fetch_plugin_list.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +// import 'package:talawa/views/after_auth_screens/chat/chat_list_screen.dart'; +import 'package:talawa/views/after_auth_screens/events/explore_events.dart'; +import 'package:talawa/views/after_auth_screens/feed/organization_feed.dart'; +import 'package:talawa/views/after_auth_screens/profile/profile_page.dart'; +import 'package:talawa/views/demo_screens/explore_events_demo.dart'; +import 'package:talawa/views/demo_screens/organization_feed_demo.dart'; +import 'package:talawa/views/demo_screens/profile_page_demo.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; +import 'package:talawa/widgets/theme_switch.dart'; +import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; + +/// MainScreenViewModel class provide methods to interact with the modal to serve data in user's action in Main Screen Views. +/// +/// The functions in this class are +/// mainly in the context of Tutorials for different componenets of the App. +/// +/// Functions include: +/// * `showTutorial` +/// * `showHome` +/// * `tourEventTargets` +/// * `tourAddPost` +/// * `tourChat` +/// * `tourProfile` +class MainScreenViewModel extends BaseModel { + /// static variables. + static final GlobalKey scaffoldKey = + GlobalKey(); + + /// static variables. + final GlobalKey keyBNHome = GlobalKey(debugLabel: "HomeTab"); + + /// static variables. + final GlobalKey keyBNDemoHome = GlobalKey(debugLabel: "DemoHomeTab"); + + /// static variables. + final GlobalKey keySHPinnedPost = + GlobalKey(debugLabel: "HomeScreenPinnedPost"); + + /// static variables. + final GlobalKey keySHPost = GlobalKey(debugLabel: "HomeScreenPost"); + + /// static variables. + final GlobalKey keySHOrgName = GlobalKey(debugLabel: "HomeScreenOrgName"); + + /// static variables. + final GlobalKey keySHMenuIcon = GlobalKey(debugLabel: "HomeScreenMenuIcon"); + + /// static variables. + static final GlobalKey keyDrawerCurOrg = + GlobalKey(debugLabel: "DrawerCurrentOrg"); + + /// static variables. + static final GlobalKey keyDrawerSwitchableOrg = + GlobalKey(debugLabel: "DrawerSwitchableOrg"); + + /// static variables. + static final GlobalKey keyDrawerJoinOrg = + GlobalKey(debugLabel: "DrawerJoinOrg"); + + /// static variables. + static final GlobalKey keyDrawerLeaveCurrentOrg = + GlobalKey(debugLabel: "DrawerLeaveCurrentOr"); + + /// static variables. + final GlobalKey keyBNEvents = GlobalKey(debugLabel: "EventTab"); + + /// static variables. + final GlobalKey keyBNDemoEvents = GlobalKey(debugLabel: "DemoEventTab"); + + /// static variables. + final GlobalKey keySECategoryMenu = + GlobalKey(debugLabel: "EventScreenCategory"); + + /// static variables. + final GlobalKey keySEDateFilter = + GlobalKey(debugLabel: "EventScreenDateFilter"); + + /// static variables. + final GlobalKey keySEAdd = GlobalKey(debugLabel: "EventScreenAdd"); + + /// static variables. + final GlobalKey keySECard = GlobalKey(debugLabel: "EventScreenCard"); + + /// static variables. + final GlobalKey keyBNPost = GlobalKey(debugLabel: "PostTab"); + + /// static variables. + final GlobalKey keyBNDemoPost = GlobalKey(debugLabel: "DemoPostTab"); + + /// static variables. + final GlobalKey keyBNChat = GlobalKey(debugLabel: "ChatTab"); + + /// static variables. + final GlobalKey keyBNProfile = GlobalKey(debugLabel: "ProfileTab"); + + /// static variables. + final GlobalKey keyBNDemoProfile = GlobalKey(debugLabel: "DemoProfileTab"); + + /// static variables. + final GlobalKey keySPEditProfile = GlobalKey(debugLabel: "ProfileScreenEdit"); + + /// static variables. + final GlobalKey keySPAppSetting = + GlobalKey(debugLabel: "ProfileScreenAppSetting"); + + /// static variables. + final GlobalKey keySPHelp = GlobalKey(debugLabel: "ProfileScreenHelp"); + + /// static variables. + final GlobalKey keySPDonateUs = + GlobalKey(debugLabel: "ProfileScreenDonateUs"); + + /// static variables. + final GlobalKey keySPInvite = GlobalKey(debugLabel: "ProfileScreenInvite"); + + /// static variables. + final GlobalKey keySPLogout = GlobalKey(debugLabel: "ProfileScreenLogout"); + + /// static variables. + final GlobalKey keySPPalisadoes = + GlobalKey(debugLabel: "ProfileScreenPalisadoes"); + + /// bool to determine if we wanna show the apptour. + late bool showAppTour; + + /// bool to determine if apptour is complete. + bool tourComplete = false; + + /// bool to determine if apptour is skipped. + bool tourSkipped = false; + + /// context consist of parent info. + late BuildContext context; + + /// tutorialCoachMark consist of coach used to give tutorial. + late AppTour appTour = AppTour(model: this); + + /// array of target. + final List targets = []; + + /// flag to represent if app is in demoMode. + static bool demoMode = false; + + /// flag to represent if app is in testMode. + bool testMode = false; + + /// Initalizing function. + /// + /// **params**: + /// * `ctx`: BuildContext, contain parent info + /// * `fromSignUp`: Bool to find user entry + /// * `mainScreenIndex`: Index to find tab on mainScreen + /// * `demoMode`: Whether the app is in demo mode + /// * `testMode`: Whether the app is in test mode + /// + /// **returns**: + /// None + void initialise( + BuildContext ctx, { + required bool fromSignUp, + required int mainScreenIndex, + bool demoMode = false, + bool testMode = false, + }) { + this.testMode = testMode; + MainScreenViewModel.demoMode = demoMode; + currentPageIndex = mainScreenIndex; + showAppTour = fromSignUp || demoMode; + context = ctx; + + print(ctx); + print(context); + pluginPrototypeData = { + "Donation": { + "icon": Icons.attach_money_outlined, + "page": const ChangeThemeTile(), + }, + }; + + notifyListeners(); + if (!showAppTour) { + tourComplete = true; + tourSkipped = false; + } else { + Future.delayed( + const Duration(seconds: 1), + () => navigationService.pushDialog( + appTourDialog(ctx), + ), + ); + } + } + + /// Contains the Widgets to be rendered for corresponding navbar items. + /// + /// Features that should be implemented as plugins should be kept here. + List pages = []; + + /// Actual [BottomNavigationBarItem]s that show up on the screen. + List navBarItems = []; + + /// Maps the feature names with their proper Icon and Page. + /// + /// `icon` contains the [IconData] corresponding to plugin's icon. + /// `page` contains the corresponding page to be displayed. + /// Name of the feature provided by the admin must [exactly] match with the. + /// name stored here. + Map pluginPrototypeData = {}; + + /// list of all the pluginList. + List pluginList = []; + + /// Dynamically adds [BottomNavigationBarItems] in `BottomNavigationBar`. + /// + /// by mapping over the data received from the server. + /// + /// **params**: + /// * `context`: its the same context you use everywhere in the flutter framework refer flutter docs for more info. + /// + /// **returns**: + /// None + void fetchAndAddPlugins( + BuildContext context, + ) { + navBarItems = [ + BottomNavigationBarItem( + icon: Icon( + Icons.home, + key: keyBNHome, + ), + label: AppLocalizations.of(context)!.strictTranslate('Home'), + ), + BottomNavigationBarItem( + icon: Icon( + Icons.event_note, + key: keyBNEvents, + ), + label: AppLocalizations.of(context)!.strictTranslate('Events'), + ), + + /// Makes chat inaccessible for the user + //TODO: add chat functionality + // BottomNavigationBarItem( + // icon: Icon( + // Icons.chat_outlined, + // key: keyBNChat, + // ), + // label: AppLocalizations.of(context)!.strictTranslate('Chat'), + // ), + BottomNavigationBarItem( + icon: Icon( + Icons.account_circle, + key: keyBNProfile, + ), + label: AppLocalizations.of(context)!.strictTranslate('Profile'), + ), + ]; + + if (!demoMode) { + pages = [ + OrganizationFeed( + key: const Key("HomeView"), + homeModel: this, + ), + ExploreEvents( + key: const Key('ExploreEvents'), + homeModel: this, + ), + // AddPost( + // key: const Key('AddPost'), + // drawerKey: MainScreenViewModel.scaffoldKey, + // ), + // const ChatPage( + // key: Key('Chats'), + // ), + ProfilePage( + key: keySPEditProfile, + homeModel: this, + ), + ]; + pluginList = + (Hive.box('pluginBox').get('plugins') ?? []) as List; + + print(pluginPrototypeData); + pluginList.forEach((plugin) { + if (pluginPrototypeData.containsKey( + (plugin as Map)["pluginName"] as String, + ) && + plugin["pluginInstallStatus"] as bool) { + navBarItems.add( + BottomNavigationBarItem( + icon: Icon( + (pluginPrototypeData[plugin["pluginName"]] + as Map)["icon"] as IconData, + ), + label: AppLocalizations.of(context)!.strictTranslate( + plugin["pluginName"] as String, + ), + ), + ); + pages.add( + (pluginPrototypeData[plugin["pluginName"]] + as Map)["class"] as StatelessWidget, + ); + } + }); + + /// Causes the app check the plugins updates in every 300 sec + /// + /// updated and re-render the navbar + Timer.periodic(Duration(seconds: (testMode ? 1 : 300)), (timer) { + FetchPluginList(); + final newPluginList = + (Hive.box('pluginBox').get('plugins') ?? []) as List; + + if (listEquals(pluginList, newPluginList)) { + // notifyListeners(); + } + if (testMode) timer.cancel(); + }); + } else { + pages = [ + DemoOrganizationFeed( + key: const Key("DemoHomeView"), + homeModel: this, + ), + DemoExploreEvents( + key: const Key('DemoExploreEvents'), + homeModel: this, + ), + // DemoAddPost( + // key: const Key('DemoAddPost'), + // drawerKey: MainScreenViewModel.scaffoldKey, + // ), + // const ChatPage( + // key: Key('Chats'), + // ), + DemoProfilePage( + key: const Key('DemoProfile'), + homeModel: this, + ), + ]; + } + } + + /// var for current page in index. + int currentPageIndex = 0; + + /// Handles click on [BottomNavigationBarItem]. + /// + /// **params**: + /// * `index`: it is track of current page index. + /// + /// **returns**: + /// None + void onTabTapped(int index) { + currentPageIndex = index; + notifyListeners(); + } + + /// Builds and returns an AppTourDialog. + /// + /// **params**: + /// * `ctx`: The build context to work with. + /// + /// **returns**: + /// * `Widget`: The built [Dialog] + Widget appTourDialog(BuildContext ctx) { + return CustomAlertDialog( + dialogTitle: 'App Tour', + dialogSubTitle: 'Start app tour to know talawa functioning', + successText: 'Start', + secondaryButtonText: 'Skip', + success: () { + navigationService.pop(); + print(MainScreenViewModel.scaffoldKey.currentState?.isDrawerOpen); + if (MainScreenViewModel.scaffoldKey.currentState?.isDrawerOpen ?? + false) { + MainScreenViewModel.scaffoldKey.currentState?.closeDrawer(); + } + tourHomeTargets(); + }, + secondaryButtonTap: () { + tourComplete = false; + tourSkipped = true; + navigationService.pop(); + notifyListeners(); + }, + ); + } + + /// Starts the tour and info to be displayed is mentioned in this functions. + /// + /// **params**: + /// * `givenUserConfig`: Mock user config that helps in testing. + /// + /// **returns**: + /// None + void tourHomeTargets([UserConfig? givenUserConfig]) { + final UserConfig localUserConfig = givenUserConfig ?? userConfig; + targets.clear(); + targets.add( + FocusTarget( + key: keySHOrgName, + keyName: 'keySHOrgName', + description: 'Current selected Organization Name', + appTour: appTour, + ), + ); + targets.add( + FocusTarget( + key: keySHMenuIcon, + keyName: 'keySHMenuIcon', + description: + 'Click this button to see options related to switching, joining and leaving organization(s)', + isCircle: true, + next: () => scaffoldKey.currentState!.openDrawer(), + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keyDrawerCurOrg, + keyName: 'keyDrawerCurOrg', + description: "Current selected Organization's Name appears here", + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keyDrawerSwitchableOrg, + keyName: 'keyDrawerSwitchableOrg', + description: + "All your joined organizations appear over here you can click on them to change the current organization", + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keyDrawerJoinOrg, + keyName: 'keyDrawerJoinOrg', + description: "From this button you can join other listed organizations", + appTour: appTour, + align: ContentAlign.top, + next: () { + if (!localUserConfig.loggedIn) { + navigationService.pop(); + } + }, + ), + ); + + if (localUserConfig.loggedIn) { + targets.add( + FocusTarget( + key: keyDrawerLeaveCurrentOrg, + keyName: 'keyDrawerLeaveCurrentOrg', + description: + "To leave the current organization you can use this option", + align: ContentAlign.top, + next: () => navigationService.pop(), + appTour: appTour, + ), + ); + } + + targets.add( + FocusTarget( + key: keyBNHome, + keyName: 'keyBNHome', + description: + "This is the home tab here you can see the latest post from other members of the current organization", + isCircle: true, + align: ContentAlign.top, + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySHPinnedPost, + keyName: 'keySHPinnedPost', + description: + "This section displays all the important post set by the organization admin(s)", + align: ContentAlign.bottom, + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySHPost, + keyName: 'keySHPost', + description: + "This is the post card you can like and comment on the post from the options available", + align: ContentAlign.bottom, + appTour: appTour, + ), + ); + appTour.showTutorial( + onClickTarget: showHome, + onFinish: () { + onTabTapped(currentPageIndex + 1); + if (!tourComplete && !tourSkipped) { + tourEventTargets(); + } + }, + targets: targets, + ); + } + + /// This function shows the Home screen. + /// + /// **params**: + /// * `clickedTarget`: object to identify clickedTarget. + /// + /// **returns**: + /// None + void showHome(TargetFocus clickedTarget) { + switch (clickedTarget.identify) { + case "keySHMenuIcon": + scaffoldKey.currentState!.openDrawer(); + break; + case "keyDrawerLeaveCurrentOrg": + navigationService.pop(); + } + } + + /// This function show the tutorial for Events. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void tourEventTargets() { + targets.clear(); + targets.add( + FocusTarget( + key: keyBNEvents, + keyName: 'keyBNEvents', + description: + 'This is the Events tab here you can see all event related information of the current selected organization', + isCircle: true, + align: ContentAlign.top, + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySECategoryMenu, + keyName: 'keySECategoryMenu', + description: 'Filter Events based on categories', + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySEDateFilter, + keyName: 'keySEDateFilter', + description: 'Filter Events between selected dates', + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySECard, + keyName: 'keySECard', + description: + 'Description of event to see more details click on the card', + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySEAdd, + keyName: 'keySEAdd', + description: 'You can create a new event from here', + align: ContentAlign.top, + appTour: appTour, + ), + ); + + appTour.showTutorial( + onFinish: () { + onTabTapped(currentPageIndex + 1); + if (!tourComplete && !tourSkipped) { + tourProfile(); + } + }, + onClickTarget: (TargetFocus a) {}, + targets: targets, + ); + } + + /// This function show the tutorial to add Post in the organization. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void tourAddPost() { + targets.clear(); + targets.add( + FocusTarget( + key: keyBNPost, + keyName: 'keyBNPost', + description: + 'This is the Create post tab here you can add post to the current selected organization', + isCircle: true, + align: ContentAlign.top, + appTour: appTour, + ), + ); + appTour.showTutorial( + onFinish: () { + onTabTapped(currentPageIndex + 1); + if (!tourComplete && !tourSkipped) { + // tourChat(); + tourProfile(); + } + }, + onClickTarget: (TargetFocus a) {}, + targets: targets, + ); + } + + /// This function show the tour of chats. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void tourChat() { + targets.clear(); + targets.add( + FocusTarget( + key: keyBNChat, + keyName: 'keyBNChat', + description: + 'This is the Chat tab here you can see all your messages of the current selected organization', + isCircle: true, + align: ContentAlign.top, + appTour: appTour, + ), + ); + appTour.showTutorial( + onFinish: () { + onTabTapped(currentPageIndex + 1); + if (!tourComplete && !tourSkipped) { + tourProfile(); + } + }, + onClickTarget: (TargetFocus a) {}, + targets: targets, + ); + } + + /// This function show the tutorial for the profile page. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void tourProfile() { + targets.clear(); + targets.add( + FocusTarget( + key: keyBNProfile, + keyName: 'keyBNProfile', + description: + 'This is the Profile tab here you can see all options related to account, app setting, invitation, help etc', + isCircle: true, + align: ContentAlign.top, + nextCrossAlign: CrossAxisAlignment.start, + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySPAppSetting, + keyName: 'keySPAppSetting', + description: + 'You can edit application settings like language, theme etc from here', + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySPHelp, + keyName: 'keySPHelp', + description: + 'For any help we are always there. You can reach us from here', + appTour: appTour, + ), + ); + + targets.add( + FocusTarget( + key: keySPDonateUs, + keyName: 'keySPDonateUs', + description: + 'To help your organization grow you can support them financially from here', + appTour: appTour, + ), + ); + +// Uncomment the section below if you want to add the keySPInvite target +// targets.add( +// FocusTarget( +// key: keySPInvite, +// keyName: 'keySPInvite', +// description: 'Wanna invite colleague, invite them from here', +// ), +// ); + + targets.add( + FocusTarget( + key: keySPPalisadoes, + keyName: 'keySPPalisadoes', + description: 'You are all set to go lets get you in', + isEnd: true, + appTour: appTour, + ), + ); + + appTour.showTutorial( + onFinish: () { + if (!tourComplete && !tourSkipped) { + tourComplete = true; + onTabTapped(0); + } + }, + onClickTarget: (TargetFocus a) {}, + targets: targets, + ); + } +} diff --git a/lib/view_model/pre_auth_view_models/login_view_model.dart b/lib/view_model/pre_auth_view_models/login_view_model.dart new file mode 100644 index 000000000..e3b517184 --- /dev/null +++ b/lib/view_model/pre_auth_view_models/login_view_model.dart @@ -0,0 +1,174 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/app_strings.dart'; + +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +// import 'package:talawa/main.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/utils/encryptor.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +/// LoginViewModel class helps to interact with model to serve data. +/// +/// Reacts to user's input in Login View. +/// +/// Methods include: +/// * `login` +class LoginViewModel extends BaseModel { + /// GlobalKey to identify and manage the state of a form widget. + final formKey = GlobalKey(); + + /// List of maps to store greetings.. + late List> greeting; + + /// TextEditingController for handling password input field. + TextEditingController password = TextEditingController(); + + /// TextEditingController for handling email input field. + TextEditingController email = TextEditingController(); + + /// FocusNode to manage focus for the password input field. + FocusNode passwordFocus = FocusNode(); + + /// FocusNode to manage focus for the email input field. + FocusNode emailFocus = FocusNode(); + + /// Determines when to perform automatic validation of form fields. + AutovalidateMode validate = AutovalidateMode.disabled; + + /// Toggles password visibility (true for hidden, false for visible). + bool hidePassword = true; + + /// Initializes the greeting message. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialize() { + greeting = [ + { + 'text': "We're ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'Glad ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24), + }, + { + 'text': "you're ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'Back ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24), + }, + ]; + } + + /// Performs the login operation. + /// + /// Handles the login process by performing the following steps: + /// 1. Unfocusing the email and password text fields. + /// 2. Setting validation mode to `AutovalidateMode.always`. + /// 3. Validating the email and password fields using the form key. + /// 4. If validation is successful, disabling auto-validation mode + /// and initiating the login process. + /// 5. Displaying a custom progress dialog during login. + /// 6. Initializing database functions. + /// 7. Performing a GraphQL mutation to login the user by providing + /// the email and encrypted password. + /// 8. Handling the result of the login operation: + /// - Updating the current user with the received data. + /// - Redirecting the user based on their status in the application. + /// - Handling Firebase options for Android and iOS if available. + /// - Configuring Firebase and saving FCM token to the database. + /// + /// In case of any exceptions during the login process, + /// this function catches and prints the error. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future login() async { + emailFocus.unfocus(); + passwordFocus.unfocus(); + validate = AutovalidateMode.always; + // if the email and password are not empty. + if (formKey.currentState!.validate()) { + validate = AutovalidateMode.disabled; + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.youAreOfflineUnableToLogin, + action: () async { + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('LoginProgress'), + ), + ); + databaseFunctions.init(); + // run the graph QL query to login the user, + // passing `email` and `password`. + final result = await databaseFunctions.gqlNonAuthMutation( + queries.loginUser( + email.text, + Encryptor.encryptString( + password.text, + ), + ), + ); + navigationService.pop(); + + return result; + }, + onValidResult: (result) async { + // if user found. + if (result.data != null) { + final User loggedInUser = User.fromJson( + result.data!['login'] as Map, + ); + userConfig.updateUser(loggedInUser); + } + }, + apiCallSuccessUpdateUI: () { + // if user has not already joined any organization. + if (userConfig.currentUser.joinedOrganizations!.isEmpty) { + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ); + } else { + userConfig.saveCurrentOrgInHive( + userConfig.currentUser.joinedOrganizations![0], + ); + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: MainScreenArgs(mainScreenIndex: 0, fromSignUp: false), + ); + } + }, + onActionException: (e) async { + print('here'); + print(e); + }, + ); + } + } +} 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 new file mode 100644 index 000000000..e74f702cb --- /dev/null +++ b/lib/view_model/pre_auth_view_models/select_organization_view_model.dart @@ -0,0 +1,267 @@ +// ignore_for_file: talawa_good_doc_comments, talawa_api_doc +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +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. +/// +/// 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 search is enabled. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void searchActive() { + if (searchFocus.hasFocus) { + organizations = []; + searching = true; + setState(ViewState.idle); + } + } + + /// initializer. + /// + /// **params**: + /// * `initialData`: data + /// + /// **returns**: + /// * `Future`: None + Future initialise(String initialData) async { + searchFocus.addListener(searchActive); + if (!initialData.contains('-1')) { + databaseFunctions.init(); + final fetch = await databaseFunctions.fetchOrgById(initialData); + if (fetch.runtimeType == OrgInfo) { + selectedOrganization = fetch as OrgInfo; + if (userConfig.currentUser.refreshToken?.isEmpty ?? true) { + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: selectedOrganization, + ); + } else { + selectOrg(selectedOrganization); + } + setState(ViewState.idle); + } + } + } + + /// This function select the organization. + /// + /// **params**: + /// * `item`: Selected organization data. + /// + /// **returns**: + /// * `Future`: None + Future selectOrg(OrgInfo item) async { + bool orgAlreadyJoined = false; + bool orgRequestAlreadyPresent = false; + // if user session not expirec + if (userConfig.loggedIn) { + // check if user has already joined the selected organization. + userConfig.currentUser.joinedOrganizations!.forEach((element) { + if (element.id! == item.id) { + orgAlreadyJoined = true; + } + }); + // check if user has already send the membership request to the selected organization. + userConfig.currentUser.membershipRequests!.forEach((element) { + if (element.id! == item.id) { + orgRequestAlreadyPresent = true; + } + }); + // if not already joined and not memebrship request. + if (!orgAlreadyJoined && !orgRequestAlreadyPresent) { + selectedOrganization = item; + notifyListeners(); + onTapJoin(); + + if (selectedOrganization.userRegistrationRequired!) { + navigationService.pushScreen( + Routes.requestAccess, + arguments: selectedOrganization, + ); + } + } else if (orgAlreadyJoined) { + selectedOrganization = OrgInfo(id: '-1'); + navigationService.showTalawaErrorSnackBar( + 'Organisation already joined', + MessageType.warning, + ); + } else { + navigationService.showTalawaErrorSnackBar( + 'Membership request already sent', + MessageType.warning, + ); + } + } else { + selectedOrganization = item; + notifyListeners(); + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: selectedOrganization, + ); + } + } + + /// 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') { + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: selectedOrganization, + ); + } else { + navigationService.showTalawaErrorSnackBar( + 'Select one organization to continue', + MessageType.warning, + ); + } + } + + /// This function make user to join the selected organization. + /// + /// + /// The function uses `joinOrgById` graph QL query + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Future`: None + Future onTapJoin() async { + // if `selectedOrganization` registrations is not required. + if (selectedOrganization.userRegistrationRequired == false) { + try { + // run the graph QL mutation + final QueryResult result = await databaseFunctions.gqlAuthMutation( + queries.joinOrgById(selectedOrganization.id!), + ); + + final List? joinedOrg = + ((result.data!['joinPublicOrganization'] + as Map)['joinedOrganizations'] + as List?) + ?.map((e) => OrgInfo.fromJson(e as Map)) + .toList(); + userConfig.updateUserJoinedOrg(joinedOrg!); + // if user joined organization length is 1 + if (userConfig.currentUser.joinedOrganizations!.length == 1) { + userConfig.saveCurrentOrgInHive( + userConfig.currentUser.joinedOrganizations![0], + ); + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: MainScreenArgs(mainScreenIndex: 0), + ); + } else { + navigationService.pop(); + navigationService.showTalawaErrorSnackBar( + 'Joined ${selectedOrganization.name} successfully', + MessageType.info, + ); + } + } on Exception catch (e) { + print(e); + navigationService.showTalawaErrorSnackBar( + 'Something went wrong', + MessageType.error, + ); + } + } + // else { + // try { + // // navigationService.pushScreen(Routes.requestAccess); + // } on Exception catch (e) { + // print(e); + // navigationService.showTalawaErrorSnackBar( + // 'SomeThing went wrong', + // MessageType.error, + // ); + // } + // } + } + + /// This function fetch more option. + /// + /// + /// **params**: + /// * `fetchMore`: client function + /// * `organizations`: org list + /// + /// **returns**: + /// None + void fetchMoreHelper(FetchMore fetchMore, List organizations) { + fetchMore( + FetchMoreOptions( + variables: { + "first": organizations.length + 15, + "skip": organizations.length, + }, + updateQuery: (existingOrganizations, newOrganizations) { + return { + 'organizationsConnection': + (existingOrganizations!["organizationsConnection"] + as List) + + (newOrganizations!['organizationsConnection'] + as List), + }; + }, + ), + ); + } +} diff --git a/lib/view_model/pre_auth_view_models/set_url_view_model.dart b/lib/view_model/pre_auth_view_models/set_url_view_model.dart new file mode 100644 index 000000000..8ed6dc7ac --- /dev/null +++ b/lib/view_model/pre_auth_view_models/set_url_view_model.dart @@ -0,0 +1,324 @@ +import 'package:flutter/material.dart'; +import 'package:hive/hive.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; +import 'package:vibration/vibration.dart'; + +/// SetUrlViewModel class helps to interact with model to serve data. +/// +/// and react to user's input for Set Url Section. +/// Methods include: +/// * `checkURLandNavigate` +/// * `scanQR` +/// * `initialise` +/// * `checkURLandNavigate` +/// * `checkURLandShowPopUp` +/// * `scanQR` +/// * `_onQRViewCreated` + +class SetUrlViewModel extends BaseModel { + // variables + + /// formKey. + final formKey = GlobalKey(); + + /// qrKey. + final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); + + /// qrText. + late Barcode result; + + /// organizationID. + String orgId = '-1'; + + /// imageUrlKey. + static const imageUrlKey = "imageUrl"; + + /// urlKey. + static const urlKey = "url"; + + /// url. + TextEditingController url = TextEditingController(); + + /// urlFocus. + FocusNode urlFocus = FocusNode(); + + /// qrController. + late List> greeting; + + /// qrValidator. + AutovalidateMode validate = AutovalidateMode.disabled; + + /// This function initialises the variables. + /// + /// **params**: + /// * `inviteUrl`: url + /// + /// **returns**: + /// None + + void initialise({String inviteUrl = ''}) { + final uri = inviteUrl; + if (uri.isNotEmpty) { + /// assigning the invite server url to the url text controller. + url.text = uri; + final box = Hive.box('url'); + box.put(urlKey, uri); + box.put(imageUrlKey, "$uri/talawa/"); + graphqlConfig.getOrgUrl(); + } + + /// greeting message. + greeting = [ + { + 'text': 'Join ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24, fontWeight: FontWeight.w700), + }, + { + 'text': 'and ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'Collaborate ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24, fontWeight: FontWeight.w700), + }, + { + 'text': 'with your ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'Organizations', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall! + .copyWith(fontSize: 24, color: const Color(0xFF4285F4)), + }, + ]; + notifyListeners(); + } + + /// This function check the URL and navigate to the respective URL. + /// + /// **params**: + /// * `navigateTo`: url + /// * `argument`: message + /// + /// **returns**: + /// None + + Future checkURLandNavigate(String navigateTo, String argument) async { + urlFocus.unfocus(); + validate = AutovalidateMode.always; + + /// if the url is valid. + if (formKey.currentState!.validate()) { + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: navigateTo == '/login' + ? TalawaErrors.youAreOfflineUnableToLogin + : TalawaErrors.youAreOfflineUnableToSignUp, + action: () async { + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('UrlCheckProgress'), + ), + ); + validate = AutovalidateMode.disabled; + final String uri = url.text.trim(); + final bool? urlPresent = + await locator().validateUrlExistence(uri); + if (urlPresent! == true) { + final box = Hive.box('url'); + box.put(urlKey, uri); + box.put(imageUrlKey, "$uri/talawa/"); + navigationService.pop(); + graphqlConfig.getOrgUrl(); + navigationService.pushScreen(navigateTo, arguments: argument); + } else { + navigationService.pop(); + navigationService.showTalawaErrorSnackBar( + "URL doesn't exist/no connection please check", + MessageType.error, + ); + } + return null; + }, + ); + } + } + + /// This function check the URL and navigate to the respective URL. + /// + /// **params**: + /// * `argument`: message + /// + /// **returns**: + /// None + + Future checkURLandShowPopUp(String argument) async { + urlFocus.unfocus(); + validate = AutovalidateMode.always; + + // if the url is valid. + if (formKey.currentState!.validate()) { + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('UrlCheckProgress'), + ), + ); + validate = AutovalidateMode.disabled; + final String uri = url.text.trim(); + final bool? urlPresent = + await locator().validateUrlExistence(uri); + if (urlPresent! == true) { + final box = Hive.box('url'); + box.put(urlKey, uri); + box.put(imageUrlKey, "$uri/talawa/"); + navigationService.pop(); + graphqlConfig.getOrgUrl(); + navigationService.showSnackBar("Url is valid"); + } else { + navigationService.pop(); + navigationService.showTalawaErrorDialog( + "URL doesn't exist/no connection please check", + MessageType.info, + ); + } + } + } + + /// This function create a widget which is used to scan the QR-code. + /// + /// **params**: + /// * `context`: BuildContext + /// + /// **returns**: + /// None + + void scanQR(BuildContext context) { + showModalBottomSheet( + context: context, + barrierColor: Colors.transparent, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + builder: (BuildContext context) { + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: Container( + height: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondary, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 250, + width: 250, + child: QRView( + key: qrKey, + onQRViewCreated: _onQRViewCreated, + overlay: QrScannerOverlayShape( + borderRadius: 10, + borderLength: 20, + borderWidth: 10, + cutOutSize: 250, + ), + /*overlayMargin: EdgeInsets.all(50)*/ + ), + ), + SizedBox( + height: SizeConfig.safeBlockVertical! * 4, + ), + const Text('Scan QR'), + SizedBox( + height: SizeConfig.safeBlockVertical! * 4, + ), + ], + ), + ), + ); + }, + ); + } + + /// This is the helper function which execute when the on QR view created. + /// + /// **params**: + /// * `controller`: QRViewController + /// + /// **returns**: + /// None + + void _onQRViewCreated(QRViewController controller) { + controller.scannedDataStream.listen((scanData) { + /// if the scanData is not empty. + if (scanData.code!.isNotEmpty) { + print(scanData.code); + try { + final List data = scanData.code!.split('?'); + url.text = data[0]; + final List queries = data[1].split('&'); + orgId = queries[0].split('=')[1]; + Vibration.vibrate(duration: 100); + controller.stopCamera(); + controller.dispose(); + final box = Hive.box('url'); + box.put(urlKey, url.text); + box.put(imageUrlKey, "${url.text}/talawa/"); + graphqlConfig.getOrgUrl(); + Navigator.pop(navigationService.navigatorKey.currentContext!); + navigationService.pushScreen('/selectOrg', arguments: orgId); + } on CameraException catch (e) { + debugPrint(e.toString()); + navigationService.showTalawaErrorSnackBar( + "The Camera is not working", + MessageType.error, + ); + } on QrEmbeddedImageException catch (e) { + debugPrint(e.toString()); + navigationService.showTalawaErrorDialog( + "The QR is not Working", + MessageType.error, + ); + } on QrUnsupportedVersionException catch (e) { + debugPrint(e.toString()); + navigationService.showTalawaErrorDialog( + "This QR version is not Supported.", + MessageType.error, + ); + } on Exception catch (e) { + debugPrint(e.toString()); + navigationService.showTalawaErrorSnackBar( + "This QR is not for the App", + MessageType.error, + ); + } + } + }); + } +} diff --git a/lib/view_model/pre_auth_view_models/signup_details_view_model.dart b/lib/view_model/pre_auth_view_models/signup_details_view_model.dart new file mode 100644 index 000000000..a4c0ca049 --- /dev/null +++ b/lib/view_model/pre_auth_view_models/signup_details_view_model.dart @@ -0,0 +1,214 @@ +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/constants/app_strings.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/utils/encryptor.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +/// SignupDetailsViewModel class helps to interact with model to serve data and react to user's input for Sign Up Details section. +/// +/// Methods include: +/// * `signUp` +class SignupDetailsViewModel extends BaseModel { + /// GlobalKey to identify and manage the state of a form widget. + final formKey = GlobalKey(); + + /// List of maps to store greeting information, where each greeting is represented by a map with String keys and dynamic values. + late List> greeting; + + /// Represents information about the selected organization. + late OrgInfo selectedOrganization; + + /// TextEditingController for handling confirmation password input field. + TextEditingController confirmPassword = TextEditingController(); + + /// TextEditingController for handling first name input field. + TextEditingController firstName = TextEditingController(); + + /// TextEditingController for handling last name input field. + TextEditingController lastName = TextEditingController(); + + /// TextEditingController for handling password input field. + TextEditingController password = TextEditingController(); + + /// TextEditingController for handling email input field. + TextEditingController email = TextEditingController(); + + /// AutovalidateMode to determine when to perform automatic validation of form fields. + AutovalidateMode validate = AutovalidateMode.disabled; + + /// FocusNode to manage focus for the confirmation password input field. + FocusNode confirmFocus = FocusNode(); + + /// Boolean to toggle password visibility (true for hidden, false for visible). + bool hidePassword = true; + + /// Initializes the greeting message for a selected organization. + /// + /// **params**: + /// * `org`: OrgInfo - the organization information to set as selected. + /// + /// **returns**: + /// None + void initialise(OrgInfo org) { + selectedOrganization = org; + // greeting message + greeting = [ + { + 'text': "Let's ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'get ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': "you ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'SignUp ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24), + }, + ]; + } + + /// Initiates the sign-up process. + /// + /// Handles the sign-up process by performing the following steps: + /// 1. Unfocusing the current focus scope. + /// 2. Setting the view state to `ViewState.busy`. + /// 3. Setting validation mode to `AutovalidateMode.always`. + /// 4. Setting the view state to `ViewState.idle`. + /// 5. Validating the form using the form key. + /// 6. If validation is successful, disabling auto-validation mode and + /// initiating the sign-up. + /// 7. Displaying a custom progress dialog during sign-up. + /// 8. Initializing database functions. + /// 9. Performing a GraphQL mutation to register the user with provided + /// details (first name, last name, email, password). + /// 10. Handling the result of the sign-up operation: + /// - Updating the current user with the received data. + /// - Refreshing the access token. + /// - Joining a public organization or sending a membership request + /// based on the selected organization. + /// + /// In case of any exceptions during the sign-up process, this function + /// catches and prints the error + /// and displays a Talawa error snackbar with a corresponding message. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future signUp() async { + FocusScope.of(navigationService.navigatorKey.currentContext!).unfocus(); + setState(ViewState.busy); + validate = AutovalidateMode.always; + setState(ViewState.idle); + if (formKey.currentState!.validate()) { + validate = AutovalidateMode.disabled; + await actionHandlerService.performAction( + actionType: ActionType.critical, + criticalActionFailureMessage: TalawaErrors.youAreOfflineUnableToSignUp, + action: () async { + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('SignUpProgress'), + ), + ); + databaseFunctions.init(); + final query = queries.registerUser( + firstName.text, + lastName.text, + email.text, + Encryptor.encryptString( + password.text, + ), + selectedOrganization.id, + ); + final result = await databaseFunctions.gqlNonAuthMutation(query); + navigationService.pop(); + return result; + }, + onValidResult: (result) async { + if (result.data != null) { + final User signedInUser = User.fromJson( + result.data!['signUp'] as Map, + ); + final bool userSaved = await userConfig.updateUser(signedInUser); + final bool tokenRefreshed = await graphqlConfig.getToken() as bool; + + // if user successfully saved and access token is also generated. + if (userSaved && tokenRefreshed) { + // if the selected organization userRegistration not required. + if (!selectedOrganization.userRegistrationRequired!) { + final query = queries.joinOrgById(selectedOrganization.id!); + print(query); + final QueryResult result = + await databaseFunctions.gqlAuthMutation( + query, + ); + final joinPublicOrganization = result + .data!['joinPublicOrganization'] as Map; + final List? joinedOrg = (joinPublicOrganization[ + 'joinedOrganizations'] as List?) + ?.map((e) => OrgInfo.fromJson(e as Map)) + .toList(); + await userConfig.updateUserJoinedOrg(joinedOrg!); + userConfig.saveCurrentOrgInHive( + userConfig.currentUser.joinedOrganizations![0], + ); + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: + MainScreenArgs(mainScreenIndex: 0, fromSignUp: true), + ); + } else { + final QueryResult result = + await databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest(selectedOrganization.id!), + ); + final sendMembershipRequest = result + .data!['sendMembershipRequest'] as Map; + final OrgInfo membershipRequest = OrgInfo.fromJson( + sendMembershipRequest['organization'] as Map, + ); + userConfig.updateUserMemberRequestOrg([membershipRequest]); + navigationService.pop(); + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ); + } + } + } + }, + onActionException: (e) async { + print(e); + navigationService.showTalawaErrorSnackBar( + 'Something went wrong', + MessageType.error, + ); + }, + ); + } + } +} diff --git a/lib/view_model/pre_auth_view_models/waiting_view_model.dart b/lib/view_model/pre_auth_view_models/waiting_view_model.dart new file mode 100644 index 000000000..150859248 --- /dev/null +++ b/lib/view_model/pre_auth_view_models/waiting_view_model.dart @@ -0,0 +1,60 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// WaitingViewModel class helps to interact with model to serve data +/// and react to user's input for Waiting section. +/// +/// Methods include: +/// * `logout` +class WaitingViewModel extends BaseModel { + late List> greeting; + late List pendingRequestOrg; + late User currentUser; + + // initialiser + void initialise(BuildContext context) { + currentUser = userConfig.currentUser; + pendingRequestOrg = currentUser.membershipRequests!; + // greetings + greeting = [ + { + 'text': "Please wait", + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + { + 'text': " ${currentUser.firstName} ", + 'textStyle': + Theme.of(context).textTheme.titleLarge!.copyWith(fontSize: 24), + }, + { + 'text': "for organisation(s) to accept your invitation.", + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + ]; + } + + /// This function ends the session for the user or logout the user from the application. + void logout() { + final user = Hive.box('currentUser'); + final url = Hive.box('url'); + user.clear(); + url.clear(); + navigationService.removeAllAndPush( + Routes.languageSelectionRoute, + Routes.splashScreen, + arguments: '0', + ); + } + + void joinOrg() { + navigationService.pushScreen(Routes.joinOrg, arguments: '-1'); + } +} diff --git a/lib/view_model/theme_view_model.dart b/lib/view_model/theme_view_model.dart new file mode 100644 index 000000000..67378ceb0 --- /dev/null +++ b/lib/view_model/theme_view_model.dart @@ -0,0 +1,84 @@ +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// AppTheme class is a type of ViewModel to serve data from model to views in the context of App Themes. +/// +/// Methods include: +/// * `switchTheme` +class AppTheme extends BaseModel { + /// Key for dynamic theme. + final String key = "DynamicTheme"; + + late SharedPreferences _pref; + late bool _isDarkMode; + + /// flag to check darkMode. + bool get isdarkTheme => _isDarkMode; + + /// getter to fetch current theme. + ThemeData get theme => + isdarkTheme ? TalawaTheme.darkTheme : TalawaTheme.lightTheme; + + /// Initializes the theme settings. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void initialize() { + _isDarkMode = true; + _loadFromPrefs(); + } + + /// This function switches the app theme. + /// + /// **params**: + /// * `isOn`: `bool` type, the state to switch the theme to (true for Dark, false for Light). + /// + /// **returns**: + /// None + void switchTheme({required bool isOn}) { + _isDarkMode = isOn; + _saveToPrefs(); + notifyListeners(); + } + + /// Initializes the SharedPreferences instance. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future _initPrefs() async { + _pref = await SharedPreferences.getInstance(); + } + + /// Loads the theme preference from SharedPreferences. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future _loadFromPrefs() async { + await _initPrefs(); + _isDarkMode = _pref.getBool(key) ?? true; + notifyListeners(); + } + + /// Saves the theme preference to SharedPreferences. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future _saveToPrefs() async { + await _initPrefs(); + _pref.setBool(key, _isDarkMode); + } +} diff --git a/lib/view_model/widgets_view_models/comments_view_model.dart b/lib/view_model/widgets_view_models/comments_view_model.dart new file mode 100644 index 000000000..15f6ed231 --- /dev/null +++ b/lib/view_model/widgets_view_models/comments_view_model.dart @@ -0,0 +1,110 @@ +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/comment/comment_model.dart'; +import 'package:talawa/services/comment_service.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// CommentsViewModel class helps to serve the data from model and to react to user's input for Comment Widget. +/// +/// Methods include: +/// * `getComments` : to get all comments on the post. +/// * `createComment` : to add comment on the post. +class CommentsViewModel extends BaseModel { + /// Constructor + late CommentService _commentService; + + /// PostService instance. + late PostService _postService; + + /// Post id on which comments are to be fetched. + late String _postID; + + /// List of comments on the post. + late List _commentlist; + + /// UserConfig instance. + late UserConfig _userConfig; + + /// comment list getter. + List get commentList => _commentlist; + + /// Id of current post. + String get postId => _postID; + + /// This function is used to initialise the CommentViewModel. + /// + /// To verify things are working, check out the native platform logs. + /// **params**: + /// * `postID`: The post id for which comments are to be fetched. + /// + /// **returns**: + /// None + Future initialise(String postID) async { + _commentlist = []; + _postID = postID; + _commentService = locator(); + _userConfig = locator(); + _postService = locator(); + notifyListeners(); + await getComments(); + } + + /// This function is used to get all comments on the post. + /// + /// To verify things are working, check out the native platform logs. + /// **params**: + /// None + /// + /// **returns**: + /// None + Future getComments() async { + setState(ViewState.busy); + final List commentsJSON = await _commentService.getCommentsForPost(_postID); + print(commentsJSON); + commentsJSON.forEach((commentJson) { + _commentlist.add(Comment.fromJson(commentJson as Map)); + }); + setState(ViewState.idle); + } + + /// This function add comment on the post. The function uses `createComments` method provided by Comment Service. + /// + /// **params**: + /// * `msg`: The comment text. + /// + /// **returns**: + /// None + Future createComment(String msg) async { + await actionHandlerService.performAction( + actionType: ActionType.optimistic, + action: () async { + await _commentService.createComments(_postID, msg); + return null; + }, + updateUI: () { + addCommentLocally(msg); + }, + ); + } + + /// This function add comment locally. + /// + /// **params**: + /// * `msg`: BuildContext, contain parent info + /// + /// **returns**: + /// None + void addCommentLocally(String msg) { + _postService.addCommentLocally(_postID); + final creator = _userConfig.currentUser; + final Comment localComment = Comment( + text: msg, + createdAt: DateTime.now().toString(), + creator: creator, + ); + _commentlist.add(localComment); + notifyListeners(); + } +} diff --git a/lib/view_model/widgets_view_models/custom_drawer_view_model.dart b/lib/view_model/widgets_view_models/custom_drawer_view_model.dart new file mode 100644 index 000000000..564ef0f39 --- /dev/null +++ b/lib/view_model/widgets_view_models/custom_drawer_view_model.dart @@ -0,0 +1,161 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; +import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; + +/// CustomDrawerViewModel class helps to serve the data and to react to user's input for Custom Dialog Widget. +/// +/// Functions include: +/// * `switchOrg` +/// * `isPresentinSwitchableOrg` +/// * `setSelectedOrganizationName` +class CustomDrawerViewModel extends BaseModel { + // getters + + /// Scroll controller for managing scrolling behavior. + final ScrollController controller = ScrollController(); + + /// List of TargetFocus objects used for tutorial coaching. + final List targets = []; + + /// Instance of TutorialCoachMark responsible for providing tutorial guidance. + late TutorialCoachMark tutorialCoachMark; + late User _currentUser; + late List _switchAbleOrg; + bool _disposed = false; + OrgInfo? _selectedOrg; + StreamSubscription? _currentOrganizationStreamSubscription; + + //// Getter method to retrieve the selected organization. + OrgInfo? get selectedOrg => _selectedOrg; + + /// Getter method to retrieve the switchAble organization. + // ignore: unnecessary_getters_setters + List get switchAbleOrg => _switchAbleOrg; + + /// Setter method for switchAble organization. + set switchAbleOrg(List switchableOrg) => + _switchAbleOrg = switchableOrg; + + /// initializer. + /// + /// **params**: + /// * `homeModel`: instance of MainScreenViewModel. + /// * `context`: instance of BuildContext. + /// + /// **returns**: + /// None + void initialize(MainScreenViewModel homeModel, BuildContext context) { + _currentOrganizationStreamSubscription = + userConfig.currentOrgInfoStream.listen( + (updatedOrganization) { + setSelectedOrganizationName(updatedOrganization); + }, + ); + _currentUser = userConfig.currentUser; + _selectedOrg = userConfig.currentOrg; + _switchAbleOrg = _currentUser.joinedOrganizations ?? []; + } + + /// This function switches the organization to the specified `switchToOrg`. + /// + /// If `selectedOrg` is equal to `switchToOrg` and `switchToOrg` is present, a warning message is displayed using a custom Snackbar. + /// Otherwise, it saves the `switchToOrg` as the current organization, updates the selected organization name, + /// and displays an informational message using a custom Snackbar. + /// + /// **params**: + /// * `switchToOrg`: The organization to switch to. + /// + /// **returns**: + /// None + void switchOrg(OrgInfo switchToOrg) { + // if `selectedOrg` is equal to `switchOrg` and `switchToOrg` present or not. + if ((selectedOrg == switchToOrg) && + (isPresentinSwitchableOrg(switchToOrg))) { + // _navigationService.pop(); + navigationService.showTalawaErrorSnackBar( + '${switchToOrg.name} already selected', + MessageType.warning, + ); + } else { + userConfig.saveCurrentOrgInHive(switchToOrg); + setSelectedOrganizationName(switchToOrg); + navigationService.showTalawaErrorSnackBar( + 'Switched to ${switchToOrg.name}', + MessageType.info, + ); + } + navigationService.pop(); + } + + /// This function checks `switchOrg` is present in the `switchAbleOrg`. + /// + /// **params**: + /// * `switchToOrg`: `OrgInfo` type of organization want to switch into. + /// + /// **returns**: + /// * `bool`: returns true if switchToOrg is in switchAbleOrg list. + bool isPresentinSwitchableOrg(OrgInfo switchToOrg) { + var isPresent = false; + for (final OrgInfo orgs in switchAbleOrg) { + if (orgs.id == switchToOrg.id) { + isPresent = true; + } + } + return isPresent; + } + + @override + void notifyListeners() { + if (!_disposed) { + super.notifyListeners(); + } + } + + /// returns an exit alert dialog. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `CustomAlertDialog`: returns customAlertDialogBox. + CustomAlertDialog exitAlertDialog() { + return CustomAlertDialog( + key: const Key("Exit?"), + reverse: true, + dialogSubTitle: 'Are you sure you want to exit this organization?', + successText: 'Exit', + success: () {}, + ); + } + + /// This function switches the current organization to new organization. + /// + /// **params**: + /// * `updatedOrganization`: `OrgInfo` type, new organization. + /// + /// **returns**: + /// None + void setSelectedOrganizationName(OrgInfo updatedOrganization) { + // if current and updated organization are not same. + if (_selectedOrg != updatedOrganization) { + _selectedOrg = updatedOrganization; + // update in `UserConfig` variable. + userConfig.currentOrgInfoController.add(_selectedOrg!); + notifyListeners(); + } + } + + @override + void dispose() { + _disposed = true; + _currentOrganizationStreamSubscription?.cancel(); + super.dispose(); + } +} diff --git a/lib/view_model/widgets_view_models/event_card_view_model.dart b/lib/view_model/widgets_view_models/event_card_view_model.dart new file mode 100644 index 000000000..cd3c21f21 --- /dev/null +++ b/lib/view_model/widgets_view_models/event_card_view_model.dart @@ -0,0 +1,38 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +// import 'package:flutter/material.dart'; +// import 'package:talawa/locator.dart'; +// import 'package:talawa/models/events/event_badge_helper_model.dart'; +// import 'package:talawa/models/events/event_model.dart'; +// import 'package:talawa/view_model/base_view_model.dart'; + +// class EventCardViewModel extends BaseModel { +// late final Event _event; +// Event get event => _event; +// late final bool isRegistered; +// late EventBadge eventBadge; +// initialize({required Event event}) { +// _event = event; +// isRegistered = _event.isRegistered ?? false; +// initBadge(); +// } + +// void initBadge() {} + +// Map badgeDetails() { +// if (_event.creator!.id == userConfig.currentUser.id) { +// return { +// "BadgeTitle": "Created", +// }; +// } else if (isRegistered) { +// return { +// "BadgeTitle": "Subscribed", +// }; +// } else { +// return { +// "BadgeTitle": "", +// }; +// } +// } +// } 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 new file mode 100644 index 000000000..67b8013ce --- /dev/null +++ b/lib/view_model/widgets_view_models/like_button_view_model.dart @@ -0,0 +1,115 @@ +// ignore_for_file: talawa_api_doc +import 'dart:async'; + +import 'package:talawa/locator.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +/// LikeButtonViewModel class helps to serve the data and to react to user's input for Like Button Widget. +/// +/// +/// Methods include: +/// * `toggleIsLiked` +/// * `setIsLiked` +/// * `updatePost` +class LikeButtonViewModel extends BaseModel { + // Services + final _userConfig = locator(); + final _postService = locator(); + + // Local Variables for session caching + bool _isLiked = false; + late User _user; + List _likedBy = []; + late String _postID; + + // ignore: unused_field + late StreamSubscription _updatePostSubscription; + + ///Getters. + bool get isLiked => _isLiked; + List get likedBy => _likedBy; + int get likesCount => _likedBy.length; + + /// First function to initialize the ViewModel. + /// + /// **params**: + /// * `likedBy`: List of LikedBy Objects + /// * `postID`: Post Id of the Post + /// + /// **returns**: + /// None + void initialize(List likedBy, String postID) { + _postID = postID; + _user = _userConfig.currentUser; + _likedBy = likedBy; + notifyListeners(); + checkAndSetTheIsLiked(); + _updatePostSubscription = + _postService.updatedPostStream.listen((post) => updatePost(post)); + } + + /// function to toggleisLiked boolean. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void toggleIsLiked() { + if (!_isLiked) { + _postService.addLike(_postID); + } + } + + /// function to set isLiked boolean. + /// + /// **params**: + /// * `val`: value to set bool to. + /// + /// **returns**: + /// None + void setIsLiked({bool val = true}) { + _isLiked = val; + notifyListeners(); + } + + /// function to set isLiked boolean and check. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void checkAndSetTheIsLiked() { + setIsLiked(val: false); + for (var i = 0; i < _likedBy.length; i++) { + if (_likedBy[i].sId == _user.id) { + setIsLiked(); + } + } + } + + /// function to update the Post. + /// + /// **params**: + /// * `post`: Post Object + /// + /// **returns**: + /// None + void updatePost(Post post) { + if (_postID == post.sId) { + _likedBy = post.likedBy!; + checkAndSetTheIsLiked(); + } + } + + @override + // ignore: must_call_super + void dispose() { + _updatePostSubscription.cancel(); + } +} diff --git a/lib/view_model/widgets_view_models/progress_dialog_view_model.dart b/lib/view_model/widgets_view_models/progress_dialog_view_model.dart new file mode 100644 index 000000000..c84562d35 --- /dev/null +++ b/lib/view_model/widgets_view_models/progress_dialog_view_model.dart @@ -0,0 +1,39 @@ +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/view_model/base_view_model.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +/// ProgressDialogViewModel class helps to serve the data. +/// +/// to react to user's input for Progress Dialog Widget. +class ProgressDialogViewModel extends BaseModel { + /// Result of connectivity status. + late ConnectivityResult connectivityResult; + + /// Flag for connectivity presence. + bool connectivityPresent = false; + + /// Initializes the state of the component by checking the online status and updating the view accordingly. + /// + /// This method performs the following actions: + /// 1. Sets the view state to busy to indicate that an initialization process is underway. + /// 2. Checks the online status of the application. + /// - If the app is offline, it sets the `connectivityPresent` flag to `false`. + /// - If the app is online, it sets the `connectivityPresent` flag to `true`. + /// 3. Updates the view state to idle after the online status check is complete. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future initialise() async { + setState(ViewState.busy); + if (!AppConnectivity.isOnline) { + connectivityPresent = false; + } else { + connectivityPresent = true; + } + setState(ViewState.idle); + } +} diff --git a/lib/view_models/base_model.dart b/lib/view_models/base_model.dart deleted file mode 100644 index c6165a338..000000000 --- a/lib/view_models/base_model.dart +++ /dev/null @@ -1,14 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:talawa/enums/viewstate.dart'; - -//this is the base model to change the notifier -class BaseModel extends ChangeNotifier { - ViewState _state = ViewState.idle; - - ViewState get state => _state; - - void setState(ViewState viewState) { - _state = viewState; - notifyListeners(); - } -} diff --git a/lib/view_models/swtich_org_vm.dart b/lib/view_models/swtich_org_vm.dart deleted file mode 100644 index 8cc99734c..000000000 --- a/lib/view_models/swtich_org_vm.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:talawa/enums/viewstate.dart'; -import 'package:talawa/model/switch_org.dart'; -import 'package:talawa/services/api_.dart'; -import 'package:talawa/view_models/base_model.dart'; - -import '../locator.dart'; - -//class to switch the model base model -class SwitchOrgModel extends BaseModel { - final API _api = locator(); - - List joinedOrgs; - - Future getJoinedOrgs() async { - setState(ViewState.busy); - joinedOrgs = await _api.fetchUserDetails(); - setState(ViewState.idle); - } -} diff --git a/lib/view_models/vm_login.dart b/lib/view_models/vm_login.dart deleted file mode 100644 index 35196df44..000000000 --- a/lib/view_models/vm_login.dart +++ /dev/null @@ -1,7 +0,0 @@ -//login model -class LoginViewModel { - LoginViewModel({this.email, this.password}); - - String email; - String password; -} diff --git a/lib/view_models/vm_register.dart b/lib/view_models/vm_register.dart deleted file mode 100644 index faafbbd2d..000000000 --- a/lib/view_models/vm_register.dart +++ /dev/null @@ -1,9 +0,0 @@ -//register model -class RegisterViewModel { - RegisterViewModel({this.firstName, this.lastName, this.email, this.password}); - - String firstName; - String lastName; - String email; - String password; -} diff --git a/lib/views/after_auth_screens/add_post_page.dart b/lib/views/after_auth_screens/add_post_page.dart new file mode 100644 index 000000000..aaf281e85 --- /dev/null +++ b/lib/views/after_auth_screens/add_post_page.dart @@ -0,0 +1,248 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; + +/// Add Post View Model. +late AddPostViewModel model; + +/// AddPost returns a widget to add(upload) the post. +class AddPost extends StatefulWidget { + const AddPost({super.key, this.drawerKey}); + + /// DrawerKey. + final GlobalKey? drawerKey; + + @override + State createState() => _AddPostState(); +} + +class _AddPostState extends State { + @override + Widget build(BuildContext context) { + // final Uint8List imageBytes = base64Decode(sampleBase64Image); + // final Uint8List bytes = BASE64.decode(_base64); + return Scaffold( + resizeToAvoidBottomInset: false, + // header for the widget + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.9, + centerTitle: true, + // header title + title: Text( + AppLocalizations.of(context)!.strictTranslate('Share News'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + leading: IconButton( + //TODO: showing the null pointer exception + key: const Key('add_post_icon_button1'), + color: Theme.of(context).iconTheme.color, + icon: const Icon( + Icons.arrow_back, + size: 36, + ), + onPressed: () { + navigationService.pop(); + }, + ), + // button to upload the post. + actions: [ + TextButton( + key: const Key('add_post_text_btn1'), + onPressed: () async { + await model.uploadPost(); + navigationService.pop(); + // convertImageToBase64(sampleBase64Image); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate("Post"), + style: Theme.of(context).textTheme.headlineSmall!.copyWith( + fontWeight: FontWeight.w600, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ), + // Image.memory(imageBytes) + ], + ), + body: BaseView( + onModelReady: (m) { + m.initialise(); + model = m; + }, + builder: (context, model, child) { + return SingleChildScrollView( + child: Column( + children: [ + ListTile( + leading: CustomAvatar( + isImageNull: model.userPic == null, + firstAlphabet: model.userName.substring(0, 1).toUpperCase(), + imageUrl: model.userPic, + fontSize: SizeConfig.screenHeight! * 0.018, + ), + title: Text(model.userName), + subtitle: Text( + AppLocalizations.of(context)! + .strictTranslate(model.orgName), + ), + ), + // renders icon button to upload post files. + Row( + children: [ + // button to select the photo from gallery. + IconButton( + key: const Key('add_post_icon_button2'), + onPressed: () => model.getImageFromGallery(), + icon: const Icon(Icons.photo), + ), + // button to capture the image. + IconButton( + key: const Key('add_post_icon_button3'), + onPressed: () => model.getImageFromGallery(camera: true), + icon: const Icon(Icons.camera_alt), + ), + // button to add hastags to the post. + TextButton( + key: const Key('add_post_text_btn2'), + onPressed: () { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text( + AppLocalizations.of(context)! + .strictTranslate("Enter the Tag"), + ), + content: TextField( + controller: model.textHashTagController, + ), + actions: [ + TextButton( + key: const Key("add_hashtag_button"), + onPressed: () { + navigationService.showTalawaErrorSnackBar( + "The tag was added", + MessageType.info, + ); + Navigator.of(context).pop(); + }, + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Add"), + ), + ), + TextButton( + key: const Key("cancel_hashtag_button"), + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Cancel"), + ), + ), + ], + ); + }, + ); + }, + child: Text( + model.textHashTagController.text == "" + ? '# ${AppLocalizations.of(context)!.strictTranslate("Add tag")}' + : model.textHashTagController.text, + style: Theme.of(context).textTheme.titleLarge, + ), + ), + ], + ), + const Divider(), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: TextField( + controller: model.titleController, + // input field to write the description of the post. + decoration: InputDecoration( + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + hintText: AppLocalizations.of(context)!.strictTranslate( + "Enter the title of your post", + ), + label: Text( + AppLocalizations.of(context)!.strictTranslate( + "Title", + ), + ), + ), + ), + ), + const Divider(), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: TextField( + controller: model.controller, + maxLines: null, + // input field to write the description of the post. + decoration: InputDecoration( + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + hintText: AppLocalizations.of(context)!.strictTranslate( + "Write here what do you want to share", + ), + ), + ), + ), + // if the image for the post is added then render button to remove it. + model.imageFile != null + // ignore: sized_box_for_whitespace + ? Container( + height: 230, + padding: const EdgeInsets.all(8.0), + child: Stack( + children: [ + // Image.file( + // model.imageFile!, + // fit: BoxFit.cover, + // width: MediaQuery.of(context).size.width, + // ), + Image.file(model.imageFile!), + Positioned( + right: 5, + top: 5, + child: IconButton( + key: const Key("remove_icon"), + onPressed: () { + model.removeImage(); + }, + icon: const Icon( + Icons.cancel, + color: Colors.black, + ), + ), + ), + ], + ), + ) + : Container(), + ], + ), + ); + }, + ), + ); + } +} diff --git a/lib/views/after_auth_screens/app_settings/app_settings_page.dart b/lib/views/after_auth_screens/app_settings/app_settings_page.dart new file mode 100644 index 000000000..16db78340 --- /dev/null +++ b/lib/views/after_auth_screens/app_settings/app_settings_page.dart @@ -0,0 +1,326 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/settings_view_models/app_setting_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; +import 'package:talawa/widgets/lang_switch.dart'; +import 'package:talawa/widgets/theme_switch.dart'; + +/// Widget representing the App Settings page. +/// +/// This widget represents the settings page of the application. +/// It allows users to configure various application settings. +class AppSettingsPage extends StatelessWidget { + const AppSettingsPage({ + super.key, + }); + + @override + Widget build(BuildContext context) { + const String talawaDocs = 'https://docs.talawa.io'; + const String talawaGithub = + 'https://github.com/PalisadoesFoundation/talawa'; + return BaseView( + builder: (context, model, child) { + return Scaffold( + key: const Key('AppSettingScaffold'), + // AppBar is a horizontal bar typically shown at the top of an app using the appBar property. + appBar: AppBar( + iconTheme: Theme.of(context).iconTheme, + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.0, + centerTitle: true, + // title of the page in appBar property + title: Text( + // title text translation according to the app language. + AppLocalizations.of(context)!.strictTranslate('Settings'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () => navigationService.pop(), + ), + ), + // style of the AppBar. + body: Padding( + padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 20), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + userConfig.loggedIn + ? category( + context: context, + title: 'Profile', + listItems: [ + customListTile( + leading: const Icon(Icons.edit), + content: Text( + AppLocalizations.of(context)! + .strictTranslate('Edit Profile'), + ), + trailing: chevronButton(context: context), + onTap: () { + navigationService + .pushScreen(Routes.editProfilePage); + }, + ), + ], + ) + : Container(), + category( + context: context, + title: 'General', + listItems: [ + const ChangeThemeTile(), + const LanguageTile(), + ], + ), + category( + context: context, + title: 'Help & Support', + listItems: [ + customListTile( + leading: const Icon(Icons.description), + content: Text( + AppLocalizations.of(context)! + .strictTranslate('Talawa Docs'), + ), + trailing: chevronButton( + context: context, + ), + onTap: () { + model.launchWebsite(talawaDocs); + }, + ), + customListTile( + leading: const Icon(Icons.code), + content: Text( + AppLocalizations.of(context)! + .strictTranslate('Talawa GitHub'), + ), + trailing: chevronButton( + context: context, + ), + onTap: () { + model.launchWebsite(talawaGithub); + }, + ), + ], + ), + ], + ), + ), + ), + footerTile(context: context, model: model), + ], + ), + ), + ); + }, + ); + } + + /// Generates an Icon widget for a chevron (right arrow). + /// + /// **params**: + /// * `context`: The BuildContext of the widget used to derive the theme's primary color. + /// + /// **returns**: + /// * `Icon`: An Icon widget representing a chevron (right arrow). + Icon chevronButton({required BuildContext context}) { + return Icon( + Icons.chevron_right, + color: Theme.of(context).colorScheme.primary, + ); + } + + /// Custom List Tile Widget. + /// + /// This widget creates a custom list tile with customizable components such as + /// leading, content, trailing, and an optional onTap callback. + /// + /// **params**: + /// * `leading`: Widget displayed at the start of the list tile. + /// * `content`: Widget displayed as the main content of the list tile. + /// * `trailing`: Widget displayed at the end of the list tile. + /// * `onTap`: Callback function triggered when the list tile is tapped. + /// + /// **returns**: + /// * `Widget`: Returns a ListTile widget customized with the provided components. + Widget customListTile({ + Widget? leading, + required Widget content, + required Widget trailing, + required void Function()? onTap, + }) { + return ListTile( + contentPadding: EdgeInsets.symmetric( + horizontal: SizeConfig.blockSizeHorizontal!, + ), + leading: leading, + title: content, + trailing: trailing, + onTap: onTap, + ); + } + + /// Widget representing a category with a title and a list of items. + /// + /// Displays a category title along with a list of widgets. + /// + /// **params**: + /// * `context`: The [BuildContext] of the widget. + /// * `title`: The title of the category to be displayed. + /// * `listItems`: A list of [Widget]s representing items in the category. + /// + /// **returns**: + /// * `Widget`: A [Padding] widget containing a [Column] with the category title displayed using + /// [catergoryHeader] and followed by the list of `listItems`. + Widget category({ + required BuildContext context, + required String title, + required List listItems, + }) { + return Padding( + padding: + EdgeInsets.symmetric(vertical: SizeConfig.blockSizeVertical! * 1.5), + child: Column( + children: [ + catergoryHeader(context: context, title: title), + ] + + listItems, + ), + ); + } + + /// Creates a header widget for a category. + /// + /// This widget displays a title for a category with a divider line underneath. + /// + /// **params**: + /// * `context`: The [BuildContext] associated with the widget. + /// * `title`: The title string to be displayed for the category. + /// + /// **returns**: + /// * `Widget`: Returns a [Widget] that represents the category header. + Widget catergoryHeader({ + required BuildContext context, + required String title, + }) { + return Padding( + padding: EdgeInsets.only(top: SizeConfig.blockSizeVertical!), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 2), + child: Text( + AppLocalizations.of(context)!.strictTranslate(title), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(color: Theme.of(context).colorScheme.primary), + ), + ), + customDivider(context: context), + ], + ), + ); + } + + /// Widget representing a footer tile that performs different actions based on user login status. + /// + /// **params**: + /// * `context`: The [BuildContext] of the widget. + /// * `model`: An instance of [AppSettingViewModel] used for handling app settings. + /// + /// **returns**: + /// * `Widget`: Returns a [Column] widget displaying a divider and a [TextButton] that varies its behavior based on user login status. + Widget footerTile({ + required BuildContext context, + required AppSettingViewModel model, + }) { + return Column( + children: [ + customDivider(context: context), + TextButton( + key: const Key('Logout'), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + userConfig.loggedIn + ? const Icon( + Icons.logout, + color: Colors.red, + ) + : Icon( + Icons.add, + color: Theme.of(context).colorScheme.secondary, + ), + SizedBox( + width: SizeConfig.blockSizeHorizontal! * 3, + ), + Text( + AppLocalizations.of(context)!.strictTranslate( + userConfig.loggedIn ? 'Logout' : 'Join an Organisation', + ), + style: Theme.of(context).textTheme.bodyLarge, + ), + ], + ), + ), + onPressed: () { + userConfig.loggedIn + ? showDialog( + context: context, + builder: (context) { + return CustomAlertDialog( + reverse: true, + dialogSubTitle: 'Are you sure you want to logout?', + successText: 'Logout', + success: () async { + await model.logout(); + }, + ); + }, + ) + : navigationService.pushScreen( + Routes.setUrlScreen, + arguments: '', + ); + }, + ), + ], + ); + } + + /// Builds a customized Divider widget based on the provided [BuildContext]. + /// + /// This function creates a Divider widget using the provided [context] to obtain + /// the appropriate divider color from the current app's theme. + /// + /// **params**: + /// * `context`: The BuildContext used to access the current app's theme. + /// + /// **returns**: + /// * `Widget`: Returns a Divider widget customized with the color from the app's theme. + Widget customDivider({ + required BuildContext context, + }) { + return Divider( + color: Theme.of(context).dividerColor, + ); + } +} diff --git a/lib/views/after_auth_screens/chat/chat_list_screen.dart b/lib/views/after_auth_screens/chat/chat_list_screen.dart new file mode 100644 index 000000000..d872a7266 --- /dev/null +++ b/lib/views/after_auth_screens/chat/chat_list_screen.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/views/after_auth_screens/chat/direct_chats.dart'; +import 'package:talawa/views/after_auth_screens/chat/select_contact.dart'; + +/// ChatPage returns a stateless widget. +/// +/// That renders a list of users with whom the current user has chatted. +class ChatPage extends StatelessWidget { + const ChatPage({super.key}); + + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 1, + child: Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.0, + centerTitle: true, + title: Text( + "Chats", + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + bottom: const TabBar( + tabs: [ + Tab( + text: "Direct", + ), + ], + ), + ), + // returns a tabs on the top for current user to switch between DirectChats and EventChats. + body: const TabBarView( + children: [ + DirectChats(), + ], + ), + floatingActionButton: FloatingActionButton( + // onPressed to FloatingActionButton renders SelectContact Widget to chat with other users in the connection. + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const SelectContact()), + ); + }, + child: const Icon(Icons.add), + ), + ), + ); + } +} diff --git a/lib/views/after_auth_screens/chat/chat_message_screen.dart b/lib/views/after_auth_screens/chat/chat_message_screen.dart new file mode 100644 index 000000000..7d8b86b8c --- /dev/null +++ b/lib/views/after_auth_screens/chat/chat_message_screen.dart @@ -0,0 +1,79 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart'; +import 'package:talawa/views/after_auth_screens/chat/widgets/chat_input_field.dart'; +import 'package:talawa/views/after_auth_screens/chat/widgets/chat_message_bubble.dart'; +import 'package:talawa/views/base_view.dart'; + +/// ChatMessageScreen returns a StatelessWidget for showing the chat message screen. +class ChatMessageScreen extends StatelessWidget { + const ChatMessageScreen({ + super.key, + required this.chatId, + required this.model, + }); + + final String chatId; + final DirectChatViewModel model; + + @override + Widget build(BuildContext context) { + model.getChatMessages(chatId); + model.chatName(chatId); + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + title: Row( + children: [ + IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () => Navigator.pop(context), + ), + SizedBox(width: SizeConfig.safeBlockHorizontal! * 3), + CircleAvatar( + backgroundColor: Colors.white, + radius: SizeConfig.blockSizeVertical! * 2.3, + ), + SizedBox(width: SizeConfig.safeBlockHorizontal! * 3), + Text('${model.name}'), + ], + ), + ), + body: BaseView( + onModelReady: (model) => model.getChatMessages(chatId), + builder: (context, model, child) => + (Provider.of(context).chatState == + ChatState.complete) + ? Column( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.safeBlockHorizontal! * 3, + ), + child: ListView.builder( + itemCount: model.chatMessagesByUser[chatId]!.length, + itemBuilder: (context, index) { + return Message( + message: + model.chatMessagesByUser[chatId]![index], + ); + }, + ), + ), + ), + ChatInputField(chatId: chatId, model: model), + ], + ) + : const Center( + child: CircularProgressIndicator(), + ), + ), + ); + } +} diff --git a/lib/views/after_auth_screens/chat/direct_chats.dart b/lib/views/after_auth_screens/chat/direct_chats.dart new file mode 100644 index 000000000..e76cd37f8 --- /dev/null +++ b/lib/views/after_auth_screens/chat/direct_chats.dart @@ -0,0 +1,53 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/chats/chat_list_tile_data_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +/// DirectChats return a statelessWidget for rendering all the directs +/// chats of the current user in the Chat List Screen +class DirectChats extends StatelessWidget { + const DirectChats({super.key}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(), + builder: (context, model, child) { + return ListView.builder( + // key: model.listKey, + itemCount: model.chats.length, + itemBuilder: (context, index) { + return ChatTile( + chat: model.chats[index], + model: model, + ); + }, + ); + }, + ); + } +} + +/// ChatTile return a widget for a tile in the list of Direct Chats in the Chat List Screen. +class ChatTile extends StatelessWidget { + const ChatTile({super.key, required this.chat, required this.model}); + + final ChatListTileDataModel chat; + final DirectChatViewModel model; + @override + Widget build(BuildContext context) { + return ListTile( + onTap: () => navigationService + .pushScreen(Routes.chatMessageScreen, arguments: [chat.id, model]), + leading: const CircleAvatar( + radius: 20, + ), + title: Text(chat.users![0].firstName!), + ); + } +} diff --git a/lib/views/after_auth_screens/chat/select_contact.dart b/lib/views/after_auth_screens/chat/select_contact.dart new file mode 100644 index 000000000..180abe47c --- /dev/null +++ b/lib/views/after_auth_screens/chat/select_contact.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/select_contact_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +/// SelectContact returns a widget that has mutable state _SelectContactState. +class SelectContact extends StatefulWidget { + const SelectContact({super.key}); + + @override + _SelectContactState createState() => _SelectContactState(); +} + +/// _SelectContactState returns a widget that renders the list of the users that current user can chat with. +class _SelectContactState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 0.0, + backgroundColor: Colors.black, + centerTitle: true, + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () { + navigationService.pop(); + }, + ), + title: Text( + "Select Contacts", + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + ), + body: BaseView( + onModelReady: (model) async { + model.initialise(); + await model.getCurrentOrgUsersList(); + }, + builder: (context, model, child) { + return ListView.builder( + itemCount: model.orgMembersList.length, + itemBuilder: (context, index) { + return GestureDetector( + key: Key('select_contact_gesture_$index'), + onTap: () { + // Navigator.push(context, MaterialPageRoute(builder: (context)=>ChatMessageScreen(chat: ChatListTileDataModel(ChatUser(model.orgMembersList[index].firstName,model.orgMembersList[index].id,model.orgMembersList[index].image),null,0)))); + }, + child: Container( + child: Padding( + padding: const EdgeInsets.all(5.0), + child: ListTile( + leading: const CircleAvatar( + radius: 25, + ), + title: Text( + model.orgMembersList[index].firstName.toString(), + ), + ), + ), + ), + ); + }, + ); + }, + ), + ); + } +} diff --git a/lib/views/after_auth_screens/chat/widgets/chat_input_field.dart b/lib/views/after_auth_screens/chat/widgets/chat_input_field.dart new file mode 100644 index 000000000..c9606800d --- /dev/null +++ b/lib/views/after_auth_screens/chat/widgets/chat_input_field.dart @@ -0,0 +1,114 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart'; + +/// ChatInputField returns a widget that has mutable state _ChatInputFieldState. +class ChatInputField extends StatefulWidget { + const ChatInputField({ + required this.chatId, + required this.model, + super.key, + }); + + /// DirectChatViewModel instance. + final DirectChatViewModel model; + + /// ChatId. + final String chatId; + + @override + State createState() => _ChatInputFieldState(); +} + +/// _ChatInputFieldState is a mutable state which return a widget for Input Field in Chat section. +class _ChatInputFieldState extends State { + // controllers are a means to give control to the parent widget over its child state + /// TextEditingController for input field. + final controller = TextEditingController(); + + @override + // dispose function declaration + void dispose() { + controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + // return a container + return Container( + // styling + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.blockSizeHorizontal! * 2, + vertical: SizeConfig.blockSizeVertical!, + ), + // input field decoration + decoration: BoxDecoration( + // background theme for text field + color: Theme.of(context).scaffoldBackgroundColor, + // box shadow + boxShadow: [ + BoxShadow( + offset: const Offset(0, 4), + blurRadius: 32, + color: const Color(0xFF087949).withOpacity(0.08), + ), + ], + ), + child: Row( + children: [ + Expanded( + child: Container( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.blockSizeHorizontal! * 3, + ), + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.circular(40), + ), + child: Row( + children: [ + SizedBox(width: SizeConfig.blockSizeHorizontal), + Expanded( + // TextField is commonly used text input widget that + //allows users to collect inputs from the keyboard into an app. + child: TextField( + key: const Key('InputFieldKey'), + controller: controller, + decoration: InputDecoration( + enabledBorder: InputBorder.none, + disabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + suffixIcon: GestureDetector( + key: const Key('InputFieldGestureKey'), + onTap: () { + widget.model.sendMessageToDirectChat( + widget.chatId, + controller.text, + ); + controller.clear(); + }, + child: Icon( + Icons.send, + color: Theme.of(context) + .textTheme + .bodyLarge! + .color! + .withOpacity(0.64), + ), + ), + // Placeholder text for the text field + hintText: "Type a message", + border: InputBorder.none, + ), + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/views/after_auth_screens/chat/widgets/chat_message_bubble.dart b/lib/views/after_auth_screens/chat/widgets/chat_message_bubble.dart new file mode 100644 index 000000000..6487db912 --- /dev/null +++ b/lib/views/after_auth_screens/chat/widgets/chat_message_bubble.dart @@ -0,0 +1,65 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/chats/chat_message.dart'; +import 'package:talawa/services/size_config.dart'; + +/// Message returns a widget for chat message in the bubble form. +class Message extends StatelessWidget { + const Message({super.key, required this.message}); + + final ChatMessage message; + + @override + Widget build(BuildContext context) { + // styling + return Padding( + padding: EdgeInsets.only(top: SizeConfig.safeBlockVertical! * 2), + child: Row( + mainAxisAlignment: + message.sender!.firstName == userConfig.currentUser.firstName + ? MainAxisAlignment.end + : MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.safeBlockHorizontal! * 2, + vertical: SizeConfig.blockSizeVertical! * 1.2, + ), + decoration: BoxDecoration( + // if the message is sent by current user, then the background color will be white else green + color: + message.sender!.firstName == userConfig.currentUser.firstName + ? Colors.white + : Colors.green, + borderRadius: + message.sender!.firstName == userConfig.currentUser.firstName + ? const BorderRadius.only( + bottomRight: Radius.circular(15), + topLeft: Radius.circular(15), + bottomLeft: Radius.circular(15), + ) + : const BorderRadius.only( + bottomRight: Radius.circular(15), + topRight: Radius.circular(15), + bottomLeft: Radius.circular(15), + ), + ), + child: Text( + message.messageContent!, + // if the message is sent by current user, then the text color will be black else theme bodyText color + style: TextStyle( + color: message.sender!.firstName == + userConfig.currentUser.firstName + ? Colors.black + : Theme.of(context).textTheme.bodyLarge!.color, + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/views/after_auth_screens/events/create_agenda_item_page.dart b/lib/views/after_auth_screens/events/create_agenda_item_page.dart new file mode 100644 index 000000000..10cbc8883 --- /dev/null +++ b/lib/views/after_auth_screens/events/create_agenda_item_page.dart @@ -0,0 +1,472 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/services/navigation_service.dart'; +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/utils/validators.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; + +/// A page for creating a new agenda item for events. +class CreateAgendaItemPage extends StatefulWidget { + /// Creates an instance of [CreateAgendaItemPage]. + /// + /// **Params**: + /// * `model`: An instance of [EventInfoViewModel] to manage agenda item data. + const CreateAgendaItemPage({super.key, required this.model}); + + /// The ViewModel associated with this page. + final EventInfoViewModel model; + + @override + _CreateAgendaItemPageState createState() => _CreateAgendaItemPageState(); +} + +/// State class for [CreateAgendaItemPage]. +class _CreateAgendaItemPageState extends State { + /// Controller for the agenda item title input field. + TextEditingController titleController = TextEditingController(); + + /// Controller for the agenda item description input field. + TextEditingController descController = TextEditingController(); + + /// Controller for the URL input field. + TextEditingController urlController = TextEditingController(); + + /// Controller for the duration input field. + TextEditingController durationController = TextEditingController(); + + /// Focus node for the title input field. + FocusNode titleFocus = FocusNode(); + + /// Focus node for the description input field. + FocusNode descFocus = FocusNode(); + + /// Focus node for the URL input field. + FocusNode urlFocus = FocusNode(); + + /// Focus node for the duration input field. + FocusNode durationFocus = FocusNode(); + + /// List of selected categories for the agenda item. + List selectedCategories = []; + + /// List of URLs associated with the agenda item. + List urls = []; + + /// List of base64 encoded attachments associated with the agenda item. + List attachments = []; + + /// Service for picking multimedia files. + late MultiMediaPickerService _multiMediaPickerService; + + @override + void initState() { + super.initState(); + // Initialize the multimedia picker service. + _multiMediaPickerService = locator(); + } + + /// Handles the selection and deselection of categories. + /// + /// **params**: + /// * `category`: The category selected or deselected. + /// + /// **returns**: + /// None + void _onCategorySelected(AgendaCategory category) { + setState(() { + if (selectedCategories.contains(category)) { + selectedCategories.remove(category); + } else { + selectedCategories.add(category); + } + widget.model.setSelectedCategories( + selectedCategories, + ); + }); + } + + /// Removes a category from the selected categories list. + /// + /// **params**: + /// * `category`: The category to be removed. + /// + /// **returns**: + /// None + void _removeCategory(AgendaCategory category) { + setState(() { + selectedCategories.remove(category); + widget.model.setSelectedCategories(selectedCategories); + }); + } + + /// method to add urls. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void _addUrl() { + if (urlController.text.isNotEmpty) { + setState(() { + urls.add(urlController.text); + urlController.clear(); + }); + } + } + + /// Adds a URL to the list of URLs. + /// + /// **params**: + /// * `url`: url that is to be removed. + /// + /// **returns**: + /// None + void _removeUrl(String url) { + setState(() { + urls.remove(url); + }); + } + + /// Picks an attachment using the multimedia picker service. + /// + /// **params**: + /// * `fromCamera`: Indicates if the photo should be picked from the camera. + /// + /// **returns**: + /// None + Future _pickAttachment({bool fromCamera = false}) async { + final File? pickedFile = + await _multiMediaPickerService.getPhotoFromGallery(camera: fromCamera); + if (pickedFile != null) { + final base64PickedFile = await imageService + .convertToBase64(pickedFile); // Convert the file to base64. + setState(() { + attachments + .add(base64PickedFile); // Add the base64 string to attachments. + }); + } + } + + /// Removes an attachment from the list of attachments. + /// + /// **params**: + /// * `image`: The base64 string of the attachment to be removed. + /// + /// **returns**: + /// None + void _removeAttachment(String image) { + setState(() { + attachments.remove(image); + }); + } + + @override + Widget build(BuildContext context) { + final navigationServiceLocal = locator(); + return Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 1, + centerTitle: true, + leading: GestureDetector( + onTap: () => navigationServiceLocal.pop(), + child: const Icon(Icons.close), + ), + title: Text( + AppLocalizations.of(context)!.strictTranslate('Add Agenda Item'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + actions: [ + TextButton( + key: const Key('addButton'), + onPressed: () { + final List categoryIds = + selectedCategories.map((category) => category.id!).toList(); + + widget.model.createAgendaItem( + title: titleController.text, + duration: durationController.text, + description: descController.text, + urls: urls, + categories: categoryIds, + attachments: attachments, + ); + Navigator.of(context).pop(); + }, + child: Text( + key: const Key('add_agenda'), + AppLocalizations.of(context)!.strictTranslate('Add'), + style: Theme.of(context).textTheme.bodyLarge!.copyWith( + fontSize: 16, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ), + ], + ), + body: Scrollbar( + thickness: 2, + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DropdownButtonFormField( + key: const Key('create_agenda_item_category_dropdown'), + value: selectedCategories.isNotEmpty + ? selectedCategories.first + : null, + onChanged: (AgendaCategory? category) { + if (category != null) { + _onCategorySelected(category); + } + }, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Select Categories'), + border: const OutlineInputBorder(), + ), + items: widget.model.categories + .map>( + (AgendaCategory category) { + return DropdownMenuItem( + value: category, + child: Text(category.name!), + ); + }).toList(), + ), + const SizedBox(height: 10), + Wrap( + spacing: 8.0, + runSpacing: 4.0, + children: selectedCategories.map((category) { + return Chip( + label: Text(category.name!), + onDeleted: () => _removeCategory(category), + deleteIconColor: Colors.redAccent, + ); + }).toList(), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + TextFormField( + key: const Key('create_event_agenda_tf1'), + textInputAction: TextInputAction.next, + controller: titleController, + keyboardType: TextInputType.name, + maxLength: 20, + focusNode: titleFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Title'), + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Add Agenda Item Title'), + isDense: true, + labelStyle: Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + counterText: "", + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.title, + size: 25, + ), + ), + ), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + TextFormField( + key: const Key('create_event_agenda_tf2'), + keyboardType: TextInputType.multiline, + controller: descController, + focusNode: descFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Description'), + maxLines: 10, + minLines: 1, + decoration: InputDecoration( + hintText: AppLocalizations.of(context)! + .strictTranslate('Describe the event'), + labelText: AppLocalizations.of(context)! + .strictTranslate('Add Description'), + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.view_headline, + size: 25, + ), + ), + ), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + TextFormField( + key: const Key('create_event_agenda_duration'), + controller: durationController, + focusNode: durationFocus, + keyboardType: TextInputType.text, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Duration (mm:ss)'), + hintText: '00:00', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: const OutlineInputBorder(), + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.timer, + size: 25, + ), + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return AppLocalizations.of(context)! + .strictTranslate('Please enter a duration'); + } + // Add additional validation for mm:ss format if needed + return null; + }, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + Row( + children: [ + Expanded( + child: TextFormField( + controller: urlController, + focusNode: urlFocus, + maxLines: 5, + minLines: 1, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Add URL'), + labelStyle: Theme.of(context).textTheme.titleMedium, + border: const OutlineInputBorder(), + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.add_link_outlined, + size: 25, + ), + ), + ), + ), + ), + const SizedBox(width: 10), + ElevatedButton( + onPressed: _addUrl, + child: Text( + key: const Key('add_url'), + AppLocalizations.of(context)!.strictTranslate('Add'), + ), + ), + ], + ), + const SizedBox(height: 10), + Wrap( + spacing: 8.0, + runSpacing: 4.0, + children: urls.map((url) { + return Chip( + label: Text(url), + onDeleted: () => _removeUrl(url), + deleteIconColor: Colors.redAccent, + ); + }).toList(), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + ElevatedButton.icon( + onPressed: () => _pickAttachment(fromCamera: false), + icon: const Icon(Icons.attach_file), + label: Text( + AppLocalizations.of(context)! + .strictTranslate('Add Attachments'), + ), + ), + const Divider(), + const SizedBox(height: 10), + GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + ), + itemCount: attachments.length, + itemBuilder: (context, index) { + final base64String = attachments[index]; + final imageData = base64Decode(base64String); + return Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(8), + child: Image.memory( + imageData, + fit: BoxFit.cover, + width: double.infinity, + height: double.infinity, + ), + ), + Positioned( + top: 0, + right: 0, + child: GestureDetector( + onTap: () => _removeAttachment(base64String), + child: Container( + padding: const EdgeInsets.all(4), + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + child: const Icon( + Icons.close, + color: Colors.white, + size: 18, + ), + ), + ), + ), + ], + ); + }, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/views/after_auth_screens/events/create_custom_recurring_event.dart b/lib/views/after_auth_screens/events/create_custom_recurring_event.dart new file mode 100644 index 000000000..0667482d9 --- /dev/null +++ b/lib/views/after_auth_screens/events/create_custom_recurring_event.dart @@ -0,0 +1,332 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/locator.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/create_event_view_model.dart'; +import 'package:talawa/widgets/create_recurring_event_helper_widgets.dart'; +import 'package:talawa/widgets/custom_weekday_selector.dart'; + +/// custom padding. +final _sectionPadding = SizeConfig.blockSizeHorizontal! * 8; + +/// Widget to build custom recurrence page. +class CustomRecurrencePage extends StatefulWidget { + const CustomRecurrencePage({super.key, required this.model}); + + /// Instance of create event view model. + final CreateEventViewModel model; + + @override + State createState() => _CustomRecurrencePageState(); +} + +class _CustomRecurrencePageState extends State { + /// Instance of create event view model. + late CreateEventViewModel viewModel; + + @override + void initState() { + super.initState(); + viewModel = widget.model; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 1, + centerTitle: true, + title: Text( + AppLocalizations.of(context)!.strictTranslate('Custom recurrence'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + actions: [ + TextButton( + onPressed: () { + setState(() { + if (viewModel.eventEndType == EventEndTypes.never) { + viewModel.recurrenceEndDate = null; + } else if (viewModel.eventEndType == EventEndTypes.after) { + viewModel.count = + int.parse(viewModel.endOccurenceController.text); + } + viewModel.interval = + int.parse(viewModel.repeatsEveryCountController.text); + viewModel.recurrenceLabel = + RecurrenceUtils.getRecurrenceRuleText( + viewModel.frequency, + viewModel.weekDays, + viewModel.interval, + viewModel.count, + viewModel.weekDayOccurenceInMonth, + viewModel.recurrenceStartDate, + viewModel.recurrenceEndDate, + ); + }); + navigationService.pop(); + }, + child: Text(AppLocalizations.of(context)!.strictTranslate('Done')), + ), + ], + ), + body: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: _buildRecurrenceOptions(context), + ), + ); + } + + /// Utility to build recurrence options widgets. + /// + /// **params**: + /// * `context`: BuildContext of the widget. + /// + /// **returns**: + /// * `Column`: Column of recurrence options widgets. + Column _buildRecurrenceOptions(BuildContext context) { + final List monthlyOptions = [ + RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + null, + int.parse(viewModel.repeatsEveryCountController.text), + int.parse(viewModel.endOccurenceController.text), + null, + viewModel.recurrenceStartDate, + viewModel.recurrenceEndDate, + ), + RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + { + RecurrenceUtils + .weekDays[widget.model.recurrenceStartDate.weekday - 1], + }, + int.parse(viewModel.repeatsEveryCountController.text), + int.parse(viewModel.endOccurenceController.text), + RecurrenceUtils.getWeekDayOccurenceInMonth( + widget.model.recurrenceStartDate, + ), + viewModel.recurrenceStartDate, + viewModel.recurrenceEndDate, + ), + RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + { + RecurrenceUtils + .weekDays[widget.model.recurrenceStartDate.weekday - 1], + }, + int.parse(viewModel.repeatsEveryCountController.text), + int.parse(viewModel.endOccurenceController.text), + -1, + viewModel.recurrenceStartDate, + viewModel.recurrenceEndDate, + ), + ]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(_sectionPadding), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + inputFieldHeading('Repeats every'), + _section1InputFields(), + ], + ), + ), + (viewModel.recurrenceInterval == EventIntervals.daily || + viewModel.recurrenceInterval == EventIntervals.yearly) + ? Divider(color: Theme.of(context).hintColor) + : Column( + children: [ + Divider(color: Theme.of(context).hintColor), + Container( + padding: EdgeInsets.fromLTRB( + _sectionPadding, + _sectionPadding, + 90, + _sectionPadding, + ), + child: viewModel.recurrenceInterval == + EventIntervals.monthly + ? Row( + children: [ + RecurrenceFrequencyDropdown( + model: viewModel, + options: [ + monthlyOptions[0], + if (RecurrenceUtils + .getWeekDayOccurenceInMonth( + widget.model.recurrenceStartDate, + ) != + 5) + monthlyOptions[1], + if (RecurrenceUtils.isLastOccurenceOfWeekDay( + widget.model.recurrenceStartDate, + )) + monthlyOptions[2], + ], + selectedOption: monthlyOptions[0], + onSelected: (String value) { + Set tempWeekDays; + int? tempWeekDayOccurenceInMonth; + if (value == monthlyOptions[0]) { + tempWeekDays = {}; + tempWeekDayOccurenceInMonth = null; + } else if (value == monthlyOptions[1]) { + tempWeekDays = { + RecurrenceUtils.weekDays[widget.model + .recurrenceStartDate.weekday - + 1], + }; + tempWeekDayOccurenceInMonth = + RecurrenceUtils + .getWeekDayOccurenceInMonth( + widget.model.recurrenceStartDate, + ); + } else { + tempWeekDays = { + RecurrenceUtils.weekDays[widget.model + .recurrenceStartDate.weekday - + 1], + }; + tempWeekDayOccurenceInMonth = -1; + } + setState(() { + viewModel.frequency = Frequency.monthly; + viewModel.recurrenceLabel = value; + viewModel.weekDays = tempWeekDays; + viewModel.weekDayOccurenceInMonth = + tempWeekDayOccurenceInMonth; + }); + }, + ), + ], + ) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + inputFieldHeading('Repeats on'), + CustomWeekDaySelector( + model: viewModel, + ), + ], + ), + ), + Divider(color: Theme.of(context).hintColor), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + EdgeInsets.only(top: _sectionPadding, left: _sectionPadding), + child: inputFieldHeading('Ends'), + ), + EventEndOptions(model: viewModel), + ], + ), + ], + ); + } + + /// Input Fields of repeats every section. + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Row`: Row of Custom input fields. + Row _section1InputFields() { + return Row( + children: [ + SizedBox( + width: SizeConfig.screenWidth! * 0.15, + child: CustomTextField( + key: const Key('inputsection1TextField'), + maxTextLength: 2, + textEditingController: viewModel.repeatsEveryCountController, + ), + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.03, + ), + RecurrenceFrequencyDropdown( + model: viewModel, + options: [ + EventIntervals.daily, + EventIntervals.weekly, + EventIntervals.monthly, + EventIntervals.yearly, + ], + selectedOption: viewModel.recurrenceInterval, + onSelected: (String value) { + switch (value) { + case EventIntervals.daily: + updateModel(Frequency.daily, value, null, null); + break; + case EventIntervals.weekly: + updateModel(Frequency.weekly, value, null, null); + break; + case EventIntervals.monthly: + updateModel(Frequency.monthly, value, null, null); + break; + case EventIntervals.yearly: + updateModel(Frequency.yearly, value, null, null); + break; + } + }, + ), + ], + ); + } + + /// Custom heading for input fields. + /// + /// **params**: + /// * `title`: Text displayed as heading. + /// + /// **returns**: + /// * `Container`: Container containing the heading text. + Container inputFieldHeading(String title) => Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title), + const SizedBox( + height: 12, + ), + ], + ), + ); + + /// Returns the updated model with the selected recurrence options. + /// + /// **params**: + /// * `frequency`: represent the frequency of the event. + /// * `value`: represent the interval of the event. + /// * `weekDayOccurenceInMonth`: represent the week day occurence in month. + /// * `weekDays`: represent the list of week days. + /// + /// **returns**: + /// None + void updateModel( + String frequency, + String value, + int? weekDayOccurenceInMonth, + Set? weekDays, + ) { + setState(() { + widget.model.frequency = frequency; + widget.model.recurrenceInterval = value; + widget.model.weekDayOccurenceInMonth = weekDayOccurenceInMonth; + widget.model.weekDays = weekDays ?? {}; + }); + } +} diff --git a/lib/views/after_auth_screens/events/create_event_form.dart b/lib/views/after_auth_screens/events/create_event_form.dart new file mode 100644 index 000000000..caac2c137 --- /dev/null +++ b/lib/views/after_auth_screens/events/create_event_form.dart @@ -0,0 +1,125 @@ +// ignore_for_file: talawa_good_doc_comments, talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; + +/// CreateEventForm returns a widget of a Form for creating events in the organization. +/// This widget is used in CreateEventPage widget. +class CreateEventForm extends StatelessWidget { + const CreateEventForm({super.key, required this.model}); + final CreateEventViewModel model; + @override + Widget build(BuildContext context) { + // Form class is a container for grouping together multiple form field widgets. + return Form( + key: model.formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Text field for event title. + TextFormField( + key: const Key('create_event_form_tff1'), + textInputAction: TextInputAction.next, + controller: model.eventTitleTextController, + keyboardType: TextInputType.name, + maxLength: 20, + focusNode: model.titleFocus, + validator: (value) => Validator.validateEventForm(value!, 'Title'), + decoration: InputDecoration( + // placeholder of the text field + labelText: AppLocalizations.of(context)! + .strictTranslate('Add Event Title'), + isDense: true, + labelStyle: Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + counterText: "", + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.title, + size: 25, + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // Text field for the location. + TextFormField( + key: const Key('create_event_form_tff2'), + textInputAction: TextInputAction.next, + keyboardType: TextInputType.streetAddress, + controller: model.eventLocationTextController, + focusNode: model.locationFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Location'), + decoration: InputDecoration( + hintText: AppLocalizations.of(context)! + .strictTranslate('Where is the event?'), + labelText: + AppLocalizations.of(context)!.strictTranslate('Add Location'), + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.place, + size: 25, + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // Text field for event description. + TextFormField( + key: const Key('create_event_form_tff3'), + keyboardType: TextInputType.multiline, + controller: model.eventDescriptionTextController, + focusNode: model.descriptionFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Description'), + maxLines: 10, + minLines: 1, + decoration: InputDecoration( + hintText: AppLocalizations.of(context)! + .strictTranslate('Describe the event'), + labelText: AppLocalizations.of(context)! + .strictTranslate('Add Description'), + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.view_headline, + size: 25, + ), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/views/after_auth_screens/events/create_event_page.dart b/lib/views/after_auth_screens/events/create_event_page.dart new file mode 100644 index 000000000..878e31a48 --- /dev/null +++ b/lib/views/after_auth_screens/events/create_event_page.dart @@ -0,0 +1,543 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_venue.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/create_event_form.dart'; +import 'package:talawa/views/after_auth_screens/events/venue_bottom_sheet.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/add_members_bottom_sheet.dart'; +import 'package:talawa/widgets/date_time_picker.dart'; +import 'package:talawa/widgets/event_date_time_tile.dart'; +import 'package:talawa/widgets/member_name_tile.dart'; +import 'package:talawa/widgets/recurrence_dialog.dart'; + +/// CreateEventPage returns a widget that has mutable state _CreateEventPageState. +class CreateEventPage extends StatefulWidget { + const CreateEventPage({super.key}); + + @override + _CreateEventPageState createState() => _CreateEventPageState(); +} + +/// _CreateEventPageState returns a widget for a Page to Creatxe the Event in the Organization. +class _CreateEventPageState extends State { + /// venue selected by the user. + Venue? selectedVenue; + + @override + Widget build(BuildContext context) { + final TextStyle subtitleTextStyle = + Theme.of(context).textTheme.headlineSmall!.copyWith(fontSize: 16); + final navigationServiceLocal = locator(); + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return Scaffold( + // AppBar is the header of the page + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 1, + centerTitle: true, + leading: GestureDetector( + onTap: () => navigationServiceLocal.pop(), + child: const Icon(Icons.close), + ), + title: Text( + AppLocalizations.of(context)!.strictTranslate('Add Event'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + actions: [ + TextButton( + key: const Key('addButton'), + onPressed: () { + if (userConfig.loggedIn) { + model.createEvent(); + } else { + navigationService.pop(); + MainScreenViewModel.scaffoldKey.currentState?.openDrawer(); + } + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Add'), + style: Theme.of(context).textTheme.bodyLarge!.copyWith( + fontSize: 16, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ), + ], + ), + body: Scrollbar( + thickness: 2, + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + const Icon( + Icons.image, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.036, + ), + TextButton( + key: const Key('txt_btn_cep'), + onPressed: () { + model.getImageFromGallery(); + }, + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Add Image"), + style: subtitleTextStyle, + ), + ), + ], + ), + model.imageFile != null + ? Container( + height: 300, + padding: const EdgeInsets.all(8.0), + child: Stack( + children: [ + Image.file( + model.imageFile!, + fit: BoxFit.fitWidth, + width: MediaQuery.of(context).size.width, + ), + Positioned( + right: 5, + top: 5, + child: IconButton( + onPressed: () => model.removeImage(), + icon: const Icon( + Icons.cancel, + color: Colors.black, + ), + ), + ), + ], + ), + ) + : Container(), + const Divider(), + CreateEventForm( + model: model, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + const Divider(), + GestureDetector( + onTap: () async { + final List venues = await model.fetchVenues(); + if (!context.mounted) return; + final Venue? selected = + await showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (context) { + return VenueBottomSheet(venues: venues); + }, + ); + if (selected != null) { + setState(() { + selectedVenue = selected; + }); + } + }, + child: selectedVenue == null + ? Container( + height: 50.0, + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Row( + children: [ + const Icon(Icons.add_location), + const SizedBox(width: 10.0), + Text( + AppLocalizations.of(context)! + .strictTranslate('Add Venue'), + style: + Theme.of(context).textTheme.titleMedium, + ), + ], + ), + ) + : Container( + height: 100.0, + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Row( + children: [ + if (selectedVenue!.imageUrl!.isNotEmpty) + Image.network( + selectedVenue!.imageUrl!.replaceAll( + 'http://localhost:4000', + GraphqlConfig.orgURI! + .replaceFirst('/graphql', ''), + ), + ) + else + Image.asset( + 'assets/images/defaultImg.png', + width: 50, + height: 50, + fit: BoxFit.cover, + ), + const SizedBox(width: 10.0), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Text( + selectedVenue!.name!, + style: Theme.of(context) + .textTheme + .titleMedium, + ), + Text( + 'Capacity: ${selectedVenue!.capacity}', + style: Theme.of(context) + .textTheme + .bodySmall, + ), + ], + ), + ), + Column( + children: [ + IconButton( + onPressed: () { + setState(() { + selectedVenue = null; + }); + }, + icon: const Icon(Icons.cancel), + ), + const Icon(Icons.edit), + ], + ), + ], + ), + ), + ), + const Divider(), + SizedBox( + width: SizeConfig.screenWidth, + child: Wrap( + alignment: WrapAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + AppLocalizations.of(context)! + .strictTranslate('Keep Registerable'), + style: subtitleTextStyle, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.005, + ), + Switch( + value: model.isRegisterableSwitch, + onChanged: (value) { + setState(() { + model.isRegisterableSwitch = value; + }); + }, + activeColor: + Theme.of(context).colorScheme.primary, + ), + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + AppLocalizations.of(context)! + .strictTranslate('All day'), + style: subtitleTextStyle, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.005, + ), + Switch( + // Switch to select the visibility of the event. + value: model.isAllDay, + onChanged: (value) { + setState(() { + model.isAllDay = value; + }); + }, + activeColor: + Theme.of(context).colorScheme.primary, + ), + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + AppLocalizations.of(context)! + .strictTranslate('Keep Public'), + style: subtitleTextStyle, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.005, + ), + Switch( + value: model.isPublicSwitch, + onChanged: (value) { + setState(() { + model.isPublicSwitch = value; + }); + }, + activeColor: + Theme.of(context).colorScheme.primary, + ), + ], + ), + ], + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + const Divider(), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + Text( + AppLocalizations.of(context)!.strictTranslate( + model.isAllDay + ? 'Select Start Date' + : 'Select Start Date and Time', + ), + style: subtitleTextStyle, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // DateTimeTile is custom widget that returns a tile to select date and time. + DateTimeTile( + isAllDay: model.isAllDay, + date: "${model.eventStartDate.toLocal()}".split(' ')[0], + time: model.eventStartTime.format(context), + setDate: () async { + final date = await customDatePicker( + initialDate: model.eventStartDate, + ); + if (date.isBefore(DateTime.now())) { + navigationServiceLocal.showSnackBar( + "Cannot create events having date prior than today ", + ); + } + setState(() { + if (model.eventStartDate != date) { + model.eventStartDate = date; + model.recurrenceStartDate = date; + model.recurrenceLabel = 'Does not repeat'; + model.isRecurring = false; + model.frequency = Frequency.weekly; + model.weekDays = {}; + model.weekDayOccurenceInMonth = null; + } + }); + }, + setTime: () async { + final time = await customTimePicker( + initialTime: model.eventStartTime, + ); + final validationError = Validator.validateEventTime( + time, + model.eventEndTime, + ); + if (validationError != null) { + // coverage:ignore-start + navigationService.showTalawaErrorSnackBar( + 'Start time must be before end time', + MessageType.error, + ); + // coverage:ignore-end + } else { + setState(() { + model.eventStartTime = time; + }); + } + }, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.026, + ), + Text( + AppLocalizations.of(context)!.strictTranslate( + model.isAllDay + ? 'Select End Date' + : 'Select End Date and Time', + ), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 16), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + DateTimeTile( + key: const Key('key for test cep'), + isAllDay: model.isAllDay, + date: "${model.eventEndDate.toLocal()}".split(' ')[0], + time: model.eventEndTime.format(context), + setDate: () async { + final date = await customDatePicker( + initialDate: model.eventEndDate, + ); + final startDate = model.eventStartDate; + // coverage:ignore-start + if (startDate.compareTo(date) < 0) { + setState(() { + if (model.eventEndDate != date) { + model.eventEndDate = date; + model.recurrenceLabel = 'Does not repeat'; + model.recurrenceEndDate = null; + model.isRecurring = false; + model.frequency = Frequency.weekly; + model.weekDays = {}; + model.weekDayOccurenceInMonth = null; + } + }); + // coverage:ignore-end + } else { + navigationServiceLocal.showSnackBar( + "End Date cannot be after start date ", + ); + } + }, + setTime: () async { + final time = await customTimePicker( + initialTime: model.eventEndTime, + ); + final validationError = Validator.validateEventTime( + model.eventStartTime, + time, + ); + final showSnackBar = + navigationService.showTalawaErrorSnackBar; + if (validationError != null) { + // coverage:ignore-start + showSnackBar( + 'Start time must be before end time', + MessageType.error, + ); + // coverage:ignore-end + } else { + setState(() { + model.eventEndTime = time; + }); + } + }, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.026, + ), + InkWell( + key: const Key('inkwell_recurrLabel'), + child: Row( + children: [ + const Icon(Icons.restore), + SizedBox( + width: SizeConfig.screenWidth! * 0.045, + ), + Expanded( + child: Text( + AppLocalizations.of(context)! + .strictTranslate(model.recurrenceLabel), + style: subtitleTextStyle, + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + onTap: () async { + final String? selectedReccurence; + selectedReccurence = await showDialog( + context: context, + builder: (context) { + return ShowRecurrenceDialog( + model: model, + ); + }, + ); + setState(() { + if (selectedReccurence != null) { + model.recurrenceLabel = selectedReccurence; + } + }); + }, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.026), + const Divider(), + InkWell( + key: const Key('inwell_cep2'), + onTap: () { + EventBottomSheet().addUserBottomSheet( + context: context, + model: model, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + AppLocalizations.of(context)! + .strictTranslate("Add Members"), + style: subtitleTextStyle, + ), + Icon( + Icons.add, + color: Theme.of(context).colorScheme.secondary, + ), + ], + ), + ), + Wrap( + children: model.selectedMembers + .map( + (user) => MemberNameTile( + userName: "${user.firstName!} ${user.lastName!}", + userImage: user.image, + onDelete: () { + model.removeUserFromList( + userId: user.id!, + ); + }, + ), + ) + .toList() + .cast(), + ), + ], + ), + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/events/edit_agenda_item_page.dart b/lib/views/after_auth_screens/events/edit_agenda_item_page.dart new file mode 100644 index 000000000..f620c3c63 --- /dev/null +++ b/lib/views/after_auth_screens/events/edit_agenda_item_page.dart @@ -0,0 +1,374 @@ +import 'dart:convert'; + +import 'package:delightful_toast/delight_toast.dart'; +import 'package:delightful_toast/toast/components/toast_card.dart'; +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +/// Screen for edit agenda item. +class EditAgendaItemPage extends StatefulWidget { + const EditAgendaItemPage({ + super.key, + required this.agendaItem, + required this.categories, + }); + + /// agenda item that is going to be be updated. + final EventAgendaItem agendaItem; + + /// list of categories in that organisation. + final List categories; + + @override + _EditAgendaItemPageState createState() => _EditAgendaItemPageState(); +} + +class _EditAgendaItemPageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => + model.initialize(widget.agendaItem, widget.categories), + builder: (context, model, child) { + return Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 1, + centerTitle: true, + leading: GestureDetector( + onTap: () => locator().pop(), + child: const Icon(Icons.close), + ), + title: Text( + AppLocalizations.of(context)!.strictTranslate('Edit Agenda Item'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + actions: [ + TextButton( + key: const Key('updateButton'), + onPressed: () async { + if (model.checkForChanges()) { + await model.updateAgendaItem(); + if (context.mounted) { + Navigator.of(context).pop(true); + } + } else { + DelightToastBar( + snackbarDuration: const Duration(seconds: 2), + builder: (context) { + return ToastCard( + title: const Text( + "No changes made", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + leading: const Icon( + Icons.error_outline, + color: Colors.redAccent, + ), + color: Colors.black.withOpacity(0.8), + ); + }, + ).show(context); + } + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Update'), + style: Theme.of(context).textTheme.bodyLarge!.copyWith( + fontSize: 16, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ), + ], + ), + body: Scrollbar( + thickness: 2, + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DropdownButtonFormField( + key: const Key('edit_agenda_item_category_dropdown'), + value: model.selectedCategories.isNotEmpty + ? model.selectedCategories.first + : null, + onChanged: (AgendaCategory? category) { + if (category != null) { + final updatedCategories = List.from( + model.selectedCategories, + ); + if (updatedCategories.contains(category)) { + updatedCategories.remove(category); + } else { + updatedCategories.add(category); + } + model.setSelectedCategories(updatedCategories); + } + }, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Select Categories'), + border: const OutlineInputBorder(), + ), + items: model.categories + .map>( + (AgendaCategory category) { + return DropdownMenuItem( + value: category, + child: Text(category.name!), + ); + }).toList(), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + Wrap( + spacing: 8.0, + runSpacing: 4.0, + children: model.selectedCategories.map((category) { + return Chip( + key: Key(category.name!), + label: Text(category.name!), + onDeleted: () { + final updatedCategories = List.from( + model.selectedCategories, + ); + updatedCategories.remove(category); + model.setSelectedCategories(updatedCategories); + }, + deleteIconColor: Colors.redAccent, + ); + }).toList(), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + TextFormField( + key: const Key('edit_event_agenda_tf1'), + textInputAction: TextInputAction.next, + controller: model.titleController, + keyboardType: TextInputType.name, + maxLength: 20, + validator: (value) => + Validator.validateEventForm(value!, 'Title'), + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Agenda Item Title'), + isDense: true, + labelStyle: Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + counterText: "", + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.title, + size: 25, + ), + ), + ), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + TextFormField( + key: const Key('edit_event_agenda_tf2'), + keyboardType: TextInputType.multiline, + controller: model.descriptionController, + validator: (value) => + Validator.validateEventForm(value!, 'Description'), + maxLines: 10, + minLines: 1, + decoration: InputDecoration( + hintText: AppLocalizations.of(context)! + .strictTranslate('Describe the agenda item'), + labelText: AppLocalizations.of(context)! + .strictTranslate('Description'), + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.view_headline, + size: 25, + ), + ), + ), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + TextFormField( + key: const Key('edit_event_agenda_duration'), + controller: model.durationController, + keyboardType: TextInputType.text, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Duration (mm:ss)'), + hintText: '00:00', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: const OutlineInputBorder(), + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.timer, + size: 25, + ), + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return AppLocalizations.of(context)! + .strictTranslate('Please enter a duration'); + } + // Add additional validation for mm:ss format if needed + return null; + }, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + Row( + children: [ + Expanded( + child: TextFormField( + key: const Key('urlTextField'), + controller: model.urlController, + maxLines: 5, + minLines: 1, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Add URL'), + labelStyle: + Theme.of(context).textTheme.titleMedium, + border: const OutlineInputBorder(), + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.add_link_outlined, + size: 25, + ), + ), + ), + ), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + ElevatedButton( + onPressed: () { + model.addUrl(model.urlController.text); + model.urlController.clear(); + }, + child: Text( + AppLocalizations.of(context)! + .strictTranslate('Add'), + ), + ), + ], + ), + const SizedBox(height: 10), + Wrap( + spacing: 8.0, + runSpacing: 4.0, + children: model.urls.map((url) { + return Chip( + key: Key(url), + label: Text(url), + onDeleted: () => model.removeUrl(url), + deleteIconColor: Colors.redAccent, + ); + }).toList(), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + ElevatedButton.icon( + onPressed: () => model.pickAttachment(fromCamera: false), + icon: const Icon(Icons.attach_file), + label: Text( + AppLocalizations.of(context)! + .strictTranslate('Add Attachments'), + ), + ), + const Divider(), + const SizedBox(height: 10), + GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + ), + itemCount: model.attachments.length, + itemBuilder: (context, index) { + final base64String = model.attachments[index]; + final imageData = base64Decode(base64String); + return Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(8), + child: Image.memory( + imageData, + fit: BoxFit.cover, + width: double.infinity, + height: double.infinity, + ), + ), + Positioned( + top: 0, + right: 0, + child: GestureDetector( + onTap: () => + model.removeAttachment(base64String), + child: Container( + padding: const EdgeInsets.all(4), + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + child: const Icon( + Icons.close, + color: Colors.white, + size: 18, + ), + ), + ), + ), + ], + ); + }, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + ], + ), + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/events/edit_event_page.dart b/lib/views/after_auth_screens/events/edit_event_page.dart new file mode 100644 index 000000000..8ea4d2a6d --- /dev/null +++ b/lib/views/after_auth_screens/events/edit_event_page.dart @@ -0,0 +1,230 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.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/edit_event_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/edit_events_form.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/date_time_picker.dart'; +import 'package:talawa/widgets/event_date_time_tile.dart'; + +/// EditEventPage returns a widget that has mutable state _EditEventPageState. +class EditEventPage extends StatefulWidget { + const EditEventPage({super.key, required this.event}); + + /// Represents event instance to be edited. + final Event event; + + @override + _EditEventPageState createState() => _EditEventPageState(); +} + +/// _EditEventPageState returns a widget to edit the event that is being posted by the current user. +class _EditEventPageState extends State { + @override + Widget build(BuildContext context) { + final TextStyle subtitleTextStyle = + Theme.of(context).textTheme.headlineSmall!.copyWith(fontSize: 16); + return BaseView( + onModelReady: (model) => model.initialize(widget.event), + builder: (context, model, child) { + return Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 1, + centerTitle: true, + leading: GestureDetector( + onTap: () { + navigationService.pop(); + }, + child: const Icon(Icons.close), + ), + // Title of the app bar(header). + title: Text( + 'Edit Event', + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + actions: [ + // Button for "Done". + TextButton( + onPressed: () { + model.updateEvent(); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Done'), + style: Theme.of(context).textTheme.bodyLarge!.copyWith( + fontSize: 16, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ), + ], + ), + body: SingleChildScrollView( + // SingleChildScrollView is a box in which a single widget can be scrolled. + child: Padding( + padding: const EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + const Icon( + Icons.image, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.036, + ), + TextButton( + onPressed: () {}, + child: Text("Add Image", style: subtitleTextStyle), + ), + ], + ), + const Divider(), + EditEventForm( + model: model, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + const Divider(), + Text('Select Start Date and Time', style: subtitleTextStyle), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + DateTimeTile( + isAllDay: false, + // variables and member functions initialisation. + date: "${model.eventStartDate.toLocal()}".split(' ')[0], + time: model.eventStartTime.format(context), + setDate: () async { + final date = await customDatePicker( + initialDate: model.eventStartDate, + ); + setState(() { + model.eventStartDate = date; + }); + }, + setTime: () async { + final time = await customTimePicker( + initialTime: model.eventStartTime, + ); + setState(() { + model.eventStartTime = time; + }); + }, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.026, + ), + Text( + 'Select End Date and Time', + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 16), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + DateTimeTile( + isAllDay: false, + date: "${model.eventEndDate.toLocal()}".split(' ')[0], + time: model.eventEndTime.format(context), + setDate: () async { + final date = await customDatePicker( + initialDate: model.eventEndDate, + ); + setState(() { + model.eventEndDate = date; + }); + }, + setTime: () async { + final time = await customTimePicker( + initialTime: model.eventEndTime, + ); + + setState(() { + model.eventEndTime = time; + }); + }, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.026, + ), + Row( + children: [ + const Icon(Icons.restore), + SizedBox( + width: SizeConfig.screenWidth! * 0.045, + ), + Text('Does not repeat', style: subtitleTextStyle), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.026, + ), + const Divider(), + SizedBox( + width: SizeConfig.screenWidth, + child: Wrap( + alignment: WrapAlignment.spaceBetween, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text('Keep Public', style: subtitleTextStyle), + SizedBox( + width: SizeConfig.screenWidth! * 0.005, + ), + Switch( + value: model.isPublicSwitch, + onChanged: (value) { + setState(() { + model.isPublicSwitch = value; + }); + }, + activeColor: + Theme.of(context).colorScheme.primary, + ), + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + 'Keep Registerable', + style: subtitleTextStyle, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.005, + ), + Switch( + value: model.isRegisterableSwitch, + onChanged: (value) { + setState(() { + model.isRegisterableSwitch = value; + }); + }, + activeColor: + Theme.of(context).colorScheme.primary, + ), + ], + ), + ], + ), + ), + ], + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/events/edit_events_form.dart b/lib/views/after_auth_screens/events/edit_events_form.dart new file mode 100644 index 000000000..68f7f514d --- /dev/null +++ b/lib/views/after_auth_screens/events/edit_events_form.dart @@ -0,0 +1,135 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart'; + +/// EditEventForm returns a widget of a Form for editing an event. +/// This widget is used in EditEventPage widget. +class EditEventForm extends StatelessWidget { + const EditEventForm({super.key, required this.model}); + final EditEventViewModel model; + @override + Widget build(BuildContext context) { + // Form class is a container for grouping together multiple form field widgets. + return Form( + key: model.formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Text field for event title. + TextFormField( + textInputAction: TextInputAction.next, + controller: model.eventTitleTextController, + keyboardType: TextInputType.name, + maxLength: 20, + focusNode: model.titleFocus, + validator: (value) => Validator.validateEventForm(value!, 'Title'), + decoration: InputDecoration( + labelText: 'Add Event Title', + isDense: true, + labelStyle: Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + counterText: "", + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.title, + size: 25, + ), + ), + suffixIcon: IconButton( + onPressed: () { + FocusScope.of(context).requestFocus(model.titleFocus); + }, + icon: const Icon(Icons.edit), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // Text field for the location. + TextFormField( + textInputAction: TextInputAction.next, + keyboardType: TextInputType.streetAddress, + controller: model.eventLocationTextController, + focusNode: model.locationFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Location'), + decoration: InputDecoration( + hintText: 'Where is the event?', + labelText: 'Add Location', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.place, + size: 25, + ), + ), + suffixIcon: IconButton( + onPressed: () { + FocusScope.of(context).requestFocus(model.locationFocus); + }, + icon: const Icon(Icons.edit), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // Text field for event description. + TextFormField( + keyboardType: TextInputType.multiline, + controller: model.eventDescriptionTextController, + focusNode: model.descriptionFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Description'), + maxLines: 10, + minLines: 1, + decoration: InputDecoration( + hintText: 'Describe the event', + labelText: 'Add Description', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.view_headline, + size: 25, + ), + ), + suffixIcon: IconButton( + onPressed: () { + FocusScope.of(context).requestFocus(model.descriptionFocus); + }, + icon: const Icon(Icons.edit), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/views/after_auth_screens/events/event_calendar.dart b/lib/views/after_auth_screens/events/event_calendar.dart new file mode 100644 index 000000000..e444b6271 --- /dev/null +++ b/lib/views/after_auth_screens/events/event_calendar.dart @@ -0,0 +1,190 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:syncfusion_flutter_calendar/calendar.dart'; +import 'package:syncfusion_flutter_datepicker/datepicker.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_calendar_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/date_time_picker.dart'; + +/// EventCalendar returns a widget that has mutable state _EventCalendarState. +class EventCalendar extends StatelessWidget { + const EventCalendar(this.eventList, {super.key}); + + /// List of events that needs to bge passed when the calling this widget. + final List eventList; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(eventList), + builder: (context, model, child) { + print(model.calendarView); + return Scaffold( + // header of the page. + appBar: AppBar( + title: const Text('Event Calendar'), + actions: [ + IconButton( + // button to select the date and time of an event. + onPressed: () async { + // initially pickedDate is initialised with current time. + final pickedDate = + await customDatePicker(initialDate: DateTime.now()); + model.selectionChanged( + DateRangePickerSelectionChangedArgs(pickedDate), + ); + }, + icon: const Icon(Icons.date_range), + ), + calendarViewSelection(model), + ], + ), + body: Column( + children: [ + // SizedBox( + // height: 100, + // // The SfDateRangePicker widget provides four different types of views to display. + // //It can be assigned to the widget constructor by using the view property. + // child: SfDateRangePicker( + // view: DateRangePickerView.month, + // controller: model.dateRangePickerController, + // showNavigationArrow: true, + // allowViewNavigation: false, + // monthViewSettings: const DateRangePickerMonthViewSettings( + // numberOfWeeksInView: 1, + // dayFormat: 'EEE', + // ), + // onSelectionChanged: model.selectionChanged, + // ), + // ), + Expanded( + child: SfCalendar( + view: model.calendarView, + headerHeight: 60, + viewHeaderHeight: 60, + controller: model.calendarController, + dataSource: _getCalendarDataSource(eventList), + onViewChanged: model.viewChanged, + ), + ), + ], + ), + ); + }, + ); + } + + /// Popupmenu Button to select calendar view. + /// + /// **params**: + /// * `model`: EventCalendarViewModel. + /// + /// **returns**: + /// * `PopupMenuButton`: custom PopupMenuButton.. + PopupMenuButton calendarViewSelection(EventCalendarViewModel model) { + final List views = ["Day", "Month", "Schedule"]; + return PopupMenuButton( + itemBuilder: (context) { + return >[ + for (final view in views) + PopupMenuItem( + value: view, + child: Text(view), + ), + ]; + }, + onSelected: (value) { + model.changeView(value); + }, + ); + } +} + +/// function to convert List to Appointment object. +/// +/// Appointment is provided by the calender external library +/// +/// **params**: +/// * `eventsList`: list of events to be converted +/// +/// **returns**: +/// * `_AppointmentDataSource`: Entire data in [](list) format +_AppointmentDataSource _getCalendarDataSource(List eventsList) { + final appointments = []; + final colors = [ + Colors.green, + Colors.blue, + Colors.red, + Colors.orange, + Colors.purple, + Colors.pink, + ]; + int index = 0; + // looping through all the events created in the organization. + eventsList.forEach((event) { + DateTime startDate; + DateTime endDate; + if (event.startDate!.contains('/')) { + startDate = DateFormat('MM/dd/yyyy').parse(event.startDate!); + } else { + startDate = DateFormat('yyyy-MM-dd').parse(event.startDate!); + } + + if (event.endDate!.contains('/')) { + endDate = DateFormat('MM/dd/yyyy').parse(event.endDate!); + } else { + endDate = DateFormat('yyyy-MM-dd').parse(event.endDate!); + } + print("${event.startTime!}##############################"); + final startTime = parseTime(event.startTime ?? '14:23:01'); + final endTime = parseTime(event.endTime ?? '21:23:01'); + + // adding appointments on the calender for event[index] date time. + appointments.add( + Appointment( + startTime: startDate + .add(Duration(hours: startTime.hour, minutes: startTime.minute)), + endTime: + endDate.add(Duration(hours: endTime.hour, minutes: endTime.minute)), + subject: event.title!, + color: colors[index % colors.length], + location: event.location, + id: event.id, + ), + ); + index++; + }); + + return _AppointmentDataSource(appointments); +} + +/// a_line_ending_with_end_punctuation. +/// +/// **params**: +/// * `time`: define_the_param +/// +/// **returns**: +/// * `DateTime`: define_the_return +DateTime parseTime(String time) { + try { + return DateFormat('h:mm a', 'en_US').parse(time); + } on FormatException { + print('Caught FormatException: $time'); + try { + return DateFormat('Hms').parse(time); + } catch (e) { + print('Caught error: $e'); + throw Exception('Invalid time format: $time'); + } + } +} + +/// class for handling the data source. +/// +/// assign the appointments value +class _AppointmentDataSource extends CalendarDataSource { + _AppointmentDataSource(List source) { + appointments = source; + } +} 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 000000000..a16452148 --- /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/event_info_body.dart b/lib/views/after_auth_screens/events/event_info_body.dart new file mode 100644 index 000000000..06f86db7c --- /dev/null +++ b/lib/views/after_auth_screens/events/event_info_body.dart @@ -0,0 +1,259 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.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/event_info_view_model.dart'; +import 'package:talawa/widgets/custom_list_tile.dart'; + +/// EventInfoBody returns a stateless widget which describes the body of a particular event. +class EventInfoBody extends StatelessWidget { + const EventInfoBody({super.key}); + + @override + Widget build(BuildContext context) { + // fetching the event data from model + final model = Provider.of(context); + final event = model.event; + // Slivers are special-purpose widgets that can be combined using a + //CustomScrollView to create custom scroll effects. A SliverToBoxAdapter + //is a basic sliver that creates a bridge back to one of the usual box-based widgets. + return SliverToBoxAdapter( + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Container( + padding: EdgeInsets.only( + right: SizeConfig.safeBlockHorizontal! * 15, + ), + child: Row( + children: [ + Flexible( + child: Text( + // event title + event.title!, + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith(fontSize: 26), + ), + ), + ], + ), + ), + Positioned( + right: SizeConfig.screenWidth! * 0.002, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + (model.event.creator!.id == userConfig.currentUser.id) + ? IconButton( + onPressed: () => navigationService.pushScreen( + "/editEventPage", + arguments: model.event, + ), + icon: const Icon(Icons.edit), + ) + : Container(), + const Icon(Icons.chat_bubble_outline), + ], + ), + ), + ], + ), + Text( + // Display event creator full name. + "${AppLocalizations.of(context)!.strictTranslate("Created by")}: ${event.creator!.firstName} ${event.creator!.lastName}", + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(fontWeight: FontWeight.w600), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.011, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon( + Icons.calendar_today, + size: 13, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.027, + ), + Text( + // Display start and end date of the Event. + "${event.startDate} - ${event.endDate}", + style: Theme.of(context).textTheme.bodySmall, + ), + const Spacer(), + // If event type is public then renders lock_open icon else renders lock icon. + event.isPublic! + ? Icon( + Icons.lock_open, + size: 13, + color: Theme.of(context).colorScheme.secondary, + ) + : Icon( + Icons.lock, + size: 13, + color: Theme.of(context).colorScheme.primary, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.027, + ), + // If event type is public then renders 'public' + // else renders 'private' text translated into the app language. + event.isPublic! + ? Text( + AppLocalizations.of(context)!.strictTranslate('public'), + style: Theme.of(context).textTheme.bodySmall, + ) + : Text( + AppLocalizations.of(context)! + .strictTranslate('private'), + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.011, + ), + if (event.startTime != null && event.endTime != null) + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // display schedule icon with the start and end date of the time. + const Icon( + Icons.schedule, + size: 12, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.025, + ), + Text( + "${event.startTime} - ${event.endTime}", + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.011, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon( + Icons.place, + size: 12, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.027, + ), + Text( + event.location!, + style: Theme.of(context).textTheme.bodySmall, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + maxLines: 3, + ), + const Spacer(), + ], + ), + const Divider(), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + Text( + AppLocalizations.of(context)!.strictTranslate("Description"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 16), + ), + SizedBox(width: SizeConfig.screenWidth! * 0.013), + Text( + // Display the Description of the event if not null. + event.description!, + style: Theme.of(context).textTheme.bodySmall, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + Text( + AppLocalizations.of(context)!.strictTranslate("Admins"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 16), + ), + Divider( + color: Theme.of(context).colorScheme.onSurface, + thickness: 2, + ), + ListView.builder( + padding: EdgeInsets.zero, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: event.admins!.length, + itemBuilder: (BuildContext context, int index) { + return CustomListTile( + key: Key( + '${AppLocalizations.of(context)!.strictTranslate("Admins")}$index', + ), + index: index, + type: TileType.user, + userInfo: event.admins![index], + onTapUserInfo: () {}, + ); + }, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + Text( + AppLocalizations.of(context)!.strictTranslate("Attendees"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 16), + ), + Divider( + color: Theme.of(context).colorScheme.onSurface, + thickness: 2, + ), + if (model.isBusy) + // if the model is still fetching the attendees details then display Circular Progress Indicator Icon. + const Padding( + padding: EdgeInsets.only(top: 12.0), + child: Center(child: CircularProgressIndicator()), + ) + else + // else if the model fetched the attendees details successfully + //then renders all the attendees in ListView. + ListView.builder( + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: model.attendees.length, + itemBuilder: (BuildContext context, int index) { + return CustomListTile( + key: Key( + 'Attendee$index', + ), + index: index, + type: TileType.attendee, + attendeeInfo: model.attendees[index], + onTapAttendeeInfo: () {}, + ); + }, + ), + ], + ), + ), + ); + } +} diff --git a/lib/views/after_auth_screens/events/event_info_page.dart b/lib/views/after_auth_screens/events/event_info_page.dart new file mode 100644 index 000000000..fd4c926a8 --- /dev/null +++ b/lib/views/after_auth_screens/events/event_info_page.dart @@ -0,0 +1,140 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.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/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/event_info_body.dart'; +import 'package:talawa/views/after_auth_screens/events/manage_agenda_items_screen.dart'; +import 'package:talawa/views/after_auth_screens/events/volunteer_groups_screen.dart'; +import 'package:talawa/views/base_view.dart'; + +/// EventInfoPage returns a widget that has mutable state _EventInfoPageState. +class EventInfoPage extends StatefulWidget { + const EventInfoPage({super.key, required this.args}); + + /// Takes in Arguments for the Page. + final Map args; + + @override + _EventInfoPageState createState() => _EventInfoPageState(); +} + +class _EventInfoPageState extends State + with SingleTickerProviderStateMixin { + late TabController _tabController; + bool _showFloatingActionButton = true; + + @override + void initState() { + super.initState(); + // TabController length will depend on whether the user is the event creator + final bool isCreator = (widget.args["event"] as Event).creator!.id == + userConfig.currentUser.id; + final int tabCount = isCreator ? 3 : 2; + + _tabController = TabController(length: tabCount, vsync: this); + _tabController.addListener(() { + setState(() { + _showFloatingActionButton = _tabController.index == 0; + }); + }); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(args: widget.args), + builder: (context, model, child) { + final bool isCreator = model.event.creator != null && + model.event.creator!.id == userConfig.currentUser.id; + + return Scaffold( + appBar: AppBar( + title: Text( + AppLocalizations.of(context)!.strictTranslate('Event Details'), + ), + bottom: TabBar( + key: const Key("tabBar"), + controller: _tabController, + tabs: [ + const Tab( + text: "Info", + key: Key('info_tag'), + ), + const Tab( + text: "Volunteers", + key: Key('volunteer_tag'), + ), + if (isCreator) + const Tab( + text: "Agendas", + key: Key('agenda_tag'), + ), + ], + ), + ), + body: TabBarView( + controller: _tabController, + children: [ + Scaffold( + body: CustomScrollView( + slivers: [ + SliverAppBar( + automaticallyImplyLeading: false, + pinned: true, + expandedHeight: SizeConfig.screenWidth, + flexibleSpace: FlexibleSpaceBar( + background: Image.network( + 'https://picsum.photos/id/26/200/300', + fit: BoxFit.fill, + ), + ), + ), + const EventInfoBody(), + ], + ), + floatingActionButton: _showFloatingActionButton + ? (model.event.creator != null && + model.event.creator!.id != + userConfig.currentUser.id) + ? FloatingActionButton.extended( + key: const Key("registerEventFloatingbtn"), + onPressed: () { + model.registerForEvent(); + }, + label: Text( + AppLocalizations.of(context)! + .strictTranslate(model.fabTitle), + style: Theme.of(context).textTheme.bodyMedium, + ), + ) + : FloatingActionButton( + onPressed: () { + (widget.args["exploreEventViewModel"] + as ExploreEventsViewModel) + .deleteEvent(eventId: model.event.id!); + }, + foregroundColor: + Theme.of(context).colorScheme.secondary, + backgroundColor: Theme.of(context).primaryColor, + child: const Icon(Icons.delete), + ) + : null, + ), + VolunteerGroupsScreen(event: model.event, model: model), + if (isCreator) const ManageAgendaScreen(), + ], + ), + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/events/explore_event_dialogue.dart b/lib/views/after_auth_screens/events/explore_event_dialogue.dart new file mode 100644 index 000000000..4155a6762 --- /dev/null +++ b/lib/views/after_auth_screens/events/explore_event_dialogue.dart @@ -0,0 +1,157 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/date_time_picker.dart'; + +/// ExploreEventDialog returns a widget that has mutable state _ExploreEventDialogState. +class ExploreEventDialog extends StatefulWidget { + const ExploreEventDialog({required Key key}) : super(key: key); + @override + _ExploreEventDialogState createState() => _ExploreEventDialogState(); +} + +/// _ExploreEventDialogState returns a widget that show explored dialog of the event. +class _ExploreEventDialogState extends State { + DateTime _startDate = DateTime.now(); + DateTime _endDate = DateTime.now().add(const Duration(days: 1)); + + @override + Widget build(BuildContext context) { + return AlertDialog( + insetPadding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.15, + ), + content: SizedBox( + height: SizeConfig.screenHeight! * 0.33, + // width: SizeConfig.screenWidth! * 0.3, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 6), + child: Column( + children: [ + datePicker( + context, + key: const Key('StartDateSelector'), + title: 'Start Date', + date: _startDate, + onTap: () async { + final date = + await customDatePicker(initialDate: _startDate); + setState(() { + _startDate = date; + }); + }, + ), + datePicker( + context, + key: const Key('EndDateSelector'), + title: 'End Date', + date: _endDate, + onTap: () async { + final date = + await customDatePicker(initialDate: _endDate); + setState(() { + _endDate = date; + }); + }, + ), + ], + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + TextButton( + key: const Key('CancelButton'), + onPressed: () { + navigationService.pop(); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Cancel'), + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + TextButton( + key: const Key('DoneButton'), + onPressed: () { + navigationService.pop(); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Done'), + style: const TextStyle( + fontSize: 14, + color: Color(0xff4285F4), + ), + ), + ), + ], + ), + ], + ), + ), + ); + } + + /// Creates a column with a date picker. + /// + /// **params**: + /// * `context`: A `BuildContext` representing the build context. + /// * `title`: A `String` representing the title of the date picker. + /// * `onTap`: A `void Function()` callback triggered when the date picker is tapped. + /// * `date`: A `DateTime` representing the selected date for the date picker. + /// * `key`: A `Key` to identify and differentiate the date picker widget. + /// + /// **returns**: + /// * `Column`: Returns a `Column` widget containing the date picker elements. + Column datePicker( + BuildContext context, { + required String title, + required void Function()? onTap, + required DateTime date, + required Key key, + }) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + AppLocalizations.of(context)!.strictTranslate(title), + ), + const SizedBox( + height: 5, + ), + GestureDetector( + key: key, + onTap: onTap, + child: SizedBox( + height: SizeConfig.screenHeight! * 0.08, + child: Card( + color: Theme.of(context).colorScheme.primaryContainer, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Padding( + padding: EdgeInsets.symmetric(horizontal: 10), + child: Icon( + Icons.calendar_today, + size: 20, + ), + ), + Expanded( + // shows the end date of the event + child: Text( + "${date.toLocal()}".split(' ')[0], + // maxLines: 1, + ), + ), + ], + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/views/after_auth_screens/events/explore_events.dart b/lib/views/after_auth_screens/events/explore_events.dart new file mode 100644 index 000000000..254989e97 --- /dev/null +++ b/lib/views/after_auth_screens/events/explore_events.dart @@ -0,0 +1,295 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.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'; +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'; +import 'package:talawa/widgets/event_search_delegate.dart'; + +/// Shows the list of events with options to categorize them. +class ExploreEvents extends StatelessWidget { + const ExploreEvents({ + required Key key, + this.homeModel, + }) : super(key: key); + + /// Represents the view model for the home screen. + final MainScreenViewModel? homeModel; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(), + builder: (context, model, child) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.green, + key: const Key( + "ExploreEventsAppBar", + ), + elevation: 0.0, + automaticallyImplyLeading: false, + centerTitle: true, + title: Text( + AppLocalizations.of(context)!.strictTranslate( + 'Explore Events', + ), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + color: Colors.white, + ), + ), + leading: IconButton( + color: Colors.white, + icon: const Icon( + Icons.menu, + ), + onPressed: () => + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(), + ), + actions: [ + Padding( + padding: EdgeInsets.only( + right: SizeConfig.screenWidth! * 0.027, + ), + child: model.events.isNotEmpty + ? IconButton( + onPressed: () { + showSearch( + context: context, + delegate: EventSearch( + eventList: model.events, + exploreEventsViewModel: model, + ), + ); + }, + icon: const Icon( + Icons.search, + color: Colors.white, + ), + ) + : const SizedBox(), + ), + ], + ), + body: model.isBusy + ? const Center( + child: CircularProgressIndicator(), + ) + : RefreshIndicator( + onRefresh: () async => model.refreshEvents(), + child: Stack( + children: [ + SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.010, + ), + child: Column( + children: [ + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 2, + child: GestureDetector( + onTap: () => showModalBottomSheet( + backgroundColor: Colors.white, + context: context, + builder: (_) => dropDownList( + model, + context, + ), + ), + child: Card( + surfaceTintColor: Theme.of(context) + .colorScheme + .secondaryContainer, + color: Theme.of(context) + .colorScheme + .onPrimary, + child: Container( + padding: const EdgeInsets.symmetric( + vertical: 12, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate( + "Filters", + ), + ), + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), + ], + ), + ), + ), + ), + ), + Expanded( + flex: 3, + child: GestureDetector( + onTap: () => showDialog( + context: context, + builder: (_) => + const ExploreEventDialog( + key: Key('ExploreEvents'), + ), + ), + child: Card( + surfaceTintColor: Theme.of(context) + .colorScheme + .secondaryContainer, + key: homeModel?.keySEDateFilter, + color: Theme.of(context) + .colorScheme + .onPrimary, + child: Container( + padding: const EdgeInsets.symmetric( + vertical: 12, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), + const Icon( + Icons.calendar_today, + color: Color(0xff524F4F), + ), + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate( + "Filter by Date", + ), + ), + SizedBox( + width: SizeConfig + .safeBlockHorizontal, + ), + ], + ), + ), + ), + ), + ), + Expanded( + flex: 1, + child: Card( + surfaceTintColor: Theme.of(context) + .colorScheme + .secondaryContainer, + color: Theme.of(context) + .colorScheme + .onPrimary, + child: IconButton( + onPressed: () { + navigationService.pushScreen( + Routes.calendar, + arguments: model.events, + ); + }, + icon: const Icon( + Icons.calendar_month, + ), + ), + ), + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.020, + ), + model.events.isEmpty + ? SizedBox( + height: SizeConfig.screenHeight! * 0.5, + child: Center( + child: Text( + AppLocalizations.of(context)! + .strictTranslate( + model.emptyListMessage, + ), + ), + ), + ) + : ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: model.events.length, + itemBuilder: + (BuildContext context, int index) { + return GestureDetector( + onTap: () { + navigationService.pushScreen( + "/eventInfo", + arguments: { + "event": model.events[index], + "exploreEventViewModel": model, + }, + ); + }, + child: EventCard( + event: model.events[index], + isSearchItem: false, + ), + ); + }, + ), + ], + ), + ), + ), + ], + ), + ), + floatingActionButton: FloatingActionButton.extended( + key: homeModel?.keySEAdd, + heroTag: "AddEventFab", + backgroundColor: Theme.of(context).colorScheme.surface, + onPressed: () => navigationService.pushScreen("/createEventPage"), + icon: Icon( + Icons.add, + color: Theme.of(context).colorScheme.secondary, + ), + label: Text( + AppLocalizations.of(context)!.strictTranslate("Event"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(color: Theme.of(context).colorScheme.secondary), + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/events/manage_agenda_items_screen.dart b/lib/views/after_auth_screens/events/manage_agenda_items_screen.dart new file mode 100644 index 000000000..0c27135b0 --- /dev/null +++ b/lib/views/after_auth_screens/events/manage_agenda_items_screen.dart @@ -0,0 +1,108 @@ +import 'package:delightful_toast/delight_toast.dart'; +import 'package:delightful_toast/toast/components/toast_card.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/create_agenda_item_page.dart'; +import 'package:talawa/views/after_auth_screens/events/edit_agenda_item_page.dart'; +import 'package:talawa/widgets/agenda_item_tile.dart'; + +/// Agenda section screen to manage agendas. +class ManageAgendaScreen extends StatelessWidget { + const ManageAgendaScreen({super.key}); + + @override + Widget build(BuildContext context) { + final model = Provider.of(context); + return Scaffold( + body: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + child: model.agendaItems.isEmpty + ? Center( + child: Text( + 'No agenda items yet', + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + color: Colors.white, + ), + ), + ) + : ReorderableListView.builder( + itemCount: model.agendaItems.length, + onReorder: (oldIndex, newIndex) { + model.reorderAgendaItems(oldIndex, newIndex); + }, + itemBuilder: (context, index) { + final item = model.agendaItems[index]; + return ExpandableAgendaItemTile( + key: Key("agenda_item$index"), + item: item, + onEdit: () async { + final bool? wasUpdated = await Navigator.push( + context, + MaterialPageRoute( + builder: (context) => EditAgendaItemPage( + agendaItem: item, + categories: model.categories, + ), + ), + ); + // Refresh agenda items only if changes were made + if (wasUpdated == true) { + await model.fetchAgendaItems(); + } + }, + onDelete: () async { + await model.deleteAgendaItem(item.id!); + if (context.mounted) { + DelightToastBar( + autoDismiss: true, + snackbarDuration: const Duration(seconds: 2), + builder: (context) { + return ToastCard( + title: const Text( + "Agenda item removed", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), + ), + leading: const Icon( + Icons.error_outline, + color: Colors.redAccent, + ), + color: Colors.black.withOpacity(0.8), + ); + }, + ).show(context); + } + }, + ); + }, + ), + ), + SizedBox(height: SizeConfig.screenHeight! * 0.011), + ElevatedButton.icon( + key: const Key('add_item_btn'), + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => CreateAgendaItemPage(model: model), + ), + ); + }, + icon: const Icon(Icons.add, color: Colors.white), + label: const Text('Add Agenda Item'), + ), + ], + ), + ), + ); + } +} diff --git a/lib/views/after_auth_screens/events/manage_volunteer_group.dart b/lib/views/after_auth_screens/events/manage_volunteer_group.dart new file mode 100644 index 000000000..9ee7eb2ce --- /dev/null +++ b/lib/views/after_auth_screens/events/manage_volunteer_group.dart @@ -0,0 +1,517 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +/// ManageGroupScreen handles the display and management of volunteers within a specific group. +/// +/// This screen shows the list of volunteers, their current status (Accepted, Rejected, Pending), +/// and allows the user to add new volunteers, edit group details, or delete the group. +class ManageGroupScreen extends StatelessWidget { + const ManageGroupScreen({ + super.key, + required this.group, + required this.event, + }); + + /// The volunteer group being managed. + final EventVolunteerGroup group; + + /// The event to which the volunteer group belongs. + final Event event; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(event, group), + builder: (context, model, child) { + return Scaffold( + appBar: AppBar( + centerTitle: true, + backgroundColor: Theme.of(context).primaryColor, + title: Text( + group.name!, + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + color: Colors.white, + ), + ), + ), + body: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + if (model.volunteers.isNotEmpty) + Container( + decoration: BoxDecoration( + color: Colors.green, + borderRadius: BorderRadius.circular(8), + ), + padding: const EdgeInsets.symmetric( + vertical: 12.0, + horizontal: 16.0, + ), + margin: const EdgeInsets.only(bottom: 10.0), + child: const Row( + children: [ + Expanded( + flex: 3, + child: Text( + 'Volunteer', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 16, + ), + ), + ), + Expanded( + flex: 6, + child: Text( + 'Status', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 16, + ), + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + Expanded( + child: model.volunteers.isEmpty + ? Center( + child: Text( + 'No volunteers yet', + style: Theme.of(context) + .textTheme + .titleLarge! + .copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + color: Colors.white, + ), + ), + ) + : ListView.builder( + itemCount: model.volunteers.length, + itemBuilder: (context, index) { + final volunteer = model.volunteers[index]; + final response = volunteer.response; + + String status; + Color statusColor; + + switch (response) { + case 'YES': + status = 'Accepted'; + statusColor = Colors.green; + break; + case 'NO': + status = 'Rejected'; + statusColor = Colors.red; + break; + default: + status = 'Pending'; + statusColor = Colors.grey; + } + + return ListTile( + key: const Key("volunteers"), + title: Text( + '${volunteer.user!.firstName} ${volunteer.user!.lastName}', + style: const TextStyle( + color: Colors.blue, + fontSize: 16, + ), + ), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.only(right: 24), + child: Text( + status, + style: TextStyle( + color: statusColor, + fontSize: 16, + ), + ), + ), + IconButton( + key: Key("delete_volunteer$index"), + icon: const Icon( + Icons.delete, + color: Colors.red, + ), + onPressed: () { + model.removeVolunteerFromGroup( + volunteer.id!, + ); + ScaffoldMessenger.of(context) + .showSnackBar( + const SnackBar( + content: Text('Volunteer removed'), + duration: Duration(seconds: 1), + ), + ); + }, + ), + ], + ), + ); + }, + ), + ), + if (model.volunteers.isNotEmpty) + _buildVolunteerStatusSummary(model), + SizedBox(height: SizeConfig.screenHeight! * 0.011), + Row( + children: [ + Expanded( + child: ElevatedButton.icon( + onPressed: () { + _showAddVolunteerBottomSheet(context, model); + }, + icon: const Icon( + Icons.add, + color: Colors.white, + ), + label: const Text( + 'Add Volunteers', + style: TextStyle(color: Colors.white, fontSize: 16), + ), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + ), + ), + ), + ], + ), + SizedBox(height: SizeConfig.screenHeight! * 0.01), + Row( + children: [ + Expanded( + child: ElevatedButton.icon( + onPressed: () { + _showEditGroupDialog(context, model); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + ), + label: const Text( + 'Edit Group', + style: TextStyle(color: Colors.white, fontSize: 15), + ), + icon: const Icon( + Icons.edit, + color: Colors.white, + ), + ), + ), + SizedBox(width: SizeConfig.screenWidth! * 0.02), + Expanded( + child: ElevatedButton.icon( + onPressed: () async { + final bool? confirm = await showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + key: const Key("Delete_group_dialogue"), + title: const Text('Confirm Deletion'), + content: const Text( + 'Are you sure you want to delete this group?', + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text('Cancel'), + ), + TextButton( + onPressed: () { + Navigator.of(context).pop(true); + }, + child: const Text('Delete'), + ), + ], + ); + }, + ); + if (confirm == true) { + await model.deleteVolunteerGroup(group.id!); + if (context.mounted) { + Navigator.pop(context, true); + } + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.red, + ), + label: const Text( + 'Delete Group', + style: TextStyle(color: Colors.white, fontSize: 15), + ), + icon: const Icon( + Icons.delete, + color: Colors.white, + ), + ), + ), + ], + ), + ], + ), + ), + ); + }, + ); + } + + /// Builds a summary of the volunteer statuses for the group.. + /// + /// **params**: + /// * `model`: The view model managing the group + /// + /// **returns**: + /// * `Widget`: A [Widget] displaying the volunteer status summary + Widget _buildVolunteerStatusSummary(ManageVolunteerGroupViewModel model) { + final int accepted = model.volunteers + .where((volunteer) => volunteer.response == 'YES') + .length; + final int pending = model.volunteers + .where((volunteer) => volunteer.response == null) + .length; + final int needed = group.volunteersRequired! - accepted; + + return Container( + padding: const EdgeInsets.all(12.0), + decoration: BoxDecoration( + color: Colors.blueGrey, + borderRadius: BorderRadius.circular(8), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Accepted Volunteers: $accepted', + style: const TextStyle( + color: Colors.white, + fontSize: 16, + ), + ), + Text( + 'Pending Volunteers: $pending', + style: const TextStyle( + color: Colors.white, + fontSize: 16, + ), + ), + Text( + 'Volunteers Still Needed: ${needed > 0 ? needed : 0}', + style: const TextStyle( + color: Colors.white, + fontSize: 16, + ), + ), + ], + ), + ); + } + + /// Shows a dialog allowing the user to edit the group's name and required volunteers. + /// + /// **params**: + /// * `context`: [BuildContext] - The build context. + /// * `model`: [ManageVolunteerGroupViewModel] - The view model managing the group. + /// + /// **returns**: + /// None + void _showEditGroupDialog( + BuildContext context, + ManageVolunteerGroupViewModel model, + ) { + final TextEditingController nameController = + TextEditingController(text: group.name); + final TextEditingController volunteersRequiredController = + TextEditingController(text: group.volunteersRequired.toString()); + + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Edit Group'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + key: const Key('groupNameField'), + controller: nameController, + decoration: const InputDecoration( + labelText: 'Group Name', + ), + ), + TextField( + key: const Key('groupVolunteerRequiredField'), + controller: volunteersRequiredController, + decoration: const InputDecoration( + labelText: 'Volunteers Required', + ), + keyboardType: TextInputType.number, + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); // Close the dialog + }, + child: const Text('Cancel'), + ), + TextButton( + onPressed: () async { + final String newName = nameController.text.trim(); + final int newVolunteersRequired = + int.tryParse(volunteersRequiredController.text.trim())!; + + if (newName.isNotEmpty && newVolunteersRequired > 0) { + await model.updateVolunteerGroup( + group, + event.id!, + newName, + newVolunteersRequired, + ); + + if (context.mounted) { + Navigator.of(context).pop(); + } + } + }, + child: const Text('Save'), + ), + ], + ); + }, + ); + } + + /// Shows the bottom sheet for adding a new volunteer to the group. + /// + /// **params**: + /// * `context`: [BuildContext] - The build context. + /// * `model`: [ManageVolunteerGroupViewModel] - The view model managing the group. + /// + /// **returns**: + /// None + void _showAddVolunteerBottomSheet( + BuildContext context, + ManageVolunteerGroupViewModel model, + ) { + model.getCurrentOrgUsersList().then((members) { + if (context.mounted) { + showModalBottomSheet( + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + isScrollControlled: true, + builder: (BuildContext context) { + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: Container( + key: const Key("bottomSheetContainer"), + height: MediaQuery.of(context).size.height * 0.8, + decoration: BoxDecoration( + color: Theme.of(context).scaffoldBackgroundColor, + ), + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + const Text( + 'Add Volunteers', + style: TextStyle(fontSize: 16), + ), + TextButton( + onPressed: () async { + for (final member + in model.memberCheckedMap.entries) { + if (member.value) { + await model.addVolunteerToGroup( + member.key, + event.id!, + group.id!, + ); + } + } + if (context.mounted) { + model.memberCheckedMap.clear(); + Navigator.pop(context); + } + }, + child: const Text('Done'), + ), + const Divider(), + members.isEmpty + ? const Center( + child: Text( + "There aren't any members in this organization.", + ), + ) + : Flexible( + child: ListView.builder( + key: const Key("members_list_key"), + shrinkWrap: true, + itemCount: members.length, + itemBuilder: (context, index) { + return CheckboxListTile( + key: Key("checkBox$index"), + checkColor: Theme.of(context) + .colorScheme + .surface, + activeColor: Theme.of(context) + .colorScheme + .primary, + title: Text( + "${members[index].firstName!} ${members[index].lastName!}", + ), + value: model.memberCheckedMap[ + members[index].id], + onChanged: (val) { + setState(() { + model.memberCheckedMap[ + members[index].id!] = val!; + }); + }, + ); + }, + ), + ), + ], + ), + ), + ), + ); + }, + ); + }, + ); + } + }); + } +} diff --git a/lib/views/after_auth_screens/events/venue_bottom_sheet.dart b/lib/views/after_auth_screens/events/venue_bottom_sheet.dart new file mode 100644 index 000000000..293f186c6 --- /dev/null +++ b/lib/views/after_auth_screens/events/venue_bottom_sheet.dart @@ -0,0 +1,158 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/models/events/event_venue.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/venue_card.dart'; + +/// a_line_ending_with_end_punctuation. +class VenueBottomSheet extends StatefulWidget { + const VenueBottomSheet({super.key, required this.venues}); + + /// a_line_ending_with_end_punctuation. + final List venues; + + @override + _VenueBottomSheetState createState() => _VenueBottomSheetState(); +} + +class _VenueBottomSheetState extends State { + /// Controller for the search text field. + TextEditingController searchController = TextEditingController(); + + /// The list of venues filtered based on the search query. + List filteredVenues = []; + + /// Whether the search field is currently active. + bool isSearching = false; + + /// The venue that is currently selected by the user. + Venue? selectedVenue; + + @override + void initState() { + super.initState(); + filteredVenues = widget.venues; + } + + /// Filters the venues based on the search query. + /// + /// **params**: + /// * `query`: The search query entered by the user. + /// + /// **returns**: + /// None + void _searchVenue(String query) { + setState(() { + filteredVenues = widget.venues + .where( + (venue) => venue.name!.toLowerCase().contains(query.toLowerCase()), + ) + .toList(); + }); + } + + /// Toggles the search field on and off. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void _toggleSearch() { + setState(() { + isSearching = !isSearching; + if (!isSearching) { + searchController.clear(); + filteredVenues = widget.venues; + } + }); + } + + /// Selects a venue and marks it as the currently selected venue. + /// + /// **params**: + /// * `venue`: The venue to select. + /// + /// **returns**: + /// None + void _selectVenue(Venue venue) { + setState(() { + selectedVenue = venue; + }); + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + key: const Key('gestureDetector1'), + onTap: () { + FocusScope.of(context).unfocus(); + }, + child: Container( + height: MediaQuery.of(context).size.height * 0.95, + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + if (!isSearching) + Expanded( + child: Center( + child: Text( + AppLocalizations.of(context)! + .strictTranslate('Add Venue'), + style: Theme.of(context).textTheme.headlineMedium, + ), + ), + ), + if (isSearching) + Expanded( + child: TextField( + controller: searchController, + onChanged: _searchVenue, + decoration: const InputDecoration( + hintText: 'Search Venue', + prefixIcon: Icon(Icons.search), + ), + ), + ), + if (selectedVenue != null) + IconButton( + icon: const Icon(Icons.check), + onPressed: () { + Navigator.of(context).pop(selectedVenue); + }, + ), + IconButton( + icon: Icon(isSearching ? Icons.close : Icons.search), + onPressed: _toggleSearch, + ), + ], + ), + const SizedBox(height: 16.0), + if (widget.venues.isEmpty) + const Center(child: Text('No Venues added yet')) + else if (filteredVenues.isEmpty) + const Center(child: Text('No venues available')) + else + Expanded( + child: ListView.builder( + itemCount: filteredVenues.length, + itemBuilder: (context, index) { + final venue = filteredVenues[index]; + return GestureDetector( + onTap: () => _selectVenue(venue), + child: VenueCard( + venue: venue, + isSelected: selectedVenue == venue, + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/views/after_auth_screens/events/volunteer_groups_screen.dart b/lib/views/after_auth_screens/events/volunteer_groups_screen.dart new file mode 100644 index 000000000..2d8dbf8a1 --- /dev/null +++ b/lib/views/after_auth_screens/events/volunteer_groups_screen.dart @@ -0,0 +1,300 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; + +/// A screen that displays the volunteer groups for a specific event. +class VolunteerGroupsScreen extends StatefulWidget { + const VolunteerGroupsScreen({ + super.key, + required this.event, + required this.model, + }); + + /// The event for which volunteer groups are displayed. + final Event event; + + /// The view model that manages the event information. + final EventInfoViewModel model; + + @override + State createState() => _VolunteerGroupsScreenState(); +} + +class _VolunteerGroupsScreenState extends State { + /// Formats a date string into 'yyyy-MM-dd' format. + /// + /// **params**: + /// * `dateStr`:The date string to format + /// + /// **returns**: + /// * `String`:A formatted date string + String _formatDate(String? dateStr) { + if (dateStr == null) return 'N/A'; + + try { + final DateTime dateTime = DateTime.parse(dateStr); + final DateFormat formatter = DateFormat('yyyy-MM-dd'); + return formatter.format(dateTime); + } catch (e) { + return 'Invalid date'; + } + } + + @override + void initState() { + super.initState(); + _fetchVolunteerGroupsAndDisplay(); + } + + /// method to fetch all volunteer groups. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + Future _fetchVolunteerGroupsAndDisplay() async { + await widget.model.fetchVolunteerGroups(widget.event.id!); + // Ensure setState is called after the widget is built + if (mounted) { + WidgetsBinding.instance.addPostFrameCallback((_) { + setState(() {}); + }); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + floatingActionButton: FloatingActionButton( + key: const Key("add_group_btn"), + backgroundColor: Colors.green, + child: const Icon( + Icons.add, + color: Colors.white, + size: 30, + ), + onPressed: () { + _showCreateGroupDialog(context, widget.model); + }, + ), + body: RefreshIndicator( + onRefresh: () async { + widget.model.fetchVolunteerGroups(widget.event.id!); + }, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox(height: 20), + if (widget.model.volunteerGroups.isNotEmpty) + Container( + decoration: BoxDecoration( + color: Colors.green, + borderRadius: BorderRadius.circular(8), + ), + padding: const EdgeInsets.symmetric( + vertical: 12.0, + horizontal: 10.0, + ), + margin: const EdgeInsets.only(bottom: 10.0), + child: const Row( + children: [ + Expanded( + flex: 3, + child: Text( + 'Group Name', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 14, + ), + ), + ), + Expanded( + flex: 3, + child: Text( + 'Created At', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 14, + ), + textAlign: TextAlign.center, + ), + ), + Expanded( + flex: 3, + child: Text( + 'Manage', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 15, + ), + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + Expanded( + child: widget.model.volunteerGroups.isEmpty + ? const Center( + child: Text( + "There aren't any volunteer groups", + style: TextStyle(color: Colors.white, fontSize: 18), + ), + ) + : ListView.builder( + itemCount: widget.model.volunteerGroups.length, + itemBuilder: (context, index) { + final group = widget.model.volunteerGroups[index]; + return Row( + key: const Key("group_data"), + children: [ + Expanded( + flex: 3, + child: Container( + padding: + const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + group.name!, + style: const TextStyle( + color: Colors.blue, + fontSize: 16, + ), + textAlign: TextAlign.center, + ), + ), + ), + Expanded( + flex: 3, + child: Container( + padding: + const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + _formatDate(group.createdAt), + style: const TextStyle(color: Colors.white), + textAlign: TextAlign.center, + ), + ), + ), + Expanded( + flex: 3, + child: IconButton( + icon: const Icon( + Icons.edit, + color: Colors.green, + ), + onPressed: () async { + navigationService.pushScreen( + "/manageVolunteerScreen", + arguments: [ + widget.event, + widget.model.volunteerGroups[index], + ], + ); + }, + ), + ), + ], + ); + }, + ), + ), + ], + ), + ), + ), + ); + } + + /// Displays a dialog for creating a new volunteer group. + /// + /// **params**: + /// * `context`: The build context where the dialog should be displayed + /// * `model`: The view model that manages event-related operations + /// + /// **returns**: + /// None + void _showCreateGroupDialog(BuildContext context, EventInfoViewModel model) { + final groupNameController = TextEditingController(); + final volunteersRequiredController = TextEditingController(); + + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + key: const Key("add_grp_dialogue"), + backgroundColor: const Color.fromARGB(255, 34, 34, 34), + title: const Text('Create Volunteer Group'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + key: const Key("group_name_field"), + controller: groupNameController, + decoration: const InputDecoration(labelText: 'Group Name'), + ), + TextField( + key: const Key("volunteers_required_field"), + controller: volunteersRequiredController, + keyboardType: TextInputType.number, + decoration: + const InputDecoration(labelText: 'Volunteers Required'), + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: const Text('Cancel'), + ), + TextButton( + onPressed: () async { + final groupName = groupNameController.text; + final volunteersRequired = + int.tryParse(volunteersRequiredController.text) ?? 0; + + if (groupName.isNotEmpty && volunteersRequired > 0) { + final newGroup = await model.createVolunteerGroup( + widget.event, + groupName, + volunteersRequired, + ); + + if (newGroup != null) { + if (context.mounted) { + Navigator.of(context).pop(); + navigationService.pushScreen( + "/manageVolunteerScreen", + arguments: [widget.event, newGroup], + ); + } + } else { + if (context.mounted) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Failed to create group')), + ); + } + } + } else { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Please enter valid data')), + ); + } + }, + child: const Text('Create Group'), + ), + ], + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/feed/individual_post.dart b/lib/views/after_auth_screens/feed/individual_post.dart new file mode 100644 index 000000000..8718fe18c --- /dev/null +++ b/lib/views/after_auth_screens/feed/individual_post.dart @@ -0,0 +1,308 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/models/comment/comment_model.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/widgets_view_models/comments_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/post_widget.dart'; + +// Global State, should be removed in next few iterations + +/// Comment view model. +late CommentsViewModel _commentViewModel; + +/// IndividualPostView returns a widget that has mutable state _IndividualPostViewState. +class IndividualPostView extends StatefulWidget { + const IndividualPostView({super.key, required this.post}); + + /// Individual Post. + final Post post; + + @override + _IndividualPostViewState createState() => _IndividualPostViewState(); +} + +class _IndividualPostViewState extends State { + final TextEditingController _controller = TextEditingController(); + bool _isCommentValid = false; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 0.0, + ), + bottomSheet: Container( + height: 60, + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Row( + children: [ + Expanded( + // TextField to send the comment on the post. + child: TextField( + key: const Key('indi_post_tf_key'), + controller: _controller, + textInputAction: TextInputAction.send, + onChanged: (msg) { + if (msg.isEmpty && _isCommentValid == true) { + setState(() { + _isCommentValid = false; + }); + } + if (msg.isEmpty == false && _isCommentValid == false) { + setState(() { + _isCommentValid = true; + }); + } + }, + textAlign: TextAlign.start, + decoration: InputDecoration( + hintText: AppLocalizations.of(context)!.strictTranslate( + "Write your comment here..", + ), + contentPadding: const EdgeInsets.all(8.0), + focusColor: Colors.black, + border: InputBorder.none, + ), + keyboardType: TextInputType.text, + ), + ), + // Button to send the comment. + TextButton( + key: const Key('sendButton'), + style: _isCommentValid == false + ? ButtonStyle( + overlayColor: WidgetStateProperty.all(Colors.transparent), + ) + : null, + //check if button is enabled when comment is valid + onPressed: _isCommentValid + ? () { + _commentViewModel.createComment(_controller.text); + _controller.text = ""; + + setState(() { + _isCommentValid = false; + }); + } + : null, + child: Text( + AppLocalizations.of(context)!.strictTranslate( + "Send", + ), + style: !_isCommentValid + ? const TextStyle(color: Colors.grey) + : null, + ), + ), + ], + ), + ), + body: ListView( + children: [ + // Post + NewsPost( + post: widget.post, + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenHeight! * 0.010, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // renders the number of users liked the post. + IndividualPageLikeSection( + usersLiked: widget.post.likedBy!, + ), + // renders the number of users commented on the post. + IndividualPostCommentSection( + comments: widget.post.comments!, + postID: widget.post.sId, + ), + const SizedBox( + height: 200, + ), + ], + ), + ), + ], + ), + ); + } +} + +/// Generates a `Padding` widget with customizable vertical padding around a text element. +/// +/// **params**: +/// * `context`: The build context in which the padding method is called. +/// * `text`: The text on which padding should be applied. +/// +/// **returns**: +/// * `Padding`: Padding widget with vertical padding applied to the provided text. +Padding buildPadding(BuildContext context, String text) { + return Padding( + padding: EdgeInsets.symmetric(vertical: SizeConfig.screenHeight! * 0.006), + child: Text( + AppLocalizations.of(context)!.strictTranslate(text), + style: Theme.of(context).textTheme.titleLarge, + ), + ); +} + +/// IndividualPageLikeSection returns a widget that show the list of all the users liked the post. +class IndividualPageLikeSection extends StatelessWidget { + const IndividualPageLikeSection({ + super.key, + required this.usersLiked, + }); + + /// Represents a list of users who have liked a post. + final List usersLiked; + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildPadding( + context, + AppLocalizations.of(context)!.strictTranslate( + "Liked by", + ), + ), + Row( + children: [ + // Looping through the usersLiked list, + for (int i = 0; i < usersLiked.length; i++) + // renders the custom widget for invidual user. + likedUserCircleAvatar(usersLiked[i]), + ], + ), + ], + ); + } +} + +/// Widget representing the comment section of an individual post. +/// +/// The `IndividualPostCommentSection` widget displays a list of comments on a post. +class IndividualPostCommentSection extends StatelessWidget { + const IndividualPostCommentSection({ + super.key, + required this.comments, + required this.postID, + }); + + /// List of comments on a post. + final List comments; + + /// ID of a post with associated comments. + final String postID; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + await model.initialise(postID); + // print(model.commentList.first.creator); + _commentViewModel = model; + }, + builder: (context, model, child) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildPadding(context, "Comments"), + // Looping through the commentList list, + for (int i = 0; i < model.commentList.length; i++) + // renders the custom widget for invidual user. + CommentTemplate(comment: model.commentList[i]), + ], + ), + ); + } +} + +/// CommentTemplate returns a widget of the individual user commented on the post. +class CommentTemplate extends StatelessWidget { + const CommentTemplate({ + super.key, + required this.comment, + }); + + /// Instance of comment. + final Comment comment; + + @override + Widget build(BuildContext context) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const CircleAvatar(), + Expanded( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).iconTheme.color!.withOpacity(0.2), + borderRadius: const BorderRadius.all(Radius.circular(8)), + ), + padding: const EdgeInsets.all(16.0), + margin: const EdgeInsets.only(left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 8.0), + child: Text( + "${comment.creator!.firstName!} ${comment.creator!.lastName!}", + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + Text( + comment.text!, + style: Theme.of(context) + .textTheme + .bodyLarge! + .copyWith(fontSize: 16.0), + ), + ], + ), + ), + ), + ], + ); + } +} + +/// Generates a Circle Avatar representing a user who liked the post. +/// +/// **params**: +/// * `user`: The user who liked the post, represented by the `LikedBy` class. +/// +/// **returns**: +/// * `Widget`: Circle Avatar of the user who liked the post. +Widget likedUserCircleAvatar(LikedBy user) { + return const Padding( + padding: EdgeInsets.only(right: 10.0, bottom: 16.0), + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.center, + children: [ + CircleAvatar( + backgroundColor: Color(0xfff2f2f2), + radius: 20, + ), + Positioned( + top: 30, + right: 0, + bottom: 20, + left: 20, + child: Icon( + Icons.thumb_up, + color: Colors.blue, + size: 20, + ), + ), + ], + ), + ); +} diff --git a/lib/views/after_auth_screens/feed/organization_feed.dart b/lib/views/after_auth_screens/feed/organization_feed.dart new file mode 100644 index 000000000..5913f121e --- /dev/null +++ b/lib/views/after_auth_screens/feed/organization_feed.dart @@ -0,0 +1,185 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/pinned_post.dart'; +import 'package:talawa/widgets/post_list_widget.dart'; + +/// OrganizationFeed returns a widget that shows the feed of the organization. +class OrganizationFeed extends StatefulWidget { + const OrganizationFeed({ + required Key key, + this.homeModel, + this.forTest = false, + }) : super(key: key); + + /// MainScreenViewModel. + final MainScreenViewModel? homeModel; + + /// To implement the test. + final bool forTest; + + @override + State createState() => _OrganizationFeedState(); +} + +class _OrganizationFeedState extends State { + final ScrollController _scrollController = ScrollController(); + + /// Counter for first time scrolling when at the start of the list. + int firstDownScroll = 0; + + /// Counter for first time scrolling when at the start of the list. + int firstUpScroll = 0; + @override + void dispose() { + _scrollController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(isTest: widget.forTest), + builder: (context, model, child) { + return Scaffold( + floatingActionButton: FloatingActionButton( + shape: const CircleBorder(side: BorderSide.none), + key: const Key('floating_action_btn'), + backgroundColor: Colors.green, + onPressed: () { + navigationService.pushScreen('/addpostscreen'); + }, + child: Icon( + Icons.add, + size: SizeConfig.screenHeight! * 0.045, + color: Colors.white, + ), + ), + appBar: AppBar( + backgroundColor: Colors.green, + elevation: 0.0, + centerTitle: true, + title: Text( + model.currentOrgName, + key: widget.homeModel?.keySHOrgName, + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + color: Colors.white, + ), + ), + leading: IconButton( + key: widget.homeModel?.keySHMenuIcon, + icon: const Icon( + Icons.menu, + color: Colors.white, + ), + onPressed: () { + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(); + }, + ), + ), + // if the model is fetching the data then renders Circular Progress Indicator else renders the result. + body: model.isFetchingPosts || model.isBusy + ? const Center(child: CircularProgressIndicator()) + : RefreshIndicator( + onRefresh: () async => model.fetchNewPosts(), + child: NotificationListener( + onNotification: (notification) { + final currentScroll = _scrollController.position.pixels; + + if (notification is ScrollEndNotification && + notification.metrics.atEdge) { + if (firstDownScroll > 0) { + model.nextPage(); + firstDownScroll = 0; + } else { + firstDownScroll++; + } + } + if (notification is ScrollEndNotification && + notification.metrics.atEdge && + currentScroll <= 0) { + if (firstUpScroll > 0) { + model.previousPage(); + firstUpScroll = 0; + } else { + firstUpScroll++; + } + } + // Reset counters if scrolling occurs anywhere other than at the edge + if (!notification.metrics.atEdge) { + firstDownScroll = 0; + firstUpScroll = 0; + } + + return false; + }, + child: ListView( + controller: _scrollController, + key: const Key('listView'), + shrinkWrap: true, + children: [ + // Always show PinnedPost if available + if (model.pinnedPosts.isNotEmpty) + PinnedPost( + key: const Key('pinnedPosts'), + pinnedPost: model.pinnedPosts, + model: widget.homeModel!, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.01, + ), + model.posts.isNotEmpty + ? PostListWidget( + key: widget.homeModel?.keySHPost, + posts: model.posts, + function: model.navigateToIndividualPage, + deletePost: model.removePost, + ) + : // if there is no post in an organisation then show text button to create a post. + Column( + children: [ + Padding( + padding: EdgeInsets.only( + top: SizeConfig.screenHeight! * 0.21, + ), + child: Text( + AppLocalizations.of(context)! + .strictTranslate( + 'There are no posts in this organization', + ), + style: TextStyle( + fontSize: + SizeConfig.screenHeight! * 0.026, + ), + textAlign: TextAlign.center, + ), + ), + TextButton( + onPressed: () { + navigationService + .pushScreen('/addpostscreen'); + }, + child: Text( + AppLocalizations.of(context)! + .strictTranslate( + 'Create your first post', + ), + ), + ), + ], + ), + ], + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/feed/pinned_post_page.dart b/lib/views/after_auth_screens/feed/pinned_post_page.dart new file mode 100644 index 000000000..028ae73f2 --- /dev/null +++ b/lib/views/after_auth_screens/feed/pinned_post_page.dart @@ -0,0 +1,34 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/post_list_widget.dart'; + +/// PinnedPostPage returns a widget that shows the list of all the pinned post. +class PinnedPostPage extends StatelessWidget { + const PinnedPostPage({super.key, required this.pinnedPosts}); + final List pinnedPosts; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + iconTheme: Theme.of(context).iconTheme, + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.0, + title: Text( + AppLocalizations.of(context)!.strictTranslate('Pinned Posts'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + ), + body: ListView( + children: [PostListWidget(posts: pinnedPosts)], + ), + ); + } +} diff --git a/lib/views/after_auth_screens/feed/pinned_post_screen.dart b/lib/views/after_auth_screens/feed/pinned_post_screen.dart new file mode 100644 index 000000000..f2112770e --- /dev/null +++ b/lib/views/after_auth_screens/feed/pinned_post_screen.dart @@ -0,0 +1,79 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:talawa/apptheme.dart'; + +import 'package:talawa/services/size_config.dart'; + +/// Pinned post screen. +/// +class PinnedPostScreen extends StatefulWidget { + const PinnedPostScreen({super.key, required this.post, this.cacheManager}); + + /// Contains the data of the post. + /// + final Map post; + + /// Custom avatar data. + final BaseCacheManager? cacheManager; + + @override + State createState() => _PinnedPostScreenState(); +} + +class _PinnedPostScreenState extends State { + @override + Widget build(BuildContext context) { + return SafeArea( + child: Container( + decoration: const BoxDecoration(color: Colors.black38), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(18.0), + child: Text( + widget.post['title']!, + maxLines: 2, + style: AppTheme.title.copyWith( + color: Colors.white, + decorationThickness: 0, + ), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '${widget.post['time']!}hr', + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w200, + fontSize: 14, + decorationThickness: 0, + ), + ), + ), + ], + ), + CachedNetworkImage( + cacheManager: widget.cacheManager, + imageUrl: widget.post['imageUrl']!, + errorWidget: (context, url, error) { + return const SizedBox( + child: Center( + child: CircularProgressIndicator(), + ), + ); + }, + height: SizeConfig.screenHeight! * .75, + fit: BoxFit.cover, + ), + ], + ), + ), + ); + } +} 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 new file mode 100644 index 000000000..f6c1a8150 --- /dev/null +++ b/lib/views/after_auth_screens/join_org_after_auth/access_request_screen.dart @@ -0,0 +1,103 @@ +// ignore_for_file: talawa_good_doc_comments, talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:talawa/apptheme.dart'; +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. +class SendAccessRequest extends StatelessWidget { + const SendAccessRequest({ + super.key, + required this.org, + // required this.model + }); + + /// OrgInfo object. + final OrgInfo org; + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(org), + builder: (context, model, child) { + return SafeArea( + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.transparent, + ), + resizeToAvoidBottomInset: false, + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset('assets/images/Group 8948.png'), + Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "You need access", + style: AppTheme.title.copyWith(color: AppTheme.white), + ), + const SizedBox( + height: 5, + ), + const Text( + "Request access, or switch to an account with access", + ), + const SizedBox( + height: 20, + ), + Container( + child: TextField( + style: const TextStyle(color: AppTheme.blackPrimary), + minLines: 15, + maxLines: 20, + decoration: InputDecoration( + constraints: const BoxConstraints( + maxWidth: 400, + minWidth: 100, + ), + enabledBorder: UnderlineInputBorder( + borderRadius: BorderRadius.circular(20.0), + borderSide: const BorderSide( + width: 3, + color: Colors.white, + ), + ), + hintText: "Message (optional)", + hintStyle: const TextStyle( + color: AppTheme.blackSecondary, + ), + filled: true, + fillColor: AppTheme.white, + ), + ), + ), + ], + ), + ), + Center( + child: TextButton( + onPressed: () { + model.sendMembershipRequest(); + }, + style: + TextButton.styleFrom(backgroundColor: AppTheme.green), + child: const Text( + "Request Access", + style: TextStyle( + color: AppTheme.white, + ), + ), + ), + ), + ], + ), + ), + ); + }, + ); + } +} 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 new file mode 100644 index 000000000..fa519edbb --- /dev/null +++ b/lib/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart @@ -0,0 +1,185 @@ +// ignore_for_file: talawa_api_doc, talawa_good_doc_comments +import 'package:flutter/material.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/organization_list.dart'; +import 'package:talawa/widgets/organization_search_list.dart'; +import 'package:vibration/vibration.dart'; + +/// JoinOrganisationAfterAuth returns a widget for page to join the organization just after user authentication. +class JoinOrganisationAfterAuth extends StatelessWidget { + const JoinOrganisationAfterAuth({super.key, required this.orgId}); + + /// org identifier. + /// + final String orgId; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(orgId), + builder: (context, model, child) { + return Scaffold( + key: const Key('JoinOrgScreen'), + // header for the widget + appBar: AppBar( + centerTitle: true, + // title of the header. + title: Text( + AppLocalizations.of(context)! + .strictTranslate('Join Organisation'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + // action button for the option to join the organization using QR code. + actions: [ + IconButton( + icon: const Icon( + Icons.qr_code_scanner, + size: 30, + semanticLabel: 'Join Organisation with QR', + ), + onPressed: () => scanQR(context, model), + ), + ], + ), + body: Column( + children: [ + const Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0), + child: Divider( + color: Colors.grey, + thickness: 2.0, + ), + ), + Expanded( + // if model searching is under process then renders OrganizationSearchList widget + // else renders OrganizationList widget. + child: model.searching + ? OrganizationSearchList(model: model) + : OrganizationList(model: model), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + ], + ), + ); + }, + ); + } + + /// 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, + barrierColor: Colors.transparent, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + builder: (BuildContext context) { + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: Container( + height: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondary, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 250, + width: 250, + child: QRView( + key: model.qrKey, + onQRViewCreated: (controller) => + _onQRViewCreated(controller, model), + overlay: QrScannerOverlayShape( + overlayColor: Theme.of(context).colorScheme.secondary, + borderRadius: 10, + borderLength: 20, + borderWidth: 10, + cutOutSize: 250, + ), + /*overlayMargin: EdgeInsets.all(50)*/ + ), + ), + SizedBox( + height: SizeConfig.safeBlockVertical! * 4, + ), + Text( + AppLocalizations.of(context)!.strictTranslate('Scan QR'), + ), + SizedBox( + height: SizeConfig.safeBlockVertical! * 4, + ), + ], + ), + ), + ); + }, + ); + } + + /// To handle to qr. + /// + /// **params**: + /// * `controller`: Controller to manage qr activity + /// * `model`: Viewmodel + /// + /// **returns**: + /// None + void _onQRViewCreated( + QRViewController controller, + SelectOrganizationViewModel model, + ) { + controller.scannedDataStream.listen((scanData) { + if (scanData.code!.isNotEmpty) { + print(scanData.code); + try { + final List data = scanData.code!.split('?'); + final String url = data[0]; + Vibration.vibrate(duration: 100); + if (url == GraphqlConfig.orgURI) { + final List queries = data[1].split('&'); + model.orgId = queries[0].split('=')[1]; + controller.stopCamera(); + controller.dispose(); + Navigator.pop(navigationService.navigatorKey.currentContext!); + model.initialise(model.orgId); + } else { + navigationService.showTalawaErrorSnackBar( + "Organisation on different server, logout and scan qr again", + MessageType.error, + ); + } + } on Exception catch (e) { + print(e); + print('invalid app qr'); + } + } + }); + } +} diff --git a/lib/views/after_auth_screens/org_info_screen.dart b/lib/views/after_auth_screens/org_info_screen.dart new file mode 100644 index 000000000..bb34827fd --- /dev/null +++ b/lib/views/after_auth_screens/org_info_screen.dart @@ -0,0 +1,443 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; + +/// A screen widget to display detailed information about an organization. +class OrganisationInfoScreen extends StatelessWidget { + const OrganisationInfoScreen({super.key, required this.orgInfo}); + + /// The organization information to be displayed on the screen. + final OrgInfo orgInfo; + + @override + Widget build(BuildContext context) { + final double imageHeight = SizeConfig.screenHeight! * 0.38; + final SelectOrganizationViewModel model = SelectOrganizationViewModel(); + final Map joinedOrgsMap = {}; + for (final org + in userConfig.currentUser.joinedOrganizations ?? []) { + joinedOrgsMap[org.id!] = org; + } + + return Scaffold( + extendBodyBehindAppBar: true, + floatingActionButton: !joinedOrgsMap.containsKey(orgInfo.id) + ? FloatingActionButton.extended( + onPressed: () { + model.selectOrg(orgInfo); + }, + label: Text( + 'Join', + style: TextStyle( + color: const Color.fromARGB(255, 255, 255, 255), + fontSize: SizeConfig.screenHeight! * 0.022, + ), + ), + backgroundColor: const Color.fromARGB(255, 86, 194, 65), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + ) + : FloatingActionButton.extended( + onPressed: () {}, + label: Text( + 'Leave', + style: TextStyle( + color: const Color.fromARGB(255, 255, 255, 255), + fontSize: SizeConfig.screenHeight! * 0.022, + ), + ), + backgroundColor: const Color.fromARGB(255, 208, 51, 51), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + ), + floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, + appBar: AppBar( + leading: IconButton( + icon: const Icon(Icons.arrow_back, color: Colors.white), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.transparent, + elevation: 0, + ), + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Stack( + alignment: Alignment.center, + children: [ + Stack( + children: [ + orgInfo.image != null + ? Image.network( + orgInfo.image!, + height: imageHeight, + width: double.infinity, + fit: BoxFit.cover, + ) + : ClipRRect( + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(20.0), + bottomRight: Radius.circular(20.0), + ), + child: Image.asset( + 'assets/images/Organisation_Default_Image.jpeg', + height: imageHeight, + width: double.infinity, + fit: BoxFit.cover, + ), + ), + Container( + key: const Key('image_container'), + height: imageHeight, + width: double.infinity, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.55), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(20.0), + bottomRight: Radius.circular(20.0), + ), + ), + ), + ], + ), + Positioned( + bottom: 45, + left: 16, + child: Row( + children: [ + Text( + orgInfo.name ?? 'Organization Name', + style: const TextStyle( + fontSize: 28.0, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + if (orgInfo.address != null) + Padding( + padding: const EdgeInsets.only(top: 8, left: 8), + child: Center( + child: Text( + '${orgInfo.address?.city}, ${orgInfo.address?.countryCode}', + style: const TextStyle( + fontSize: 16.0, + color: Color.fromARGB(255, 179, 168, 168), + ), + ), + ), + ), + ], + ), + ), + Positioned( + bottom: 24, + left: 16, + child: Text( + 'Created by: ${orgInfo.creatorInfo?.firstName ?? 'User name'} ${orgInfo.creatorInfo?.lastName ?? ''}', + style: const TextStyle( + fontSize: 16.0, + color: Color.fromARGB(255, 255, 255, 255), + fontWeight: FontWeight.w500, + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 16, left: 16, right: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text( + 'Description', + style: + TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + !orgInfo.userRegistrationRequired! + ? const Icon( + Icons.lock_open, + size: 18, + color: Colors.green, + ) + : Icon( + Icons.lock, + size: 18, + color: Theme.of(context).colorScheme.primary, + ), + const SizedBox(width: 8), + !orgInfo.userRegistrationRequired! + ? Text( + "Public", + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + color: + const Color.fromARGB(255, 98, 98, 98), + ), + ) + : Text( + "Private", + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + color: const Color.fromARGB( + 255, + 103, + 103, + 103, + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.only( + top: 10, + left: 16, + right: 20, + bottom: 10, + ), + child: Text( + orgInfo.description ?? 'No description provided.', + style: const TextStyle(fontSize: 16.0), + ), + ), + _buildSectionTitle( + context, + 'Admins', + orgInfo.admins, + () => _showAllMembersBottomSheet( + context, + orgInfo.admins!, + 'Admins', + ), + 2, + ), + Divider( + color: Theme.of(context).colorScheme.onSurface, + thickness: 1, + endIndent: 16, + indent: 16, + ), + _buildUserList(context, orgInfo.admins, 2), + _buildSectionTitle( + context, + 'Members', + orgInfo.members, + () => _showAllMembersBottomSheet( + context, + orgInfo.members!, + 'Members', + ), + 4, + ), + Divider( + color: Theme.of(context).colorScheme.onSurface, + thickness: 1, + endIndent: 16, + indent: 16, + ), + _buildUserList(context, orgInfo.members, 4), + ], + ), + ), + ); + } + + /// Builds a section title widget. + /// + /// **params**: + /// * `context`: The build context. + /// * `title`: The title of the section. + /// * `users`: The list of users + /// * `onSeeAllTap`: Callback when "See all" is tapped. + /// * `maxUsers`: The maximum number of users to display. + /// + /// **returns**: + /// * `Widget`: Returns a section title widget. + Widget _buildSectionTitle( + BuildContext context, + String title, + List? users, + VoidCallback onSeeAllTap, + int maxUsers, + ) { + return Padding( + padding: const EdgeInsets.only(left: 16.0, right: 16, top: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + title, + style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0), + ), + if (users != null && users.length > maxUsers) + GestureDetector( + onTap: onSeeAllTap, + child: const Text( + 'See all', + style: TextStyle( + fontSize: 16.0, + color: Colors.blue, + ), + ), + ), + ], + ), + ); + } + + /// Builds a list of users widget. + /// + /// **params**: + /// * `context`: The build context. + /// * `users`: The list of users + /// * `maxDisplay`: The maximum number of users to display. + /// + /// **returns**: + /// * `Widget`: Returns a list of users widget. + Widget _buildUserList( + BuildContext context, + List? users, + int maxDisplay, + ) { + if (users == null || users.isEmpty) { + return const Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), + child: Text('No users to display'), + ); + } + + final List displayedUsers = users.take(maxDisplay).toList(); + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Column( + children: displayedUsers + .map( + (user) => Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).brightness == Brightness.dark + ? const Color.fromARGB(255, 50, 50, 50) + : const Color.fromARGB(255, 226, 226, 226), + borderRadius: BorderRadius.circular(20), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 1, + blurRadius: + Theme.of(context).brightness == Brightness.dark + ? 1 + : 6, + offset: Theme.of(context).brightness == Brightness.dark + ? Offset.zero + : const Offset(0, 3), + ), + ], + ), + height: 60, + child: Row( + children: [ + Expanded( + flex: 1, + child: CustomAvatar( + isImageNull: user.image == null, + firstAlphabet: + user.firstName!.substring(0, 1).toUpperCase(), + imageUrl: + '${'${GraphqlConfig.orgURI}'.replaceFirst('/graphql', '')}/${user.image}', + fontSize: SizeConfig.screenHeight! * 0.018, + ), + ), + Expanded( + flex: 3, + child: Text( + '${user.firstName ?? 'No Name'} ${user.lastName ?? ''}', + ), + ), + ], + ), + ), + ), + ) + .toList(), + ), + ); + } + + /// Shows a bottom sheet with all members. + /// + /// **params**: + /// * `context`: The build context. + /// * `users`: The list of users. + /// * `title`: The title of the bottom sheet. + /// + /// **returns**: + /// None + void _showAllMembersBottomSheet( + BuildContext context, + List users, + String title, + ) { + showModalBottomSheet( + context: context, + builder: (BuildContext bc) { + return SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + AppBar( + title: Text(title), + leading: IconButton( + key: const Key('modalSheetbackBtn'), + icon: const Icon(Icons.close), + onPressed: () => Navigator.of(bc).pop(), + ), + ), + Flexible( + child: ListView.builder( + itemCount: users.length, + itemBuilder: (BuildContext context, int index) { + return ListTile( + leading: CustomAvatar( + isImageNull: users[index].image == null, + firstAlphabet: users[index] + .firstName! + .substring(0, 1) + .toUpperCase(), + imageUrl: + '${'${GraphqlConfig.orgURI}'.replaceFirst('/graphql', '')}/${users[index].image}', + fontSize: SizeConfig.screenHeight! * 0.018, + ), + title: Text( + '${users[index].firstName ?? 'No Name'} ${users[index].lastName ?? ''}', + ), + ); + }, + ), + ), + ], + ), + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/profile/edit_profile_page.dart b/lib/views/after_auth_screens/profile/edit_profile_page.dart new file mode 100644 index 000000000..96965dc30 --- /dev/null +++ b/lib/views/after_auth_screens/profile/edit_profile_page.dart @@ -0,0 +1,304 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +/// EditProfilePage returns a widget that has mutable state _EditProfilePageState. +class EditProfilePage extends StatefulWidget { + const EditProfilePage({super.key}); + + @override + _EditProfilePageState createState() => _EditProfilePageState(); +} + +/// _EditProfilePageState returns a widget for a Page to edit the user profile. +class _EditProfilePageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return Scaffold( + key: const Key('EditProfileScreenScaffold'), + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.0, + title: Text( + AppLocalizations.of(context)!.strictTranslate('Profile'), + key: const Key('ProfileText'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: SizeConfig.screenHeight! * 0.03, + ), + ), + ), + body: SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: SizeConfig.screenHeight! * 0.068, + ), + Center( + child: Stack( + children: [ + // if the profile pic is not empty then render Circle Avatar with image as background image + // else render Circle Avatar with grey background color. + CircleAvatar( + key: const Key('profilepic'), + radius: SizeConfig.screenHeight! * 0.082, + backgroundImage: model.imageFile != null + ? Image.file( + model.imageFile!, + fit: BoxFit.fitWidth, + ).image + : model.user.image != null + ? NetworkImage(model.user.image!) + : null, + backgroundColor: + model.imageFile == null && model.user.image == null + ? Colors.grey.withOpacity(0.2) + : null, + child: model.imageFile == null + ? model.user.image == null + ? Text( + '${model.user.firstName![0].toUpperCase()}${model.user.lastName![0].toUpperCase()}', + style: Theme.of(context) + .textTheme + .headlineMedium, + ) + : null + : null, + ), + Positioned( + bottom: 0, + right: 0, + child: InkWell( + key: const Key('AddRemoveImageButton'), + onTap: () { + // modal sheet for image selection from camera or gallery. + model.imageFile == null + ? showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return Container( + height: + SizeConfig.screenHeight! * 0.135, + padding: const EdgeInsets.all(17), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + _createModalSheetButton( + context, + Icons.camera_alt, + 'Camera', + () { + Navigator.of(context).pop(); + model.selectImage( + camera: true, + ); + }, + ), + _createModalSheetButton( + context, + Icons.photo_library, + 'Gallery', + () { + Navigator.of(context).pop(); + model.selectImage(); + }, + ), + ], + ), + ); + }, + ) + : model.removeImage(); + }, + child: CircleAvatar( + radius: SizeConfig.screenHeight! * 0.034, + backgroundColor: model.imageFile == null + ? Theme.of(context).colorScheme.secondary + : Theme.of(context).colorScheme.secondary, + child: model.imageFile == null + ? const Icon( + Icons.photo_camera, + color: Colors.white, + ) + : const Icon( + Icons.close, + color: Colors.white, + ), + ), + ), + ), + ], + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.068, + ), + const Divider(), + Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Row( + children: [ + // Flexible is a widget that controls how a child of a Row, Column, or Flex flexes. + Flexible( + // Text field for first name with value text of user's first name. + child: TextFormField( + key: const Key('FirstNameTextField'), + controller: model.firstNameTextController, + focusNode: model.firstNameFocus, + keyboardType: TextInputType.name, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('First Name'), + labelStyle: + Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: const Icon(Icons.person), + suffixIcon: IconButton( + onPressed: () { + FocusScope.of(context).requestFocus( + model.firstNameFocus, + ); + }, + icon: const Icon(Icons.edit), + ), + ), + ), + ), + ], + ), + Row( + children: [ + Flexible( + // Text field for first name with value text of user's last name. + child: TextFormField( + controller: model.lastNameTextController, + focusNode: model.lastNameFocus, + keyboardType: TextInputType.name, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)! + .strictTranslate('Last Name'), + labelStyle: + Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: const Icon(Icons.person), + suffixIcon: IconButton( + onPressed: () { + FocusScope.of(context).requestFocus( + model.lastNameFocus, + ); + }, + icon: const Icon(Icons.edit), + ), + ), + ), + ), + ], + ), + ], + ), + ), + const Divider(), + Padding( + padding: const EdgeInsets.all(20), + child: Row( + children: [ + SizedBox( + height: SizeConfig.screenHeight! * 0.027, + width: SizeConfig.screenWidth! * 0.055, + child: const Icon(Icons.email), + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.045, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + AppLocalizations.of(context)! + .strictTranslate('Email'), + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + color: + Theme.of(context).colorScheme.onSurface, + ), + ), + // Text for first name with value text of user's first name. + Text( + model.user.email!, + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(fontSize: 18), + ), + ], + ), + ], + ), + ), + const Divider(), + TextButton( + key: const Key('updatebtn'), + onPressed: () { + model.updateUserProfile( + firstName: model.firstNameTextController.text, + newImage: model.imageFile, + lastName: model.lastNameTextController.text, + ); + FocusScope.of(context).unfocus(); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Update'), + ), + ), + ], + ), + ), + ); + }, + ); + } + + /// Button for the different image selection methods. + /// + /// **params**: + /// * `context`:context for the sheet + /// * `icon`: icon for the method + /// * `label`: label for the method + /// * `onTap`: onTap funtionality for the method + /// + /// **returns**: + /// * `Widget`: Icon Button for selecting different image selection method. + Widget _createModalSheetButton( + BuildContext context, + IconData icon, + String label, + VoidCallback onTap, + ) { + return GestureDetector( + key: Key('select$label'), + onTap: onTap, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + icon, + size: SizeConfig.screenHeight! * 0.05, + ), + Text(AppLocalizations.of(context)!.strictTranslate(label)), + ], + ), + ); + } +} diff --git a/lib/views/after_auth_screens/profile/profile_page.dart b/lib/views/after_auth_screens/profile/profile_page.dart new file mode 100644 index 000000000..742499539 --- /dev/null +++ b/lib/views/after_auth_screens/profile/profile_page.dart @@ -0,0 +1,472 @@ +import 'package:contained_tab_bar_view/contained_tab_bar_view.dart'; +import 'package:flutter/material.dart'; +// import 'package:flutter_braintree/flutter_braintree.dart'; +// import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/plugins/talawa_plugin_provider.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/profile/user_event.dart'; +import 'package:talawa/views/after_auth_screens/profile/user_feed.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; + +/// ProfilePage returns a widget that renders a page of user's profile. +class ProfilePage extends StatelessWidget { + const ProfilePage({ + required Key key, + this.homeModel, + }) : super(key: key); + + /// represents MainScreenViewModel. + final MainScreenViewModel? homeModel; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return Scaffold( + key: model.scaffoldKey, + appBar: AppBar( + backgroundColor: Colors.green, + elevation: 0.0, + centerTitle: true, + leading: IconButton( + color: Colors.white, + icon: const Icon(Icons.menu), + onPressed: () => + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(), + ), + key: const Key("ProfilePageAppBar"), + title: Text( + AppLocalizations.of(context)!.strictTranslate('Profile'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + color: Colors.white, + ), + ), + actions: [ + IconButton( + key: const Key('settingIcon'), + onPressed: () { + navigationService.pushScreen(Routes.appSettings); + }, + icon: const Icon( + Icons.settings, + color: Colors.white, + ), + ), + ], + ), + // if data fetching is under process then renders Circular Progress Icon + // else renders the widget. + body: model.isBusy + ? const CircularProgressIndicator() + : RefreshIndicator( + onRefresh: () async => model.initialize(), + child: SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: SizeConfig.screenHeight! * 0.01, + ), + Row( + children: [ + Expanded( + flex: 1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: CustomAvatar( + key: const Key('profilepic'), + isImageNull: model.currentUser.image == null, + firstAlphabet: model.currentUser.firstName! + .substring(0, 1), + imageUrl: model.currentUser.image, + fontSize: Theme.of(context) + .textTheme + .titleLarge! + .fontSize, + maxRadius: SizeConfig.screenHeight! * 0.02, + ), + ), + ), + Expanded( + flex: 3, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '${model.currentUser.firstName!} ${model.currentUser.lastName!}', + style: TextStyle( + fontSize: SizeConfig.screenHeight! * 0.025, + ), + ), + ), + ), + Expanded( + flex: 1, + child: IconButton( + key: const Key('inviteicon'), + icon: Icon( + Icons.share, + color: + Theme.of(context).colorScheme.secondary, + ), + onPressed: () => model.invite(context), + ), + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.02, + ), + TalawaPluginProvider( + pluginName: "Donation", + visible: true, + child: Column( + children: [ + RaisedRoundedButton( + key: homeModel!.keySPDonateUs, + buttonLabel: AppLocalizations.of(context)! + .strictTranslate( + 'Donate to the Community', + ), + onTap: () => donate(context, model), + textColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + backgroundColor: + Theme.of(context).colorScheme.tertiary, + ), + ], + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.68, + width: double.infinity, + child: ContainedTabBarView( + tabs: [ + Tab( + text: AppLocalizations.of(context)! + .strictTranslate( + 'Posts', + ), + key: const Key('UserpostTab'), + ), + Tab( + text: AppLocalizations.of(context)! + .strictTranslate( + 'Events', + ), + key: const Key('UserEventsTab'), + ), + ], + views: [ + const UserFeed(key: Key("UserFeed")), + const UserEvents(key: Key("UserEvents")), + ], + ), + ), + ], + ), + ), + ), + ); + }, + ); + } + + /// 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, + isScrollControlled: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + builder: (BuildContext context) { + return StatefulBuilder( + builder: (context, setState) { + model.attachListener(setState); + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: SizedBox( + height: model.bottomSheetHeight, + child: Scaffold( + // background color set to Primary + backgroundColor: + Theme.of(context).colorScheme.primaryContainer, + // header + appBar: AppBar( + centerTitle: true, + automaticallyImplyLeading: false, + backgroundColor: Colors.transparent, + elevation: 0.0, + toolbarHeight: SizeConfig.screenHeight! * 0.15, + title: Padding( + padding: const EdgeInsets.only(top: 8.0), + // display title + child: Text( + '${AppLocalizations.of(context)!.strictTranslate('Donating to')}\n${model.currentOrg.name}', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith(fontSize: 24), + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + ), + actions: [ + Padding( + padding: EdgeInsets.only( + right: 8.0, + top: SizeConfig.screenHeight! * 0.01, + ), + child: IconButton( + icon: Icon( + Icons.cancel, + color: Theme.of(context).colorScheme.primary, + ), + onPressed: model.popBottomSheet, + ), + ), + ], + ), + body: SingleChildScrollView( + // SingleChildScrollView is a box in which a single widget can be scrolled. + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Please select any amount'), + style: Theme.of(context).textTheme.headlineSmall, + ), + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // looping through and renders button for donation amounts. + children: List.generate( + 3, + (index) => model.dominationButton( + model.denomination[index], + context, + setState, + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + Text( + AppLocalizations.of(context)!.strictTranslate( + 'Or', + ), + style: Theme.of(context).textTheme.headlineSmall, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Input custom amount'), + style: Theme.of(context).textTheme.headlineSmall, + ), + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + // containers for custom amount + Container( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.05, + ), + child: TextField( + key: const Key('custom_amt'), + controller: model.donationAmount, + focusNode: model.donationField, + textInputAction: TextInputAction.next, + keyboardType: TextInputType.number, + autofillHints: const [AutofillHints.email], + enableSuggestions: true, + style: Theme.of(context).textTheme.titleLarge, + onChanged: (text) { + setState(() {}); + }, + decoration: InputDecoration( + hintText: AppLocalizations.of(context)! + .translate("Enter donation amount"), + labelText: AppLocalizations.of(context)! + .translate("Enter custom donation amount"), + labelStyle: + Theme.of(context).textTheme.titleMedium, + prefixIcon: GestureDetector( + key: const Key('currency_btn'), + onTap: () { + model.changeCurrency(context, setState); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 15.0, + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + model.donationCurrency, + textAlign: TextAlign.center, + style: Theme.of(context) + .textTheme + .headlineSmall, + ), + const Icon( + Icons.arrow_drop_down_circle_outlined, + ), + ], + ), + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: const BorderRadius.all( + Radius.circular(12.0), + ), + borderSide: BorderSide( + color: + Theme.of(context).colorScheme.secondary, + width: 2, + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: const BorderRadius.all( + Radius.circular(10.0), + ), + borderSide: BorderSide( + color: + Theme.of(context).colorScheme.secondary, + ), + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + ElevatedButton( + key: const Key('DONATE'), + onPressed: () async { + ///required fields for donation transaction + // late final String userId; + // late final String orgId; + // late final String nameOfOrg; + // late final String nameOfUser; + // late final String payPalId; + // late final double amount; + // orgId = model.currentOrg.id!; + // userId = model.currentUser.id!; + // nameOfUser = + // "${model.currentUser.firstName!} ${model.currentUser.lastName!}"; + // nameOfOrg = model.currentOrg.name!; + + // amount = double.parse(model.donationAmount.text); + // final request = BraintreeDropInRequest( + // tokenizationKey: + // '', + // collectDeviceData: true, + // paypalRequest: BraintreePayPalRequest( + // amount: model.donationAmount.text, + // displayName: "Talawa", + // ), + // cardEnabled: true, + // ); + + // final BraintreeDropInResult? result = + // await BraintreeDropIn.start(request); + // if (result != null) { + // ///saving the donation in server + // late final GraphQLClient client = + // graphqlConfig.clientToQuery(); + + // ///getting transaction id from `brainTree` API + // payPalId = result.paymentMethodNonce.nonce; + + // final QueryResult donationResult = + // await client.mutate( + // MutationOptions( + // document: gql( + // queries.createDonation( + // userId, + // orgId, + // nameOfOrg, + // nameOfUser, + // payPalId, + // amount, + // ), + // ), + // ), + // ); + // if (donationResult.hasException) { + // model.showSnackBar( + // "Error occurred while making a donation", + // ); + // } + + // /// hiding the donation UI once it is successful + // model.popBottomSheet(); + // model.showSnackBar( + // 'Donation Successful,Thanks for the support !', + // ); + // } + }, + style: ButtonStyle( + backgroundColor: WidgetStateProperty.all( + // if the donation amount entered or selected is empty then renders grey color + // else render primary color + model.donationAmount.text.isEmpty + ? Colors.grey + : Theme.of(context).colorScheme.primary, + ), + ), + child: Text( + AppLocalizations.of(context)!.strictTranslate( + 'DONATE', + ), + style: Theme.of(context).textTheme.labelLarge, + ), + ), + ], + ), + ), + ), + ), + ); + }, + ); + }, + ).then((value) => model.updateSheetHeight()); + } +} diff --git a/lib/views/after_auth_screens/profile/user_event.dart b/lib/views/after_auth_screens/profile/user_event.dart new file mode 100644 index 000000000..e9fea98b0 --- /dev/null +++ b/lib/views/after_auth_screens/profile/user_event.dart @@ -0,0 +1,91 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.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'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/event_card.dart'; + +///UserEvents to show events created by user in current organisation . +class UserEvents extends StatefulWidget { + const UserEvents({ + required super.key, + }); + + @override + State createState() => _UserEventsState(); +} + +class _UserEventsState extends State + with AutomaticKeepAliveClientMixin { + @override + bool get wantKeepAlive => true; + + @override + Widget build(BuildContext context) { + super.build(context); + return BaseView( + onModelReady: (model) => model.initialise(), + builder: (context, model, child) { + return Scaffold( + body: model.isBusy + ? const Center(child: CircularProgressIndicator()) + : model.userEvents.isEmpty + ? Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppLocalizations.of(context)!.strictTranslate( + 'You have no event in this organization', + ), + style: TextStyle( + fontSize: SizeConfig.screenHeight! * 0.026, + ), + ), + TextButton( + onPressed: () { + navigationService.pushScreen( + "/createEventPage", + ); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate( + 'Create your first event', + ), + ), + ), + ], + ), + ) + : SingleChildScrollView( + key: const Key('UserEventsList'), + child: ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: model.userEvents.length, + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + key: Key('event$index'), + onTap: () { + navigationService.pushScreen( + "/eventInfo", + arguments: { + "event": model.userEvents[index], + "exploreEventViewModel": model, + }, + ); + }, + child: EventCard( + event: model.userEvents[index], + isSearchItem: false, + ), + ); + }, + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/after_auth_screens/profile/user_feed.dart b/lib/views/after_auth_screens/profile/user_feed.dart new file mode 100644 index 000000000..f8130d69a --- /dev/null +++ b/lib/views/after_auth_screens/profile/user_feed.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/post_list_widget.dart'; + +/// User Feed to shows posts by user in current organisation. +class UserFeed extends StatefulWidget { + const UserFeed({ + required Key key, + this.forTest = false, + }) : super(key: key); + + /// for testing. + final bool forTest; + + @override + State createState() => _UserFeedState(); +} + +class _UserFeedState extends State + with AutomaticKeepAliveClientMixin { + @override + bool get wantKeepAlive => true; + + @override + Widget build(BuildContext context) { + super.build(context); + return BaseView( + onModelReady: (model) => model.initialise(isTest: widget.forTest), + builder: (context, model, child) { + model.userPosts.sort((a, b) => b.createdAt!.compareTo(a.createdAt!)); + return Scaffold( + body: model.isFetchingPosts + ? const Center(child: CircularProgressIndicator()) + : (model.userPosts.isEmpty + ? Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppLocalizations.of(context)!.strictTranslate( + 'You have no post in this organization', + ), + style: TextStyle( + fontSize: SizeConfig.screenHeight! * 0.026, + ), + ), + TextButton( + onPressed: () { + navigationService.pushScreen('/addpostscreen'); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate( + 'Create your first post', + ), + ), + ), + ], + ), + ) + : SingleChildScrollView( + child: PostListWidget( + key: const Key('UserPostWidget'), + posts: model.userPosts, + function: model.navigateToIndividualPage, + deletePost: model.removePost, + ), + )), + ); + }, + ); + } +} diff --git a/lib/views/base_view.dart b/lib/views/base_view.dart index 2e474c8df..b0d2578aa 100644 --- a/lib/views/base_view.dart +++ b/lib/views/base_view.dart @@ -1,14 +1,17 @@ -//the flutter material package is called -import 'package:flutter/material.dart'; +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments -//Pages are imported here +import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:talawa/locator.dart'; class BaseView extends StatefulWidget { - const BaseView({@required this.builder, this.onModelReady}); - final Widget Function(BuildContext context, T value, Widget child) builder; - final Function(T) onModelReady; + const BaseView({ + required this.builder, + this.onModelReady, + }); + final Function(T)? onModelReady; + final Widget Function(BuildContext, T, Widget?) builder; @override _BaseViewState createState() => _BaseViewState(); @@ -19,17 +22,19 @@ class _BaseViewState extends State> { @override void initState() { - if (widget.onModelReady != null) { - widget.onModelReady(model); - } + widget.onModelReady?.call(model); super.initState(); } @override - Widget build(BuildContext context) { + Widget build( + BuildContext context, + ) { return ChangeNotifierProvider( create: (context) => model, - child: Consumer(builder: widget.builder), + child: Consumer( + builder: widget.builder, + ), ); } } diff --git a/lib/views/demo_screens/explore_events_demo.dart b/lib/views/demo_screens/explore_events_demo.dart new file mode 100644 index 000000000..7eb9e70b2 --- /dev/null +++ b/lib/views/demo_screens/explore_events_demo.dart @@ -0,0 +1,266 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.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'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/explore_event_dialogue.dart'; +import 'package:talawa/widgets/event_card.dart'; + +/// Shows the list of events with options to categorize them. +class DemoExploreEvents extends StatelessWidget { + const DemoExploreEvents({ + required Key key, + this.homeModel, + }) : super(key: key); + + /// [homeModal] is a type of [MainScreenViewModel] which provides methods to handle the data for this component. + final MainScreenViewModel? homeModel; + + @override + Widget build(BuildContext context) { + final model = locator(); + return Scaffold( + appBar: AppBar( + // AppBar returns widget for the header. + backgroundColor: Theme.of(context).primaryColor, + key: const Key("ExploreEventsAppBar"), + elevation: 0.0, + automaticallyImplyLeading: false, + centerTitle: true, + title: Text( + AppLocalizations.of(context)!.strictTranslate('Explore Events'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + leading: IconButton( + // returns a button of menu icon to redirect to home. + color: Theme.of(context).iconTheme.color, + icon: const Icon(Icons.menu), + onPressed: () => + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(), + ), + actions: [ + Padding( + padding: EdgeInsets.only( + right: SizeConfig.screenWidth! * 0.027, + ), + // if the events is not empty then renders button for searching the events else renders just a box. + // child: model.events.isNotEmpty + // ? IconButton( + // onPressed: () { + // showSearch( + // context: context, + // delegate: EventSearch( + // eventList: model.events, + // exploreEventsViewModel: model, + // ), + // ); + // }, + // icon: const Icon(Icons.search, size: 20), + // ) + // : const SizedBox(), + child: const SizedBox(), + ), + ], + ), + // 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: Stack( + children: [ + SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.010, + ), + child: Column( + children: [ + Row( + mainAxisAlignment: 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), + ), + ), + ), + ), + Expanded( + flex: 2, + child: GestureDetector( + onTap: () { + showDialog( + // on tap open the Explore Event Dialog. + context: context, + builder: (_) { + return const ExploreEventDialog( + key: Key('ExploreEvents'), + ); + }, + ); + }, + child: Card( + key: homeModel?.keySEDateFilter, + color: Theme.of(context).colorScheme.onPrimary, + child: Container( + padding: const EdgeInsets.symmetric( + vertical: 12, + ), + // width: SizeConfig.screenWidth! * 0.30, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + const Icon( + Icons.calendar_today, + color: Color(0xff524F4F), + ), + const SizedBox( + width: 8, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate( + "Add Date", + ), + ), + ], + ), + ), + ), + ), + ), + Expanded( + flex: 1, + child: Card( + color: Theme.of(context).colorScheme.onPrimary, + child: IconButton( + onPressed: () { + navigationService.pushScreen( + Routes.calendar, + arguments: model.events, + ); + }, + icon: const Icon( + Icons.calendar_month, + ), + ), + ), + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.027, + ), + // if the events model is empty then renders a box with text as "Empty List" + // else renders lists of the all event tile. + model.events.isEmpty + ? SizedBox( + height: SizeConfig.screenHeight! * 0.5, + child: Center( + child: Text(model.emptyListMessage), + ), + ) + : ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: model.events.length, + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + onTap: () { + navigationService.pushScreen( + "/eventInfo", + arguments: { + "event": model.events[index], + "exploreEventViewModel": model, + }, + ); + }, + child: EventCard( + event: model.events[index], + isSearchItem: false, + ), + ); + }, + ), + ], + ), + ), + ), + ], + ), + + floatingActionButton: FloatingActionButton.extended( + key: homeModel?.keySEAdd, + heroTag: "AddEventFab", + backgroundColor: Theme.of(context).colorScheme.surface, + onPressed: () { + navigationService.pushScreen( + "/createEventPage", + ); + }, + icon: Icon( + Icons.add, + color: Theme.of(context).colorScheme.secondary, + ), + label: Text( + AppLocalizations.of(context)!.strictTranslate("Event"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(color: Theme.of(context).colorScheme.secondary), + ), + ), + ); + } + + /// 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/views/demo_screens/organization_feed_demo.dart b/lib/views/demo_screens/organization_feed_demo.dart new file mode 100644 index 000000000..65a5f0463 --- /dev/null +++ b/lib/views/demo_screens/organization_feed_demo.dart @@ -0,0 +1,142 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/widgets/pinned_post.dart'; + +/// OrganizationFeed returns a widget that shows the feed of the organization. +class DemoOrganizationFeed extends StatelessWidget { + const DemoOrganizationFeed({ + required Key key, + this.homeModel, + this.forTest = false, + }) : super(key: key); + + /// MainScreenViewModel. + final MainScreenViewModel? homeModel; + + /// To implement the test. + final bool forTest; + + /// List of dummy pinned posts. + static const List> pinnedPosts = [ + { + 'text': 'Church Meeting', + '_id': 'hdkahfu567', + 'imageUrl': + 'https://i2-prod.manchestereveningnews.co.uk/incoming/article25630061.ece/ALTERNATES/s615/2_Church-PA.jpg', + 'createdAt': '2023-12-14T08:30:00Z', + }, + { + 'text': 'Russia-Ukraine war leads to Hike in Gas prices in Europe.', + '_id': 'hfkajhk669', + 'imageUrl': + 'https://gdb.voanews.com/3B960F7F-786C-452C-8ABD-9D5AEEAED9D9.jpg', + 'createdAt': '2023-12-14T08:30:00Z', + }, + { + 'text': 'Flood in near village.', + '_id': 'adadada555', + 'imageUrl': + 'https://www.deccanherald.com/sites/dh/files/styles/article_detail/public/articleimages/2022/08/03/file7m4trf3i92e1krs53cn6-1132513-1659475940.jpg?itok=oVs3TTP8', + 'createdAt': '2023-12-14T08:30:00Z', + }, + { + 'text': 'The craze behind auto-tech stocks.', + '_id': 'nvikaebkf', + 'imageUrl': + 'https://akm-img-a-in.tosshub.com/businesstoday/images/assets/202303/stock-market-02136-4-sixteen_nine.jpg', + 'createdAt': '2023-12-14T08:30:00Z', + }, + { + 'text': 'High seas treaty', + '_id': 'nfqbkbd', + 'imageUrl': + 'https://ichef.bbci.co.uk/news/976/cpsprodpb/A194/production/_128846314_humpbackwhale.jpg', + 'createdAt': '2023-12-14T08:30:00Z', + }, + { + 'text': 'WWE Wrestking and Gambling', + '_id': 'dadadada', + 'imageUrl': + 'https://staticc.sportskeeda.com/editor/2023/03/a9b3a-16783664764772-1920.jpg', + 'createdAt': '2023-12-14T08:30:00Z', + }, + { + 'text': 'Dead of Silicon Valley Bank.', + '_id': 'hfkaaddadajhk669', + 'imageUrl': + 'https://thechainsaw.com/wp-content/uploads/2023/03/2023-50.jpg?w=1200', + 'createdAt': '2023-12-14T08:30:00Z', + }, + { + 'text': 'What if women were paid for chores', + '_id': 'kofapjfn', + 'imageUrl': + 'https://www.shethepeople.tv/wp-content/uploads/2019/06/household.png', + 'createdAt': '2023-12-14T08:30:00Z', + }, + { + 'text': 'Debate over stocks bybacks.', + '_id': 'agdjvfhsjaf', + 'imageUrl': + 'https://m.wsj.net/video/20200105/wsjglossarystockbuybackssplash/wsjglossarystockbuybackssplash_640x360.jpg', + 'createdAt': '2023-12-14T08:30:00Z', + }, + ]; + + /// function returns a widget that shows the feed of the organization. + /// + /// **params**: + /// * `context`: build context of the widget. + /// + /// **returns**: + /// * `Widget`: returns a widget that shows the feed of the organization. + Widget demoOrganisationFeedPage(BuildContext context) { + return Scaffold( + appBar: AppBar( + // AppBar returns a widget for the header of the page. + backgroundColor: Colors.green, + // Theme.of(context).primaryColor, + elevation: 0.0, + centerTitle: true, + title: Text( + AppLocalizations.of(context)!.strictTranslate("Organisation Name"), + key: homeModel?.keySHOrgName, + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontSize: 20, + color: Colors.white, + ), + ), + leading: IconButton( + key: homeModel?.keySHMenuIcon, + icon: Icon( + Icons.menu, + color: Theme.of(context).iconTheme.color, + ), + onPressed: () { + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(); + }, + ), + ), + // if the model is fetching the data then renders Circular Progress Indicator else renders the result. + body: ListView( + shrinkWrap: true, + children: [ + // If the organization has pinned posts then renders PinnedPostCarousel widget else Container. + PinnedPost( + pinnedPost: pinnedPosts.map((map) => Post.fromJson(map)).toList(), + model: homeModel!, + ), + // If the organization has posts then renders PostListWidget widget else Container. + Container(), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + return demoOrganisationFeedPage(context); + } +} diff --git a/lib/views/demo_screens/profile_page_demo.dart b/lib/views/demo_screens/profile_page_demo.dart new file mode 100644 index 000000000..cee0dd2e8 --- /dev/null +++ b/lib/views/demo_screens/profile_page_demo.dart @@ -0,0 +1,251 @@ +import 'package:contained_tab_bar_view/contained_tab_bar_view.dart'; +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; +import 'package:talawa/widgets/from_palisadoes.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; + +/// ProfilePage returns a widget that renders a page of user's profile. +class DemoProfilePage extends StatelessWidget { + const DemoProfilePage({ + required Key key, + this.homeModel, + }) : super(key: key); + + /// MainScreenViewModel. + /// + final MainScreenViewModel? homeModel; + + @override + Widget build(BuildContext context) { + print(userConfig.loggedIn); + return Scaffold( + key: const Key('DemoProfilePage'), + appBar: AppBar( + backgroundColor: Colors.green, + // Theme.of(context).primaryColor, + elevation: 0.0, + centerTitle: true, + leading: IconButton( + color: Theme.of(context).iconTheme.color, + icon: const Icon(Icons.menu), + onPressed: () { + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(); + }, + ), + key: const Key("ProfilePageAppBar"), + title: Text( + AppLocalizations.of(context)!.strictTranslate('Profile'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + // fontWeight: FontWeight.w600, + fontSize: 20, + fontFamily: 'open-sans', + color: Colors.white, + ), + ), + actions: [ + IconButton( + key: const Key('settingIcon'), + onPressed: () { + print('came'); + navigationService.pushScreen(Routes.appSettings); + }, + icon: const Icon(Icons.settings), + ), + ], + ), + // if data fetching is under process then renders Circular Progress Icon + // else renders the widget. + body: guestViewWidget(context), + ); + } + + /// guestViewWidget, this widget is shown if user is not logged in. + /// + /// **params**: + /// * `context`: Build context to perform context related operation + /// + /// **returns**: + /// * `Widget`: Widget + Widget guestViewWidget(BuildContext context) { + return SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: SizeConfig.screenHeight! * 0.01, + ), + Row( + children: [ + Expanded( + flex: 1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: CustomAvatar( + isImageNull: true, + firstAlphabet: "U", + imageUrl: null, + fontSize: Theme.of(context).textTheme.titleLarge!.fontSize, + maxRadius: 30, + ), + ), + ), + const Expanded( + flex: 3, + child: Padding( + padding: EdgeInsets.all(8.0), + child: Text( + 'User', + style: TextStyle( + color: Colors.white, + fontSize: 20, + fontFamily: 'open-sans', + ), + ), + ), + ), + // Expanded( + // flex: 1, + // child: IconButton( + // icon: Icon( + // Icons.share, + // color: + // Theme.of(context).colorScheme.secondary, + // ), + // onPressed: () => model.invite(context), + // ), + // ), + ], + ), + const SizedBox( + height: 20, + ), + RaisedRoundedButton( + key: homeModel!.keySPDonateUs, + buttonLabel: AppLocalizations.of(context)!.strictTranslate( + 'Donate to the Community', + ), + onTap: () { + MainScreenViewModel.scaffoldKey.currentState?.openDrawer(); + }, + textColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + backgroundColor: Theme.of(context).colorScheme.secondaryContainer, + ), + SizedBox( + height: 600, + width: double.infinity, + child: ContainedTabBarView( + tabs: [ + Tab( + text: AppLocalizations.of(context)!.strictTranslate('Posts'), + ), + Tab( + text: AppLocalizations.of(context)!.strictTranslate('Events'), + ), + Tab( + text: AppLocalizations.of(context)!.strictTranslate('Tasks'), + ), + ], + views: [ + ColoredBox( + color: Theme.of(context).colorScheme.surface, + child: GridView.count( + mainAxisSpacing: 5, + crossAxisCount: 3, + children: [ + Image.asset('assets/images/pfp2.png'), + Image.asset('assets/images/pfp2.png'), + Image.asset('assets/images/pfp2.png'), + Image.asset('assets/images/pfp2.png'), + Image.asset('assets/images/pfp2.png'), + ], + ), + ), + Container( + color: Theme.of(context).colorScheme.surface, + ), + Container( + color: Theme.of(context).colorScheme.onPrimary, + ), + ], + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.67, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: SizeConfig.screenHeight! * 0.01, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + + /// `Donation` acts as plugin. If visible is true the it will be always visible. + /// even if it's uninstalled by the admin (for development purposes) + //TODO: custom tile for Invitation. + // CustomListTile( + // key: homeModel!.keySPInvite, + // index: 3, + // type: TileType.option, + // option: Options( + // icon: Icon( + // Icons.share, + // color: + // Theme.of(context).colorScheme.secondary, + // size: 30, + // ), + // // title + // title: AppLocalizations.of(context)! + // .strictTranslate('Invite'), + // // subtitle + // subtitle: AppLocalizations.of(context)! + // .strictTranslate('Invite to org'), + // ), + // // on tap call the invite function + // onTapOption: () => model.invite(context), + // ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + // Custom tile for Logout option. + //TODO: logout + // CustomListTile( + // key: homeModel!.keySPLogout, + // index: 3, + // type: TileType.option, + // option: Options( + // icon: Icon( + // Icons.logout, + // color: + // Theme.of(context).colorScheme.secondary, + // size: 30, + // ), + // title: AppLocalizations.of(context)! + // .strictTranslate('Log out'), + // subtitle: AppLocalizations.of(context)! + // .strictTranslate('Log out from Talawa'), + // ), + // // on tap calls the logout function + // onTapOption: () => model.logout(context), + // ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + FromPalisadoes(key: homeModel!.keySPPalisadoes), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/views/main_screen.dart b/lib/views/main_screen.dart new file mode 100644 index 000000000..f3239cf49 --- /dev/null +++ b/lib/views/main_screen.dart @@ -0,0 +1,106 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_drawer.dart'; + +/// This widget is responsible for displaying the main screen of the application. +class MainScreen extends StatefulWidget { + const MainScreen({super.key, required this.mainScreenArgs}); + + /// Holds data for the MainScreenArgs model, providing information to MainScreen. + final MainScreenArgs mainScreenArgs; + + @override + State createState() => _MainScreenState(); +} + +class _MainScreenState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.initialise( + context, + fromSignUp: widget.mainScreenArgs.fromSignUp, + mainScreenIndex: widget.mainScreenArgs.mainScreenIndex, + demoMode: widget.mainScreenArgs.toggleDemoMode, + ); + }, + builder: (context, model, child) { + // Checks for updates in plugins from the server. + // Will continously hit the server and fetch plugin information. + model.fetchAndAddPlugins(context); + return Scaffold( + key: MainScreenViewModel.scaffoldKey, + drawer: CustomDrawer( + homeModel: model, + key: const Key("Custom Drawer"), + ), + body: Stack( + children: [ + IndexedStack( + index: model.currentPageIndex, + children: model.pages, + ), + widget.mainScreenArgs.toggleDemoMode + ? Positioned( + bottom: 0, // Adjust this value as per your UI + left: 0, + right: 0, + child: InkWell( + key: const Key('banner'), + onTap: () => navigationService + .pushScreen(Routes.setUrlScreen, arguments: ''), + child: Container( + height: 30.0, // Set the desired height of the banner + color: Theme.of(context) + .canvasColor, // Change color as needed + child: Center( + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: AppLocalizations.of(context)! + .strictTranslate( + 'For complete access, please', + ), + style: + Theme.of(context).textTheme.bodySmall, + ), + TextSpan( + text: AppLocalizations.of(context)! + .strictTranslate( + 'join an organization.', + ), + style: TextStyle( + color: Theme.of(context) + .colorScheme + .secondary, + ), + ), + ], + ), + ), + ), + ), + ), + ) + : Container(), + ], + ), + bottomNavigationBar: BottomNavigationBar( + type: BottomNavigationBarType.fixed, + currentIndex: model.currentPageIndex, + onTap: model.onTabTapped, + selectedItemColor: const Color(0xff34AD64), + items: model.navBarItems, + ), + ); + }, + ); + } +} diff --git a/lib/views/pages/_pages.dart b/lib/views/pages/_pages.dart deleted file mode 100644 index 1dbcfb66e..000000000 --- a/lib/views/pages/_pages.dart +++ /dev/null @@ -1,4 +0,0 @@ -export 'home_page.dart'; -export 'login_signup/login_page.dart'; -export 'organization/join_organization.dart'; -export 'organization/profile_page.dart'; diff --git a/lib/views/pages/chat/chat.dart b/lib/views/pages/chat/chat.dart deleted file mode 100644 index 27df73cad..000000000 --- a/lib/views/pages/chat/chat.dart +++ /dev/null @@ -1,78 +0,0 @@ -//flutter packages -import 'package:flutter/material.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -//pages are called here -import 'package:talawa/utils/uidata.dart'; - -class Chat extends StatefulWidget { - const Chat({Key key, this.groupName}) : super(key: key); - final String groupName; - - @override - _ChatState createState() => _ChatState(); -} - -class _ChatState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Row( - children: [ - CircleAvatar( - backgroundColor: UIData.secondaryColor, - child: Image.asset(UIData.talawaLogo), - ), - Padding( - padding: - EdgeInsets.only(left: SizeConfig.safeBlockHorizontal * 2.5), - child: Text( - widget.groupName, - style: const TextStyle(color: Colors.white), - ), - ) - ], - ), - ), - body: Align( - alignment: Alignment.bottomCenter, child: _textComposerWidget()), - ); - } - - Widget _textComposerWidget() { - return Padding( - padding: EdgeInsets.only(bottom: SizeConfig.safeBlockVertical * 1.25), - child: IconTheme( - data: const IconThemeData(color: Colors.blue), - child: Container( - margin: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 2), - child: Row( - children: [ - Flexible( - child: TextField( - textInputAction: TextInputAction.newline, - maxLines: null, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(20.0), - ), - hintText: "Enter your message...."), - ), - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 2), - child: IconButton( - onPressed: () {}, - icon: const Icon(Icons.send), - ), - ) - ], - ), - ), - ), - ); - } -} diff --git a/lib/views/pages/chat/groups.dart b/lib/views/pages/chat/groups.dart deleted file mode 100644 index 21b9c1a8f..000000000 --- a/lib/views/pages/chat/groups.dart +++ /dev/null @@ -1,209 +0,0 @@ -//flutter packages are called here -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -//pages are called here -import 'package:provider/provider.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:talawa/views/pages/chat/chat.dart'; - -class Groups extends StatefulWidget { - const Groups({Key key}) : super(key: key); - - @override - _GroupsState createState() => _GroupsState(); -} - -class _GroupsState extends State { - List eventList = []; - List displayedEvents = []; - Preferences preferences = Preferences(); - ApiFunctions apiFunctions = ApiFunctions(); - - //variable to monitor fetching of events - bool fetched = true; - - // ignore: prefer_typing_uninitialized_variables - var events; - FToast fToast; - - //variable for organization Id - String _currOrgId; - - @override - initState() { - super.initState(); - setState(() { - events = getEvents(); - }); - } - - //function to get the events - Future getEvents() async { - fetched = false; - final String currentOrgID = await preferences.getCurrentOrgId(); - _currOrgId = currentOrgID; - final Map result = - await apiFunctions.gqlquery(Queries().fetchOrgEvents(currentOrgID)); - // print(result); - eventList = result == null - ? [] - : result['events'].reversed.toList() as List; - eventList.removeWhere((element) => - element['title'] == 'Talawa Congress' || - element['title'] == 'test' || - element['title'] == 'Talawa Conference Test' || - element['title'] == 'mayhem' || - element['title'] == 'mayhem1' || - element['isRegistered'] == false || - element['organization']['_id'] != - currentOrgID); //dont know who keeps adding these - // This removes all invalid date formats other than Unix time - eventList.removeWhere( - (element) => int.tryParse(element['startTime'] as String) == null); - eventList.sort((a, b) { - return DateTime.fromMicrosecondsSinceEpoch( - int.parse(a['startTime'] as String)) - .compareTo(DateTime.fromMicrosecondsSinceEpoch( - int.parse(b['startTime'] as String))); - }); - // eventsToDates(eventList, DateTime.now()); - setState(() { - displayedEvents = eventList; - }); - fetched = true; - - // print('orgID ==== $currentOrgID'); - print(displayedEvents); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - key: const Key('GROUPS_APP_BAR'), - title: const Text( - 'Chats', - style: TextStyle(color: Colors.white), - ), - ), - body: (_currOrgId == null || displayedEvents.isEmpty) - ? Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - const Spacer(), - Container( - alignment: Alignment.center, - //Text for empty chat groups - child: const Text( - "Register in an event to start chatting", - key: Key('empty_chat_group'), - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - color: Colors.grey, - ), - ), - ), - const Spacer(), - //Shows spinner while fetching is performed - //else shows a refresh text button with icon - !fetched - ? const Padding( - padding: EdgeInsets.all(8.0), - child: FittedBox( - fit: BoxFit.scaleDown, - child: CircularProgressIndicator(), - ), - ) - : TextButton.icon( - key: const Key('click_to_refresh_button'), - icon: const Icon(Icons.refresh), - label: const Text('Click to Refresh..'), - onPressed: () { - setState(() { - try { - getEvents(); - } catch (e) { - _exceptionToast(e.toString()); - } - }); - }, - ), - ], - ), - ) - //Refresh indicator for calling getEvents - : RefreshIndicator( - onRefresh: () async { - try { - await getEvents(); - } catch (e) { - _exceptionToast(e.toString()); - } - }, - //List of chat groups - child: ListView.builder( - itemCount: displayedEvents.length, - itemBuilder: (context, index) { - final String groupName = - '${displayedEvents[index]['title']}'; - final String _imgSrc = displayedEvents[index] - ['organization']['image'] as String; - return Card( - child: ListTile( - title: Text(groupName), - leading: CircleAvatar( - backgroundColor: UIData.secondaryColor, - child: _imgSrc == null - ? Image.asset(UIData.talawaLogo) - : NetworkImage( - Provider.of(context) - .displayImgRoute + - _imgSrc) as Widget, - ), - trailing: const Icon(Icons.arrow_right), - onTap: () { - pushNewScreen( - context, - screen: Chat( - groupName: groupName, - ), - ); - }, - ), - ); - }), - ), - ); - } - - //function to show exceptions - _exceptionToast(String msg) { - final Widget toast = Container( - padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 14.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 1), - ); - } -} diff --git a/lib/views/pages/events/add_event_page.dart b/lib/views/pages/events/add_event_page.dart deleted file mode 100644 index ff346d0a9..000000000 --- a/lib/views/pages/events/add_event_page.dart +++ /dev/null @@ -1,345 +0,0 @@ -//flutter packages -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/services/queries_.dart'; - -//pages are called here -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:intl/intl.dart'; -import 'package:talawa/views/pages/events/events.dart'; -import 'package:talawa/views/widgets/show_progress.dart'; -import 'package:talawa/views/widgets/toast_tile.dart'; - -class AddEvent extends StatefulWidget { - const AddEvent({Key key}) : super(key: key); - - @override - _AddEventState createState() => _AddEventState(); -} - -class _AddEventState extends State { - final titleController = TextEditingController(); - final descriptionController = TextEditingController(); - final locationController = TextEditingController(); - bool _validateTitle = false, - _validateDescription = false, - _validateLocation = false; - ApiFunctions apiFunctions = ApiFunctions(); - FToast fToast; - - Map switchVals = { - 'Make Public': true, - 'Make Registerable': true, - 'Recurring': true, - 'All Day': false - }; - List recurranceList = ['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY']; - String recurrance = 'DAILY'; - Preferences preferences = Preferences(); - @override - void initState() { - fToast = FToast(); - fToast.init(context); - super.initState(); - } - - //getting the date for the event - DateTimeRange dateRange = DateTimeRange( - start: DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day, 1, 0), - end: DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day + 1, 1, 0)); - - //storing the start time of an event - Map startEndTimes = { - 'Start Time': DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day, 12, 0), - 'End Time': DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day, 23, 59), - }; - - //method to be called when the user wants to select the date - Future _selectDate(BuildContext context) async { - final DateTime now = DateTime.now(); - final DateTimeRange picked = await showDateRangePicker( - context: context, - // initialDate: selectedDate, - firstDate: DateTime(now.year, now.month, now.day), - lastDate: DateTime(2101)); - if (picked != null && picked != dateRange) { - setState(() { - dateRange = picked; - }); - } - } - - //method to be called when the user wants to select time - Future _selectTime( - BuildContext context, String name, TimeOfDay time) async { - final TimeOfDay picked = await showTimePicker( - context: context, - initialTime: time, - ); - if (picked != null && picked != time) { - setState(() { - startEndTimes[name] = DateTime( - DateTime.now().year, - DateTime.now().month, - DateTime.now().day, - picked.hour, - picked.minute); - }); - } - } - - //method used to create an event - Future createEvent() async { - final DateTime startDate = DateTime( - dateRange.start.year, dateRange.start.month, dateRange.start.day); - final DateTime endDate = DateTime( - dateRange.start.year, dateRange.start.month, dateRange.start.day); - final DateTime startTime = DateTime( - dateRange.start.year, - dateRange.start.month, - dateRange.start.day, - startEndTimes['Start Time'].hour, - startEndTimes['Start Time'].minute); - final DateTime endTime = DateTime( - dateRange.end.year, - dateRange.end.month, - dateRange.end.day, - startEndTimes['End Time'].hour, - startEndTimes['End Time'].minute); - - if (switchVals['All Day']) { - startEndTimes = { - 'Start Time': DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, 12, 0), - 'End Time': DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, 23, 59), - }; - } - final String currentOrgID = await preferences.getCurrentOrgId(); - final result = await Queries().addEvent( - startDate: startDate.toString(), - endDate: endDate.toString(), - organizationId: currentOrgID, - title: titleController.text, - description: descriptionController.text, - location: locationController.text, - isPublic: switchVals['Make Public'], - isRegisterable: switchVals['Make Registerable'], - recurring: switchVals['Recurring'], - allDay: switchVals['All Day'], - recurrance: recurrance, - startTime: startTime.microsecondsSinceEpoch.toString(), - endTime: endTime.microsecondsSinceEpoch.toString(), - ); - print('Result is : $result'); - if (result == null) { - _exceptionToast("Could not create event! Please Try Again later!"); - } - } - - //main build starts from here - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text( - 'New Event', - style: TextStyle(color: Colors.white), - ), - ), - body: ListView( - padding: const EdgeInsets.only(bottom: 100), - children: [ - inputField('Title', titleController), - inputField('Description', descriptionController), - inputField('Location', locationController), - switchTile('Make Public'), - switchTile('Make Registerable'), - switchTile('Recurring'), - switchTile('All Day'), - recurrencedropdown(), - dateButton(), - timeButton('Start Time', startEndTimes['Start Time']), - timeButton('End Time', startEndTimes['End Time']), - ], - ), - floatingActionButton: addEventFab(), - ); - } - - //widget to get the date button - Widget dateButton() { - return ListTile( - onTap: () { - _selectDate(context); - }, - leading: Text( - 'Date', - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - trailing: Text( - '${DateFormat.yMMMd().format(dateRange.start)} | ${DateFormat.yMMMd().format(dateRange.end)} ', - style: const TextStyle(fontSize: 16, color: UIData.secondaryColor), - ), - ); - } - - //widget to get the time button - Widget timeButton(String name, DateTime time) { - return AbsorbPointer( - absorbing: switchVals['All Day'], - child: ListTile( - onTap: () { - _selectTime(context, name, TimeOfDay.fromDateTime(time)); - }, - leading: Text( - name, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - trailing: Text( - TimeOfDay.fromDateTime(time).format(context), - style: TextStyle( - color: !switchVals['All Day'] - ? UIData.secondaryColor - : Colors.grey), - ), - )); - } - - //widget to add the event - Widget addEventFab() { - return FloatingActionButton( - backgroundColor: UIData.secondaryColor, - onPressed: () async { - if (titleController.text.isEmpty || - descriptionController.text.isEmpty || - locationController.text.isEmpty) { - if (titleController.text.isEmpty) { - setState(() { - _validateTitle = true; - }); - } - if (descriptionController.text.isEmpty) { - setState(() { - _validateDescription = true; - }); - } - if (locationController.text.isEmpty) { - setState(() { - _validateLocation = true; - }); - } - Fluttertoast.showToast( - msg: 'Fill in the empty fields', - backgroundColor: Colors.grey[500]); - } else { - showProgress(context, 'Creating New Event . . .', - isDismissible: false); - await createEvent(); - hideProgress(); - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => const Events()), - (route) => false); - } - }, - child: const Icon( - Icons.check, - color: Colors.white, - ), - ); - } - - Widget inputField(String name, TextEditingController controller) { - return Padding( - padding: const EdgeInsets.all(10), - child: TextField( - maxLines: name == 'Description' ? null : 1, - controller: controller, - decoration: InputDecoration( - errorText: name == 'Title' - ? _validateTitle - ? "Field Can't Be Empty" - : null - : name == 'Description' - ? _validateDescription - ? "Field Can't Be Empty" - : null - : name == 'Location' - ? _validateLocation - ? "Field Can't Be Empty" - : null - : null, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(20.0), - borderSide: const BorderSide(color: Colors.teal)), - hintText: name), - )); - } - - Widget switchTile(String name) { - return SwitchListTile( - activeColor: UIData.secondaryColor, - value: switchVals[name], - contentPadding: const EdgeInsets.symmetric(horizontal: 20), - title: Text( - name, - style: TextStyle(color: Colors.grey[600]), - ), - onChanged: (val) { - setState(() { - switchVals[name] = val; - }); - }); - } - - Widget recurrencedropdown() { - return ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20), - leading: Text( - 'Recurrence', - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - trailing: AbsorbPointer( - absorbing: !switchVals['Recurring'], - child: DropdownButton( - style: TextStyle( - color: switchVals['Recurring'] - ? UIData.secondaryColor - : Colors.grey), - value: recurrance, - icon: const Icon(Icons.arrow_drop_down), - onChanged: (String newValue) { - setState(() { - recurrance = newValue; - }); - }, - items: recurranceList.map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), - ), - ); - } - - _exceptionToast(String msg) { - fToast.showToast( - child: ToastTile( - msg: msg, - success: false, - ), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/events/add_task_dialog.dart b/lib/views/pages/events/add_task_dialog.dart deleted file mode 100644 index 9f74a7ab2..000000000 --- a/lib/views/pages/events/add_task_dialog.dart +++ /dev/null @@ -1,176 +0,0 @@ -//flutter packages are called here -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -//pages are called here -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:intl/intl.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/widgets/toast_tile.dart'; - -// ignore: must_be_immutable -class AddEventTask extends StatefulWidget { - AddEventTask({Key key, @required this.eventId}) : super(key: key); - String eventId; - - @override - _AddEventTaskState createState() => _AddEventTaskState(); -} - -class _AddEventTaskState extends State { - final titleController = TextEditingController(); - final descriptionController = TextEditingController(); - ApiFunctions apiFunctions = ApiFunctions(); - DateTime selectedDate = DateTime.now(); - final _formkey = GlobalKey(); - FToast fToast; - - //function to add the task - Future addTask() async { - final String mutation = Queries().addEventTask( - eventId: widget.eventId, - title: titleController.text, - description: descriptionController.text, - deadline: DateTime.now().millisecondsSinceEpoch.toString()) as String; - - final Map result = await apiFunctions.gqlquery(mutation); - if (result["exception"] != null) { - _exceptionToast("Failed to add task!Try again later"); - } - } - - //function to select the date - Future _selectDate(BuildContext context) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: selectedDate, - firstDate: DateTime.now(), - lastDate: DateTime(2101)); - if (picked != null && picked != selectedDate) { - setState(() { - selectedDate = picked; - }); - } - } - - @override - void initState() { - fToast = FToast(); - fToast.init(context); - super.initState(); - } - - //main build starts here - @override - Widget build(BuildContext context) { - return AlertDialog( - insetPadding: const EdgeInsets.all(0), - title: const Text("Add A Task To This Event"), - // ignore: sized_box_for_whitespace - content: Container( - height: SizeConfig.safeBlockVertical * 37.5, - child: Form( - key: _formkey, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Flexible( - child: inputField('Title', titleController, (value) { - if (titleController.text == "") { - return "This Field is Required"; - } - if (titleController.text.length > 30) { - return "title cannot be longer than 30 letters"; - } - return null; - }, 30), - ), - Flexible( - child: - inputField('Description', descriptionController, (value) { - if (descriptionController.text == "") { - return "This Field is Required"; - } - if (descriptionController.text.length > 10000) { - return "description cannot be longer than 10000 letters"; - } - return null; - }, 10000), - ), - Flexible( - child: dateButton(), - ), - ], - ), - )), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("Cancel"), - ), - TextButton( - onPressed: () async { - if (_formkey.currentState.validate()) { - addTask(); - Navigator.of(context).pop(); - } - }, - child: const Text("Add"), - ), - ], - ); - } - - //widget to use date button - Widget dateButton() { - return ListTile( - onTap: () { - _selectDate(context); - }, - leading: Text( - 'Date', - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - trailing: Text( - DateFormat.yMMMd().format(selectedDate), - style: const TextStyle(fontSize: 16, color: UIData.secondaryColor), - ), - ); - } - - //widget to use input field - Widget inputField(String name, TextEditingController controller, - String Function(String) validate, int maxLength) { - return Padding( - padding: const EdgeInsets.all(10), - child: TextFormField( - key: Key(name), - inputFormatters: [LengthLimitingTextInputFormatter(maxLength)], - validator: validate, - maxLines: name == 'Description' ? null : 1, - controller: controller, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(20.0), - borderSide: const BorderSide(color: Colors.teal)), - hintText: name), - ), - ); - } - - _exceptionToast(String msg) { - fToast.showToast( - child: ToastTile( - msg: msg, - success: false, - ), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/events/edit_event_dialog.dart b/lib/views/pages/events/edit_event_dialog.dart deleted file mode 100644 index 7ce38558c..000000000 --- a/lib/views/pages/events/edit_event_dialog.dart +++ /dev/null @@ -1,382 +0,0 @@ -//flutter packages are called here -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:talawa/services/queries_.dart'; - -//pages are called here -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:intl/intl.dart'; -import 'package:talawa/views/pages/events/events.dart'; -import 'package:talawa/views/widgets/show_progress.dart'; -import 'package:talawa/views/widgets/toast_tile.dart'; - -// ignore: must_be_immutable -class EditEvent extends StatefulWidget { - EditEvent({Key key, @required this.event}) : super(key: key); - Map event; - - @override - _EditEventState createState() => _EditEventState(); -} - -class _EditEventState extends State { - final titleController = TextEditingController(); - final descriptionController = TextEditingController(); - final locationController = TextEditingController(); - bool _validateTitle = false, - _validateDescription = false, - _validateLocation = false; - ApiFunctions apiFunctions = ApiFunctions(); - FToast fToast; - - DateTimeRange dateRange = DateTimeRange( - start: DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day, 1, 0), - end: DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day + 1, 1, 0)); - - Map startEndTimes = { - 'Start Time': DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day, 12, 0), - 'End Time': DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day, 23, 59), - }; - - Map event; - Map switchVals = { - 'Make Public': true, - 'Make Registerable': true, - 'Recurring': true, - 'All Day': false - }; - - var recurranceList = ['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY']; - String recurrance = 'DAILY'; - Preferences preferences = Preferences(); - String currentOrgId; - - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - getCurrentOrgId(); - print(widget.event); - initevent(); - } - - initevent() { - setState(() { - titleController.text = widget.event['title'].toString(); - descriptionController.text = widget.event['description'].toString(); - locationController.text = widget.event['location'].toString(); - switchVals = { - 'Make Public': widget.event['isPublic'] as bool, - 'Make Registerable': widget.event['isRegisterable'] as bool, - 'Recurring': widget.event['recurring'] as bool, - 'All Day': widget.event['allDay'] as bool, - }; - recurrance = widget.event['recurrance'].toString(); - }); - } - - //getting current organization id - getCurrentOrgId() async { - final orgId = await preferences.getCurrentOrgId(); - setState(() { - currentOrgId = orgId; - }); - print(currentOrgId); - } - - //method called to select the date - Future _selectDate(BuildContext context) async { - final DateTime now = DateTime.now(); - final DateTimeRange picked = await showDateRangePicker( - context: context, - // initialDate: selectedDate, - firstDate: DateTime(now.year, now.month, now.day), - lastDate: DateTime(2101)); - if (picked != null && picked != dateRange) { - setState(() { - dateRange = picked; - }); - } - } - - //method to select the time - Future _selectTime( - BuildContext context, String name, TimeOfDay time) async { - final TimeOfDay picked = await showTimePicker( - context: context, - initialTime: time, - ); - if (picked != null && picked != time) { - setState(() { - startEndTimes[name] = DateTime( - DateTime.now().year, - DateTime.now().month, - DateTime.now().day, - picked.hour, - picked.minute); - }); - } - } - - //method used to create and event - Future updateEvent() async { - final DateTime startTime = DateTime( - dateRange.start.year, - dateRange.start.month, - dateRange.start.day, - startEndTimes['Start Time'].hour, - startEndTimes['Start Time'].minute); - final DateTime endTime = DateTime( - dateRange.end.year, - dateRange.end.month, - dateRange.end.day, - startEndTimes['End Time'].hour, - startEndTimes['End Time'].minute); - - if (switchVals['All Day']) { - startEndTimes = { - 'Start Time': DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, 12, 0), - 'End Time': DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, 23, 59), - }; - } - final String mutation = Queries().updateEvent( - eventId: widget.event['_id'], - title: titleController.text, - description: descriptionController.text, - location: locationController.text, - isPublic: switchVals['Make Public'], - isRegisterable: switchVals['Make Registerable'], - recurring: switchVals['Recurring'], - allDay: switchVals['All Day'], - recurrance: recurrance, - startTime: startTime.microsecondsSinceEpoch.toString(), - endTime: endTime.microsecondsSinceEpoch.toString(), - ); - final Map result = await apiFunctions.gqlquery(mutation); - if (result["exception"] != null) { - _exceptionToast("Could not update event! Please try again later"); - } - print('Result is : $result'); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text( - 'Edit Event', - style: TextStyle(color: Colors.white), - ), - ), - body: ListView( - padding: EdgeInsets.only(bottom: SizeConfig.safeBlockVertical * 12.5), - children: [ - inputField('Title', titleController), - inputField('Description', descriptionController), - inputField('Location', locationController), - switchTile('Make Public'), - switchTile('Make Registerable'), - switchTile('Recurring'), - switchTile('All Day'), - recurrencedropdown(), - dateButton(), - timeButton('Start Time', startEndTimes['Start Time']), - timeButton('End Time', startEndTimes['End Time']), - ], - ), - floatingActionButton: addEventFab(), - ); - } - - //widget for the date buttons - Widget dateButton() { - return ListTile( - onTap: () { - _selectDate(context); - }, - leading: Text( - 'Date', - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - trailing: Text( - '${DateFormat.yMMMd().format(dateRange.start)} | ${DateFormat.yMMMd().format(dateRange.end)} ', - style: const TextStyle(fontSize: 16, color: UIData.secondaryColor), - ), - ); - } - - //widget for time buttons - Widget timeButton(String name, DateTime time) { - return AbsorbPointer( - absorbing: switchVals['All Day'], - child: ListTile( - onTap: () { - _selectTime(context, name, TimeOfDay.fromDateTime(time)); - }, - leading: Text( - name, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - trailing: Text( - TimeOfDay.fromDateTime(time).format(context), - style: TextStyle( - color: !switchVals['All Day'] - ? UIData.secondaryColor - : Colors.grey), - ), - )); - } - - //widget for the input field - Widget inputField(String name, TextEditingController controller) { - return Padding( - padding: const EdgeInsets.all(10), - child: TextField( - maxLines: name == 'Description' ? null : 1, - controller: controller, - keyboardType: TextInputType.text, - decoration: InputDecoration( - errorText: name == 'Title' - ? _validateTitle - ? "Field Can't Be Empty" - : null - : name == 'Description' - ? _validateDescription - ? "Field Can't Be Empty" - : null - : name == 'Location' - ? _validateLocation - ? "Field Can't Be Empty" - : null - : null, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(20.0), - borderSide: const BorderSide(color: Colors.teal)), - hintText: name), - )); - } - - Widget switchTile(String name) { - return SwitchListTile( - activeColor: UIData.secondaryColor, - value: switchVals[name], - contentPadding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 5), - title: Text( - name, - style: TextStyle(color: Colors.grey[600]), - ), - onChanged: (val) { - setState(() { - switchVals[name] = val; - }); - }); - } - - Widget recurrencedropdown() { - return ListTile( - contentPadding: - EdgeInsets.symmetric(horizontal: SizeConfig.safeBlockHorizontal * 5), - leading: Text( - 'Recurrence', - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - trailing: AbsorbPointer( - absorbing: !switchVals['Recurring'], - child: DropdownButton( - style: TextStyle( - color: switchVals['Recurring'] - ? UIData.secondaryColor - : Colors.grey), - value: recurrance, - icon: const Icon(Icons.arrow_drop_down), - onChanged: (String newValue) { - setState(() { - recurrance = newValue; - }); - }, - items: recurranceList.map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), - ), - ); - } - - //widget to add the event - Widget addEventFab() { - return FloatingActionButton( - backgroundColor: UIData.secondaryColor, - onPressed: () async { - if (titleController.text.isEmpty || - descriptionController.text.isEmpty || - locationController.text.isEmpty) { - if (titleController.text.isEmpty) { - setState(() { - _validateTitle = true; - }); - } - if (descriptionController.text.isEmpty) { - setState(() { - _validateDescription = true; - }); - } - if (locationController.text.isEmpty) { - setState(() { - _validateLocation = true; - }); - } - Fluttertoast.showToast( - msg: 'Fill in the empty fields', - backgroundColor: Colors.grey[500]); - } else { - try { - showProgress(context, 'Updating Event Details . . .', - isDismissible: false); - await updateEvent(); - } catch (e) { - if (e == "User cannot delete event they didn't create") { - Fluttertoast.showToast( - msg: "You can't edit events you didn't create", - backgroundColor: Colors.grey[500]); - } - } - hideProgress(); - print('EDITING DONE'); - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => const Events()), - (route) => false); - } - }, - child: const Icon( - Icons.check, - color: Colors.white, - ), - ); - } - - _exceptionToast(String msg) { - fToast.showToast( - child: ToastTile( - msg: msg, - success: false, - ), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/events/event_detail_page.dart b/lib/views/pages/events/event_detail_page.dart deleted file mode 100644 index f7a9b025b..000000000 --- a/lib/views/pages/events/event_detail_page.dart +++ /dev/null @@ -1,145 +0,0 @@ -//flutter packages are called here -import 'package:flutter/material.dart'; -import 'package:flutter_sticky_header/flutter_sticky_header.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -//pages are imported here -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/events/registrant_list.dart'; -import 'package:talawa/views/pages/events/task_list.dart'; -import 'package:intl/intl.dart'; - -// ignore: must_be_immutable -class EventDetail extends StatefulWidget { - EventDetail({Key key, @required this.event}) : super(key: key); - Map event; - - @override - _EventDetailState createState() => _EventDetailState(); -} - -class _EventDetailState extends State - with SingleTickerProviderStateMixin { - TabController _tabController; - - @override - void initState() { - super.initState(); - _tabController = TabController(vsync: this, length: 2); - } - - @override - Widget build(BuildContext context) { - final double width = MediaQuery.of(context).size.width; - print(widget.event); - return Scaffold( - appBar: AppBar( - title: Text( - widget.event['title'].toString(), - style: const TextStyle(color: Colors.white), - overflow: TextOverflow.ellipsis, - ), - ), - body: CustomScrollView( - slivers: [ - SliverAppBar( - automaticallyImplyLeading: false, - expandedHeight: SizeConfig.safeBlockVertical * 40, - flexibleSpace: FlexibleSpaceBar( - background: FittedBox( - fit: BoxFit.contain, - child: Container( - height: SizeConfig.safeBlockVertical * 40, - width: width, - color: UIData.primaryColor, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - displayText( - "To Do: ${widget.event['description'].toString()}", - ), - displayText( - "Held: ${widget.event['recurrance'][0]}${widget.event['recurrance'].substring(1).toLowerCase()}", - ), - displayText( - "Next: ${DateFormat.yMMMd('en_US').format(DateTime.fromMicrosecondsSinceEpoch(int.parse(widget.event['startTime'].toString()))).toString()}", - ), - displayText( - "Where: ${widget.event['location'].toString()}", - ), - displayText( - "From: ${'${DateFormat.jm('en_US').format(DateTime.fromMicrosecondsSinceEpoch(int.parse(widget.event['startTime'].toString())))} to ${DateFormat.jm('en_US').format(DateTime.fromMicrosecondsSinceEpoch(int.parse(widget.event['endTime'].toString())))}'}", - ), - ], - ), - ), - ), - ), - ), - SliverStickyHeader( - header: Container( - height: SizeConfig.safeBlockVertical * 7.5, - decoration: - BoxDecoration(color: Theme.of(context).primaryColor), - child: Material( - color: UIData.secondaryColor, - child: TabBar( - labelPadding: const EdgeInsets.all(0), - indicatorColor: Colors.white, - controller: _tabController, - tabs: const [ - Tab( - icon: Text( - 'Tasks', - style: TextStyle( - color: Colors.white, - ), - ), - ), - Tab( - icon: Text( - 'Registrants', - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - )), - sliver: SliverFillRemaining( - child: Container( - child: TabBarView( - controller: _tabController, - children: [ - TaskList( - event: widget.event, - ), - RegList( - event: widget.event, - ), - ], - ), - ), - ), - ), - ], - ), - ); - } - - Widget displayText(String text) { - return Container( - decoration: const BoxDecoration( - color: Colors.black26, - borderRadius: BorderRadius.all(Radius.circular(5))), - margin: const EdgeInsets.all(8), - padding: const EdgeInsets.all(8), - height: SizeConfig.safeBlockVertical * 5.5, - child: Text( - text, - style: TextStyle( - fontSize: SizeConfig.safeBlockVertical * 2.5, color: Colors.white), - overflow: TextOverflow.ellipsis, - ), - ); - } -} diff --git a/lib/views/pages/events/events.dart b/lib/views/pages/events/events.dart deleted file mode 100644 index b2ed4fbc7..000000000 --- a/lib/views/pages/events/events.dart +++ /dev/null @@ -1,640 +0,0 @@ -//flutter packages are called here -import 'package:flutter/material.dart'; -import 'package:flutter_sticky_header/flutter_sticky_header.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -//pages are imported here -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/timer.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/events/event_detail_page.dart'; -import 'package:talawa/views/pages/events/add_event_page.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:talawa/views/pages/events/add_task_dialog.dart'; -import 'package:talawa/views/pages/events/edit_event_dialog.dart'; -import 'package:talawa/views/widgets/loading.dart'; -import 'package:talawa/views/widgets/show_progress.dart'; - -//pubspec packages are called here -import 'package:timeline_list/timeline.dart'; -import 'package:timeline_list/timeline_model.dart'; -import 'package:table_calendar/table_calendar.dart'; -import 'package:carousel_slider/carousel_slider.dart'; - -class Events extends StatefulWidget { - const Events({Key key}) : super(key: key); - - @override - _EventsState createState() => _EventsState(); -} - -class _EventsState extends State { - List eventList = []; - List displayedEvents = []; - List currentFilterEvents = []; - List eventsToDate = []; - List myEvents = []; - String dateSelected = 'Today'; - Preferences preferences = Preferences(); - ApiFunctions apiFunctions = ApiFunctions(); - StickyHeaderController stickyHeaderController = StickyHeaderController(); - final CalendarController _calendarController = CalendarController(); - CarouselController carouselController = CarouselController(); - String notFetched = 'No Events Created'; - bool fetched = true; - Future events; - Timer timer = Timer(); - String userId; - - FToast fToast; - - //variable for organization Id - String _currOrgId; - - @override - void initState() { - super.initState(); - setState(() { - events = getEvents(); - }); - } - - //get all events for a given day - //account for recurring events - List filterEventsByDay(DateTime currentDate, List events) { - final List currentevents = []; - - for (final event in events) { - final DateTime startTime = DateTime.fromMicrosecondsSinceEpoch( - int.parse(event['startTime'].toString())); - if (!(event['recurring'] as bool) && - timer.isSameDay(currentDate, startTime)) { - currentevents.add(event); - } - if (event['recurrance'] == 'DAILY') { - currentevents.add(event); - } else if (event['recurrance'] == 'WEEKLY' && - timer.isSameWeekDay(currentDate, startTime)) { - currentevents.add(event); - } else if (event['recurrance'] == 'MONTHLY' && - currentDate.day == startTime.day) { - currentevents.add(event); - } else if (event['recurrance'] == 'YEARLY' && - currentDate.month == startTime.month && - currentDate.day == startTime.day) { - currentevents.add(event); - } - } - return currentevents; - } - - //return events in calendar display format ''Map>'' - //account for recurring events - Map eventsToDates(List events, DateTime now) { - final Map> eventDates = {}; - addDateToMap(DateTime date, Map event) { - if (eventDates[date] == null) { - eventDates[date] = [event]; - } else { - eventDates[date].add(event); - } - } - - for (final event in events) { - if (!(event['recurring'] as bool)) { - addDateToMap( - DateTime.fromMicrosecondsSinceEpoch( - int.parse(event['startTime'].toString())), - event as Map); - } else { - if (event['recurrance'] == 'DAILY') { - int day = DateTime.fromMicrosecondsSinceEpoch( - int.parse(event['startTime'].toString())) - .day; - final int lastday = DateTime.fromMicrosecondsSinceEpoch( - int.parse(event['endTime'].toString())) - .day; - while (day <= lastday) { - addDateToMap(DateTime(now.year, now.month, day), event as Map); - day += 1; - } - } - if (event['recurrance'] == 'WEEKLY') { - int day = DateTime.fromMicrosecondsSinceEpoch( - int.parse(event['startTime'].toString())) - .day; - final int lastday = DateTime.fromMicrosecondsSinceEpoch( - int.parse(event['endTime'].toString())) - .day; - while (day <= lastday) { - addDateToMap(DateTime(now.year, now.month, day), event as Map); - - day += 7; - } - } - if (event['recurrance'] == 'MONTHLY') { - final DateTime firstDate = DateTime.fromMicrosecondsSinceEpoch( - int.parse(event['startTime'].toString())); - addDateToMap( - DateTime(now.year, now.month, firstDate.day), event as Map); - } - if (event['recurrance'] == 'YEARLY') { - final DateTime firstDate = DateTime.fromMicrosecondsSinceEpoch( - int.parse(event['startTime'].toString())); - if (now.month == firstDate.month) { - addDateToMap( - DateTime(now.year, now.month, firstDate.day), event as Map); - } - } - } - } - return eventDates; - } - - //function called to delete the event - Future _deleteEvent(BuildContext context, String eventId) async { - showProgress(context, 'Deleting Event . . .', isDismissible: false); - final String mutation = Queries().deleteEvent(eventId); - final Map result = await apiFunctions.gqlquery(mutation); - if (result["exception"] != null) { - _exceptionToast("Could not delete event! Please try again later"); - } - await getEvents(); - hideProgress(); - } - - //function to called be called for register - Future _register(BuildContext context, String eventId) async { - final Map result = await Queries().registerForEvent(eventId) as Map; - print(result); - } - - //function to get the events - Future getEvents() async { - final String currentOrgID = await preferences.getCurrentOrgId(); - _currOrgId = currentOrgID; - final Map result = - await apiFunctions.gqlquery(Queries().fetchOrgEvents(currentOrgID)); - eventList = - result == null ? [] : (result['events'] as List).reversed.toList(); - eventList.removeWhere((element) => - element['title'] == 'Talawa Congress' || - element['title'] == 'test' || - element['title'] == 'Talawa Conference Test' || - element['title'] == 'mayhem' || - element['title'] == 'mayhem1' || - element['organization']['_id'] != - currentOrgID); //dont know who keeps adding these - // This removes all invalid date formats other than Unix time - eventList.removeWhere( - (element) => int.tryParse(element['startTime'] as String) == null); - eventList.sort((a, b) { - return DateTime.fromMicrosecondsSinceEpoch( - int.parse(a['startTime'] as String)) - .compareTo(DateTime.fromMicrosecondsSinceEpoch( - int.parse(b['startTime'] as String))); - }); - eventsToDates(eventList, DateTime.now()); - setState(() { - displayedEvents = eventList; - }); - userId = await preferences.getUserId(); - } - - //functions to edit the event - Future _editEvent(BuildContext context, Map event) async { - if (event['creator']['_id'] != userId) { - Fluttertoast.showToast(msg: "You cannot edit events you didn't create"); - } else { - pushNewScreen(context, - withNavBar: true, - screen: EditEvent( - event: event, - )); - } - } - - Future addEventTask(BuildContext context, String eventId) async { - showDialog( - context: context, - builder: (BuildContext context) { - return AddEventTask( - eventId: eventId, - ); - }, - ); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - key: const Key('EVENTS_APP_BAR'), - title: const Text( - 'Events', - style: TextStyle(color: Colors.white), - ), - ), - floatingActionButton: eventFab(), - body: FutureBuilder( - future: events, - // ignore: missing_return - builder: (context, snapshot) { - final state = snapshot.connectionState; - if (state == ConnectionState.done) { - if (eventList.isEmpty) { - return RefreshIndicator( - onRefresh: () async { - try { - await getEvents(); - } catch (e) { - _exceptionToast(e.toString()); - } - }, - child: CustomScrollView( - slivers: [ - SliverAppBar( - backgroundColor: Colors.white, - automaticallyImplyLeading: false, - expandedHeight: SizeConfig.safeBlockVertical * 47.5, - flexibleSpace: FlexibleSpaceBar( - background: calendar(), - )), - SliverStickyHeader( - header: carouselSliderBar(), - sliver: const SliverFillRemaining( - child: Center( - child: Text( - 'No Event Created', - style: TextStyle( - fontSize: 15.0, - ), - ), - )), - ), - ], - )); - } else { - return RefreshIndicator( - onRefresh: () async { - try { - await getEvents(); - } catch (e) { - _exceptionToast(e.toString()); - } - }, - child: Container( - color: Colors.white, - child: Stack( - children: [ - Positioned.fill( - top: 0, - left: 0, - right: 0, - child: calendar(), - ), - DraggableScrollableSheet( - initialChildSize: 0.3, - minChildSize: 0.3, - maxChildSize: 1.0, - expand: true, - builder: - (BuildContext context, myscrollController) { - return Container( - color: Colors.white, - child: Column( - children: [ - ListView( - controller: myscrollController, - shrinkWrap: true, - children: [carouselSliderBar()], - ), - Expanded( - child: Timeline.builder( - controller: myscrollController, - lineColor: UIData.primaryColor, - position: TimelinePosition.Left, - itemCount: displayedEvents.length, - itemBuilder: (context, index) { - if (index == 0) { - return TimelineModel( - Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - padding: EdgeInsets.symmetric( - vertical: SizeConfig - .safeBlockVertical * - 0.625), - child: Text( - '${displayedEvents.length} Events', - style: const TextStyle( - color: - Colors.black45), - ), - ), - eventCard(index) - ], - ), - iconBackground: - UIData.secondaryColor, - ); - } - return TimelineModel( - eventCard(index), - iconBackground: - UIData.secondaryColor, - position: - TimelineItemPosition.right, - ); - }, - ), - ), - ], - ), - ); - }, - ), - ], - ), - )); - } - } else if (state == ConnectionState.waiting) { - print(snapshot.data); - return Center( - child: Loading( - key: UniqueKey(), - )); - } else if (state == ConnectionState.none) { - return const Text('Could Not Fetch Data.'); - } - }, - )); - } - - Widget calendar() { - DateTime now = DateTime.now(); - Map thisMonthsEvents = eventsToDates(eventList, now); - return ListView(children: [ - TableCalendar( - onVisibleDaysChanged: (m, n, b) { - now = now.add(const Duration(days: 22)); - setState(() { - thisMonthsEvents = eventsToDates(eventList, now); - }); - }, - calendarStyle: const CalendarStyle(markersColor: Colors.black45), - /*onDaySelected: (day, events) { - String carouselDay = DateFormat.yMMMd('en_US').format(day); - if (timer.isSameDay(day, now)) { - carouselDay = 'Today'; - } - carouselController.animateToPage(1); - setState(() { - _calendarController.setSelectedDay(day); - dateSelected = carouselDay; - }); - List currentevents = filterEventsByDay(day, events); - setState(() { - currentFilterEvents = currentevents; - displayedEvents = currentevents; - }); - },*/ - events: thisMonthsEvents as Map>, - calendarController: _calendarController, - ), - ]); - } - - Widget carouselSliderBar() { - return Container( - padding: EdgeInsets.all(SizeConfig.safeBlockHorizontal * 2.5), - alignment: Alignment.centerLeft, - color: UIData.secondaryColor, - height: SizeConfig.safeBlockVertical * 6, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - IconButton( - padding: const EdgeInsets.all(0), - onPressed: () { - carouselController.previousPage(); - }, - icon: const Icon( - Icons.arrow_left, - color: Colors.white, - )), - SizedBox( - width: SizeConfig.safeBlockHorizontal * 57.5, - child: CarouselSlider( - carouselController: carouselController, - items: [ - const Text( - 'All', - style: TextStyle(color: Colors.white, fontSize: 16), - ), - Text( - dateSelected, - style: const TextStyle(color: Colors.white, fontSize: 16), - ), - ], - options: CarouselOptions( - onPageChanged: (item, reason) { - currentFilterEvents = filterEventsByDay( - _calendarController.selectedDay, eventList); - if (item == 0) { - setState(() { - displayedEvents = eventList; - }); - } else if (item == 1) { - setState(() { - displayedEvents = currentFilterEvents; - }); - } - }, - height: SizeConfig.safeBlockVertical * 5, - ), - ), - ), - IconButton( - padding: const EdgeInsets.all(0), - onPressed: () { - carouselController.nextPage(); - }, - icon: const Icon( - Icons.arrow_right, - color: Colors.white, - )), - ], - )); - } - - Widget menueText(String text) { - return ListTile( - title: Text( - text, - style: TextStyle(color: Colors.grey[700]), - )); - } - - Widget eventCard(int index) { - return Container( - child: Column( - children: [ - ExpansionTile( - title: Text( - displayedEvents[index]['title'].toString(), - style: const TextStyle( - color: Colors.black87, - fontSize: 16, - ), - ), - subtitle: Text( - displayedEvents[index]['description'].toString(), - style: const TextStyle(color: Colors.black54), - ), - trailing: popUpMenue(displayedEvents[index]), - children: [ - displayedEvents[index]['isPublic'] as bool - ? menueText('This event is Public') - : menueText('This event is Private'), - displayedEvents[index]['isRegistered'] as bool - ? menueText('You Are Registered') - : menueText('You Are Not Registered'), - // menueText('Starts: ' + - // DateFormat.jm('en_US') - // .format(DateTime.fromMicrosecondsSinceEpoch( - // int.parse(displayedEvents[index]['startTime']))) - // .toString()), - ListTile( - trailing: ElevatedButton( - style: ButtonStyle( - backgroundColor: - MaterialStateProperty.all(UIData.secondaryColor), - shape: MaterialStateProperty.all( - const StadiumBorder()), - ), - onPressed: () { - pushNewScreen( - context, - withNavBar: true, - screen: EventDetail(event: displayedEvents[index] as Map), - ); - }, - child: const Text( - "More", - style: TextStyle(color: Colors.white), - ), - ), - ), - ], - ), - // ), - const Divider( - height: 0, - thickness: 1, - ) - ], - ), - ); - } - - Widget popUpMenue(event) { - return PopupMenuButton( - onSelected: (val) async { - if (val == 1) { - return _register(context, event['_id'].toString()); - } else if (val == 2) { - return addEventTask(context, event['_id'].toString()); - } else if (val == 3) { - return _editEvent(context, event as Map); - } else if (val == 4) { - return _deleteEvent(context, event['_id'].toString()); - } - }, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 1, - child: ListTile( - leading: Icon(Icons.playlist_add_check, color: Colors.grey), - title: Text( - 'Register For Event', - style: TextStyle(color: Colors.black), - ), - )), - const PopupMenuItem( - value: 2, - child: ListTile( - leading: Icon(Icons.note_add, color: Colors.grey), - title: Text( - 'Add a Task to this Event', - style: TextStyle(color: Colors.black), - ), - )), - const PopupMenuItem( - value: 3, - child: ListTile( - leading: Icon(Icons.edit, color: Colors.grey), - title: Text( - 'Edit this event', - style: TextStyle(color: Colors.black), - ), - )), - const PopupMenuItem( - value: 4, - child: ListTile( - leading: Icon(Icons.delete, color: Colors.grey), - title: Text( - 'Delete This Event', - style: TextStyle(color: Colors.black), - ), - )) - ], - ); - } - - Widget eventFab() { - return FloatingActionButton( - backgroundColor: UIData.secondaryColor, - onPressed: () { - pushNewScreen( - context, - withNavBar: true, - screen: const AddEvent(), - ); - }, - child: const Icon( - Icons.add, - color: Colors.white, - ), - ); - } - - //function to show exceptions - _exceptionToast(String msg) { - final Widget toast = Container( - padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 14.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 1), - ); - } -} diff --git a/lib/views/pages/events/registrant_list.dart b/lib/views/pages/events/registrant_list.dart deleted file mode 100644 index 84f5c40cd..000000000 --- a/lib/views/pages/events/registrant_list.dart +++ /dev/null @@ -1,81 +0,0 @@ -//flutter packages are called here -import 'package:flutter/material.dart'; - -//imported the pages here -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/api_functions.dart'; - -class RegList extends StatefulWidget { - const RegList({ - Key key, - @required this.event, - }) : super(key: key); - - final Map event; - - @override - _RegListState createState() => _RegListState(); -} - -class _RegListState extends State { - Preferences preferences = Preferences(); - - ApiFunctions apiFunctions = ApiFunctions(); - List eventTasks; - - @override - void initState() { - super.initState(); - getRegistrants(); - } - - //method to get the list of registrants - Future> getRegistrants() async { - final String userID = widget.event['_id'].toString(); - final Map result = - await apiFunctions.gqlquery(Queries().getRegistrantsByEvent(userID)); - //setState(() { - - // }); - // ignore: join_return_with_assignment - eventTasks = result == null ? [] : result['registrantsByEvent'] as List; - return eventTasks; - } - - @override - Widget build(BuildContext context) { - final task = getRegistrants(); - return Container( - child: FutureBuilder>( - future: task, - builder: (context, snapshot) { - if (snapshot.connectionState != ConnectionState.done) { - return const Center(child: CircularProgressIndicator()); - } else if (snapshot.data.isEmpty) { - return Container( - child: const Center( - child: Text( - "No Registrants found", - style: TextStyle(fontSize: 20), - textAlign: TextAlign.center, - )), - ); - } else { - return SingleChildScrollView( - child: ListView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: snapshot.data.length, - itemBuilder: (context, index) { - return ListTile( - leading: - Text(snapshot.data[index]['firstName'].toString()), - ); - }), - ); - } - }), - ); - } -} diff --git a/lib/views/pages/events/task_list.dart b/lib/views/pages/events/task_list.dart deleted file mode 100644 index 9dd500153..000000000 --- a/lib/views/pages/events/task_list.dart +++ /dev/null @@ -1,83 +0,0 @@ -//flutter packages are imported here -import 'package:flutter/material.dart'; - -//pages are imported here -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/api_functions.dart'; - -class TaskList extends StatefulWidget { - const TaskList({ - Key key, - @required this.event, - }) : super(key: key); - - final Map event; - - @override - _TaskListState createState() => _TaskListState(); -} - -class _TaskListState extends State { - Preferences preferences = Preferences(); - - ApiFunctions apiFunctions = ApiFunctions(); - List eventTasks; - - @override - void initState() { - super.initState(); - getTasks(); - } - - //function to get the task list - Future> getTasks() async { - final String userID = widget.event['_id'].toString(); - print("ishan"); - - final Map result = - await apiFunctions.gqlquery(Queries().getTasksByEvent(userID)); - //setState(() { - - //}); - eventTasks = result == null ? [] : result['tasksByEvent'] as List; - return eventTasks; - } - - @override - Widget build(BuildContext context) { - final task = getTasks(); - return Container( - child: FutureBuilder>( - future: task, - builder: (context, snapshot) { - if (snapshot.connectionState != ConnectionState.done) { - return const Center( - child: CircularProgressIndicator(), - ); - } else if (snapshot.data.isEmpty) { - return Container( - child: const Center( - child: Text( - "No Tasks found", - style: TextStyle(fontSize: 20), - textAlign: TextAlign.center, - )), - ); - } else { - return SingleChildScrollView( - child: ListView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: snapshot.data.length, - itemBuilder: (context, index) { - return ListTile( - leading: Text(snapshot.data[index]['title'].toString()), - ); - }), - ); - } - }), - ); - } -} diff --git a/lib/views/pages/home_page.dart b/lib/views/pages/home_page.dart deleted file mode 100644 index f43b6e3bf..000000000 --- a/lib/views/pages/home_page.dart +++ /dev/null @@ -1,162 +0,0 @@ -//imported flutter packages -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -//importing the pages here -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/post_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/newsfeed/newsfeed.dart'; -import 'package:talawa/views/pages/members/members.dart'; - -import 'package:talawa/views/pages/events/events.dart'; -import 'package:talawa/views/pages/chat/groups.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'organization/profile_page.dart'; - -class HomePage extends StatefulWidget { - const HomePage({this.openPageIndex = 0}); - final int openPageIndex; - @override - _HomePageState createState() => _HomePageState(); -} - -class _HomePageState extends State { - @override - void setState(fn) { - if (mounted) { - super.setState(fn); - } - } - - int currentIndex = 0; - - PersistentTabController _controller; - Preferences preferences = Preferences(); - - @override - void initState() { - super.initState(); - currentIndex = widget.openPageIndex; - _controller = PersistentTabController(initialIndex: currentIndex); - } - - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - Future getUserInfo() async { - final String userID = await preferences - .getUserId(); //getting the current user id from the server - final String mutation = Queries().fetchUserInfo2( - userID); //getting some more user information with the ID - final ApiFunctions apiFunctions = ApiFunctions(); - await apiFunctions.gqlmutation(mutation); - } - - List _buildScreens() { - //here we are building the screens that are mention in the app bar - return [ - NewsFeed(), //first page of the news feed - const Groups(), //second page of the Group chatting event - const Events(), //Third page of creating the events and viewing it - const Organizations(), //fourth page of seeing the organization - const ProfilePage(), //last page of the profile - ]; - } - - List _navBarsItems() { - return [ - PersistentBottomNavBarItem( - //mentioning the screen home in the bottom bar - icon: const Icon(Icons.home), - title: "Home", - activeColorPrimary: Colors.white, - inactiveColorPrimary: Colors.white, - ), - PersistentBottomNavBarItem( - //mentioning the screen chats in the bottom bar - icon: const Icon(Icons.chat), - title: "Chats", - activeColorPrimary: Colors.white, - inactiveColorPrimary: Colors.white, - ), - PersistentBottomNavBarItem( - //mentioning the Events home in the bottom bar - icon: const Icon(Icons.calendar_today), - title: "Events", - activeColorPrimary: Colors.white, - inactiveColorPrimary: Colors.white, - ), - PersistentBottomNavBarItem( - //mentioning the screen home in the bottom bar - icon: const Icon(Icons.group), - title: "Members", - activeColorPrimary: Colors.white, - inactiveColorPrimary: Colors.white, - ), - PersistentBottomNavBarItem( - //mentioning the screen Profile in the bottom bar - icon: const Icon(Icons.folder), - title: "Profile", - activeColorPrimary: Colors.white, - inactiveColorPrimary: Colors.white, - ), - ]; - } - - void onTabTapped(int index) { - //this function tells us what should be done if the particular tab is clicked - setState(() { - currentIndex = index; - }); - } - - @override - Widget build(BuildContext context) { - SizeConfig().init(context); - return MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ChangeNotifierProvider( - create: (_) => PostController(), - ), - ], - child: Builder(builder: (BuildContext context) { - final BuildContext rootContext = context; - Provider.of(rootContext, listen: false) - .getOrgUrl(); - Provider.of(rootContext, listen: false).getCurrentOrgId(); - return PersistentTabView(rootContext, - backgroundColor: UIData.primaryColor, - controller: _controller, - items: _navBarsItems(), - screens: _buildScreens(), - confineInSafeArea: true, - handleAndroidBackButtonPress: true, - navBarStyle: NavBarStyle.style4, - itemAnimationProperties: const ItemAnimationProperties( - duration: Duration(milliseconds: 200), - curve: Curves.ease, - ), - screenTransitionAnimation: const ScreenTransitionAnimation( - animateTabTransition: true, - curve: Curves.ease, - duration: Duration(milliseconds: 200), - )); - }), - ); - } -} diff --git a/lib/views/pages/login_signup/login_form.dart b/lib/views/pages/login_signup/login_form.dart deleted file mode 100644 index b8a336ff3..000000000 --- a/lib/views/pages/login_signup/login_form.dart +++ /dev/null @@ -1,317 +0,0 @@ -//flutter packages are called here -import 'package:data_connection_checker/data_connection_checker.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -//pages are called here -import 'package:provider/provider.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/utils/validator.dart'; -import 'package:talawa/view_models/vm_login.dart'; -import 'package:talawa/model/token.dart'; -import 'package:talawa/views/pages/home_page.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -import '../_pages.dart'; - -class LoginForm extends StatefulWidget { - @override - LoginFormState createState() { - return LoginFormState(); - } -} - -class LoginFormState extends State { - final TextEditingController _emailController = TextEditingController(); - final TextEditingController _passwordController = TextEditingController(); - - final _formKey = GlobalKey(); - LoginViewModel model = LoginViewModel(); - bool _progressBarState = false; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final Queries _query = Queries(); - FToast fToast; - final Preferences _pref = Preferences(); - static String orgURI; - bool _obscureText = true; - - void toggleProgressBarState() { - _progressBarState = !_progressBarState; - } - - //providing variables with initial states - @override - void initState() { - super.initState(); - Provider.of(context, listen: false).getOrgUrl(); - fToast = FToast(); - fToast.init(context); - } - - //function for login user which gets called when sign in is press - Future loginUser() async { - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(_query.loginUser(model.email, model.password)))); - final bool connectionCheck = await DataConnectionChecker().hasConnection; - if (!connectionCheck) { - print('You are not connected to the internet'); - setState(() { - _progressBarState = false; - }); - _exceptionToast( - 'Connection Error. Make sure your Internet connection is stable'); - } else if (result.hasException) { - print(result.exception); - setState(() { - _progressBarState = false; - }); - - _exceptionToast(result.exception.toString().substring(16, 35)); - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = true; - }); - _successToast("All Set!"); - final Token accessToken = - Token(tokenString: result.data['login']['accessToken'].toString()); - await _pref.saveToken(accessToken); - final Token refreshToken = - Token(tokenString: result.data['login']['refreshToken'].toString()); - await _pref.saveRefreshToken(refreshToken); - final String currentUserId = - result.data['login']['user']['_id'].toString(); - await _pref.saveUserId(currentUserId); - final String userFName = - result.data['login']['user']['firstName'].toString(); - await _pref.saveUserFName(userFName); - final String userLName = - result.data['login']['user']['lastName'].toString(); - await _pref.saveUserLName(userLName); - - final List organisations = - result.data['login']['user']['joinedOrganizations'] as List; - if (organisations.isEmpty) { - //skip the steps below - } else { - //execute the steps below - final String currentOrgId = result.data['login']['user'] - ['joinedOrganizations'][0]['_id'] - .toString(); - await _pref.saveCurrentOrgId(currentOrgId); - - final String currentOrgImgSrc = result.data['login']['user'] - ['joinedOrganizations'][0]['image'] - .toString(); - await _pref.saveCurrentOrgImgSrc(currentOrgImgSrc); - - final String currentOrgName = result.data['login']['user'] - ['joinedOrganizations'][0]['name'] - .toString(); - await _pref.saveCurrentOrgName(currentOrgName); - } - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute( - builder: (context) => const HomePage( - openPageIndex: 0, - )), - (route) => false); - } - } - - //main build starts here - @override - Widget build(BuildContext context) { - return Form( - key: _formKey, - child: Column( - children: [ - const Text('Login', - style: TextStyle(fontSize: 35, color: Colors.white)), - SizedBox( - height: SizeConfig.safeBlockVertical * 6.25, - ), - AutofillGroup( - child: Column( - children: [ - TextFormField( - autofillHints: const [AutofillHints.email], - keyboardType: TextInputType.emailAddress, - textAlign: TextAlign.left, - controller: _emailController, - validator: Validator.validateEmail, - style: const TextStyle(color: Colors.white), - //Changed text input action to next - textInputAction: TextInputAction.next, - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(20.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.orange), - borderRadius: BorderRadius.circular(20.0), - ), - prefixIcon: const Icon( - Icons.email, - color: Colors.white, - ), - labelText: "Email", - labelStyle: const TextStyle(color: Colors.white), - alignLabelWithHint: true, - hintText: 'foo@bar.com', - hintStyle: const TextStyle(color: Colors.grey), - ), - onSaved: (value) { - model.email = value; - }, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - TextFormField( - autofillHints: const [AutofillHints.password], - obscureText: _obscureText, - textAlign: TextAlign.left, - controller: _passwordController, - validator: Validator.validatePassword, - style: const TextStyle(color: Colors.white), - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(20.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.orange), - borderRadius: BorderRadius.circular(20.0), - ), - prefixIcon: const Icon( - Icons.lock, - color: Colors.white, - ), - suffixIcon: TextButton( - onPressed: _toggle, - child: Icon( - _obscureText ? Icons.visibility_off : Icons.visibility, - color: Colors.white, - ), - ), - labelText: "Password", - labelStyle: const TextStyle(color: Colors.white), - focusColor: UIData.primaryColor, - alignLabelWithHint: true, - hintText: '**********', - hintStyle: const TextStyle(color: Colors.grey), - ), - onSaved: (value) { - model.password = value; - }, - ), - ], - )), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - Container( - padding: EdgeInsets.symmetric( - vertical: SizeConfig.safeBlockVertical * 2.5, - horizontal: SizeConfig.safeBlockHorizontal * 7.25), - width: double.infinity, - child: ElevatedButton( - style: ButtonStyle( - padding: MaterialStateProperty.all( - const EdgeInsets.all(12.0)), - shape: MaterialStateProperty.all( - const StadiumBorder()), - backgroundColor: - MaterialStateProperty.all(Colors.white), - ), - onPressed: () async { - FocusScope.of(context).unfocus(); - //checks to see if all the fields have been validated then authenticate a user - if (_formKey.currentState.validate()) { - _formKey.currentState.save(); - loginUser(); - setState(() { - toggleProgressBarState(); - }); - } - }, - child: _progressBarState - ? const CircularProgressIndicator() - : const Text( - "SIGN IN", - ), - ), - ), - ], - )); - } - - //the method called when the result is success - _successToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 5, - vertical: SizeConfig.safeBlockVertical * 1.5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.green, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Center(child: Text(msg)), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } - - //the method called when the result is an exception - _exceptionToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 6, - vertical: SizeConfig.safeBlockVertical * 1.75), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - msg, - textAlign: TextAlign.center, - )), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 5), - ); - } - - //function toggles _obscureText value - void _toggle() { - setState(() { - _obscureText = !_obscureText; - }); - } -} diff --git a/lib/views/pages/login_signup/login_page.dart b/lib/views/pages/login_signup/login_page.dart deleted file mode 100644 index 5e88553ae..000000000 --- a/lib/views/pages/login_signup/login_page.dart +++ /dev/null @@ -1,94 +0,0 @@ -//flutter packages are called here -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/login_signup/login_form.dart'; -import 'package:talawa/views/pages/login_signup/register_page.dart'; - -class LoginPage extends StatefulWidget { - @override - _LoginScreenState createState() => _LoginScreenState(); -} - -class _LoginScreenState extends State with TickerProviderStateMixin { - final GlobalKey _scaffoldkey = GlobalKey(); - //providing the initial states to the variables - @override - void initState() { - super.initState(); - } - - @override - dispose() { - super.dispose(); - } - - Widget loginScreenForm() => Center( - child: Container( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Container( - constraints: BoxConstraints( - maxWidth: SizeConfig.safeBlockHorizontal * 75, - minWidth: SizeConfig.safeBlockHorizontal * 62.5, - minHeight: SizeConfig.safeBlockVertical * 37.5), - child: SingleChildScrollView( - padding: - EdgeInsets.only(bottom: SizeConfig.safeBlockVertical * 7.5), - scrollDirection: Axis.vertical, - child: Column( - children: [ - LoginForm(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - "Dont have an account?", - style: TextStyle( - color: Colors.white, - ), - ), - Container( - margin: const EdgeInsets.only(left: 8.0), - child: GestureDetector( - onTap: () { - // Navigator.pop(context); - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => RegisterPage())); - }, - child: const Text( - "SIGN UP!", - textAlign: TextAlign.start, - style: TextStyle(color: UIData.primaryColor), - ), - ), - ), - ], - ) - ], - ), - )), - ), - ); - //main build starts here - @override - build(BuildContext context) { - return Scaffold( - //resizeToAvoidBottomInset: false, - key: _scaffoldkey, - backgroundColor: Colors.white, - body: Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage(UIData.cloud1), fit: BoxFit.cover), - ), - child: Center( - child: SingleChildScrollView( - child: loginScreenForm(), - ), - ), - )); - } -} diff --git a/lib/views/pages/login_signup/register_form.dart b/lib/views/pages/login_signup/register_form.dart deleted file mode 100644 index 13dd7a2e9..000000000 --- a/lib/views/pages/login_signup/register_form.dart +++ /dev/null @@ -1,572 +0,0 @@ -//flutter packages are called here -import 'dart:io'; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_pw_validator/flutter_pw_validator.dart'; - -// pages are called here -import 'package:provider/provider.dart'; -import 'package:talawa/enums/image_from.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/utils/validator.dart'; -import 'package:talawa/view_models/vm_register.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/model/token.dart'; -import 'package:talawa/views/pages/organization/join_organization.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:graphql/utilities.dart' show multipartFileFrom; - -//pubspec packages are called here -import 'package:image_picker/image_picker.dart'; - -import '../_pages.dart'; - -class RegisterForm extends StatefulWidget { - @override - RegisterFormState createState() { - return RegisterFormState(); - } -} - -class RegisterFormState extends State { - final _formKey = GlobalKey(); - final TextEditingController _firstNameController = TextEditingController(); - final TextEditingController _lastNameController = TextEditingController(); - final TextEditingController _emailController = TextEditingController(); - final TextEditingController _originalPasswordController = - TextEditingController(); - FocusNode confirmPassField = FocusNode(); - RegisterViewModel model = RegisterViewModel(); - bool _progressBarState = false; - final Queries _signupQuery = Queries(); - var _validate = AutovalidateMode.disabled; - final Preferences _pref = Preferences(); - FToast fToast; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - File _image; - bool _obscureText = true; - - void toggleProgressBarState() { - _progressBarState = !_progressBarState; - } - - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - Provider.of(context, listen: false).getOrgUrl(); - } - - //function for registering user which gets called when sign up is press - registerUser() async { - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - final img = await multipartFileFrom(_image); - print(_image); - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(_signupQuery.registerUser( - model.firstName, model.lastName, model.email, model.password)), - variables: { - 'file': img, - }, - )); - if (result.hasException) { - print(result.exception); - setState(() { - _progressBarState = false; - }); - _exceptionToast(result.hasException.toString().substring(16, 35)); - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = true; - }); - - final String userFName = - result.data['signUp']['user']['firstName'].toString(); - await _pref.saveUserFName(userFName); - final String userLName = - result.data['signUp']['user']['lastName'].toString(); - await _pref.saveUserLName(userLName); - - final Token accessToken = - Token(tokenString: result.data['signUp']['accessToken'].toString()); - await _pref.saveToken(accessToken); - final Token refreshToken = - Token(tokenString: result.data['signUp']['refreshToken'].toString()); - await _pref.saveRefreshToken(refreshToken); - final String currentUserId = - result.data['signUp']['user']['_id'].toString(); - await _pref.saveUserId(currentUserId); - //Navigate user to join organization screen - Navigator.of(context).pushAndRemoveUntil( - MaterialPageRoute( - builder: (context) => const JoinOrganization( - fromProfile: false, - )), - (route) => false); - } - } - - //function called when the user is called without the image - registerUserWithoutImg() async { - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(_signupQuery.registerUserWithoutImg( - model.firstName, model.lastName, model.email, model.password)), - )); - if (result.hasException) { - print(result.exception); - setState(() { - _progressBarState = false; - }); - _exceptionToast(result.exception.toString().substring(16, 35)); - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = true; - }); - - final String userFName = - result.data['signUp']['user']['firstName'].toString(); - await _pref.saveUserFName(userFName); - final String userLName = - result.data['signUp']['user']['lastName'].toString(); - await _pref.saveUserLName(userLName); - final Token accessToken = - Token(tokenString: result.data['signUp']['accessToken'].toString()); - await _pref.saveToken(accessToken); - final Token refreshToken = - Token(tokenString: result.data['signUp']['refreshToken'].toString()); - await _pref.saveRefreshToken(refreshToken); - final String currentUserId = - result.data['signUp']['user']['_id'].toString(); - await _pref.saveUserId(currentUserId); - - Navigator.of(context).pushAndRemoveUntil( - MaterialPageRoute( - builder: (context) => const JoinOrganization( - fromProfile: false, - )), - (route) => false); - } - } - - //get image from camera and gallery based on the enum passed - _imgFrom({From pickFrom = From.none}) async { - File pickImageFile; - if (pickFrom != From.none) { - final PickedFile selectedImage = await ImagePicker().getImage( - source: pickFrom == From.camera - ? ImageSource.camera - : ImageSource.gallery); - pickImageFile = File(selectedImage.path); - setState(() { - _image = pickImageFile; - }); - } - } - - @override - Widget build(BuildContext context) { - return SingleChildScrollView( - child: Form( - key: _formKey, - autovalidateMode: _validate, - child: Column( - children: [ - addImage(), - _image == null - ? const Padding( - padding: EdgeInsets.all(8.0), - child: Text('Add Profile Image', - style: - TextStyle(fontSize: 16, color: Colors.white)), - ) - : IconButton( - icon: const Icon( - Icons.delete, - size: 30, - color: Colors.red, - ), - onPressed: () { - setState(() { - _image = null; - }); - }, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 3.15, - ), - AutofillGroup( - child: Column( - children: [ - TextFormField( - autofillHints: const [AutofillHints.givenName], - textInputAction: TextInputAction.next, - textCapitalization: TextCapitalization.words, - controller: _firstNameController, - validator: (value) => - Validator.validateFirstName(value), - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.white), - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(20.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.orange), - borderRadius: BorderRadius.circular(20.0), - ), - prefixIcon: - const Icon(Icons.person, color: Colors.white), - labelText: "First Name", - labelStyle: const TextStyle(color: Colors.white), - alignLabelWithHint: true, - hintText: 'Earl', - hintStyle: const TextStyle(color: Colors.grey), - ), - onSaved: (value) { - model.firstName = value; - }, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - TextFormField( - autofillHints: const [AutofillHints.familyName], - textInputAction: TextInputAction.next, - textCapitalization: TextCapitalization.words, - controller: _lastNameController, - validator: Validator.validateLastName, - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.white), - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(20.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.orange), - borderRadius: BorderRadius.circular(20.0), - ), - prefixIcon: - const Icon(Icons.person, color: Colors.white), - labelText: "Last Name", - labelStyle: const TextStyle(color: Colors.white), - alignLabelWithHint: true, - hintText: 'John', - hintStyle: const TextStyle(color: Colors.grey), - ), - onSaved: (value) { - model.lastName = value; - }, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - TextFormField( - autofillHints: const [AutofillHints.email], - textInputAction: TextInputAction.next, - keyboardType: TextInputType.emailAddress, - validator: Validator.validateEmail, - controller: _emailController, - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.white), - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(20.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.orange), - borderRadius: BorderRadius.circular(20.0), - ), - prefixIcon: - const Icon(Icons.email, color: Colors.white), - labelText: "Email", - labelStyle: const TextStyle(color: Colors.white), - alignLabelWithHint: true, - hintText: 'foo@bar.com', - hintStyle: const TextStyle(color: Colors.grey), - ), - onSaved: (value) { - model.email = value; - }, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - TextFormField( - autofillHints: const [AutofillHints.password], - textInputAction: TextInputAction.next, - obscureText: _obscureText, - controller: _originalPasswordController, - validator: Validator.validatePassword, - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.white), - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(20.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.orange), - borderRadius: BorderRadius.circular(20.0), - ), - prefixIcon: - const Icon(Icons.lock, color: Colors.white), - suffixIcon: TextButton( - onPressed: _toggle, - child: Icon( - _obscureText - ? Icons.visibility_off - : Icons.visibility, - color: Colors.white, - ), - ), - labelText: "Password", - labelStyle: const TextStyle(color: Colors.white), - focusColor: UIData.primaryColor, - alignLabelWithHint: true, - hintText: 'Password', - hintStyle: const TextStyle(color: Colors.grey), - ), - onFieldSubmitted: (_) { - FocusScope.of(context).unfocus(); - FocusScope.of(context).requestFocus(confirmPassField); - }, - onChanged: (_) { - setState(() {}); - }, - onSaved: (value) { - model.password = value; - }, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 1.25, - ), - FlutterPwValidator( - width: 400, - height: 150, - minLength: 8, - uppercaseCharCount: 1, - specialCharCount: 1, - numericCharCount: 1, - onSuccess: (_) { - setState(() {}); - }, - controller: _originalPasswordController, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - TextFormField( - autofillHints: const [AutofillHints.password], - obscureText: true, - focusNode: confirmPassField, - validator: (value) => Validator.validatePasswordConfirm( - _originalPasswordController.text, - value, - ), - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.white), - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(20.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Colors.orange), - borderRadius: BorderRadius.circular(20.0), - ), - prefixIcon: - const Icon(Icons.lock, color: Colors.white), - labelText: "Confirm Password", - labelStyle: const TextStyle(color: Colors.white), - focusColor: UIData.primaryColor, - ), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - ], - ), - ), - Container( - padding: EdgeInsets.symmetric( - vertical: SizeConfig.safeBlockVertical * 2.5, - horizontal: SizeConfig.safeBlockHorizontal * 7.5), - width: double.infinity, - child: ElevatedButton( - style: ButtonStyle( - padding: MaterialStateProperty.all( - const EdgeInsets.all(12.0)), - shape: MaterialStateProperty.all( - const StadiumBorder()), - backgroundColor: - MaterialStateProperty.all(Colors.white), - ), - onPressed: () async { - FocusScope.of(context).unfocus(); - _validate = AutovalidateMode.always; - if (_formKey.currentState.validate()) { - _formKey.currentState.save(); - _image != null - ? registerUser() - : registerUserWithoutImg(); - setState(() { - toggleProgressBarState(); - }); - } - }, - child: _progressBarState - ? SizedBox( - width: SizeConfig.safeBlockHorizontal * 5, - height: SizeConfig.safeBlockVertical * 2.5, - child: const CircularProgressIndicator( - valueColor: - AlwaysStoppedAnimation(Colors.orange), - strokeWidth: 3, - backgroundColor: Colors.black, - )) - : const Text( - "SIGN UP", - ), - ), - ), - ], - ))); - } - - //widget used to add the image - Widget addImage() { - return Column( - children: [ - const SizedBox( - height: 32, - ), - Center( - child: GestureDetector( - onTap: () { - _showPicker(context); - }, - child: CircleAvatar( - radius: 55, - backgroundColor: UIData.secondaryColor, - child: _image != null - ? CircleAvatar( - radius: 52, - backgroundImage: FileImage( - _image, - ), - ) - : CircleAvatar( - radius: 52, - backgroundColor: Colors.lightBlue[50], - child: Icon( - Icons.camera_alt, - color: Colors.grey[800], - ), - ), - ), - ), - ) - ], - ); - } - - //used to show the method user want to choose their pictures - void _showPicker(BuildContext context) { - showModalBottomSheet( - context: context, - builder: (BuildContext context) { - return SafeArea( - child: Container( - child: Wrap( - children: [ - ListTile( - leading: const Icon(Icons.camera_alt_outlined), - title: const Text('Camera'), - onTap: () { - _imgFrom(pickFrom: From.camera); - Navigator.of(context).pop(); - }, - ), - ListTile( - leading: const Icon(Icons.photo_library), - title: const Text('Photo Library'), - onTap: () { - _imgFrom(pickFrom: From.gallery); - Navigator.of(context).pop(); - }), - ], - ), - ), - ); - }); - } - - /* _successToast(String msg) { - Widget toast = Container( - padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.green, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - msg, - textAlign: TextAlign.center, - ), - ), - ], - ), - );*/ - - //this method is called when the result is an exception - _exceptionToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 6, - vertical: SizeConfig.safeBlockVertical * 1.75), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - msg, - style: const TextStyle(fontSize: 15.0, color: Colors.white), - textAlign: TextAlign.center, - ), - ), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 5), - ); - } - - //function toggles _obscureText value - void _toggle() { - setState(() { - _obscureText = !_obscureText; - }); - } -} diff --git a/lib/views/pages/login_signup/register_page.dart b/lib/views/pages/login_signup/register_page.dart deleted file mode 100644 index 59888d9a9..000000000 --- a/lib/views/pages/login_signup/register_page.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/login_signup/login_page.dart'; -import 'package:talawa/views/pages/login_signup/register_form.dart'; - -class RegisterPage extends StatefulWidget { - @override - _RegisterePageState createState() => _RegisterePageState(); -} - -class _RegisterePageState extends State - with TickerProviderStateMixin { - final GlobalKey _scaffoldkey = GlobalKey(); - - Widget registrationScreenForm() => Center( - child: Container( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Container( - constraints: BoxConstraints( - maxWidth: SizeConfig.safeBlockHorizontal * 75, - minWidth: SizeConfig.safeBlockHorizontal * 62.5, - minHeight: SizeConfig.safeBlockVertical * 43.75), - child: SingleChildScrollView( - padding: const EdgeInsets.only(bottom: 30.0), - scrollDirection: Axis.vertical, - child: Column( - children: [ - RegisterForm(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - "Already have an account?", - style: TextStyle(color: Colors.white), - ), - Container( - margin: const EdgeInsets.only(left: 8.0), - child: GestureDetector( - onTap: () { - // Navigator.pop(context); - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => LoginPage())); - }, - child: const Text( - "SIGN IN!", - textAlign: TextAlign.start, - style: TextStyle(color: UIData.primaryColor), - ), - ), - ), - ], - ) - ], - ), - )), - ), - ); - - @override - Widget build(BuildContext context) { - return Scaffold( - //resizeToAvoidBottomInset: false, - key: _scaffoldkey, - backgroundColor: Colors.white, - body: Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage(UIData.cloud1), fit: BoxFit.cover), - ), - child: Center( - child: SingleChildScrollView( - child: registrationScreenForm(), - ), - ), - ), - ); - } -} diff --git a/lib/views/pages/login_signup/set_url_page.dart b/lib/views/pages/login_signup/set_url_page.dart deleted file mode 100644 index 50e524d3f..000000000 --- a/lib/views/pages/login_signup/set_url_page.dart +++ /dev/null @@ -1,555 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_logs/flutter_logs.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/loghelper.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/utils/validator.dart'; -import 'package:http/http.dart' as http; -import 'package:talawa/views/pages/login_signup/login_page.dart'; -import 'package:talawa/views/pages/login_signup/register_page.dart'; - -class UrlPage extends StatefulWidget { - @override - _UrlPageState createState() => _UrlPageState(); -} - -bool first = true; - -void changeFirst() { - first = false; -} - -class _UrlPageState extends State - with TickerProviderStateMixin { - final GlobalKey _scaffoldkey = GlobalKey(); - - MediaQueryData _media; - final _formKey = GlobalKey(); - final urlController = TextEditingController(); - String dropdownValue = 'HTTP'; - final Preferences _pref = Preferences(); - String orgUrl, orgImgUrl; - String saveMsg = "Set URL"; - String urlInput; - FToast fToast; - bool isUrlCalled = false; - //animation Controllers - AnimationController controller; - AnimationController loginController; - AnimationController helloController; - AnimationController createController; - // animation - Animation loginAnimation; - Animation createAnimation; - Animation animation; - Animation helloAnimation; - - listenToUrl() { - if (saveMsg == "URL SAVED!" && urlController.text != urlInput) { - setState(() { - saveMsg = "Set URL"; - }); - } - urlInput = urlController.text; - } - - Future checkAndSetUrl() async { - setState(() { - isUrlCalled = true; - }); - - try { - await http.get('${dropdownValue.toLowerCase()}://${urlController.text}/'); - setApiUrl(); - _setURL(); - } catch (e) { - LogHelper().log(LogLevel.ERROR, widget.toStringShort(), "checkAndSetUrl", - "Incorrect Oraganization", - exception: e as Exception); - _exceptionToast('Incorrect Organization Entered'); - LogHelper().exportLogs(); - } - - setState(() { - isUrlCalled = false; - }); - } - - Future setApiUrl() async { - setState(() { - orgUrl = "${dropdownValue.toLowerCase()}://${urlController.text}/"; - orgImgUrl = - "${dropdownValue.toLowerCase()}://${urlController.text}/talawa/"; - }); - await _pref.saveOrgUrl(orgUrl); - await _pref.saveOrgImgUrl(orgImgUrl); - } - - void _setURL() { - setState(() { - saveMsg = "URL SAVED!"; - }); - } - - _exceptionToast(String msg) { - final Widget toast = Container( - padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 14.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - msg, - style: const TextStyle(fontSize: 15.0, color: Colors.white), - textAlign: TextAlign.center, - ), - ), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 5), - ); - } - - void assignAnimation({@required bool firstTime}) { - if (!firstTime) { - animation = Tween(begin: 1.0, end: 1.0).animate(controller); - - helloAnimation = Tween(begin: 1.0, end: 1.0).animate(helloController); - - createAnimation = Tween(begin: 1.0, end: 1.0).animate(createController); - - loginAnimation = Tween(begin: 1.0, end: 1.0).animate(loginController); - } else { - loginAnimation = Tween(begin: 0.0, end: 1.0).animate(loginController); - - createAnimation = Tween(begin: 0.0, end: 1.0).animate(createController); - - animation = Tween(begin: 0.0, end: 1.0).animate(controller); - - helloAnimation = Tween(begin: 0.0, end: 1.0).animate(helloController); - } - } - - Future load() async { - await controller?.forward(); - await helloController?.forward(); - await createController?.forward(); - await loginController?.forward(); - changeFirst(); - } - - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - urlController.addListener(listenToUrl); - // Initializing all the animationControllers - controller = AnimationController( - vsync: this, - duration: const Duration(milliseconds: 2000), - ); - loginController = AnimationController( - vsync: this, - duration: const Duration(milliseconds: 500), - ); - - helloController = AnimationController( - vsync: this, - duration: const Duration(milliseconds: 500), - ); - - createController = AnimationController( - vsync: this, - duration: const Duration(milliseconds: 500), - ); - } - - @override - Widget build(BuildContext context) { - assignAnimation(firstTime: first); - load(); - SizeConfig().init(context); - Widget mainScreen() { - return Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - FadeTransition( - opacity: animation, - child: Container( - //padding: EdgeInsets.all(100.0), - padding: const EdgeInsets.symmetric(vertical: 50.0), - child: const Center( - child: Image(image: AssetImage(UIData.talawaLogo))), - ), - ), - Container( - //container with login and sign up button - padding: EdgeInsets.fromLTRB( - 0, 0, 0, SizeConfig.safeBlockVertical * 6.25), - - child: Column( - children: [ - Container( - padding: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 5, 0, 0, 0), - width: _media != null - ? _media.size.width - : MediaQuery.of(context).size.width, - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - FadeTransition( - opacity: helloAnimation, - child: Container( - child: const Text( - "TALAWA", - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 60, - ), - ), - ), - ), - ], - ), - FadeTransition( - opacity: helloAnimation, - child: Container( - child: const Text( - ".", - style: TextStyle( - color: Colors.orange, - fontWeight: FontWeight.bold, - fontSize: 60, - ), - ), - ), - ), - ], - ), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2, - ), - FadeTransition( - opacity: createAnimation, - child: Container( - child: Container( - width: _media != null - ? _media.size.width - : MediaQuery.of(context).size.width, - margin: EdgeInsets.only( - left: SizeConfig.safeBlockHorizontal * 5, - right: SizeConfig.safeBlockHorizontal * 7.5, - top: SizeConfig.safeBlockVertical * 1.25), - alignment: Alignment.center, - child: Column( - children: [ - Row( - children: [ - DropdownButton( - value: dropdownValue, - icon: const Icon(Icons.arrow_downward, - color: Colors.orange), - iconSize: 24, - elevation: 16, - style: - const TextStyle(color: UIData.primaryColor), - underline: Container( - height: 2, - color: UIData.primaryColor, - ), - onChanged: (String newValue) { - setState(() { - dropdownValue = newValue; - saveMsg = 'Set URL'; - }); - }, - items: [ - 'HTTP', - 'HTTPS' - ].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), - SizedBox( - width: SizeConfig.safeBlockHorizontal * 2.5, - ), - Expanded( - child: Form( - key: _formKey, - child: TextFormField( - keyboardType: TextInputType.url, - validator: (value) => - Validator.validateURL( - urlController.text), - textAlign: TextAlign.left, - style: - const TextStyle(color: Colors.white), - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: Colors.white), - borderRadius: - BorderRadius.circular(50.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: Colors.orange), - borderRadius: - BorderRadius.circular(50.0), - ), - prefixIcon: const Icon(Icons.web, - color: Colors.white), - labelText: "Type Org URL Here", - labelStyle: const TextStyle( - color: Colors.white), - alignLabelWithHint: true, - hintText: - 'talawa-graphql-api.herokuapp.com/graphql', - hintStyle: - const TextStyle(color: Colors.grey), - ), - controller: urlController, - )), - ), - ], - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 0.75, - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ElevatedButton( - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), - ), - ), - onPressed: () async { - FocusScope.of(context).unfocus(); - if (_formKey.currentState.validate()) { - _formKey.currentState.save(); - - await checkAndSetUrl(); - } - }, - child: isUrlCalled - ? SizedBox( - height: SizeConfig.safeBlockVertical * - 1.75, - width: - SizeConfig.safeBlockHorizontal * - 3.5, - child: - const CircularProgressIndicator( - backgroundColor: - Colors.white), - ) - : Text( - saveMsg, - )), - ], - ), - ], - ), - ), - ), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - FadeTransition( - //changed opacity animation to match login button animation - opacity: loginAnimation, - child: Container( - //padding: EdgeInsets.all(100.0), - child: Container( - width: _media != null - ? _media.size.width - : MediaQuery.of(context).size.width, - margin: EdgeInsets.only( - left: SizeConfig.safeBlockHorizontal * 12.5, - right: SizeConfig.safeBlockHorizontal * 12.5, - top: SizeConfig.safeBlockVertical * 1.25), - alignment: Alignment.center, - child: Row( - children: [ - Expanded( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - padding: EdgeInsets.zero, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), - ), - ), - onPressed: saveMsg != "URL SAVED!" - ? null - : () async { - if (_formKey.currentState.validate()) { - _formKey.currentState.save(); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - RegisterPage()), - ); - } - }, - child: Container( - padding: EdgeInsets.symmetric( - vertical: SizeConfig.safeBlockVertical * 2.5, - horizontal: - SizeConfig.safeBlockHorizontal * 5, - ), - decoration: BoxDecoration( - border: Border.all(color: Colors.orange), - borderRadius: BorderRadius.circular(50.0)), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Expanded( - child: Text( - "Create an Account", - textAlign: TextAlign.center, - style: TextStyle( - //color: UIData.quitoThemeColor, - color: Colors.white, - fontSize: 18, - //fontWeight: FontWeight.bold - ), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ), - ), - SizedBox(height: SizeConfig.safeBlockVertical * 0.75), - FadeTransition( - opacity: loginAnimation, - child: Container( - child: Container( - width: _media != null - ? _media.size.width - : MediaQuery.of(context).size.width, - margin: EdgeInsets.only( - left: SizeConfig.safeBlockHorizontal * 12.5, - right: SizeConfig.safeBlockHorizontal * 12.5, - top: SizeConfig.safeBlockVertical * 1.25), - alignment: Alignment.center, - child: Row( - children: [ - Expanded( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - padding: EdgeInsets.zero, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), - ), - ), - onPressed: saveMsg != "URL SAVED!" - ? null - : () async { - if (_formKey.currentState.validate()) { - _formKey.currentState.save(); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - LoginPage())); - } - }, - child: Container( - padding: EdgeInsets.symmetric( - vertical: SizeConfig.safeBlockVertical * 2.5, - horizontal: - SizeConfig.safeBlockHorizontal * 5, - ), - decoration: BoxDecoration( - border: Border.all(color: Colors.orange), - borderRadius: BorderRadius.circular(50.0)), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Expanded( - child: Text( - "Login", - textAlign: TextAlign.center, - style: TextStyle( - //color: UIData.quitoThemeColor, - color: Colors.white, - fontSize: 18, - //fontWeight: FontWeight.bold - ), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ], - ); - } - - return Scaffold( - //resizeToAvoidBottomInset: false, - key: _scaffoldkey, - backgroundColor: Colors.white, - body: Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage(UIData.cloud1), fit: BoxFit.cover), - ), - child: Center( - child: SingleChildScrollView( - child: mainScreen(), - ), - ), - ), - ); - } - - @override - dispose() { - controller.dispose(); - helloController.dispose(); - createController.dispose(); - loginController.dispose(); - super.dispose(); - } -} diff --git a/lib/views/pages/members/member_details.dart b/lib/views/pages/members/member_details.dart deleted file mode 100644 index 7d4e85edb..000000000 --- a/lib/views/pages/members/member_details.dart +++ /dev/null @@ -1,235 +0,0 @@ -//flutter imported function -import 'dart:ui'; -import 'package:flutter/material.dart'; -import 'package:flutter_sticky_header/flutter_sticky_header.dart'; - -//files are imported here -import 'package:provider/provider.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import '../../../utils/uidata.dart'; -import 'reg_eventstab.dart'; -import 'user_taskstab.dart'; - -// ignore: must_be_immutable -class MemberDetail extends StatefulWidget { - MemberDetail( - {Key key, - @required this.member, - @required this.color, - this.admins, - this.creatorId}) - : super(key: key); - - final List admins; - final String creatorId; - Map member; - Color color; - - @override - _MemberDetailState createState() => _MemberDetailState(); -} - -class _MemberDetailState extends State - with SingleTickerProviderStateMixin { - TabController _tabController; - @override - void initState() { - super.initState(); - _tabController = TabController(vsync: this, length: 2); - } - - String getPrivilege(String id) { - if (widget.creatorId.compareTo(id) == 0) { - return 'Creator'; - } - for (int i = 0; i < widget.admins.length; i++) { - if (widget.admins[i]['_id'] == id) { - return 'Admin'; - } - } - return 'Member'; - } - - //main build starts here - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text( - 'User Info', - style: TextStyle(color: Colors.white), - ), - ), - body: CustomScrollView(slivers: [ - SliverAppBar( - backgroundColor: Colors.white, - automaticallyImplyLeading: false, - expandedHeight: SizeConfig.safeBlockVertical * 31.25, - flexibleSpace: FlexibleSpaceBar( - background: Column(children: [ - widget.member['image'] == null - ? defaultUserImg() - : userImg(widget.member['image'].toString()), - Card( - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.only( - left: SizeConfig.safeBlockHorizontal * 5), - alignment: Alignment.centerLeft, - height: SizeConfig.safeBlockVertical * 3.75, - child: Text('User email: ${widget.member['email']}'), - )), - Card( - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.only( - left: SizeConfig.safeBlockHorizontal * 5), - alignment: Alignment.centerLeft, - height: SizeConfig.safeBlockVertical * 3.75, - child: Text( - // ignore: prefer_interpolation_to_compose_strings - 'User Privileges: ' + - getPrivilege(widget.member['_id'].toString()), - key: const Key('Privilege'), - ), - )), - ]), - )), - SliverStickyHeader( - header: Container( - height: SizeConfig.safeBlockVertical * 7.5, - decoration: - BoxDecoration(color: Theme.of(context).primaryColor), - child: Material( - color: UIData.secondaryColor, - child: TabBar( - labelPadding: const EdgeInsets.all(0), - indicatorColor: Colors.white, - controller: _tabController, - tabs: const [ - Tab( - icon: Text( - 'Tasks', - style: TextStyle( - color: Colors.white, - ), - ), - ), - Tab( - icon: Text( - 'Registered Events', - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - )), - sliver: SliverFillRemaining( - child: TabBarView( - controller: _tabController, - children: [ - UserTasks( - member: widget.member, - ), - RegisteredEvents( - member: widget.member, - ), - ], - ), - ), - ), - ])); - } - - //widget to get the user image - Widget userImg(String link) { - return Container( - height: SizeConfig.safeBlockVertical * 21.25, - width: double.maxFinite, - decoration: BoxDecoration( - image: DecorationImage( - image: NetworkImage( - Provider.of(context).displayImgRoute + - link), - fit: BoxFit.cover, - ), - ), - child: Stack(alignment: AlignmentDirectional.bottomStart, children: [ - ClipRRect( - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), - child: Container( - alignment: Alignment.center, - color: Colors.grey.withOpacity(0.1), - child: Image.network( - Provider.of(context).displayImgRoute + - link, - ), - ), - ), - ), - Container( - decoration: const BoxDecoration( - gradient: LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [Colors.black45, Colors.transparent]), - ), - padding: EdgeInsets.only(left: SizeConfig.safeBlockHorizontal * 5), - height: SizeConfig.safeBlockVertical * 5, - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${widget.member['firstName']} ${widget.member['lastName']}', - style: const TextStyle( - color: Colors.white, - fontSize: 20, - ), - ), - )) - ]), - ); - } - - //this is widget for default user image - Widget defaultUserImg() { - return Container( - height: SizeConfig.safeBlockVertical * 21.25, - width: MediaQuery.of(context).size.width, - color: widget.color, - child: Column( - children: [ - // ignore: sized_box_for_whitespace - Container( - height: SizeConfig.safeBlockVertical * 16.25, - child: Icon( - Icons.person, - size: SizeConfig.safeBlockVertical * 12.25, - color: Colors.white54, - )), - Container( - decoration: const BoxDecoration( - gradient: LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [Colors.black45, Colors.transparent]), - ), - padding: - EdgeInsets.only(left: SizeConfig.safeBlockHorizontal * 5), - height: SizeConfig.safeBlockVertical * 5, - child: Align( - alignment: Alignment.centerLeft, - child: Text( - '${widget.member['firstName']} ${widget.member['lastName']}', - style: const TextStyle( - color: Colors.white, - fontSize: 20, - ), - ), - )) - ], - ), - ); - } -} diff --git a/lib/views/pages/members/members.dart b/lib/views/pages/members/members.dart deleted file mode 100644 index 12d647963..000000000 --- a/lib/views/pages/members/members.dart +++ /dev/null @@ -1,327 +0,0 @@ -//flutter imported package -import 'dart:ui'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -//pages are called here -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/members/member_details.dart'; -import 'package:flutter_sticky_header/flutter_sticky_header.dart'; -import 'package:talawa/views/widgets/loading.dart'; - -class Organizations extends StatefulWidget { - const Organizations({Key key}) : super(key: key); - - @override - _OrganizationsState createState() => _OrganizationsState(); -} - -class _OrganizationsState extends State { - String currentOrgID; - Map alphaMembersMap; - List membersList = []; - int isSelected = 0; - List admins = []; - String creatorId; - - FToast fToast; - - Preferences preferences = Preferences(); - - //providing initial states to the variables - @override - initState() { - super.initState(); - getMembers(); - } - - Map alphaSplitList(List list) { - final Map alphaMap = {}; - - list.forEach((element) { - if (alphaMap[element['firstName'][0].toUpperCase()] == null) { - alphaMap[element['firstName'][0].toString().toUpperCase()] = []; - alphaMap[element['firstName'][0].toUpperCase()].add(element); - } else { - alphaMap[element['firstName'][0].toUpperCase()].add(element); - } - }); - - return alphaMap; - } - - //function to get the members of an organization - // ignore: missing_return - Future getMembers() async { - final String currentOrgID = await preferences.getCurrentOrgId(); - print(currentOrgID); - if (currentOrgID != null) { - final ApiFunctions apiFunctions = ApiFunctions(); - final result = - await apiFunctions.gqlquery(Queries().fetchOrgById(currentOrgID)); - print(result); - List membersList = result == null ? [] : result['organizations'] as List; - if ((result['organizations'] as List).isNotEmpty) { - admins = result['organizations'][0]['admins'] as List; - creatorId = result['organizations'][0]['creator']['_id'].toString(); - print(admins); - } - if (membersList.isNotEmpty) { - membersList = membersList[0]['members'] as List; - membersList.sort((a, b) => - (a['firstName'].toString()).compareTo(b['firstName'].toString())); - setState(() { - alphaMembersMap = alphaSplitList(membersList); - }); - } - } else { - setState(() { - alphaMembersMap = {}; - }); - } - } - - //returns a random color based on the user id (1 of 18) - Color idToColor(String id) { - final String userId = id.replaceAll(RegExp('[a-z]'), ''); - int colorInt = int.parse(userId.substring(userId.length - 10)); - colorInt = colorInt % 18; - return Color.alphaBlend( - Colors.black45, - Colors.primaries[colorInt], - ); - } - - //main build starts here - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - key: const Key('ORGANIZATION_APP_BAR'), - title: const Text( - 'Members', - style: TextStyle(color: Colors.white), - ), - ), - body: alphaMembersMap == null - ? const Center( - child: Loading(), - ) - : alphaMembersMap.isEmpty - ? RefreshIndicator( - onRefresh: () async { - try { - await getMembers(); - } catch (e) { - _exceptionToast(e.toString()); - } - }, - child: Center( - child: Column(children: [ - SizedBox( - height: SizeConfig.safeBlockVertical * 31.25, - ), - const Text( - "No member to Show", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 6.25, - ), - ElevatedButton( - onPressed: () async { - try { - await getMembers(); - } catch (e) { - _exceptionToast(e.toString()); - } - }, - child: const Text("Refresh"), - ) - ]))) - : RefreshIndicator( - onRefresh: () async { - try { - await getMembers(); - } catch (e) { - _exceptionToast(e.toString()); - } - }, - child: CustomScrollView( - slivers: List.generate( - alphaMembersMap.length, - (index) { - return alphabetDividerList(context, - alphaMembersMap.keys.toList()[index].toString()); - }, - ), - ))); - } - - //widget which divides the list according to letters - Widget alphabetDividerList(BuildContext context, String alphabet) { - return SliverStickyHeader( - header: Container( - color: Colors.white, - height: SizeConfig.safeBlockVertical * 7.5, - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 4), - alignment: Alignment.centerLeft, - child: CircleAvatar( - backgroundColor: UIData.secondaryColor, - child: Text( - alphabet, - style: const TextStyle( - color: Colors.white, - fontSize: 20, - ), - )), - ), - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - return memberCard(index, alphaMembersMap[alphabet] as List); - }, - childCount: (alphaMembersMap[alphabet] as List).length, - ), - ), - ); - } - - //a custom card made for showing member details - Widget memberCard(int index, List membersList) { - final Color color = idToColor(membersList[index]['_id'].toString()); - return GestureDetector( - onTap: () { - pushNewScreen(context, - screen: MemberDetail( - member: membersList[index] as Map, - color: color, - admins: admins, - creatorId: creatorId, - )); - }, - child: Card( - clipBehavior: Clip.hardEdge, - child: Row( - children: [ - membersList[index]['image'] == null - ? defaultUserImage(membersList[index] as Map) - : userImage(membersList[index] as Map), - Flexible( - child: Container( - alignment: Alignment.centerLeft, - padding: const EdgeInsets.all(20), - height: SizeConfig.safeBlockVertical * 10, - color: Colors.white, - child: Text( - '${membersList[index]['firstName']} ${membersList[index]['lastName']}', - textAlign: TextAlign.left, - overflow: TextOverflow.ellipsis, - )), - ) - ], - ), - )); - } - - //widget to get the user images - Widget userImage(Map member) { - return Container( - height: SizeConfig.safeBlockVertical * 10, - width: SizeConfig.safeBlockHorizontal * 25, - decoration: BoxDecoration( - image: DecorationImage( - image: NetworkImage( - Provider.of(context).displayImgRoute + - member['image'].toString()), - fit: BoxFit.cover, - ), - ), - child: ClipRRect( - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), - child: Container( - alignment: Alignment.center, - color: Colors.grey.withOpacity(0.1), - child: Image.network( - Provider.of(context).displayImgRoute + - member['image'].toString(), - ), - ), - ), - ), - ); - } - - //widget to get the default user image - Widget defaultUserImage(Map member) { - return Container( - padding: const EdgeInsets.all(0), - height: SizeConfig.safeBlockVertical * 10, - width: SizeConfig.safeBlockHorizontal * 25, - color: idToColor(member['_id'].toString()), - child: Padding( - padding: EdgeInsets.all(SizeConfig.safeBlockHorizontal * 2.5), - child: CircleAvatar( - backgroundColor: Colors.black12, - child: Icon( - Icons.person, - size: SizeConfig.safeBlockHorizontal * 7.5, - color: Colors.white70, - )))); - } - - //the widget is user for pop up menu - Widget popUpMenue(Map member) { - return PopupMenuButton( - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 1, - child: ListTile( - leading: Icon(Icons.playlist_add_check), - title: Text('View Assigned Tasks'), - )), - const PopupMenuItem( - value: 2, - child: ListTile( - leading: Icon(Icons.playlist_add_check), - title: Text('View Registered Events'), - )), - ], - ); - } - - _exceptionToast(String msg) { - final Widget toast = Container( - padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 14.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 1), - ); - } -} diff --git a/lib/views/pages/members/reg_eventstab.dart b/lib/views/pages/members/reg_eventstab.dart deleted file mode 100644 index 5cd8e25fd..000000000 --- a/lib/views/pages/members/reg_eventstab.dart +++ /dev/null @@ -1,70 +0,0 @@ -//flutter packages imported here -import 'package:flutter/material.dart'; - -//packages for pages are imported here -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:talawa/views/widgets/loading.dart'; - -// ignore: must_be_immutable -class RegisteredEvents extends StatefulWidget { - RegisteredEvents({ - Key key, - @required this.member, - }) : super(key: key); - Map member; - - @override - _RegisteredEventsState createState() => _RegisteredEventsState(); -} - -class _RegisteredEventsState extends State { - Preferences preferences = Preferences(); - - ApiFunctions apiFunctions = ApiFunctions(); - List userEvents; - - //providing variables with the initial states - @override - void initState() { - super.initState(); - getUserDetails(); - } - - //method to get the user details - getUserDetails() async { - final String userID = widget.member['_id'].toString(); - final Map result = - await apiFunctions.gqlquery(Queries().registeredEventsByUser(userID)); - setState(() { - userEvents = - result == null ? [] : result['registeredEventsByUser'] as List; - }); - } - - //the main build starts here - @override - Widget build(BuildContext context) { - return userEvents == null - ? const Center( - child: Loading(), - ) - : userEvents.isNotEmpty - ? ListView.builder( - itemCount: userEvents.length, - itemBuilder: (context, index) { - return ListTile( - leading: Text('${userEvents[index]['title']}'), - ); - }) - : Container( - child: const Center( - child: Text( - "No registered events", - style: TextStyle(fontSize: 20), - textAlign: TextAlign.center, - )), - ); - } -} diff --git a/lib/views/pages/members/user_taskstab.dart b/lib/views/pages/members/user_taskstab.dart deleted file mode 100644 index 4e819c35e..000000000 --- a/lib/views/pages/members/user_taskstab.dart +++ /dev/null @@ -1,112 +0,0 @@ -//flutter packages are called here -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; - -//pages are called here -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/views/widgets/loading.dart'; - -// ignore: must_be_immutable -class UserTasks extends StatefulWidget { - UserTasks({ - Key key, - @required this.member, - }) : super(key: key); - - Map member; - - @override - _UserTasksState createState() => _UserTasksState(); -} - -class _UserTasksState extends State { - Preferences preferences = Preferences(); - - ApiFunctions apiFunctions = ApiFunctions(); - List userTasks; - - @override - void initState() { - super.initState(); - getUserDetails(); - } - - //getting user details - getUserDetails() async { - final String userID = widget.member['_id'].toString(); - final Map result = - await apiFunctions.gqlquery(Queries().tasksByUser(userID)); - print(result); - setState(() { - userTasks = result == null ? [] : result['tasksByUser'] as List; - }); - } - - @override - void setState(fn) { - if (mounted) { - super.setState(fn); - } else { - return; - } - } - - //main building starts here - @override - Widget build(BuildContext context) { - return userTasks == null - ? Container( - key: const Key("User Task Loading"), - child: const Center( - child: Loading(), - ), - ) - : userTasks.isNotEmpty - ? Container( - key: const Key("User Task Exists"), - child: ListView.builder( - itemCount: userTasks.length, - itemBuilder: (context, index) { - String title = "Title: ${userTasks[index]["title"]}"; - title += userTasks[index]["event"] != null - ? '\nEvent: ${userTasks[index]["event"]["title"]}' - : ""; - String description = - userTasks[index]["description"].toString(); - description += userTasks[index]["deadline"] != null - ? ' \nDue Date: ${DateFormat("dd-MM-yyyy").format(DateTime.fromMillisecondsSinceEpoch(int.parse(userTasks[index]["deadline"].toString())))}' - : '\nDue Date: N/A'; - return Card( - child: Column( - children: [ - ListTile( - title: Text( - title, - ), - subtitle: Text( - 'Description: $description', - ), - contentPadding: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 2, - SizeConfig.safeBlockVertical, - SizeConfig.safeBlockHorizontal * 2, - SizeConfig.safeBlockVertical), - ), - ], - )); - })) - : Container( - key: const Key("User Task Not Exists"), - child: const Center( - child: Text( - "No Tasks found", - style: TextStyle(fontSize: 20), - textAlign: TextAlign.center, - ), - ), - ); - } -} diff --git a/lib/views/pages/newsfeed/add_post.dart b/lib/views/pages/newsfeed/add_post.dart deleted file mode 100644 index 1ee33afa6..000000000 --- a/lib/views/pages/newsfeed/add_post.dart +++ /dev/null @@ -1,211 +0,0 @@ -//flutter imported packages -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/services/post_provider.dart'; - -//pages are called here -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/widgets/toast_tile.dart'; - -class AddPost extends StatefulWidget { - const AddPost({Key key}) : super(key: key); - - @override - _AddPostState createState() => _AddPostState(); -} - -class _AddPostState extends State { - final titleController = TextEditingController(); - final textController = TextEditingController(); - AutovalidateMode validate = AutovalidateMode.disabled; - String id; - String organizationId; - Map result; - FToast fToast; - Preferences preferences = Preferences(); - - //giving every variable its initial state - @override - initState() { - super.initState(); - getCurrentOrgId(); - fToast = FToast(); - fToast.init(context); - } - - //this method is getting the current org id - getCurrentOrgId() async { - final orgId = await preferences.getCurrentOrgId(); - setState(() { - organizationId = orgId; - }); - print(organizationId); - } - - //creating post - Future createPost() async { - final String description = textController.text.trim().replaceAll('\n', ' '); - final String title = titleController.text.trim().replaceAll('\n', ' '); - result = await Queries().addPost(description, organizationId, title) as Map; - print(result); - if (result != null) { - Provider.of(context, listen: false).getPosts(); - Navigator.pop(context, true); - } else { - _exceptionToast(result.toString().substring(16)); - } - return result; - } - - @override - void dispose() { - titleController.dispose(); - textController.dispose(); - super.dispose(); - } - - final GlobalKey _formKey = GlobalKey(); - - //main build starts from here - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text( - 'New Post', - style: TextStyle(color: Colors.white), - ), - ), - body: SingleChildScrollView( - child: Container( - child: Form( - autovalidateMode: validate, - key: _formKey, - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(9.0), - child: Container( - child: TextFormField( - maxLines: null, - keyboardType: TextInputType.multiline, - inputFormatters: [LengthLimitingTextInputFormatter(30)], - key: const Key('Title'), - textInputAction: TextInputAction.next, - validator: (String value) { - if (value.length > 30) { - return "Post title cannot be longer than 30 letters"; - } - - if (value.isEmpty) { - return "This field is Required"; - } - return null; - }, - controller: titleController, - decoration: const InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.all( - Radius.circular(20.0), - ), - ), - labelText: 'Give your post a title....', - ), - // 'Give your post a title....', - ), - ), - ), - Padding( - padding: const EdgeInsets.all(9.0), - child: Container( - child: TextFormField( - maxLines: null, - inputFormatters: [ - LengthLimitingTextInputFormatter(10000) - ], - keyboardType: TextInputType.multiline, - key: const Key('Description'), - controller: textController, - validator: (String value) { - if (value.length > 10000) { - return "Post cannot be longer than 10000 letters"; - } - - if (value.isEmpty) { - return "This field is Required"; - } - return null; - }, - decoration: const InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.all( - Radius.circular(20.0), - ), - ), - labelText: 'Write Your post here....', - ), - // 'Give your post Description here....', - ), - ), - ), - ], - ), - ), - ), - ), - floatingActionButton: addPostFab(), - ); - } - - //this method adds the post - Widget addPostFab() { - return FloatingActionButton( - heroTag: "btn1", - key: const Key('submit'), - backgroundColor: UIData.secondaryColor, - onPressed: () { - if (_formKey.currentState.validate()) { - _formKey.currentState.save(); - createPost(); - } - }, - child: const Icon( - Icons.check, - color: Colors.white, - ), - ); - } - - Widget inputField(String name, TextEditingController controller) { - return Padding( - padding: const EdgeInsets.all(10), - child: TextField( - inputFormatters: [ - LengthLimitingTextInputFormatter(10), - ], - keyboardType: TextInputType.multiline, - controller: controller, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(20.0), - borderSide: const BorderSide(color: Colors.teal)), - hintText: name), - )); - } - - _exceptionToast(String msg) { - fToast.showToast( - child: ToastTile( - msg: msg, - success: false, - ), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/newsfeed/news_article.dart b/lib/views/pages/newsfeed/news_article.dart deleted file mode 100644 index c48a09b41..000000000 --- a/lib/views/pages/newsfeed/news_article.dart +++ /dev/null @@ -1,470 +0,0 @@ -//the flutter packages are imported here -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -import 'package:flutter/services.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/post_controller.dart'; - -//the pages are called here -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/api_functions.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/utils/timer.dart'; -import 'package:talawa/views/widgets/toast_tile.dart'; - -const String newLineKey = "@123TALAWA321@"; - -// ignore: must_be_immutable -class NewsArticle extends StatefulWidget { - const NewsArticle({Key key, @required this.index, @required this.post}) - : super(key: key); - final Map post; - final int index; - - @override - _NewsArticleState createState() => _NewsArticleState(); -} - -class _NewsArticleState extends State { - @override - void setState(fn) { - if (mounted) { - super.setState(fn); - } - } - - TextEditingController commentController; - Preferences preferences = Preferences(); - ApiFunctions apiFunctions = ApiFunctions(); - bool showLoadComments = false; - Timer timer = Timer(); - List comments = []; - bool moreComments = false; - bool isCommentAdded = false; - int index; - Map post; - FToast fToast; - final Queries _query = Queries(); - List userDetails = []; - String userID; - String orgName; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - PostController postController; - - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - commentController = TextEditingController( - text: Provider.of(context, listen: false) - .comment(widget.post["_id"].toString())); - fetchUserDetails(); - index = widget.index; - post = widget.post; - commentController.addListener(_notifyData); - } - - void _notifyData() { - Provider.of(context, listen: false) - .commentEntry(widget.post["_id"].toString(), commentController.text); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - getPostComments(); - } - - Future fetchUserDetails() async { - userID = await preferences.getUserId(); - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - final QueryResult result = await _client.query(QueryOptions( - documentNode: gql(_query.fetchUserInfo), variables: {'id': userID})); - if (result.hasException) { - print(result.exception); - _exceptionToast(result.exception.toString()); - } else if (!result.hasException) { - //print(result); - setState(() { - userDetails = result.data['users'] as List; - }); - //print(userDetails); - } - } - - @override - void dispose() { - commentController.dispose(); - super.dispose(); - } - -//return profile image of current user - Widget _profileImage() { - return userDetails[0]['image'] != null - ? CircleAvatar( - radius: 30, - backgroundImage: NetworkImage( - Provider.of(context).displayImgRoute + - userDetails[0]['image'].toString())) - : CircleAvatar( - radius: 45.0, - backgroundColor: Colors.white, - child: Text( - userDetails[0]['firstName'] - .toString() - .substring(0, 1) - .toUpperCase() + - userDetails[0]['lastName'] - .toString() - .substring(0, 1) - .toUpperCase(), - style: const TextStyle( - color: UIData.primaryColor, - )), - ); - } - - //this method helps us to get the comments of the post - Future getPostComments() async { - final String mutation = - Queries().getPostsComments(widget.post['_id'].toString()); - final Map result = await apiFunctions.gqlmutation(mutation) as Map; - comments = result == null - ? [] - : (result['commentsByPost'] as List).reversed.toList(); - } - - //this method helps us to create any comments we are willing to - Future createComment() async { - FocusScope.of(context).unfocus(); - String queryText = ''; - if (commentController.text.isNotEmpty) { - Fluttertoast.showToast(msg: "Adding Comment..."); - queryText = commentController.text.replaceAll("\n", newLineKey).trim(); - final Map result = await Queries() - .createComments(widget.post['_id'].toString(), queryText) as Map; - if (result == null) { - Fluttertoast.showToast( - msg: "Sorry, this comment could not be posted.", - ); - } else { - isCommentAdded = true; - FocusScope.of(context).requestFocus(FocusNode()); - commentController.text = ''; - await Fluttertoast.showToast( - msg: "Comment added.", - ); - postController.addComment(index, result["createComment"] as Map); - } - } else { - Fluttertoast.showToast(msg: "Please write comment"); - } - } - - //get time of comment - String commentTime(int index) { - final Duration commentTimeDuration = DateTime.now().difference( - DateTime.fromMillisecondsSinceEpoch( - int.parse(comments[index]['createdAt'].toString())), - ); - - String timeText = ''; - - if (commentTimeDuration.inMinutes < 1) { - if (commentTimeDuration.inSeconds == 1) { - timeText = ' second ago'; - } else { - timeText = ' seconds ago'; - } - return commentTimeDuration.inSeconds.toString() + timeText; - } else if (commentTimeDuration.inHours < 1) { - if (commentTimeDuration.inMinutes == 1) { - timeText = ' min ago'; - } else { - timeText = ' mins ago'; - } - return commentTimeDuration.inMinutes.toString() + timeText; - } else if (commentTimeDuration.inDays < 1) { - if (commentTimeDuration.inHours == 1) { - timeText = ' hour ago'; - } else { - timeText = ' hours ago'; - } - return commentTimeDuration.inHours.toString() + timeText; - } else if (commentTimeDuration.inDays < 7) { - if (commentTimeDuration.inDays == 1) { - timeText = ' day ago'; - } else { - timeText = ' days ago'; - } - return commentTimeDuration.inDays.toString() + timeText; - } else if (commentTimeDuration.inDays < 52) { - final int weeks = commentTimeDuration.inDays ~/ 7; - if (weeks == 1) { - timeText = ' week ago'; - } else { - timeText = ' weeks ago'; - } - return weeks.toString() + timeText; - } else { - final int years = commentTimeDuration.inDays ~/ 365; - if (years == 1) { - timeText = ' year ago'; - } else { - timeText = ' years ago'; - } - return years.toString() + timeText; - } - } - - String addNewline(String rawComment) { - // ignore: parameter_assignments - rawComment = rawComment.replaceAll(newLineKey, "\n"); - return rawComment; - } - - //main build starts here - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - Navigator.of(context).pop(isCommentAdded); - return true; - }, - child: Scaffold( - extendBodyBehindAppBar: true, - appBar: AppBar( - backgroundColor: Colors.transparent, - elevation: 0.0, - leading: GestureDetector( - onTap: () { - Navigator.of(context).pop(isCommentAdded); - }, - child: const Icon( - Icons.arrow_back, - color: Colors.black, - ), - ), - ), - resizeToAvoidBottomInset: false, - body: Column( - children: [ - Expanded( - flex: 4, - child: Stack( - children: [ - SizedBox.expand( - child: FittedBox( - fit: BoxFit.fill, - child: Image.asset( - UIData.shoppingImage, - ), - ), - ), - Align( - alignment: Alignment.bottomLeft, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Text( - widget.post['title'].toString(), - style: const TextStyle( - color: Colors.white, fontSize: 30.0), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - ), - ), - ], - ), - ), - Expanded( - flex: 10, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Flexible( - flex: 3, - child: Padding( - padding: const EdgeInsets.fromLTRB(20.0, 10, 10, 10), - child: Text( - widget.post['text'].toString(), - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.justify, - maxLines: 10, - ), - ), - ), - Flexible( - flex: 3, - child: ListTile( - leading: userDetails.isEmpty ? null : _profileImage(), - title: Container( - constraints: const BoxConstraints( - maxHeight: double.infinity, - // minHeight: 20, - ), - child: TextFormField( - key: const Key("leaveCommentField"), - textInputAction: TextInputAction.newline, - keyboardType: TextInputType.multiline, - validator: (String value) { - if (value.length > 500) { - return "Comment cannot be longer than 500 letters"; - } - if (value.isEmpty) { - return "Comment cannot be empty"; - } - return null; - }, - inputFormatters: [ - LengthLimitingTextInputFormatter(500) - ], - //minLines: 1,//Normal textInputField will be displayed - //maxLines: 10,// when user presses enter it will adapt to it - maxLines: null, - decoration: InputDecoration( - suffixIcon: IconButton( - key: const Key("leaveCommentButton"), - color: Colors.grey, - icon: const Icon(Icons.send), - onPressed: () { - print(commentController.text); - createComment(); - }, - ), - hintText: 'Leave a Comment...', - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(20.0), - borderSide: const BorderSide( - color: Colors.teal, - ), - ), - ), - controller: commentController, - ), - ), - ), - ), - Flexible( - flex: 10, - child: Container( - child: showLoadComments == false - ? Align( - alignment: Alignment.topCenter, - child: loadCommentsButton()) - : commentList()), - ), - ], - ), - ), - ], - ), - )); - } - - //this loads the comments button - Widget loadCommentsButton() { - return TextButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.grey[200]), - ), - onPressed: () { - setState(() { - showLoadComments = true; - }); - }, - child: const Text( - 'Load Comments', - style: TextStyle(color: Colors.black54), - )); - } - - // For getting length of Comments to be displayed - int getCommentslength() { - getPostComments(); - return comments.length; - } - - // a new widget for comment list - Widget commentList() { - int lenthOfCommentList = getCommentslength(); - - if (lenthOfCommentList > 3) { - if (moreComments == false) { - lenthOfCommentList = 3; - } - } - - return Column( - children: [ - ListTile( - key: const ValueKey('commentIcon'), - leading: const Icon(Icons.chat), - title: Text('${comments.length} Comments'), - ), - Flexible( - child: ListView.builder( - shrinkWrap: true, - physics: const ClampingScrollPhysics(), - itemCount: lenthOfCommentList, - itemBuilder: (context, index) { - return ListTile( - leading: const CircleAvatar( - backgroundColor: UIData.secondaryColor, - child: Icon( - Icons.person, - color: Colors.white10, - ), - ), - title: Text( - comments[index]['text'].toString(), - ), - subtitle: Row( - children: [ - Text( - '${comments[index]['creator']['firstName']} ${comments[index]['creator']['lastName']}'), - const Text( - " - ", - style: TextStyle( - fontSize: 20, - ), - ), - Text(commentTime(index)), - // Text(timer.hoursOrDays(comments[index]['createdAt'])) - ], - ), - ); - }), - ), - (moreComments || comments.length <= 3) - ? const SizedBox( - width: 0, - height: 0, - ) - : TextButton( - onPressed: () { - setState(() { - moreComments = true; - }); - }, - child: const Text("View More Comments")) - ], - ); - } - - void _exceptionToast(String msg) { - fToast.showToast( - child: ToastTile(msg: msg, success: false), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/newsfeed/newsfeed.dart b/lib/views/pages/newsfeed/newsfeed.dart deleted file mode 100644 index 2d92b325f..000000000 --- a/lib/views/pages/newsfeed/newsfeed.dart +++ /dev/null @@ -1,265 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; - -//pages are imported here -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/views/pages/newsfeed/add_post.dart'; -import 'package:talawa/views/pages/newsfeed/news_article.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/widgets/custom_appbar.dart'; -import 'package:talawa/views/widgets/loading.dart'; - -class NewsFeed extends StatelessWidget { - /// Get the list of posts - Future getPostsList(BuildContext context) async { - if (!Provider.of(context, listen: false).isPostEmpty) { - return; - } - await Provider.of(context, listen: false).getPosts(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: CustomAppBar('NewsFeed', key: const Key('NEWSFEED_APP_BAR')), - floatingActionButton: addPostFab(context), - body: FutureBuilder( - future: getPostsList(context), - builder: (BuildContext context, AsyncSnapshot snap) { - if (snap.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); - } - - return RefreshIndicator( - onRefresh: () async { - await Provider.of(context, listen: false) - .getPosts(); - }, - child: Provider.of(context).isPostEmpty - ? Center( - child: Loading( - isShowingError: - Provider.of(context).isErrorOccurred, - key: UniqueKey(), - )) - : Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: ListView.builder( - itemCount: Provider.of(context) - .getPostList - .length, - itemBuilder: (context, index) { - final Map post = - Provider.of(context) - .getPostList[index] as Map; - - return Container( - padding: EdgeInsets.only( - top: SizeConfig.safeBlockVertical * - 2.5), - child: Column( - children: [ - InkWell( - onTap: () { - pushNewScreen( - context, - screen: NewsArticle( - post: post, - index: index, - ), - ); - }, - child: Card( - color: Colors.white, - child: Column( - children: [ - Container( - padding: - const EdgeInsets.all( - 5.0), - child: ClipRRect( - borderRadius: - BorderRadius - .circular(20.0), - child: Image.asset( - UIData - .shoppingImage), - )), - Row(children: [ - SizedBox( - width: SizeConfig - .safeBlockHorizontal * - 7.5, - ), - // ignore: avoid_unnecessary_containers - Container( - child: Text( - post['title'].toString(), - style: const TextStyle( - fontWeight: - FontWeight.bold, - fontSize: 20.0, - ), - )), - ]), - SizedBox( - height: SizeConfig - .safeBlockVertical * - 1.25, - ), - Row(children: [ - SizedBox( - width: SizeConfig - .safeBlockHorizontal * - 7.5, - ), - // ignore: sized_box_for_whitespace - Container( - width: SizeConfig - .screenWidth - - SizeConfig - .safeBlockHorizontal * - 12.5, - child: Text( - post["text"] - .toString(), - textAlign: - TextAlign.justify, - overflow: TextOverflow - .ellipsis, - maxLines: 10, - style: - const TextStyle( - fontSize: 16.0, - ), - )), - ]), - Padding( - padding: - const EdgeInsets.all( - 10), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - children: [ - likeButton( - post, context), - commentCounter(post, - index, context), - Container( - width: SizeConfig - .safeBlockHorizontal * - 20) - ])), - ], - ), - ), - ), - ], - ), - ); - }), - ), - ], - ), - )); - }, - )); - } - - //function to add the post on the news feed - Widget addPostFab(BuildContext context) { - return FloatingActionButton( - heroTag: "btn2", - backgroundColor: UIData.secondaryColor, - onPressed: () { - pushNewScreenWithRouteSettings(context, - screen: const AddPost(), settings: const RouteSettings()); - }, - child: const Icon( - Icons.add, - color: Colors.white, - ), - ); - } - - //function which counts the number of comments on a particular post - Widget commentCounter(Map post, int index, BuildContext context) { - return Row( - children: [ - Text( - post['commentCount'].toString(), - style: const TextStyle( - color: Colors.grey, - fontSize: 16, - ), - ), - IconButton( - icon: const Icon(Icons.comment), - color: Colors.grey, - onPressed: () async { - pushNewScreenWithRouteSettings(context, - screen: NewsArticle( - post: post, - index: index, - ), - settings: const RouteSettings(), - withNavBar: false) - .then((value) { - //if (value != null && value) - if (value != null) { - Provider.of(context).getPosts(); - } - }); - }) - ], - ); - } - - //function to like - Widget likeButton(Map post, BuildContext context) { - final bool isPostLiked = - Provider.of(context).getLikePostMap[post['_id']]; - - return Row( - children: [ - Text( - post['likeCount'].toString(), - style: const TextStyle( - color: Colors.grey, - fontSize: 16, - ), - ), - IconButton( - icon: const Icon(Icons.thumb_up), - color: - isPostLiked ? const Color(0xff007397) : const Color(0xff9A9A9A), - onPressed: () { - if (post['likeCount'] != 0) { - if (isPostLiked == false) { - //If user has not liked the post addLike(). - Provider.of(context, listen: false) - .addLike(post['_id'].toString()); - } else { - Provider.of(context, listen: false) - .removeLike(post['_id'].toString()); - } - } else { - //if the likeCount is 0 addLike(). - Provider.of(context, listen: false) - .addLike(post['_id'].toString()); - } - }, - ), - ], - ); - } -} diff --git a/lib/views/pages/organization/accept_requests_page.dart b/lib/views/pages/organization/accept_requests_page.dart deleted file mode 100644 index 11af84b78..000000000 --- a/lib/views/pages/organization/accept_requests_page.dart +++ /dev/null @@ -1,275 +0,0 @@ -//flutter packages are imported here -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -//pages are imported here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -class AcceptRequestsPage extends StatefulWidget { - @override - _AcceptRequestsPageState createState() => _AcceptRequestsPageState(); -} - -class _AcceptRequestsPageState extends State { - final Queries _query = Queries(); - final Preferences _preferences = Preferences(); - static String itemIndex; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - FToast fToast; - final AuthController _authController = AuthController(); - List membershipRequestsList = []; - bool loaded = false; - bool processing = false; - - @override - void initState() { - //setting the initial state for the different variables - super.initState(); - fToast = FToast(); - fToast.init(context); - viewMemberShipRequests(); //this function is called here to get the request that are sent by the users to get the membership - } - - Future viewMemberShipRequests() async { - //Same function giving us the way that a administrator can see the request got from the user to get the membership - final String orgId = await _preferences.getCurrentOrgId(); - - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryResult result = await _client.query(QueryOptions( - documentNode: gql(_query.viewMembershipRequest( - orgId)))); //calling the graphql query to see the membership request - if (result.hasException) { - print(result.exception); - //showError(result.exception.toString()); - } else if (!result.hasException) { - print(result.data['organizations'][0]['membershipRequests']); - - setState(() { - membershipRequestsList = - result.data['organizations'][0]['membershipRequests'] as List; - loaded = true; - }); - - if (membershipRequestsList.isEmpty) { - _exceptionToast('You have no new requests.'); - } - } - } - - Future acceptMemberShipRequests() async { - setState(() { - processing = true; - }); - //this function give the functionality of accepting the request of the user by the administrator - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryResult result = await _client.query(QueryOptions( - documentNode: gql(_query.acceptMembershipRequest(itemIndex)))); - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return acceptMemberShipRequests(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - setState(() { - processing = false; - }); - _exceptionToast(result.exception.toString().substring(16)); - } else if (!result.hasException) { - setState(() { - processing = false; - }); - _successToast('Success'); - viewMemberShipRequests(); - } - } - - Future rejectMemberShipRequests() async { - setState(() { - processing = true; - }); - //this function give the functionality of rejecting the request of the user by the administrator - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryResult result = await _client.query(QueryOptions( - documentNode: gql(_query.rejectMembershipRequest(itemIndex)))); - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return rejectMemberShipRequests(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - setState(() { - processing = false; - }); - _exceptionToast(result.exception.toString().substring(16)); - } else if (!result.hasException) { - setState(() { - processing = false; - }); - _successToast('Success'); - viewMemberShipRequests(); - } - } - - @override - Widget build(BuildContext context) { - //building the UI page - return Scaffold( - appBar: AppBar( - title: const Text('Membership Requests', - style: TextStyle(color: Colors.white)), - ), - body: RefreshIndicator( - onRefresh: () async { - await viewMemberShipRequests(); - }, - child: (!loaded) - ? const Center( - child: CircularProgressIndicator(), - ) - : membershipRequestsList.isEmpty - ? Center( - child: Column( - children: [ - SizedBox( - height: SizeConfig.safeBlockVertical * 31.25, - ), - const Text( - "No request", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - ), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 6.25, - ), - ], - ), - ) - : ListView.builder( - //Builds list of awaiting membership requests - itemCount: membershipRequestsList.length, - itemBuilder: (context, index) { - final membershipRequests = membershipRequestsList[index]; - return Card( - child: ListTile( - leading: membershipRequests['user']['image'] != - null - ? CircleAvatar( - radius: - SizeConfig.safeBlockVertical * 3.75, - backgroundImage: NetworkImage(Provider.of< - GraphQLConfiguration>(context) - .displayImgRoute + - membershipRequests['user']['image'] - .toString())) - : CircleAvatar( - radius: - SizeConfig.safeBlockVertical * 3.75, - backgroundImage: const AssetImage( - "assets/images/team.png")), - title: Text( - '${membershipRequests['user']['firstName']} ${membershipRequests['user']['lastName']}'), - trailing: processing - ? const FittedBox( - child: CircularProgressIndicator(), - ) - : Wrap( - spacing: 4, - children: [ - IconButton( - iconSize: 26.0, - icon: const Icon(Icons.delete), - color: Colors.red, - onPressed: () { - itemIndex = - membershipRequests['_id'] - .toString(); - rejectMemberShipRequests(); - }, - ), - IconButton( - iconSize: 26.0, - icon: const Icon(Icons.check), - color: Colors.green, - onPressed: () { - itemIndex = - membershipRequests['_id'] - .toString(); - acceptMemberShipRequests(); - }, - ), - ], - ))); - }), - ), - ); - } - - Widget showError(BuildContext context, String msg) { - //function which will be called if there is some error in the program - return Center( - child: Text( - msg, - style: const TextStyle(fontSize: 16, color: Colors.black), - textAlign: TextAlign.center, - ), - ); - } - - _successToast(String msg) { - //function to be called when the request is successful - final Widget toast = Container( - padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.green, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } - - _exceptionToast(String msg) { - //this function is used when the exception is called - final Widget toast = Container( - padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 14.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/organization/create_organization.dart b/lib/views/pages/organization/create_organization.dart deleted file mode 100644 index b0f3685d7..000000000 --- a/lib/views/pages/organization/create_organization.dart +++ /dev/null @@ -1,562 +0,0 @@ -//flutter packages -import 'dart:io'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -//pages are imported here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/enums/image_from.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/utils/validator.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:graphql/utilities.dart' show multipartFileFrom; -import 'package:talawa/views/pages/_pages.dart'; -import 'package:image_picker/image_picker.dart'; - -class CreateOrganization extends StatefulWidget { - const CreateOrganization({this.isFromProfile = false}); - final bool isFromProfile; - - @override - _CreateOrganizationState createState() => _CreateOrganizationState(); -} - -class _CreateOrganizationState extends State { - //defining the Organization creation state - final orgNameController = TextEditingController(); - final orgDescController = TextEditingController(); - final orgMemberDescController = TextEditingController(); - final Queries _queries = Queries(); - bool _progressBarState = false; - final _validate = AutovalidateMode.disabled; - final _formKey = GlobalKey(); - int radioValue = -1; - int radioValue1 = -1; - bool isPublic = true; - bool isVisible = true; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - FToast fToast; - final AuthController _authController = AuthController(); - File _image; - - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - } - - void toggleProgressBarState() { - _progressBarState = !_progressBarState; - } - - createOrg() async { - //this is the function which will be called when the organization is created - final GraphQLClient _client = graphQLConfiguration.authClient(); - orgNameController.text = - orgNameController.text.trim().replaceAll('\n', ' '); - orgDescController.text = - orgDescController.text.trim().replaceAll('\n', ' '); - orgMemberDescController.text = - orgMemberDescController.text.trim().replaceAll('\n', ' '); - final img = await multipartFileFrom(_image); - orgNameController.text = - orgNameController.text.trim().replaceAll('\n', ' '); - orgDescController.text = - orgDescController.text.trim().replaceAll('\n', ' '); - orgMemberDescController.text = - orgMemberDescController.text.trim().replaceAll('\n', ' '); - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(_queries.createOrg( - orgNameController.text, - orgDescController.text, - orgMemberDescController.text, - isPublic: isPublic, - visibleInSearch: isVisible, - )), - variables: { - 'file': img, - }, - )); - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return createOrg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - print(result.exception); - setState(() { - _progressBarState = false; - }); - _exceptionToast(result.exception.toString()); - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = true; - }); - _successToast("Sucess!"); - print(result.data); - - if (widget.isFromProfile) { - Navigator.pop(context); - Navigator.pop(context); - } else { - Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (context) => const HomePage( - openPageIndex: 2, - ))); - } - } - } - - createOrgWithoutImg() async { - //the function is called when we are creating the organization without the display picture - final GraphQLClient _client = graphQLConfiguration.authClient(); - orgNameController.text = - orgNameController.text.trim().replaceAll('\n', ' '); - orgDescController.text = - orgDescController.text.trim().replaceAll('\n', ' '); - orgMemberDescController.text = - orgMemberDescController.text.trim().replaceAll('\n', ' '); - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(_queries.createOrgWithoutImg( - orgNameController.text, - orgDescController.text, - orgMemberDescController.text, - isPublic: isPublic, - visibleInSearch: isVisible, - )), - )); - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return createOrgWithoutImg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - print(result.exception); - setState(() { - _progressBarState = false; - }); - _exceptionToast(result.exception.toString()); - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = true; - }); - _successToast("Sucess!"); - print(result.data); - if (widget.isFromProfile) { - Navigator.pop(context); - Navigator.pop(context); - } else { - Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (context) => const HomePage( - openPageIndex: 2, - ))); - } - } - } - - //get image from camera and gallery based on the enum passed - _imgFrom({From pickFrom = From.none}) async { - File pickImageFile; - if (pickFrom != From.none) { - final PickedFile selectedImage = await ImagePicker().getImage( - source: pickFrom == From.camera - ? ImageSource.camera - : ImageSource.gallery); - pickImageFile = File(selectedImage.path); - setState(() { - _image = pickImageFile; - }); - } - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - leading: IconButton( - icon: const Icon(Icons.arrow_back), - onPressed: () { - Navigator.pop(context); - }, - ), - title: const Text('Create Organization'), - ), - body: Container( - color: Colors.white, - child: SingleChildScrollView( - padding: EdgeInsets.only(bottom: SizeConfig.safeBlockVertical * 1.25), - scrollDirection: Axis.vertical, - child: Column( - children: [ - addImage(), - const Text("Upload Organization Image", - style: TextStyle(fontSize: 16, color: Colors.black)), - Form( - key: _formKey, - autovalidateMode: _validate, - child: Padding( - padding: EdgeInsets.only( - left: SizeConfig.safeBlockHorizontal * 7.5, - right: SizeConfig.safeBlockHorizontal * 7.5), - child: Column( - children: [ - SizedBox( - height: SizeConfig.safeBlockVertical * 3.75, - ), - AutofillGroup( - child: Column( - children: [ - TextFormField( - keyboardType: TextInputType.multiline, - inputFormatters: [ - LengthLimitingTextInputFormatter(40) - ], - autofillHints: const [ - AutofillHints.organizationName - ], - validator: (value) => - Validator.validateOrgName(value), - textInputAction: TextInputAction.next, - textAlign: TextAlign.left, - textCapitalization: TextCapitalization.words, - style: const TextStyle(color: Colors.black), - decoration: InputDecoration( - border: OutlineInputBorder( - borderSide: const BorderSide( - color: UIData.secondaryColor), - borderRadius: BorderRadius.circular(20.0)), - prefixIcon: const Icon( - Icons.group, - color: UIData.secondaryColor, - ), - labelText: "Organization Name", - labelStyle: const TextStyle(color: Colors.black), - alignLabelWithHint: true, - hintText: 'My Organization', - hintStyle: const TextStyle(color: Colors.grey), - ), - controller: orgNameController, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - TextFormField( - inputFormatters: [ - LengthLimitingTextInputFormatter(5000), - ], - autofillHints: const [AutofillHints.impp], - keyboardType: TextInputType.multiline, - maxLines: null, - textCapitalization: TextCapitalization.words, - validator: (value) => - Validator.validateOrgDesc(value), - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.black), - decoration: InputDecoration( - border: OutlineInputBorder( - borderSide: const BorderSide( - color: UIData.secondaryColor), - borderRadius: BorderRadius.circular(20.0)), - prefixIcon: const Icon(Icons.note, - color: UIData.secondaryColor), - labelText: "Organization Description", - labelStyle: const TextStyle(color: Colors.black), - alignLabelWithHint: true, - hintText: 'My Description', - hintStyle: const TextStyle(color: Colors.grey), - ), - controller: orgDescController, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - TextFormField( - inputFormatters: [ - LengthLimitingTextInputFormatter(5000) - ], - autofillHints: const [AutofillHints.impp], - keyboardType: TextInputType.multiline, - maxLines: null, - textCapitalization: TextCapitalization.words, - validator: (value) => - Validator.validateOrgAttendeesDesc(value), - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.black), - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(20.0), - borderSide: const BorderSide( - color: UIData.secondaryColor)), - prefixIcon: const Icon(Icons.note, - color: UIData.secondaryColor), - labelText: "Member Description", - labelStyle: const TextStyle(color: Colors.black), - alignLabelWithHint: true, - hintText: 'Member Description', - hintStyle: const TextStyle(color: Colors.grey), - ), - controller: orgMemberDescController, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - ], - )), - const Text('Do you want your organization to be public?', - style: TextStyle(fontSize: 16, color: Colors.black)), - RadioListTile( - groupValue: radioValue, - title: const Text('Yes'), - value: 0, - activeColor: UIData.secondaryColor, - onChanged: (int val) { - FocusScope.of(context).unfocus(); - // ignore: void_checks - setState(() { - radioValue = val; - if (radioValue == 0) { - return isPublic; - } - }); - }, - ), - RadioListTile( - activeColor: UIData.secondaryColor, - groupValue: radioValue, - title: const Text('No'), - value: 1, - onChanged: (int val) { - FocusScope.of(context).unfocus(); - // ignore: void_checks - setState(() { - radioValue = val; - if (radioValue == 1) { - isPublic = false; - return isPublic; - } - }); - }, - ), - const Text( - 'Do you want others to be able to find your organization from the search page?', - style: TextStyle(fontSize: 16, color: Colors.black)), - RadioListTile( - activeColor: UIData.secondaryColor, - groupValue: radioValue1, - title: const Text('Yes'), - value: 0, - onChanged: (int val) { - FocusScope.of(context).unfocus(); - // ignore: void_checks - setState(() { - radioValue1 = val; - if (radioValue1 == 0) { - return isVisible; - } - }); - }, - ), - RadioListTile( - activeColor: UIData.secondaryColor, - groupValue: radioValue1, - title: const Text('No'), - value: 1, - onChanged: (int val) { - FocusScope.of(context).unfocus(); - // ignore: void_checks - setState(() { - radioValue1 = val; - if (radioValue1 == 1) { - isVisible = false; - return isVisible; - } - }); - }, - ), - Container( - padding: const EdgeInsets.symmetric( - vertical: 20.0, horizontal: 30.0), - width: double.infinity, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), - ), - ), - // ignore: sort_child_properties_last - child: _progressBarState - ? const Center( - child: SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator( - valueColor: - AlwaysStoppedAnimation( - Colors.white), - strokeWidth: 3, - backgroundColor: Colors.black, - ))) - : const Text( - "CREATE ORGANIZATION", - style: TextStyle(color: Colors.white), - ), - onPressed: _progressBarState - ? () { - _exceptionToast('Request in Progress'); - } - : () async { - if (_formKey.currentState.validate() && - radioValue >= 0 && - radioValue1 >= 0) { - _formKey.currentState.save(); - if (_image != null) { - createOrg(); - } else { - createOrgWithoutImg(); - } - setState(() { - toggleProgressBarState(); - }); - } else if (radioValue < 0 || - radioValue1 < 0) { - _exceptionToast( - "A choice must be selected"); - } - }, - ), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ); - } - - Widget addImage() { - //function which is being called when the image is being add - return Column( - children: [ - SizedBox( - height: SizeConfig.safeBlockVertical * 4, - ), - Center( - child: GestureDetector( - onTap: () { - _showPicker(context); - }, - child: CircleAvatar( - radius: SizeConfig.safeBlockVertical * 6.875, - backgroundColor: UIData.secondaryColor, - child: _image != null - ? CircleAvatar( - radius: SizeConfig.safeBlockVertical * 6.5, - backgroundImage: FileImage( - _image, - ), - ) - : CircleAvatar( - radius: SizeConfig.safeBlockVertical * 6.5, - backgroundColor: Colors.lightBlue[50], - child: Icon( - Icons.camera_alt, - color: Colors.grey[800], - ), - ), - ), - ), - ) - ], - ); - } - - void _showPicker(BuildContext context) { - //this is called when the image is clicked and it shows the options that can be used to take the picture - showModalBottomSheet( - context: context, - builder: (BuildContext context) { - return SafeArea( - child: Wrap( - children: [ - ListTile( - //taking picture from the camera - leading: const Icon(Icons.camera_alt_outlined), - title: const Text('Camera'), - onTap: () { - _imgFrom(pickFrom: From.camera); - Navigator.of(context).pop(); - }, - ), - ListTile( - //taking picture from the library - leading: const Icon(Icons.photo_library), - title: const Text('Photo Library'), - onTap: () { - _imgFrom(pickFrom: From.gallery); - Navigator.of(context).pop(); - }), - ], - ), - ); - }); - } - - void _successToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 5, - vertical: SizeConfig.safeBlockVertical * 1.5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.green, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 1), - ); - } - - void _exceptionToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 6, - vertical: SizeConfig.safeBlockVertical * 1.75), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 1), - ); - } -} diff --git a/lib/views/pages/organization/join_organization.dart b/lib/views/pages/organization/join_organization.dart deleted file mode 100644 index 7d85ae4ec..000000000 --- a/lib/views/pages/organization/join_organization.dart +++ /dev/null @@ -1,729 +0,0 @@ -import 'dart:io'; -//flutter packages are imported here -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -//Pages are imported here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:talawa/views/pages/home_page.dart'; -import 'package:talawa/views/pages/organization/profile_page.dart'; -import 'package:talawa/views/widgets/loading.dart'; - -import 'create_organization.dart'; - -class JoinOrganization extends StatefulWidget { - const JoinOrganization({this.msg, this.fromProfile = false}); - final bool fromProfile; - final String msg; - @override - _JoinOrganizationState createState() => _JoinOrganizationState(); -} - -class _JoinOrganizationState extends State { - final Queries _query = Queries(); - final Preferences _pref = Preferences(); - String token; - static String itemIndex; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - FToast fToast; - List organizationInfo = []; - List filteredOrgInfo = []; - List joinedOrg = []; - final AuthController _authController = AuthController(); - String isPublic; - TextEditingController searchController = TextEditingController(); - bool _isLoaderActive = false; - bool disposed = false; - int loadingIndex = -1; - - // Variables for filtering out alread joined - // and created organizations. - String currentUserId; - List joinedOrganizations = []; - List joinedOrganizationsIds = []; - - @override - void initState() { - //creating the initial state for all the variables - super.initState(); - fToast = FToast(); - fToast.init(context); - fetchOrg(); - } - - @override - void dispose() { - disposed = true; - super.dispose(); - } - - // Function for getting the current user id. - Future getCurrentUserId() async { - currentUserId = await _pref.getUserId(); - } - - void searchOrgName(String orgName) { - //it is the search bar to search the organization - filteredOrgInfo.clear(); - if (orgName.isNotEmpty) { - for (int i = 0; i < organizationInfo.length; i++) { - final String name = organizationInfo[i]['name'].toString(); - if (name.toLowerCase().contains(orgName.toLowerCase())) { - setState(() { - filteredOrgInfo.add(organizationInfo[i]); - }); - } - } - } else { - setState(() { - filteredOrgInfo.add(organizationInfo); - }); - } - } - - Future fetchOrg() async { - // Get current User Id. - getCurrentUserId(); - - //function to fetch the org from the server - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryResult result = await _client - .query(QueryOptions(documentNode: gql(_query.fetchOrganizations))); - - // Get the details of the current user. - final QueryResult userDetailsResult = await _client.query(QueryOptions( - documentNode: gql(_query.fetchUserInfo), - variables: {'id': currentUserId})); - - if (result.hasException || userDetailsResult.hasException) { - print(result.exception); - showError(result.exception.toString()); - } else if (!result.hasException && - !disposed && - !userDetailsResult.hasException) { - setState(() { - organizationInfo = result.data['organizations'] as List; - - // Get the details of joined organizations. - joinedOrganizations = - userDetailsResult.data['users'][0]['joinedOrganizations'] as List; - - // Get the id's of joined organizations. - joinedOrganizations.forEach((element) { - joinedOrganizationsIds.add(element['_id']); - }); - - // Filtering out organizations that are created by current user. - organizationInfo = organizationInfo - .where((element) => element['admins'][0]['_id'] != currentUserId) - .toList(); - - // Filtering out organizations that are already joined by user. - joinedOrganizationsIds.forEach((e) { - print(e); - organizationInfo = - organizationInfo.where((element) => element['_id'] != e).toList(); - }); - }); - } - } - - Future joinPrivateOrg() async { - //function called if the person wants to enter a private organization - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(_query.sendMembershipRequest(itemIndex)))); - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return joinPrivateOrg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - _exceptionToast(result.exception.toString().substring(16)); - } else if (!result.hasException && !result.loading) { - print(result.data); - _successToast("Request Sent to Organization Admin"); - - if (widget.fromProfile) { - Navigator.pop(context); - } else { - Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (context) => const HomePage( - openPageIndex: 4, - ), - )); - } - } - } - - Future joinPublicOrg(String orgName) async { - //function which will be called if the person wants to join the organization which is not private - final GraphQLClient _client = graphQLConfiguration.authClient(); - - print(orgName); - - final QueryResult result = await _client - .mutate(MutationOptions(documentNode: gql(_query.getOrgId(itemIndex)))); - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - _exceptionToast(result.exception.toString().substring(16)); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - _exceptionToast(result.exception.toString().substring(16)); - } else if (!result.hasException && !result.loading) { - setState(() { - joinedOrg = result.data['joinPublicOrganization']['joinedOrganizations'] - as List; - }); - - //set the default organization to the first one in the list - - if (joinedOrg.length == 1) { - final String currentOrgId = result.data['joinPublicOrganization'] - ['joinedOrganizations'][0]['_id'] - .toString(); - await _pref.saveCurrentOrgId(currentOrgId); - final String currentOrgImgSrc = result.data['joinPublicOrganization'] - ['joinedOrganizations'][0]['image'] - .toString(); - await _pref.saveCurrentOrgImgSrc(currentOrgImgSrc); - final String currentOrgName = result.data['joinPublicOrganization'] - ['joinedOrganizations'][0]['name'] - .toString(); - await _pref.saveCurrentOrgName(currentOrgName); - } else { - // If there are multiple number of organizations. - for (int i = 0; i < joinedOrg.length; i++) { - if (joinedOrg[i]['name'] == orgName) { - final String currentOrgId = result.data['joinPublicOrganization'] - ['joinedOrganizations'][i]['_id'] - .toString(); - await _pref.saveCurrentOrgId(currentOrgId); - final String currentOrgImgSrc = result - .data['joinPublicOrganization']['joinedOrganizations'][i] - ['image'] - .toString(); - await _pref.saveCurrentOrgImgSrc(currentOrgImgSrc); - final String currentOrgName = result.data['joinPublicOrganization'] - ['joinedOrganizations'][i]['name'] - .toString(); - await _pref.saveCurrentOrgName(currentOrgName); - } - } - } - _successToast("Success!"); - - //Navigate user to newsfeed - if (widget.fromProfile) { - pushNewScreen( - context, - screen: const ProfilePage(), - ); - } else { - Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (context) => const HomePage( - openPageIndex: 4, - ), - ), - ); - } - } - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('Join Organization', - style: TextStyle(color: Colors.white)), - ), - body: organizationInfo.isEmpty - ? Center( - child: Loading( - key: UniqueKey(), - )) - : Container( - color: const Color(0xffF3F6FF), - padding: EdgeInsets.symmetric( - vertical: SizeConfig.safeBlockVertical * 0.75, - horizontal: SizeConfig.safeBlockHorizontal * 4), - child: Column( - children: [ - const Text( - "Welcome, \nJoin or Create your organization to get started", - style: TextStyle( - color: Colors.black, - fontSize: 18, - fontStyle: FontStyle.normal), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2, - ), - TextFormField( - onChanged: (value) { - searchOrgName(value); - }, - controller: searchController, - textAlign: TextAlign.left, - style: const TextStyle(fontSize: 14), - decoration: InputDecoration( - contentPadding: const EdgeInsets.all(5), - fillColor: Colors.white, - filled: true, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: - const BorderSide(color: Colors.white, width: 0.0), - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: - const BorderSide(color: Colors.white, width: 0.0), - ), - prefixIcon: const Padding( - padding: EdgeInsets.all(0.0), - child: Icon(Icons.search, color: Colors.black), - ), - hintText: "Search Organization Name"), - ), - SizedBox(height: SizeConfig.safeBlockVertical * 2), - Expanded( - child: Container( - color: const Color(0xffF3F6FF), - child: searchController.text.isNotEmpty - ? ListView.builder( - itemCount: filteredOrgInfo.length, - itemBuilder: (context, index) { - final organization = filteredOrgInfo[index]; - return Card( - child: ListTile( - leading: organization['image'] != null - ? CircleAvatar( - radius: SizeConfig - .safeBlockVertical * - 3.75, - backgroundImage: NetworkImage( - Provider.of( - context) - .displayImgRoute + - organization['image'] - .toString())) - : CircleAvatar( - radius: SizeConfig - .safeBlockVertical * - 3.75, - backgroundImage: const AssetImage( - "assets/images/team.png")), - title: organization['isPublic'] - .toString() != - 'false' - ? Row( - children: [ - Flexible( - child: Text( - organization['name'] - .toString(), - maxLines: 2, - overflow: - TextOverflow.ellipsis, - ), - ), - const Icon(Icons.lock_open, - color: Colors.green, - size: 16) - ], - ) - : Row( - children: [ - Flexible( - child: Text( - organization['name'] - .toString(), - maxLines: 2, - overflow: - TextOverflow.ellipsis, - ), - ), - const Icon(Icons.lock, - color: Colors.red, - size: 16) - ], - ), - subtitle: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - organization['description'] - .toString(), - maxLines: 2, - overflow: - TextOverflow.ellipsis), - Text( - 'Created by: ${organization['creator']['firstName']} ${organization['creator']['lastName']}', - maxLines: 2, - overflow: - TextOverflow.ellipsis), - ], - ), - trailing: ElevatedButton( - style: ButtonStyle( - backgroundColor: - MaterialStateProperty.all< - Color>(UIData.primaryColor), - shape: MaterialStateProperty.all< - OutlinedBorder>( - RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0), - )), - ), - onPressed: () { - itemIndex = - organization['_id'].toString(); - if (organization['isPublic'] - .toString() == - 'false') { - setState(() { - isPublic = 'false'; - }); - } else { - setState(() { - isPublic = 'true'; - }); - } - confirmOrgDialog( - organization['name'].toString(), - index); - }, - child: _isLoaderActive == true && - loadingIndex == index - ? SizedBox( - width: SizeConfig - .safeBlockHorizontal * - 5, - height: SizeConfig - .safeBlockVertical * - 2.5, - child: - const CircularProgressIndicator( - valueColor: - AlwaysStoppedAnimation< - Color>( - Colors.white), - strokeWidth: 3, - backgroundColor: - Colors.black, - )) - : const Text("JOIN"), - ), - isThreeLine: true, - ), - ); - }) - : ListView.builder( - itemCount: organizationInfo.length, - itemBuilder: (context, index) { - final organization = - organizationInfo[index]; - return Card( - child: ListTile( - leading: organization['image'] != null - ? CircleAvatar( - radius: SizeConfig - .safeBlockVertical * - 3.75, - backgroundImage: NetworkImage( - Provider.of( - context) - .displayImgRoute + - organization['image'] - .toString())) - : CircleAvatar( - radius: SizeConfig - .safeBlockVertical * - 3.75, - backgroundImage: const AssetImage( - "assets/images/team.png")), - title: organization['isPublic'] - .toString() != - 'false' - ? Row( - children: [ - Flexible( - child: Text( - organization['name'] - .toString(), - maxLines: 2, - overflow: - TextOverflow.ellipsis, - ), - ), - Icon(Icons.lock_open, - color: Colors.green, - size: SizeConfig - .safeBlockVertical * - 2) - ], - ) - : Row( - children: [ - Flexible( - child: Text( - organization['name'] - .toString(), - maxLines: 2, - overflow: - TextOverflow.ellipsis, - ), - ), - Icon(Icons.lock, - color: Colors.red, - size: SizeConfig - .safeBlockVertical * - 2) - ], - ), - subtitle: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - organization['description'] - .toString(), - maxLines: 2, - overflow: - TextOverflow.ellipsis), - Text( - 'Created by: ${organization['creator']['firstName']} ${organization['creator']['lastName']}', - maxLines: 2, - overflow: - TextOverflow.ellipsis), - ], - ), - trailing: ElevatedButton( - style: ButtonStyle( - backgroundColor: - MaterialStateProperty.all< - Color>(UIData.primaryColor), - shape: MaterialStateProperty.all< - OutlinedBorder>( - RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0), - )), - ), - onPressed: () { - itemIndex = - organization['_id'].toString(); - if (organization['isPublic'] - .toString() == - 'false') { - setState(() { - isPublic = 'false'; - }); - } else { - setState(() { - isPublic = 'true'; - }); - } - confirmOrgDialog( - organization['name'].toString(), - index); - }, - child: _isLoaderActive == true && - loadingIndex == index - ? SizedBox( - width: SizeConfig - .safeBlockHorizontal * - 5, - height: SizeConfig - .safeBlockVertical * - 2.5, - child: - const CircularProgressIndicator( - valueColor: - AlwaysStoppedAnimation< - Color>( - Colors.white), - strokeWidth: 3, - backgroundColor: - Colors.black, - )) - : const Text("JOIN"), - ), - isThreeLine: true, - ), - ); - }))) - ], - )), - floatingActionButton: FloatingActionButton( - backgroundColor: UIData.secondaryColor, - foregroundColor: Colors.white, - elevation: 5.0, - onPressed: () { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => CreateOrganization( - isFromProfile: widget.fromProfile, - ))); - }, - child: const Icon(Icons.add), - ), - floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, - ); - } - - void confirmOrgDialog(String orgName, int index) { - //this is the pop up shown when the confirmation is required - if (Platform.isIOS) { - showCupertinoDialog( - context: context, - useRootNavigator: false, - builder: (_) => CupertinoAlertDialog( - title: const Text("Confirmation"), - content: - const Text("Are you sure you want to join this organization?"), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("Close"), - ), - TextButton( - onPressed: () async { - setState(() { - loadingIndex = index; - _isLoaderActive = true; - }); - Navigator.of(context).pop(); - if (isPublic == 'true') { - await joinPublicOrg(orgName).whenComplete(() => setState(() { - loadingIndex = -1; - _isLoaderActive = false; - })); - } else if (isPublic == 'false') { - await joinPrivateOrg().whenComplete(() => setState(() { - loadingIndex = -1; - _isLoaderActive = false; - })); - } - }, - child: const Text("Yes"), - ) - ], - ), - ); - } else { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: const Text("Confirmation"), - content: const Text( - "Are you sure you want to join this organization?"), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("Close"), - ), - TextButton( - onPressed: () async { - setState(() { - loadingIndex = index; - _isLoaderActive = true; - }); - Navigator.of(context).pop(); - if (isPublic == 'true') { - await joinPublicOrg(orgName) - .whenComplete(() => setState(() { - loadingIndex = -1; - _isLoaderActive = false; - })); - } else if (isPublic == 'false') { - await joinPrivateOrg().whenComplete(() => setState(() { - loadingIndex = -1; - _isLoaderActive = false; - })); - } - }, - child: const Text("Yes"), - ) - ], - ); - }); - } - } - - Widget showError(String msg) { - return Center( - child: Text( - msg, - style: const TextStyle(fontSize: 16), - textAlign: TextAlign.center, - ), - ); - } - - _successToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 5, - vertical: SizeConfig.safeBlockVertical * 1.5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.green, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } - - _exceptionToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 6, - vertical: SizeConfig.safeBlockVertical * 1.75), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Text(msg), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/organization/organization_members.dart b/lib/views/pages/organization/organization_members.dart deleted file mode 100644 index 852d71a35..000000000 --- a/lib/views/pages/organization/organization_members.dart +++ /dev/null @@ -1,326 +0,0 @@ -//flutter imported packages -import 'dart:math' as math; -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -//pages are imported here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; - -import 'package:talawa/views/widgets/alert_dialog_box.dart'; -import 'package:talawa/views/widgets/toast_tile.dart'; - -class OrganizationMembers extends StatefulWidget { - @override - _OrganizationMembersState createState() => _OrganizationMembersState(); -} - -class _OrganizationMembersState extends State - with SingleTickerProviderStateMixin { - final Preferences _preferences = Preferences(); - AnimationController _controller; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - final AuthController _authController = AuthController(); - List membersList = []; - List adminsList = []; - List selectedMembers = []; - FToast fToast; - bool forward = false; - bool processing = false; - String userId; - final Queries _query = Queries(); - String creatorId; - - //giving initial states to every variable - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - _controller = AnimationController( - vsync: this, - duration: const Duration(milliseconds: 500), - ); - viewMembers(); - } - - //method to show the members of the organization - Future viewMembers() async { - final String orgId = await _preferences.getCurrentOrgId(); - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryResult result = await _client - .query(QueryOptions(documentNode: gql(_query.fetchOrgById(orgId)))); - if (result.hasException) { - print(result.exception); - //showError(result.exception.toString()); - _exceptionToast(result.exception.toString()); - } else if (!result.hasException) { - result.data['organizations'][0]['admins'] - .forEach((admin) => adminsList.add(admin['_id'])); - setState(() { - creatorId = - result.data['organizations'][0]['creator']['_id'].toString(); - membersList = result.data['organizations'][0]['members'] as List; - }); - if (membersList.length == 1) { - _exceptionToast('You are alone here.'); - } - } - } - - //method called when a member has to be removed by the admin - Future removeMembers() async { - setState(() { - processing = true; - }); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final String orgId = await _preferences.getCurrentOrgId(); - - final QueryResult result = await _client.query(QueryOptions( - documentNode: gql(_query.removeMember(orgId, selectedMembers)))); - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return removeMembers(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - print(result.exception.toString().substring(16)); - _exceptionToast(result.exception.toString()); - setState(() { - processing = false; - }); - } else if (!result.hasException) { - selectedMembers = []; - setState(() { - processing = false; - }); - _successToast('Member(s) removed successfully'); - viewMembers(); - } - } - - Future addAdmin() async { - setState(() { - processing = true; - }); - if (!adminsList.contains(selectedMembers[0])) { - final GraphQLClient _client = graphQLConfiguration.authClient(); - final String orgId = await _preferences.getCurrentOrgId(); - final QueryResult result = await _client.query(QueryOptions( - documentNode: - gql(_query.addAdmin(orgId, selectedMembers[0].toString())))); - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return addAdmin(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - print(result.exception.toString().substring(16)); - _exceptionToast("Something went wrong!Try again later"); - setState(() { - processing = false; - }); - } else if (!result.hasException) { - selectedMembers = []; - setState(() { - processing = false; - }); - _successToast('Admin created'); - viewMembers(); - } - } else { - _exceptionToast('Already an admin'); - } - } - - //add or remove selected members from list - void _onMemberSelected(bool selected, String memberId) { - if (selected == true) { - if (!adminsList.contains(memberId)) { - setState(() { - selectedMembers.add('"$memberId"'); - }); - } else { - _exceptionToast("Can't select admins"); - } - } else { - setState(() { - selectedMembers.remove('"$memberId"'); - }); - } - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('Organization Members', - style: TextStyle(color: Colors.white)), - ), - body: Stack( - children: [ - processing - ? Container( - color: Colors.transparent.withOpacity(0.3), - child: const Center( - child: CircularProgressIndicator(), - ), - ) - : const SizedBox(), - membersList.isEmpty - ? const Center(child: CircularProgressIndicator()) - : ListView.separated( - itemCount: membersList.length, - itemBuilder: (context, index) { - final members = membersList[index]; - final String mId = members['_id'].toString(); - final String name = - '${members['firstName']} ${members['lastName']}'; - return CheckboxListTile( - secondary: members['image'] != null - ? CircleAvatar( - radius: SizeConfig.safeBlockVertical * 3.75, - backgroundImage: NetworkImage( - Provider.of(context) - .displayImgRoute + - members['image'].toString())) - : CircleAvatar( - radius: SizeConfig.safeBlockVertical * 3.75, - backgroundColor: Colors.white, - child: Text( - members['firstName'] - .toString() - .substring(0, 1) - .toUpperCase() + - members['lastName'] - .toString() - .substring(0, 1) - .toUpperCase(), - style: const TextStyle( - color: UIData.primaryColor, - fontSize: 22, - )), - ), - title: Text(name), - subtitle: Text(adminsList.contains(mId) ? 'Admin' : ''), - value: selectedMembers.contains('"$mId"'), - onChanged: (bool value) { - _onMemberSelected(value, members['_id'].toString()); - }, - ); - }, - separatorBuilder: (BuildContext context, int index) { - return const Divider(); - }, - ), - ], - ), - floatingActionButton: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: List.generate(2, (int index) { - final Widget child = Container( - margin: const EdgeInsets.only(bottom: 15), - alignment: FractionalOffset.bottomRight, - child: ScaleTransition( - scale: CurvedAnimation( - parent: _controller, - curve: Interval(0.0, 1.0 - index, curve: Curves.easeOut), - ), - child: FloatingActionButton.extended( - heroTag: null, - backgroundColor: UIData.secondaryColor, - tooltip: index == 0 ? "Remove" : "Admin", - icon: Icon( - index == 0 ? Icons.delete : Icons.admin_panel_settings, - color: Colors.white), - label: Text(index == 0 ? "Remove" : "Admin"), - onPressed: () { - if (index == 0) { - dialog( - "Are you sure you want to remove selected member(s)?", - removeMembers); - } else if (index == 1) { - if (selectedMembers.length == 1) { - dialog( - "Are you sure you want to make selected member and admin?", - addAdmin); - } else { - _exceptionToast('You can make one admin at a time'); - } - } - }, - ), - ), - ); - return child; - }).toList() - ..add( - FloatingActionButton( - heroTag: null, - onPressed: () { - setState(() { - forward = !forward; - }); - if (_controller.isDismissed) { - _controller.forward(); - } else { - _controller.reverse(); - } - }, - child: AnimatedBuilder( - animation: _controller, - builder: (BuildContext context, Widget child) { - return Transform( - transform: - Matrix4.rotationZ(_controller.value * 1 * math.pi), - alignment: FractionalOffset.center, - child: const Icon(Icons.expand_more), - ); - }, - ), - ), - ), - ), - ); - } - - //dialog to confirm if the admin really wants to remove the member or not - void dialog(String msg, Function function) { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertBox( - message: msg, - function: function, - ); - }); - } - - _successToast(String msg) { - fToast.showToast( - child: ToastTile(msg: msg, success: true), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } - - _exceptionToast(String msg) { - fToast.showToast( - child: ToastTile( - msg: msg, - success: false, - ), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/organization/organization_settings.dart b/lib/views/pages/organization/organization_settings.dart deleted file mode 100644 index 18dd6819e..000000000 --- a/lib/views/pages/organization/organization_settings.dart +++ /dev/null @@ -1,317 +0,0 @@ -//flutter packages are called here -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -//pages are called here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/organization/accept_requests_page.dart'; -import 'package:talawa/views/pages/organization/profile_page.dart'; -import 'package:talawa/views/pages/organization/organization_members.dart'; -import 'package:talawa/views/widgets/alert_dialog_box.dart'; -import 'package:talawa/views/widgets/toast_tile.dart'; -import 'update_organization.dart'; - -class OrganizationSettings extends StatefulWidget { - const OrganizationSettings({this.public, this.creator, this.organization}); - - final bool public; - final bool creator; - final List organization; - @override - _OrganizationSettingsState createState() => _OrganizationSettingsState(); -} - -class _OrganizationSettingsState extends State { - final Preferences _preferences = Preferences(); - final Queries _query = Queries(); - final AuthController _authController = AuthController(); - final OrgController _orgController = OrgController(); - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - FToast fToast; - bool processing = false; - - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - } - - Future leaveOrg() async { - setState(() { - processing = true; - }); - List remaindingOrg = []; - String newOrgId; - String newOrgName; - final GraphQLClient _client = graphQLConfiguration.authClient(); - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: - gql(_query.leaveOrg(widget.organization[0]['_id'].toString())))); - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return leaveOrg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - setState(() { - processing = false; - }); - _exceptionToast(result.exception.toString().substring(16)); - } else if (!result.hasException && !result.loading) { - //set org at the top of the list as the new current org - setState(() { - remaindingOrg = - result.data['leaveOrganization']['joinedOrganizations'] as List; - if (remaindingOrg.isEmpty) { - newOrgId = null; - } else if (remaindingOrg.isNotEmpty) { - setState(() { - newOrgId = result.data['leaveOrganization']['joinedOrganizations'] - [0]['_id'] - .toString(); - newOrgName = result.data['leaveOrganization']['joinedOrganizations'] - [0]['name'] - .toString(); - }); - } - processing = false; - }); - - _orgController.setNewOrg(context, newOrgId, newOrgName); - Provider.of(context, listen: false) - .saveCurrentOrgName(newOrgName); - Provider.of(context, listen: false) - .saveCurrentOrgId(newOrgId); - _successToast('You are no longer apart of this organization'); - pushNewScreen( - context, - screen: const ProfilePage(), - ); - } - } - - Future removeOrg() async { - setState(() { - processing = true; - }); - //this is called the organization has to be removed - final String orgId = await _preferences.getCurrentOrgId(); - List remaindingOrg = []; - String newOrgId; - String newOrgName; - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryResult result = await _client - .mutate(MutationOptions(documentNode: gql(_query.removeOrg(orgId)))); - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return removeOrg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - Navigator.of(context).pop(); - setState(() { - processing = false; - }); - //_exceptionToast(result.exception.toString().substring(16)); - } else if (!result.hasException && !result.loading) { - _successToast('Successfully Removed Organization'); - setState(() { - remaindingOrg = - result.data['removeOrganization']['joinedOrganizations'] as List; - if (remaindingOrg.isEmpty) { - newOrgId = null; - } else if (remaindingOrg.isNotEmpty) { - newOrgId = result.data['removeOrganization']['joinedOrganizations'][0] - ['_id'] - .toString(); - newOrgName = result.data['removeOrganization']['joinedOrganizations'] - [0]['name'] - .toString(); - } - processing = false; - }); - - _orgController.setNewOrg(context, newOrgId, newOrgName); - Provider.of(context, listen: false) - .saveCurrentOrgName(newOrgName); - Provider.of(context, listen: false) - .saveCurrentOrgId(newOrgId); - Navigator.of(context).pop(); - pushNewScreen( - context, - screen: const ProfilePage(), - ); - } - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('Organization Settings', - style: TextStyle(color: Colors.white)), - ), - body: Stack( - children: [ - processing - ? Container( - color: Colors.transparent.withOpacity(0.3), - child: const Center( - child: CircularProgressIndicator(), - ), - ) - : const SizedBox(), - Container( - child: Column(children: [ - ListTile( - key: const Key('Update Organization'), - title: const Text( - 'Update Organization', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.update, - color: UIData.secondaryColor, - ), - onTap: () { - pushNewScreen( - context, - screen: UpdateOrganization( - description: widget.organization[0]['description'] - .toString(), - name: widget.organization[0]['name'].toString(), - isPublic: - (widget.organization[0]['isPublic'] as bool) - ? 0 - : 1, - isVisible: widget.organization[0] - ['visibleInSearch'] == - null - ? -1 - : (widget.organization[0][0]['visibleInSearch'] - as bool) - ? 0 - : 1), - ); - }), - const Divider(), - widget.public - ? const SizedBox() - : ListTile( - key: const Key('Accept MemberShip Requests'), - title: const Text( - 'Accept MemberShip Requests', - style: TextStyle(fontSize: 18.0), - ), - subtitle: const Text( - 'For Private Organizations', - ), - leading: const Icon( - Icons.group_add, - color: UIData.secondaryColor, - ), - onTap: () { - pushNewScreen( - context, - screen: AcceptRequestsPage(), - ); - }), - widget.public ? const SizedBox() : const Divider(), - ListTile( - key: const Key('Member(s)'), - title: const Text( - 'Member(s)', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.person, - color: UIData.secondaryColor, - ), - onTap: () { - pushNewScreen( - context, - screen: OrganizationMembers(), - ); - }), - const Divider(), - widget.creator - ? ListTile( - key: const Key('Remove This Organization'), - title: const Text( - 'Remove This Organization', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.delete, - color: UIData.secondaryColor, - ), - onTap: () async { - if (!widget.creator) { - _exceptionToast( - 'Creator can only remove organization'); - } - showDialog( - context: context, - builder: (BuildContext context) { - return AlertBox( - message: - "Are you sure you want to remove this organization?", - function: removeOrg, - ); - }); - }) - : ListTile( - key: const Key('Leave Organization'), - title: const Text( - 'Leave Organization', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.person, - color: UIData.secondaryColor, - ), - onTap: () { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertBox( - message: - "Are you sure you want to leave this organization?", - function: leaveOrg, - ); - }); - }), - ]), - ), - ], - )); - } - - void _successToast(String msg) { - fToast.showToast( - child: ToastTile(msg: msg, success: true), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } - - void _exceptionToast(String msg) { - fToast.showToast( - child: ToastTile(msg: msg, success: false), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/organization/profile_page.dart b/lib/views/pages/organization/profile_page.dart deleted file mode 100644 index 128c834d7..000000000 --- a/lib/views/pages/organization/profile_page.dart +++ /dev/null @@ -1,561 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/cupertino.dart'; -//flutter packages are imported here -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:provider/provider.dart'; - -//pages are imported here -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:talawa/views/pages/organization/join_organization.dart'; -import 'package:talawa/views/pages/organization/update_profile_page.dart'; -import 'package:talawa/views/widgets/about_tile.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:talawa/views/pages/organization/organization_settings.dart'; - -import 'package:talawa/views/widgets/alert_dialog_box.dart'; -import 'package:talawa/views/widgets/loading.dart'; -import 'switch_org_page.dart'; - -class ProfilePage extends StatefulWidget { - const ProfilePage({this.isCreator, this.test}); - final bool isCreator; - final List test; - @override - _ProfilePageState createState() => _ProfilePageState(); -} - -class _ProfilePageState extends State { - @override - void setState(fn) { - if (mounted) { - super.setState(fn); - } - } - - final Queries _query = Queries(); - final Preferences _preferences = Preferences(); - final AuthController _authController = AuthController(); - List userDetails = []; - List orgAdmin = []; - List org = []; - List admins = []; - List curOrganization = []; - bool isCreator; - bool isPublic; - String creator; - String userID; - String orgName; - final OrgController _orgController = OrgController(); - String orgId; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - FToast fToast; - - //providing initial states to the variables - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - if (widget.isCreator != null && widget.test != null) { - userDetails = widget.test; - isCreator = widget.isCreator; - org = userDetails[0]['joinedOrganizations'] as List; - } - //Provider.of(context, listen: false).getCurrentOrgName(); - fetchUserDetails(); - } - - //used to fetch the users details from the server - Future fetchUserDetails() async { - orgName = await _preferences.getCurrentOrgName(); - orgId = await _preferences.getCurrentOrgId(); - userID = await _preferences.getUserId(); - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - final QueryResult result = await _client.query(QueryOptions( - documentNode: gql(_query.fetchUserInfo), variables: {'id': userID})); - if (result.hasException) { - print(result.exception); - _exceptionToast("Something went wrong!"); - } else if (!result.hasException) { - print(result); - setState(() { - userDetails = result.data['users'] as List; - org = userDetails[0]['joinedOrganizations'] as List; - }); - print(userDetails); - int notFound = 0; - for (int i = 0; i < org.length; i++) { - if (org[i]['_id'] == orgId) { - break; - } else { - notFound++; - } - } - if (notFound == org.length && org.isNotEmpty) { - _orgController.setNewOrg( - context, org[0]['_id'].toString(), org[0]['name'].toString()); - Provider.of(context, listen: false) - .saveCurrentOrgName(org[0]['name'].toString()); - Provider.of(context, listen: false) - .saveCurrentOrgId(org[0]['_id'].toString()); - await _preferences.saveCurrentOrgImgSrc(org[0]['image'].toString()); - } - fetchOrgAdmin(); - } - } - - //used to fetch Organization Admin details - Future fetchOrgAdmin() async { - orgName = await _preferences.getCurrentOrgName(); - orgId = await _preferences.getCurrentOrgId(); - if (orgId != null) { - final GraphQLClient _client = graphQLConfiguration.authClient(); - final QueryResult result = await _client - .query(QueryOptions(documentNode: gql(_query.fetchOrgById(orgId)))); - if (result.hasException) { - print(result.exception.toString()); - _exceptionToast("Please Try Again later!"); - } else if (!result.hasException) { - print('here'); - curOrganization = result.data['organizations'] as List; - creator = result.data['organizations'][0]['creator']['_id'].toString(); - isPublic = result.data['organizations'][0]['isPublic'] as bool; - result.data['organizations'][0]['admins'] - .forEach((userId) => admins.add(userId)); - for (int i = 0; i < admins.length; i++) { - print(admins[i]['_id']); - if (admins[i]['_id'] == userID) { - isCreator = true; - break; - } else { - isCreator = false; - } - } - } - } else { - isCreator = false; - } - setState(() {}); - } - - //function used when someone wants to leave organization - Future leaveOrg() async { - List remaindingOrg = []; - String newOrgId; - String newOrgName; - final String orgId = await _preferences.getCurrentOrgId(); - - final GraphQLClient _client = graphQLConfiguration.authClient(); - - final QueryResult result = await _client - .mutate(MutationOptions(documentNode: gql(_query.leaveOrg(orgId)))); - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - print('loop'); - return leaveOrg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - print('exception: ${result.exception.toString()}'); - _exceptionToast("Please Try Again later!"); - //_exceptionToast(result.exception.toString().substring(16)); - } else if (!result.hasException && !result.loading) { - //set org at the top of the list as the new current org - print('done'); - setState(() { - remaindingOrg = - result.data['leaveOrganization']['joinedOrganizations'] as List; - if (remaindingOrg.isEmpty) { - newOrgId = null; - } else if (remaindingOrg.isNotEmpty) { - setState(() { - newOrgId = result.data['leaveOrganization']['joinedOrganizations'] - [0]['_id'] - .toString(); - newOrgName = result.data['leaveOrganization']['joinedOrganizations'] - [0]['name'] - .toString(); - }); - } - }); - - _orgController.setNewOrg(context, newOrgId, newOrgName); - Provider.of(context, listen: false) - .saveCurrentOrgName(newOrgName); - Provider.of(context, listen: false) - .saveCurrentOrgId(newOrgId); - // _successToast('You are no longer apart of this organization'); - pushNewScreen( - context, - screen: const ProfilePage(), - ); - } - } - - //main build starts from here - @override - Widget build(BuildContext context) { - return Scaffold( - key: const Key('PROFILE_PAGE_SCAFFOLD'), - backgroundColor: Colors.white, - body: userDetails.isEmpty || isCreator == null - ? Center( - child: Loading( - key: UniqueKey(), - )) - : Column( - key: const Key('body'), - children: [ - Container( - padding: EdgeInsets.fromLTRB( - 0, - SizeConfig.safeBlockVertical * 6.25, - 0, - SizeConfig.safeBlockVertical * 4), - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(20.0), - bottomRight: Radius.circular(20.0), - ), - color: UIData.primaryColor, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListTile( - title: const Text("Profile", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20.0, - color: Colors.white)), - trailing: userDetails[0]['image'] != null - ? CircleAvatar( - radius: SizeConfig.safeBlockVertical * 3.75, - backgroundImage: NetworkImage( - Provider.of( - context) - .displayImgRoute + - userDetails[0]['image'].toString())) - : CircleAvatar( - radius: - SizeConfig.safeBlockVertical * 5.625, - backgroundColor: Colors.white, - child: Text( - userDetails[0]['firstName'] - .toString() - .substring(0, 1) - .toUpperCase() + - userDetails[0]['lastName'] - .toString() - .substring(0, 1) - .toUpperCase(), - style: const TextStyle( - color: UIData.primaryColor, - )), - )), - SizedBox(height: SizeConfig.safeBlockVertical * 1.25), - Padding( - padding: EdgeInsets.only( - left: SizeConfig.safeBlockHorizontal * 4), - child: Text( - "${userDetails[0]['firstName']} ${userDetails[0]['lastName']}", - style: const TextStyle( - fontSize: 20.0, color: Colors.white)), - ), - SizedBox(height: SizeConfig.safeBlockVertical * 0.625), - Padding( - padding: EdgeInsets.only( - left: SizeConfig.safeBlockHorizontal * 4), - child: Text( - "Current Organization: ${orgName ?? 'No Organization Joined'}", - style: const TextStyle( - fontSize: 16.0, color: Colors.white)), - ), - ], - ), - ), - SizedBox(height: SizeConfig.safeBlockVertical * 2.5), - Expanded( - child: ListView( - children: ListTile.divideTiles( - context: context, - tiles: [ - ListTile( - key: const Key('Update Profile'), - title: const Text( - 'Update Profile', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.edit, - color: UIData.secondaryColor, - ), - onTap: () { - pushNewScreen( - context, - screen: UpdateProfilePage( - userDetails: userDetails, - ), - ); - }, - ), - org.isEmpty - ? const SizedBox() - : ListTile( - key: const Key('Switch Organization'), - title: const Text( - 'Switch Organization', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.compare_arrows, - color: UIData.secondaryColor, - ), - onTap: () { - pushNewScreen( - context, - screen: SwitchOrganization(), - ); - }), - ListTile( - key: const Key('Join or Create New Organization'), - title: const Text( - 'Join or Create New Organization', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.business, - color: UIData.secondaryColor, - ), - onTap: () { - pushNewScreen( - context, - screen: const JoinOrganization( - fromProfile: true, - ), - ); - }), - isCreator == null - ? const SizedBox() - : isCreator == true - ? ListTile( - key: const Key('Organization Settings'), - title: const Text( - 'Organization Settings', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.settings, - color: UIData.secondaryColor, - ), - onTap: () { - pushNewScreen( - context, - screen: OrganizationSettings( - creator: creator == userID, - public: isPublic, - organization: curOrganization), - ); - }) - : org.isEmpty - ? const SizedBox() - : ListTile( - key: const Key( - 'Leave This Organization'), - title: const Text( - 'Leave This Organization', - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.exit_to_app, - color: UIData.secondaryColor, - ), - onTap: () async { - showDialog( - context: context, - builder: - (BuildContext context) { - return AlertBox( - message: - "Are you sure you want to leave this organization?", - function: leaveOrg); - }); - }), - ListTile( - key: const Key('Logout'), - title: const Text( - "Logout", - style: TextStyle(fontSize: 18.0), - ), - leading: const Icon( - Icons.exit_to_app, - color: UIData.secondaryColor, - ), - onTap: () { - if (Platform.isAndroid) { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: const Text("Confirmation"), - content: const Text( - "Are you sure you want to logout?"), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("No"), - ), - TextButton( - onPressed: () { - _authController.logout(context); - }, - child: const Text("Yes"), - ) - ], - ); - }); - } else { - // iOS-specific - showCupertinoDialog( - context: context, - useRootNavigator: false, - builder: (_) => CupertinoAlertDialog( - title: const Text( - "Confirmation", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - ), - ), - content: const Text( - "Are you sure you want to log out?", - style: TextStyle( - fontWeight: FontWeight.normal, - ), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("No"), - ), - TextButton( - onPressed: () { - _authController.logout(context); - }, - child: const Text("Yes"), - ) - ], - ), - ); - } - }, - ), - MyAboutTile(), - ], - ).toList(), - ), - ) - ], - )); - } - - void confirmLeave() { - if (Platform.isAndroid) { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: const Text("Confirmation"), - content: const Text( - "Are you sure you want to leave this organization?"), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("Close"), - ), - TextButton( - onPressed: () async { - leaveOrg(); - Navigator.of(context).pop(); - }, - child: const Text("Yes"), - ) - ], - ); - }); - } else { - // iOS-specific - showCupertinoDialog( - context: context, - useRootNavigator: false, - builder: (_) => CupertinoAlertDialog( - title: const Text("Confirmation"), - content: - const Text("Are you sure you want to leave this organization?"), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("Close"), - ), - TextButton( - onPressed: () async { - leaveOrg(); - Navigator.of(context).pop(); - }, - child: const Text("Yes"), - ) - ], - ), - ); - } - } - - void _exceptionToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 6, - vertical: SizeConfig.safeBlockVertical * 3.75), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - msg, - style: const TextStyle(fontSize: 15.0, color: Colors.white), - textAlign: TextAlign.center, - ), - ), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 5), - ); - } -} diff --git a/lib/views/pages/organization/switch_org_page.dart b/lib/views/pages/organization/switch_org_page.dart deleted file mode 100644 index 043c22c67..000000000 --- a/lib/views/pages/organization/switch_org_page.dart +++ /dev/null @@ -1,258 +0,0 @@ -import 'package:flutter/material.dart'; - -//pages are called here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/views/pages/home_page.dart'; - -class SwitchOrganization extends StatefulWidget { - @override - _SwitchOrganizationState createState() => _SwitchOrganizationState(); -} - -class _SwitchOrganizationState extends State { - final Queries _query = Queries(); - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - FToast fToast; - int visit = 0; - String orgId; - int isSelected; - String itemIndex; - List userOrg = []; - final Preferences _pref = Preferences(); - bool _progressBarState = false; - - void toggleProgressBarState() { - _progressBarState = !_progressBarState; - } - - //giving initial state to the variables - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - fetchUserDetails(); - } - - //method used to fetch the user details from the server - Future fetchUserDetails() async { - final String userID = await _pref.getUserId(); - - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - - final QueryResult result = await _client.query(QueryOptions( - documentNode: gql(_query.fetchUserInfo), variables: {'id': userID})); - if (result.loading) { - setState(() { - _progressBarState = true; - }); - } else if (result.hasException) { - print(result.exception); - setState(() { - _progressBarState = false; - showError(result.exception.toString()); - }); - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = false; - userOrg = result.data['users'][0]['joinedOrganizations'] as List; - print(userOrg); - if (userOrg.isEmpty) { - showError("You are not registered to any organization"); - } - }); - } - } - - //this method allows user to change the organization if he wants to - Future switchOrg() async { - if (userOrg[isSelected]['_id'] == orgId) { - _successToast("Switched to ${userOrg[isSelected]['name']}"); - - //Kill all previous stacked screen - // Navigator.of(context).popUntil(ModalRoute.withName("/")); - - //New Screen with updated data set - pushNewScreen(context, - screen: const HomePage( - openPageIndex: 4, - ), - withNavBar: false); - } else { - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - - final QueryResult result = await _client.mutate( - MutationOptions(documentNode: gql(_query.fetchOrgById(itemIndex)))); - if (result.hasException) { - print(result.exception); - _exceptionToast(result.exception.toString()); - } else if (!result.hasException) { - _successToast("Switched to ${result.data['organizations'][0]['name']}"); - - //save new current org in preference - final String currentOrgId = - result.data['organizations'][0]['_id'].toString(); - await _pref.saveCurrentOrgId(currentOrgId); - final String currentOrgImgSrc = - result.data['organizations'][0]['image'].toString(); - await _pref.saveCurrentOrgImgSrc(currentOrgImgSrc); - final String currentOrgName = - result.data['organizations'][0]['name'].toString(); - await _pref.saveCurrentOrgName(currentOrgName); - - //Kill all previous stacked screen - // Navigator.of(context).popUntil(ModalRoute.withName("/")); - - //New Screen with Updated data set - pushNewScreen(context, - screen: const HomePage( - openPageIndex: 4, - ), - withNavBar: false); - } - } - } - - // it is used to get the current organization id - getCurrentOrg() async { - orgId = await Provider.of(context).getCurrentOrgId(); - setState(() {}); - } - -//the build starts from here - @override - Widget build(BuildContext context) { - if (visit == 0) { - visit++; - getCurrentOrg(); - } - return Scaffold( - appBar: AppBar( - title: const Text( - 'Switch Organization', - style: TextStyle(color: Colors.white), - ), - ), - body: _progressBarState - ? const Center(child: CircularProgressIndicator()) - : ListView.separated( - padding: - EdgeInsets.only(top: SizeConfig.safeBlockVertical * 1.25), - itemCount: userOrg.length, - itemBuilder: (context, index) { - if (userOrg[index]['_id'] == orgId) { - isSelected = index; - } - return RadioListTile( - secondary: userOrg[index]['image'] != null - ? CircleAvatar( - radius: SizeConfig.safeBlockVertical * 7.25, - backgroundImage: NetworkImage( - Provider.of(context) - .displayImgRoute + - userOrg[index]['image'].toString())) - : CircleAvatar( - radius: SizeConfig.safeBlockVertical * 3.75, - backgroundImage: - const AssetImage("assets/images/team.png")), - activeColor: UIData.secondaryColor, - groupValue: isSelected, - title: Text( - '${userOrg[index]['name']}\n${userOrg[index]['description']}'), - value: index, - onChanged: (int val) { - setState(() { - orgId = null; - isSelected = val; - itemIndex = userOrg[index]['_id'].toString(); - }); - }, - ); - }, - separatorBuilder: (BuildContext context, int index) { - return const Divider(); - }, - ), - floatingActionButton: FloatingActionButton.extended( - icon: const Icon(Icons.save), - label: const Text("SAVE"), - backgroundColor: UIData.secondaryColor, - foregroundColor: Colors.white, - elevation: 5.0, - onPressed: () { - switchOrg(); - }, - ), - floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, - ); - } - - //widget to show error if there is some error in the lines - Widget showError(String msg) { - return Center( - child: Text( - msg, - style: const TextStyle(fontSize: 16), - textAlign: TextAlign.center, - ), - ); - } - - //the method which is called when the result is successful - _successToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 5, - vertical: SizeConfig.safeBlockVertical * 1.5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.green, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } - - //the method is called when the result is an exception - _exceptionToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 6, - vertical: SizeConfig.safeBlockVertical * 1.75), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/organization/update_organization.dart b/lib/views/pages/organization/update_organization.dart deleted file mode 100644 index 1cb7af529..000000000 --- a/lib/views/pages/organization/update_organization.dart +++ /dev/null @@ -1,293 +0,0 @@ -//flutter packages -import 'package:flutter/material.dart'; - -//pages called are here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/utils/validator.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:talawa/views/pages/organization/profile_page.dart'; -import 'package:talawa/views/widgets/text_field_decoration.dart'; -import 'package:talawa/views/widgets/toast_tile.dart'; - -class UpdateOrganization extends StatefulWidget { - const UpdateOrganization( - {this.isPublic, this.description, this.isVisible, this.name}); - - final String description; - final String name; - final int isPublic; - final int isVisible; - @override - _UpdateOrganizationState createState() => _UpdateOrganizationState(); -} - -class _UpdateOrganizationState extends State { - final orgNameController = TextEditingController(); - final orgDescController = TextEditingController(); - final orgMemberDescController = TextEditingController(); - final Queries _queries = Queries(); - bool _progressBarState = false; - final AutovalidateMode _validate = AutovalidateMode.disabled; - final _formKey = GlobalKey(); - int radioValue = -1; - int radioValue1 = -1; - bool isPublic = true; - bool isVisible = true; - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - FToast fToast; - final Preferences _preferences = Preferences(); - final AuthController _authController = AuthController(); - - //providing with the initial states to the variables - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - orgNameController.text = widget.name; - orgDescController.text = widget.description; - radioValue = widget.isPublic; - radioValue1 = widget.isVisible; - } - - //this method shows the toggle bar - void toggleProgressBarState() { - _progressBarState = !_progressBarState; - } - - //this method is used if we want to update the organization - updateOrg() async { - final String currentOrgId = await _preferences.getCurrentOrgId(); - orgNameController.text = - orgNameController.text.trim().replaceAll('\n', ' '); - orgDescController.text = - orgDescController.text.trim().replaceAll('\n', ' '); - orgMemberDescController.text = - orgMemberDescController.text.trim().replaceAll('\n', ' '); - final GraphQLClient _client = graphQLConfiguration.authClient(); - final QueryResult result = await _client.mutate(MutationOptions( - documentNode: gql(_queries.updateOrg( - currentOrgId, - orgNameController.text, - orgDescController.text, - isPublic: isPublic, - visibleInSearch: isVisible, - )))); - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return updateOrg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - print(result.exception); - setState(() { - _progressBarState = false; - }); - _exceptionToast(result.exception.toString().substring(16)); - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = true; - }); - _successToast("Success!"); - pushNewScreen( - context, - screen: const ProfilePage(), - ); - } - } - - Widget getRadioButton(int group, int count, {bool public}) { - return ListView( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - children: List.generate( - count, - (index) => RadioListTile( - groupValue: group, - title: Text(index == 0 ? 'Yes' : 'No'), - value: index, - activeColor: UIData.secondaryColor, - onChanged: (int val) { - FocusScope.of(context).unfocus(); - // ignore: void_checks - setState(() { - public ? radioValue = val : radioValue1 = val; - if (radioValue == 0) { - return public ? isPublic : isVisible; - } else if (radioValue == 1) { - if (public) { - isPublic = false; - } else { - isVisible = false; - } - return public ? isPublic : isVisible; - } - }); - }, - ), - ), - ); - } - - //the main build starts here - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('Update Organization', - style: TextStyle(color: Colors.white))), - body: Container( - color: Colors.white, - child: radioValue == null - ? const Center(child: CircularProgressIndicator()) - : SingleChildScrollView( - padding: const EdgeInsets.only(bottom: 10.0), - scrollDirection: Axis.vertical, - child: Form( - key: _formKey, - autovalidateMode: _validate, - child: Padding( - padding: const EdgeInsets.only(left: 30.0, right: 30.0), - child: Column( - children: [ - const Image( - image: AssetImage('assets/images/team.png')), - const SizedBox( - height: 20, - ), - TextFormField( - validator: (value) => - Validator.validateOrgName(value), - textAlign: TextAlign.left, - textCapitalization: TextCapitalization.words, - style: const TextStyle(color: Colors.black), - decoration: FormFieldFormatting.formFieldFormatting( - hintText: "Organization Name", - labelText: 'My Organization', - prefixIcon: Icons.group, - ), - controller: orgNameController, - ), - const SizedBox( - height: 20, - ), - TextFormField( - keyboardType: TextInputType.multiline, - maxLines: null, - textCapitalization: TextCapitalization.words, - validator: (value) => - Validator.validateOrgDesc(value), - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.black), - decoration: FormFieldFormatting.formFieldFormatting( - hintText: "My Description", - labelText: "Organization Description", - prefixIcon: Icons.note_sharp), - controller: orgDescController, - ), - const SizedBox( - height: 20, - ), - TextFormField( - autofillHints: const [AutofillHints.impp], - keyboardType: TextInputType.multiline, - maxLines: null, - textCapitalization: TextCapitalization.words, - validator: (value) => - Validator.validateOrgAttendeesDesc(value), - textAlign: TextAlign.left, - style: const TextStyle(color: Colors.black), - decoration: FormFieldFormatting.formFieldFormatting( - hintText: "Member Description", - labelText: "Member Description", - prefixIcon: Icons.note_sharp), - controller: orgMemberDescController, - ), - const SizedBox( - height: 20, - ), - const Text( - 'Do you want your organization to be public?', - style: - TextStyle(fontSize: 16, color: Colors.black)), - getRadioButton(radioValue, 2, public: true), - const Text( - 'Do you want others to be able to find your organization from the search page?', - style: - TextStyle(fontSize: 16, color: Colors.black)), - getRadioButton(radioValue1, 2, public: false), - Container( - padding: const EdgeInsets.symmetric( - vertical: 20.0, horizontal: 30.0), - width: double.infinity, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), - ), - ), - onPressed: () async { - if (_formKey.currentState.validate() && - radioValue >= 0 && - radioValue1 >= 0) { - _formKey.currentState.save(); - updateOrg(); - setState(() { - toggleProgressBarState(); - }); - } else if (radioValue < 0 || radioValue1 < 0) { - _exceptionToast("A choice must be selected"); - } - }, - child: _progressBarState - ? const Center( - child: SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator( - valueColor: - AlwaysStoppedAnimation( - Colors.white), - strokeWidth: 3, - backgroundColor: Colors.black, - ))) - : const Text( - "UPDATE ORGANIZATION", - style: TextStyle(color: Colors.white), - ), - ), - ), - ], - ), - ), - ), - ), - )); - } - - //a message if the result is successful - _successToast(String msg) { - fToast.showToast( - child: ToastTile(msg: msg, success: true), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 1), - ); - } - - //a method which is called when the result is an exception - _exceptionToast(String msg) { - fToast.showToast( - child: ToastTile(msg: msg, success: false), - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pages/organization/update_profile_page.dart b/lib/views/pages/organization/update_profile_page.dart deleted file mode 100644 index 62e86a4f1..000000000 --- a/lib/views/pages/organization/update_profile_page.dart +++ /dev/null @@ -1,621 +0,0 @@ -import 'dart:io'; -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:graphql/utilities.dart' show multipartFileFrom; -import 'package:image_picker/image_picker.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/enums/image_from.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/globals.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/utils/uidata.dart'; -import 'package:talawa/utils/validator.dart'; -import 'package:talawa/view_models/vm_register.dart'; -import 'package:talawa/views/pages/organization/profile_page.dart'; - -class UpdateProfilePage extends StatefulWidget { - const UpdateProfilePage({Key key, @required this.userDetails}) - : super(key: key); - final List userDetails; - - @override - _UpdateProfilePageState createState() => _UpdateProfilePageState(); -} - -class _UpdateProfilePageState extends State { - File _image; - FToast fToast; - - final _formKey = GlobalKey(); - var _validate = AutovalidateMode.disabled; - final AuthController _authController = AuthController(); - final Queries _updateProfileQuery = Queries(); - RegisterViewModel model = RegisterViewModel(); - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - bool _progressBarState = false; - - //providing initial states to the variables - @override - void initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - } - - //Function called when the user update without the image - updateProfileWithoutImg() async { - setState(() { - _progressBarState = true; - }); - - final GraphQLClient _client = graphQLConfiguration.authClient(); - QueryResult result; - - if (widget.userDetails[0]['email'] == model.email) { - result = await _client.mutate( - MutationOptions( - documentNode: gql(_updateProfileQuery.updateUserProfile()), - variables: { - "firstName": model.firstName, - "lastName": model.lastName, - }, - ), - ); - } else { - result = await _client.mutate( - MutationOptions( - documentNode: gql(_updateProfileQuery.updateUserProfile()), - variables: { - "firstName": model.firstName, - "lastName": model.lastName, - "email": widget.userDetails[0]['email'] == model.email - ? null - : model.email, - }, - ), - ); - } - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return updateProfileWithoutImg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - print(result.exception); - setState(() { - _progressBarState = false; - }); - if (result.exception.clientException != null) { - _exceptionToast(result.exception.clientException.message); - } else { - _exceptionToast(result.exception.graphqlErrors.first.message); - } - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = false; - }); - - _successToast('Profile Updated'); - - Navigator.of(context).popUntil(ModalRoute.withName("/")); - - pushNewScreen( - context, - screen: const ProfilePage(), - ); - } - } - - //function called when the user is called without the image - updateProfileWithImg() async { - setState(() { - _progressBarState = true; - }); - - final GraphQLClient _client = graphQLConfiguration.authClient(); - final img = await multipartFileFrom(_image); - QueryResult result; - if (widget.userDetails[0]['email'] == model.email) { - result = await _client.mutate( - MutationOptions( - documentNode: gql(_updateProfileQuery.updateUserProfile()), - variables: { - 'file': img, - "firstName": model.firstName, - "lastName": model.lastName, - }, - ), - ); - } else { - result = await _client.mutate( - MutationOptions( - documentNode: gql(_updateProfileQuery.updateUserProfile()), - variables: { - 'file': img, - "firstName": model.firstName, - "lastName": model.lastName, - "email": widget.userDetails[0]['email'] == model.email - ? null - : model.email, - }, - ), - ); - } - - if (result.hasException && - result.exception.toString().substring(16) == accessTokenException) { - _authController.getNewToken(); - return updateProfileWithImg(); - } else if (result.hasException && - result.exception.toString().substring(16) != accessTokenException) { - print(result.exception); - setState(() { - _progressBarState = false; - }); - if (result.exception.clientException != null) { - _exceptionToast(result.exception.clientException.message); - } else { - _exceptionToast(result.exception.graphqlErrors.first.message); - } - } else if (!result.hasException && !result.loading) { - setState(() { - _progressBarState = false; - }); - - _successToast('Profile Updated'); - - //Navigate to home screen - Navigator.of(context).popUntil(ModalRoute.withName("/")); - - //Push New Screen - pushNewScreen( - context, - screen: const ProfilePage(), - ); - } - } - - //get image from camera and gallery based on the enum passed - _imgFrom({From pickFrom = From.none}) async { - File pickImageFile; - if (pickFrom != From.none) { - final PickedFile selectedImage = await ImagePicker().getImage( - source: pickFrom == From.camera - ? ImageSource.camera - : ImageSource.gallery); - pickImageFile = File(selectedImage.path); - setState(() { - _image = pickImageFile; - }); - } - } - - @override - Widget build(BuildContext context) { - return Container( - color: Colors.white, - child: SafeArea( - child: Scaffold( - backgroundColor: Colors.white, - body: Form( - key: _formKey, - autovalidateMode: _validate, - child: ListView( - children: [ - Container( - color: Colors.white, - alignment: Alignment.bottomCenter, - child: Row( - children: [ - IconButton( - icon: const Icon( - Icons.arrow_back, - ), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - SizedBox(width: SizeConfig.safeBlockHorizontal * 2.5), - const Expanded( - child: ListTile( - contentPadding: EdgeInsets.all(0), - title: Text( - 'Update Profile', - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.w800, - ), - ), - subtitle: Text( - 'Keep your profile upto date', - style: TextStyle( - fontSize: 14, - fontFamily: 'OpenSans', - ), - ), - ), - ), - ], - ), - ), - addImage(), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - _image != null - ? IconButton( - icon: Icon( - Icons.delete, - size: SizeConfig.safeBlockVertical * 3.75, - color: Colors.red, - ), - onPressed: () { - setState(() { - _image = null; - }); - }, - ) - : Container(), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 3.75, - ), - //First Name - Container( - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(10), - ), - margin: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 5, - 0, - SizeConfig.safeBlockHorizontal * 5, - 0), - padding: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 4, - SizeConfig.safeBlockVertical * 2, - SizeConfig.safeBlockHorizontal * 4, - SizeConfig.safeBlockVertical * 2), - child: TextFormField( - style: const TextStyle(fontSize: 20), - keyboardType: TextInputType.name, - validator: (value) => Validator.validateLastName(value), - enableSuggestions: true, - cursorRadius: const Radius.circular(10), - cursorColor: Colors.blue[800], - textCapitalization: TextCapitalization.words, - initialValue: widget.userDetails[0]['firstName'].toString(), - onSaved: (firstName) { - model.firstName = firstName; - }, - decoration: InputDecoration( - contentPadding: const EdgeInsets.all(0), - labelText: 'First Name', - counterText: '', - border: InputBorder.none, - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(4), - borderSide: const BorderSide(color: Colors.red), - ), - ), - ), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - //Last Name - Container( - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(10), - ), - margin: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 5, - 0, - SizeConfig.safeBlockHorizontal * 5, - 0), - padding: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 4, - SizeConfig.safeBlockVertical * 2, - SizeConfig.safeBlockHorizontal * 4, - SizeConfig.safeBlockVertical * 2), - child: TextFormField( - style: const TextStyle(fontSize: 20), - keyboardType: TextInputType.name, - validator: (value) => Validator.validateLastName(value), - enableSuggestions: true, - cursorRadius: const Radius.circular(10), - cursorColor: Colors.blue[800], - textCapitalization: TextCapitalization.words, - initialValue: widget.userDetails[0]['lastName'].toString(), - onSaved: (lastName) { - model.lastName = lastName; - }, - decoration: InputDecoration( - contentPadding: const EdgeInsets.all(0), - labelText: 'Last Name', - counterText: '', - border: InputBorder.none, - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(4), - borderSide: const BorderSide(color: Colors.red), - ), - ), - ), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 2.5, - ), - //Email - Container( - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(10), - ), - margin: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 5, - 0, - SizeConfig.safeBlockHorizontal * 5, - 0), - padding: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 4, - SizeConfig.safeBlockVertical * 2, - SizeConfig.safeBlockHorizontal * 4, - SizeConfig.safeBlockVertical * 2), - child: TextFormField( - style: const TextStyle(fontSize: 20), - keyboardType: TextInputType.emailAddress, - validator: (value) => Validator.validateEmail(value), - enableSuggestions: true, - cursorRadius: const Radius.circular(10), - cursorColor: Colors.blue[800], - initialValue: widget.userDetails[0]['email'].toString(), - textCapitalization: TextCapitalization.words, - onSaved: (email) { - model.email = email; - }, - decoration: InputDecoration( - contentPadding: const EdgeInsets.all(0), - labelText: 'Email', - counterText: '', - border: InputBorder.none, - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(4), - borderSide: const BorderSide(color: Colors.red), - ), - ), - ), - ), - SizedBox( - height: SizeConfig.safeBlockVertical * 3.75, - ), - Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.safeBlockHorizontal * 5, - 0, - SizeConfig.safeBlockHorizontal * 5, - 0), - child: ElevatedButton.icon( - style: ButtonStyle( - padding: MaterialStateProperty.all( - const EdgeInsets.all(15.0)), - shape: MaterialStateProperty.all( - const StadiumBorder()), - backgroundColor: - MaterialStateProperty.all(Colors.blue), - ), - onPressed: () { - FocusScope.of(context).unfocus(); - _validate = AutovalidateMode.always; - - if (_formKey.currentState.validate()) { - _formKey.currentState.save(); - _image == null - ? updateProfileWithoutImg() - : updateProfileWithImg(); - } - }, - icon: _progressBarState - ? SizedBox( - height: SizeConfig.safeBlockVertical * 1.75, - width: SizeConfig.safeBlockHorizontal * 3.5, - child: const CircularProgressIndicator( - backgroundColor: Colors.white, - ), - ) - : const Icon( - Icons.update, - color: Colors.white, - ), - label: const Text( - 'Update Profile', - style: TextStyle( - fontSize: 18, - color: Colors.white, - ), - ), - ), - ) - ], - ), - ), - ), - ), - ); - } - - //widget used to add the image - Widget addImage() { - return Column( - children: [ - SizedBox( - height: SizeConfig.safeBlockVertical * 1.25, - ), - Center( - child: GestureDetector( - onTap: () { - _showPicker(context); - }, - child: CircleAvatar( - radius: SizeConfig.safeBlockVertical * 6.875, - backgroundColor: - _image != null ? UIData.secondaryColor : Colors.grey[300], - child: _image != null - ? CircleAvatar( - radius: SizeConfig.safeBlockVertical * 6.5, - backgroundImage: FileImage( - _image, - ), - ) - : CircleAvatar( - radius: SizeConfig.safeBlockVertical * 6.5, - backgroundColor: Colors.grey[300], - child: Icon( - Icons.add_a_photo, - color: Colors.grey[800], - size: SizeConfig.safeBlockVertical * 5.625, - ), - ), - ), - ), - ) - ], - ); - } - - //used to show the method user want to choose their pictures - void _showPicker(BuildContext context) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - elevation: 5.0, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16), topRight: Radius.circular(16)), - ), - builder: (BuildContext context) { - return Container( - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.bottom, - ), - decoration: BoxDecoration( - color: Colors.grey[100], - borderRadius: BorderRadius.circular(16), - ), - constraints: BoxConstraints( - maxHeight: SizeConfig.screenHeight * 0.8, - minHeight: SizeConfig.screenHeight * 0.1, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox(height: SizeConfig.safeBlockVertical * 1.25), - const Icon( - Icons.maximize, - size: 30, - ), - SizedBox(height: SizeConfig.safeBlockVertical * 0.75), - const Center( - child: Text( - 'Update your profile picture', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - fontFamily: 'OpenSans', - ), - ), - ), - SizedBox(height: SizeConfig.safeBlockVertical * 0.75), - const Divider(), - Wrap( - children: [ - ListTile( - leading: const Icon(Icons.camera_alt_outlined), - title: const Text('Camera'), - onTap: () { - _imgFrom(pickFrom: From.camera); - Navigator.of(context).pop(); - }, - ), - ListTile( - leading: const Icon(Icons.photo_library), - title: const Text('Photo Library'), - onTap: () { - _imgFrom(pickFrom: From.gallery); - Navigator.of(context).pop(); - }), - ], - ), - ], - ), - ); - }); - } - - //This method is called when the result is an exception - void _exceptionToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 6, - vertical: SizeConfig.safeBlockVertical * 3.75), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - msg, - style: const TextStyle(fontSize: 15.0, color: Colors.white), - textAlign: TextAlign.center, - ), - ), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 5), - ); - } - - //This method is called after complete mutation - void _successToast(String msg) { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 5, - vertical: SizeConfig.safeBlockVertical * 1.5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.green, - ), - child: Text( - msg, - overflow: TextOverflow.ellipsis, - maxLines: 2, - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/pre_auth_screens/change_password.dart b/lib/views/pre_auth_screens/change_password.dart new file mode 100644 index 000000000..9f292b3fe --- /dev/null +++ b/lib/views/pre_auth_screens/change_password.dart @@ -0,0 +1,160 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +/// This widget lets the user change his/her password. +/// There are two input fields. The first one is for entering the new password, and the +/// second one is for re-entering the password for verification. +/// There is a raised button which finally updates the password when pressed. +class ChangePass extends StatefulWidget { + const ChangePass({required Key key}) : super(key: key); + + @override + _ChangePassState createState() => _ChangePassState(); +} + +class _ChangePassState extends State { + final formKey = GlobalKey(); + final TextEditingController newPassword = TextEditingController(); + final TextEditingController reNewPassword = TextEditingController(); + final FocusNode newPasswordFocus = FocusNode(); + final FocusNode reNewPasswordFocus = FocusNode(); + + @override + Widget build(BuildContext context) { + //custom text variable (List). + final text = [ + { + 'text': "${AppLocalizations.of(context)!.translate("Hello")}, ", + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + { + 'text': '${AppLocalizations.of(context)!.translate("User Name")} ', + 'textStyle': + Theme.of(context).textTheme.titleLarge!.copyWith(fontSize: 24), + }, + { + 'text': "${AppLocalizations.of(context)!.translate("we've")} ", + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + { + 'text': + '${AppLocalizations.of(context)!.translate("got you covered")} ', + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + ]; + return Scaffold( + key: const Key('ChangePassScreenScaffold'), + appBar: AppBar( + elevation: 0.0, + backgroundColor: Colors.transparent, + leading: IconButton( + icon: const Icon( + Icons.arrow_back, + color: Colors.black, + ), + onPressed: () { + navigationService.pop(); + }, + ), + ), + body: SingleChildScrollView( + physics: const NeverScrollableScrollPhysics(), + child: Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.screenHeight! * 0.2, + SizeConfig.screenWidth! * 0.06, + 0.0, + ), + width: SizeConfig.screenWidth, + height: SizeConfig.screenHeight, + child: Form( + key: formKey, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomRichText( + key: const Key('ChangePageText'), + words: text, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + // Text field taking the input of the password + TextFormField( + key: const Key('PassInputField'), + controller: newPassword, + focusNode: newPasswordFocus, + textInputAction: TextInputAction.done, + keyboardType: TextInputType.text, + enableSuggestions: true, + autofillHints: const [AutofillHints.password], + obscureText: true, + validator: (pass) => Validator.validatePassword(pass!), + decoration: InputDecoration( + hintText: + AppLocalizations.of(context)!.translate('password'), + labelText: + '${AppLocalizations.of(context)!.translate("Enter new password")} *', + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.025, + ), + // Text field taking the input of the password again for verification + TextFormField( + key: const Key('PassRepeatInputField'), + controller: reNewPassword, + focusNode: reNewPasswordFocus, + textInputAction: TextInputAction.done, + keyboardType: TextInputType.text, + enableSuggestions: true, + autofillHints: const [AutofillHints.password], + obscureText: true, + validator: (pass) => Validator.validatePasswordConfirm( + pass!, + newPassword.text, + ), + decoration: InputDecoration( + hintText: + AppLocalizations.of(context)!.translate('password'), + labelText: + '${AppLocalizations.of(context)!.translate("Re-Enter your password")} *', + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.086, + ), + // Button for changing the password + RaisedRoundedButton( + buttonLabel: + '${AppLocalizations.of(context)!.translate("Change Password")} ', + onTap: () { + formKey.currentState!.validate(); + newPasswordFocus.unfocus(); + reNewPasswordFocus.unfocus(); + }, + textColor: const Color(0xFF008A37), + key: const Key('ChangePasswordButton'), + backgroundColor: Colors.white, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/views/pre_auth_screens/login.dart b/lib/views/pre_auth_screens/login.dart new file mode 100644 index 000000000..6495c6cd4 --- /dev/null +++ b/lib/views/pre_auth_screens/login.dart @@ -0,0 +1,198 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/pre_auth_view_models/login_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +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 +/// the "recover password" screen when pressed. +/// At the bottom, there is a login button to initiate the login. +class Login extends StatefulWidget { + const Login({required Key key}) : super(key: key); + + @override + _LoginState createState() => _LoginState(); +} + +class _LoginState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return Scaffold( + resizeToAvoidBottomInset: true, + appBar: AppBar( + elevation: 0.0, + backgroundColor: Colors.transparent, + leading: IconButton( + icon: const Icon( + Icons.arrow_back, + ), + onPressed: () { + navigationService.pop(); + }, + ), + ), + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.screenHeight! * 0.2, + SizeConfig.screenWidth! * 0.06, + 0.0, + ), + width: SizeConfig.screenWidth, + height: SizeConfig.screenHeight, + child: Form( + key: model.formKey, + autovalidateMode: model.validate, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //Custom greeting text. + CustomRichText( + key: const Key('UrlPageText'), + words: model.greeting, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + //Input form for the email of the user. + TextFormField( + key: const Key('EmailInputField'), + controller: model.email, + focusNode: model.emailFocus, + textInputAction: TextInputAction.next, + keyboardType: TextInputType.emailAddress, + autofillHints: const [AutofillHints.email], + enableSuggestions: true, + validator: (value) { + final String? err = Validator.validateEmail(value!); + if (err != null) { + return AppLocalizations.of(context)!.translate(err); + } + + return null; + }, + decoration: InputDecoration( + hintText: AppLocalizations.of(context)! + .translate("Email Hint"), + labelText: + '${AppLocalizations.of(context)!.translate("Enter your registered Email")} *', + labelStyle: Theme.of(context).textTheme.titleMedium, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.025, + ), + //Input form for the password of the user. + TextFormField( + key: const Key('PasswordInputField'), + controller: model.password, + focusNode: model.passwordFocus, + textInputAction: TextInputAction.done, + keyboardType: TextInputType.text, + enableSuggestions: true, + autofillHints: const [AutofillHints.password], + obscureText: model.hidePassword, + validator: (value) { + final String? err = Validator.validatePassword(value!); + if (err != null) { + return AppLocalizations.of(context)!.translate(err); + } + + return null; + }, + decoration: InputDecoration( + suffixIcon: IconButton( + onPressed: () { + setState(() { + model.hidePassword = !model.hidePassword; + }); + }, + icon: Icon( + model.hidePassword + ? Icons.visibility_off + : Icons.visibility, + ), + ), + hintText: + AppLocalizations.of(context)!.translate('password'), + labelText: + '${AppLocalizations.of(context)!.translate("Enter your password")} *', + labelStyle: Theme.of(context).textTheme.titleMedium, + ), + ), + //Option to recover the password if the user forgets his/her password. + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + TextButton( + onPressed: () { + navigationService.showTalawaErrorSnackBar( + 'Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)', + MessageType.info, + ); + }, + child: const Text( + 'Tip', + style: TextStyle( + fontSize: 14, + color: Colors.green, + fontFamily: 'open-sans', + ), + ), + ), + TextButton( + onPressed: () { + model.emailFocus.unfocus(); + model.passwordFocus.unfocus(); + navigationService.pushScreen('/recover'); + }, + child: Text( + '${AppLocalizations.of(context)!.translate("Forgot password")}?', + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith( + fontSize: 14, + color: const Color(0xFF4285F4), + ), + ), + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.086, + ), + //Button to initiate the login. + RaisedRoundedButton( + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Login'), + onTap: () => model.login(), + textColor: const Color(0xFF008A37), + key: const Key('LoginButton'), + backgroundColor: Theme.of(context).colorScheme.tertiary, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.0215), + ], + ), + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/pre_auth_screens/recover.dart b/lib/views/pre_auth_screens/recover.dart new file mode 100644 index 000000000..59c89799a --- /dev/null +++ b/lib/views/pre_auth_screens/recover.dart @@ -0,0 +1,123 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +/// This class recovers the users password. +/// The users needs to enter his/her email and press on the button at the bottom to recover his/her password. +class Recover extends StatefulWidget { + const Recover({required Key key}) : super(key: key); + + @override + _RecoverState createState() => _RecoverState(); +} + +class _RecoverState extends State { + final TextEditingController email = TextEditingController(); + final formKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + final text = [ + { + 'text': + "${AppLocalizations.of(context)!.translate("Sit back relax, we'll")} ", + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + { + 'text': '${AppLocalizations.of(context)!.translate("Recover")} ', + 'textStyle': + Theme.of(context).textTheme.titleLarge!.copyWith(fontSize: 24), + }, + { + 'text': AppLocalizations.of(context)!.translate("your password"), + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + ]; + return Scaffold( + key: const Key('RecoverScreenScaffold'), + appBar: AppBar( + elevation: 0.0, + backgroundColor: Colors.transparent, + leading: IconButton( + icon: const Icon( + Icons.arrow_back, + ), + onPressed: () { + navigationService.pop(); + }, + ), + ), + body: SingleChildScrollView( + physics: const NeverScrollableScrollPhysics(), + child: Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.screenHeight! * 0.2, + SizeConfig.screenWidth! * 0.06, + 0.0, + ), + width: SizeConfig.screenWidth, + height: SizeConfig.screenHeight, + //custom text at the top of the screen + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomRichText( + key: const Key('RecoverPageText'), + words: text, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + //This form takes the email of the user as an input + Form( + key: formKey, + child: TextFormField( + key: const Key('EmailInputField'), + controller: email, + textInputAction: TextInputAction.next, + keyboardType: TextInputType.emailAddress, + autofillHints: const [AutofillHints.email], + enableSuggestions: true, + validator: (email) => Validator.validateEmail(email!), + decoration: InputDecoration( + hintText: + AppLocalizations.of(context)!.translate("Email Hint"), + labelText: + '${AppLocalizations.of(context)!.translate("Enter your registered Email")} *', + labelStyle: Theme.of(context).textTheme.titleMedium, + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.086, + ), + //Button to initiate the process of recovering password. + RaisedRoundedButton( + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Recover Password'), + onTap: () { + formKey.currentState!.validate(); + }, + textColor: const Color(0xFF008A37), + key: const Key('RecoverButton'), + backgroundColor: Colors.white, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/views/pre_auth_screens/select_language.dart b/lib/views/pre_auth_screens/select_language.dart new file mode 100644 index 000000000..ef71ca2b1 --- /dev/null +++ b/lib/views/pre_auth_screens/select_language.dart @@ -0,0 +1,160 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; + +/// This widget enables us to select a different language. +/// +/// The default language is English. We can choose among the options to switch the language. +/// There is a text button at the right bottom of the screen which changes the language when tapped. +/// The user finally gets redirected to the previous screen. +class SelectLanguage extends StatefulWidget { + const SelectLanguage({required Key key}) : super(key: key); + + @override + _SelectLanguageState createState() => _SelectLanguageState(); +} + +class _SelectLanguageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + key: const Key('SelectLanguageScreenScaffold'), + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: Padding( + padding: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.safeBlockVertical! * 4, + SizeConfig.screenWidth! * 0.06, + 0.0, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: SizeConfig.screenWidth! * 0.06), + child: SizedBox( + height: SizeConfig.screenHeight! * 0.045, + child: FittedBox( + // Heading of the screen: "Select Language" + child: Text( + AppLocalizations.of(context)! + .strictTranslate('Select Language'), + style: Theme.of(context).textTheme.headlineSmall, + key: const Key('Select Language'), + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.018, + ), + // const CupertinoSearchTextField( + // key: Key('SearchField'), + // ), + SizedBox( + height: SizeConfig.screenHeight! * 0.016, + ), + Expanded( + child: ListView.builder( + key: const Key('LanguagesList'), + itemCount: languages.length, + itemBuilder: (BuildContext context, int index) { + // Returns a list of all the languages available + return InkWell( + key: Key( + Provider.of(context).appLocal.languageCode == + languages[index].langCode + ? 'Selected' + : 'NotSelected', + ), + onTap: () async { + await Provider.of( + context, + listen: false, + ).changeLanguage( + Locale(languages[index].langCode), + ); + }, + child: Consumer( + builder: (context, appLang, _) { + return Container( + key: Key('LanguageItem$index'), + alignment: Alignment.centerLeft, + height: SizeConfig.screenHeight! * 0.063, + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.06, + ), + decoration: BoxDecoration( + color: languages[index].langCode == + appLang.appLocal.languageCode + ? const Color(0xFFC4C4C4).withOpacity(0.15) + : Colors.transparent, + ), + child: index == 0 + ? Row( + key: const Key('LanguageItem'), + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + languages[index].langName, + style: Theme.of(context) + .textTheme + .titleLarge, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Default'), + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith( + color: const Color(0xFF4285F4), + ), + ), + ], + ) + : Text( + languages[index].langName, + style: Theme.of(context).textTheme.titleLarge, + key: const Key('LanguageItem'), + ), + ); + }, + ), + ); + }, + ), + ), + const Divider( + color: Color(0xffe5e5e5), + ), + // Text Button which changes the language when tapped. + Container( + height: SizeConfig.screenHeight! * 0.08, + alignment: Alignment.centerRight, + child: TextButton( + key: const Key('NavigateToMainScreen'), + onPressed: () async { + Provider.of(context, listen: false) + .selectLanguagePress(); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Select'), + style: Theme.of(context).textTheme.headlineSmall!.copyWith( + fontSize: 18, + color: const Color(0xFF008A37), + ), + key: const Key('SelectLangTextButton'), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/views/pre_auth_screens/select_organization.dart b/lib/views/pre_auth_screens/select_organization.dart new file mode 100644 index 000000000..1c89c3993 --- /dev/null +++ b/lib/views/pre_auth_screens/select_organization.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/organization_list.dart'; + +/// This widget lets the user select new organizations. +/// +/// There is a list tile which displays the organization selected by the user. +/// He/she needs to press the "continue" button to proceed. +class SelectOrganization extends StatefulWidget { + const SelectOrganization({required Key key, required this.selectedOrgId}) + : super(key: key); + + /// Contains Integer value for selected org id. + final String selectedOrgId; + + @override + _SelectOrganizationState createState() => _SelectOrganizationState(); +} + +class _SelectOrganizationState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(widget.selectedOrgId), + builder: (context, model, child) { + return Scaffold( + extendBodyBehindAppBar: false, + appBar: AppBar( + backgroundColor: Colors.transparent, + ), + body: Padding( + padding: EdgeInsets.only(top: SizeConfig.safeBlockVertical!), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 18, + ), + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Choose an Organization"), + style: const TextStyle(fontSize: 40), + ), + ), + Expanded(child: OrganizationList(model: model)), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + ], + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/pre_auth_screens/set_url.dart b/lib/views/pre_auth_screens/set_url.dart new file mode 100644 index 000000000..ebc451f37 --- /dev/null +++ b/lib/views/pre_auth_screens/set_url.dart @@ -0,0 +1,236 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/custom_painters/language_icon.dart'; +import 'package:talawa/custom_painters/talawa_logo.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/pre_auth_view_models/set_url_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +/// This widget lets a user sign in/up with the organization url. +/// +/// The user can enter an organization through the QR code scanner, +/// or enter the organization URL and then login. +/// There is also a signup option which navigates to a screen for the user +/// to select an organization. +/// At the bottom, there is also a gesture detector for changing the language. +class SetUrl extends StatefulWidget { + const SetUrl({required Key key, required this.uri}) : super(key: key); + + /// Variable. + final String uri; + + @override + _SetUrlState createState() => _SetUrlState(); +} + +class _SetUrlState extends State { + @override + Widget build(BuildContext context) { + print("built"); + return BaseView( + onModelReady: (model) => model.initialise(inviteUrl: widget.uri), + builder: (context, model, child) { + return Scaffold( + key: const Key('SetUrlScreenScaffold'), + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.safeBlockVertical! * 4, + SizeConfig.screenWidth! * 0.06, + 0.0, + ), + width: SizeConfig.screenWidth, + height: SizeConfig.screenHeight, + alignment: Alignment.center, + child: SingleChildScrollView( + child: Form( + key: model.formKey, + autovalidateMode: model.validate, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only( + top: SizeConfig.safeBlockVertical! * 2, + ), + // QR code scanner for joining the organization. + child: IconButton( + icon: const Icon( + Icons.qr_code_scanner, + size: 30, + semanticLabel: 'Join Organisation with QR', + ), + onPressed: () => model.scanQR(context), + // model.scanQR(context), + ), + ), + Padding( + padding: EdgeInsets.only( + top: SizeConfig.screenHeight! * 0.08, + ), + child: CustomPaint( + key: const Key('LogoPainter'), + size: Size( + SizeConfig.screenWidth! * 0.6, + SizeConfig.screenWidth! * 0.6, + ), + painter: AppLogo(), + ), + ), + CustomRichText( + key: const Key('UrlPageText'), + words: model.greeting, + ), + //Form input for entering the organization URL + TextFormField( + key: const Key('UrlInputField'), + controller: model.url, + focusNode: model.urlFocus, + textInputAction: TextInputAction.done, + keyboardType: TextInputType.text, + enableSuggestions: true, + validator: (value) { + final String? msg = Validator.validateURL(value!); + if (msg == null) { + return null; + } + + return AppLocalizations.of(context)!.translate(msg); + }, + onFieldSubmitted: (value) => + AppLocalizations.of(context)! + .translate(Validator.validateURL(value)), + decoration: InputDecoration( + labelText: + '${AppLocalizations.of(context)!.translate("Enter Community URL")} *', + labelStyle: Theme.of(context).textTheme.titleMedium, + suffixIcon: InkWell( + key: const Key('VerifyButton'), + onTap: () async { + model.urlFocus.unfocus(); + model.validate = AutovalidateMode.always; + model.formKey.currentState!.validate(); + + /// Checking url. If valid, than show the pop-up + await model.checkURLandShowPopUp(''); + }, + child: Container( + height: 48, + width: 48, + alignment: Alignment.center, + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Verify"), + style: Theme.of(context).textTheme.bodyLarge, + textAlign: TextAlign.center, + ), + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.086, + ), + //Login button. + RaisedRoundedButton( + key: const Key('LoginButton'), + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Login'), + onTap: () async { + /// Checking url. If valid, than navigating to login route + await model.checkURLandNavigate('/login', ''); + }, + showArrow: true, + textColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + backgroundColor: Theme.of(context).colorScheme.tertiary, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + //Sign up button. + RaisedRoundedButton( + key: const Key('SignUpButton'), + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Sign Up'), + onTap: () => model.checkURLandNavigate( + '/selectOrg', + model.orgId, + ), + showArrow: true, + textColor: + Theme.of(context).colorScheme.secondaryContainer, + backgroundColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.06, + ), + //Gesture Detector which navigates to a different screen for changing the language. + GestureDetector( + key: const Key('ChangeLanguage'), + onTap: () { + navigationService + .pushScreen(Routes.languageSelectionRoute); + }, + child: Padding( + padding: EdgeInsets.only( + bottom: SizeConfig.safeBlockVertical! * 2, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CustomPaint( + size: Size( + SizeConfig.screenWidth! * 0.125, + SizeConfig.screenWidth! * 0.125 * 0.5, + ), + painter: LanguageIcon(), + ), + const SizedBox( + width: 10, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Change language'), + style: Theme.of(context) + .textTheme + .titleLarge! + .copyWith( + color: Theme.of(context) + .colorScheme + .surface + .withOpacity(0.8), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/pre_auth_screens/signup_details.dart b/lib/views/pre_auth_screens/signup_details.dart new file mode 100644 index 000000000..06a39bb5c --- /dev/null +++ b/lib/views/pre_auth_screens/signup_details.dart @@ -0,0 +1,303 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/pre_auth_view_models/signup_details_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; +import 'package:talawa/widgets/rich_text.dart'; +import 'package:talawa/widgets/signup_progress_indicator.dart'; + +/// This widget takes the user details for signup. The form includes first name, last name, email, password, and password confirmation inputs. +class SignUpDetails extends StatefulWidget { + const SignUpDetails({required Key key, required this.selectedOrg}) + : super(key: key); + + /// Details of selected Organisation. + final OrgInfo selectedOrg; + @override + _SignUpDetailsState createState() => _SignUpDetailsState(); +} + +class _SignUpDetailsState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(widget.selectedOrg), + builder: (context, model, child) { + return Scaffold( + resizeToAvoidBottomInset: + true, // To allow the keyboard to not overlap the form + extendBodyBehindAppBar: true, + appBar: AppBar( + elevation: 0.0, + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + leading: IconButton( + icon: const Icon( + Icons.arrow_back, + ), + onPressed: () { + navigationService.pop(); + }, + ), + ), + body: Padding( + padding: EdgeInsets.only(top: SizeConfig.safeBlockVertical! * 6), + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SignupProgressIndicator( + key: const Key('SelectOrg'), + currentPageIndex: 1, + ), + Form( + key: model.formKey, + autovalidateMode: model.validate, + child: Column( + children: [ + Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.screenWidth! * 0.05, + SizeConfig.screenWidth! * 0.06, + 0.0, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomRichText( + key: const Key('UrlPageText'), + words: model.greeting, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), //Input field for the first name of the user. + TextFormField( + key: const Key('FirstNameInputField'), + controller: model.firstName, + textInputAction: TextInputAction.next, + keyboardType: TextInputType.text, + autofillHints: const [ + AutofillHints.givenName, + ], + enableSuggestions: true, + validator: (value) { + final String? msg = + Validator.validateFirstName( + value!, + ); + if (msg == null) { + return null; + } + return AppLocalizations.of(context)! + .translate( + Validator.validateFirstName( + value, + ), + ); + }, + decoration: InputDecoration( + hintText: AppLocalizations.of( + context, + )! + .translate('First Name Hint'), + labelText: + '${AppLocalizations.of(context)!.translate("Enter your first name")}*', + labelStyle: + Theme.of(context).textTheme.titleMedium, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.015, + ), //Input field for the last name of the user. + TextFormField( + key: const Key('LastNameInputField'), + controller: model.lastName, + textInputAction: TextInputAction.next, + keyboardType: TextInputType.text, + autofillHints: const [ + AutofillHints.familyName, + ], + enableSuggestions: true, + validator: (value) { + final String? msg = + Validator.validateLastName( + value!, + ); + if (msg == null) { + return null; + } + return AppLocalizations.of(context)! + .translate( + Validator.validateLastName(value), + ); + }, + decoration: InputDecoration( + hintText: AppLocalizations.of( + context, + )! + .translate('Last Name Hint'), + labelText: + '${AppLocalizations.of(context)!.translate("Enter your last name")}*', + labelStyle: + Theme.of(context).textTheme.titleMedium, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.015, + ), + //Input field for the email of the user. + TextFormField( + key: const Key('signUpEmailField'), + controller: model.email, + textInputAction: TextInputAction.next, + keyboardType: TextInputType.emailAddress, + autofillHints: const [ + AutofillHints.email, + ], + enableSuggestions: true, + validator: (value) { + final String? msg = + Validator.validateEmail(value!); + if (msg == null) { + return null; + } + + return AppLocalizations.of(context)! + .translate( + Validator.validateEmail(value), + ); + }, + decoration: InputDecoration( + hintText: 'test@test.org', + labelText: + '${AppLocalizations.of(context)!.translate("Enter your registered Email")}*', + labelStyle: + Theme.of(context).textTheme.titleMedium, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.015, + ), //Input field for the password of the user. + TextFormField( + key: const Key('signuppassword'), + controller: model.password, + textInputAction: TextInputAction.next, + keyboardType: TextInputType.visiblePassword, + obscureText: model.hidePassword, + autofillHints: const [ + AutofillHints.password, + ], + enableSuggestions: true, + validator: (value) { + final String? msg = + Validator.validatePassword( + value!, + ); + if (msg == null) { + return null; + } + + return AppLocalizations.of(context)! + .translate( + Validator.validatePassword(value), + ); + }, + onFieldSubmitted: (done) { + FocusScope.of(context).requestFocus( + model.confirmFocus, + ); + }, + decoration: InputDecoration( + suffixIcon: IconButton( + onPressed: () { + setState(() { + model.hidePassword = + !model.hidePassword; + }); + }, + icon: Icon( + model.hidePassword + ? Icons.visibility_off + : Icons.visibility, + ), + ), + hintText: AppLocalizations.of(context)! + .translate('password'), + labelText: + '${AppLocalizations.of(context)!.translate("Enter your password")}*', + labelStyle: + Theme.of(context).textTheme.titleMedium, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.015, + ), //Input field for the confirmation of the password of the user. + TextFormField( + controller: model.confirmPassword, + focusNode: model.confirmFocus, + textInputAction: TextInputAction.done, + keyboardType: TextInputType.text, + enableSuggestions: true, + autofillHints: const [ + AutofillHints.password, + ], + obscureText: model.hidePassword, + validator: (value) { + final String? msg = + Validator.validatePasswordConfirm( + model.password.text, + value!, + ); + if (msg == null) { + return null; + } + return AppLocalizations.of(context)! + .translate( + Validator.validatePasswordConfirm( + model.password.text, + value, + ), + ); + }, + decoration: InputDecoration( + hintText: AppLocalizations.of(context)! + .translate('password'), + labelText: + '${AppLocalizations.of(context)!.translate("Confirm your password")}*', + labelStyle: + Theme.of(context).textTheme.titleMedium, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.086, + ), + ], + ), + ), //Sign up button. + RaisedRoundedButton( + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Next'), + onTap: model.signUp, + textColor: const Color(0xFF008A37), + key: const Key('SignUpLoginDetailsButton'), + backgroundColor: Colors.white, + ), + ], + ), + ), + ], + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/pre_auth_screens/waiting_screen.dart b/lib/views/pre_auth_screens/waiting_screen.dart new file mode 100644 index 000000000..5615793c1 --- /dev/null +++ b/lib/views/pre_auth_screens/waiting_screen.dart @@ -0,0 +1,128 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/pre_auth_view_models/waiting_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_list_tile.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; +import 'package:talawa/widgets/rich_text.dart'; +import 'package:talawa/widgets/signup_progress_indicator.dart'; + +/// Displays a screen instructing the user to wait for approval. +class WaitingPage extends StatelessWidget { + const WaitingPage({super.key}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(context), + builder: (context, model, child) { + return Scaffold( + key: const Key('WaitingPageScaffold'), + extendBodyBehindAppBar: true, + appBar: AppBar( + elevation: 0.0, + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + ), + body: Container( + padding: EdgeInsets.only(top: SizeConfig.safeBlockVertical! * 6), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SignupProgressIndicator( + key: const Key('Waiting'), + currentPageIndex: 2, + ), + Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.screenHeight! * 0.01, + SizeConfig.screenWidth! * 0.06, + SizeConfig.screenHeight! * 0.01, + ), + width: SizeConfig.screenWidth, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //Greeting text + CustomRichText( + key: const Key('WaitingPageText'), + words: model.greeting, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.03, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Request Sent to'), + style: Theme.of(context).textTheme.titleLarge, + ), + ], + ), + ), + //Information of the organization to which the request is sent. + Expanded( + child: ListView.builder( + key: const Key('PendingRequestList'), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemCount: model.pendingRequestOrg.length, + itemBuilder: (BuildContext context, int index) { + return CustomListTile( + key: const Key('WaitingJoin'), + index: index, + type: TileType.org, + orgInfo: model.pendingRequestOrg[index], + onTapOrgInfo: (item) {}, + ); + }, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + //Join organization button + RaisedRoundedButton( + key: const Key('JoinOrg'), + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Join Organisation'), + onTap: model.joinOrg, + showArrow: true, + textColor: Theme.of(context).colorScheme.secondaryContainer, + backgroundColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + //Logout button + RaisedRoundedButton( + key: const Key('Logout'), + buttonLabel: + AppLocalizations.of(context)!.strictTranslate('Log out'), + onTap: model.logout, + textColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + backgroundColor: + Theme.of(context).colorScheme.secondaryContainer, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + ], + ), + ), + ); + }, + ); + } +} diff --git a/lib/views/widgets/_widgets.dart b/lib/views/widgets/_widgets.dart deleted file mode 100644 index c1f2dc318..000000000 --- a/lib/views/widgets/_widgets.dart +++ /dev/null @@ -1,3 +0,0 @@ -export 'about_tile.dart'; -export 'common_divider.dart'; -export 'snackbar.dart'; diff --git a/lib/views/widgets/about_tile.dart b/lib/views/widgets/about_tile.dart deleted file mode 100644 index 2d9f58356..000000000 --- a/lib/views/widgets/about_tile.dart +++ /dev/null @@ -1,52 +0,0 @@ -//flutter package imported -import 'package:flutter/material.dart'; -import 'package:talawa/utils/package_info.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -//pages are imported here -import 'package:talawa/utils/uidata.dart'; - -class MyAboutTile extends StatefulWidget { - @override - _MyAboutTileState createState() => _MyAboutTileState(); -} - -class _MyAboutTileState extends State { - Map packageInfo = {}; - @override - void initState() { - initPackageInfo(); - super.initState(); - } - - Future initPackageInfo() async { - packageInfo = await PackageDetails.getInfo(); - setState(() {}); - print(packageInfo); - } - - @override - Widget build(BuildContext context) { - return AboutListTile( - // ignore: sized_box_for_whitespace - applicationIcon: Container( - width: SizeConfig.safeBlockHorizontal * 12.5, - height: SizeConfig.safeBlockVertical * 6.25, - child: Image.asset('assets/images/talawaLogo-dark.png'), - ), - icon: Image.asset('assets/images/talawaLogo-dark.png'), - aboutBoxChildren: [ - SizedBox( - height: SizeConfig.safeBlockVertical * 1.25, - ), - const Text( - "Collaborative", - ), - ], - applicationName: UIData.appName, - applicationVersion: - packageInfo != null ? packageInfo['version'].toString() : "Loading..", - applicationLegalese: "Apache License 2.0", - ); - } -} diff --git a/lib/views/widgets/alert_dialog_box.dart b/lib/views/widgets/alert_dialog_box.dart deleted file mode 100644 index 3698d4d4e..000000000 --- a/lib/views/widgets/alert_dialog_box.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; - -class AlertBox extends StatefulWidget { - const AlertBox({this.message, this.function}); - - final String message; - final Function function; - - @override - _AlertBoxState createState() => _AlertBoxState(); -} - -class _AlertBoxState extends State { - @override - Widget build(BuildContext context) { - return AlertDialog( - title: const Text("Confirmation"), - content: Text(widget.message), - actions: [ - ElevatedButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("Close"), - ), - ElevatedButton( - onPressed: () async { - print('here'); - widget.function(); - Navigator.pop(context); - }, - child: const Text("Yes"), - ) - ], - ); - } -} diff --git a/lib/views/widgets/common_divider.dart b/lib/views/widgets/common_divider.dart deleted file mode 100644 index 8df3d6334..000000000 --- a/lib/views/widgets/common_divider.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -class CommonDivider extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Divider( - color: Colors.grey.shade300, - height: SizeConfig.safeBlockVertical, - ); - } -} diff --git a/lib/views/widgets/custom_appbar.dart b/lib/views/widgets/custom_appbar.dart deleted file mode 100644 index 322c8dd91..000000000 --- a/lib/views/widgets/custom_appbar.dart +++ /dev/null @@ -1,83 +0,0 @@ -//flutter package imported here -import 'package:flutter/material.dart'; - -//imported the pages here -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/services/queries_.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -//We are currently adding the app bar here - -class CustomAppBar extends StatefulWidget with PreferredSizeWidget { - CustomAppBar( - this.title, { - Key key, - }) : preferredSize = const Size.fromHeight(55.0), - super(key: key); - - final String title; - - @override - final Size preferredSize; - - @override - _CustomAppBarState createState() => _CustomAppBarState(); -} - -class _CustomAppBarState extends State { - final Queries _query = Queries(); - GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration(); - Preferences preferences = Preferences(); - String _imgSrc; - - @override - void initState() { - super.initState(); - getImg(); - } - - Future getImg() async { - //this function gets the image from the graphql query - final GraphQLClient _client = graphQLConfiguration.clientToQuery(); - final String orgId = await preferences.getCurrentOrgId(); - - final QueryResult result = await _client - .query(QueryOptions(documentNode: gql(_query.fetchOrgById(orgId)))); - if (result.hasException) { - print(result.exception); - } else if (!result.hasException) { - // print(result.data); - setState(() { - _imgSrc = result.data['organizations'][0]['image'].toString(); - }); - } - } - - @override - Widget build(BuildContext context) { - return AppBar( - title: Text( - widget.title, - style: const TextStyle(color: Colors.white), - ), - leading: _imgSrc != null - ? Padding( - padding: EdgeInsets.all(SizeConfig.safeBlockHorizontal), - child: CircleAvatar( - radius: SizeConfig.safeBlockVertical * 5, - backgroundImage: NetworkImage( - Provider.of(context).displayImgRoute + - _imgSrc), - )) - : Padding( - padding: EdgeInsets.all(SizeConfig.safeBlockHorizontal), - child: CircleAvatar( - radius: SizeConfig.safeBlockVertical * 5, - backgroundImage: const AssetImage("assets/images/team.png")), - ), - ); - } -} diff --git a/lib/views/widgets/internet_connectivity.dart b/lib/views/widgets/internet_connectivity.dart deleted file mode 100644 index 85763da17..000000000 --- a/lib/views/widgets/internet_connectivity.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:flutter/material.dart'; - -//this file is there to check the internet connectivity of the device it is being running - -class NoInternetConnection extends StatefulWidget { - @override - _NoInternetConnectionState createState() => _NoInternetConnectionState(); -} - -class _NoInternetConnectionState extends State { - @override - Widget build(BuildContext context) { - return Container( - child: Center( - child: Column( - children: const [ - Text( - 'No Internet Connection.', - style: TextStyle(fontSize: 20), - textAlign: TextAlign.center, - ), - Icon( - Icons.signal_cellular_connected_no_internet_4_bar, - color: Colors.red, - ) - ], - )), - ); - } -} diff --git a/lib/views/widgets/loading.dart b/lib/views/widgets/loading.dart deleted file mode 100644 index 5c7aa34aa..000000000 --- a/lib/views/widgets/loading.dart +++ /dev/null @@ -1,74 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -class Loading extends StatefulWidget { - const Loading({Key key, this.isShowingError}) : super(key: key); - final bool isShowingError; - @override - _LoadingState createState() => _LoadingState(); -} - -class _LoadingState extends State { - bool loading = true; - Timer _timer; - void loadingFunc() { - if (mounted) { - setState(() { - loading = true; - }); - } - _timer = Timer(const Duration(seconds: 10), () { - if (mounted) { - setState(() { - loading = false; - }); - } - }); - } - - @override - void initState() { - super.initState(); - loadingFunc(); - print(1); - } - - @override - void didUpdateWidget(Loading oldWidget) { - super.didUpdateWidget(oldWidget); - loadingFunc(); - } - - @override - void dispose() { - super.dispose(); - _timer.cancel(); - } - - @override - Widget build(BuildContext context) { - return loading && widget.isShowingError == null - ? const CircularProgressIndicator() - : Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset( - 'assets/images/error.svg', - width: SizeConfig.screenWidth / 1.3, - ), - SizedBox(height: SizeConfig.safeBlockVertical * 3.75), - Text( - widget.isShowingError != null - ? widget.isShowingError - ? "Something went wrong" - : "No News Feed to show" - : 'No data or something went wrong', - style: const TextStyle(color: Colors.red), - ), - ], - ); - } -} diff --git a/lib/views/widgets/show_progress.dart b/lib/views/widgets/show_progress.dart deleted file mode 100644 index 00eee2591..000000000 --- a/lib/views/widgets/show_progress.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:progress_dialog/progress_dialog.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -ProgressDialog progressDialog; - -Future showProgress(BuildContext context, String message, - {@required bool isDismissible}) async { - progressDialog = ProgressDialog(context, - type: ProgressDialogType.Normal, isDismissible: isDismissible); - progressDialog.style( - message: message, - borderRadius: SizeConfig.safeBlockVertical * 1.25, - progressWidget: Container( - padding: EdgeInsets.all(SizeConfig.safeBlockVertical), - child: const CircularProgressIndicator( - backgroundColor: Colors.white, - )), - elevation: 10.0, - insetAnimCurve: Curves.easeInOut, - messageTextStyle: const TextStyle( - color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600)); - await progressDialog.show(); -} - -updateProgress(String message) { - progressDialog.update(message: message); -} - -hideProgress() async { - await progressDialog.hide(); -} diff --git a/lib/views/widgets/snackbar.dart b/lib/views/widgets/snackbar.dart deleted file mode 100644 index 5ef090bbf..000000000 --- a/lib/views/widgets/snackbar.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -//creating the snackbar here to be shown if any error is occurred - -class SnackBarFactory extends StatelessWidget { - const SnackBarFactory(this.msg); - - final String msg; - - @override - Widget build(BuildContext context) { - return SnackBar(content: Text(msg)); - } -} diff --git a/lib/views/widgets/success_toast.dart b/lib/views/widgets/success_toast.dart deleted file mode 100644 index 4d8a9652f..000000000 --- a/lib/views/widgets/success_toast.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -//Here we are making the Success bar it will be called when user gets some success - -class SuccessToast extends StatefulWidget { - const SuccessToast(this.msg); - final String msg; - - @override - _SuccessToastState createState() => _SuccessToastState(); -} - -class _SuccessToastState extends State { - FToast fToast; - - @override - // ignore: type_annotate_public_apis - initState() { - super.initState(); - fToast = FToast(); - fToast.init(context); - } - - @override - Widget build(BuildContext context) { - return _successToast() as Widget; - } - - _successToast() { - final Widget toast = Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 5, - vertical: SizeConfig.safeBlockVertical * 1.5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: Colors.green, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(widget.msg), - ], - ), - ); - - fToast.showToast( - child: toast, - gravity: ToastGravity.BOTTOM, - toastDuration: const Duration(seconds: 3), - ); - } -} diff --git a/lib/views/widgets/text_field_decoration.dart b/lib/views/widgets/text_field_decoration.dart deleted file mode 100644 index 911a7e6d5..000000000 --- a/lib/views/widgets/text_field_decoration.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:talawa/utils/uidata.dart'; - -class FormFieldFormatting { - static InputDecoration formFieldFormatting( - {String hintText, String labelText, IconData prefixIcon}) { - return InputDecoration( - border: OutlineInputBorder( - borderSide: const BorderSide(color: UIData.secondaryColor), - borderRadius: BorderRadius.circular(20.0)), - prefixIcon: Icon(prefixIcon, color: UIData.secondaryColor), - labelText: labelText, - labelStyle: const TextStyle(color: Colors.black), - alignLabelWithHint: true, - hintText: hintText, - hintStyle: const TextStyle(color: Colors.grey), - ); - } -} diff --git a/lib/views/widgets/toast_tile.dart b/lib/views/widgets/toast_tile.dart deleted file mode 100644 index 15fae8ff9..000000000 --- a/lib/views/widgets/toast_tile.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:talawa/utils/ui_scaling.dart'; - -class ToastTile extends StatelessWidget { - const ToastTile({this.success, this.msg}); - - final bool success; - final String msg; - - @override - Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig.safeBlockHorizontal * 6, - vertical: SizeConfig.safeBlockVertical * 1.75), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.0), - color: success ? Colors.green : Colors.red, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(msg), - ], - ), - ); - } -} diff --git a/lib/widgets/add_members_bottom_sheet.dart b/lib/widgets/add_members_bottom_sheet.dart new file mode 100644 index 000000000..874a2493b --- /dev/null +++ b/lib/widgets/add_members_bottom_sheet.dart @@ -0,0 +1,126 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; + +/// Adds members to an event. +class EventBottomSheet { + /// This function creates a modal material design bottom sheet. + /// + /// to let the user add admin or members to an organization. + /// **params**: + /// * `context`: BuildContext + /// * `model`: CreateEventViewModel + /// + /// **returns**: + /// None + void addUserBottomSheet({ + required BuildContext context, + required CreateEventViewModel model, + }) { + // Returns a Future that resolves to the value ("context") passed + // to Navigator.pop + showModalBottomSheet( + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + isScrollControlled: true, + builder: (BuildContext context) { + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: Container( + height: MediaQuery.of(context).size.height * 0.8, + decoration: BoxDecoration( + color: Theme.of(context).scaffoldBackgroundColor, + ), + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Text( + AppLocalizations.of(context)! + .strictTranslate("Add Members"), + style: const TextStyle(fontSize: 16), + ), + TextButton( + key: const Key('text_btn_ambs1'), + onPressed: () { + model.buildUserList(); + Navigator.pop(context); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Done'), + ), + ), + const Divider(), + FutureBuilder( + // an admin can access the list of the members in an organization + future: model.getCurrentOrgUsersList(), + builder: ( + BuildContext context, + AsyncSnapshot> snapshot, + ) { + if (snapshot.data == null) { + return const Center( + child: CircularProgressIndicator(), + ); + } else { + return snapshot.data!.isEmpty + ? const Center( + child: Text( + "There aren't any members in this organization.", + ), + ) + // Displaying the list of the members + : Flexible( + child: ListView.builder( + shrinkWrap: true, + itemCount: snapshot.data!.length, + itemBuilder: (context, index) { + return CheckboxListTile( + checkColor: Theme.of(context) + .colorScheme + .surface, + activeColor: Theme.of(context) + .colorScheme + .primary, + title: Text( + "${snapshot.data![index].firstName!} ${snapshot.data![index].lastName!}", + ), + value: model.memberCheckedMap[ + snapshot.data![index].id], + onChanged: (val) { + setState( + () { + model.memberCheckedMap[snapshot + .data![index].id!] = val!; + }, + ); + }, + ); + }, + ), + ); + } + }, + ), + ], + ), + ), + ), + ); + }, + ); + }, + ); + } +} diff --git a/lib/widgets/agenda_item_tile.dart b/lib/widgets/agenda_item_tile.dart new file mode 100644 index 000000000..991d6ac3c --- /dev/null +++ b/lib/widgets/agenda_item_tile.dart @@ -0,0 +1,202 @@ +import 'dart:convert'; +import 'dart:typed_data'; +import 'package:flutter/material.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; + +/// A widget that displays an expandable agenda item tile. +class ExpandableAgendaItemTile extends StatelessWidget { + const ExpandableAgendaItemTile({ + super.key, + required this.item, + required this.onEdit, + required this.onDelete, + }); + + /// Agenda Item whose data to be displayed. + final EventAgendaItem item; + + /// edit callback for the agenda item. + final VoidCallback onEdit; + + /// on delete callback for agenda item. + final VoidCallback onDelete; + + @override + Widget build(BuildContext context) { + return Card( + color: const Color.fromARGB(255, 70, 69, 69), + margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + child: ExpansionTile( + leading: ReorderableDragStartListener( + key: const Key('reorder_icon'), + index: item.sequence! - 1, + child: const Icon(Icons.drag_handle), + ), + title: Text( + item.title!, + style: const TextStyle( + color: Colors.green, + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + key: Key("edit_agenda_item${item.id}"), + icon: const Icon(Icons.edit, color: Colors.blue, size: 20), + onPressed: onEdit, + ), + IconButton( + key: Key("delete_agenda_item${item.id}"), + icon: const Icon(Icons.delete, color: Colors.red, size: 20), + onPressed: onDelete, + ), + ], + ), + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Categories:', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14), + ), + const SizedBox(height: 4), + Wrap( + spacing: 8, + children: (item.categories ?? []).map((category) { + return Chip( + label: Text( + category.name!, + style: const TextStyle(fontSize: 12), + ), + padding: const EdgeInsets.all(4), + ); + }).toList(), + ), + const SizedBox(height: 8), + const Text( + 'Description:', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14), + ), + const SizedBox(height: 4), + Text(item.description ?? ''), + const SizedBox(height: 8), + const Text( + 'Duration:', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14), + ), + const SizedBox(height: 4), + Text(item.duration ?? ''), + const SizedBox(height: 8), + if ((item.urls ?? []).isNotEmpty) ...[ + const Text( + 'URLs:', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14), + ), + const SizedBox(height: 4), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: (item.urls ?? []).map((url) { + return Text( + url, + style: const TextStyle(fontSize: 14), + ); + }).toList(), + ), + const SizedBox(height: 8), + ], + if ((item.attachments ?? []).isNotEmpty) ...[ + const Text( + 'Attachments:', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14), + ), + const SizedBox(height: 4), + GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + ), + itemCount: item.attachments!.length, + itemBuilder: (context, index) { + final base64String = item.attachments![index]; + try { + final imageData = base64Decode(base64String); + return GestureDetector( + onTap: () => _showFullScreenImage(context, imageData), + child: ClipRRect( + borderRadius: BorderRadius.circular(8), + child: Image.memory( + imageData, + fit: BoxFit.cover, + width: double.infinity, + height: double.infinity, + ), + ), + ); + } catch (e) { + return Container( + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(8), + ), + child: const Icon( + Icons.attachment, + color: Colors.white, + ), + ); + } + }, + ), + const SizedBox(height: 8), + ], + ], + ), + ), + ], + ), + ); + } + + /// show Image in full screen mode. + /// + /// **params**: + /// * `context`: context for the image + /// * `imageData`: data of the Image that is to be viewed + /// + /// **returns**: + /// None + void _showFullScreenImage(BuildContext context, Uint8List imageData) { + showDialog( + context: context, + builder: (BuildContext context) { + return GestureDetector( + onTap: () => Navigator.of(context).pop(), + child: ColoredBox( + color: Colors.black.withOpacity(0.5), + child: Center( + child: InteractiveViewer( + panEnabled: true, + boundaryMargin: const EdgeInsets.all(20), + minScale: 0.5, + maxScale: 4, + child: Image.memory( + imageData, + fit: BoxFit.contain, + ), + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/widgets/create_recurring_event_helper_widgets.dart b/lib/widgets/create_recurring_event_helper_widgets.dart new file mode 100644 index 000000000..df3d0240e --- /dev/null +++ b/lib/widgets/create_recurring_event_helper_widgets.dart @@ -0,0 +1,326 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:intl/intl.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; +import 'package:talawa/widgets/date_time_picker.dart'; + +/// Builds a rectangle with custom properties. +class CustomRectangle extends StatelessWidget { + const CustomRectangle({ + super.key, + required this.child, + }); + + /// widget that is wrapped with CustomRectangle. + final Widget child; + + @override + Widget build(BuildContext context) { + final repeatEveryBoxDecoration = BoxDecoration( + border: Border.all( + color: Theme.of(context).textTheme.bodyLarge!.color!, + width: 1, + ), + borderRadius: BorderRadius.circular(5), + ); + return Container( + decoration: repeatEveryBoxDecoration, + child: Center(child: child), + ); + } +} + +/// Builds a TextField with custom properties. +class CustomTextField extends StatelessWidget { + const CustomTextField({ + super.key, + this.maxTextLength, + required this.textEditingController, + this.readOnly = false, + this.enabled, + }); + + /// Max textLength the text field allows. + final int? maxTextLength; + + /// Controller of textField. + final TextEditingController textEditingController; + + /// Indicates wether text field is enabled. + final bool? enabled; + + /// Indicates wether text field is read only. + final bool readOnly; + + @override + Widget build(BuildContext context) { + final outLineBorder = OutlineInputBorder( + borderSide: + BorderSide(color: Theme.of(context).textTheme.bodyLarge!.color!), + ); + return SizedBox( + width: SizeConfig.screenWidth! * 0.15, + child: TextField( + maxLength: maxTextLength, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + controller: textEditingController, + decoration: InputDecoration( + counterText: "", + enabledBorder: outLineBorder, + focusedBorder: outLineBorder, + border: outLineBorder, + disabledBorder: outLineBorder, + contentPadding: const EdgeInsets.symmetric(vertical: 14), + ), + enabled: enabled, + readOnly: readOnly, + ), + ); + } +} + +/// Recurrence Frequency selection widget. +class RecurrenceFrequencyDropdown extends StatefulWidget { + const RecurrenceFrequencyDropdown({ + required this.model, + required this.onSelected, + required this.options, + required this.selectedOption, + }); + + /// Instance of create event view model. + final CreateEventViewModel model; + + /// Callback to be executed when selected value changes. + final void Function(String)? onSelected; + + /// Options to be shown in dropdown. + final List options; + + /// Selected option. + final String selectedOption; + + @override + _RecurrenceFrequencyDropdownState createState() => + _RecurrenceFrequencyDropdownState(); +} + +class _RecurrenceFrequencyDropdownState + extends State { + @override + Widget build(BuildContext context) { + return CustomRectangle( + child: Container( + padding: const EdgeInsets.all(12), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment + .center, // Align the row's contents to the center horizontally + children: [ + PopupMenuButton( + offset: const Offset(0, 40), + itemBuilder: (BuildContext context) { + return >[ + for (int i = 0; i < widget.options.length; i++) + PopupMenuItem( + value: widget.options[i], + child: Text(widget.options[i]), + ), + ]; + }, + onSelected: widget.onSelected, + tooltip: 'Select option', + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + widget.selectedOption, + overflow: TextOverflow.ellipsis, + ), + const Icon(Icons.arrow_drop_down), + ], + ), + ), + ], + ), + ), + ), + ); + } +} + +/// Event ending configuration options. +class EventEndOptions extends StatefulWidget { + const EventEndOptions({super.key, required this.model}); + + /// Instance of create event view model. + final CreateEventViewModel model; + + @override + State createState() => _EventEndOptionsState(); +} + +class _EventEndOptionsState extends State { + /// Event end types. + List eventEndTypes = [ + EventEndTypes.never, + EventEndTypes.on, + EventEndTypes.after, + ]; + + /// Custom inline width. + static const inlineWidth = SizedBox( + width: 8, + ); + + @override + void initState() { + if (widget.model.eventEndType == EventEndTypes.never) { + widget.model.recurrenceEndDate = null; + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + radioButton( + key: const Key('neverRadioButton'), + child: const Text(EventEndTypes.never), + index: 0, + inputAction: () { + setState(() { + widget.model.count = null; + widget.model.recurrenceEndDate = null; + widget.model.eventEndType = EventEndTypes.never; + }); + }, + ), + radioButton( + key: const Key('onRadioButton'), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Text(EventEndTypes.on), + inlineWidth, + CustomRectangle( + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 4), + child: IconButton( + key: const Key('dateSelectorCalendar'), + // button to select the date and time of an event. + onPressed: () async { + // initially pickedDate is initialised with current end time. + final pickedDate = await customDatePicker( + initialDate: DateTime.now(), + ); + setState(() { + widget.model.recurrenceEndDate = pickedDate; + widget.model.eventEndType = EventEndTypes.on; + }); + }, + icon: Text( + formatDate( + (widget.model.recurrenceEndDate ?? DateTime.now()) + .toString() + .split(" ")[0], + ), + style: widget.model.eventEndType == EventEndTypes.on + ? TextStyle(color: Theme.of(context).dividerColor) + : TextStyle( + color: Theme.of(context) + .dividerColor + .withOpacity(0.4), + ), + ), + ), + ), + ), + ], + ), + index: 1, + inputAction: () { + setState(() { + widget.model.recurrenceEndDate = DateTime.now(); + widget.model.eventEndType = EventEndTypes.on; + widget.model.count = null; + }); + }, + ), + radioButton( + key: const Key('afterRadioButton'), + child: Row( + children: [ + const Text(EventEndTypes.after), + inlineWidth, + CustomTextField( + enabled: widget.model.eventEndType == EventEndTypes.after, + maxTextLength: 3, + textEditingController: widget.model.endOccurenceController, + ), + inlineWidth, + const Text('occurrence'), + ], + ), + index: 2, + inputAction: () { + setState(() { + widget.model.recurrenceEndDate = null; + widget.model.eventEndType = EventEndTypes.after; + }); + }, + ), + ], + ); + } + + /// Custom radio button to select event ending eventEndType. + /// + /// **params**: + /// * `key`: Uniquely identifies the radioButton. + /// * `child`: RadioListTile widget. + /// * `index`: index of [eventEndType]. + /// * `inputAction`: Call back to be executed when clicked on radio button. + /// + /// **returns**: + /// * `Theme`: custom theme. + Theme radioButton({ + required Key key, + required Widget child, + required int index, + Function()? inputAction, + }) { + return Theme( + key: key, + data: Theme.of(context).copyWith(focusColor: Colors.transparent), + child: RadioListTile( + title: child, + value: eventEndTypes[index], + groupValue: widget.model.eventEndType, + onChanged: (value) { + setState(() { + widget.model.eventEndType = value!; + inputAction?.call(); + }); + }, + ), + ); + } + + /// Formats input date into [MMM d, yyyy] format. + /// + /// **params**: + /// * `inputDate`: Unformatted date. + /// + /// **returns**: + /// * `String`: formatted date. + String formatDate(String inputDate) { + final DateTime dateTime = DateTime.parse(inputDate); + return DateFormat("MMM d, yyyy").format(dateTime); + } +} diff --git a/lib/widgets/custom_alert_dialog.dart b/lib/widgets/custom_alert_dialog.dart new file mode 100644 index 000000000..7b434365e --- /dev/null +++ b/lib/widgets/custom_alert_dialog.dart @@ -0,0 +1,101 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; + +/// This Class returns CustomAlertDialog widget. Custom Alert Dialog is a popup. +/// +/// that appeared in the screen showing Alert message along with the event buttons. +/// This extends stateless widget that means it cannot change its state during the +/// runtime of a application. +class CustomAlertDialog extends StatelessWidget { + /// Constructs a [CustomAlertDialog] widget. + /// + /// [reverse] indicates whether the order of action buttons should be reversed. + /// [success] is the function triggered upon tapping the primary action button. + /// [secondaryButtonTap] is the function triggered upon tapping the secondary action button. + /// [successText] is the text displayed on the primary action button. + /// [dialogTitle] is the title displayed in the dialog (default value is 'Confirmation'). + /// [dialogSubTitle] is the subtitle or message content of the dialog. + /// [secondaryButtonText] is the text displayed on the secondary action button (default value is 'Close'). + + const CustomAlertDialog({ + super.key, + this.successText = 'Confirm', + this.dialogTitle = 'Confirmation', + this.reverse = false, + this.secondaryButtonText = 'Close', + this.secondaryButtonTap, + required this.success, + required this.dialogSubTitle, + }); + + /// Indicates whether the order of action buttons should be reversed. + final bool reverse; + + /// Function triggered upon tapping the primary action button. + final Function() success; + + /// Function triggered upon tapping the secondary action button. + final Function()? secondaryButtonTap; + + /// Text displayed on the primary action button. + final String successText; + + /// Title displayed in the dialog (default value is 'Confirmation'). + final String dialogTitle; + + /// Subtitle or message content of the dialog. + final String dialogSubTitle; + + /// Text displayed on the secondary action button (default value is 'Close'). + final String secondaryButtonText; + + @override + Widget build(BuildContext context) { + final List actions = [ + RaisedRoundedButton( + key: Key(secondaryButtonText), + onTap: () { + secondaryButtonTap != null + ? secondaryButtonTap!() + : navigationService.pop(); + }, + buttonLabel: + AppLocalizations.of(context)!.strictTranslate(secondaryButtonText), + textColor: Colors.white, + backgroundColor: const Color(0xFF008A37), + width: SizeConfig.screenWidth! * 0.2, + height: SizeConfig.screenHeight! * 0.06, + ), + RaisedRoundedButton( + key: Key(successText), + onTap: () => success(), + buttonLabel: AppLocalizations.of(context)!.strictTranslate(successText), + textColor: const Color(0xFF008A37), + backgroundColor: Theme.of(context).colorScheme.tertiary, + width: SizeConfig.screenWidth! * 0.2, + height: SizeConfig.screenHeight! * 0.06, + ), + ]; + return AlertDialog( + surfaceTintColor: Theme.of(context).colorScheme.secondaryContainer, + title: Text( + AppLocalizations.of(context)!.strictTranslate(dialogTitle), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontWeight: FontWeight.w800), + ), + content: Text( + AppLocalizations.of(context)!.strictTranslate(dialogSubTitle), + ), + buttonPadding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.05, + vertical: SizeConfig.screenHeight! * 0.05, + ), + actions: reverse ? actions.reversed.toList() : actions, + ); + } +} diff --git a/lib/widgets/custom_avatar.dart b/lib/widgets/custom_avatar.dart new file mode 100644 index 000000000..7d8ce4343 --- /dev/null +++ b/lib/widgets/custom_avatar.dart @@ -0,0 +1,79 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +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 { + const CustomAvatar({ + super.key, + required this.isImageNull, + this.firstAlphabet, + this.cacheManager, + this.imageUrl, + this.fontSize = 40, + this.maxRadius = 16, + }); + + /// 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 + Widget build(BuildContext context) { + return isImageNull + //creating the avatar with the icon-theme color when the image is null + ? CircleAvatar( + backgroundColor: + Theme.of(context).iconTheme.color!.withOpacity(0.2), + maxRadius: maxRadius, + child: Center( + child: Text( + firstAlphabet!, + style: Theme.of(context).textTheme.bodySmall!.copyWith( + fontSize: fontSize, + color: Theme.of(context).colorScheme.onSecondary, + ), + ), + ), + ) + //creating the avatar with the provided image + : CachedNetworkImage( + cacheManager: cacheManager, + imageBuilder: (context, imageProvider) { + return CircleAvatar( + backgroundColor: + Theme.of(context).iconTheme.color!.withOpacity(0.2), + backgroundImage: imageProvider, + ); + }, + imageUrl: imageUrl!, + placeholder: (context, url) => CircleAvatar( + child: Shimmer.fromColors( + baseColor: Colors.transparent, + highlightColor: Colors.white30, + child: const CircleAvatar(), + ), + ), + errorWidget: (context, url, error) => + const CircleAvatar(child: Icon(Icons.error)), + ); + } +} diff --git a/lib/widgets/custom_drawer.dart b/lib/widgets/custom_drawer.dart new file mode 100644 index 000000000..0ebe1f0b7 --- /dev/null +++ b/lib/widgets/custom_drawer.dart @@ -0,0 +1,188 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; +import 'package:talawa/widgets/from_palisadoes.dart'; + +/// Creates a custom drawer for switching organizations. +/// +/// joining new organizations, or leaving an organization. +class CustomDrawer extends StatelessWidget { + const CustomDrawer({ + super.key, + required this.homeModel, + }); + + /// home model. + final MainScreenViewModel homeModel; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(homeModel, context), + builder: (context, model, child) { + return Container( + width: SizeConfig.screenWidth! * 0.6, + alignment: Alignment.centerLeft, + child: Drawer( + key: const Key("Drawer"), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //A material design Drawer header that identifies the app's user. + Expanded( + child: ListView( + children: [ + UserAccountsDrawerHeader( + currentAccountPicture: CustomAvatar( + isImageNull: model.selectedOrg?.image == null, + imageUrl: model.selectedOrg?.image, + firstAlphabet: + model.selectedOrg?.name!.substring(0, 1), + ), + accountName: Column( + key: MainScreenViewModel.keyDrawerCurOrg, + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.selectedOrg?.name! ?? "NULL", + ), + Text( + AppLocalizations.of(context)! + .strictTranslate("Selected Organization"), + ), + ], + ), + accountEmail: const SizedBox(), + ), + //Tile to Switch organizations + Column( + key: MainScreenViewModel.keyDrawerSwitchableOrg, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 5, + horizontal: 8.0, + ), + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Switch Organization"), + style: Theme.of(context).textTheme.titleLarge, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.41, + child: Scrollbar( + controller: model.controller, + thumbVisibility: true, + child: ListView.builder( + key: const Key("Switching Org"), + controller: model.controller, + padding: EdgeInsets.zero, + itemCount: model.switchAbleOrg.length, + // itemCount: 3, + itemBuilder: (BuildContext context, int index) { + return ListTile( + key: const Key("Org"), + onTap: () => model.switchOrg( + model.switchAbleOrg[index], + ), + leading: CustomAvatar( + isImageNull: + model.switchAbleOrg[index].image == + null, + imageUrl: + model.switchAbleOrg[index].image, + firstAlphabet: model + .switchAbleOrg[index].name! + .substring(0, 1), + fontSize: 18, + ), + title: Text( + model.switchAbleOrg[index].name!, + ), + ); + }, + ), + ), + ), + ], + ), + ], + ), + ), + // A Tile to join a new organization + Container( + child: Align( + alignment: FractionalOffset.bottomCenter, + child: Container( + child: Column( + children: [ + const Divider(), + ListTile( + key: MainScreenViewModel.keyDrawerJoinOrg, + onTap: () { + if (userConfig.loggedIn) { + navigationService.popAndPushScreen( + Routes.joinOrg, + arguments: '-1', + ); + } else { + navigationService.popAndPushScreen( + Routes.setUrlScreen, + arguments: '', + ); + } + }, + leading: const Icon( + Icons.add, + size: 30, + ), + title: Text( + AppLocalizations.of(context)! + .strictTranslate("Join new Organization"), + ), + ), + userConfig.loggedIn + ? ListTile( + key: MainScreenViewModel + .keyDrawerLeaveCurrentOrg, + onTap: () => navigationService + .pushDialog(model.exitAlertDialog()), + leading: const Icon(Icons.logout, size: 30), + title: Text( + AppLocalizations.of(context)! + .strictTranslate( + "Leave Current Organization", + ), + ), + ) + : Container(), + SizedBox( + key: const Key("Sized Box Drawer"), + height: SizeConfig.screenHeight! * 0.03, + ), + const FromPalisadoes(key: Key("From Palisadoes")), + SizedBox( + key: const Key("Sized BottomBox Drawer"), + height: SizeConfig.screenHeight! * 0.03, + ), + ], + ), + ), + ), + ), + ], + ), + ), + ); + }, + ); + } +} diff --git a/lib/widgets/custom_list_tile.dart b/lib/widgets/custom_list_tile.dart new file mode 100644 index 000000000..9b0e9114a --- /dev/null +++ b/lib/widgets/custom_list_tile.dart @@ -0,0 +1,195 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/options/options.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; + +/// Returns a widget for rendering Customized tiles. +/// +/// A Tile shows the org info, user info, options that on tap user & org info. +class CustomListTile extends StatelessWidget { + const CustomListTile({ + required Key key, + required this.index, + required this.type, + this.showIcon = false, + this.orgInfo, + this.userInfo, + this.attendeeInfo, + this.option, + this.onTapOrgInfo, + this.onTapUserInfo, + this.onTapAttendeeInfo, + this.onTapOption, + }) : super(key: key); + + /// Index int of tiles. + final int index; + + /// Tiletype object to specify tle type. + final TileType type; + + /// Object containing all the necessary info regarding the org. + final OrgInfo? orgInfo; + + /// Object containing all the necessary info regarding the user. + final User? userInfo; + + /// Object containing all the necessary info regarding the Attendee. + final Attendee? attendeeInfo; + + /// Object containing all the necessary info regarding the options. + final Options? option; + + /// Object containing all the necessary info regarding the onTapOption. + final Function()? onTapOption; + + /// Function to handle the tap on user info. + final Function()? onTapUserInfo; + + /// Function to handle the tap on attendee info. + final Function()? onTapAttendeeInfo; + + /// Function to handle the tap on org info. + final Function(OrgInfo)? onTapOrgInfo; + + /// Flag to determine whether thge Icons should be shown. + final bool showIcon; + + @override + Widget build(BuildContext context) { + Function()? onTap; + + switch (type) { + case TileType.org: + onTap = () => onTapOrgInfo!(orgInfo!); + break; + case TileType.user: + onTap = onTapUserInfo; + break; + case TileType.attendee: + onTap = onTapAttendeeInfo; + break; + default: + onTap = onTapOption; + break; + } + + return InkWell( + // checking whether the tapped tile is of user or org. + onTap: onTap, + child: Padding( + padding: const EdgeInsets.all(18.0), + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 1, + blurRadius: 6, + offset: const Offset(0, 3), + ), + ], + ), + height: 70, + child: Row( + children: [ + Expanded( + flex: 6, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 25, + ), + child: type == TileType.org + ? RichText( + key: const Key('OrgNamewithOrgAddress'), + text: TextSpan( + text: orgInfo!.name, + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + fontSize: 19, + color: Colors.black, + ), + children: [ + if (orgInfo!.address != null) ...[ + const TextSpan(text: ' '), + TextSpan( + text: + '(${orgInfo!.address!.city}, ${orgInfo!.address!.countryCode})', + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + fontSize: 14, + color: const Color.fromARGB( + 255, + 112, + 112, + 112, + ), + ), + ), + ], + ], + ), + ) + : Text( + type == TileType.user + ? '${userInfo!.firstName!} ${userInfo!.lastName!}' + : type == TileType.attendee + ? '${attendeeInfo!.firstName!} ${attendeeInfo!.lastName!}' + : option!.title, + style: + type == TileType.user || type == TileType.attendee + ? Theme.of(context) + .textTheme + .titleLarge! + .copyWith( + fontSize: 18, + color: Colors.black, + ) + : option!.trailingIconButton == null + ? Theme.of(context) + .textTheme + .bodyMedium! + .copyWith( + fontSize: 18, + color: Colors.black, + ) + : Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + fontSize: 18, + color: Colors.black, + ), + ), + ), + ), + Expanded( + flex: 1, + child: type != TileType.user && type != TileType.attendee + ? type == TileType.org + ? Icon( + !orgInfo!.userRegistrationRequired! + ? Icons.lock_open + : Icons.lock, + color: !orgInfo!.userRegistrationRequired! + ? const Color(0xFF34AD64) + : const Color(0xffFABC57), + ) + : option!.trailingIconButton ?? const SizedBox() + : const SizedBox(), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/widgets/custom_progress_dialog.dart b/lib/widgets/custom_progress_dialog.dart new file mode 100644 index 000000000..fbd2b77a9 --- /dev/null +++ b/lib/widgets/custom_progress_dialog.dart @@ -0,0 +1,38 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/widgets_view_models/progress_dialog_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +/// A progress dialogue which shows an activity indicator +/// spinning clockwise if there is internet connectivity. +/// Otherwise, it shows no-internet image and text. +class CustomProgressDialog extends StatelessWidget { + const CustomProgressDialog({required Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(), + builder: (context, model, child) { + return Container( + margin: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.25, + vertical: SizeConfig.screenHeight! * 0.35, + ), + decoration: BoxDecoration( + color: Theme.of(context).textTheme.titleLarge!.color, + borderRadius: BorderRadius.circular(15), + ), + child: Center( + //An iOS-style activity indicator that spins clockwise. + child: CupertinoActivityIndicator( + radius: SizeConfig.screenWidth! * 0.065, + ), + ), + // Shows no-internet image and text on no connectivity + ); + }, + ); + } +} diff --git a/lib/widgets/custom_weekday_selector.dart b/lib/widgets/custom_weekday_selector.dart new file mode 100644 index 000000000..f46ef92d1 --- /dev/null +++ b/lib/widgets/custom_weekday_selector.dart @@ -0,0 +1,94 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; + +/// Custom Widget to select weekdays. +class CustomWeekDaySelector extends StatefulWidget { + const CustomWeekDaySelector({required this.model}); + + /// instance of create event view model. + final CreateEventViewModel model; + + @override + _CustomWeekDaySelectorState createState() => _CustomWeekDaySelectorState(); +} + +class _CustomWeekDaySelectorState extends State { + @override + Widget build(BuildContext context) { + final Set weekdays = widget.model.weekDays; + return Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: List.generate(7, (index) { + final weekday = _getWeekdayAbbreviation(index); + return GestureDetector( + onTap: () { + setState(() { + if (weekdays.contains(weekday)) { + weekdays.remove(weekday); + } else { + weekdays.add(weekday); + } + widget.model.weekDays = weekdays; + }); + }, + child: Container( + width: 30, + height: 30, + decoration: BoxDecoration( + color: weekdays.contains(weekday) + ? Theme.of(context).colorScheme.primary.withOpacity(0.5) + : Colors.transparent, + border: Border.all( + width: weekdays.contains(weekday) ? 2 : 1, + color: weekdays.contains(weekday) + ? Theme.of(context).colorScheme.primary + : Theme.of(context).dividerColor, + ), + borderRadius: BorderRadius.circular(15), + ), + child: Center( + child: Text( + weekday[0], + style: TextStyle( + color: Theme.of(context).dividerColor, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ); + }), + ), + ); + } + + /// Maps isSelected index to weekday. + /// + /// **params**: + /// * `index`: of isSelected list. + /// + /// **returns**: + /// * `String`: Weekday as string. + String _getWeekdayAbbreviation(int index) { + switch (index) { + case 0: + return WeekDays.sunday; + case 1: + return WeekDays.monday; + case 2: + return WeekDays.tuesday; + case 3: + return WeekDays.wednesday; + case 4: + return WeekDays.thursday; + case 5: + return WeekDays.friday; + case 6: + return WeekDays.saturday; + default: + return ''; + } + } +} diff --git a/lib/widgets/date_time_picker.dart b/lib/widgets/date_time_picker.dart new file mode 100644 index 000000000..916a56ebc --- /dev/null +++ b/lib/widgets/date_time_picker.dart @@ -0,0 +1,41 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; + +/// Shows a dialog containing a Material Design date picker. +/// +/// The returned Future resolves to the date selected by the user when the user confirms the dialog. +/// If the user cancels the dialog, null is returned. +Future customDatePicker({required DateTime initialDate}) async { + // showDatePicker which shows a material design date range picker used to select a range of dates. + final DateTime? picked = await showDatePicker( + context: navigationService.navigatorKey.currentContext!, + initialDate: initialDate, + firstDate: DateTime(2015, 8), + lastDate: DateTime(2101), + ); + if (picked != null && picked != initialDate) { + return picked; + } + return initialDate; +} + +/// Shows a dialog containing a material design time picker. +/// +/// The returned Future resolves to the time selected by the user when the user closes the dialog. +/// If the user cancels the dialog, null is returned. +Future customTimePicker({required TimeOfDay initialTime}) async { + // showTimePicker which shows a material design time range picker used to select a range of times. + // Click ![here](https://api.flutter.dev/flutter/material/showTimePicker.html) to know more. + final TimeOfDay? pickedTime = await showTimePicker( + context: navigationService.navigatorKey.currentContext!, + initialTime: initialTime, + ); + + if (pickedTime != null && pickedTime != initialTime) { + return pickedTime; + } + return initialTime; +} diff --git a/lib/widgets/event_card.dart b/lib/widgets/event_card.dart new file mode 100644 index 000000000..52480d78b --- /dev/null +++ b/lib/widgets/event_card.dart @@ -0,0 +1,297 @@ +import 'dart:math'; +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; + +/// This class returns the EventCard widget. +class EventCard extends StatelessWidget { + const EventCard({ + super.key, + required this.event, + this.eventTitleHighlightedText, + this.eventTitleNormalText, + required this.isSearchItem, + }); + + /// instance of an event. + final Event event; + + /// Highlighted text of the event. + final String? eventTitleHighlightedText; + + /// Eventtile normal text. + final String? eventTitleNormalText; + + /// This flag indicates that if this event is searchable. + final bool isSearchItem; + + @override + Widget build(BuildContext context) { + final bool isRegistered = event.isRegistered ?? false; + return Padding( + padding: const EdgeInsets.only(bottom: 10), + child: Stack( + children: [ + Card( + surfaceTintColor: Theme.of(context).colorScheme.secondaryContainer, + shape: RoundedRectangleBorder( + side: + isRegistered && userConfig.currentUser.id != event.creator!.id + ? BorderSide( + color: Theme.of(context).colorScheme.secondary, + width: SizeConfig.screenWidth! * 0.008, + ) + : BorderSide.none, + ), + elevation: 3, + color: Theme.of(context).primaryColor, + child: Column( + children: [ + AspectRatio( + aspectRatio: 2.5, + child: Container( + height: SizeConfig.screenHeight! * 0.11, + width: double.infinity, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(0.3), + image: const DecorationImage( + fit: BoxFit.fitWidth, + alignment: FractionalOffset.topCenter, + image: AssetImage('assets/images/pfp2.png'), + ), + ), + child: ClipRRect( + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), + child: Container( + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.0), + ), + ), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Row( + children: [ + SizedBox( + width: SizeConfig.screenWidth! * 0.48, + child: isSearchItem + ? RichText( + text: TextSpan( + text: eventTitleHighlightedText, + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + fontWeight: FontWeight.bold, + ), + children: [ + TextSpan( + text: eventTitleNormalText, + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + color: Colors.grey, + ), + ), + ], + ), + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + ) + : Text( + event.title!, + style: Theme.of(context) + .textTheme + .headlineSmall, + ), + ), + const Spacer(), + const Icon( + Icons.calendar_today, + size: 13, + ), + const Spacer(), + Expanded( + child: Text( + "${event.startDate} - ${event.endDate}", + style: Theme.of(context).textTheme.bodySmall, + ), + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.006, + ), + if (event.startTime != null && event.endTime != null) + Row( + children: [ + const Icon( + Icons.schedule, + size: 12, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.015, + ), + Text( + "${event.startTime} - ${event.endTime!}", + style: Theme.of(context).textTheme.bodySmall, + ), + const Spacer(), + const Icon( + Icons.place, + size: 12, + ), + SizedBox( + child: Text( + event.location!.substring( + 0, + min(event.location!.length, 20), + ), + style: Theme.of(context).textTheme.bodySmall, + ), + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: SizeConfig.screenWidth! * 0.55, + child: Text( + event.description!, + style: Theme.of(context).textTheme.bodySmall, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + maxLines: 3, + ), + ), + const Icon( + Icons.chevron_right, + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.007, + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + userConfig.currentUser.id == event.creator!.id + ? Row( + children: [ + Icon( + Icons.verified, + size: 13, + color: Theme.of(context) + .colorScheme + .secondary, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.013, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Created'), + style: + Theme.of(context).textTheme.bodySmall, + ), + ], + ) + : const SizedBox(), + const Spacer(), + event.isPublic! + ? Icon( + Icons.lock_open, + size: 13, + color: Theme.of(context).colorScheme.primary, + ) + : Icon( + Icons.lock, + size: 13, + color: Theme.of(context).colorScheme.primary, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.013, + ), + event.isPublic! + ? Text( + AppLocalizations.of(context)! + .strictTranslate('public'), + style: Theme.of(context).textTheme.bodySmall, + ) + : Text( + AppLocalizations.of(context)! + .strictTranslate('private'), + style: Theme.of(context).textTheme.bodySmall, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.027, + ), + const Icon( + Icons.people_outline, + size: 13, + color: Color(0xff4285F4), + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.013, + ), + Text( + (event.attendees?.length ?? 0).toString(), + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + ], + ), + ), + ], + ), + ), + Positioned( + top: SizeConfig.screenHeight! * 0.007, + right: SizeConfig.screenWidth! * 0.013, + child: isRegistered && + userConfig.currentUser.id != event.creator!.id + ? DecoratedBox( + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondary, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Registered"), + style: + Theme.of(context).textTheme.titleLarge!.copyWith( + color: Colors.white, + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ) + : const SizedBox(), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/event_date_time_tile.dart b/lib/widgets/event_date_time_tile.dart new file mode 100644 index 000000000..459765823 --- /dev/null +++ b/lib/widgets/event_date_time_tile.dart @@ -0,0 +1,85 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; + +/// Returns a widget tile(item) for displaying date and time. +class DateTimeTile extends StatelessWidget { + const DateTimeTile({ + super.key, + required this.date, + required this.time, + required this.setDate, + required this.setTime, + required this.isAllDay, + }); + + /// Represents a date in string format. + final String date; + + /// Represents a time in string format. + final String time; + + /// Represents a boolean value indicating if the event is all day. + final bool isAllDay; + + /// Function that sets the date. + final Function() setDate; + + /// Function that sets the time. + final Function() setTime; + + @override + Widget build(BuildContext context) { + return Container( + color: Theme.of(context).colorScheme.primaryContainer, + height: SizeConfig.screenHeight! * 0.068, + width: double.infinity, + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: SizeConfig.screenWidth! * 0.083), + child: Row( + children: [ + const Icon( + Icons.calendar_today, + color: Color(0xff524F4F), + size: 19, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.045, + ), + InkWell( + key: const Key('EventDateTimeTileDate'), + onTap: () async { + setDate(); + }, + child: Text( + date, + style: const TextStyle(fontSize: 16), + ), + ), + if (!isAllDay) ...[ + const Spacer(), + const Icon( + Icons.schedule, + color: Color(0xff524F4F), + size: 19, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.045, + ), + InkWell( + key: const Key('EventDateTimeTileTime'), + onTap: () async { + setTime(); + }, + child: Text( + time, + style: const TextStyle(fontSize: 16), + ), + ), + ], + ], + ), + ), + ); + } +} diff --git a/lib/widgets/event_search_delegate.dart b/lib/widgets/event_search_delegate.dart new file mode 100644 index 000000000..d2e877924 --- /dev/null +++ b/lib/widgets/event_search_delegate.dart @@ -0,0 +1,101 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/widgets/event_card.dart'; + +/// This class returns a list of the events which match the search query. +class EventSearch extends SearchDelegate { + EventSearch({required this.eventList, required this.exploreEventsViewModel}); + ExploreEventsViewModel exploreEventsViewModel; + + final List eventList; + + @override + List buildActions(BuildContext context) { + /// Returns an icon button which closes the search page and returns + /// to the underlying route if the query is empty. Otherwise it sets the + /// query empty. + return [ + IconButton( + onPressed: () { + query.isNotEmpty ? query = '' : close(context, eventList.first); + }, + icon: const Icon(Icons.clear), + ), + ]; + } + + @override + Widget buildLeading(BuildContext context) { + /// Returns an icon button which closes the search page and returns + /// to the underlying route + return IconButton( + onPressed: () { + close(context, eventList.first); + }, + icon: const Icon(Icons.arrow_back), + ); + } + + @override + Widget buildResults(BuildContext context) { + return Container(); + } + + @override + Widget buildSuggestions(BuildContext context) { + /// Returns a scrollable list through "buildSuggestionsSuccess" function. + /// where() method Returns a new lazy Iterable with all elements that satisfy the predicate test. + /// toList( ) method is used to convert an Iterable to a List. + /// toLowerCase() converts all characters in a string to lower case. + final suggestions = eventList.where((event) { + final eventLowerCase = event.title!.toLowerCase(); + final queryLowerCase = query.toLowerCase(); + return eventLowerCase.startsWith(queryLowerCase); + }).toList(); + return buildSuggestionsSucess(suggestions); + } + + Widget buildSuggestionsSucess(List suggestions) { + /// Takes a List of Events as parameter which is passed by the "buildSuggestions" function. + /// Returns a SingleChildScrollView of the events from the list. + /// SingleChildScrollView is box in which a single widget can be scrolled. + return SingleChildScrollView( + child: ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: suggestions.length, + itemBuilder: (BuildContext context, int index) { + final highlightedText = + suggestions[index].title!.substring(0, query.length); + final normalText = suggestions[index].title!.substring(query.length); + + /// Returns a widget that detects gestures. + /// Defers to its child for its sizing behavior. + /// Navigates to the screen with the event information. + return GestureDetector( + onTap: () { + navigationService.pushScreen( + "/eventInfo", + arguments: { + "event": suggestions[index], + "exploreEventViewModel": exploreEventsViewModel, + }, + ); + }, + child: EventCard( + event: suggestions[index], + isSearchItem: true, + eventTitleHighlightedText: highlightedText, + eventTitleNormalText: normalText, + ), + ); + }, + ), + ); + } +} diff --git a/lib/widgets/from_palisadoes.dart b/lib/widgets/from_palisadoes.dart new file mode 100644 index 000000000..212d2b496 --- /dev/null +++ b/lib/widgets/from_palisadoes.dart @@ -0,0 +1,51 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; + +/// This class generates the text "From Palisadoes" in a custom way. +class FromPalisadoes extends StatelessWidget { + const FromPalisadoes({super.key}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + // Customizing the word "from". + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + // This method is called for localized text. + AppLocalizations.of(context)!.strictTranslate('from'), + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + SizedBox( + height: SizeConfig.blockSizeHorizontal, + ), + // Customizing the word "Palisadoes". + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'PALISADOES', + style: Theme.of(context) + .textTheme + .titleSmall! + .copyWith(fontWeight: FontWeight.w700), + ), + ], + ), + SizedBox( + height: SizeConfig.blockSizeHorizontal! * 5, + ), + ], + ); + } +} diff --git a/lib/widgets/invite_child.dart b/lib/widgets/invite_child.dart new file mode 100644 index 000000000..4e0e84e4c --- /dev/null +++ b/lib/widgets/invite_child.dart @@ -0,0 +1,126 @@ +import 'package:flutter/material.dart'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; + +/// Creating an instance of AppLangauge() to set up localized values for each locale that our app supports. +final _appLanguageService = locator(); + +/// We can use QR code scanner, social media platforms like twitter, whatsapp, telegram and many more.. +/// +/// more_info_if_required +/// +/// **params**: +/// * `context`: Build Context +/// +/// **returns**: +/// * `Widget`: Returns Column with QR Code +Widget invite(BuildContext context) { + _appLanguageService.initialize(); + + // final String url = + // 'https://cyberwake.github.io/applink/invite?selectLang=${_appLanguageService.appLocal.languageCode}&setUrl=${GraphqlConfig.orgURI}&selectOrg=${userConfig.currentOrg.id!}'; + const String qrData = + 'https://github.com/PalisadoesFoundation/talawa/releases/download/automated/app-release.apk'; + + // print(url); + // print(qrData); + + return Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + //Scan the below given QR code to join the organization. + QrImageView( + key: const Key("QRcode"), + data: qrData, + version: QrVersions.auto, + size: 200.0, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.08, + ), + Text( + 'Scan the QR to join ${userConfig.currentOrg.name}', + style: const TextStyle(color: Colors.black), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.02, + ), + //Tap on the Twitter icon to join the organization through Twitter. + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // mainAxisSize: MainAxisSize.min, + // children: [ + // iconButton( + // "Twitter", + // const FaIcon( + // FontAwesomeIcons.twitter, + // size: 35, + // color: Color(0xFF1DA1F2), + // ), + // () async => SocialShare.shareTwitter('Join us', url: url), + // ), + // //Tap on the Whatsapp icon to join the organization through Whatsapp. + // iconButton( + // "WhatsApp", + // CustomPaint( + // size: const Size( + // 50, + // 50 * 1.004, + // ), //You can Replace [WIDTH] with your desired width for Custom Paint and height will be calculated automatically + // painter: WhatsappLogo(), + // ), + // () async => SocialShare.shareWhatsapp(url), + // ), + // iconButton( + // "Telegram", + // CustomPaint( + // size: Size( + // 45, + // (45 * 1).toDouble(), + // ), //You can Replace [WIDTH] with your desired width for Custom Paint and height will be calculated automatically + // painter: TelegramLogo(), + // ), + // () async => SocialShare.shareTelegram(url), + // ), + // iconButton( + // "Alt", + // const FaIcon( + // FontAwesomeIcons.shareNodes, + // size: 30, + // color: Color(0xff40c351), + // ), + // () async => SocialShare.shareOptions(url), + // ), + // ], + // ), + ], + ); +} + +/// It prints "tapped" in the console for the developer to know that the button was tapped. +/// +/// **params**: +/// * `key`: Key of the Widget +/// * `icon`: Icon to be displayed +/// * `onTap`: on tap function +/// +/// **returns**: +/// * `Widget`: returns IconButton. +Widget iconButton(String key, Widget icon, void Function() onTap) { + return Stack( + children: [ + IconButton( + key: Key(key), + onPressed: () { + print('tapped'); + onTap(); + }, + icon: icon, + ), + ], + ); +} diff --git a/lib/widgets/lang_switch.dart b/lib/widgets/lang_switch.dart new file mode 100644 index 000000000..2ffa67209 --- /dev/null +++ b/lib/widgets/lang_switch.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/language/language_model.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; + +/// This widget enables language switch for "internationalizing our app". +class LanguageTile extends StatelessWidget { + const LanguageTile({super.key}); + + @override + Widget build(BuildContext context) { + //AppLanguage enables to set up localized values for each locale that our app supports. + //A locale is an identifier used to select a user's language and formatting preferences. + //This represents a Unicode Language Identifier (i.e. without Locale extensions), + //except variants are not supported. + return Consumer( + builder: (context, appLang, _) { + final Language userLanguage = languages.firstWhere( + (element) => element.langCode == appLang.appLocal.languageCode, + ); + return ListTile( + key: const Key('LanguageTile'), + contentPadding: EdgeInsets.symmetric( + horizontal: SizeConfig.blockSizeHorizontal!, + ), + title: + Text(AppLocalizations.of(context)!.strictTranslate("Language")), + trailing: TextButton( + key: const Key('LanguageSelector'), + onPressed: () { + navigationService.pushReplacementScreen( + '/selectLang', + arguments: '0', + ); + }, + child: Text(userLanguage.langName), + ), + ); + }, + ); + } +} diff --git a/lib/widgets/member_name_tile.dart b/lib/widgets/member_name_tile.dart new file mode 100644 index 000000000..643b13b00 --- /dev/null +++ b/lib/widgets/member_name_tile.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; + +/// This widget returns a tile containing the name of the member. +/// +/// Along with the name, there is a circle avatar which +/// either contains the image uploaded by the user or the +/// first character of his/her name in uppercase. +class MemberNameTile extends StatelessWidget { + const MemberNameTile({ + super.key, + required this.userName, + this.userImage, + required this.onDelete, + }); + + /// Represents the user's name. + final String userName; + + /// Triggers the deletion of the user. + final Function() onDelete; + + /// Represents the URL or path to the user's image. + final String? userImage; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 10, right: 5), + child: Container( + width: SizeConfig.screenWidth! * (0.3 + userName.length / 50), + height: SizeConfig.screenHeight! * 0.04, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(SizeConfig.screenHeight! * 0.02), + color: Theme.of(context).colorScheme.primaryContainer, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Background is set with the image uploaded by the user. + userImage != null + ? CircleAvatar( + radius: SizeConfig.screenHeight! * 0.0201, + backgroundImage: NetworkImage(userImage!), + ) + // If the user has not uploaded his/her image, + // then a circle avatar is created. + // It has the first character of the user's name + //in uppercase and the default background color. + : CircleAvatar( + radius: SizeConfig.screenHeight! * 0.0201, + backgroundColor: Theme.of(context).colorScheme.secondary, + child: Text( + userName.substring(0, 1).toUpperCase(), + style: const TextStyle(color: Colors.white), + ), + ), + // The name of the member in text form. + Padding( + padding: const EdgeInsets.only(left: 5), + child: Text( + userName, + ), + ), + IconButton( + padding: EdgeInsets.zero, + onPressed: () => onDelete(), + icon: const Icon( + Icons.cancel_rounded, + color: Color(0xff524F4F), + size: 19, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/multi_reaction.dart b/lib/widgets/multi_reaction.dart new file mode 100644 index 000000000..2abec4d95 --- /dev/null +++ b/lib/widgets/multi_reaction.dart @@ -0,0 +1,120 @@ +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 + State createState() => _MultiReactionButtonState(); +} + +class _MultiReactionButtonState extends State { + @override + Widget build(BuildContext context) { + return ReactionButton( + itemSize: const Size.square(35), + onReactionChanged: (value) { + // ignore: unnecessary_statements + widget.toggle(); + }, + selectedReaction: Reaction( + icon: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: (MediaQuery.sizeOf(context).width / 392) * 35, + width: (MediaQuery.sizeOf(context).width / 392) * 35, + child: SvgPicture.asset( + 'assets/images/🦆 icon _like_.svg', + ), + ), + ), + value: 12, + ), + reactions: [ + Reaction( + icon: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: (MediaQuery.sizeOf(context).width / 392) * 35, + width: (MediaQuery.sizeOf(context).width / 392) * 35, + child: SvgPicture.asset( + 'assets/icons/angel.svg', + ), + ), + ), + value: 1, + ), + Reaction( + icon: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: (MediaQuery.sizeOf(context).width / 392) * 35, + width: (MediaQuery.sizeOf(context).width / 392) * 35, + child: SvgPicture.asset( + 'assets/icons/happy.svg', + ), + ), + ), + value: 3, + ), + Reaction( + icon: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: (MediaQuery.sizeOf(context).width / 392) * 35, + width: (MediaQuery.sizeOf(context).width / 392) * 35, + child: SvgPicture.asset( + 'assets/icons/laugh.svg', + ), + ), + ), + value: 4, + ), + Reaction( + icon: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: (MediaQuery.sizeOf(context).width / 392) * 35, + width: (MediaQuery.sizeOf(context).width / 392) * 35, + child: SvgPicture.asset( + 'assets/icons/love.svg', + ), + ), + ), + value: 1, + ), + Reaction( + icon: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: (MediaQuery.sizeOf(context).width / 392) * 35, + width: (MediaQuery.sizeOf(context).width / 392) * 35, + child: SvgPicture.asset( + 'assets/icons/tear.svg', + ), + ), + ), + value: 1, + ), + Reaction( + icon: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: (MediaQuery.sizeOf(context).width / 392) * 35, + width: (MediaQuery.sizeOf(context).width / 392) * 35, + child: SvgPicture.asset( + 'assets/icons/angry.svg', + ), + ), + ), + value: 2, + ), + ], + ); + } +} diff --git a/lib/widgets/organization_list.dart b/lib/widgets/organization_list.dart new file mode 100644 index 000000000..b0a76ce1e --- /dev/null +++ b/lib/widgets/organization_list.dart @@ -0,0 +1,155 @@ +import 'dart:async'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/constants/timeout.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/exceptions/graphql_exception_resolver.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/widgets/custom_list_tile.dart'; +import 'package:visibility_detector/visibility_detector.dart'; + +/// This class returns the OrganizationList widget. +/// +/// which shows the list of all organizations exists in the URL. +/// This widget is used after the authentication. +class OrganizationList extends StatelessWidget { + const OrganizationList({required this.model, super.key}); + + /// [model] is a type of [SelectOrganizationViewModel] which provides methods to handle the data for this component. + final SelectOrganizationViewModel model; + @override + Widget build(BuildContext context) { + final navigationServiceLocal = locator(); + model.organizations = []; + int noOfRefetch = 0; + const int maxRefetch = 10; + return GraphQLProvider( + client: ValueNotifier(graphqlConfig.clientToQuery()), + child: Query( + options: QueryOptions( + document: gql(queries.fetchJoinInOrg), + variables: { + // fetch 15 items only, will fetch more when scrolling index is at the 3rd last item! + 'first': 15, + 'skip': 0, + }, + ), + builder: ( + QueryResult result, { + Future Function(FetchMoreOptions)? fetchMore, + Future Function()? refetch, + }) { + // checking for any errors, if true fetch again! + if (result.hasException) { + final isException = + GraphqlExceptionResolver.encounteredExceptionOrError( + result.exception!, + showSnackBar: noOfRefetch == 0, + ); + if (isException != null && noOfRefetch <= maxRefetch) { + if (isException) { + refetch!(); + noOfRefetch++; + } else { + refetch!(); + noOfRefetch++; + } + } + } else { + // If the result is still loading! + if (!result.isLoading) { + // print(result.data!['organizationsConnection']); + model.organizations = OrgInfo().fromJsonToList( + result.data!['organizationsConnection'], + ); + } + + Timer(const Duration(seconds: TimeOuts.small), () { + if (model.organizations.isEmpty) { + navigationServiceLocal.showTalawaErrorDialog( + "No organizations found Please contact your admin", + MessageType.error, + ); + } + }); + return Scrollbar( + thumbVisibility: true, + interactive: true, + controller: model.allOrgController, + // Listview is a scrollable list of widgets arranged linearly. + child: ListView.separated( + controller: model.allOrgController, + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: result.isLoading + ? model.organizations.length + 1 + : model.organizations.length, + itemBuilder: (BuildContext context, int index) { + // If the index is at the end of the list! + if (index == model.organizations.length) { + // return the ListTile showing the loading icon! + return ListTile( + title: Center( + child: CupertinoActivityIndicator( + radius: SizeConfig.screenWidth! * 0.065, + ), + ), + ); + } + // If the index is at the 3rd last item in the organization list. + if (index == model.organizations.length - 3) { + // return VisibilityDetector and fetch more items in the list to show up! + return VisibilityDetector( + key: const Key('OrgSelItem'), + onVisibilityChanged: (VisibilityInfo info) { + if (info.visibleFraction > 0) { + model.fetchMoreHelper( + fetchMore!, + model.organizations, + ); + } + }, + child: CustomListTile( + index: index, + type: TileType.org, + orgInfo: model.organizations[index], + onTapOrgInfo: (item) => Navigator.pushNamed( + context, + '/OrganisationInfoScreen', + arguments: model.organizations[index], + ), + key: Key('OrgSelItem$index'), + ), + ); + } + // return CustomeTile that shows a particular item in the list! + return CustomListTile( + index: index, + type: TileType.org, + orgInfo: model.organizations[index], + onTapOrgInfo: (item) => Navigator.pushNamed( + context, + '/OrganisationInfoScreen', + arguments: model.organizations[index], + ), + key: Key('OrgSelItem$index'), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Container(); + }, + ), + ); + } + return Container(); + }, + ), + ); + } +} diff --git a/lib/widgets/organization_search_list.dart b/lib/widgets/organization_search_list.dart new file mode 100644 index 000000000..893eabfe6 --- /dev/null +++ b/lib/widgets/organization_search_list.dart @@ -0,0 +1,138 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/exceptions/graphql_exception_resolver.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/queries.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/widgets/custom_list_tile.dart'; +import 'package:visibility_detector/visibility_detector.dart'; + +/// This class returns the widget that shows all the matching orgs searched in the search bar. +class OrganizationSearchList extends StatelessWidget { + const OrganizationSearchList({required this.model, super.key}); + + /// model constructor for the selectOrganisation widget. + final SelectOrganizationViewModel model; + + @override + Widget build(BuildContext context) { + int noOfRefetch = 0; + const int maxRefetch = 10; + return GraphQLProvider( + client: ValueNotifier(graphqlConfig.authClient()), + child: Query( + options: QueryOptions( + document: gql(Queries().fetchJoinInOrgByName), + variables: { + 'nameStartsWith': model.searchController.text, + // fetch 30 items only, will fetch more when scrolling index is at the 3rd last item! + 'first': 30, + 'skip': 0, + }, + ), + builder: ( + QueryResult result, { + Future Function(FetchMoreOptions)? fetchMore, + Future Function()? refetch, + }) { + // checking for any errors, if true fetch again! + if (result.hasException) { + final isException = + GraphqlExceptionResolver.encounteredExceptionOrError( + result.exception!, + ); + print(isException); + if (noOfRefetch <= maxRefetch) { + noOfRefetch++; + refetch!(); + } + } else { + // If the result is still loading! + if (!result.isLoading) { + model.organizations = OrgInfo().fromJsonToList( + result.data!['organizationsConnection'], + ); + } + // return the Scroll bar widget for scrolling down the organizations. + return Scrollbar( + thumbVisibility: true, + interactive: true, + controller: model.controller, + // Listview is a scrollable list of widgets arranged linearly. + child: ListView.separated( + controller: model.controller, + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: result.isLoading + ? model.organizations.length + 1 + : model.organizations.length, + itemBuilder: (BuildContext context, int index) { + // If the index is at the end of the list! + if (index == model.organizations.length) { + // return the ListTile showing the loading icon! + return ListTile( + title: Center( + child: CupertinoActivityIndicator( + radius: SizeConfig.screenWidth! * 0.065, + ), + ), + ); + } + // If the index is at the 3rd last item in the organization list. + if (index == model.organizations.length - 3) { + // return VisibilityDetector and fetch more items in the list to show up! + return VisibilityDetector( + key: const Key('OrgSelItem'), + onVisibilityChanged: (VisibilityInfo info) { + if (info.visibleFraction > 0) { + print(model.organizations.length); + model.fetchMoreHelper( + fetchMore!, + model.organizations, + ); + print(model.organizations.length); + } + }, + child: CustomListTile( + index: index, + type: TileType.org, + orgInfo: model.organizations[index], + onTapOrgInfo: (item) => model.selectOrg(item), + key: Key('OrgSelItem$index'), + ), + ); + } + // return CustomeTile that shows a particular item in the list! + return CustomListTile( + index: index, + type: TileType.org, + orgInfo: model.organizations[index], + onTapOrgInfo: (item) => model.selectOrg(item), + key: Key('OrgSelItem$index'), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.only( + left: SizeConfig.screenWidth! * 0.2, + right: 12, + ), + child: const Divider( + color: Color(0xFFE5E5E5), + thickness: 0.5, + ), + ); + }, + ), + ); + } + return Container(); + }, + ), + ); + } +} diff --git a/lib/widgets/pinned_carousel_widget.dart b/lib/widgets/pinned_carousel_widget.dart new file mode 100644 index 000000000..b4f5bcf58 --- /dev/null +++ b/lib/widgets/pinned_carousel_widget.dart @@ -0,0 +1,185 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; + +/// Generates carousel for pinned posts on the Home Screen's top. +/// +/// Tapping on a post will redirect you to the respective post screen. +class PinnedPostCarousel extends StatelessWidget { + const PinnedPostCarousel({ + super.key, + required this.pinnedPosts, + required this.navigateToPinnedPostPage, + required this.navigateToIndividualPostPage, + }); + + /// List of 'Post' objects representing pinned posts. + final List pinnedPosts; + + /// Function that navigates to a page displaying pinned posts. + final Function() navigateToPinnedPostPage; + + /// Function that navigates to an individual post page. + final Function navigateToIndividualPostPage; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + height: 220, + color: + Theme.of(context).colorScheme.primaryContainer.withOpacity(0.5), + child: CustomCarouselScroller( + pinnedPosts: pinnedPosts, + key: const Key('Carousel'), + navigateToIndividualPostPage: navigateToIndividualPostPage, + ), + ), + // Gesture Detector in Flutter is used to detect + // the user's gestures on the application. + // It is a non-visual widget. Inside the gesture detector, + // another widget is placed and + // the gesture detector will capture all these + // events (gestures) and execute the tasks accordingly. + GestureDetector( + onTap: () => navigateToPinnedPostPage(), + child: Container( + height: 50, + width: SizeConfig.screenWidth, + padding: const EdgeInsets.symmetric(horizontal: 16.0), + color: Theme.of(context).colorScheme.primaryContainer, + child: Row( + children: [ + Expanded( + flex: 1, + child: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon( + Icons.article, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ), + Expanded( + flex: 8, + child: Text( + AppLocalizations.of(context)! + .strictTranslate("See all Pinned news"), + style: Theme.of(context).textTheme.titleLarge, + ), + ), + const Expanded(flex: 1, child: Icon(Icons.arrow_forward_ios)), + ], + ), + ), + ), + ], + ); + } +} + +/// Class defining custom carousel. +@visibleForTesting +class CustomCarouselScroller extends StatefulWidget { + const CustomCarouselScroller({ + super.key, + required this.pinnedPosts, + required this.navigateToIndividualPostPage, + }); + + /// List of pinnedposts. + final List pinnedPosts; + + /// function to navigate to IndividualPostPage. + final Function navigateToIndividualPostPage; + + @override + CustomCarouselScrollerState createState() => CustomCarouselScrollerState(); +} + +@visibleForTesting +class CustomCarouselScrollerState extends State { + /// pageController. + final PageController controller = PageController(initialPage: 0); + + /// pageIndex. + int pindex = 0; + + @override + Widget build(BuildContext context) { + // Stack is a widget that positions its + // children relative to the edges of its box. + return Stack( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ListTile( + leading: const CircleAvatar( + radius: 15.0, + backgroundColor: Color(0xff737373), + ), + title: Text( + "${widget.pinnedPosts[pindex].creator!.firstName} ${widget.pinnedPosts[pindex].creator!.lastName}", + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Text( + widget.pinnedPosts[pindex].description!.length > 90 + ? "${widget.pinnedPosts[pindex].description!.substring(0, 90)}..." + : widget.pinnedPosts[pindex].description!, + style: Theme.of(context) + .textTheme + .bodyLarge! + .copyWith(color: const Color(0xFF737373)), + ), + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 10.0, + ), + child: Row( + children: [ + for (int i = 0; i < 4; i++) + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 5.0), + child: Divider( + thickness: 3.0, + color: pindex == i + ? Theme.of(context).colorScheme.primary + : Colors.grey, + ), + ), + ), + ], + ), + ), + ], + ), + ), + PageView( + scrollDirection: Axis.horizontal, + controller: controller, + onPageChanged: (index) { + setState(() { + pindex = index; + }); + }, + children: List.generate( + widget.pinnedPosts.length, + (index) => Container(), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/pinned_post.dart b/lib/widgets/pinned_post.dart new file mode 100644 index 000000000..878df09a9 --- /dev/null +++ b/lib/widgets/pinned_post.dart @@ -0,0 +1,141 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/feed/pinned_post_screen.dart'; + +/// PinnedPost returns a widget that shows the pinned post. +class PinnedPost extends StatelessWidget { + const PinnedPost({super.key, required this.pinnedPost, required this.model}); + + /// contains the pinned post. + final List pinnedPost; + + /// gives access mainScreenViewModel's attributes. + final MainScreenViewModel model; + + @override + Widget build(BuildContext context) { + return Container( + key: const Key('hello'), + child: pinnedPost.isNotEmpty + ? SizedBox( + height: SizeConfig.screenHeight! * 0.28, + child: ListView.builder( + itemCount: pinnedPost.length, + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) => Padding( + key: index == 0 ? model.keySHPinnedPost : const Key(''), + padding: const EdgeInsets.only( + left: 10, + top: 7, + ), + child: GestureDetector( + onTap: () { + // final Map arg = {"index": "$index","post": pinnedPost}; + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => PinnedPostScreen( + post: toMap(index), + ), + ), + ); + }, + child: SizedBox( + width: SizeConfig.screenWidth! / 4.1, + child: Column( + children: [ + Expanded( + child: CachedNetworkImage( + cacheKey: pinnedPost[index].sId, + imageUrl: + (pinnedPost[index].imageUrl ?? '').isEmpty + ? 'placeHolderUrl' + : pinnedPost[index].imageUrl!, + errorWidget: (context, url, error) { + print(error); + return const SizedBox( + child: Center( + child: CircularProgressIndicator(), + ), + ); + }, + height: SizeConfig.screenHeight! * 0.15, + fit: BoxFit.cover, + ), + ), + const SizedBox(height: 5), + Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(1.0), + child: Text( + getTimeDifferenceInHours( + pinnedPost[index] + .createdAt! + .toIso8601String(), + ), + style: const TextStyle( + color: Colors.grey, + fontWeight: FontWeight.w200, + ), + ), + ), + ), + ], + ), + const SizedBox(height: 5), + Text( + pinnedPost[index].description!, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ), + ), + ), + ) + : Container( + key: const Key('hi'), + ), + ); + } + + /// Function returns the time difference in hours. + /// + /// **params**: + /// * `createdAtString`: the time from post + /// + /// **returns**: + /// * `String`: return a string + String getTimeDifferenceInHours(String createdAtString) { + final DateTime now = DateTime.now(); + final DateTime createdAt = DateTime.parse(createdAtString).toLocal(); + final Duration difference = now.difference(createdAt); + final int hours = difference.inHours; + return '$hours hrs'; + } + + /// converts post to mapped string. + /// + /// **params**: + /// * `index`: current index + /// + /// **returns**: + /// * `Map`: returns a map + Map toMap(int index) { + return { + 'title': this.pinnedPost[index].description!, + 'postId': this.pinnedPost[index].sId, + 'imageUrl': this.pinnedPost[index].imageUrl!, + 'time': getTimeDifferenceInHours( + this.pinnedPost[index].createdAt!.toIso8601String(), + ), + }; + } +} diff --git a/lib/widgets/post_container.dart b/lib/widgets/post_container.dart new file mode 100644 index 000000000..0ac3defa3 --- /dev/null +++ b/lib/widgets/post_container.dart @@ -0,0 +1,65 @@ +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({ + super.key, + required this.photoUrl, + }); + + /// image url. + /// + final String? photoUrl; + + @override + PostContainerState createState() => PostContainerState(); +} + +class PostContainerState extends State { + /// video was removed for mvp. + /// + bool startedPlaying = false; + + /// same as above. + /// + bool inView = true; + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + controller.dispose(); + 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) { + return VisibilityDetector( + key: Key(Random().nextInt(1000).toString()), + onVisibilityChanged: (info) { + info.visibleFraction > 0.5 ? inView = true : inView = false; + if (mounted) setState(() {}); + }, + child: Center( + child: widget.photoUrl != null + ? Image.network(widget.photoUrl!) + : Container(), + ), + ); + } +} diff --git a/lib/widgets/post_detailed_page.dart b/lib/widgets/post_detailed_page.dart new file mode 100644 index 000000000..42dbf68eb --- /dev/null +++ b/lib/widgets/post_detailed_page.dart @@ -0,0 +1,118 @@ +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 + _DescriptionTextWidgetState createState() => _DescriptionTextWidgetState(); +} + +class _DescriptionTextWidgetState extends State { + /// before clicking show more. + late String firstHalf; + + /// After the show more. + late String secondHalf; + + /// tags in the post. + late String tag; + + /// setting the flag to true initially (is show more turned on). + bool flag = true; + + @override + void initState() { + super.initState(); + // If the length of the text is greater than 150, we divide it into two parts: firstHalf and secondHalf. + if (widget.text.length > 150) { + firstHalf = widget.text.substring(0, 150); + secondHalf = widget.text.substring(150, widget.text.length); + tag = ""; + } else { + if (widget.text.split("#").length == 2) { + firstHalf = widget.text.split("#")[0]; + tag = widget.text.split("#")[1]; + } else if (widget.text.split("#").length == 1) { + firstHalf = widget.text; + tag = ""; + } else { + firstHalf = widget.text.split("#")[0]; + tag = ""; + } + secondHalf = ""; + } + } + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 5.0), + child: secondHalf.isEmpty + ? Column( + children: [ + Text( + firstHalf, + textAlign: TextAlign.justify, + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + fontFamily: 'open-sans', + color: Theme.of(context).colorScheme.onSecondary, + ), + ), + tag != "" + ? Text( + "# $tag", + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + fontFamily: 'open-sans', + color: Theme.of(context).colorScheme.onSecondary, + ), + ) + : Container(), + ], + ) + : Column( + children: [ + Text( + // If the flag is true, we only display the firstHalf. + // If it is false, we display the entire text. + flag ? ("$firstHalf...") : (firstHalf + secondHalf), + textAlign: TextAlign.justify, + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + fontFamily: 'open-sans', + color: Theme.of(context).colorScheme.onSecondary, + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + onTap: () { + setState(() { + //Setting the flag to false on tapping the "show more" text. + flag = !flag; + }); + }, + child: Text( + flag + ? AppLocalizations.of(context)! + .strictTranslate("show more") + : AppLocalizations.of(context)! + .strictTranslate("show less"), + style: const TextStyle(color: Colors.blue), + ), + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/widgets/post_list_widget.dart b/lib/widgets/post_list_widget.dart new file mode 100644 index 000000000..2364e16a6 --- /dev/null +++ b/lib/widgets/post_list_widget.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/widgets/post_widget.dart'; + +/// This class receives a List of all the Post widgets and returns a ListView. +class PostListWidget extends StatelessWidget { + const PostListWidget({ + super.key, + required this.posts, + this.function, + this.deletePost, + }); + + /// list 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. + final Function(Post)? function; + + /// Function the deleting the post. + final Function(Post)? deletePost; + + @override + Widget build(BuildContext context) { + return ListView.builder( + scrollDirection: Axis.vertical, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: posts.length, + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + NewsPost( + key: ValueKey(posts[index].sId), + post: posts[index], + function: function, + deletePost: deletePost, + ), + ], + ); + }, + ); + } +} diff --git a/lib/widgets/post_modal.dart b/lib/widgets/post_modal.dart new file mode 100644 index 000000000..24bb97720 --- /dev/null +++ b/lib/widgets/post_modal.dart @@ -0,0 +1,115 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +/// To add options to the bottom nav bar, increase the height too. +class PostBottomModal extends StatelessWidget { + const PostBottomModal({ + super.key, + this.function, + this.deletePost, + required this.post, + }); + + /// This function is passed for the handling the action to be performed when the comment button is clicked. + final Function(Post)? function; + + /// To delete the post if user can (only work if the post is made by the user). + final Function(Post)? deletePost; + + /// Post object containing all the data related to the post. + final Post post; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Center( + child: Row( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 0, 0), + child: Icon( + Icons.report_gmailerrorred_outlined, + color: Theme.of(context).colorScheme.tertiary, + ), + ), + TextButton( + key: const Key('reportPost'), + onPressed: () { + navigationService.showTalawaErrorSnackBar( + 'Your Report has been sent to the Admin', + MessageType.info, + ); + Navigator.pop(context); + }, + child: Text( + 'Report the post to the Admin', + style: Theme.of(context).textTheme.bodyLarge, + ), + ), + ], + ), + ), + Center( + child: Row( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 0, 0), + child: Icon( + Icons.delete, + color: Theme.of(context).colorScheme.tertiary, + ), + ), + TextButton( + key: const Key('deletePost'), + onPressed: () { + showDialog( + context: context, + builder: (BuildContext builder) { + return AlertDialog( + title: const Text("Warning"), + content: const Text( + "Do you really want to delete the post?", + ), + actions: [ + TextButton( + key: const Key('alert_dialog_yes_btn'), + onPressed: () { + navigationService.pop(); + deletePost?.call(post); + navigationService.pop(); + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('deletePost'), + ), + ); + }, + child: const Text("Yes"), + ), + TextButton( + key: const Key('alert_dialog_no_btn'), + onPressed: () { + Navigator.pop(context); + }, + child: const Text("No"), + ), + ], + ); + }, + ); + }, + child: Text( + 'The post was deleted', + style: Theme.of(context).textTheme.bodyLarge, + ), + ), + ], + ), + ), + ], + ); + } +} diff --git a/lib/widgets/post_widget.dart b/lib/widgets/post_widget.dart new file mode 100644 index 000000000..807f49037 --- /dev/null +++ b/lib/widgets/post_widget.dart @@ -0,0 +1,213 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; +import 'package:talawa/widgets/multi_reaction.dart'; +import 'package:talawa/widgets/post_container.dart'; +import 'package:talawa/widgets/post_detailed_page.dart'; +import 'package:talawa/widgets/post_modal.dart'; + +/// Stateless class to show the fetched post. +class NewsPost extends StatelessWidget { + const NewsPost({ + super.key, + required this.post, + this.function, + this.deletePost, + }); + + /// Post object containing all the data related to the post. + final Post post; + + /// This function is passed for the handling the action to be performed when the comment button is clicked. + final Function(Post)? function; + + /// To delete the post if user can (only work if the post is made by the user). + final Function(Post)? deletePost; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + surfaceTintColor: Theme.of(context).colorScheme.secondaryContainer, + color: Theme.of(context).colorScheme.tertiaryContainer, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + leading: CustomAvatar( + isImageNull: post.creator!.image == null, + firstAlphabet: + post.creator!.firstName!.substring(0, 1).toUpperCase(), + imageUrl: + "${'${GraphqlConfig.orgURI}'.replaceFirst('/graphql', '')}/${post.creator!.image}", + fontSize: 20, + ), + title: Text( + "${post.creator!.firstName} ${post.creator!.lastName}", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w400, + color: Theme.of(context).colorScheme.onSecondary, + ), + ), + trailing: IconButton( + key: const Key('reportButton'), + onPressed: () => showModalBottomSheet( + context: context, + builder: (BuildContext context1) => Container( + key: const Key('reportPost'), + height: 120, + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: const BorderRadius.only( + topRight: Radius.circular(16), + topLeft: Radius.circular(16), + ), + ), + child: PostBottomModal( + post: post, + deletePost: deletePost, + function: function, + ), + ), + ), + icon: Icon( + Icons.report_gmailerrorred_outlined, + color: Theme.of(context).colorScheme.onSecondary, + ), + ), + ), + post.imageUrl != null + ? Container( + key: const Key('postParentContainer'), + height: 340, + color: Colors.white, + child: PostContainer(photoUrl: post.imageUrl), + ) + : DescriptionTextWidget(text: post.description!), + BaseView( + onModelReady: (model) { + model.initialize(post.likedBy ?? [], post.sId); + }, + builder: (context, model, child) => Column( + children: [ + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + child: Column( + children: [ + MultiReactButton( + toggle: () => model.toggleIsLiked(), + ), + Text( + "${model.likedBy.length}", + style: TextStyle( + fontFamily: 'open-sans', + color: + Theme.of(context).colorScheme.onSecondary, + ), + ), + ], + ), + ), + Container( + child: Column( + children: [ + GestureDetector( + key: const Key('commentButton'), + onTap: () => function?.call(post), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: SizedBox( + height: (MediaQuery.sizeOf(context).width / + 392) * + 35, + width: (MediaQuery.sizeOf(context).width / + 392) * + 35, + child: SvgPicture.asset( + 'assets/images/comment.svg', + ), + ), + ), + ), + Text( + "${post.comments!.length}", + style: TextStyle( + color: + Theme.of(context).colorScheme.onSecondary, + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(120, 0, 0, 0), + child: Text( + ' ${post.getPostCreatedDuration()}', + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + fontSize: 12, + ), + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 0, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () => function?.call(post), + child: Text( + "${AppLocalizations.of(context)!.strictTranslate("Liked")} by ...", + style: TextStyle( + fontFamily: 'open-sans', + color: Theme.of(context).colorScheme.onSecondary, + ), + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 6, + vertical: 5, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (post.imageUrl != null) + DescriptionTextWidget(text: post.description!), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/raised_round_edge_button.dart b/lib/widgets/raised_round_edge_button.dart new file mode 100644 index 000000000..0ce734066 --- /dev/null +++ b/lib/widgets/raised_round_edge_button.dart @@ -0,0 +1,99 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; + +/// This class returns a widget for a raised rounded button, +/// for example: login button in login screen. +class RaisedRoundedButton extends StatefulWidget { + // variables + const RaisedRoundedButton({ + required Key key, + required this.buttonLabel, + required this.backgroundColor, + required this.textColor, + required this.onTap, + this.height, + this.width, + this.showArrow = false, + }) : super(key: key); + final Color backgroundColor; + final Color textColor; + final bool showArrow; + final String buttonLabel; + final Function() onTap; + final double? height; + final double? width; + + @override + _RaisedRoundedButtonState createState() => _RaisedRoundedButtonState(); +} + +class _RaisedRoundedButtonState extends State { + @override + Widget build(BuildContext context) { + // Gesture Detector in Flutter is used to detect the user's gestures on the application. + return GestureDetector( + onTap: () { + widget.onTap(); + }, + child: Container( + width: widget.width ?? SizeConfig.screenWidth! * 0.94, + height: widget.height ?? SizeConfig.screenHeight! * 0.07, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: widget.backgroundColor, + ), + // If the widget.showArrow is true then show Row wrapper else FittedBox wrapper. + // By default it is false. The showArrow are true for some buttons like login & Sign up button in + // Organization URL Screen. + child: widget.showArrow + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + //unused + const Expanded( + child: Icon( + Icons.arrow_forward, + color: Colors.transparent, + ), + ), + Expanded( + child: Text( + widget.buttonLabel, + textAlign: TextAlign.center, + style: TextStyle( + fontWeight: FontWeight.w400, + fontSize: 18, + color: widget.textColor, + ), + ), + ), + Expanded( + child: Icon( + Icons.arrow_forward, + color: widget.textColor, + ), + ), + ], + ) + : FittedBox( + // FittedBox restricts its child widgets from growing its size beyond a certain limit + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 5.0), + child: Text( + widget.buttonLabel, + style: TextStyle( + fontWeight: FontWeight.w400, + fontSize: 18, + color: widget.textColor, + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/recurrence_dialog.dart b/lib/widgets/recurrence_dialog.dart new file mode 100644 index 000000000..868bc47ab --- /dev/null +++ b/lib/widgets/recurrence_dialog.dart @@ -0,0 +1,201 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; + +/// Dialog for showing recurrence options. +class ShowRecurrenceDialog extends StatefulWidget { + const ShowRecurrenceDialog({ + super.key, + required this.model, + }); + + /// Instance of create event view model. + final CreateEventViewModel model; + + @override + State createState() => _ShowRecurrenceDialogState(); +} + +class _ShowRecurrenceDialogState extends State { + @override + Widget build(BuildContext context) { + return Dialog( + child: SizedBox( + height: SizeConfig.screenHeight! * 0.74, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + radioButtonFixText( + "Does not repeat", + // coverage:ignore-start + (value) => updateModel(value!, false, null, null, null), + // coverage:ignore-end + ), + radioButton( + Frequency.daily, + widget.model.interval, + widget.model.count, + null, + null, + ), + radioButton(Frequency.weekly, widget.model.interval, + widget.model.count, null, [ + RecurrenceUtils + .weekDays[widget.model.recurrenceStartDate.weekday - 1], + ]), + radioButton( + Frequency.monthly, + widget.model.interval, + widget.model.count, + null, + null, + ), + if (RecurrenceUtils.getWeekDayOccurenceInMonth( + widget.model.recurrenceStartDate, + ) != + 5) + radioButton( + Frequency.monthly, + widget.model.interval, + widget.model.count, + RecurrenceUtils.getWeekDayOccurenceInMonth( + widget.model.recurrenceStartDate, + ), + [ + RecurrenceUtils + .weekDays[widget.model.recurrenceStartDate.weekday - 1], + ]), + if (RecurrenceUtils.isLastOccurenceOfWeekDay( + widget.model.recurrenceStartDate, + )) + radioButton(Frequency.monthly, widget.model.interval, + widget.model.count, -1, [ + RecurrenceUtils + .weekDays[widget.model.recurrenceStartDate.weekday - 1], + ]), + radioButton( + Frequency.yearly, + widget.model.interval, + widget.model.count, + null, + null, + ), + radioButtonFixText( + 'Monday to Friday ${widget.model.recurrenceEndDate != null ? "until ${DateFormat('MMMM d, y').format(widget.model.recurrenceEndDate!)}" : ""}', + (value) => updateModel(value!, true, Frequency.weekly, null, { + 'MONDAY', + 'TUESDAY', + 'WEDNESDAY', + 'THURSDAY', + 'FRIDAY', + }), + ), + radioButtonFixText("Custom...", (value) async { + widget.model.isRecurring = true; + await navigationService.pushScreen( + Routes.customRecurrencePage, + arguments: widget.model, + ); + setState(() { + Navigator.pop(context, widget.model.recurrenceLabel); + }); + }), + ], + ), + ), + ); + } + + /// custom radio list tile. + /// + /// **params**: + /// * `frequency`: represent the frequency of the event. + /// * `interval`: represent the interval of the event. + /// * `count`: represent the count of the event. + /// * `weekDayOccurenceInMonth`: represent the week day occurence in month. + /// * `weekDays`: represent the list of week days. + /// + /// **returns**: + /// * `RadioListTile`: returns radio list tile. + RadioListTile radioButton( + String frequency, + int? interval, + int? count, + int? weekDayOccurenceInMonth, + List? weekDays, + ) { + final String text = RecurrenceUtils.getRecurrenceRuleText( + frequency, + weekDays?.toSet(), + interval, + count, + weekDayOccurenceInMonth, + widget.model.recurrenceStartDate, + widget.model.recurrenceEndDate, + ); + return RadioListTile( + title: Text(text), + value: text, + groupValue: widget.model.recurrenceLabel, + onChanged: (value) => updateModel( + value!, + true, + frequency, + weekDayOccurenceInMonth, + weekDays?.map((day) => day.toUpperCase()).toSet(), + ), + ); + } + + /// custom radio list tile with fixed the text. + /// + /// **params**: + /// * `text`: represents the text of the radio button. + /// * `onChanged`: represents the function to be called when the radio button is pressed. + /// + /// **returns**: + /// * `RadioListTile`: returns radio list tile. + RadioListTile radioButtonFixText( + String text, + Function(String?)? onChanged, + ) { + return RadioListTile( + title: Text(text), + value: text, + groupValue: widget.model.recurrenceLabel, + onChanged: onChanged, + ); + } + + /// Returns the updated model with the selected recurrence options. + /// + /// **params**: + /// * `value`: represents text of the selected recurrence option. + /// * `isRecurring`: represent whether the event is recurring or not. + /// * `frequency`: represent the frequency of the event. + /// * `weekDayOccurenceInMonth`: represent the week day occurence in month. + /// * `weekDays`: represent the list of week days. + /// + /// **returns**: + /// None + void updateModel( + String value, + bool isRecurring, + String? frequency, + int? weekDayOccurenceInMonth, + Set? weekDays, + ) { + setState(() { + widget.model.isRecurring = isRecurring; + widget.model.recurrenceLabel = value; + widget.model.weekDays = weekDays ?? {}; + widget.model.weekDayOccurenceInMonth = weekDayOccurenceInMonth; + widget.model.frequency = frequency ?? Frequency.weekly; + Navigator.pop(context, value); + }); + } +} diff --git a/lib/widgets/rich_text.dart b/lib/widgets/rich_text.dart new file mode 100644 index 000000000..673634696 --- /dev/null +++ b/lib/widgets/rich_text.dart @@ -0,0 +1,32 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/cupertino.dart'; +import 'package:talawa/utils/app_localization.dart'; + +/// CustomRichText class returns a widget for customized rich/bold text. +/// These rich text are being used in form for changing the password. +class CustomRichText extends StatelessWidget { + const CustomRichText({required Key key, required this.words}) + : super(key: key); + final List> words; + @override + Widget build(BuildContext context) { + return RichText( + textAlign: TextAlign.start, + text: TextSpan( + text: + "${AppLocalizations.of(context)!.strictTranslate(words[0]['text'].toString().trim())} ", + style: words[0]['textStyle'] as TextStyle, + children: List.generate( + words.length - 1, + (index) => TextSpan( + text: + "${AppLocalizations.of(context)!.strictTranslate(words[index + 1]['text'].toString().trim())} ", + style: words[index + 1]['textStyle'] as TextStyle, + ), + ), + ), + ); + } +} diff --git a/lib/widgets/signup_progress_indicator.dart b/lib/widgets/signup_progress_indicator.dart new file mode 100644 index 000000000..63322830e --- /dev/null +++ b/lib/widgets/signup_progress_indicator.dart @@ -0,0 +1,74 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:timelines/timelines.dart'; + +/// This class returns a widget for showing the +/// progress indicator/flow while Signing Up/ Registration. +class SignupProgressIndicator extends StatelessWidget { + SignupProgressIndicator({required Key key, required this.currentPageIndex}) + : super(key: key); + + final int currentPageIndex; + final List progressLabel = [ + 'Select\nOrganization', + 'Enter Details', + 'Final', + ]; + + @override + Widget build(BuildContext context) { + return Container( + alignment: Alignment.center, + height: SizeConfig.screenHeight! * 0.15, + child: Timeline.tileBuilder( + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + builder: TimelineTileBuilder.connected( + contentsBuilder: (_, index) => Text( + AppLocalizations.of(context)!.strictTranslate(progressLabel[index]), + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + // If the flow index is greater than currentPageIndex then + // show green(visited) color else show fade(not visited) color. + color: index <= currentPageIndex + ? const Color(0xFF008A37) + : const Color(0xFF737373), + ), + textAlign: TextAlign.center, + ), + connectorBuilder: (_, index, __) { + return SolidLineConnector( + space: 30, + // If the flow index is greater than currentPageIndex then + // show green(visited) color else show fade(not visited) color. + color: index < currentPageIndex + ? const Color(0xFF008A37) + : const Color(0xFF737373), + ); + }, + indicatorBuilder: (_, index) { + return DotIndicator( + size: 25, + color: index <= currentPageIndex + ? const Color(0xFF008A37) + : const Color(0xFF737373), + child: index < currentPageIndex + ? const Icon( + Icons.done, + color: Colors.white, + size: 20, + ) + : const SizedBox(), + ); + }, + itemExtentBuilder: (_, __) => MediaQuery.of(context).size.width / 3, + itemCount: 3, + ), + ), + ); + } +} diff --git a/lib/widgets/talawa_error_dialog.dart b/lib/widgets/talawa_error_dialog.dart new file mode 100644 index 000000000..f7a252467 --- /dev/null +++ b/lib/widgets/talawa_error_dialog.dart @@ -0,0 +1,127 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; + +/// Common Error Dialog box for the whole talawa app. +class TalawaErrorDialog extends StatelessWidget { + const TalawaErrorDialog( + this.errorMessage, { + super.key, + required this.messageType, + }); + + /// error message for the talawaDialogBox. + final String errorMessage; + + /// enum to what is the type of error message. + final MessageType messageType; + + @override + Widget build(BuildContext context) { + final screenWidth = MediaQuery.of(context).size.width; + return SizedBox( + width: screenWidth * 0.8, // Adjust the width based on screen size + child: AlertDialog( + content: SizedBox( + width: SizeConfig.screenWidth! * 0.65, + height: SizeConfig.screenWidth! * 0.38, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset( + messageType == MessageType.error + ? 'assets/images/Vector.svg' + : messageType == MessageType.warning + ? 'assets/images/Vector.svg' + : messageType == MessageType.info + ? 'assets/icons/Info.svg' + : 'assets/images/Vector.svg', + colorFilter: ColorFilter.mode( + messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.yellow + : messageType == MessageType.info + ? Colors.green + : Colors.red, + BlendMode.srcIn, + ), + ), + const SizedBox( + height: 5, + ), + Text( + messageType == MessageType.error + ? AppLocalizations.of(context)!.strictTranslate('Error') + : messageType == MessageType.warning + ? AppLocalizations.of(context)! + .strictTranslate('Warning') + : messageType == MessageType.info + ? AppLocalizations.of(context)! + .strictTranslate('Information') + : AppLocalizations.of(context)! + .strictTranslate('Error'), + style: TextStyle( + color: messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.yellow + : messageType == MessageType.info + ? Colors.green + : Colors.red, + fontSize: screenWidth * + 0.04, // Adjust the font size based on screen width + ), + textAlign: TextAlign.center, + ), + const SizedBox( + height: 5, + ), + Expanded( + child: AutoSizeText( + AppLocalizations.of(context)!.strictTranslate(errorMessage), + style: const TextStyle(fontSize: 16), + maxLines: 3, + ), + ), + const SizedBox( + height: 19, + ), + ], + ), + ), + actions: [ + TextButton( + style: TextButton.styleFrom( + backgroundColor: messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.red + : messageType == MessageType.info + ? Colors.black26 + : Colors.red, + foregroundColor: Colors.red, + ), + child: Text( + messageType == MessageType.error + ? 'Dismiss' + : messageType == MessageType.warning + ? 'Dismiss' + : messageType == MessageType.info + ? 'Close' + : 'Dismiss', + style: const TextStyle(color: Color.fromRGBO(202, 202, 202, 1)), + ), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + ); + } +} diff --git a/lib/widgets/talawa_error_snackbar.dart b/lib/widgets/talawa_error_snackbar.dart new file mode 100644 index 000000000..2a981b110 --- /dev/null +++ b/lib/widgets/talawa_error_snackbar.dart @@ -0,0 +1,88 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/enums/enums.dart'; + +import 'package:talawa/utils/app_localization.dart'; + +/// Common Error Snack Bar for the whole talawa app. +class TalawaErrorSnackBar extends StatelessWidget { + const TalawaErrorSnackBar({ + super.key, + required this.duration, + required this.errorMessage, + required this.messageType, + }); + + /// Duration the snack bar is visible. + final Duration duration; + + /// error message for the talawa Snack Bar. + final String errorMessage; + + /// enum for the type of error message. + final MessageType messageType; + @override + Widget build(BuildContext context) { + final ScrollController scrollController = ScrollController(); + + WidgetsBinding.instance.addPostFrameCallback((_) { + scrollController.animateTo( + scrollController.position.maxScrollExtent, + duration: duration, + curve: Curves.linear, + ); + }); + + return Row( + children: [ + Container( + width: 20, + height: 80, + decoration: BoxDecoration( + color: messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.yellow + : messageType == MessageType.info + ? Colors.green + : Colors.red, + ), + ), + const SizedBox( + width: 10, + ), + Icon( + messageType == MessageType.error + ? Icons.error + : messageType == MessageType.warning + ? Icons.error + : messageType == MessageType.info + ? Icons.info_outline + : Icons.error, + // Icons.error, + color: messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.yellow + : messageType == MessageType.info + ? Colors.green + : Colors.red, + size: 35, + ), + const SizedBox( + width: 10, + ), + Expanded( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + controller: scrollController, + child: Text( + AppLocalizations.of(context)!.strictTranslate(errorMessage), + style: const TextStyle(color: Colors.white), + ), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/theme_switch.dart b/lib/widgets/theme_switch.dart new file mode 100644 index 000000000..4df56a15c --- /dev/null +++ b/lib/widgets/theme_switch.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; + +/// This class enables theme switch. +class ChangeThemeTile extends StatelessWidget { + const ChangeThemeTile({super.key}); + + @override + Widget build(BuildContext context) { + final themeProvider = Provider.of(context); + return ListTile( + key: const Key('ThemeSwitch'), + contentPadding: EdgeInsets.symmetric( + horizontal: SizeConfig.blockSizeHorizontal!, + ), + title: Text(AppLocalizations.of(context)!.strictTranslate("Dark Theme")), + trailing: Switch( + key: const Key('ToggleTheme'), + autofocus: true, + activeColor: Theme.of(context).colorScheme.primary, + value: themeProvider.isdarkTheme, + onChanged: (value) { + final provider = Provider.of(context, listen: false); + provider.switchTheme(isOn: value); + }, + ), + ); + } +} diff --git a/lib/widgets/venue_card.dart b/lib/widgets/venue_card.dart new file mode 100644 index 000000000..7d2a1e685 --- /dev/null +++ b/lib/widgets/venue_card.dart @@ -0,0 +1,130 @@ +import 'package:flutter/material.dart'; +import 'package:talawa/models/events/event_venue.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; + +/// This class returns the VenueCard widget. +class VenueCard extends StatelessWidget { + const VenueCard({ + super.key, + required this.venue, + this.isSelected = false, + }); + + /// The venue object containing details about the venue. + final Venue venue; + + /// Indicates whether the venue card is selected. + /// + /// When true, the venue card will visually indicate that it is selected. + final bool isSelected; + + @override + Widget build(BuildContext context) { + final orgURI = GraphqlConfig.orgURI!.replaceFirst('/graphql', ''); + final imageURl = + venue.imageUrl!.replaceAll('http://localhost:4000', orgURI); + + return Padding( + padding: const EdgeInsets.only(bottom: 10), + child: Stack( + children: [ + Card( + surfaceTintColor: Theme.of(context).colorScheme.secondaryContainer, + shape: const RoundedRectangleBorder( + side: BorderSide.none, + ), + elevation: 3, + color: isSelected + ? Colors.blue.withOpacity(0.3) + : Theme.of(context).primaryColor, + child: Column( + children: [ + AspectRatio( + aspectRatio: 2.5, + child: Container( + key: const Key('image_container'), + height: SizeConfig.screenHeight! * 0.11, + width: double.infinity, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(0.3), + image: DecorationImage( + fit: BoxFit.fitWidth, + alignment: FractionalOffset.topCenter, + image: venue.imageUrl!.isNotEmpty + ? NetworkImage(imageURl) + : const AssetImage('assets/images/defaultImg.png') + as ImageProvider, + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Row( + children: [ + SizedBox( + width: SizeConfig.screenWidth! * 0.48, + child: Text( + venue.name!, + style: Theme.of(context).textTheme.headlineSmall, + ), + ), + const Icon( + Icons.people, + size: 22, + ), + Padding( + padding: const EdgeInsets.only(left: 8), + child: Text( + 'Capacity: ${venue.capacity}', + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.006, + ), + Row( + children: [ + const Icon( + Icons.description, + size: 12, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.015, + ), + Expanded( + child: Text( + venue.description!, + style: Theme.of(context).textTheme.bodySmall, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + maxLines: 3, + ), + ), + ], + ), + ], + ), + ), + ], + ), + ), + if (isSelected) + const Positioned( + top: 10, + right: 10, + child: Icon( + Icons.check_circle, + color: Colors.green, + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/video_widget.dart b/lib/widgets/video_widget.dart new file mode 100644 index 000000000..688f7c766 --- /dev/null +++ b/lib/widgets/video_widget.dart @@ -0,0 +1,114 @@ +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({super.key, required this.url, required this.play}); + + /// a_line_ending_with_end_punctuation. + /// + /// more_info_if_required + final String url; + + /// Is the video playing. + /// + final bool play; + + @override + _VideoWidgetState createState() => _VideoWidgetState(); +} + +class _VideoWidgetState extends State { + //Controls a platform video player, and provides updates when the state is changing + late VideoPlayerController _controller; + late Future _initializeVideoPlayerFuture; + //setting the mute variable to true initially + /// Is the Video muted. + /// + bool mute = true; + + @override + void initState() { + super.initState(); + //Constructs a [VideoPlayerController] playing a video from obtained from the network. + _controller = VideoPlayerController.networkUrl(widget.url as Uri); + _initializeVideoPlayerFuture = _controller.initialize().then((_) { + // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed. + if (widget.play) { + _controller.play(); + _controller.setLooping(true); + _controller.setVolume(0.0); + } + setState(() {}); + }); + } + + @override + void didUpdateWidget(VideoWidget oldWidget) { + if (oldWidget.play != widget.play) { + if (widget.play) { + _controller.play(); + _controller.setLooping(true); + } else { + _controller.pause(); + } + } + super.didUpdateWidget(oldWidget); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + 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) { + if (snapshot.connectionState == ConnectionState.done) { + return GestureDetector( + onTap: () { + _controller + .setVolume(_controller.value.volume == 1.0 ? 0.0 : 1.0); + setState(() { + if (_controller.value.volume == 1.0) { + // Set mute variable as false when the volume is increased to 1. + mute = false; + } else { + mute = true; + } + }); + }, + child: Stack( + children: [ + VideoPlayer(_controller), + Positioned( + bottom: 10.0, + right: 10.0, + child: CircleAvatar( + backgroundColor: Colors.black, + radius: 15.0, + child: Icon( + mute ? Icons.volume_off : Icons.volume_up, + color: Colors.white, + ), + ), + ), + ], + ), + ); + } else { + return const Center( + child: CircularProgressIndicator(), + ); + } + }, + ); + } +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 000000000..bec495176 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,1750 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + analyzer_plugin: + dependency: transitive + description: + name: analyzer_plugin + sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" + url: "https://pub.dev" + source: hosted + version: "0.11.3" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + sha256: "3f5261cd3fb5f2a9ab4e2fc3fba84fd9fcaac8821f20a1d4e71f557521b22599" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" + url: "https://pub.dev" + source: hosted + version: "4.0.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7" + url: "https://pub.dev" + source: hosted + version: "2.4.11" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185 + url: "https://pub.dev" + source: hosted + version: "7.2.11" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: c9aabae0718ec394e5bc3c7272e6bb0dc0b32201a08fe185ec1d8401d3e39309 + url: "https://pub.dev" + source: hosted + version: "8.8.1" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" + url: "https://pub.dev" + source: hosted + version: "4.1.1" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + ci: + dependency: transitive + description: + name: ci + sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 + url: "https://pub.dev" + source: hosted + version: "0.4.1" + clock: + dependency: "direct main" + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" + source: hosted + version: "4.10.0" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + connectivity_plus: + dependency: "direct main" + description: + name: connectivity_plus + sha256: "224a77051d52a11fbad53dd57827594d3bd24f945af28bd70bab376d68d437f0" + url: "https://pub.dev" + source: hosted + version: "5.0.2" + connectivity_plus_platform_interface: + dependency: transitive + description: + name: connectivity_plus_platform_interface + sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a + url: "https://pub.dev" + source: hosted + version: "1.2.4" + contained_tab_bar_view: + dependency: "direct main" + description: + name: contained_tab_bar_view + sha256: "87e35f47992764e45ab6205493f2f90c1e3fac4ad84f2b2285b73414727b756e" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + container_tab_indicator: + dependency: transitive + description: + name: container_tab_indicator + sha256: b0bdd73bb495c31c5711cefa363511b10bb3ebcfc007b603a2599401ebe6b2d9 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + url: "https://pub.dev" + source: hosted + version: "0.3.4+2" + crypto: + dependency: "direct main" + description: + name: crypto + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 + url: "https://pub.dev" + source: hosted + version: "3.0.5" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + currency_picker: + dependency: "direct main" + description: + name: currency_picker + sha256: c9ab5c0da8ae4dcc6421064dccde072b44f5b44914691b967ea4cf45a266a658 + url: "https://pub.dev" + source: hosted + version: "2.0.21" + custom_lint: + dependency: "direct dev" + description: + name: custom_lint + sha256: dfb893ff17c83cf08676c6b64df11d3e53d80590978d7c1fb242afff3ba6dedb + url: "https://pub.dev" + source: hosted + version: "0.5.8" + custom_lint_builder: + dependency: transitive + description: + name: custom_lint_builder + sha256: "8df6634b38a36a6c6cb74a9c0eb02e9ba0b0ab89b29e38e6daa86e8ed2c6288d" + url: "https://pub.dev" + source: hosted + version: "0.5.8" + custom_lint_core: + dependency: transitive + description: + name: custom_lint_core + sha256: "2b235be098d157e244f18ea905a15a18c16a205e30553888fac6544bbf52f03f" + url: "https://pub.dev" + source: hosted + version: "0.5.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" + url: "https://pub.dev" + source: hosted + version: "2.3.4" + dbus: + dependency: transitive + description: + name: dbus + sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" + url: "https://pub.dev" + source: hosted + version: "0.7.10" + delightful_toast: + dependency: "direct main" + description: + name: delightful_toast + sha256: "93d0b9e89a65947e42daa8aafe552596487dbedc15f68d0480654e789e94bc5b" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + device_info_plus: + dependency: transitive + description: + name: device_info_plus + sha256: "093b02a284b4969bb641a6236bbb8e626e4035c6ec9e30c20b65d505c24b3080" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fake_async: + dependency: "direct dev" + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + file: + dependency: "direct main" + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + url: "https://pub.dev" + source: hosted + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 + url: "https://pub.dev" + source: hosted + version: "0.9.3+3" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + url: "https://pub.dev" + source: hosted + version: "0.9.3+1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_animate: + dependency: transitive + description: + name: flutter_animate + sha256: "7c8a6594a9252dad30cc2ef16e33270b6248c4dedc3b3d06c86c4f3f4dc05ae5" + url: "https://pub.dev" + source: hosted + version: "4.5.0" + flutter_braintree: + dependency: "direct main" + description: + name: flutter_braintree + sha256: d58a91212c21f97aa1e8fcbcbb394744eb5997c7ba929274daf3cf903ceef8db + url: "https://pub.dev" + source: hosted + version: "4.0.0" + flutter_cache_manager: + dependency: "direct main" + description: + name: flutter_cache_manager + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + flutter_hooks: + dependency: transitive + description: + name: flutter_hooks + sha256: "09f64db63fee3b2ab8b9038a1346be7d8986977fae3fec601275bf32455ccfc0" + url: "https://pub.dev" + source: hosted + version: "0.20.4" + flutter_local_notifications: + dependency: "direct main" + description: + name: flutter_local_notifications + sha256: "725145682706fb0e5a30f93e5cb64f3df7ed7743de749bd555b22bf75ee718c0" + url: "https://pub.dev" + source: hosted + version: "18.0.0" + flutter_local_notifications_linux: + dependency: transitive + description: + name: flutter_local_notifications_linux + sha256: "8f685642876742c941b29c32030f6f4f6dacd0e4eaecb3efbb187d6a3812ca01" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_local_notifications_platform_interface: + dependency: transitive + description: + name: flutter_local_notifications_platform_interface + sha256: "6c5b83c86bf819cdb177a9247a3722067dd8cc6313827ce7c77a4b238a26fd52" + url: "https://pub.dev" + source: hosted + version: "8.0.0" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + url: "https://pub.dev" + source: hosted + version: "2.0.17" + flutter_reaction_button: + dependency: "direct main" + description: + name: flutter_reaction_button + sha256: "9fe67f6e6dac65c5ee864c2ab03550b25e7fc82b9a800c885a87f85abe2c03c6" + url: "https://pub.dev" + source: hosted + version: "3.0.0+3" + flutter_shaders: + dependency: transitive + description: + name: flutter_shaders + sha256: "02750b545c01ff4d8e9bbe8f27a7731aa3778402506c67daa1de7f5fc3f4befe" + url: "https://pub.dev" + source: hosted + version: "0.1.2" + flutter_speed_dial: + dependency: "direct main" + description: + name: flutter_speed_dial + sha256: "698a037274a66dbae8697c265440e6acb6ab6cae9ac5f95c749e7944d8f28d41" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: "578bd8c508144fdaffd4f77b8ef2d8c523602275cd697cc3db284dbd762ef4ce" + url: "https://pub.dev" + source: hosted + version: "2.0.14" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + font_awesome_flutter: + dependency: "direct main" + description: + name: font_awesome_flutter + sha256: d3a89184101baec7f4600d58840a764d2ef760fe1c5a20ef9e6b0e9b24a07a3a + url: "https://pub.dev" + source: hosted + version: "10.8.0" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + url: "https://pub.dev" + source: hosted + version: "2.4.1" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + get_it: + dependency: "direct main" + description: + name: get_it + sha256: c49895c1ecb0ee2a0ec568d39de882e2c299ba26355aa6744ab1001f98cebd15 + url: "https://pub.dev" + source: hosted + version: "8.0.2" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + gql: + dependency: transitive + description: + name: gql + sha256: "0bdd22c3a9464970ae590559e4f0568769b219dda9e94cb10c4cf999a3e263f7" + url: "https://pub.dev" + source: hosted + version: "1.0.1-alpha+1705114622973" + gql_dedupe_link: + dependency: transitive + description: + name: gql_dedupe_link + sha256: e5359dd0c7a38f95e2b12f6ab305989a4e30028e4032825c8e9f610150999c69 + url: "https://pub.dev" + source: hosted + version: "2.0.4-alpha+1705114623057" + gql_error_link: + dependency: transitive + description: + name: gql_error_link + sha256: "93901458f3c050e33386dedb0ca7173e08cebd7078e4e0deca4bf23ab7a71f63" + url: "https://pub.dev" + source: hosted + version: "1.0.0+1" + gql_exec: + dependency: transitive + description: + name: gql_exec + sha256: "394944626fae900f1d34343ecf2d62e44eb984826189c8979d305f0ae5846e38" + url: "https://pub.dev" + source: hosted + version: "1.1.1-alpha+1699813812660" + gql_http_link: + dependency: transitive + description: + name: gql_http_link + sha256: "1f922eed1b7078fdbfd602187663026f9f659fe9a9499e2207b5d5e01617f658" + url: "https://pub.dev" + source: hosted + version: "1.0.1+1" + gql_link: + dependency: transitive + description: + name: gql_link + sha256: "63941513a688d856546f0c3218e7ad94d47fc6e04662dcdb06de92a4cde2d7db" + url: "https://pub.dev" + source: hosted + version: "1.0.1-alpha+1705114622987" + gql_transform_link: + dependency: transitive + description: + name: gql_transform_link + sha256: "0645fdd874ca1be695fd327271fdfb24c0cd6fa40774a64b946062f321a59709" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + graphql: + dependency: transitive + description: + name: graphql + sha256: d066e53446166c12537458386b507f7426f2b8801ebafc184576aab3cbc64d56 + url: "https://pub.dev" + source: hosted + version: "5.2.0-beta.7" + graphql_flutter: + dependency: "direct main" + description: + name: graphql_flutter + sha256: "39b5e830bc654ab02c5b776c31675841d1a8c95840fdd284efba713b1d47e65d" + url: "https://pub.dev" + source: hosted + version: "5.2.0-beta.6" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + hive: + dependency: "direct main" + description: + name: hive + sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + url: "https://pub.dev" + source: hosted + version: "2.2.3" + hive_generator: + dependency: "direct dev" + description: + name: hive_generator + sha256: "06cb8f58ace74de61f63500564931f9505368f45f98958bd7a6c35ba24159db4" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + hotreloader: + dependency: transitive + description: + name: hotreloader + sha256: ed56fdc1f3a8ac924e717257621d09e9ec20e308ab6352a73a50a1d7a4d9158e + url: "https://pub.dev" + source: hosted + version: "4.2.0" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" + http: + dependency: "direct main" + description: + name: http + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" + source: hosted + version: "1.2.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + image_cropper: + dependency: "direct main" + description: + name: image_cropper + sha256: f4bad5ed2dfff5a7ce0dfbad545b46a945c702bb6182a921488ef01ba7693111 + url: "https://pub.dev" + source: hosted + version: "5.0.1" + image_cropper_for_web: + dependency: transitive + description: + name: image_cropper_for_web + sha256: "865d798b5c9d826f1185b32e5d0018c4183ddb77b7b82a931e1a06aa3b74974e" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + image_cropper_platform_interface: + dependency: transitive + description: + name: image_cropper_platform_interface + sha256: ee160d686422272aa306125f3b6fb1c1894d9b87a5e20ed33fa008e7285da11e + url: "https://pub.dev" + source: hosted + version: "5.0.0" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "39f2bfe497e495450c81abcd44b62f56c2a36a37a175da7d137b4454977b51b1" + url: "https://pub.dev" + source: hosted + version: "0.8.9+3" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: e2423c53a68b579a7c37a1eda967b8ae536c3d98518e5db95ca1fe5719a730a3 + url: "https://pub.dev" + source: hosted + version: "3.0.2" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: fadafce49e8569257a0cad56d24438a6fa1f0cbd7ee0af9b631f7492818a4ca3 + url: "https://pub.dev" + source: hosted + version: "0.8.9+1" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80" + url: "https://pub.dev" + source: hosted + version: "2.10.0" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + intl: + dependency: "direct main" + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: "direct main" + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b + url: "https://pub.dev" + source: hosted + version: "6.8.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lint: + dependency: "direct dev" + description: + name: lint + sha256: d758a5211fce7fd3f5e316f804daefecdc34c7e53559716125e6da7388ae8565 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + meta: + dependency: transitive + description: + name: meta + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + mockito: + dependency: "direct main" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" + mocktail: + dependency: transitive + description: + name: mocktail + sha256: f603ebd85a576e5914870b02e5839fc5d0243b867bf710651cf239a28ebb365e + url: "https://pub.dev" + source: hosted + version: "1.0.2" + mocktail_image_network: + dependency: "direct dev" + description: + name: mocktail_image_network + sha256: a1fccbba780343517cfc552e0af2b3834d8bdb8f9f55a746c4d495ed1a8d50d6 + url: "https://pub.dev" + source: hosted + version: "1.2.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + network_image_mock: + dependency: "direct main" + description: + name: network_image_mock + sha256: "855cdd01d42440e0cffee0d6c2370909fc31b3bcba308a59829f24f64be42db7" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + nm: + dependency: transitive + description: + name: nm + sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + normalize: + dependency: transitive + description: + name: normalize + sha256: "8a60e37de5b608eeaf9b839273370c71ebba445e9f73b08eee7725e0d92dbc43" + url: "https://pub.dev" + source: hosted + version: "0.8.2+1" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" + url: "https://pub.dev" + source: hosted + version: "2.2.10" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + sha256: "18bf33f7fefbd812f37e72091a15575e72d5318854877e0e4035a24ac1113ecb" + url: "https://pub.dev" + source: hosted + version: "11.3.1" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: "758284a0976772f9c744d6384fc5dc4834aa61e3f7aa40492927f244767374eb" + url: "https://pub.dev" + source: hosted + version: "12.0.3" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: e9ad66020b89ff1b63908f247c2c6f931c6e62699b756ef8b3c4569350cd8662 + url: "https://pub.dev" + source: hosted + version: "9.4.4" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: "54bf176b90f6eddd4ece307e2c06cf977fb3973719c35a93b85cc7093eb6070d" + url: "https://pub.dev" + source: hosted + version: "0.1.1" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: "23dfba8447c076ab5be3dee9ceb66aad345c4a648f0cac292c77b1eb0e800b78" + url: "https://pub.dev" + source: hosted + version: "4.2.0" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e" + url: "https://pub.dev" + source: hosted + version: "0.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + plugin_platform_interface: + dependency: "direct main" + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pointycastle: + dependency: "direct main" + description: + name: pointycastle + sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" + url: "https://pub.dev" + source: hosted + version: "3.9.1" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + provider: + dependency: "direct main" + description: + name: provider + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + url: "https://pub.dev" + source: hosted + version: "6.1.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + qr: + dependency: transitive + description: + name: qr + sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + qr_code_scanner: + dependency: "direct main" + description: + name: qr_code_scanner + sha256: f23b68d893505a424f0bd2e324ebea71ed88465d572d26bb8d2e78a4749591fd + url: "https://pub.dev" + source: hosted + version: "1.0.1" + qr_flutter: + dependency: "direct main" + description: + name: qr_flutter + sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + quick_actions: + dependency: "direct main" + description: + name: quick_actions + sha256: "2c1d9a91f3218b4e987a7e1e95ba0415b7f48a2cb3ffacc027a1e3d3c117223f" + url: "https://pub.dev" + source: hosted + version: "1.0.8" + quick_actions_android: + dependency: transitive + description: + name: quick_actions_android + sha256: adb42f20a46b22fee4caef421c00ff9eb209f9d441010bc5d6e9afa824288cf6 + url: "https://pub.dev" + source: hosted + version: "1.0.10" + quick_actions_ios: + dependency: transitive + description: + name: quick_actions_ios + sha256: dd355101d0e9fef6176fa2ae2bf738bcafa8df09a1e17057fcb56475719793de + url: "https://pub.dev" + source: hosted + version: "1.0.10" + quick_actions_platform_interface: + dependency: transitive + description: + name: quick_actions_platform_interface + sha256: "81a1e40c519bb3cacfec38b3008b13cef665a75bd270da94f40091b57f0f9236" + url: "https://pub.dev" + source: hosted + version: "1.0.6" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" + source: hosted + version: "0.27.7" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "95f9997ca1fb9799d494d0cb2a780fd7be075818d59f00c43832ed112b158a82" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "480ba4345773f56acda9abf5f50bd966f581dac5d514e5fc4a18c62976bbba7e" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f + url: "https://pub.dev" + source: hosted + version: "2.5.2" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e + url: "https://pub.dev" + source: hosted + version: "2.4.2" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + shimmer: + dependency: "direct main" + description: + name: shimmer + sha256: "5f88c883a22e9f9f299e5ba0e4f7e6054857224976a5d9f839d4ebdc94a14ac9" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + social_share: + dependency: "direct main" + description: + name: social_share + sha256: eb19a0f6f5a29c7bb71e5bb1991145eb52472184363b6e2da70695befd8be041 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" + url: "https://pub.dev" + source: hosted + version: "1.3.4" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d + url: "https://pub.dev" + source: hosted + version: "2.3.3+1" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: bb4738f15b23352822f4c42a531677e5c6f522e079461fd240ead29d8d8a54a6 + url: "https://pub.dev" + source: hosted + version: "2.5.0+2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + syncfusion_flutter_calendar: + dependency: "direct main" + description: + name: syncfusion_flutter_calendar + sha256: "769d3bbf8743922d74b242a968366661bd7b2973b3d34af9b9bc865874a520d9" + url: "https://pub.dev" + source: hosted + version: "27.1.58" + syncfusion_flutter_core: + dependency: transitive + description: + name: syncfusion_flutter_core + sha256: "31d2ddf410ee41abb3ecf85b7b6e8e1563307ad52ee784ddd91337e30280f715" + url: "https://pub.dev" + source: hosted + version: "27.1.58" + syncfusion_flutter_datepicker: + dependency: "direct main" + description: + name: syncfusion_flutter_datepicker + sha256: e25797401bec43cd64c475150f87150e8bc3e67212d4d1273ff35483ea793a8b + url: "https://pub.dev" + source: hosted + version: "27.1.58" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + talawa_lint: + dependency: "direct dev" + description: + path: talawa_lint + relative: true + source: path + version: "0.0.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" + source: hosted + version: "0.7.0" + timelines: + dependency: "direct main" + description: + name: timelines + sha256: "40214f5ab772ff45459cb8c15e5f60505a6828af0c0eb1eec6f29ed911a4c1c5" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + timezone: + dependency: transitive + description: + name: timezone + sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d" + url: "https://pub.dev" + source: hosted + version: "0.9.4" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + tutorial_coach_mark: + dependency: "direct main" + description: + name: tutorial_coach_mark + sha256: df450c88d4c812bc221afd3ff948da3dc0f44c0b4fa5dbc046d6d86f2cfc9e71 + url: "https://pub.dev" + source: hosted + version: "1.2.12" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + uni_links: + dependency: "direct main" + description: + name: uni_links + sha256: "051098acfc9e26a9fde03b487bef5d3d228ca8f67693480c6f33fd4fbb8e2b6e" + url: "https://pub.dev" + source: hosted + version: "0.5.1" + uni_links_platform_interface: + dependency: "direct main" + description: + name: uni_links_platform_interface + sha256: "929cf1a71b59e3b7c2d8a2605a9cf7e0b125b13bc858e55083d88c62722d4507" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + uni_links_web: + dependency: transitive + description: + name: uni_links_web + sha256: "7539db908e25f67de2438e33cc1020b30ab94e66720b5677ba6763b25f6394df" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" + url: "https://pub.dev" + source: hosted + version: "6.3.1" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79 + url: "https://pub.dev" + source: hosted + version: "6.3.9" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" + url: "https://pub.dev" + source: hosted + version: "6.2.4" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + url: "https://pub.dev" + source: hosted + version: "3.1.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + url: "https://pub.dev" + source: hosted + version: "3.1.0" + url_launcher_platform_interface: + dependency: "direct dev" + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + url: "https://pub.dev" + source: hosted + version: "3.1.1" + uuid: + dependency: transitive + description: + name: uuid + sha256: f33d6bb662f0e4f79dcd7ada2e6170f3b3a2530c28fc41f49a411ddedd576a77 + url: "https://pub.dev" + source: hosted + version: "4.5.0" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "773c9522d66d523e1c7b25dfb95cc91c26a1e17b107039cfe147285e92de7878" + url: "https://pub.dev" + source: hosted + version: "1.1.14" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: ab9ff38fc771e9ee1139320adbe3d18a60327370c218c60752068ebee4b49ab1 + url: "https://pub.dev" + source: hosted + version: "1.1.15" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vibration: + dependency: "direct main" + description: + name: vibration + sha256: f0af02af2d63132135ae0332a3e54d5de718e214ee94c4f082176ef6ce624a4b + url: "https://pub.dev" + source: hosted + version: "2.0.1" + vibration_platform_interface: + dependency: transitive + description: + name: vibration_platform_interface + sha256: f66b39aab2447038978c16f3d6f77228e49ef5717556e3da02313e044e4a7600 + url: "https://pub.dev" + source: hosted + version: "0.0.2" + video_player: + dependency: "direct main" + description: + name: video_player + sha256: "4a8c3492d734f7c39c2588a3206707a05ee80cef52e8c7f3b2078d430c84bc17" + url: "https://pub.dev" + source: hosted + version: "2.9.2" + video_player_android: + dependency: transitive + description: + name: video_player_android + sha256: "7f8f25d7ad56819a82b2948357f3c3af071f6a678db33833b26ec36bbc221316" + url: "https://pub.dev" + source: hosted + version: "2.4.11" + video_player_avfoundation: + dependency: transitive + description: + name: video_player_avfoundation + sha256: "309e3962795e761be010869bae65c0b0e45b5230c5cee1bec72197ca7db040ed" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + sha256: "236454725fafcacf98f0f39af0d7c7ab2ce84762e3b63f2cbb3ef9a7e0550bc6" + url: "https://pub.dev" + source: hosted + version: "6.2.2" + video_player_web: + dependency: transitive + description: + name: video_player_web + sha256: "34beb3a07d4331a24f7e7b2f75b8e2b103289038e07e65529699a671b6a6e2cb" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + visibility_detector: + dependency: "direct main" + description: + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 + url: "https://pub.dev" + source: hosted + version: "0.4.0+2" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" + source: hosted + version: "14.2.1" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" + source: hosted + version: "5.2.0" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.4.0 <=3.4.4" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3539b28ce..c18850a81 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,115 +1,118 @@ name: talawa -description: A new Flutter project. +description: Welcome to the Talawa Project for the Palisadoes Foundation + Community Organization Management Software. + +publish_to: "none" # Remove this line if you wish to publish to pub.dev -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+1 +homepage: https://github.com/PalisadoesFoundation/talawa + +repository: https://github.com/PalisadoesFoundation/talawa environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.17.0 <=3.4.4" dependencies: - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - adhara_socket_io: ^0.4.1 - async: ^2.5.0 - carousel_slider: ^2.2.1 - cupertino_icons: ^0.1.2 - data_connection_checker: ^0.3.4 - datetime_picker_formfield: ^1.0.0 - email_validator: ^1.0.4 - filter_list: ^0.0.4 + ############# Remove ########### + # _fe_analyzer_shared: ^60.0.0 + # analyzer: + # analyzer_plugin: + ################################ + + auto_size_text: ^3.0.0 + cached_network_image: ^3.4.1 + clock: ^1.1.1 + connectivity_plus: ^5.0.2 + contained_tab_bar_view: ^0.8.0 + + crypto: ^3.0.5 + cupertino_icons: ^1.0.8 + currency_picker: ^2.0.21 + ############## Remove ########## + + # custom_lint_builder: ^0.4.0 + ################################ + delightful_toast: ^1.1.0 + file: ^7.0.1 + flutter: sdk: flutter + flutter_braintree: ^4.0.0 + flutter_cache_manager: ^3.4.1 + flutter_local_notifications: ^18.0.0 flutter_localizations: sdk: flutter - flutter_logs: ^2.1.3 - flutter_masked_text: ^0.8.0 - flutter_password_strength: ^0.1.6 - flutter_pw_validator: ^1.2.1 - flutter_secure_storage: any - flutter_sticky_header: ^0.4.5 - flutter_svg: ^0.20.0-nullsafety.3 - fluttertoast: ^7.1.8 - font_awesome_flutter: - get_it: ^4.0.4 - graphql_flutter: ^3.0.1 - grouped_buttons: ^1.0.4 - http: ^0.12.0+1 - image_picker: any - intl: ^0.17.0 - package_info: ^2.0.0 - path_provider: ^1.6.28 - persistent_bottom_nav_bar: ^3.2.0 - progress_dialog: ^1.2.4 - provider: ^4.0.1 - shared_preferences: any - sqflite: ^1.3.0 - table_calendar: ^2.2.3 - timeline_list: ^0.0.5 - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. + flutter_reaction_button: ^3.0.0+3 + flutter_speed_dial: ^7.0.0 + flutter_svg: ^2.0.14 + font_awesome_flutter: ^10.8.0 + get_it: ^8.0.2 + graphql_flutter: ^5.1.2 + hive: ^2.2.3 + http: ^1.2.2 + image_cropper: ^5.0.1 + image_picker: ^1.1.2 + intl: ^0.19.0 + json_annotation: ^4.7.0 + mockito: ^5.4.4 + network_image_mock: ^2.1.1 + path_provider: ^2.1.5 + permission_handler: 11.3.1 + plugin_platform_interface: ^2.1.7 + pointycastle: ^3.9.1 + provider: ^6.1.2 + qr_code_scanner: ^1.0.0 + qr_flutter: 4.1.0 + quick_actions: ^1.0.8 + shared_preferences: ^2.3.3 + shimmer: ^3.0.0 + social_share: ^2.2.1 + syncfusion_flutter_calendar: ^27.1.58 + syncfusion_flutter_datepicker: ^27.1.58 + timelines: ^0.1.0 + tutorial_coach_mark: ^1.2.12 + uni_links: ^0.5.1 + uni_links_platform_interface: ^1.0.0 + url_launcher: ^6.3.1 + vibration: ^2.0.1 + video_player: ^2.9.2 + visibility_detector: ^0.4.0+2 dev_dependencies: - flutter_driver: + build_runner: ^2.4.11 + custom_lint: 0.5.8 + fake_async: ^1.3.1 + flutter_test: sdk: flutter - lint: ^1.5.3 - random_pk: -#flutter_launcher_icons: "^0.8.0" + hive_generator: ^2.0.1 -#flutter_icons: -# android: "launcher_icon" -# ios: true -# image_path: "assets/images/talawaLogo.png" -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec + json_serializable: ^6.8.0 + lint: ^2.3.0 + + mocktail_image_network: ^1.2.0 + talawa_lint: + path: talawa_lint/ + + url_launcher_platform_interface: 2.3.2 -# The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - - # To add assets to your application, add an assets section, like this: assets: - assets/images/ - - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages + - assets/icons/ + - lang/ + fonts: + - family: product-sans + fonts: + - asset: assets/fonts/ProductSans-Regular.ttf + - asset: assets/fonts/ProductSans-Medium.ttf + weight: 600 + - asset: assets/fonts/ProductSans-Bold.ttf + weight: 800 + - family: open-sans + fonts: + - asset: assets/fonts/OpenSans-Regular.ttf + - asset: assets/fonts/OpenSans-SemiBold.ttf + weight: 600 + - asset: assets/fonts/OpenSans-Bold.ttf + weight: 800 diff --git a/talawa-mobile-docs/TalawaAdmin.md b/talawa-mobile-docs/TalawaAdmin.md new file mode 100644 index 000000000..757a15bf4 --- /dev/null +++ b/talawa-mobile-docs/TalawaAdmin.md @@ -0,0 +1 @@ +file will be overwritten. \ No newline at end of file diff --git a/talawa-mobile-docs/__404error.md b/talawa-mobile-docs/__404error.md new file mode 100644 index 000000000..0fedbdcfd --- /dev/null +++ b/talawa-mobile-docs/__404error.md @@ -0,0 +1,6 @@ +# 404 + +Oops, something's gone wrong :-( + +You've tried to visit a page that doesn't exist. Luckily this site has other +[pages](index.md). diff --git a/talawa-mobile-docs/apptheme/AppTheme-class.md b/talawa-mobile-docs/apptheme/AppTheme-class.md new file mode 100644 index 000000000..517eacb47 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme-class.md @@ -0,0 +1,347 @@ + + + +# AppTheme class + + + + + + + + + + + + + +## Constructors + +[AppTheme](../apptheme/AppTheme/AppTheme.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + +## Static Properties + +##### [bodyText1](../apptheme/AppTheme/bodyText1.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [bodyText2](../apptheme/AppTheme/bodyText2.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [bodyText3](../apptheme/AppTheme/bodyText3.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [button](../apptheme/AppTheme/button.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [headline1](../apptheme/AppTheme/headline1.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [headline2](../apptheme/AppTheme/headline2.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [headline3](../apptheme/AppTheme/headline3.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [headline4](../apptheme/AppTheme/headline4.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [headline5](../apptheme/AppTheme/headline5.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [headline6](../apptheme/AppTheme/headline6.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [overline](../apptheme/AppTheme/overline.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [subtitle1](../apptheme/AppTheme/subtitle1.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [subtitle2](../apptheme/AppTheme/subtitle2.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + +##### [title](../apptheme/AppTheme/title.md) ↔ [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) + + + + +_read / write_ + + + + + + + + +## Constants + +##### [blackPrimary](../apptheme/AppTheme/blackPrimary-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [blackSecondary](../apptheme/AppTheme/blackSecondary-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [blackTertiary](../apptheme/AppTheme/blackTertiary-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [blue](../apptheme/AppTheme/blue-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [green](../apptheme/AppTheme/green-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [grey](../apptheme/AppTheme/grey-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [lightGrey](../apptheme/AppTheme/lightGrey-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [primary](../apptheme/AppTheme/primary-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [red](../apptheme/AppTheme/red-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [secondary](../apptheme/AppTheme/secondary-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [shadow](../apptheme/AppTheme/shadow-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [tertiary](../apptheme/AppTheme/tertiary-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [white](../apptheme/AppTheme/white-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + +##### [yellow](../apptheme/AppTheme/yellow-constant.md) const [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/AppTheme.md b/talawa-mobile-docs/apptheme/AppTheme/AppTheme.md new file mode 100644 index 000000000..4e8b04727 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/AppTheme.md @@ -0,0 +1,24 @@ + + + +# AppTheme constructor + + + + + + + +AppTheme() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/blackPrimary-constant.md b/talawa-mobile-docs/apptheme/AppTheme/blackPrimary-constant.md new file mode 100644 index 000000000..19a5f3026 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/blackPrimary-constant.md @@ -0,0 +1,32 @@ + + + +# blackPrimary constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const blackPrimary + + + + + + + + +## Implementation + +```dart +static const Color blackPrimary = Color(0xFF3E3E3E); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/blackSecondary-constant.md b/talawa-mobile-docs/apptheme/AppTheme/blackSecondary-constant.md new file mode 100644 index 000000000..df8a790e6 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/blackSecondary-constant.md @@ -0,0 +1,32 @@ + + + +# blackSecondary constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const blackSecondary + + + + + + + + +## Implementation + +```dart +static const Color blackSecondary = Color(0xFF636363); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/blackTertiary-constant.md b/talawa-mobile-docs/apptheme/AppTheme/blackTertiary-constant.md new file mode 100644 index 000000000..67e61ccee --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/blackTertiary-constant.md @@ -0,0 +1,32 @@ + + + +# blackTertiary constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const blackTertiary + + + + + + + + +## Implementation + +```dart +static const Color blackTertiary = Color(0xFFAEAEAE); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/blue-constant.md b/talawa-mobile-docs/apptheme/AppTheme/blue-constant.md new file mode 100644 index 000000000..3b83107b8 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/blue-constant.md @@ -0,0 +1,32 @@ + + + +# blue constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const blue + + + + + + + + +## Implementation + +```dart +static const Color blue = Color(0xFF2196F3); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/bodyText1.md b/talawa-mobile-docs/apptheme/AppTheme/bodyText1.md new file mode 100644 index 000000000..1319aea9a --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/bodyText1.md @@ -0,0 +1,37 @@ + + + +# bodyText1 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) bodyText1 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle bodyText1 = const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w400, + color: blackSecondary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/bodyText2.md b/talawa-mobile-docs/apptheme/AppTheme/bodyText2.md new file mode 100644 index 000000000..447738bd6 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/bodyText2.md @@ -0,0 +1,37 @@ + + + +# bodyText2 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) bodyText2 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle bodyText2 = const TextStyle( + fontSize: 8, + fontWeight: FontWeight.w400, + color: blackSecondary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/bodyText3.md b/talawa-mobile-docs/apptheme/AppTheme/bodyText3.md new file mode 100644 index 000000000..f5b908271 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/bodyText3.md @@ -0,0 +1,37 @@ + + + +# bodyText3 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) bodyText3 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle bodyText3 = const TextStyle( + fontSize: 10, + fontWeight: FontWeight.w400, + color: blackSecondary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/button.md b/talawa-mobile-docs/apptheme/AppTheme/button.md new file mode 100644 index 000000000..21a7c237e --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/button.md @@ -0,0 +1,37 @@ + + + +# button property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) button + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle button = const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: primary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/green-constant.md b/talawa-mobile-docs/apptheme/AppTheme/green-constant.md new file mode 100644 index 000000000..c5b360b4e --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/green-constant.md @@ -0,0 +1,32 @@ + + + +# green constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const green + + + + + + + + +## Implementation + +```dart +static const Color green = Color(0xFF2ACC00); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/grey-constant.md b/talawa-mobile-docs/apptheme/AppTheme/grey-constant.md new file mode 100644 index 000000000..782396813 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/grey-constant.md @@ -0,0 +1,32 @@ + + + +# grey constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const grey + + + + + + + + +## Implementation + +```dart +static const Color grey = Color(0xFFD2D2D2); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/headline1.md b/talawa-mobile-docs/apptheme/AppTheme/headline1.md new file mode 100644 index 000000000..37af53874 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/headline1.md @@ -0,0 +1,37 @@ + + + +# headline1 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) headline1 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle headline1 = const TextStyle( + fontSize: 24, + fontWeight: FontWeight.w600, + color: blackPrimary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/headline2.md b/talawa-mobile-docs/apptheme/AppTheme/headline2.md new file mode 100644 index 000000000..66e649046 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/headline2.md @@ -0,0 +1,37 @@ + + + +# headline2 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) headline2 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle headline2 = const TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: blackPrimary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/headline3.md b/talawa-mobile-docs/apptheme/AppTheme/headline3.md new file mode 100644 index 000000000..c76880892 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/headline3.md @@ -0,0 +1,37 @@ + + + +# headline3 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) headline3 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle headline3 = const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: blackPrimary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/headline4.md b/talawa-mobile-docs/apptheme/AppTheme/headline4.md new file mode 100644 index 000000000..003c36282 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/headline4.md @@ -0,0 +1,37 @@ + + + +# headline4 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) headline4 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle headline4 = const TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: blackPrimary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/headline5.md b/talawa-mobile-docs/apptheme/AppTheme/headline5.md new file mode 100644 index 000000000..ef7db3e53 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/headline5.md @@ -0,0 +1,37 @@ + + + +# headline5 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) headline5 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle headline5 = const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: blackPrimary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/headline6.md b/talawa-mobile-docs/apptheme/AppTheme/headline6.md new file mode 100644 index 000000000..2928a6d0f --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/headline6.md @@ -0,0 +1,37 @@ + + + +# headline6 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) headline6 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle headline6 = const TextStyle( + fontSize: 10, + fontWeight: FontWeight.w600, + color: blackPrimary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/lightGrey-constant.md b/talawa-mobile-docs/apptheme/AppTheme/lightGrey-constant.md new file mode 100644 index 000000000..2eb849d4d --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/lightGrey-constant.md @@ -0,0 +1,32 @@ + + + +# lightGrey constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const lightGrey + + + + + + + + +## Implementation + +```dart +static const Color lightGrey = Color(0xFFECECEC); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/overline.md b/talawa-mobile-docs/apptheme/AppTheme/overline.md new file mode 100644 index 000000000..8e21f35cf --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/overline.md @@ -0,0 +1,37 @@ + + + +# overline property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) overline + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle overline = const TextStyle( + fontSize: 6, + fontWeight: FontWeight.w400, + color: blackSecondary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/primary-constant.md b/talawa-mobile-docs/apptheme/AppTheme/primary-constant.md new file mode 100644 index 000000000..038d130c5 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/primary-constant.md @@ -0,0 +1,32 @@ + + + +# primary constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const primary + + + + + + + + +## Implementation + +```dart +static const Color primary = Color(0xFFFFC107); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/red-constant.md b/talawa-mobile-docs/apptheme/AppTheme/red-constant.md new file mode 100644 index 000000000..372e2ea7c --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/red-constant.md @@ -0,0 +1,32 @@ + + + +# red constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const red + + + + + + + + +## Implementation + +```dart +static const Color red = Color(0xFFEB5757); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/secondary-constant.md b/talawa-mobile-docs/apptheme/AppTheme/secondary-constant.md new file mode 100644 index 000000000..1f36d46c9 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/secondary-constant.md @@ -0,0 +1,32 @@ + + + +# secondary constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const secondary + + + + + + + + +## Implementation + +```dart +static const Color secondary = Color(0xFF795548); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/shadow-constant.md b/talawa-mobile-docs/apptheme/AppTheme/shadow-constant.md new file mode 100644 index 000000000..28767a56f --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/shadow-constant.md @@ -0,0 +1,32 @@ + + + +# shadow constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const shadow + + + + + + + + +## Implementation + +```dart +static const Color shadow = Color(0x408E8E8E); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/subtitle1.md b/talawa-mobile-docs/apptheme/AppTheme/subtitle1.md new file mode 100644 index 000000000..7aa5a306d --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/subtitle1.md @@ -0,0 +1,37 @@ + + + +# subtitle1 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) subtitle1 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle subtitle1 = const TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: blackSecondary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/subtitle2.md b/talawa-mobile-docs/apptheme/AppTheme/subtitle2.md new file mode 100644 index 000000000..cb3d34fad --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/subtitle2.md @@ -0,0 +1,37 @@ + + + +# subtitle2 property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) subtitle2 + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle subtitle2 = const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w500, + color: blackSecondary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/tertiary-constant.md b/talawa-mobile-docs/apptheme/AppTheme/tertiary-constant.md new file mode 100644 index 000000000..020d4a1c3 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/tertiary-constant.md @@ -0,0 +1,32 @@ + + + +# tertiary constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const tertiary + + + + + + + + +## Implementation + +```dart +static const Color tertiary = Color(0xFFA16938); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/title.md b/talawa-mobile-docs/apptheme/AppTheme/title.md new file mode 100644 index 000000000..21377023f --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/title.md @@ -0,0 +1,37 @@ + + + +# title property + + + + + + + +[TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html) title + +_read / write_ + + + + + + +## Implementation + +```dart +static TextStyle title = const TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + color: blackPrimary, + fontFamily: 'OpenSans', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/white-constant.md b/talawa-mobile-docs/apptheme/AppTheme/white-constant.md new file mode 100644 index 000000000..40ddf426a --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/white-constant.md @@ -0,0 +1,32 @@ + + + +# white constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const white + + + + + + + + +## Implementation + +```dart +static const Color white = Color(0xFFFFFFFF); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/AppTheme/yellow-constant.md b/talawa-mobile-docs/apptheme/AppTheme/yellow-constant.md new file mode 100644 index 000000000..19aedaf74 --- /dev/null +++ b/talawa-mobile-docs/apptheme/AppTheme/yellow-constant.md @@ -0,0 +1,32 @@ + + + +# yellow constant + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) const yellow + + + + + + + + +## Implementation + +```dart +static const Color yellow = Color(0xffF6BA18); +``` + + + + + + + diff --git a/talawa-mobile-docs/apptheme/apptheme-library.md b/talawa-mobile-docs/apptheme/apptheme-library.md new file mode 100644 index 000000000..c5efcd9ed --- /dev/null +++ b/talawa-mobile-docs/apptheme/apptheme-library.md @@ -0,0 +1,38 @@ + + + + +# apptheme library + + + + + + + + + + + +## Classes + +##### [AppTheme](../apptheme/AppTheme-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/categories.json b/talawa-mobile-docs/categories.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/talawa-mobile-docs/categories.json @@ -0,0 +1 @@ +[] diff --git a/talawa-mobile-docs/constants_constants/constants_constants-library.md b/talawa-mobile-docs/constants_constants/constants_constants-library.md new file mode 100644 index 000000000..0281be84b --- /dev/null +++ b/talawa-mobile-docs/constants_constants/constants_constants-library.md @@ -0,0 +1,49 @@ + + + + +# constants library + + + + + + + + + + + + + + + +## Properties + +##### [languages](../constants_constants/languages.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Language](../models_language_language_model/Language-class.md)> + + + +This file contains the prototypes of all the languages available and supported currencies. +_read / write_ + + + +##### [supportedCurrencies](../constants_constants/supportedCurrencies.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> + + + + +_read / write_ + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_constants/languages.md b/talawa-mobile-docs/constants_constants/languages.md new file mode 100644 index 000000000..eb6fa823a --- /dev/null +++ b/talawa-mobile-docs/constants_constants/languages.md @@ -0,0 +1,85 @@ + + + +# languages top-level property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Language](../models_language_language_model/Language-class.md)> languages + +_read / write_ + + + +

This file contains the prototypes of all the languages available and supported currencies.

+ + + +## Implementation + +```dart +List languages = [ + Language( + countryCode: 'US', + langCode: 'en', + langName: 'English', + langSample: 'Welcome User', + ), + Language( + countryCode: 'IN', + langCode: 'hi', + langName: 'हिंदी', + langSample: 'स्वागत उपयोगकर्ता', + ), + Language( + countryCode: 'CN', + langCode: 'zh', + langName: '中国人', + langSample: '欢迎用户', + ), + Language( + countryCode: 'FR', + langCode: 'fr', + langName: 'français', + langSample: 'Bienvenue utilisateur', + ), + Language( + countryCode: 'ES', + langCode: 'es', + langName: 'Española', + langSample: 'Bienvenida usuario', + ), + Language( + countryCode: 'JP', + langCode: 'ja', + langName: '日本', + langSample: 'ようこそユーザー', + ), + Language( + countryCode: 'GE', + langCode: 'de', + langName: 'Deutsch', + langSample: 'Willkommen Benutzer', + ), + Language( + countryCode: 'PE', + langCode: 'pt', + langName: 'português', + langSample: 'Bem-vindo, usuário', + ), +]; +``` + + + + + + + + diff --git a/talawa-mobile-docs/constants_constants/supportedCurrencies.md b/talawa-mobile-docs/constants_constants/supportedCurrencies.md new file mode 100644 index 000000000..74339c224 --- /dev/null +++ b/talawa-mobile-docs/constants_constants/supportedCurrencies.md @@ -0,0 +1,129 @@ + + + +# supportedCurrencies top-level property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> supportedCurrencies + +_read / write_ + + + + + + +## Implementation + +```dart +List supportedCurrencies = [ + 'AED', + 'ALL', + 'AMD', + 'ARS', + 'AUD', + 'AWG', + 'BBD', + 'BDT', + 'BMD', + 'BND', + 'BOB', + 'BSD', + 'BWP', + 'BZD', + 'CAD', + 'CHF', + 'CNY', + 'COP', + 'CRC', + 'CUP', + 'CZK', + 'DKK', + 'DOP', + 'DZD', + 'EGP', + 'ETB', + 'EUR', + 'FJD', + 'GBP', + 'GHS', + 'GIP', + 'GMD', + 'GTQ', + 'GYD', + 'HKD', + 'HNL', + 'HRK', + 'HTG', + 'HUF', + 'IDR', + 'ILS', + 'INR', + 'JMD', + 'KES', + 'KGS', + 'KHR', + 'KYD', + 'KZT', + 'LAK', + 'LBP', + 'LKR', + 'LRD', + 'LSL', + 'MAD', + 'MDL', + 'MKD', + 'MMK', + 'MNT', + 'MOP', + 'MUR', + 'MVR', + 'MWK', + 'MXN', + 'MYR', + 'NAD', + 'NGN', + 'NIO', + 'NOK', + 'NPR', + 'NZD', + 'PEN', + 'PGK', + 'PHP', + 'PKR', + 'QAR', + 'RUB', + 'SAR', + 'SCR', + 'SEK', + 'SGD', + 'SLL', + 'SOS', + 'SSP', + 'SVC', + 'SZL', + 'THB', + 'TTD', + 'TZS', + 'USD', + 'UYU', + 'UZS', + 'YER', + 'ZAR', +]; +``` + + + + + + + + diff --git a/talawa-mobile-docs/constants_custom_theme/TalawaTheme-class.md b/talawa-mobile-docs/constants_custom_theme/TalawaTheme-class.md new file mode 100644 index 000000000..256b87993 --- /dev/null +++ b/talawa-mobile-docs/constants_custom_theme/TalawaTheme-class.md @@ -0,0 +1,114 @@ + + + +# TalawaTheme class + + + + + + + + + +

This file contains various custom themes. +For instance, lightTheme, darkTheme, _lightTextTheme, _darkTextTheme, etc. +These are imported to other files/widgets to apply the required themes.

+ + + + +## Constructors + +[TalawaTheme](../constants_custom_theme/TalawaTheme/TalawaTheme.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + +## Static Properties + +##### [darkTheme](../constants_custom_theme/TalawaTheme/darkTheme.md) → [ThemeData](https://api.flutter.dev/flutter/material/ThemeData-class.html) + + + + +_final_ + + + +##### [lightTheme](../constants_custom_theme/TalawaTheme/lightTheme.md) → [ThemeData](https://api.flutter.dev/flutter/material/ThemeData-class.html) + + + + +_final_ + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_custom_theme/TalawaTheme/TalawaTheme.md b/talawa-mobile-docs/constants_custom_theme/TalawaTheme/TalawaTheme.md new file mode 100644 index 000000000..6e0ab5ca7 --- /dev/null +++ b/talawa-mobile-docs/constants_custom_theme/TalawaTheme/TalawaTheme.md @@ -0,0 +1,24 @@ + + + +# TalawaTheme constructor + + + + + + + +TalawaTheme() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_custom_theme/TalawaTheme/darkTheme.md b/talawa-mobile-docs/constants_custom_theme/TalawaTheme/darkTheme.md new file mode 100644 index 000000000..dba6e0b10 --- /dev/null +++ b/talawa-mobile-docs/constants_custom_theme/TalawaTheme/darkTheme.md @@ -0,0 +1,50 @@ + + + +# darkTheme property + + + + + + + +[ThemeData](https://api.flutter.dev/flutter/material/ThemeData-class.html) darkTheme + +_final_ + + + + + + +## Implementation + +```dart +static final darkTheme = ThemeData( + textSelectionTheme: const TextSelectionThemeData( + cursorColor: _darkCursorColor, + ), + scaffoldBackgroundColor: _darkScaffoldColor, + primaryColor: _darkPrimaryColor, + iconTheme: const IconThemeData( + color: _darkIconColor, + ), + fontFamily: 'product-sans', + textTheme: _darkTextTheme, + inputDecorationTheme: _darkInputDecor, + colorScheme: const ColorScheme.dark( + primaryContainer: _darkPrimaryVariantColor, + primary: _darkColorSchemePrimary, + secondary: Colors.black, + secondaryContainer: _lightScaffoldColor, + ).copyWith(secondary: _darkAccentColor), +); +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_custom_theme/TalawaTheme/lightTheme.md b/talawa-mobile-docs/constants_custom_theme/TalawaTheme/lightTheme.md new file mode 100644 index 000000000..e47787d49 --- /dev/null +++ b/talawa-mobile-docs/constants_custom_theme/TalawaTheme/lightTheme.md @@ -0,0 +1,50 @@ + + + +# lightTheme property + + + + + + + +[ThemeData](https://api.flutter.dev/flutter/material/ThemeData-class.html) lightTheme + +_final_ + + + + + + +## Implementation + +```dart +static final lightTheme = ThemeData( + scaffoldBackgroundColor: _lightScaffoldColor, + textSelectionTheme: const TextSelectionThemeData( + cursorColor: _lightCursorColor, + ), + primaryColor: _lightPrimaryColor, + iconTheme: const IconThemeData( + color: _lightIconColor, + ), + fontFamily: 'product-sans', + textTheme: _lightTextTheme, + inputDecorationTheme: _lightInputDecor, + colorScheme: const ColorScheme.light( + primaryContainer: _lightPrimaryVariantColor, + primary: _lightColorSchemePrimary, + secondary: Color(0xffF5F5F5), + secondaryContainer: _darkScaffoldColor, + ).copyWith(secondary: _lightAccentColor), +); +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_custom_theme/constants_custom_theme-library.md b/talawa-mobile-docs/constants_custom_theme/constants_custom_theme-library.md new file mode 100644 index 000000000..6c16bab5e --- /dev/null +++ b/talawa-mobile-docs/constants_custom_theme/constants_custom_theme-library.md @@ -0,0 +1,40 @@ + + + + +# custom_theme library + + + + + + + + + + + +## Classes + +##### [TalawaTheme](../constants_custom_theme/TalawaTheme-class.md) + + + +This file contains various custom themes. +For instance, lightTheme, darkTheme, _lightTextTheme, _darkTextTheme, etc. +These are imported to other files/widgets to apply the required themes. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_quick_actions/ShortCutMenu-class.md b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu-class.md new file mode 100644 index 000000000..b573a68b7 --- /dev/null +++ b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu-class.md @@ -0,0 +1,133 @@ + + + +# ShortCutMenu class + + + + + + + + + +

This file contains the shortcuts by which user can manage and interact with the +application. quick_actions package is used for this purpose.

+ + + + +## Constructors + +[ShortCutMenu](../constants_quick_actions/ShortCutMenu/ShortCutMenu.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + +## Static Properties + +##### [quickActionsList](../constants_quick_actions/ShortCutMenu/quickActionsList.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ShortcutItem](https://pub.dev/documentation/quick_actions_platform_interface/1.0.4/types_types/ShortcutItem-class.html)> + + + + +_final_ + + + + + + + + +## Constants + +##### [chatAction](../constants_quick_actions/ShortCutMenu/chatAction-constant.md) const [ShortcutItem](https://pub.dev/documentation/quick_actions_platform_interface/1.0.4/types_types/ShortcutItem-class.html) + + + + + + + + +##### [eventAction](../constants_quick_actions/ShortCutMenu/eventAction-constant.md) const [ShortcutItem](https://pub.dev/documentation/quick_actions_platform_interface/1.0.4/types_types/ShortcutItem-class.html) + + + + + + + + +##### [feedAction](../constants_quick_actions/ShortCutMenu/feedAction-constant.md) const [ShortcutItem](https://pub.dev/documentation/quick_actions_platform_interface/1.0.4/types_types/ShortcutItem-class.html) + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/ShortCutMenu.md b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/ShortCutMenu.md new file mode 100644 index 000000000..68d13d357 --- /dev/null +++ b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/ShortCutMenu.md @@ -0,0 +1,24 @@ + + + +# ShortCutMenu constructor + + + + + + + +ShortCutMenu() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/chatAction-constant.md b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/chatAction-constant.md new file mode 100644 index 000000000..2ae5a9506 --- /dev/null +++ b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/chatAction-constant.md @@ -0,0 +1,36 @@ + + + +# chatAction constant + + + + + + + +[ShortcutItem](https://pub.dev/documentation/quick_actions_platform_interface/1.0.4/types_types/ShortcutItem-class.html) const chatAction + + + + + + + + +## Implementation + +```dart +static const chatAction = ShortcutItem( + type: "chat_action", + localizedTitle: "Messages", + icon: "chat_icon", +); +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/eventAction-constant.md b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/eventAction-constant.md new file mode 100644 index 000000000..a01744fc6 --- /dev/null +++ b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/eventAction-constant.md @@ -0,0 +1,36 @@ + + + +# eventAction constant + + + + + + + +[ShortcutItem](https://pub.dev/documentation/quick_actions_platform_interface/1.0.4/types_types/ShortcutItem-class.html) const eventAction + + + + + + + + +## Implementation + +```dart +static const eventAction = ShortcutItem( + type: "events_action", + localizedTitle: "Events", + icon: "event_icon", +); +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/feedAction-constant.md b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/feedAction-constant.md new file mode 100644 index 000000000..e0417a7af --- /dev/null +++ b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/feedAction-constant.md @@ -0,0 +1,36 @@ + + + +# feedAction constant + + + + + + + +[ShortcutItem](https://pub.dev/documentation/quick_actions_platform_interface/1.0.4/types_types/ShortcutItem-class.html) const feedAction + + + + + + + + +## Implementation + +```dart +static const feedAction = ShortcutItem( + type: "feed_action", + localizedTitle: "NewsFeed", + icon: "newsfeed_icon", +); +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/quickActionsList.md b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/quickActionsList.md new file mode 100644 index 000000000..bc8848948 --- /dev/null +++ b/talawa-mobile-docs/constants_quick_actions/ShortCutMenu/quickActionsList.md @@ -0,0 +1,36 @@ + + + +# quickActionsList property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ShortcutItem](https://pub.dev/documentation/quick_actions_platform_interface/1.0.4/types_types/ShortcutItem-class.html)> quickActionsList + +_final_ + + + + + + +## Implementation + +```dart +static final quickActionsList = [ + eventAction, + feedAction, + chatAction +]; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_quick_actions/constants_quick_actions-library.md b/talawa-mobile-docs/constants_quick_actions/constants_quick_actions-library.md new file mode 100644 index 000000000..edab8824a --- /dev/null +++ b/talawa-mobile-docs/constants_quick_actions/constants_quick_actions-library.md @@ -0,0 +1,39 @@ + + + + +# quick_actions library + + + + + + + + + + + +## Classes + +##### [ShortCutMenu](../constants_quick_actions/ShortCutMenu-class.md) + + + +This file contains the shortcuts by which user can manage and interact with the +application. quick_actions package is used for this purpose. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes-class.md b/talawa-mobile-docs/constants_routing_constants/Routes-class.md new file mode 100644 index 000000000..50814616d --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes-class.md @@ -0,0 +1,382 @@ + + + +# Routes class + + + + + + + + + +

This file contains the routes. These can be used to make push screen call via Routes.splashScreen to access these string.

+ + + + +## Constructors + +[Routes](../constants_routing_constants/Routes/Routes.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [addTask](../constants_routing_constants/Routes/addTask-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [appSettings](../constants_routing_constants/Routes/appSettings-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [calendar](../constants_routing_constants/Routes/calendar-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [chatMessageScreen](../constants_routing_constants/Routes/chatMessageScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [createEventPage](../constants_routing_constants/Routes/createEventPage-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [demoPageViewRoute](../constants_routing_constants/Routes/demoPageViewRoute-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [editEventPage](../constants_routing_constants/Routes/editEventPage-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [editProfilePage](../constants_routing_constants/Routes/editProfilePage-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [editTask](../constants_routing_constants/Routes/editTask-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [eventInfoPage](../constants_routing_constants/Routes/eventInfoPage-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [eventTasks](../constants_routing_constants/Routes/eventTasks-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [exploreEventsScreen](../constants_routing_constants/Routes/exploreEventsScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [homeScreen](../constants_routing_constants/Routes/homeScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [individualPost](../constants_routing_constants/Routes/individualPost-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [joinOrg](../constants_routing_constants/Routes/joinOrg-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [languageSelectionRoute](../constants_routing_constants/Routes/languageSelectionRoute-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [loginScreen](../constants_routing_constants/Routes/loginScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [mainScreen](../constants_routing_constants/Routes/mainScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [mapScreen](../constants_routing_constants/Routes/mapScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [pinnedPostPage](../constants_routing_constants/Routes/pinnedPostPage-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [profilePage](../constants_routing_constants/Routes/profilePage-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [progressDialog](../constants_routing_constants/Routes/progressDialog-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [recoverScreen](../constants_routing_constants/Routes/recoverScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [requestAccess](../constants_routing_constants/Routes/requestAccess-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [selectContact](../constants_routing_constants/Routes/selectContact-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [selectOrgScreen](../constants_routing_constants/Routes/selectOrgScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [setUrlScreen](../constants_routing_constants/Routes/setUrlScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [signupDetailScreen](../constants_routing_constants/Routes/signupDetailScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [splashScreen](../constants_routing_constants/Routes/splashScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [updateScreen](../constants_routing_constants/Routes/updateScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [userTasks](../constants_routing_constants/Routes/userTasks-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + +##### [waitingScreen](../constants_routing_constants/Routes/waitingScreen-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +static variables. + + + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/Routes.md b/talawa-mobile-docs/constants_routing_constants/Routes/Routes.md new file mode 100644 index 000000000..94fcce69f --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/Routes.md @@ -0,0 +1,24 @@ + + + +# Routes constructor + + + + + + + +Routes() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/addTask-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/addTask-constant.md new file mode 100644 index 000000000..769130815 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/addTask-constant.md @@ -0,0 +1,33 @@ + + + +# addTask constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const addTask + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String addTask = '/addTask'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/appSettings-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/appSettings-constant.md new file mode 100644 index 000000000..055c9cc61 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/appSettings-constant.md @@ -0,0 +1,33 @@ + + + +# appSettings constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const appSettings + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String appSettings = '/appSettingsPage'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/calendar-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/calendar-constant.md new file mode 100644 index 000000000..e68f3aef8 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/calendar-constant.md @@ -0,0 +1,33 @@ + + + +# calendar constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const calendar + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String calendar = '/calendar'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/chatMessageScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/chatMessageScreen-constant.md new file mode 100644 index 000000000..143ffb1c3 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/chatMessageScreen-constant.md @@ -0,0 +1,33 @@ + + + +# chatMessageScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const chatMessageScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String chatMessageScreen = '/chatMessageScreen'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/createEventPage-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/createEventPage-constant.md new file mode 100644 index 000000000..cbc75f3c3 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/createEventPage-constant.md @@ -0,0 +1,33 @@ + + + +# createEventPage constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const createEventPage + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String createEventPage = "/createEventPage"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/demoPageViewRoute-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/demoPageViewRoute-constant.md new file mode 100644 index 000000000..4872c8cc5 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/demoPageViewRoute-constant.md @@ -0,0 +1,33 @@ + + + +# demoPageViewRoute constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const demoPageViewRoute + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String demoPageViewRoute = "/demoPageViewRoute"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/editEventPage-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/editEventPage-constant.md new file mode 100644 index 000000000..37189f536 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/editEventPage-constant.md @@ -0,0 +1,33 @@ + + + +# editEventPage constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const editEventPage + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String editEventPage = "/editEventPage"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/editProfilePage-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/editProfilePage-constant.md new file mode 100644 index 000000000..eeb2fae24 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/editProfilePage-constant.md @@ -0,0 +1,33 @@ + + + +# editProfilePage constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const editProfilePage + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String editProfilePage = "/editProfilePage"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/editTask-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/editTask-constant.md new file mode 100644 index 000000000..8dce26712 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/editTask-constant.md @@ -0,0 +1,33 @@ + + + +# editTask constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const editTask + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String editTask = '/editTask'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/eventInfoPage-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/eventInfoPage-constant.md new file mode 100644 index 000000000..d40a818cc --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/eventInfoPage-constant.md @@ -0,0 +1,33 @@ + + + +# eventInfoPage constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const eventInfoPage + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String eventInfoPage = "/eventInfo"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/eventTasks-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/eventTasks-constant.md new file mode 100644 index 000000000..5f1ae4565 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/eventTasks-constant.md @@ -0,0 +1,33 @@ + + + +# eventTasks constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const eventTasks + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String eventTasks = '/event_tasks'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/exploreEventsScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/exploreEventsScreen-constant.md new file mode 100644 index 000000000..49d7f4b78 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/exploreEventsScreen-constant.md @@ -0,0 +1,33 @@ + + + +# exploreEventsScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const exploreEventsScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String exploreEventsScreen = "/exploreEvents"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/homeScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/homeScreen-constant.md new file mode 100644 index 000000000..2e5038d9b --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/homeScreen-constant.md @@ -0,0 +1,33 @@ + + + +# homeScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const homeScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String homeScreen = "/homeScreen"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/individualPost-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/individualPost-constant.md new file mode 100644 index 000000000..8e90b10af --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/individualPost-constant.md @@ -0,0 +1,33 @@ + + + +# individualPost constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const individualPost + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String individualPost = "/individualPost"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/joinOrg-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/joinOrg-constant.md new file mode 100644 index 000000000..b15ae1443 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/joinOrg-constant.md @@ -0,0 +1,33 @@ + + + +# joinOrg constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const joinOrg + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String joinOrg = '/joinOrg'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/languageSelectionRoute-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/languageSelectionRoute-constant.md new file mode 100644 index 000000000..c44d80fa2 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/languageSelectionRoute-constant.md @@ -0,0 +1,33 @@ + + + +# languageSelectionRoute constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const languageSelectionRoute + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String languageSelectionRoute = "/selectLang"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/loginScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/loginScreen-constant.md new file mode 100644 index 000000000..8fec21cdf --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/loginScreen-constant.md @@ -0,0 +1,33 @@ + + + +# loginScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const loginScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String loginScreen = "/login"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/mainScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/mainScreen-constant.md new file mode 100644 index 000000000..ea0792a53 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/mainScreen-constant.md @@ -0,0 +1,33 @@ + + + +# mainScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const mainScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String mainScreen = "/mainScreen"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/mapScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/mapScreen-constant.md new file mode 100644 index 000000000..b4e93a646 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/mapScreen-constant.md @@ -0,0 +1,33 @@ + + + +# mapScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const mapScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String mapScreen = '/mapScreen'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/pinnedPostPage-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/pinnedPostPage-constant.md new file mode 100644 index 000000000..c818d6e26 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/pinnedPostPage-constant.md @@ -0,0 +1,33 @@ + + + +# pinnedPostPage constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const pinnedPostPage + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String pinnedPostPage = "/pinnedPostPage"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/profilePage-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/profilePage-constant.md new file mode 100644 index 000000000..c81e48b56 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/profilePage-constant.md @@ -0,0 +1,33 @@ + + + +# profilePage constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const profilePage + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String profilePage = "/profilePage"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/progressDialog-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/progressDialog-constant.md new file mode 100644 index 000000000..9b8fc0437 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/progressDialog-constant.md @@ -0,0 +1,33 @@ + + + +# progressDialog constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const progressDialog + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String progressDialog = "/progress"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/recoverScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/recoverScreen-constant.md new file mode 100644 index 000000000..ec709fd38 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/recoverScreen-constant.md @@ -0,0 +1,33 @@ + + + +# recoverScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const recoverScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String recoverScreen = "/recover"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/requestAccess-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/requestAccess-constant.md new file mode 100644 index 000000000..1107d1e0b --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/requestAccess-constant.md @@ -0,0 +1,33 @@ + + + +# requestAccess constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const requestAccess + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String requestAccess = '/requestAccess'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/selectContact-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/selectContact-constant.md new file mode 100644 index 000000000..7f8f9c69e --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/selectContact-constant.md @@ -0,0 +1,33 @@ + + + +# selectContact constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const selectContact + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String selectContact = '/selectContact'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/selectOrgScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/selectOrgScreen-constant.md new file mode 100644 index 000000000..23c3b5949 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/selectOrgScreen-constant.md @@ -0,0 +1,33 @@ + + + +# selectOrgScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const selectOrgScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String selectOrgScreen = "/selectOrg"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/setUrlScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/setUrlScreen-constant.md new file mode 100644 index 000000000..e3231e3ac --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/setUrlScreen-constant.md @@ -0,0 +1,33 @@ + + + +# setUrlScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const setUrlScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String setUrlScreen = "/setUrl"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/signupDetailScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/signupDetailScreen-constant.md new file mode 100644 index 000000000..1d2c87467 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/signupDetailScreen-constant.md @@ -0,0 +1,33 @@ + + + +# signupDetailScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const signupDetailScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String signupDetailScreen = "/signupDetails"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/splashScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/splashScreen-constant.md new file mode 100644 index 000000000..b2fdcfbfa --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/splashScreen-constant.md @@ -0,0 +1,33 @@ + + + +# splashScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const splashScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String splashScreen = "/"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/updateScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/updateScreen-constant.md new file mode 100644 index 000000000..5264a460f --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/updateScreen-constant.md @@ -0,0 +1,33 @@ + + + +# updateScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const updateScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String updateScreen = "/update"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/userTasks-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/userTasks-constant.md new file mode 100644 index 000000000..13241dbaf --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/userTasks-constant.md @@ -0,0 +1,33 @@ + + + +# userTasks constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const userTasks + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String userTasks = '/user_tasks'; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/Routes/waitingScreen-constant.md b/talawa-mobile-docs/constants_routing_constants/Routes/waitingScreen-constant.md new file mode 100644 index 000000000..14dea52eb --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/Routes/waitingScreen-constant.md @@ -0,0 +1,33 @@ + + + +# waitingScreen constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const waitingScreen + + + + + +

static variables.

+ + + +## Implementation + +```dart +static const String waitingScreen = "/waiting"; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_routing_constants/constants_routing_constants-library.md b/talawa-mobile-docs/constants_routing_constants/constants_routing_constants-library.md new file mode 100644 index 000000000..f0958e272 --- /dev/null +++ b/talawa-mobile-docs/constants_routing_constants/constants_routing_constants-library.md @@ -0,0 +1,38 @@ + + + + +# routing_constants library + + + + + + + + + + + +## Classes + +##### [Routes](../constants_routing_constants/Routes-class.md) + + + +This file contains the routes. These can be used to make push screen call via Routes.splashScreen to access these string. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_timeout/TimeOuts-class.md b/talawa-mobile-docs/constants_timeout/TimeOuts-class.md new file mode 100644 index 000000000..b85d9801e --- /dev/null +++ b/talawa-mobile-docs/constants_timeout/TimeOuts-class.md @@ -0,0 +1,121 @@ + + + +# TimeOuts class + + + + + + + + + +

Class to define constant timeout to bring consistency in the code.

+ + + + +## Constructors + +[TimeOuts](../constants_timeout/TimeOuts/TimeOuts.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [large](../constants_timeout/TimeOuts/large-constant.md) const [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +For large timeout, used for large data fetch. + + + + +##### [mediums](../constants_timeout/TimeOuts/mediums-constant.md) const [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +For medium timeout, used for medium data fetch. + + + + +##### [small](../constants_timeout/TimeOuts/small-constant.md) const [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +For small timeout, used for small data fetch. + + + + + + + + + diff --git a/talawa-mobile-docs/constants_timeout/TimeOuts/TimeOuts.md b/talawa-mobile-docs/constants_timeout/TimeOuts/TimeOuts.md new file mode 100644 index 000000000..75d16c8cb --- /dev/null +++ b/talawa-mobile-docs/constants_timeout/TimeOuts/TimeOuts.md @@ -0,0 +1,24 @@ + + + +# TimeOuts constructor + + + + + + + +TimeOuts() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/constants_timeout/TimeOuts/large-constant.md b/talawa-mobile-docs/constants_timeout/TimeOuts/large-constant.md new file mode 100644 index 000000000..06ea1ae78 --- /dev/null +++ b/talawa-mobile-docs/constants_timeout/TimeOuts/large-constant.md @@ -0,0 +1,33 @@ + + + +# large constant + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) const large + + + + + +

For large timeout, used for large data fetch.

+ + + +## Implementation + +```dart +static const large = 300; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_timeout/TimeOuts/mediums-constant.md b/talawa-mobile-docs/constants_timeout/TimeOuts/mediums-constant.md new file mode 100644 index 000000000..c481d6b87 --- /dev/null +++ b/talawa-mobile-docs/constants_timeout/TimeOuts/mediums-constant.md @@ -0,0 +1,33 @@ + + + +# mediums constant + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) const mediums + + + + + +

For medium timeout, used for medium data fetch.

+ + + +## Implementation + +```dart +static const mediums = 100; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_timeout/TimeOuts/small-constant.md b/talawa-mobile-docs/constants_timeout/TimeOuts/small-constant.md new file mode 100644 index 000000000..3fce2b606 --- /dev/null +++ b/talawa-mobile-docs/constants_timeout/TimeOuts/small-constant.md @@ -0,0 +1,33 @@ + + + +# small constant + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) const small + + + + + +

For small timeout, used for small data fetch.

+ + + +## Implementation + +```dart +static const small = 5; +``` + + + + + + + diff --git a/talawa-mobile-docs/constants_timeout/constants_timeout-library.md b/talawa-mobile-docs/constants_timeout/constants_timeout-library.md new file mode 100644 index 000000000..68fa60665 --- /dev/null +++ b/talawa-mobile-docs/constants_timeout/constants_timeout-library.md @@ -0,0 +1,38 @@ + + + + +# timeout library + + + + + + + + + + + +## Classes + +##### [TimeOuts](../constants_timeout/TimeOuts-class.md) + + + +Class to define constant timeout to bring consistency in the code. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon-class.md b/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon-class.md new file mode 100644 index 000000000..a05ca02ba --- /dev/null +++ b/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon-class.md @@ -0,0 +1,183 @@ + + + +# LanguageIcon class + + + + + + + + + +

This class draws the language icon using custom paint. +CustomPaint is a widget from the Flutter SDK, which enables +you to use a canvas to draw different shapes.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Listenable](https://api.flutter.dev/flutter/foundation/Listenable-class.html) +- [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) +- LanguageIcon + + + + + + + + +## Constructors + +[LanguageIcon](../custom_painters_language_icon/LanguageIcon/LanguageIcon.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [semanticsBuilder](https://api.flutter.dev/flutter/rendering/CustomPainter/semanticsBuilder.html) → [SemanticsBuilderCallback](https://api.flutter.dev/flutter/rendering/SemanticsBuilderCallback.html)? + + + +Returns a function that builds semantic information for the picture drawn +by this painter. +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/rendering/CustomPainter/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be notified when it is time to repaint. +_inherited_ + + + +##### [hitTest](https://api.flutter.dev/flutter/rendering/CustomPainter/hitTest.html)([Offset](https://api.flutter.dev/flutter/dart-ui/Offset-class.html) position) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + +Called whenever a hit test is being performed on an object that is using +this custom paint delegate. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [paint](../custom_painters_language_icon/LanguageIcon/paint.md)([Canvas](https://api.flutter.dev/flutter/dart-ui/Canvas-class.html) canvas, [Size](https://api.flutter.dev/flutter/dart-ui/Size-class.html) size) void + + + +Called whenever the object needs to paint. The given
Canvas has its +coordinate space configured such that the origin is at the top left of the +box. The area of the box is the size of the size argument. +_override_ + + + +##### [removeListener](https://api.flutter.dev/flutter/rendering/CustomPainter/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that the +object notifies when it is time to repaint. +_inherited_ + + + +##### [shouldRebuildSemantics](https://api.flutter.dev/flutter/rendering/CustomPainter/shouldRebuildSemantics.html)(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former). +_inherited_ + + + +##### [shouldRepaint](../custom_painters_language_icon/LanguageIcon/shouldRepaint.md)(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former). +_override_ + + + +##### [toString](https://api.flutter.dev/flutter/rendering/CustomPainter/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/LanguageIcon.md b/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/LanguageIcon.md new file mode 100644 index 000000000..65d824c57 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/LanguageIcon.md @@ -0,0 +1,24 @@ + + + +# LanguageIcon constructor + + + + + + + +LanguageIcon() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/paint.md b/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/paint.md new file mode 100644 index 000000000..ef9042c71 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/paint.md @@ -0,0 +1,382 @@ + + + +# paint method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void paint +([Canvas](https://api.flutter.dev/flutter/dart-ui/Canvas-class.html) canvas, [Size](https://api.flutter.dev/flutter/dart-ui/Size-class.html) size) + +_override_ + + + +

Called whenever the object needs to paint. The given Canvas has its +coordinate space configured such that the origin is at the top left of the +box. The area of the box is the size of the size argument.

+

Paint operations should remain inside the given area. Graphical +operations outside the bounds may be silently ignored, clipped, or not +clipped. It may sometimes be difficult to guarantee that a certain +operation is inside the bounds (e.g., drawing a rectangle whose size is +determined by user inputs). In that case, consider calling +Canvas.clipRect at the beginning of paint so everything that follows +will be guaranteed to only draw within the clipped area.

+

Implementations should be wary of correctly pairing any calls to +Canvas.save/Canvas.saveLayer and Canvas.restore, otherwise all +subsequent painting on this canvas may be affected, with potentially +hilarious but confusing results.

+

To paint text on a Canvas, use a TextPainter.

+

To paint an image on a Canvas:

+
    +
  1. +

    Obtain an ImageStream, for example by calling ImageProvider.resolve +on an AssetImage or NetworkImage object.

    +
  2. +
  3. +

    Whenever the ImageStream's underlying ImageInfo object changes +(see ImageStream.addListener), create a new instance of your custom +paint delegate, giving it the new ImageInfo object.

    +
  4. +
  5. +

    In your delegate's paint method, call the Canvas.drawImage, +Canvas.drawImageRect, or Canvas.drawImageNine methods to paint the +ImageInfo.image object, applying the ImageInfo.scale value to +obtain the correct rendering size.

    +
  6. +
+ + + +## Implementation + +```dart +@override +void paint(Canvas canvas, Size size) { + final Path path_0 = Path(); + path_0.moveTo(size.width * 0.2376568, size.height * 0.4381250); + path_0.cubicTo( + size.width * 0.2321886, + size.height * 0.4003127, + size.width * 0.2254689, + size.height * 0.3343750, + size.width * 0.2254689, + size.height * 0.3343750, + ); + path_0.lineTo(size.width * 0.2246875, size.height * 0.3343750); + path_0.cubicTo( + size.width * 0.2246875, + size.height * 0.3343750, + size.width * 0.2179686, + size.height * 0.4003127, + size.width * 0.2125000, + size.height * 0.4381250, + ); + path_0.lineTo(size.width * 0.1951561, size.height * 0.5553136); + path_0.lineTo(size.width * 0.2546886, size.height * 0.5553136); + path_0.lineTo(size.width * 0.2376568, size.height * 0.4381250); + path_0.close(); + path_0.moveTo(size.width * 0.9625000, 0); + path_0.lineTo(size.width * 0.5250000, 0); + path_0.lineTo(size.width * 0.5250000, size.height); + path_0.lineTo(size.width * 0.9625000, size.height); + path_0.cubicTo( + size.width * 0.9832818, + size.height, + size.width, + size.height * 0.9665636, + size.width, + size.height * 0.9250000, + ); + path_0.lineTo(size.width, size.height * 0.07500000); + path_0.cubicTo( + size.width, + size.height * 0.03343750, + size.width * 0.9832818, + 0, + size.width * 0.9625000, + 0, + ); + path_0.close(); + path_0.moveTo(size.width * 0.9250000, size.height * 0.3750000); + path_0.cubicTo( + size.width * 0.9250000, + size.height * 0.3956250, + size.width * 0.9165636, + size.height * 0.4125000, + size.width * 0.9062500, + size.height * 0.4125000, + ); + path_0.lineTo(size.width * 0.8884364, size.height * 0.4125000); + path_0.cubicTo( + size.width * 0.8776568, + size.height * 0.4862500, + size.width * 0.8545318, + size.height * 0.5606227, + size.width * 0.8217182, + size.height * 0.6309364, + ); + path_0.cubicTo( + size.width * 0.8348432, + size.height * 0.6509364, + size.width * 0.8484364, + size.height * 0.6700000, + size.width * 0.8625000, + size.height * 0.6871864, + ); + path_0.cubicTo( + size.width * 0.8710932, + size.height * 0.6978136, + size.width * 0.8739068, + size.height * 0.7200000, + size.width * 0.8689068, + size.height * 0.7378136, + ); + path_0.lineTo(size.width * 0.8565636, size.height * 0.7812500); + path_0.cubicTo( + size.width * 0.8512500, + size.height * 0.7996864, + size.width * 0.8395318, + size.height * 0.8056227, + size.width * 0.8304682, + size.height * 0.7946864, + ); + path_0.cubicTo( + size.width * 0.8107818, + size.height * 0.7703136, + size.width * 0.7921886, + size.height * 0.7443727, + size.width * 0.7751568, + size.height * 0.7168727, + ); + path_0.cubicTo( + size.width * 0.7581250, + size.height * 0.7440636, + size.width * 0.7396886, + size.height * 0.7703136, + size.width * 0.7198432, + size.height * 0.7946864, + ); + path_0.cubicTo( + size.width * 0.7107818, + size.height * 0.8056227, + size.width * 0.6990636, + size.height * 0.7996864, + size.width * 0.6937500, + size.height * 0.7812500, + ); + path_0.lineTo(size.width * 0.6814068, size.height * 0.7378136); + path_0.cubicTo( + size.width * 0.6764068, + size.height * 0.7203136, + size.width * 0.6792182, + size.height * 0.6978136, + size.width * 0.6879682, + size.height * 0.6871864, + ); + path_0.cubicTo( + size.width * 0.7025000, + size.height * 0.6693727, + size.width * 0.7160932, + size.height * 0.6506273, + size.width * 0.7287500, + size.height * 0.6309364, + ); + path_0.cubicTo( + size.width * 0.7164068, + size.height * 0.6046864, + size.width * 0.7054682, + size.height * 0.5778136, + size.width * 0.6959386, + size.height * 0.5506273, + ); + path_0.cubicTo( + size.width * 0.6896886, + size.height * 0.5328136, + size.width * 0.6925000, + size.height * 0.5081273, + size.width * 0.7017182, + size.height * 0.4971864, + ); + path_0.lineTo(size.width * 0.7118750, size.height * 0.4850000); + path_0.lineTo(size.width * 0.7232818, size.height * 0.4715636); + path_0.cubicTo( + size.width * 0.7317182, + size.height * 0.4615636, + size.width * 0.7426568, + size.height * 0.4662500, + size.width * 0.7482818, + size.height * 0.4821864, + ); + path_0.cubicTo( + size.width * 0.7560932, + size.height * 0.5040636, + size.width * 0.7651568, + size.height * 0.5259364, + size.width * 0.7754682, + size.height * 0.5475000, + ); + path_0.cubicTo( + size.width * 0.7965614, + size.height * 0.5031273, + size.width * 0.8126568, + size.height * 0.4571864, + size.width * 0.8223432, + size.height * 0.4125000, + ); + path_0.lineTo(size.width * 0.6437500, size.height * 0.4125000); + path_0.cubicTo( + size.width * 0.6334386, + size.height * 0.4125000, + size.width * 0.6250000, + size.height * 0.3956250, + size.width * 0.6250000, + size.height * 0.3750000, + ); + path_0.lineTo(size.width * 0.6250000, size.height * 0.3250000); + path_0.cubicTo( + size.width * 0.6250000, + size.height * 0.3043750, + size.width * 0.6334386, + size.height * 0.2875000, + size.width * 0.6437500, + size.height * 0.2875000, + ); + path_0.lineTo(size.width * 0.7437500, size.height * 0.2875000); + path_0.lineTo(size.width * 0.7437500, size.height * 0.2375000); + path_0.cubicTo( + size.width * 0.7437500, + size.height * 0.2168750, + size.width * 0.7521886, + size.height * 0.2000000, + size.width * 0.7625000, + size.height * 0.2000000, + ); + path_0.lineTo(size.width * 0.7875000, size.height * 0.2000000); + path_0.cubicTo( + size.width * 0.7978136, + size.height * 0.2000000, + size.width * 0.8062500, + size.height * 0.2168750, + size.width * 0.8062500, + size.height * 0.2375000, + ); + path_0.lineTo(size.width * 0.8062500, size.height * 0.2875000); + path_0.lineTo(size.width * 0.9062500, size.height * 0.2875000); + path_0.cubicTo( + size.width * 0.9165636, + size.height * 0.2875000, + size.width * 0.9250000, + size.height * 0.3043750, + size.width * 0.9250000, + size.height * 0.3250000, + ); + path_0.lineTo(size.width * 0.9250000, size.height * 0.3750000); + path_0.close(); + path_0.moveTo(0, size.height * 0.07500000); + path_0.lineTo(0, size.height * 0.9250000); + path_0.cubicTo( + 0, + size.height * 0.9665636, + size.width * 0.01671875, + size.height, + size.width * 0.03750000, + size.height, + ); + path_0.lineTo(size.width * 0.4750000, size.height); + path_0.lineTo(size.width * 0.4750000, 0); + path_0.lineTo(size.width * 0.03750000, 0); + path_0.cubicTo( + size.width * 0.01671875, + 0, + 0, + size.height * 0.03343750, + 0, + size.height * 0.07500000, + ); + path_0.close(); + path_0.moveTo(size.width * 0.09203136, size.height * 0.7503136); + path_0.lineTo(size.width * 0.1818750, size.height * 0.2218750); + path_0.cubicTo( + size.width * 0.1845314, + size.height * 0.2065623, + size.width * 0.1915625, + size.height * 0.1965623, + size.width * 0.1996875, + size.height * 0.1965623, + ); + path_0.lineTo(size.width * 0.2504682, size.height * 0.1965623); + path_0.cubicTo( + size.width * 0.2584386, + size.height * 0.1965623, + size.width * 0.2656250, + size.height * 0.2068750, + size.width * 0.2682818, + size.height * 0.2218750, + ); + path_0.lineTo(size.width * 0.3581250, size.height * 0.7503136); + path_0.cubicTo( + size.width * 0.3621864, + size.height * 0.7746864, + size.width * 0.3532818, + size.height * 0.8000000, + size.width * 0.3403136, + size.height * 0.8000000, + ); + path_0.lineTo(size.width * 0.3045318, size.height * 0.8000000); + path_0.cubicTo( + size.width * 0.3004886, + size.height * 0.7999955, + size.width * 0.2965523, + size.height * 0.7973727, + size.width * 0.2933159, + size.height * 0.7925318, + ); + path_0.cubicTo( + size.width * 0.2900773, + size.height * 0.7876864, + size.width * 0.2877091, + size.height * 0.7808818, + size.width * 0.2865614, + size.height * 0.7731227, + ); + path_0.lineTo(size.width * 0.2718750, size.height * 0.6734364); + path_0.lineTo(size.width * 0.1778125, size.height * 0.6734364); + path_0.lineTo(size.width * 0.1635936, size.height * 0.7728136); + path_0.cubicTo( + size.width * 0.1612500, + size.height * 0.7887500, + size.width * 0.1539061, + size.height * 0.8000000, + size.width * 0.1456250, + size.height * 0.8000000, + ); + path_0.lineTo(size.width * 0.1098439, size.height * 0.8000000); + path_0.cubicTo( + size.width * 0.09703136, + size.height * 0.8000000, + size.width * 0.08796886, + size.height * 0.7746864, + size.width * 0.09203136, + size.height * 0.7503136, + ); + path_0.close(); + + final Paint paint0fill = Paint()..style = PaintingStyle.fill; + paint0fill.color = const Color(0xff737373).withOpacity(1.0); + canvas.drawPath(path_0, paint0fill); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/shouldRepaint.md b/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/shouldRepaint.md new file mode 100644 index 000000000..a74a9cec4 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_language_icon/LanguageIcon/shouldRepaint.md @@ -0,0 +1,58 @@ + + + +# shouldRepaint method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) shouldRepaint +(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) + +_override_ + + + +

Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former).

+

If the new instance represents different information than the old +instance, then the method should return true, otherwise it should return +false.

+

If the method returns false, then the paint call might be optimized +away.

+

It's possible that the paint method will get called even if +shouldRepaint returns false (e.g. if an ancestor or descendant needed to +be repainted). It's also possible that the paint method will get called +without shouldRepaint being called at all (e.g. if the box changes +size).

+

If a custom delegate has a particularly expensive paint function such that +repaints should be avoided as much as possible, a RepaintBoundary or +RenderRepaintBoundary (or other render object with +RenderObject.isRepaintBoundary set to true) might be helpful.

+

The oldDelegate argument will never be null.

+ + + +## Implementation + +```dart +@override +bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_language_icon/custom_painters_language_icon-library.md b/talawa-mobile-docs/custom_painters_language_icon/custom_painters_language_icon-library.md new file mode 100644 index 000000000..f987bcce8 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_language_icon/custom_painters_language_icon-library.md @@ -0,0 +1,40 @@ + + + + +# language_icon library + + + + + + + + + + + +## Classes + +##### [LanguageIcon](../custom_painters_language_icon/LanguageIcon-class.md) + + + +This class draws the language icon using custom paint. +CustomPaint is a widget from the Flutter SDK, which enables +you to use a canvas to draw different shapes. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo-class.md b/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo-class.md new file mode 100644 index 000000000..baaa311d6 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo-class.md @@ -0,0 +1,183 @@ + + + +# AppLogo class + + + + + + + + + +

This class draws the app logo using custom paint. +CustomPaint is a widget from the Flutter SDK, which enables +you to use a canvas to draw different shapes.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Listenable](https://api.flutter.dev/flutter/foundation/Listenable-class.html) +- [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) +- AppLogo + + + + + + + + +## Constructors + +[AppLogo](../custom_painters_talawa_logo/AppLogo/AppLogo.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [semanticsBuilder](https://api.flutter.dev/flutter/rendering/CustomPainter/semanticsBuilder.html) → [SemanticsBuilderCallback](https://api.flutter.dev/flutter/rendering/SemanticsBuilderCallback.html)? + + + +Returns a function that builds semantic information for the picture drawn +by this painter. +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/rendering/CustomPainter/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be notified when it is time to repaint. +_inherited_ + + + +##### [hitTest](https://api.flutter.dev/flutter/rendering/CustomPainter/hitTest.html)([Offset](https://api.flutter.dev/flutter/dart-ui/Offset-class.html) position) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + +Called whenever a hit test is being performed on an object that is using +this custom paint delegate. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [paint](../custom_painters_talawa_logo/AppLogo/paint.md)([Canvas](https://api.flutter.dev/flutter/dart-ui/Canvas-class.html) canvas, [Size](https://api.flutter.dev/flutter/dart-ui/Size-class.html) size) void + + + +Called whenever the object needs to paint. The given Canvas has its +coordinate space configured such that the origin is at the top left of the +box. The area of the box is the size of the size argument. +_override_ + + + +##### [removeListener](https://api.flutter.dev/flutter/rendering/CustomPainter/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that the +object notifies when it is time to repaint. +_inherited_ + + + +##### [shouldRebuildSemantics](https://api.flutter.dev/flutter/rendering/CustomPainter/shouldRebuildSemantics.html)(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former). +_inherited_ + + + +##### [shouldRepaint](../custom_painters_talawa_logo/AppLogo/shouldRepaint.md)(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former). +_override_ + + + +##### [toString](https://api.flutter.dev/flutter/rendering/CustomPainter/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/AppLogo.md b/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/AppLogo.md new file mode 100644 index 000000000..8dad793f7 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/AppLogo.md @@ -0,0 +1,24 @@ + + + +# AppLogo constructor + + + + + + + +AppLogo() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/paint.md b/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/paint.md new file mode 100644 index 000000000..0dc5d6056 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/paint.md @@ -0,0 +1,485 @@ + + + +# paint method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void paint +([Canvas](https://api.flutter.dev/flutter/dart-ui/Canvas-class.html) canvas, [Size](https://api.flutter.dev/flutter/dart-ui/Size-class.html) size) + +_override_ + + + +

Called whenever the object needs to paint. The given Canvas has its +coordinate space configured such that the origin is at the top left of the +box. The area of the box is the size of the size argument.

+

Paint operations should remain inside the given area. Graphical +operations outside the bounds may be silently ignored, clipped, or not +clipped. It may sometimes be difficult to guarantee that a certain +operation is inside the bounds (e.g., drawing a rectangle whose size is +determined by user inputs). In that case, consider calling +Canvas.clipRect at the beginning of paint so everything that follows +will be guaranteed to only draw within the clipped area.

+

Implementations should be wary of correctly pairing any calls to +Canvas.save/Canvas.saveLayer and Canvas.restore, otherwise all +subsequent painting on this canvas may be affected, with potentially +hilarious but confusing results.

+

To paint text on a Canvas, use a TextPainter.

+

To paint an image on a Canvas:

+
    +
  1. +

    Obtain an ImageStream, for example by calling ImageProvider.resolve +on an AssetImage or NetworkImage object.

    +
  2. +
  3. +

    Whenever the ImageStream's underlying ImageInfo object changes +(see ImageStream.addListener), create a new instance of your custom +paint delegate, giving it the new ImageInfo object.

    +
  4. +
  5. +

    In your delegate's paint method, call the Canvas.drawImage, +Canvas.drawImageRect, or Canvas.drawImageNine methods to paint the +ImageInfo.image object, applying the ImageInfo.scale value to +obtain the correct rendering size.

    +
  6. +
+ + + +## Implementation + +```dart +@override +void paint(Canvas canvas, Size size) { + final Path path_0 = Path(); + path_0.moveTo(size.width * 0.6581984, size.height * 0.6200040); + path_0.cubicTo( + size.width * 0.6951984, + size.height * 0.6792024, + size.width * 0.7321984, + size.height * 0.7386032, + size.width * 0.7695992, + size.height * 0.7978016, + ); + path_0.cubicTo( + size.width * 0.7737976, + size.height * 0.8044008, + size.width * 0.7730000, + size.height * 0.8070040, + size.width * 0.7664008, + size.height * 0.8112024, + ); + path_0.cubicTo( + size.width * 0.7314008, + size.height * 0.8330040, + size.width * 0.6964008, + size.height * 0.8552024, + size.width * 0.6617976, + size.height * 0.8776032, + ); + path_0.cubicTo( + size.width * 0.6560000, + size.height * 0.8814008, + size.width * 0.6534008, + size.height * 0.8820040, + size.width * 0.6491984, + size.height * 0.8750040, + ); + path_0.cubicTo( + size.width * 0.5995992, + size.height * 0.7930040, + size.width * 0.5495992, + size.height * 0.7112024, + size.width * 0.4997976, + size.height * 0.6292024, + ); + path_0.cubicTo( + size.width * 0.4941984, + size.height * 0.6198016, + size.width * 0.4940000, + size.height * 0.6200040, + size.width * 0.4884008, + size.height * 0.6292024, + ); + path_0.cubicTo( + size.width * 0.4380000, + size.height * 0.7114008, + size.width * 0.3873992, + size.height * 0.7938016, + size.width * 0.3371992, + size.height * 0.8762024, + ); + path_0.cubicTo( + size.width * 0.3337992, + size.height * 0.8818016, + size.width * 0.3317992, + size.height * 0.8816032, + size.width * 0.3267992, + size.height * 0.8784008, + ); + path_0.cubicTo( + size.width * 0.2913992, + size.height * 0.8558016, + size.width * 0.2559992, + size.height * 0.8334008, + size.width * 0.2203992, + size.height * 0.8112024, + ); + path_0.cubicTo( + size.width * 0.2165992, + size.height * 0.8088016, + size.width * 0.2131992, + size.height * 0.8076032, + size.width * 0.2167992, + size.height * 0.8018016, + ); + path_0.cubicTo( + size.width * 0.2547992, + size.height * 0.7420040, + size.width * 0.2923992, + size.height * 0.6818016, + size.width * 0.3301992, + size.height * 0.6218016, + ); + path_0.cubicTo( + size.width * 0.3575992, + size.height * 0.5766032, + size.width * 0.3853992, + size.height * 0.5320040, + size.width * 0.4130000, + size.height * 0.4870040, + ); + path_0.cubicTo( + size.width * 0.4191984, + size.height * 0.4768016, + size.width * 0.4255992, + size.height * 0.4666032, + size.width * 0.4317976, + size.height * 0.4564008, + ); + path_0.cubicTo( + size.width * 0.4347976, + size.height * 0.4516032, + size.width * 0.4377976, + size.height * 0.4468016, + size.width * 0.4441984, + size.height * 0.4458016, + ); + path_0.cubicTo( + size.width * 0.4541984, + size.height * 0.4452024, + size.width * 0.4640000, + size.height * 0.4472024, + size.width * 0.4740000, + size.height * 0.4474008, + ); + path_0.cubicTo( + size.width * 0.4960000, + size.height * 0.4482024, + size.width * 0.5167976, + size.height * 0.4438016, + size.width * 0.5377976, + size.height * 0.4382024, + ); + path_0.cubicTo( + size.width * 0.5435992, + size.height * 0.4374008, + size.width * 0.5470000, + size.height * 0.4408016, + size.width * 0.5497976, + size.height * 0.4454008, + ); + path_0.cubicTo( + size.width * 0.5830000, + size.height * 0.5002024, + size.width * 0.6170000, + size.height * 0.5546032, + size.width * 0.6497976, + size.height * 0.6096032, + ); + path_0.cubicTo( + size.width * 0.6517976, + size.height * 0.6136032, + size.width * 0.6544008, + size.height * 0.6172024, + size.width * 0.6581984, + size.height * 0.6200040, + ); + path_0.close(); + + final Paint paint0fill = Paint()..style = PaintingStyle.fill; + paint0fill.color = const Color(0xff31BB6B).withOpacity(1.0); + canvas.drawPath(path_0, paint0fill); + + final Path path_1 = Path(); + path_1.moveTo(size.width * 0.5405992, size.height * 0.4396032); + path_1.cubicTo( + size.width * 0.5084008, + size.height * 0.4512024, + size.width * 0.4754008, + size.height * 0.4532024, + size.width * 0.4418016, + size.height * 0.4472024, + ); + path_1.cubicTo( + size.width * 0.4292024, + size.height * 0.4490000, + size.width * 0.4184008, + size.height * 0.4428016, + size.width * 0.4078016, + size.height * 0.4382024, + ); + path_1.cubicTo( + size.width * 0.3772004, + size.height * 0.4248016, + size.width * 0.3516004, + size.height * 0.4048016, + size.width * 0.3326004, + size.height * 0.3768020, + ); + path_1.cubicTo( + size.width * 0.3302004, + size.height * 0.3732020, + size.width * 0.3276004, + size.height * 0.3696020, + size.width * 0.3278004, + size.height * 0.3650020, + ); + path_1.cubicTo( + size.width * 0.3124004, + size.height * 0.3368020, + size.width * 0.3032004, + size.height * 0.3070020, + size.width * 0.3040004, + size.height * 0.2746020, + ); + path_1.cubicTo( + size.width * 0.3056004, + size.height * 0.2126020, + size.width * 0.3322004, + size.height * 0.1636020, + size.width * 0.3842004, + size.height * 0.1300020, + ); + path_1.cubicTo( + size.width * 0.4872024, + size.height * 0.06320198, + size.width * 0.6244008, + size.height * 0.1212020, + size.width * 0.6494008, + size.height * 0.2418020, + ); + path_1.cubicTo( + size.width * 0.6554008, + size.height * 0.2704020, + size.width * 0.6535992, + size.height * 0.2994020, + size.width * 0.6452024, + size.height * 0.3276020, + ); + path_1.cubicTo( + size.width * 0.6444008, + size.height * 0.3302020, + size.width * 0.6440000, + size.height * 0.3328020, + size.width * 0.6434008, + size.height * 0.3354020, + ); + path_1.cubicTo( + size.width * 0.6380000, + size.height * 0.3574020, + size.width * 0.6260000, + size.height * 0.3756020, + size.width * 0.6118016, + size.height * 0.3924020, + ); + path_1.cubicTo( + size.width * 0.5960000, + size.height * 0.4108016, + size.width * 0.5770000, + size.height * 0.4252024, + size.width * 0.5548016, + size.height * 0.4354008, + ); + path_1.cubicTo( + size.width * 0.5500000, + size.height * 0.4376032, + size.width * 0.5455992, + size.height * 0.4394008, + size.width * 0.5405992, + size.height * 0.4396032, + ); + path_1.close(); + + final Paint paint1fill = Paint()..style = PaintingStyle.fill; + paint1fill.color = const Color(0xffFEBC59).withOpacity(1.0); + canvas.drawPath(path_1, paint1fill); + + final Path path_2 = Path(); + path_2.moveTo(size.width * 0.5405992, size.height * 0.4395992); + path_2.cubicTo( + size.width * 0.5880000, + size.height * 0.4200000, + size.width * 0.6224008, + size.height * 0.3870008, + size.width * 0.6410000, + size.height * 0.3386008, + ); + path_2.cubicTo( + size.width * 0.6414008, + size.height * 0.3374008, + size.width * 0.6425992, + size.height * 0.3364008, + size.width * 0.6434008, + size.height * 0.3354008, + ); + path_2.cubicTo( + size.width * 0.6850000, + size.height * 0.4020000, + size.width * 0.7265992, + size.height * 0.4688016, + size.width * 0.7685992, + size.height * 0.5352024, + ); + path_2.cubicTo( + size.width * 0.7742024, + size.height * 0.5440000, + size.width * 0.7724008, + size.height * 0.5470000, + size.width * 0.7642024, + size.height * 0.5520000, + ); + path_2.cubicTo( + size.width * 0.7285992, + size.height * 0.5740000, + size.width * 0.6924008, + size.height * 0.5954008, + size.width * 0.6584008, + size.height * 0.6200000, + ); + path_2.cubicTo( + size.width * 0.6535992, + size.height * 0.6225992, + size.width * 0.6520000, + size.height * 0.6190000, + size.width * 0.6502024, + size.height * 0.6158016, + ); + path_2.cubicTo( + size.width * 0.6158016, + size.height * 0.5590000, + size.width * 0.5814008, + size.height * 0.5022024, + size.width * 0.5470000, + size.height * 0.4455992, + ); + path_2.cubicTo( + size.width * 0.5452024, + size.height * 0.4430000, + size.width * 0.5440000, + size.height * 0.4402024, + size.width * 0.5405992, + size.height * 0.4395992, + ); + path_2.close(); + + final Paint paint2fill = Paint()..style = PaintingStyle.fill; + paint2fill.color = const Color(0xff737373).withOpacity(1.0); + canvas.drawPath(path_2, paint2fill); + + final Path path_3 = Path(); + path_3.moveTo(size.width * 0.3277992, size.height * 0.3651976); + path_3.cubicTo( + size.width * 0.3541992, + size.height * 0.4085992, + size.width * 0.3929992, + size.height * 0.4351984, + size.width * 0.4417976, + size.height * 0.4471984, + ); + path_3.cubicTo( + size.width * 0.4287976, + size.height * 0.4623968, + size.width * 0.4197976, + size.height * 0.4803968, + size.width * 0.4094008, + size.height * 0.4973968, + ); + path_3.cubicTo( + size.width * 0.3847992, + size.height * 0.5373968, + size.width * 0.3591992, + size.height * 0.5765992, + size.width * 0.3361992, + size.height * 0.6173968, + ); + path_3.cubicTo( + size.width * 0.3347992, + size.height * 0.6197976, + size.width * 0.3333992, + size.height * 0.6219960, + size.width * 0.3301992, + size.height * 0.6215992, + ); + path_3.cubicTo( + size.width * 0.3235992, + size.height * 0.6143968, + size.width * 0.3149992, + size.height * 0.6097976, + size.width * 0.3069992, + size.height * 0.6045992, + ); + path_3.cubicTo( + size.width * 0.2783992, + size.height * 0.5863968, + size.width * 0.2493992, + size.height * 0.5685992, + size.width * 0.2205992, + size.height * 0.5507976, + ); + path_3.cubicTo( + size.width * 0.2163992, + size.height * 0.5481984, + size.width * 0.2131992, + size.height * 0.5465992, + size.width * 0.2169992, + size.height * 0.5403968, + ); + path_3.cubicTo( + size.width * 0.2535992, + size.height * 0.4825992, + size.width * 0.2899992, + size.height * 0.4243968, + size.width * 0.3263992, + size.height * 0.3663976, + ); + path_3.cubicTo( + size.width * 0.3265992, + size.height * 0.3659976, + size.width * 0.3271992, + size.height * 0.3655976, + size.width * 0.3277992, + size.height * 0.3651976, + ); + path_3.close(); + + final Paint paint3fill = Paint()..style = PaintingStyle.fill; + paint3fill.color = const Color(0xff737373).withOpacity(1.0); + canvas.drawPath(path_3, paint3fill); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/shouldRepaint.md b/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/shouldRepaint.md new file mode 100644 index 000000000..bbd772e40 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_talawa_logo/AppLogo/shouldRepaint.md @@ -0,0 +1,58 @@ + + + +# shouldRepaint method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) shouldRepaint +(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) + +_override_ + + + +

Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former).

+

If the new instance represents different information than the old +instance, then the method should return true, otherwise it should return +false.

+

If the method returns false, then the paint call might be optimized +away.

+

It's possible that the paint method will get called even if +shouldRepaint returns false (e.g. if an ancestor or descendant needed to +be repainted). It's also possible that the paint method will get called +without shouldRepaint being called at all (e.g. if the box changes +size).

+

If a custom delegate has a particularly expensive paint function such that +repaints should be avoided as much as possible, a RepaintBoundary or +RenderRepaintBoundary (or other render object with +RenderObject.isRepaintBoundary set to true) might be helpful.

+

The oldDelegate argument will never be null.

+ + + +## Implementation + +```dart +@override +bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_talawa_logo/custom_painters_talawa_logo-library.md b/talawa-mobile-docs/custom_painters_talawa_logo/custom_painters_talawa_logo-library.md new file mode 100644 index 000000000..5c5e7aba1 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_talawa_logo/custom_painters_talawa_logo-library.md @@ -0,0 +1,40 @@ + + + + +# talawa_logo library + + + + + + + + + + + +## Classes + +##### [AppLogo](../custom_painters_talawa_logo/AppLogo-class.md) + + + +This class draws the app logo using custom paint. +CustomPaint is a widget from the Flutter SDK, which enables +you to use a canvas to draw different shapes. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo-class.md b/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo-class.md new file mode 100644 index 000000000..12b1a1e0a --- /dev/null +++ b/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo-class.md @@ -0,0 +1,183 @@ + + + +# TelegramLogo class + + + + + + + + + +

This class draws the telegram logo using custom paint. +CustomPaint is a widget from the Flutter SDK, which enables +you to use a canvas to draw different shapes.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Listenable](https://api.flutter.dev/flutter/foundation/Listenable-class.html) +- [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) +- TelegramLogo + + + + + + + + +## Constructors + +[TelegramLogo](../custom_painters_telegram_logo/TelegramLogo/TelegramLogo.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [semanticsBuilder](https://api.flutter.dev/flutter/rendering/CustomPainter/semanticsBuilder.html) → [SemanticsBuilderCallback](https://api.flutter.dev/flutter/rendering/SemanticsBuilderCallback.html)? + + + +Returns a function that builds semantic information for the picture drawn +by this painter. +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/rendering/CustomPainter/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be notified when it is time to repaint. +_inherited_ + + + +##### [hitTest](https://api.flutter.dev/flutter/rendering/CustomPainter/hitTest.html)([Offset](https://api.flutter.dev/flutter/dart-ui/Offset-class.html) position) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + +Called whenever a hit test is being performed on an object that is using +this custom paint delegate. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [paint](../custom_painters_telegram_logo/TelegramLogo/paint.md)([Canvas](https://api.flutter.dev/flutter/dart-ui/Canvas-class.html) canvas, [Size](https://api.flutter.dev/flutter/dart-ui/Size-class.html) size) void + + + +Called whenever the object needs to paint. The given Canvas has its +coordinate space configured such that the origin is at the top left of the +box. The area of the box is the size of the size argument. +_override_ + + + +##### [removeListener](https://api.flutter.dev/flutter/rendering/CustomPainter/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that the +object notifies when it is time to repaint. +_inherited_ + + + +##### [shouldRebuildSemantics](https://api.flutter.dev/flutter/rendering/CustomPainter/shouldRebuildSemantics.html)(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former). +_inherited_ + + + +##### [shouldRepaint](../custom_painters_telegram_logo/TelegramLogo/shouldRepaint.md)(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former). +_override_ + + + +##### [toString](https://api.flutter.dev/flutter/rendering/CustomPainter/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/TelegramLogo.md b/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/TelegramLogo.md new file mode 100644 index 000000000..4d5cfd037 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/TelegramLogo.md @@ -0,0 +1,24 @@ + + + +# TelegramLogo constructor + + + + + + + +TelegramLogo() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/paint.md b/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/paint.md new file mode 100644 index 000000000..fdec6895d --- /dev/null +++ b/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/paint.md @@ -0,0 +1,171 @@ + + + +# paint method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void paint +([Canvas](https://api.flutter.dev/flutter/dart-ui/Canvas-class.html) canvas, [Size](https://api.flutter.dev/flutter/dart-ui/Size-class.html) size) + +_override_ + + + +

Called whenever the object needs to paint. The given Canvas has its +coordinate space configured such that the origin is at the top left of the +box. The area of the box is the size of the size argument.

+

Paint operations should remain inside the given area. Graphical +operations outside the bounds may be silently ignored, clipped, or not +clipped. It may sometimes be difficult to guarantee that a certain +operation is inside the bounds (e.g., drawing a rectangle whose size is +determined by user inputs). In that case, consider calling +Canvas.clipRect at the beginning of paint so everything that follows +will be guaranteed to only draw within the clipped area.

+

Implementations should be wary of correctly pairing any calls to +Canvas.save/Canvas.saveLayer and Canvas.restore, otherwise all +subsequent painting on this canvas may be affected, with potentially +hilarious but confusing results.

+

To paint text on a Canvas, use a TextPainter.

+

To paint an image on a Canvas:

+
    +
  1. +

    Obtain an ImageStream, for example by calling ImageProvider.resolve +on an AssetImage or NetworkImage object.

    +
  2. +
  3. +

    Whenever the ImageStream's underlying ImageInfo object changes +(see ImageStream.addListener), create a new instance of your custom +paint delegate, giving it the new ImageInfo object.

    +
  4. +
  5. +

    In your delegate's paint method, call the Canvas.drawImage, +Canvas.drawImageRect, or Canvas.drawImageNine methods to paint the +ImageInfo.image object, applying the ImageInfo.scale value to +obtain the correct rendering size.

    +
  6. +
+ + + +## Implementation + +```dart +@override +void paint(Canvas canvas, Size size) { + final Paint paint0Fill = Paint()..style = PaintingStyle.fill; + paint0Fill.shader = ui.Gradient.linear( + Offset(size.width * 0.6670000, size.height * 0.1670000), + Offset(size.width * 0.4170000, size.height * 0.7500000), [ + const Color(0xff37aee2).withOpacity(1), + const Color(0xff1e96c8).withOpacity(1) + ], [ + 0, + 1 + ]); + canvas.drawCircle( + Offset(size.width * 0.5000000, size.height * 0.5000000), + size.width * 0.5000000, + paint0Fill, + ); + + final Path path_1 = Path(); + path_1.moveTo(size.width * 0.4083333, size.height * 0.7291667); + path_1.cubicTo( + size.width * 0.3921333, + size.height * 0.7291667, + size.width * 0.3948875, + size.height * 0.7230500, + size.width * 0.3893000, + size.height * 0.7076250, + ); + path_1.lineTo(size.width * 0.3416667, size.height * 0.5508625); + path_1.lineTo(size.width * 0.7083333, size.height * 0.3333333); + + final Paint paint1Fill = Paint()..style = PaintingStyle.fill; + paint1Fill.color = const Color(0xffc8daea).withOpacity(1.0); + canvas.drawPath(path_1, paint1Fill); + + final Path path_2 = Path(); + path_2.moveTo(size.width * 0.4083333, size.height * 0.7291667); + path_2.cubicTo( + size.width * 0.4208333, + size.height * 0.7291667, + size.width * 0.4263542, + size.height * 0.7234500, + size.width * 0.4333333, + size.height * 0.7166667, + ); + path_2.lineTo(size.width * 0.5000000, size.height * 0.6518417); + path_2.lineTo(size.width * 0.4168417, size.height * 0.6016958); + + final Paint paint2Fill = Paint()..style = PaintingStyle.fill; + paint2Fill.color = const Color(0xffa9c9dd).withOpacity(1.0); + canvas.drawPath(path_2, paint2Fill); + + final Path path_3 = Path(); + path_3.moveTo(size.width * 0.4168333, size.height * 0.6017083); + path_3.lineTo(size.width * 0.6183333, size.height * 0.7505792); + path_3.cubicTo( + size.width * 0.6413292, + size.height * 0.7632667, + size.width * 0.6579208, + size.height * 0.7566958, + size.width * 0.6636500, + size.height * 0.7292333, + ); + path_3.lineTo(size.width * 0.7456708, size.height * 0.3427208); + path_3.cubicTo( + size.width * 0.7540667, + size.height * 0.3090542, + size.width * 0.7328375, + size.height * 0.2937792, + size.width * 0.7108375, + size.height * 0.3037667, + ); + path_3.lineTo(size.width * 0.2292125, size.height * 0.4894792); + path_3.cubicTo( + size.width * 0.1963375, + size.height * 0.5026667, + size.width * 0.1965333, + size.height * 0.5210083, + size.width * 0.2232208, + size.height * 0.5291792, + ); + path_3.lineTo(size.width * 0.3468167, size.height * 0.5677583); + path_3.lineTo(size.width * 0.6329542, size.height * 0.3872375); + path_3.cubicTo( + size.width * 0.6464625, + size.height * 0.3790458, + size.width * 0.6588625, + size.height * 0.3834458, + size.width * 0.6486875, + size.height * 0.3924792, + ); + + final Paint paint3Fill = Paint()..style = PaintingStyle.fill; + paint3Fill.shader = ui.Gradient.linear( + Offset(size.width * 0.6600000, size.height * 0.4370000), + Offset(size.width * 0.8510000, size.height * 0.8020000), [ + const Color(0xffeff7fc).withOpacity(1), + const Color(0xffffffff).withOpacity(1) + ], [ + 0, + 1 + ]); + canvas.drawPath(path_3, paint3Fill); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/shouldRepaint.md b/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/shouldRepaint.md new file mode 100644 index 000000000..255d4828a --- /dev/null +++ b/talawa-mobile-docs/custom_painters_telegram_logo/TelegramLogo/shouldRepaint.md @@ -0,0 +1,58 @@ + + + +# shouldRepaint method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) shouldRepaint +(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) + +_override_ + + + +

Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former).

+

If the new instance represents different information than the old +instance, then the method should return true, otherwise it should return +false.

+

If the method returns false, then the paint call might be optimized +away.

+

It's possible that the paint method will get called even if +shouldRepaint returns false (e.g. if an ancestor or descendant needed to +be repainted). It's also possible that the paint method will get called +without shouldRepaint being called at all (e.g. if the box changes +size).

+

If a custom delegate has a particularly expensive paint function such that +repaints should be avoided as much as possible, a RepaintBoundary or +RenderRepaintBoundary (or other render object with +RenderObject.isRepaintBoundary set to true) might be helpful.

+

The oldDelegate argument will never be null.

+ + + +## Implementation + +```dart +@override +bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_telegram_logo/custom_painters_telegram_logo-library.md b/talawa-mobile-docs/custom_painters_telegram_logo/custom_painters_telegram_logo-library.md new file mode 100644 index 000000000..4dad766a1 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_telegram_logo/custom_painters_telegram_logo-library.md @@ -0,0 +1,40 @@ + + + + +# telegram_logo library + + + + + + + + + + + +## Classes + +##### [TelegramLogo](../custom_painters_telegram_logo/TelegramLogo-class.md) + + + +This class draws the telegram logo using custom paint. +CustomPaint is a widget from the Flutter SDK, which enables +you to use a canvas to draw different shapes. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo-class.md b/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo-class.md new file mode 100644 index 000000000..71a314a26 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo-class.md @@ -0,0 +1,183 @@ + + + +# WhatsappLogo class + + + + + + + + + +

This class draws the whatsapp logo using custom paint. +CustomPaint is a widget from the Flutter SDK, which enables +you to use a canvas to draw different shapes.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Listenable](https://api.flutter.dev/flutter/foundation/Listenable-class.html) +- [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) +- WhatsappLogo + + + + + + + + +## Constructors + +[WhatsappLogo](../custom_painters_whatsapp_logo/WhatsappLogo/WhatsappLogo.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [semanticsBuilder](https://api.flutter.dev/flutter/rendering/CustomPainter/semanticsBuilder.html) → [SemanticsBuilderCallback](https://api.flutter.dev/flutter/rendering/SemanticsBuilderCallback.html)? + + + +Returns a function that builds semantic information for the picture drawn +by this painter. +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/rendering/CustomPainter/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be notified when it is time to repaint. +_inherited_ + + + +##### [hitTest](https://api.flutter.dev/flutter/rendering/CustomPainter/hitTest.html)([Offset](https://api.flutter.dev/flutter/dart-ui/Offset-class.html) position) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + +Called whenever a hit test is being performed on an object that is using +this custom paint delegate. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [paint](../custom_painters_whatsapp_logo/WhatsappLogo/paint.md)([Canvas](https://api.flutter.dev/flutter/dart-ui/Canvas-class.html) canvas, [Size](https://api.flutter.dev/flutter/dart-ui/Size-class.html) size) void + + + +Called whenever the object needs to paint. The given Canvas has its +coordinate space configured such that the origin is at the top left of the +box. The area of the box is the size of the size argument. +_override_ + + + +##### [removeListener](https://api.flutter.dev/flutter/rendering/CustomPainter/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that the +object notifies when it is time to repaint. +_inherited_ + + + +##### [shouldRebuildSemantics](https://api.flutter.dev/flutter/rendering/CustomPainter/shouldRebuildSemantics.html)(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former). +_inherited_ + + + +##### [shouldRepaint](../custom_painters_whatsapp_logo/WhatsappLogo/shouldRepaint.md)(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former). +_override_ + + + +##### [toString](https://api.flutter.dev/flutter/rendering/CustomPainter/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/WhatsappLogo.md b/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/WhatsappLogo.md new file mode 100644 index 000000000..e75ac5d53 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/WhatsappLogo.md @@ -0,0 +1,24 @@ + + + +# WhatsappLogo constructor + + + + + + + +WhatsappLogo() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/paint.md b/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/paint.md new file mode 100644 index 000000000..ff1a5a712 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/paint.md @@ -0,0 +1,485 @@ + + + +# paint method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void paint +([Canvas](https://api.flutter.dev/flutter/dart-ui/Canvas-class.html) canvas, [Size](https://api.flutter.dev/flutter/dart-ui/Size-class.html) size) + +_override_ + + + +

Called whenever the object needs to paint. The given Canvas has its +coordinate space configured such that the origin is at the top left of the +box. The area of the box is the size of the size argument.

+

Paint operations should remain inside the given area. Graphical +operations outside the bounds may be silently ignored, clipped, or not +clipped. It may sometimes be difficult to guarantee that a certain +operation is inside the bounds (e.g., drawing a rectangle whose size is +determined by user inputs). In that case, consider calling +Canvas.clipRect at the beginning of paint so everything that follows +will be guaranteed to only draw within the clipped area.

+

Implementations should be wary of correctly pairing any calls to +Canvas.save/Canvas.saveLayer and Canvas.restore, otherwise all +subsequent painting on this canvas may be affected, with potentially +hilarious but confusing results.

+

To paint text on a Canvas, use a TextPainter.

+

To paint an image on a Canvas:

+
    +
  1. +

    Obtain an ImageStream, for example by calling ImageProvider.resolve +on an AssetImage or NetworkImage object.

    +
  2. +
  3. +

    Whenever the ImageStream's underlying ImageInfo object changes +(see ImageStream.addListener), create a new instance of your custom +paint delegate, giving it the new ImageInfo object.

    +
  4. +
  5. +

    In your delegate's paint method, call the Canvas.drawImage, +Canvas.drawImageRect, or Canvas.drawImageNine methods to paint the +ImageInfo.image object, applying the ImageInfo.scale value to +obtain the correct rendering size.

    +
  6. +
+ + + +## Implementation + +```dart +@override +void paint(Canvas canvas, Size size) { + final Path path_0 = Path(); + path_0.moveTo(size.width * 0.3580000, size.height * 0.1673307); + path_0.cubicTo( + size.width * 0.4170000, + size.height * 0.1406375, + size.width * 0.4836000, + size.height * 0.1314741, + size.width * 0.5480000, + size.height * 0.1400398, + ); + path_0.cubicTo( + size.width * 0.6134000, + size.height * 0.1486056, + size.width * 0.6760000, + size.height * 0.1764940, + size.width * 0.7260000, + size.height * 0.2193227, + ); + path_0.cubicTo( + size.width * 0.7740000, + size.height * 0.2595618, + size.width * 0.8106000, + size.height * 0.3129482, + size.width * 0.8308000, + size.height * 0.3719124, + ); + path_0.cubicTo( + size.width * 0.8540000, + size.height * 0.4390438, + size.width * 0.8558000, + size.height * 0.5133466, + size.width * 0.8360000, + size.height * 0.5810757, + ); + path_0.arcToPoint( + Offset(size.width * 0.7034000, size.height * 0.7677291), + radius: + Radius.elliptical(size.width * 0.3520000, size.height * 0.3505976), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_0.arcToPoint( + Offset(size.width * 0.5662000, size.height * 0.8264940), + radius: + Radius.elliptical(size.width * 0.3500000, size.height * 0.3486056), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_0.cubicTo( + size.width * 0.4822000, + size.height * 0.8424303, + size.width * 0.3930000, + size.height * 0.8268924, + size.width * 0.3202000, + size.height * 0.7826693, + ); + path_0.cubicTo( + size.width * 0.3156000, + size.height * 0.7806773, + size.width * 0.3112000, + size.height * 0.7756972, + size.width * 0.3058000, + size.height * 0.7778884, + ); + path_0.lineTo(size.width * 0.1780000, size.height * 0.8107570); + path_0.lineTo(size.width * 0.2120000, size.height * 0.6864542); + path_0.cubicTo( + size.width * 0.2140000, + size.height * 0.6820717, + size.width * 0.2100000, + size.height * 0.6784861, + size.width * 0.2080000, + size.height * 0.6745020, + ); + path_0.cubicTo( + size.width * 0.1694000, + size.height * 0.6159363, + size.width * 0.1494000, + size.height * 0.5454183, + size.width * 0.1514000, + size.height * 0.4752988, + ); + path_0.cubicTo( + size.width * 0.1534000, + size.height * 0.3318725, + size.width * 0.2454000, + size.height * 0.2183267, + size.width * 0.3574000, + size.height * 0.1665339, + ); + + final Paint paint0Fill = Paint()..style = PaintingStyle.fill; + paint0Fill.color = const Color(0xff40c351).withOpacity(1.0); + canvas.drawPath(path_0, paint0Fill); + + final Path path_1 = Path(); + path_1.moveTo(size.width * 0.3760000, size.height * 0.2908367); + path_1.cubicTo( + size.width * 0.3854000, + size.height * 0.2910359, + size.width * 0.3916000, + size.height * 0.2994024, + size.width * 0.3952000, + size.height * 0.3067729, + ); + path_1.cubicTo( + size.width * 0.4072000, + size.height * 0.3326693, + size.width * 0.4168000, + size.height * 0.3593625, + size.width * 0.4282000, + size.height * 0.3854582, + ); + path_1.cubicTo( + size.width * 0.4306000, + size.height * 0.3908367, + size.width * 0.4322000, + size.height * 0.3968127, + size.width * 0.4302000, + size.height * 0.4025896, + ); + path_1.cubicTo( + size.width * 0.4242000, + size.height * 0.4195219, + size.width * 0.4102000, + size.height * 0.4316733, + size.width * 0.3990000, + size.height * 0.4452191, + ); + path_1.cubicTo( + size.width * 0.3950000, + size.height * 0.4498008, + size.width * 0.3954000, + size.height * 0.4563745, + size.width * 0.3986000, + size.height * 0.4611554, + ); + path_1.arcToPoint( + Offset(size.width * 0.5456000, size.height * 0.5876494), + radius: + Radius.elliptical(size.width * 0.2600000, size.height * 0.2589641), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.cubicTo( + size.width * 0.5516000, + size.height * 0.5902390, + size.width * 0.5588000, + size.height * 0.5896414, + size.width * 0.5630000, + size.height * 0.5844622, + ); + path_1.arcToPoint( + Offset(size.width * 0.5970000, size.height * 0.5428287), + radius: + Radius.elliptical(size.width * 0.5640000, size.height * 0.5617530), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.cubicTo( + size.width * 0.6062000, + size.height * 0.5308765, + size.width * 0.6142000, + size.height * 0.5342629, + size.width * 0.6262000, + size.height * 0.5392430, + ); + path_1.lineTo(size.width * 0.7030000, size.height * 0.5760956); + path_1.cubicTo( + size.width * 0.7090000, + size.height * 0.5786853, + size.width * 0.7150000, + size.height * 0.5830677, + size.width * 0.7144000, + size.height * 0.5900398, + ); + path_1.cubicTo( + size.width * 0.7184000, + size.height * 0.6418327, + size.width * 0.6718000, + size.height * 0.6820717, + size.width * 0.6230000, + size.height * 0.6836653, + ); + path_1.cubicTo( + size.width * 0.4970000, + size.height * 0.6745020, + size.width * 0.4110000, + size.height * 0.6047809, + size.width * 0.3490000, + size.height * 0.5243028, + ); + path_1.cubicTo( + size.width * 0.3286000, + size.height * 0.4960159, + size.width * 0.3070000, + size.height * 0.4675299, + size.width * 0.2958000, + size.height * 0.4338645, + ); + path_1.cubicTo( + size.width * 0.2852000, + size.height * 0.4043825, + size.width * 0.2848000, + size.height * 0.3707171, + size.width * 0.2974000, + size.height * 0.3416335, + ); + path_1.cubicTo( + size.width * 0.3168000, + size.height * 0.3027888, + size.width * 0.3338000, + size.height * 0.2878486, + size.width * 0.3766000, + size.height * 0.2902390, + ); + path_1.close(); + path_1.moveTo(size.width * 0.2580000, size.height * 0.1422311); + path_1.cubicTo( + size.width * 0.3504000, + size.height * 0.07649402, + size.width * 0.4700000, + size.height * 0.05139442, + size.width * 0.5820000, + size.height * 0.07370518, + ); + path_1.arcToPoint( + Offset(size.width * 0.7774000, size.height * 0.1699203), + radius: + Radius.elliptical(size.width * 0.4180000, size.height * 0.4163347), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.arcToPoint( + Offset(size.width * 0.9178000, size.height * 0.4368526), + radius: + Radius.elliptical(size.width * 0.4200000, size.height * 0.4183267), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.arcToPoint( + Offset(size.width * 0.8918000, size.height * 0.6380478), + radius: + Radius.elliptical(size.width * 0.4220000, size.height * 0.4203187), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.cubicTo( + size.width * 0.8622000, + size.height * 0.7137450, + size.width * 0.8098000, + size.height * 0.7802789, + size.width * 0.7434000, + size.height * 0.8272908, + ); + path_1.arcToPoint( + Offset(size.width * 0.5254000, size.height * 0.9039841), + radius: + Radius.elliptical(size.width * 0.4180000, size.height * 0.4163347), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.arcToPoint( + Offset(size.width * 0.2994000, size.height * 0.8541833), + radius: + Radius.elliptical(size.width * 0.4200000, size.height * 0.4183267), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.lineTo(size.width * 0.07540000, size.height * 0.9119522); + path_1.lineTo(size.width * 0.1344000, size.height * 0.6968127); + path_1.cubicTo( + size.width * 0.1356000, + size.height * 0.6942231, + size.width * 0.1338000, + size.height * 0.6920319, + size.width * 0.1324000, + size.height * 0.6900398, + ); + path_1.arcToPoint( + Offset(size.width * 0.08240000, size.height * 0.4310757), + radius: + Radius.elliptical(size.width * 0.4200000, size.height * 0.4183267), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.arcToPoint( + Offset(size.width * 0.2574000, size.height * 0.1422311), + radius: + Radius.elliptical(size.width * 0.4260000, size.height * 0.4243028), + rotation: 0, + largeArc: false, + clockwise: true, + ); + path_1.moveTo(size.width * 0.3568000, size.height * 0.1673307); + path_1.cubicTo( + size.width * 0.2898000, + size.height * 0.1972112, + size.width * 0.2328000, + size.height * 0.2486056, + size.width * 0.1964000, + size.height * 0.3121514, + ); + path_1.cubicTo( + size.width * 0.1676000, + size.height * 0.3619522, + size.width * 0.1516000, + size.height * 0.4187251, + size.width * 0.1504000, + size.height * 0.4760956, + ); + path_1.cubicTo( + size.width * 0.1484000, + size.height * 0.5462151, + size.width * 0.1684000, + size.height * 0.6165339, + size.width * 0.2070000, + size.height * 0.6752988, + ); + path_1.cubicTo( + size.width * 0.2090000, + size.height * 0.6788845, + size.width * 0.2126000, + size.height * 0.6826693, + size.width * 0.2110000, + size.height * 0.6872510, + ); + path_1.lineTo(size.width * 0.1770000, size.height * 0.8115538); + path_1.cubicTo( + size.width * 0.2196000, + size.height * 0.8007968, + size.width * 0.2622000, + size.height * 0.7892430, + size.width * 0.3050000, + size.height * 0.7784861, + ); + path_1.cubicTo( + size.width * 0.3104000, + size.height * 0.7764940, + size.width * 0.3150000, + size.height * 0.7808765, + size.width * 0.3194000, + size.height * 0.7832669, + ); + path_1.arcToPoint( + Offset(size.width * 0.5654000, size.height * 0.8272908), + radius: + Radius.elliptical(size.width * 0.3500000, size.height * 0.3486056), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.7026000, size.height * 0.7685259), + radius: + Radius.elliptical(size.width * 0.3460000, size.height * 0.3446215), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.8352000, size.height * 0.5818725), + radius: + Radius.elliptical(size.width * 0.3520000, size.height * 0.3505976), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.8300000, size.height * 0.3727092), + radius: + Radius.elliptical(size.width * 0.3500000, size.height * 0.3486056), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.7252000, size.height * 0.2201195), + radius: + Radius.elliptical(size.width * 0.3500000, size.height * 0.3486056), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.arcToPoint( + Offset(size.width * 0.5470000, size.height * 0.1408367), + radius: + Radius.elliptical(size.width * 0.3480000, size.height * 0.3466135), + rotation: 0, + largeArc: false, + clockwise: false, + ); + path_1.cubicTo( + size.width * 0.4830000, + size.height * 0.1322709, + size.width * 0.4162000, + size.height * 0.1414343, + size.width * 0.3570000, + size.height * 0.1681275, + ); + path_1.close(); + + final Paint paint1fill = Paint()..style = PaintingStyle.fill; + paint1fill.color = const Color(0xfffcfcfc).withOpacity(1.0); + canvas.drawPath(path_1, paint1fill); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/shouldRepaint.md b/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/shouldRepaint.md new file mode 100644 index 000000000..886f0bbbb --- /dev/null +++ b/talawa-mobile-docs/custom_painters_whatsapp_logo/WhatsappLogo/shouldRepaint.md @@ -0,0 +1,58 @@ + + + +# shouldRepaint method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) shouldRepaint +(covariant [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html) oldDelegate) + +_override_ + + + +

Called whenever a new instance of the custom painter delegate class is +provided to the RenderCustomPaint object, or any time that a new +CustomPaint object is created with a new instance of the custom painter +delegate class (which amounts to the same thing, because the latter is +implemented in terms of the former).

+

If the new instance represents different information than the old +instance, then the method should return true, otherwise it should return +false.

+

If the method returns false, then the paint call might be optimized +away.

+

It's possible that the paint method will get called even if +shouldRepaint returns false (e.g. if an ancestor or descendant needed to +be repainted). It's also possible that the paint method will get called +without shouldRepaint being called at all (e.g. if the box changes +size).

+

If a custom delegate has a particularly expensive paint function such that +repaints should be avoided as much as possible, a RepaintBoundary or +RenderRepaintBoundary (or other render object with +RenderObject.isRepaintBoundary set to true) might be helpful.

+

The oldDelegate argument will never be null.

+ + + +## Implementation + +```dart +@override +bool shouldRepaint(covariant CustomPainter oldDelegate) { + return true; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/custom_painters_whatsapp_logo/custom_painters_whatsapp_logo-library.md b/talawa-mobile-docs/custom_painters_whatsapp_logo/custom_painters_whatsapp_logo-library.md new file mode 100644 index 000000000..9c4646508 --- /dev/null +++ b/talawa-mobile-docs/custom_painters_whatsapp_logo/custom_painters_whatsapp_logo-library.md @@ -0,0 +1,40 @@ + + + + +# whatsapp_logo library + + + + + + + + + + + +## Classes + +##### [WhatsappLogo](../custom_painters_whatsapp_logo/WhatsappLogo-class.md) + + + +This class draws the whatsapp logo using custom paint. +CustomPaint is a widget from the Flutter SDK, which enables +you to use a canvas to draw different shapes. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/demo_server_data_direct_chat_demo_data/demo_server_data_direct_chat_demo_data-library.md b/talawa-mobile-docs/demo_server_data_direct_chat_demo_data/demo_server_data_direct_chat_demo_data-library.md new file mode 100644 index 000000000..5a7cd4e32 --- /dev/null +++ b/talawa-mobile-docs/demo_server_data_direct_chat_demo_data/demo_server_data_direct_chat_demo_data-library.md @@ -0,0 +1,40 @@ + + + + +# direct_chat_demo_data library + + + + + + + + + + + + + + +## Constants + +##### [directChatDemoData](../demo_server_data_direct_chat_demo_data/directChatDemoData-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)>> + + + +This file contains demo data. + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/demo_server_data_direct_chat_demo_data/directChatDemoData-constant.md b/talawa-mobile-docs/demo_server_data_direct_chat_demo_data/directChatDemoData-constant.md new file mode 100644 index 000000000..213ffe978 --- /dev/null +++ b/talawa-mobile-docs/demo_server_data_direct_chat_demo_data/directChatDemoData-constant.md @@ -0,0 +1,200 @@ + + + +# directChatDemoData top-level constant + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)>> const directChatDemoData + + + + + +

This file contains demo data.

+

It contains a list of type Map<String, Object> and sample data of chats.

+ + + +## Implementation + +```dart +const directChatDemoData = [ + { + "sender": { + "name": "Sender 1", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Last message from the sender.", + "bool": "True" + }, + "unreadCount": 6, + }, + { + "sender": { + "name": "Sender 2", + "id": "sadiufghbasdqwuibnnads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Last message from the sender.", + "bool": "True" + }, + "unreadCount": 6, + }, + { + "sender": { + "name": "Sender 8", + "id": "sadiusfgafghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True" + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 7", + "id": "sasdasddiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True" + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 6", + "id": "sadiufghbassadasddqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True" + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 5", + "id": "sadiufghbasdqwsaduibnuads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender 5", + "id": "sadiufghbasdqwdfdibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True" + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 4", + "id": "sadiufghbsdasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True" + }, + "unreadCount": 3, + }, + { + "sender": { + "name": "Sender 41", + "id": "sadiufghbadgsdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True" + }, + "unreadCount": 1, + }, + { + "sender": { + "name": "Sender 13", + "id": "sadiufghbadsfsdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "lastMessage": { + "sender": { + "name": "Sender Name", + "id": "sadiufghbasdqwuibnuads", + "image": "sender_profile_inmage_url" + }, + "messageID": "asdasdfasdfgasdf", + "text": "Latest message", + "bool": "True" + }, + "unreadCount": 8, + }, +]; +``` + + + + + + + + diff --git a/talawa-mobile-docs/demo_server_data_events_demo_data/demo_server_data_events_demo_data-library.md b/talawa-mobile-docs/demo_server_data_events_demo_data/demo_server_data_events_demo_data-library.md new file mode 100644 index 000000000..64a23f76d --- /dev/null +++ b/talawa-mobile-docs/demo_server_data_events_demo_data/demo_server_data_events_demo_data-library.md @@ -0,0 +1,41 @@ + + + + +# events_demo_data library + + + + + + + + + + + + + + +## Constants + +##### [eventsDemoData](../demo_server_data_events_demo_data/eventsDemoData-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)>> + + + +This file contains demo data. It contains a list of type Map<String, Object> +and sample data of events. + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/demo_server_data_events_demo_data/eventsDemoData-constant.md b/talawa-mobile-docs/demo_server_data_events_demo_data/eventsDemoData-constant.md new file mode 100644 index 000000000..72455cde7 --- /dev/null +++ b/talawa-mobile-docs/demo_server_data_events_demo_data/eventsDemoData-constant.md @@ -0,0 +1,229 @@ + + + +# eventsDemoData top-level constant + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)>> const eventsDemoData + + + + + +

This file contains demo data. It contains a list of type Map<String, Object> +and sample data of events.

+ + + +## Implementation + +```dart +const eventsDemoData = [ + { + "title": "Calculus", + "description": + "This course introduces calculus using analytic geometry functions. Topics include limits and continuity, derivatives, optimization, related rates, graphing and other applications of derivatives, definite and indefinite integrals, and numerical integration.", + "attendees": "50", + "location": "Lostilos", + "recurring": "false", + "allDay": "true", + "startDate": "1 Aug", + "endDate": "15 Aug", + "startTime": "11am", + "endTime": "3pm", + "recurrence": "MONTHLY", + "isPublic": "true", + "isSubscribed": "false", + "isRegisterable": "true", + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "_id": "asdasdasd" + }, + "registrants": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + ], + "admins": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + ], + "organization": { + "_id": '1', + "name": 'Mathematicians', + "image": ' ', + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "_id": "asdasdasd" + } + }, + }, + { + "title": "UI/UX", + "description": + "UX design refers to the term “user experience design”, while UI stands for “user interface design”. Both elements are crucial to a product and work closely together.", + "attendees": "80", + "location": "Tokyo, Japan", + "recurring": "false", + "allDay": "true", + "startDate": "5 May", + "endDate": "13 May", + "startTime": "2am", + "endTime": "3pm", + "recurrence": "MONTHLY", + "isPublic": "true", + "isSubscribed": "true", + "isRegisterable": "true", + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "_id": "asdasdasd" + }, + "registrants": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + ], + "admins": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + ], + "organization": { + "_id": '1', + "name": 'Courses', + "image": ' ', + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "_id": "asdasdasd" + } + }, + }, + { + "title": "System Design", + "description": + "Systems design is the process of defining the architecture, product design, modules, interfaces, and data for a system to satisfy specified requirements. Systems design could be seen as the application of systems theory to product development.", + "attendees": "29", + "location": "Shimla, India", + "recurring": "false", + "allDay": "true", + "startDate": "15 Dec", + "endDate": "18 Aug", + "startTime": "8am", + "endTime": "3pm", + "recurrence": "MONTHLY", + "isPublic": "false", + "isSubscribed": "false", + "isRegisterable": "true", + "creator": { + "firstName": "Ritik", + "lastName": "Srivastav", + "_id": "asdasdasd" + }, + "registrants": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + ], + "admins": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + ], + "organization": { + "_id": '1', + "image": ' ', + "name": 'Computer Science', + "creator": { + "firstName": "Ritik", + "lastName": "Srivastav", + "_id": "asdasdasd" + } + }, + }, + { + "title": "Gaming", + // ignore: missing_whitespace_between_adjacent_strings + "description": + "Cyberpunk 2077 is a 2020 action role-playing v_ideo game developed and published by CD Projekt. The story takes place in Night City, an open world set in the Cyberpunk universe.", + + "attendees": "5k+", + "location": "Nagpur, India", + "recurring": "false", + "allDay": "true", + "startDate": "1 Aug", + "endDate": "15 Aug", + "startTime": "11am", + "endTime": "3pm", + "recurrence": "MONTHLY", + "isPublic": "true", + "isSubscribed": "true", + "isRegisterable": "true", + + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "_id": "asdasdasd" + }, + "registrants": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + {"firstName": "Warren", "lastName": "Buff", "_id": "asdasdasd"}, + {"firstName": "Bustin", "lastName": "Jiber", "_id": "asdasdasd"}, + ], + "admins": [ + {"firstName": "Utkarsh", "lastName": "Shendge", "_id": "asdasdasd"}, + ], + "organization": { + "_id": '1', + "image": ' ', + "name": 'Cyclone', + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "_id": "asdasdasd" + } + }, + } +]; +``` + + + + + + + + diff --git a/talawa-mobile-docs/demo_server_data_pinned_post_demo_data/demo_server_data_pinned_post_demo_data-library.md b/talawa-mobile-docs/demo_server_data_pinned_post_demo_data/demo_server_data_pinned_post_demo_data-library.md new file mode 100644 index 000000000..90c5b02d0 --- /dev/null +++ b/talawa-mobile-docs/demo_server_data_pinned_post_demo_data/demo_server_data_pinned_post_demo_data-library.md @@ -0,0 +1,40 @@ + + + + +# pinned_post_demo_data library + + + + + + + + + + + + + + +## Constants + +##### [pinnedPostsDemoData](../demo_server_data_pinned_post_demo_data/pinnedPostsDemoData-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)>> + + + +This file contains demo data for pinned posts. It contains a list of type Map<String, Object> and sample data. + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/demo_server_data_pinned_post_demo_data/pinnedPostsDemoData-constant.md b/talawa-mobile-docs/demo_server_data_pinned_post_demo_data/pinnedPostsDemoData-constant.md new file mode 100644 index 000000000..e932c9d7e --- /dev/null +++ b/talawa-mobile-docs/demo_server_data_pinned_post_demo_data/pinnedPostsDemoData-constant.md @@ -0,0 +1,193 @@ + + + +# pinnedPostsDemoData top-level constant + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)>> const pinnedPostsDemoData + + + + + +

This file contains demo data for pinned posts. It contains a list of type Map<String, Object> and sample data.

+ + + +## Implementation + +```dart +const pinnedPostsDemoData = [ + { + "_id": "1", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": "image url string", + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "id": "asdasdasd" + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"} + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + ] + }, + { + "_id": "2", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": "image url string", + "creator": { + "firstName": "Ranchhod Das", + "lastName": "Chanchad", + "id": "asdasdasd" + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"} + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + ] + }, + { + "_id": "3", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": "image url string", + "creator": { + "firstName": "Ritik", + "lastName": "Srivastav", + "id": "asdasdasd" + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"} + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + ] + }, + { + "_id": "4", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": "image url string", + "creator": { + "firstName": "Utkarsh", + "lastName": "Shendge", + "id": "asdasdasd" + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"} + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"} + }, + ] + }, +]; +``` + + + + + + + + diff --git a/talawa-mobile-docs/demo_server_data_post_demo_data/demo_server_data_post_demo_data-library.md b/talawa-mobile-docs/demo_server_data_post_demo_data/demo_server_data_post_demo_data-library.md new file mode 100644 index 000000000..2e26a035a --- /dev/null +++ b/talawa-mobile-docs/demo_server_data_post_demo_data/demo_server_data_post_demo_data-library.md @@ -0,0 +1,41 @@ + + + + +# post_demo_data library + + + + + + + + + + + + + + +## Constants + +##### [postsDemoData](../demo_server_data_post_demo_data/postsDemoData-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)>> + + + +This file contains demo data for posts. It contains a list of type Map<String, Object> +and sample data of posts. + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/demo_server_data_post_demo_data/postsDemoData-constant.md b/talawa-mobile-docs/demo_server_data_post_demo_data/postsDemoData-constant.md new file mode 100644 index 000000000..aa96891f7 --- /dev/null +++ b/talawa-mobile-docs/demo_server_data_post_demo_data/postsDemoData-constant.md @@ -0,0 +1,214 @@ + + + +# postsDemoData top-level constant + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)>> const postsDemoData + + + + + +

This file contains demo data for posts. It contains a list of type Map<String, Object> +and sample data of posts.

+ + + +## Implementation + +```dart +const postsDemoData = [ + { + "_id": "asdasdasd", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "created at string", + "imageUrl": "image url string", + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "_id": "asdasdasd" + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"} + ], + "comments": [ + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "5", "_id": "asdasdasdas"} + }, + ] + }, + { + "_id": "asdasdasd", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Andro_id in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "created at string", + "imageUrl": "image url string", + "creator": { + "firstName": "Ranchhod Das Chhanchad", + "lastName": "Chandla", + "_id": "asdasdasd" + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"} + ], + "comments": [ + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + ] + }, + { + "_id": "asdasdasd", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Andro_id in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "created at string", + "imageUrl": "image url string", + "creator": { + "firstName": "Ritik", + "lastName": "Srivastav", + "_id": "asdasdasd" + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"} + ], + "comments": [ + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + ] + }, + { + "_id": "asdasdasd", + "text": + "Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Andro_id in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.", + "createdAt": "created at string", + "imageUrl": "image url string", + "creator": { + "firstName": "Utkarsh", + "lastName": "Shengde", + "_id": "asdasdasd" + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "_id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "_id": "asdasdasdas"} + ], + "comments": [ + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + { + "_id": "commentID", + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "_id": "asdasdasdas"} + }, + ] + }, +]; +``` + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/CallFor.md b/talawa-mobile-docs/enums_enums/CallFor.md new file mode 100644 index 000000000..c508c6110 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/CallFor.md @@ -0,0 +1,149 @@ + + + +# CallFor enum + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Enum](https://api.flutter.dev/flutter/dart-core/Enum-class.html) +- CallFor + + + + + + +## Constructors + +[CallFor](../enums_enums/CallFor/CallFor.md) () + + _const_ + + +## Values + +##### [login](../enums_enums/CallFor.md) const [CallFor](../enums_enums/CallFor.md) + + + + + + + + +##### [signup](../enums_enums/CallFor.md) const [CallFor](../enums_enums/CallFor.md) + + + + + + + + +##### [joinPublicOrg](../enums_enums/CallFor.md) const [CallFor](../enums_enums/CallFor.md) + + + + + + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [index](https://api.flutter.dev/flutter/dart-core/Enum/index.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +A numeric identifier for the enumerated value. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [values](../enums_enums/CallFor/values-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[CallFor](../enums_enums/CallFor.md)> + + + +A constant List of the values in this enum, in order of their declaration. + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/CallFor/CallFor.md b/talawa-mobile-docs/enums_enums/CallFor/CallFor.md new file mode 100644 index 000000000..1f869b15f --- /dev/null +++ b/talawa-mobile-docs/enums_enums/CallFor/CallFor.md @@ -0,0 +1,24 @@ + + + +# CallFor constructor + + + + + + +const +CallFor() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/CallFor/values-constant.md b/talawa-mobile-docs/enums_enums/CallFor/values-constant.md new file mode 100644 index 000000000..cff3cf6c2 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/CallFor/values-constant.md @@ -0,0 +1,28 @@ + + + +# values constant + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[CallFor](../../enums_enums/CallFor.md)> const values + + + + + +

A constant List of the values in this enum, in order of their declaration.

+ + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ChatState.md b/talawa-mobile-docs/enums_enums/ChatState.md new file mode 100644 index 000000000..739acc025 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ChatState.md @@ -0,0 +1,150 @@ + + + +# ChatState enum + + + + + + + +

Represents the state of the chat

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Enum](https://api.flutter.dev/flutter/dart-core/Enum-class.html) +- ChatState + + + + + + +## Constructors + +[ChatState](../enums_enums/ChatState/ChatState.md) () + + _const_ + + +## Values + +##### [initial](../enums_enums/ChatState.md) const [ChatState](../enums_enums/ChatState.md) + + + + + + + + +##### [loading](../enums_enums/ChatState.md) const [ChatState](../enums_enums/ChatState.md) + + + + + + + + +##### [complete](../enums_enums/ChatState.md) const [ChatState](../enums_enums/ChatState.md) + + + + + + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [index](https://api.flutter.dev/flutter/dart-core/Enum/index.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +A numeric identifier for the enumerated value. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [values](../enums_enums/ChatState/values-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatState](../enums_enums/ChatState.md)> + + + +A constant List of the values in this enum, in order of their declaration. + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ChatState/ChatState.md b/talawa-mobile-docs/enums_enums/ChatState/ChatState.md new file mode 100644 index 000000000..1d0a6f303 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ChatState/ChatState.md @@ -0,0 +1,24 @@ + + + +# ChatState constructor + + + + + + +const +ChatState() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ChatState/values-constant.md b/talawa-mobile-docs/enums_enums/ChatState/values-constant.md new file mode 100644 index 000000000..8d2ba60b5 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ChatState/values-constant.md @@ -0,0 +1,28 @@ + + + +# values constant + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatState](../../enums_enums/ChatState.md)> const values + + + + + +

A constant List of the values in this enum, in order of their declaration.

+ + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/MessageType.md b/talawa-mobile-docs/enums_enums/MessageType.md new file mode 100644 index 000000000..5bc119ab1 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/MessageType.md @@ -0,0 +1,159 @@ + + + +# MessageType enum + + + + + + + +

Represents the type of the Message

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Enum](https://api.flutter.dev/flutter/dart-core/Enum-class.html) +- MessageType + + + + + + +## Constructors + +[MessageType](../enums_enums/MessageType/MessageType.md) () + + _const_ + + +## Values + +##### [error](../enums_enums/MessageType.md) const [MessageType](../enums_enums/MessageType.md) + + + + + + + + +##### [warning](../enums_enums/MessageType.md) const [MessageType](../enums_enums/MessageType.md) + + + + + + + + +##### [info](../enums_enums/MessageType.md) const [MessageType](../enums_enums/MessageType.md) + + + + + + + + +##### [random](../enums_enums/MessageType.md) const [MessageType](../enums_enums/MessageType.md) + + + + + + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [index](https://api.flutter.dev/flutter/dart-core/Enum/index.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +A numeric identifier for the enumerated value. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [values](../enums_enums/MessageType/values-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[MessageType](../enums_enums/MessageType.md)> + + + +A constant List of the values in this enum, in order of their declaration. + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/MessageType/MessageType.md b/talawa-mobile-docs/enums_enums/MessageType/MessageType.md new file mode 100644 index 000000000..cfa1c55e6 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/MessageType/MessageType.md @@ -0,0 +1,24 @@ + + + +# MessageType constructor + + + + + + +const +MessageType() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/MessageType/values-constant.md b/talawa-mobile-docs/enums_enums/MessageType/values-constant.md new file mode 100644 index 000000000..d6a40b624 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/MessageType/values-constant.md @@ -0,0 +1,28 @@ + + + +# values constant + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[MessageType](../../enums_enums/MessageType.md)> const values + + + + + +

A constant List of the values in this enum, in order of their declaration.

+ + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ModalSheet.md b/talawa-mobile-docs/enums_enums/ModalSheet.md new file mode 100644 index 000000000..ddfe171d2 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ModalSheet.md @@ -0,0 +1,140 @@ + + + +# ModalSheet enum + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Enum](https://api.flutter.dev/flutter/dart-core/Enum-class.html) +- ModalSheet + + + + + + +## Constructors + +[ModalSheet](../enums_enums/ModalSheet/ModalSheet.md) () + + _const_ + + +## Values + +##### [donation](../enums_enums/ModalSheet.md) const [ModalSheet](../enums_enums/ModalSheet.md) + + + + + + + + +##### [invite](../enums_enums/ModalSheet.md) const [ModalSheet](../enums_enums/ModalSheet.md) + + + + + + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [index](https://api.flutter.dev/flutter/dart-core/Enum/index.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +A numeric identifier for the enumerated value. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [values](../enums_enums/ModalSheet/values-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ModalSheet](../enums_enums/ModalSheet.md)> + + + +A constant List of the values in this enum, in order of their declaration. + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ModalSheet/ModalSheet.md b/talawa-mobile-docs/enums_enums/ModalSheet/ModalSheet.md new file mode 100644 index 000000000..28f3e9e6e --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ModalSheet/ModalSheet.md @@ -0,0 +1,24 @@ + + + +# ModalSheet constructor + + + + + + +const +ModalSheet() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ModalSheet/values-constant.md b/talawa-mobile-docs/enums_enums/ModalSheet/values-constant.md new file mode 100644 index 000000000..b1da27eac --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ModalSheet/values-constant.md @@ -0,0 +1,28 @@ + + + +# values constant + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ModalSheet](../../enums_enums/ModalSheet.md)> const values + + + + + +

A constant List of the values in this enum, in order of their declaration.

+ + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/TileType.md b/talawa-mobile-docs/enums_enums/TileType.md new file mode 100644 index 000000000..006412868 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/TileType.md @@ -0,0 +1,150 @@ + + + +# TileType enum + + + + + + + +

Represents the type of the tile

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Enum](https://api.flutter.dev/flutter/dart-core/Enum-class.html) +- TileType + + + + + + +## Constructors + +[TileType](../enums_enums/TileType/TileType.md) () + + _const_ + + +## Values + +##### [user](../enums_enums/TileType.md) const [TileType](../enums_enums/TileType.md) + + + + + + + + +##### [org](../enums_enums/TileType.md) const [TileType](../enums_enums/TileType.md) + + + + + + + + +##### [option](../enums_enums/TileType.md) const [TileType](../enums_enums/TileType.md) + + + + + + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [index](https://api.flutter.dev/flutter/dart-core/Enum/index.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +A numeric identifier for the enumerated value. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [values](../enums_enums/TileType/values-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[TileType](../enums_enums/TileType.md)> + + + +A constant List of the values in this enum, in order of their declaration. + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/TileType/TileType.md b/talawa-mobile-docs/enums_enums/TileType/TileType.md new file mode 100644 index 000000000..b9500b131 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/TileType/TileType.md @@ -0,0 +1,24 @@ + + + +# TileType constructor + + + + + + +const +TileType() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/TileType/values-constant.md b/talawa-mobile-docs/enums_enums/TileType/values-constant.md new file mode 100644 index 000000000..383d264e8 --- /dev/null +++ b/talawa-mobile-docs/enums_enums/TileType/values-constant.md @@ -0,0 +1,28 @@ + + + +# values constant + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[TileType](../../enums_enums/TileType.md)> const values + + + + + +

A constant List of the values in this enum, in order of their declaration.

+ + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ViewState.md b/talawa-mobile-docs/enums_enums/ViewState.md new file mode 100644 index 000000000..d0cb942eb --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ViewState.md @@ -0,0 +1,144 @@ + + + +# ViewState enum + + + + + + + +

This file contains different enums. +The enum keyword is used to define an enumeration type in Dart. +The use case of enumeration is to store finite data members under the same type definition. +Represents the state of the view

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Enum](https://api.flutter.dev/flutter/dart-core/Enum-class.html) +- ViewState + + + + + + +## Constructors + +[ViewState](../enums_enums/ViewState/ViewState.md) () + + _const_ + + +## Values + +##### [idle](../enums_enums/ViewState.md) const [ViewState](../enums_enums/ViewState.md) + + + + + + + + +##### [busy](../enums_enums/ViewState.md) const [ViewState](../enums_enums/ViewState.md) + + + + + + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [index](https://api.flutter.dev/flutter/dart-core/Enum/index.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +A numeric identifier for the enumerated value. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [values](../enums_enums/ViewState/values-constant.md) const [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ViewState](../enums_enums/ViewState.md)> + + + +A constant List of the values in this enum, in order of their declaration. + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ViewState/ViewState.md b/talawa-mobile-docs/enums_enums/ViewState/ViewState.md new file mode 100644 index 000000000..a491a741c --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ViewState/ViewState.md @@ -0,0 +1,24 @@ + + + +# ViewState constructor + + + + + + +const +ViewState() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/ViewState/values-constant.md b/talawa-mobile-docs/enums_enums/ViewState/values-constant.md new file mode 100644 index 000000000..6360c8b8d --- /dev/null +++ b/talawa-mobile-docs/enums_enums/ViewState/values-constant.md @@ -0,0 +1,28 @@ + + + +# values constant + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ViewState](../../enums_enums/ViewState.md)> const values + + + + + +

A constant List of the values in this enum, in order of their declaration.

+ + + + + + + + + + diff --git a/talawa-mobile-docs/enums_enums/enums_enums-library.md b/talawa-mobile-docs/enums_enums/enums_enums-library.md new file mode 100644 index 000000000..3760572ad --- /dev/null +++ b/talawa-mobile-docs/enums_enums/enums_enums-library.md @@ -0,0 +1,76 @@ + + + + +# enums library + + + + + + + + + + + + + + + + + +## Enums + +##### [CallFor](../enums_enums/CallFor.md) + + + + + + +##### [ChatState](../enums_enums/ChatState.md) + + + +Represents the state of the chat + + +##### [MessageType](../enums_enums/MessageType.md) + + + +Represents the type of the Message + + +##### [ModalSheet](../enums_enums/ModalSheet.md) + + + + + + +##### [TileType](../enums_enums/TileType.md) + + + +Represents the type of the tile + + +##### [ViewState](../enums_enums/ViewState.md) + + + +This file contains different enums. +The enum keyword is used to define an enumeration type in Dart. +The use case of enumeration is to store finite data members under the same type definition. +Represents the state of the view + + + + + + + + + diff --git a/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions-class.md b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions-class.md new file mode 100644 index 000000000..f8bb745e4 --- /dev/null +++ b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions-class.md @@ -0,0 +1,128 @@ + + + +# DefaultFirebaseOptions class + + + + + + + + + +

Default FirebaseOptions for use with your Firebase apps.

+

Example:

+
import 'firebase_options.dart';
+// ...
+await Firebase.initializeApp(
+  options: DefaultFirebaseOptions.currentPlatform,
+);
+
+ + + + +## Constructors + +[DefaultFirebaseOptions](../firebase_options/DefaultFirebaseOptions/DefaultFirebaseOptions.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + +## Static Methods + +##### [android](../firebase_options/DefaultFirebaseOptions/android.md)([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> androidFirebaseOptions) [FirebaseOptions](https://pub.dev/documentation/firebase_core_platform_interface/4.8.0/firebase_core_platform_interface/FirebaseOptions-class.html) + + + +Scaffolds androidFirebaseOptions around FirebaseOptions. + + + + +##### [currentPlatform](../firebase_options/DefaultFirebaseOptions/currentPlatform.md)([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> androidFirebaseOptions, [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> iosFirebaseOptions) [FirebaseOptions](https://pub.dev/documentation/firebase_core_platform_interface/4.8.0/firebase_core_platform_interface/FirebaseOptions-class.html) + + + +Builds and returns FirebaseOptions based on the current platform. + + + + +##### [ios](../firebase_options/DefaultFirebaseOptions/ios.md)([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> iosFirebaseOptions) [FirebaseOptions](https://pub.dev/documentation/firebase_core_platform_interface/4.8.0/firebase_core_platform_interface/FirebaseOptions-class.html) + + + +Scaffolds iosFirebaseOptions around FirebaseOptions. + + + + + + + + + + + + diff --git a/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/DefaultFirebaseOptions.md b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/DefaultFirebaseOptions.md new file mode 100644 index 000000000..b07fd7df2 --- /dev/null +++ b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/DefaultFirebaseOptions.md @@ -0,0 +1,24 @@ + + + +# DefaultFirebaseOptions constructor + + + + + + + +DefaultFirebaseOptions() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/android.md b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/android.md new file mode 100644 index 000000000..8ca043804 --- /dev/null +++ b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/android.md @@ -0,0 +1,51 @@ + + + +# android method + + + + + + + + +[FirebaseOptions](https://pub.dev/documentation/firebase_core_platform_interface/4.8.0/firebase_core_platform_interface/FirebaseOptions-class.html) android +([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> androidFirebaseOptions) + + + + + +

Scaffolds androidFirebaseOptions around FirebaseOptions.

+

params:

+
    +
  • androidFirebaseOptions: The options which we want to scaffold
  • +
+

returns:

+
    +
  • FirebaseOptions: Scaffolded FirebaseOptions
  • +
+ + + +## Implementation + +```dart +static FirebaseOptions android(Map androidFirebaseOptions) => + FirebaseOptions( + apiKey: androidFirebaseOptions['apiKey'] as String, + appId: androidFirebaseOptions['appId'] as String, + messagingSenderId: + androidFirebaseOptions['messagingSenderId'] as String, + projectId: androidFirebaseOptions['projectId'] as String, + storageBucket: androidFirebaseOptions['storageBucket'] as String, + ); +``` + + + + + + + diff --git a/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/currentPlatform.md b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/currentPlatform.md new file mode 100644 index 000000000..29bbbf15d --- /dev/null +++ b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/currentPlatform.md @@ -0,0 +1,72 @@ + + + +# currentPlatform method + + + + + + + + +[FirebaseOptions](https://pub.dev/documentation/firebase_core_platform_interface/4.8.0/firebase_core_platform_interface/FirebaseOptions-class.html) currentPlatform +([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> androidFirebaseOptions, [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> iosFirebaseOptions) + + + + + +

Builds and returns FirebaseOptions based on the current platform.

+

Switches on the current platform and calls android or iOS +methods accordingly to build the FirebaseOptions. Throws +UnsupportedError if the platform is other than these two.

+

params:

+
    +
  • androidFirebaseOptions: Firebase Options for Android
  • +
  • iosFirebaseOptions: Firebase Options for iOS
  • +
+

returns:

+ + + + +## Implementation + +```dart +static FirebaseOptions currentPlatform( + Map androidFirebaseOptions, + Map iosFirebaseOptions, +) { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android(androidFirebaseOptions); + case TargetPlatform.iOS: + return ios(iosFirebaseOptions); + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/ios.md b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/ios.md new file mode 100644 index 000000000..e6845082b --- /dev/null +++ b/talawa-mobile-docs/firebase_options/DefaultFirebaseOptions/ios.md @@ -0,0 +1,53 @@ + + + +# ios method + + + + + + + + +[FirebaseOptions](https://pub.dev/documentation/firebase_core_platform_interface/4.8.0/firebase_core_platform_interface/FirebaseOptions-class.html) ios +([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> iosFirebaseOptions) + + + + + +

Scaffolds iosFirebaseOptions around FirebaseOptions.

+

more_info_if_required

+

params:

+
    +
  • iosFirebaseOptions: The options which we want to scaffold
  • +
+

returns:

+
    +
  • FirebaseOptions: Scaffolded FirebaseOptions
  • +
+ + + +## Implementation + +```dart +static FirebaseOptions ios(Map iosFirebaseOptions) => + FirebaseOptions( + apiKey: iosFirebaseOptions['apiKey'] as String, + appId: iosFirebaseOptions['appId'] as String, + messagingSenderId: iosFirebaseOptions['messagingSenderId'] as String, + projectId: iosFirebaseOptions['projectId'] as String, + storageBucket: iosFirebaseOptions['storageBucket'] as String, + iosClientId: iosFirebaseOptions['iosClientId'] as String, + iosBundleId: iosFirebaseOptions['iosBundleId'] as String, + ); +``` + + + + + + + diff --git a/talawa-mobile-docs/firebase_options/firebase_options-library.md b/talawa-mobile-docs/firebase_options/firebase_options-library.md new file mode 100644 index 000000000..8d7486d18 --- /dev/null +++ b/talawa-mobile-docs/firebase_options/firebase_options-library.md @@ -0,0 +1,38 @@ + + + + +# firebase_options library + + + + + + + + + + + +## Classes + +##### [DefaultFirebaseOptions](../firebase_options/DefaultFirebaseOptions-class.md) + + + +Default FirebaseOptions for use with your Firebase apps. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/generated_plugin_registrant/generated_plugin_registrant-library.md b/talawa-mobile-docs/generated_plugin_registrant/generated_plugin_registrant-library.md new file mode 100644 index 000000000..866146259 --- /dev/null +++ b/talawa-mobile-docs/generated_plugin_registrant/generated_plugin_registrant-library.md @@ -0,0 +1,40 @@ + + + + +# generated_plugin_registrant library + + + + + + + + + + + + + + + + +## Functions + +##### [registerPlugins](../generated_plugin_registrant/registerPlugins.md)([Registrar](https://api.flutter.dev/flutter/flutter_web_plugins/Registrar-class.html) registrar) void + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/generated_plugin_registrant/registerPlugins.md b/talawa-mobile-docs/generated_plugin_registrant/registerPlugins.md new file mode 100644 index 000000000..0614534bc --- /dev/null +++ b/talawa-mobile-docs/generated_plugin_registrant/registerPlugins.md @@ -0,0 +1,42 @@ + + + +# registerPlugins function + + + + + + + + + + +void registerPlugins +([Registrar](https://api.flutter.dev/flutter/flutter_web_plugins/Registrar-class.html) registrar) + + + + + + + + +## Implementation + +```dart +void registerPlugins(Registrar registrar) { + ConnectivityPlusPlugin.registerWith(registrar); + SharedPreferencesPlugin.registerWith(registrar); + UniLinksPlugin.registerWith(registrar); + VibrationWebPlugin.registerWith(registrar); + registrar.registerMessageHandler(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/index.json b/talawa-mobile-docs/index.json new file mode 100644 index 000000000..0ff4d0217 --- /dev/null +++ b/talawa-mobile-docs/index.json @@ -0,0 +1 @@ +[{"name":"access_request_screen","qualifiedName":"access_request_screen","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/views_after_auth_screens_join_org_after_auth_access_request_screen-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SendAccessRequest","qualifiedName":"access_request_screen.SendAccessRequest","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"requestAccess","enclosedBy":{"name":"access_request_screen","type":"library","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/views_after_auth_screens_join_org_after_auth_access_request_screen-library.md"}},{"name":"SendAccessRequest","qualifiedName":"access_request_screen.SendAccessRequest.SendAccessRequest","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/SendAccessRequest.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SendAccessRequest","type":"class","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest-class.md"}},{"name":"build","qualifiedName":"access_request_screen.SendAccessRequest.build","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"SendAccessRequest","type":"class","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest-class.md"}},{"name":"org","qualifiedName":"access_request_screen.SendAccessRequest.org","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/org.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SendAccessRequest","type":"class","href":"views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest-class.md"}},{"name":"access_request_view_model","qualifiedName":"access_request_view_model","href":"view_model_access_request_view_model/view_model_access_request_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AccessScreenViewModel","qualifiedName":"access_request_view_model.AccessScreenViewModel","href":"view_model_access_request_view_model/AccessScreenViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"access_request_view_model","type":"library","href":"view_model_access_request_view_model/view_model_access_request_view_model-library.md"}},{"name":"AccessScreenViewModel","qualifiedName":"access_request_view_model.AccessScreenViewModel.AccessScreenViewModel","href":"view_model_access_request_view_model/AccessScreenViewModel/AccessScreenViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AccessScreenViewModel","type":"class","href":"view_model_access_request_view_model/AccessScreenViewModel-class.md"}},{"name":"initialise","qualifiedName":"access_request_view_model.AccessScreenViewModel.initialise","href":"view_model_access_request_view_model/AccessScreenViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AccessScreenViewModel","type":"class","href":"view_model_access_request_view_model/AccessScreenViewModel-class.md"}},{"name":"optionalMessageController","qualifiedName":"access_request_view_model.AccessScreenViewModel.optionalMessageController","href":"view_model_access_request_view_model/AccessScreenViewModel/optionalMessageController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AccessScreenViewModel","type":"class","href":"view_model_access_request_view_model/AccessScreenViewModel-class.md"}},{"name":"orgId","qualifiedName":"access_request_view_model.AccessScreenViewModel.orgId","href":"view_model_access_request_view_model/AccessScreenViewModel/orgId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AccessScreenViewModel","type":"class","href":"view_model_access_request_view_model/AccessScreenViewModel-class.md"}},{"name":"organizations","qualifiedName":"access_request_view_model.AccessScreenViewModel.organizations","href":"view_model_access_request_view_model/AccessScreenViewModel/organizations.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AccessScreenViewModel","type":"class","href":"view_model_access_request_view_model/AccessScreenViewModel-class.md"}},{"name":"selectedOrganization","qualifiedName":"access_request_view_model.AccessScreenViewModel.selectedOrganization","href":"view_model_access_request_view_model/AccessScreenViewModel/selectedOrganization.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AccessScreenViewModel","type":"class","href":"view_model_access_request_view_model/AccessScreenViewModel-class.md"}},{"name":"sendMembershipRequest","qualifiedName":"access_request_view_model.AccessScreenViewModel.sendMembershipRequest","href":"view_model_access_request_view_model/AccessScreenViewModel/sendMembershipRequest.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AccessScreenViewModel","type":"class","href":"view_model_access_request_view_model/AccessScreenViewModel-class.md"}},{"name":"add_members_bottom_sheet","qualifiedName":"add_members_bottom_sheet","href":"widgets_add_members_bottom_sheet/widgets_add_members_bottom_sheet-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventBottomSheet","qualifiedName":"add_members_bottom_sheet.EventBottomSheet","href":"widgets_add_members_bottom_sheet/EventBottomSheet-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Adds members to an event.","enclosedBy":{"name":"add_members_bottom_sheet","type":"library","href":"widgets_add_members_bottom_sheet/widgets_add_members_bottom_sheet-library.md"}},{"name":"EventBottomSheet","qualifiedName":"add_members_bottom_sheet.EventBottomSheet.EventBottomSheet","href":"widgets_add_members_bottom_sheet/EventBottomSheet/EventBottomSheet.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventBottomSheet","type":"class","href":"widgets_add_members_bottom_sheet/EventBottomSheet-class.md"}},{"name":"addUserBottomSheet","qualifiedName":"add_members_bottom_sheet.EventBottomSheet.addUserBottomSheet","href":"widgets_add_members_bottom_sheet/EventBottomSheet/addUserBottomSheet.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function creates a modal material design bottom sheet.","enclosedBy":{"name":"EventBottomSheet","type":"class","href":"widgets_add_members_bottom_sheet/EventBottomSheet-class.md"}},{"name":"add_post_page","qualifiedName":"add_post_page","href":"views_after_auth_screens_add_post_page/views_after_auth_screens_add_post_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AddPost","qualifiedName":"add_post_page.AddPost","href":"views_after_auth_screens_add_post_page/AddPost-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"AddPost returns a widget to add(upload) the post.","enclosedBy":{"name":"add_post_page","type":"library","href":"views_after_auth_screens_add_post_page/views_after_auth_screens_add_post_page-library.md"}},{"name":"AddPost","qualifiedName":"add_post_page.AddPost.AddPost","href":"views_after_auth_screens_add_post_page/AddPost/AddPost.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AddPost","type":"class","href":"views_after_auth_screens_add_post_page/AddPost-class.md"}},{"name":"build","qualifiedName":"add_post_page.AddPost.build","href":"views_after_auth_screens_add_post_page/AddPost/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"AddPost","type":"class","href":"views_after_auth_screens_add_post_page/AddPost-class.md"}},{"name":"drawerKey","qualifiedName":"add_post_page.AddPost.drawerKey","href":"views_after_auth_screens_add_post_page/AddPost/drawerKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"DrawerKey.","enclosedBy":{"name":"AddPost","type":"class","href":"views_after_auth_screens_add_post_page/AddPost-class.md"}},{"name":"model","qualifiedName":"add_post_page.model","href":"views_after_auth_screens_add_post_page/model.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"Add Post View Model.","enclosedBy":{"name":"add_post_page","type":"library","href":"views_after_auth_screens_add_post_page/views_after_auth_screens_add_post_page-library.md"}},{"name":"add_post_view_model","qualifiedName":"add_post_view_model","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/view_model_after_auth_view_models_add_post_view_models_add_post_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AddPostViewModel","qualifiedName":"add_post_view_model.AddPostViewModel","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"AddPostViewModel class have different functions that are used.","enclosedBy":{"name":"add_post_view_model","type":"library","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/view_model_after_auth_view_models_add_post_view_models_add_post_view_model-library.md"}},{"name":"AddPostViewModel","qualifiedName":"add_post_view_model.AddPostViewModel.AddPostViewModel","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/AddPostViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"controller","qualifiedName":"add_post_view_model.AddPostViewModel.controller","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/controller.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Post body text controller.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"getImageFromGallery","qualifiedName":"add_post_view_model.AddPostViewModel.getImageFromGallery","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/getImageFromGallery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get the image from gallery.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"imageFile","qualifiedName":"add_post_view_model.AddPostViewModel.imageFile","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/imageFile.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"The image file that is to be uploaded.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"initialise","qualifiedName":"add_post_view_model.AddPostViewModel.initialise","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is usedto do initialisation of stuff in the view model.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"orgName","qualifiedName":"add_post_view_model.AddPostViewModel.orgName","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/orgName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"The organisation name.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"removeImage","qualifiedName":"add_post_view_model.AddPostViewModel.removeImage","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/removeImage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function removes the image selected.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"titleController","qualifiedName":"add_post_view_model.AddPostViewModel.titleController","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/titleController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Post title text controller.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"uploadPost","qualifiedName":"add_post_view_model.AddPostViewModel.uploadPost","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/uploadPost.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function uploads the post finally, and navigate the success message or error message in Snack Bar.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"userName","qualifiedName":"add_post_view_model.AddPostViewModel.userName","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/userName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"The Username.","enclosedBy":{"name":"AddPostViewModel","type":"class","href":"view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md"}},{"name":"app_localization","qualifiedName":"app_localization","href":"utils_app_localization/utils_app_localization-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AppLocalizations","qualifiedName":"app_localization.AppLocalizations","href":"utils_app_localization/AppLocalizations-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class provides methods to localize the application so that it can be available\nto users with different languages.","enclosedBy":{"name":"app_localization","type":"library","href":"utils_app_localization/utils_app_localization-library.md"}},{"name":"AppLocalizations","qualifiedName":"app_localization.AppLocalizations.AppLocalizations","href":"utils_app_localization/AppLocalizations/AppLocalizations.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"delegate","qualifiedName":"app_localization.AppLocalizations.delegate","href":"utils_app_localization/AppLocalizations/delegate-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"isTest","qualifiedName":"app_localization.AppLocalizations.isTest","href":"utils_app_localization/AppLocalizations/isTest.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"load","qualifiedName":"app_localization.AppLocalizations.load","href":"utils_app_localization/AppLocalizations/load.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"loadTest","qualifiedName":"app_localization.AppLocalizations.loadTest","href":"utils_app_localization/AppLocalizations/loadTest.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"locale","qualifiedName":"app_localization.AppLocalizations.locale","href":"utils_app_localization/AppLocalizations/locale.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"of","qualifiedName":"app_localization.AppLocalizations.of","href":"utils_app_localization/AppLocalizations/of.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"strictTranslate","qualifiedName":"app_localization.AppLocalizations.strictTranslate","href":"utils_app_localization/AppLocalizations/strictTranslate.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"translate","qualifiedName":"app_localization.AppLocalizations.translate","href":"utils_app_localization/AppLocalizations/translate.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizations","type":"class","href":"utils_app_localization/AppLocalizations-class.md"}},{"name":"AppLocalizationsDelegate","qualifiedName":"app_localization.AppLocalizationsDelegate","href":"utils_app_localization/AppLocalizationsDelegate-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"app_localization","type":"library","href":"utils_app_localization/utils_app_localization-library.md"}},{"name":"AppLocalizationsDelegate","qualifiedName":"app_localization.AppLocalizationsDelegate.AppLocalizationsDelegate","href":"utils_app_localization/AppLocalizationsDelegate/AppLocalizationsDelegate.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizationsDelegate","type":"class","href":"utils_app_localization/AppLocalizationsDelegate-class.md"}},{"name":"isSupported","qualifiedName":"app_localization.AppLocalizationsDelegate.isSupported","href":"utils_app_localization/AppLocalizationsDelegate/isSupported.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Whether resources for the given locale can be loaded by this delegate.","enclosedBy":{"name":"AppLocalizationsDelegate","type":"class","href":"utils_app_localization/AppLocalizationsDelegate-class.md"}},{"name":"isTest","qualifiedName":"app_localization.AppLocalizationsDelegate.isTest","href":"utils_app_localization/AppLocalizationsDelegate/isTest.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLocalizationsDelegate","type":"class","href":"utils_app_localization/AppLocalizationsDelegate-class.md"}},{"name":"load","qualifiedName":"app_localization.AppLocalizationsDelegate.load","href":"utils_app_localization/AppLocalizationsDelegate/load.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Start loading the resources for locale. The returned future completes\nwhen the resources have finished loading.","enclosedBy":{"name":"AppLocalizationsDelegate","type":"class","href":"utils_app_localization/AppLocalizationsDelegate-class.md"}},{"name":"shouldReload","qualifiedName":"app_localization.AppLocalizationsDelegate.shouldReload","href":"utils_app_localization/AppLocalizationsDelegate/shouldReload.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Returns true if the resources for this delegate should be loaded\nagain by calling the load method.","enclosedBy":{"name":"AppLocalizationsDelegate","type":"class","href":"utils_app_localization/AppLocalizationsDelegate-class.md"}},{"name":"app_settings_page","qualifiedName":"app_settings_page","href":"views_after_auth_screens_app_settings_app_settings_page/views_after_auth_screens_app_settings_app_settings_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AppSettingsPage","qualifiedName":"app_settings_page.AppSettingsPage","href":"views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"AppSettingsPage is a widget that has mutable state _AppSettingsPageState.","enclosedBy":{"name":"app_settings_page","type":"library","href":"views_after_auth_screens_app_settings_app_settings_page/views_after_auth_screens_app_settings_app_settings_page-library.md"}},{"name":"AppSettingsPage","qualifiedName":"app_settings_page.AppSettingsPage.AppSettingsPage","href":"views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/AppSettingsPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppSettingsPage","type":"class","href":"views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage-class.md"}},{"name":"createState","qualifiedName":"app_settings_page.AppSettingsPage.createState","href":"views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"AppSettingsPage","type":"class","href":"views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage-class.md"}},{"name":"apptheme","qualifiedName":"apptheme","href":"apptheme/apptheme-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AppTheme","qualifiedName":"apptheme.AppTheme","href":"apptheme/AppTheme-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"apptheme","type":"library","href":"apptheme/apptheme-library.md"}},{"name":"AppTheme","qualifiedName":"apptheme.AppTheme.AppTheme","href":"apptheme/AppTheme/AppTheme.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"blackPrimary","qualifiedName":"apptheme.AppTheme.blackPrimary","href":"apptheme/AppTheme/blackPrimary-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"blackSecondary","qualifiedName":"apptheme.AppTheme.blackSecondary","href":"apptheme/AppTheme/blackSecondary-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"blackTertiary","qualifiedName":"apptheme.AppTheme.blackTertiary","href":"apptheme/AppTheme/blackTertiary-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"blue","qualifiedName":"apptheme.AppTheme.blue","href":"apptheme/AppTheme/blue-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"bodyText1","qualifiedName":"apptheme.AppTheme.bodyText1","href":"apptheme/AppTheme/bodyText1.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"bodyText2","qualifiedName":"apptheme.AppTheme.bodyText2","href":"apptheme/AppTheme/bodyText2.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"bodyText3","qualifiedName":"apptheme.AppTheme.bodyText3","href":"apptheme/AppTheme/bodyText3.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"button","qualifiedName":"apptheme.AppTheme.button","href":"apptheme/AppTheme/button.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"green","qualifiedName":"apptheme.AppTheme.green","href":"apptheme/AppTheme/green-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"grey","qualifiedName":"apptheme.AppTheme.grey","href":"apptheme/AppTheme/grey-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"headline1","qualifiedName":"apptheme.AppTheme.headline1","href":"apptheme/AppTheme/headline1.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"headline2","qualifiedName":"apptheme.AppTheme.headline2","href":"apptheme/AppTheme/headline2.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"headline3","qualifiedName":"apptheme.AppTheme.headline3","href":"apptheme/AppTheme/headline3.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"headline4","qualifiedName":"apptheme.AppTheme.headline4","href":"apptheme/AppTheme/headline4.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"headline5","qualifiedName":"apptheme.AppTheme.headline5","href":"apptheme/AppTheme/headline5.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"headline6","qualifiedName":"apptheme.AppTheme.headline6","href":"apptheme/AppTheme/headline6.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"lightGrey","qualifiedName":"apptheme.AppTheme.lightGrey","href":"apptheme/AppTheme/lightGrey-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"overline","qualifiedName":"apptheme.AppTheme.overline","href":"apptheme/AppTheme/overline.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"primary","qualifiedName":"apptheme.AppTheme.primary","href":"apptheme/AppTheme/primary-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"red","qualifiedName":"apptheme.AppTheme.red","href":"apptheme/AppTheme/red-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"secondary","qualifiedName":"apptheme.AppTheme.secondary","href":"apptheme/AppTheme/secondary-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"shadow","qualifiedName":"apptheme.AppTheme.shadow","href":"apptheme/AppTheme/shadow-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"subtitle1","qualifiedName":"apptheme.AppTheme.subtitle1","href":"apptheme/AppTheme/subtitle1.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"subtitle2","qualifiedName":"apptheme.AppTheme.subtitle2","href":"apptheme/AppTheme/subtitle2.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"tertiary","qualifiedName":"apptheme.AppTheme.tertiary","href":"apptheme/AppTheme/tertiary-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"title","qualifiedName":"apptheme.AppTheme.title","href":"apptheme/AppTheme/title.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"white","qualifiedName":"apptheme.AppTheme.white","href":"apptheme/AppTheme/white-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"yellow","qualifiedName":"apptheme.AppTheme.yellow","href":"apptheme/AppTheme/yellow-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"apptheme/AppTheme-class.md"}},{"name":"base_view","qualifiedName":"base_view","href":"views_base_view/views_base_view-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"BaseView","qualifiedName":"base_view.BaseView","href":"views_base_view/BaseView-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"base_view","type":"library","href":"views_base_view/views_base_view-library.md"}},{"name":"BaseView","qualifiedName":"base_view.BaseView.BaseView","href":"views_base_view/BaseView/BaseView.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"BaseView","type":"class","href":"views_base_view/BaseView-class.md"}},{"name":"builder","qualifiedName":"base_view.BaseView.builder","href":"views_base_view/BaseView/builder.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"BaseView","type":"class","href":"views_base_view/BaseView-class.md"}},{"name":"createState","qualifiedName":"base_view.BaseView.createState","href":"views_base_view/BaseView/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"BaseView","type":"class","href":"views_base_view/BaseView-class.md"}},{"name":"onModelReady","qualifiedName":"base_view.BaseView.onModelReady","href":"views_base_view/BaseView/onModelReady.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"BaseView","type":"class","href":"views_base_view/BaseView-class.md"}},{"name":"base_view_model","qualifiedName":"base_view_model","href":"view_model_base_view_model/view_model_base_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"BaseModel","qualifiedName":"base_view_model.BaseModel","href":"view_model_base_view_model/BaseModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"base_view_model","type":"library","href":"view_model_base_view_model/view_model_base_view_model-library.md"}},{"name":"BaseModel","qualifiedName":"base_view_model.BaseModel.BaseModel","href":"view_model_base_view_model/BaseModel/BaseModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"BaseModel","type":"class","href":"view_model_base_view_model/BaseModel-class.md"}},{"name":"isBusy","qualifiedName":"base_view_model.BaseModel.isBusy","href":"view_model_base_view_model/BaseModel/isBusy.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"BaseModel","type":"class","href":"view_model_base_view_model/BaseModel-class.md"}},{"name":"setState","qualifiedName":"base_view_model.BaseModel.setState","href":"view_model_base_view_model/BaseModel/setState.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"BaseModel","type":"class","href":"view_model_base_view_model/BaseModel-class.md"}},{"name":"state","qualifiedName":"base_view_model.BaseModel.state","href":"view_model_base_view_model/BaseModel/state.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"BaseModel","type":"class","href":"view_model_base_view_model/BaseModel-class.md"}},{"name":"change_password","qualifiedName":"change_password","href":"views_pre_auth_screens_change_password/views_pre_auth_screens_change_password-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChangePass","qualifiedName":"change_password.ChangePass","href":"views_pre_auth_screens_change_password/ChangePass-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This widget lets the user change his/her password.\nThere are two input fields. The first one is for entering the new password, and the\nsecond one is for re-entering the password for verification.\nThere is a raised button which finally updates the password when pressed.","enclosedBy":{"name":"change_password","type":"library","href":"views_pre_auth_screens_change_password/views_pre_auth_screens_change_password-library.md"}},{"name":"ChangePass","qualifiedName":"change_password.ChangePass.ChangePass","href":"views_pre_auth_screens_change_password/ChangePass/ChangePass.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChangePass","type":"class","href":"views_pre_auth_screens_change_password/ChangePass-class.md"}},{"name":"createState","qualifiedName":"change_password.ChangePass.createState","href":"views_pre_auth_screens_change_password/ChangePass/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"ChangePass","type":"class","href":"views_pre_auth_screens_change_password/ChangePass-class.md"}},{"name":"chat_input_field","qualifiedName":"chat_input_field","href":"views_after_auth_screens_chat_widgets_chat_input_field/views_after_auth_screens_chat_widgets_chat_input_field-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatInputField","qualifiedName":"chat_input_field.ChatInputField","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ChatInputField returns a widget that has mutable state _ChatInputFieldState.","enclosedBy":{"name":"chat_input_field","type":"library","href":"views_after_auth_screens_chat_widgets_chat_input_field/views_after_auth_screens_chat_widgets_chat_input_field-library.md"}},{"name":"ChatInputField","qualifiedName":"chat_input_field.ChatInputField.ChatInputField","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/ChatInputField.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatInputField","type":"class","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md"}},{"name":"chatId","qualifiedName":"chat_input_field.ChatInputField.chatId","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/chatId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"ChatId.","enclosedBy":{"name":"ChatInputField","type":"class","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md"}},{"name":"createState","qualifiedName":"chat_input_field.ChatInputField.createState","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"ChatInputField","type":"class","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md"}},{"name":"model","qualifiedName":"chat_input_field.ChatInputField.model","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/model.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"DirectChatViewModel instance.","enclosedBy":{"name":"ChatInputField","type":"class","href":"views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md"}},{"name":"chat_list_screen","qualifiedName":"chat_list_screen","href":"views_after_auth_screens_chat_chat_list_screen/views_after_auth_screens_chat_chat_list_screen-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatPage","qualifiedName":"chat_list_screen.ChatPage","href":"views_after_auth_screens_chat_chat_list_screen/ChatPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ChatPage returns a stateless widget for current user Chat Page which renders\nthe list of all the users that the current user has chat with.","enclosedBy":{"name":"chat_list_screen","type":"library","href":"views_after_auth_screens_chat_chat_list_screen/views_after_auth_screens_chat_chat_list_screen-library.md"}},{"name":"ChatPage","qualifiedName":"chat_list_screen.ChatPage.ChatPage","href":"views_after_auth_screens_chat_chat_list_screen/ChatPage/ChatPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatPage","type":"class","href":"views_after_auth_screens_chat_chat_list_screen/ChatPage-class.md"}},{"name":"build","qualifiedName":"chat_list_screen.ChatPage.build","href":"views_after_auth_screens_chat_chat_list_screen/ChatPage/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"ChatPage","type":"class","href":"views_after_auth_screens_chat_chat_list_screen/ChatPage-class.md"}},{"name":"chat_list_tile_data_model","qualifiedName":"chat_list_tile_data_model","href":"models_chats_chat_list_tile_data_model/models_chats_chat_list_tile_data_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatListTileDataModel","qualifiedName":"chat_list_tile_data_model.ChatListTileDataModel","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates JSON code using the JsonSerializable package.","enclosedBy":{"name":"chat_list_tile_data_model","type":"library","href":"models_chats_chat_list_tile_data_model/models_chats_chat_list_tile_data_model-library.md"}},{"name":"ChatListTileDataModel","qualifiedName":"chat_list_tile_data_model.ChatListTileDataModel.ChatListTileDataModel","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatListTileDataModel","type":"class","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md"}},{"name":"ChatListTileDataModel.fromJson","qualifiedName":"chat_list_tile_data_model.ChatListTileDataModel.fromJson","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatListTileDataModel","type":"class","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md"}},{"name":"id","qualifiedName":"chat_list_tile_data_model.ChatListTileDataModel.id","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel/id.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatListTileDataModel","type":"class","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md"}},{"name":"toJson","qualifiedName":"chat_list_tile_data_model.ChatListTileDataModel.toJson","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel/toJson.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatListTileDataModel","type":"class","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md"}},{"name":"users","qualifiedName":"chat_list_tile_data_model.ChatListTileDataModel.users","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel/users.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatListTileDataModel","type":"class","href":"models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md"}},{"name":"chat_message","qualifiedName":"chat_message","href":"models_chats_chat_message/models_chats_chat_message-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatMessage","qualifiedName":"chat_message.ChatMessage","href":"models_chats_chat_message/ChatMessage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates JSON code for chat message using the JsonSerializable package.","enclosedBy":{"name":"chat_message","type":"library","href":"models_chats_chat_message/models_chats_chat_message-library.md"}},{"name":"ChatMessage","qualifiedName":"chat_message.ChatMessage.ChatMessage","href":"models_chats_chat_message/ChatMessage/ChatMessage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessage","type":"class","href":"models_chats_chat_message/ChatMessage-class.md"}},{"name":"ChatMessage.fromJson","qualifiedName":"chat_message.ChatMessage.fromJson","href":"models_chats_chat_message/ChatMessage/ChatMessage.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessage","type":"class","href":"models_chats_chat_message/ChatMessage-class.md"}},{"name":"id","qualifiedName":"chat_message.ChatMessage.id","href":"models_chats_chat_message/ChatMessage/id.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessage","type":"class","href":"models_chats_chat_message/ChatMessage-class.md"}},{"name":"messageContent","qualifiedName":"chat_message.ChatMessage.messageContent","href":"models_chats_chat_message/ChatMessage/messageContent.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessage","type":"class","href":"models_chats_chat_message/ChatMessage-class.md"}},{"name":"receiver","qualifiedName":"chat_message.ChatMessage.receiver","href":"models_chats_chat_message/ChatMessage/receiver.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessage","type":"class","href":"models_chats_chat_message/ChatMessage-class.md"}},{"name":"sender","qualifiedName":"chat_message.ChatMessage.sender","href":"models_chats_chat_message/ChatMessage/sender.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessage","type":"class","href":"models_chats_chat_message/ChatMessage-class.md"}},{"name":"toJson","qualifiedName":"chat_message.ChatMessage.toJson","href":"models_chats_chat_message/ChatMessage/toJson.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessage","type":"class","href":"models_chats_chat_message/ChatMessage-class.md"}},{"name":"chat_message_bubble","qualifiedName":"chat_message_bubble","href":"views_after_auth_screens_chat_widgets_chat_message_bubble/views_after_auth_screens_chat_widgets_chat_message_bubble-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Message","qualifiedName":"chat_message_bubble.Message","href":"views_after_auth_screens_chat_widgets_chat_message_bubble/Message-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Message returns a widget for chat message in the bubble form.","enclosedBy":{"name":"chat_message_bubble","type":"library","href":"views_after_auth_screens_chat_widgets_chat_message_bubble/views_after_auth_screens_chat_widgets_chat_message_bubble-library.md"}},{"name":"Message","qualifiedName":"chat_message_bubble.Message.Message","href":"views_after_auth_screens_chat_widgets_chat_message_bubble/Message/Message.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Message","type":"class","href":"views_after_auth_screens_chat_widgets_chat_message_bubble/Message-class.md"}},{"name":"build","qualifiedName":"chat_message_bubble.Message.build","href":"views_after_auth_screens_chat_widgets_chat_message_bubble/Message/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"Message","type":"class","href":"views_after_auth_screens_chat_widgets_chat_message_bubble/Message-class.md"}},{"name":"chat_message_screen","qualifiedName":"chat_message_screen","href":"views_after_auth_screens_chat_chat_message_screen/views_after_auth_screens_chat_chat_message_screen-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatMessageScreen","qualifiedName":"chat_message_screen.ChatMessageScreen","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ChatMessageScreen returns a StatelessWidget for showing the chat message screen.","enclosedBy":{"name":"chat_message_screen","type":"library","href":"views_after_auth_screens_chat_chat_message_screen/views_after_auth_screens_chat_chat_message_screen-library.md"}},{"name":"ChatMessageScreen","qualifiedName":"chat_message_screen.ChatMessageScreen.ChatMessageScreen","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/ChatMessageScreen.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessageScreen","type":"class","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md"}},{"name":"build","qualifiedName":"chat_message_screen.ChatMessageScreen.build","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"ChatMessageScreen","type":"class","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md"}},{"name":"chatId","qualifiedName":"chat_message_screen.ChatMessageScreen.chatId","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/chatId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessageScreen","type":"class","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md"}},{"name":"model","qualifiedName":"chat_message_screen.ChatMessageScreen.model","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/model.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatMessageScreen","type":"class","href":"views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md"}},{"name":"chat_queries","qualifiedName":"chat_queries","href":"utils_chat_queries/utils_chat_queries-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatQueries","qualifiedName":"chat_queries.ChatQueries","href":"utils_chat_queries/ChatQueries-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates the queries dealing with chats.","enclosedBy":{"name":"chat_queries","type":"library","href":"utils_chat_queries/utils_chat_queries-library.md"}},{"name":"ChatQueries","qualifiedName":"chat_queries.ChatQueries.ChatQueries","href":"utils_chat_queries/ChatQueries/ChatQueries.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatQueries","type":"class","href":"utils_chat_queries/ChatQueries-class.md"}},{"name":"fetchDirectChatMessagesByChatId","qualifiedName":"chat_queries.ChatQueries.fetchDirectChatMessagesByChatId","href":"utils_chat_queries/ChatQueries/fetchDirectChatMessagesByChatId.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatQueries","type":"class","href":"utils_chat_queries/ChatQueries-class.md"}},{"name":"fetchDirectChatsByUserId","qualifiedName":"chat_queries.ChatQueries.fetchDirectChatsByUserId","href":"utils_chat_queries/ChatQueries/fetchDirectChatsByUserId.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatQueries","type":"class","href":"utils_chat_queries/ChatQueries-class.md"}},{"name":"messageSentToDirectChatsubscription","qualifiedName":"chat_queries.ChatQueries.messageSentToDirectChatsubscription","href":"utils_chat_queries/ChatQueries/messageSentToDirectChatsubscription.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatQueries","type":"class","href":"utils_chat_queries/ChatQueries-class.md"}},{"name":"sendMessageToDirectChat","qualifiedName":"chat_queries.ChatQueries.sendMessageToDirectChat","href":"utils_chat_queries/ChatQueries/sendMessageToDirectChat.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatQueries","type":"class","href":"utils_chat_queries/ChatQueries-class.md"}},{"name":"chat_service","qualifiedName":"chat_service","href":"services_chat_service/services_chat_service-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatService","qualifiedName":"chat_service.ChatService","href":"services_chat_service/ChatService-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ChatService class provides different services for direct chats of the user.","enclosedBy":{"name":"chat_service","type":"library","href":"services_chat_service/services_chat_service-library.md"}},{"name":"ChatService","qualifiedName":"chat_service.ChatService.ChatService","href":"services_chat_service/ChatService/ChatService.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatService","type":"class","href":"services_chat_service/ChatService-class.md"}},{"name":"chatListStream","qualifiedName":"chat_service.ChatService.chatListStream","href":"services_chat_service/ChatService/chatListStream.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatService","type":"class","href":"services_chat_service/ChatService-class.md"}},{"name":"chatMessagesStream","qualifiedName":"chat_service.ChatService.chatMessagesStream","href":"services_chat_service/ChatService/chatMessagesStream.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatService","type":"class","href":"services_chat_service/ChatService-class.md"}},{"name":"chatStream","qualifiedName":"chat_service.ChatService.chatStream","href":"services_chat_service/ChatService/chatStream.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatService","type":"class","href":"services_chat_service/ChatService-class.md"}},{"name":"getDirectChatMessagesByChatId","qualifiedName":"chat_service.ChatService.getDirectChatMessagesByChatId","href":"services_chat_service/ChatService/getDirectChatMessagesByChatId.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get all the chat messages of a particular chat by the user.","enclosedBy":{"name":"ChatService","type":"class","href":"services_chat_service/ChatService-class.md"}},{"name":"getDirectChatsByUserId","qualifiedName":"chat_service.ChatService.getDirectChatsByUserId","href":"services_chat_service/ChatService/getDirectChatsByUserId.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get all the chats by the user.","enclosedBy":{"name":"ChatService","type":"class","href":"services_chat_service/ChatService-class.md"}},{"name":"sendMessageToDirectChat","qualifiedName":"chat_service.ChatService.sendMessageToDirectChat","href":"services_chat_service/ChatService/sendMessageToDirectChat.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to send the message in the direct chats.","enclosedBy":{"name":"ChatService","type":"class","href":"services_chat_service/ChatService-class.md"}},{"name":"chat_user","qualifiedName":"chat_user","href":"models_chats_chat_user/models_chats_chat_user-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatUser","qualifiedName":"chat_user.ChatUser","href":"models_chats_chat_user/ChatUser-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates JSON code for chat user using the JsonSerializable package.","enclosedBy":{"name":"chat_user","type":"library","href":"models_chats_chat_user/models_chats_chat_user-library.md"}},{"name":"ChatUser","qualifiedName":"chat_user.ChatUser.ChatUser","href":"models_chats_chat_user/ChatUser/ChatUser.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatUser","type":"class","href":"models_chats_chat_user/ChatUser-class.md"}},{"name":"firstName","qualifiedName":"chat_user.ChatUser.firstName","href":"models_chats_chat_user/ChatUser/firstName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatUser","type":"class","href":"models_chats_chat_user/ChatUser-class.md"}},{"name":"ChatUser.fromJson","qualifiedName":"chat_user.ChatUser.fromJson","href":"models_chats_chat_user/ChatUser/ChatUser.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatUser","type":"class","href":"models_chats_chat_user/ChatUser-class.md"}},{"name":"id","qualifiedName":"chat_user.ChatUser.id","href":"models_chats_chat_user/ChatUser/id.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatUser","type":"class","href":"models_chats_chat_user/ChatUser-class.md"}},{"name":"image","qualifiedName":"chat_user.ChatUser.image","href":"models_chats_chat_user/ChatUser/image.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatUser","type":"class","href":"models_chats_chat_user/ChatUser-class.md"}},{"name":"toJson","qualifiedName":"chat_user.ChatUser.toJson","href":"models_chats_chat_user/ChatUser/toJson.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatUser","type":"class","href":"models_chats_chat_user/ChatUser-class.md"}},{"name":"comment_model","qualifiedName":"comment_model","href":"models_comment_comment_model/models_comment_comment_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Comment","qualifiedName":"comment_model.Comment","href":"models_comment_comment_model/Comment-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class returns a Comment instance.","enclosedBy":{"name":"comment_model","type":"library","href":"models_comment_comment_model/models_comment_comment_model-library.md"}},{"name":"Comment","qualifiedName":"comment_model.Comment.Comment","href":"models_comment_comment_model/Comment/Comment.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Comment","type":"class","href":"models_comment_comment_model/Comment-class.md"}},{"name":"createdAt","qualifiedName":"comment_model.Comment.createdAt","href":"models_comment_comment_model/Comment/createdAt.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Comment","type":"class","href":"models_comment_comment_model/Comment-class.md"}},{"name":"creator","qualifiedName":"comment_model.Comment.creator","href":"models_comment_comment_model/Comment/creator.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Comment","type":"class","href":"models_comment_comment_model/Comment-class.md"}},{"name":"Comment.fromJson","qualifiedName":"comment_model.Comment.fromJson","href":"models_comment_comment_model/Comment/Comment.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Comment","type":"class","href":"models_comment_comment_model/Comment-class.md"}},{"name":"likeCount","qualifiedName":"comment_model.Comment.likeCount","href":"models_comment_comment_model/Comment/likeCount.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Comment","type":"class","href":"models_comment_comment_model/Comment-class.md"}},{"name":"post","qualifiedName":"comment_model.Comment.post","href":"models_comment_comment_model/Comment/post.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Comment","type":"class","href":"models_comment_comment_model/Comment-class.md"}},{"name":"text","qualifiedName":"comment_model.Comment.text","href":"models_comment_comment_model/Comment/text.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Comment","type":"class","href":"models_comment_comment_model/Comment-class.md"}},{"name":"comment_queries","qualifiedName":"comment_queries","href":"utils_comment_queries/utils_comment_queries-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CommentQueries","qualifiedName":"comment_queries.CommentQueries","href":"utils_comment_queries/CommentQueries-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates the queries dealing with comments.","enclosedBy":{"name":"comment_queries","type":"library","href":"utils_comment_queries/utils_comment_queries-library.md"}},{"name":"CommentQueries","qualifiedName":"comment_queries.CommentQueries.CommentQueries","href":"utils_comment_queries/CommentQueries/CommentQueries.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentQueries","type":"class","href":"utils_comment_queries/CommentQueries-class.md"}},{"name":"createComment","qualifiedName":"comment_queries.CommentQueries.createComment","href":"utils_comment_queries/CommentQueries/createComment.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentQueries","type":"class","href":"utils_comment_queries/CommentQueries-class.md"}},{"name":"getPostsComments","qualifiedName":"comment_queries.CommentQueries.getPostsComments","href":"utils_comment_queries/CommentQueries/getPostsComments.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentQueries","type":"class","href":"utils_comment_queries/CommentQueries-class.md"}},{"name":"comment_service","qualifiedName":"comment_service","href":"services_comment_service/services_comment_service-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CommentService","qualifiedName":"comment_service.CommentService","href":"services_comment_service/CommentService-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CommentService class have different member functions which provides service in the context of commenting.","enclosedBy":{"name":"comment_service","type":"library","href":"services_comment_service/services_comment_service-library.md"}},{"name":"CommentService","qualifiedName":"comment_service.CommentService.CommentService","href":"services_comment_service/CommentService/CommentService.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentService","type":"class","href":"services_comment_service/CommentService-class.md"}},{"name":"createComments","qualifiedName":"comment_service.CommentService.createComments","href":"services_comment_service/CommentService/createComments.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to add comment on the post.","enclosedBy":{"name":"CommentService","type":"class","href":"services_comment_service/CommentService-class.md"}},{"name":"getCommentsForPost","qualifiedName":"comment_service.CommentService.getCommentsForPost","href":"services_comment_service/CommentService/getCommentsForPost.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to fetch all comments on the post.","enclosedBy":{"name":"CommentService","type":"class","href":"services_comment_service/CommentService-class.md"}},{"name":"comments_view_model","qualifiedName":"comments_view_model","href":"view_model_widgets_view_models_comments_view_model/view_model_widgets_view_models_comments_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CommentsViewModel","qualifiedName":"comments_view_model.CommentsViewModel","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CommentsViewModel class helps to serve the data from model\nand to react to user's input for Comment Widget.","enclosedBy":{"name":"comments_view_model","type":"library","href":"view_model_widgets_view_models_comments_view_model/view_model_widgets_view_models_comments_view_model-library.md"}},{"name":"CommentsViewModel","qualifiedName":"comments_view_model.CommentsViewModel.CommentsViewModel","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel/CommentsViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentsViewModel","type":"class","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md"}},{"name":"addCommentLocally","qualifiedName":"comments_view_model.CommentsViewModel.addCommentLocally","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel/addCommentLocally.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentsViewModel","type":"class","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md"}},{"name":"commentList","qualifiedName":"comments_view_model.CommentsViewModel.commentList","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel/commentList.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentsViewModel","type":"class","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md"}},{"name":"createComment","qualifiedName":"comments_view_model.CommentsViewModel.createComment","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel/createComment.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function add comment on the post.\nThe function uses createComments method provided by Comment Service.","enclosedBy":{"name":"CommentsViewModel","type":"class","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md"}},{"name":"getComments","qualifiedName":"comments_view_model.CommentsViewModel.getComments","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel/getComments.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This methods fetch all comments on the post.\nThe function uses getCommentsForPost method by Comment Service.","enclosedBy":{"name":"CommentsViewModel","type":"class","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md"}},{"name":"initialise","qualifiedName":"comments_view_model.CommentsViewModel.initialise","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentsViewModel","type":"class","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md"}},{"name":"postId","qualifiedName":"comments_view_model.CommentsViewModel.postId","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel/postId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentsViewModel","type":"class","href":"view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md"}},{"name":"constants","qualifiedName":"constants","href":"constants_constants/constants_constants-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"languages","qualifiedName":"constants.languages","href":"constants_constants/languages.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"This file contains the prototypes of all the languages available and supported currencies.","enclosedBy":{"name":"constants","type":"library","href":"constants_constants/constants_constants-library.md"}},{"name":"supportedCurrencies","qualifiedName":"constants.supportedCurrencies","href":"constants_constants/supportedCurrencies.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"constants","type":"library","href":"constants_constants/constants_constants-library.md"}},{"name":"create_event_form","qualifiedName":"create_event_form","href":"views_after_auth_screens_events_create_event_form/views_after_auth_screens_events_create_event_form-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CreateEventForm","qualifiedName":"create_event_form.CreateEventForm","href":"views_after_auth_screens_events_create_event_form/CreateEventForm-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CreateEventForm returns a widget of a Form for creating events in the organization.\nThis widget is used in CreateEventPage widget.","enclosedBy":{"name":"create_event_form","type":"library","href":"views_after_auth_screens_events_create_event_form/views_after_auth_screens_events_create_event_form-library.md"}},{"name":"CreateEventForm","qualifiedName":"create_event_form.CreateEventForm.CreateEventForm","href":"views_after_auth_screens_events_create_event_form/CreateEventForm/CreateEventForm.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateEventForm","type":"class","href":"views_after_auth_screens_events_create_event_form/CreateEventForm-class.md"}},{"name":"build","qualifiedName":"create_event_form.CreateEventForm.build","href":"views_after_auth_screens_events_create_event_form/CreateEventForm/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CreateEventForm","type":"class","href":"views_after_auth_screens_events_create_event_form/CreateEventForm-class.md"}},{"name":"model","qualifiedName":"create_event_form.CreateEventForm.model","href":"views_after_auth_screens_events_create_event_form/CreateEventForm/model.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateEventForm","type":"class","href":"views_after_auth_screens_events_create_event_form/CreateEventForm-class.md"}},{"name":"create_event_page","qualifiedName":"create_event_page","href":"views_after_auth_screens_events_create_event_page/views_after_auth_screens_events_create_event_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CreateEventPage","qualifiedName":"create_event_page.CreateEventPage","href":"views_after_auth_screens_events_create_event_page/CreateEventPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CreateEventPage returns a widget that has mutable state _CreateEventPageState.","enclosedBy":{"name":"create_event_page","type":"library","href":"views_after_auth_screens_events_create_event_page/views_after_auth_screens_events_create_event_page-library.md"}},{"name":"CreateEventPage","qualifiedName":"create_event_page.CreateEventPage.CreateEventPage","href":"views_after_auth_screens_events_create_event_page/CreateEventPage/CreateEventPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateEventPage","type":"class","href":"views_after_auth_screens_events_create_event_page/CreateEventPage-class.md"}},{"name":"createState","qualifiedName":"create_event_page.CreateEventPage.createState","href":"views_after_auth_screens_events_create_event_page/CreateEventPage/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"CreateEventPage","type":"class","href":"views_after_auth_screens_events_create_event_page/CreateEventPage-class.md"}},{"name":"create_event_view_model","qualifiedName":"create_event_view_model","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/view_model_after_auth_view_models_event_view_models_create_event_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CreateEventViewModel","qualifiedName":"create_event_view_model.CreateEventViewModel","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CreateEventViewModel class have methods to interact with model in.","enclosedBy":{"name":"create_event_view_model","type":"library","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/view_model_after_auth_view_models_event_view_models_create_event_view_model-library.md"}},{"name":"CreateEventViewModel","qualifiedName":"create_event_view_model.CreateEventViewModel.CreateEventViewModel","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/CreateEventViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"buildUserList","qualifiedName":"create_event_view_model.CreateEventViewModel.buildUserList","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/buildUserList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function build the user list.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"createEvent","qualifiedName":"create_event_view_model.CreateEventViewModel.createEvent","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/createEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to create the event for the organization.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"descriptionFocus","qualifiedName":"create_event_view_model.CreateEventViewModel.descriptionFocus","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/descriptionFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"DescriptionFocus FocusNode.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"eventDescriptionTextController","qualifiedName":"create_event_view_model.CreateEventViewModel.eventDescriptionTextController","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventDescriptionTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Event Description Text Controller.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"eventEndDate","qualifiedName":"create_event_view_model.CreateEventViewModel.eventEndDate","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndDate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Event End Date.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"eventEndTime","qualifiedName":"create_event_view_model.CreateEventViewModel.eventEndTime","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndTime.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Event End Time.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"eventLocationTextController","qualifiedName":"create_event_view_model.CreateEventViewModel.eventLocationTextController","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventLocationTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Event Location Text Controller.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"eventStartDate","qualifiedName":"create_event_view_model.CreateEventViewModel.eventStartDate","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartDate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Event Start Date.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"eventStartTime","qualifiedName":"create_event_view_model.CreateEventViewModel.eventStartTime","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartTime.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Event Start Time.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"eventTitleTextController","qualifiedName":"create_event_view_model.CreateEventViewModel.eventTitleTextController","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventTitleTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Event Title Text Controller.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"formKey","qualifiedName":"create_event_view_model.CreateEventViewModel.formKey","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/formKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Global FormKey.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"getCurrentOrgUsersList","qualifiedName":"create_event_view_model.CreateEventViewModel.getCurrentOrgUsersList","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getCurrentOrgUsersList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function fetch all the users in the current organization and return List.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"getImageFromGallery","qualifiedName":"create_event_view_model.CreateEventViewModel.getImageFromGallery","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getImageFromGallery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get the image from gallery.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"imageFile","qualifiedName":"create_event_view_model.CreateEventViewModel.imageFile","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/imageFile.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Getter to return imageFile.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"initialize","qualifiedName":"create_event_view_model.CreateEventViewModel.initialize","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Function To Initialize.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"isPublicSwitch","qualifiedName":"create_event_view_model.CreateEventViewModel.isPublicSwitch","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isPublicSwitch.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Public Event or Not.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"isRegisterableSwitch","qualifiedName":"create_event_view_model.CreateEventViewModel.isRegisterableSwitch","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isRegisterableSwitch.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"If event is registerable after creation.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"latitude","qualifiedName":"create_event_view_model.CreateEventViewModel.latitude","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/latitude.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Latitude store.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"locationFocus","qualifiedName":"create_event_view_model.CreateEventViewModel.locationFocus","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/locationFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"LocationFocus FocusNode.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"longitude","qualifiedName":"create_event_view_model.CreateEventViewModel.longitude","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/longitude.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Longitude store.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"memberCheckedMap","qualifiedName":"create_event_view_model.CreateEventViewModel.memberCheckedMap","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/memberCheckedMap.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Getter to return members map.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"orgMembersList","qualifiedName":"create_event_view_model.CreateEventViewModel.orgMembersList","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/orgMembersList.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Organisation Members List.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"removeImage","qualifiedName":"create_event_view_model.CreateEventViewModel.removeImage","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeImage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function remove the selected image.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"removeUserFromList","qualifiedName":"create_event_view_model.CreateEventViewModel.removeUserFromList","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeUserFromList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to remove a user from user's list.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"selectedMembers","qualifiedName":"create_event_view_model.CreateEventViewModel.selectedMembers","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/selectedMembers.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Getter to return selected members.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"titleFocus","qualifiedName":"create_event_view_model.CreateEventViewModel.titleFocus","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/titleFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"TitleFocus FocusNode.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"validate","qualifiedName":"create_event_view_model.CreateEventViewModel.validate","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/validate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"AutoValidateMode default to disabled.","enclosedBy":{"name":"CreateEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md"}},{"name":"create_task_page","qualifiedName":"create_task_page","href":"views_after_auth_screens_tasks_create_task_page/views_after_auth_screens_tasks_create_task_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CreateTaskPage","qualifiedName":"create_task_page.CreateTaskPage","href":"views_after_auth_screens_tasks_create_task_page/CreateTaskPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CreateTaskPage returns a widget for page to create task for the user.","enclosedBy":{"name":"create_task_page","type":"library","href":"views_after_auth_screens_tasks_create_task_page/views_after_auth_screens_tasks_create_task_page-library.md"}},{"name":"CreateTaskPage","qualifiedName":"create_task_page.CreateTaskPage.CreateTaskPage","href":"views_after_auth_screens_tasks_create_task_page/CreateTaskPage/CreateTaskPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateTaskPage","type":"class","href":"views_after_auth_screens_tasks_create_task_page/CreateTaskPage-class.md"}},{"name":"build","qualifiedName":"create_task_page.CreateTaskPage.build","href":"views_after_auth_screens_tasks_create_task_page/CreateTaskPage/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CreateTaskPage","type":"class","href":"views_after_auth_screens_tasks_create_task_page/CreateTaskPage-class.md"}},{"name":"eventId","qualifiedName":"create_task_page.CreateTaskPage.eventId","href":"views_after_auth_screens_tasks_create_task_page/CreateTaskPage/eventId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateTaskPage","type":"class","href":"views_after_auth_screens_tasks_create_task_page/CreateTaskPage-class.md"}},{"name":"create_task_view_model","qualifiedName":"create_task_view_model","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/view_model_after_auth_view_models_task_view_models_create_task_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CreateTaskViewModel","qualifiedName":"create_task_view_model.CreateTaskViewModel","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CreateTaskViewModel class helps to interact with model to serve data\nand react to user's input in Create Task view.","enclosedBy":{"name":"create_task_view_model","type":"library","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/view_model_after_auth_view_models_task_view_models_create_task_view_model-library.md"}},{"name":"CreateTaskViewModel","qualifiedName":"create_task_view_model.CreateTaskViewModel.CreateTaskViewModel","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/CreateTaskViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"createTask","qualifiedName":"create_task_view_model.CreateTaskViewModel.createTask","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/createTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function creates a new task for an event.\nThe function uses createTask method provided by Task Services.","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"dispose","qualifiedName":"create_task_view_model.CreateTaskViewModel.dispose","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/dispose.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Discards any resources used by the object. After this is called, the\nobject is not in a usable state and should be discarded (calls to\naddListener will throw after the object is disposed).","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"editTask","qualifiedName":"create_task_view_model.CreateTaskViewModel.editTask","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/editTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function updates the task.\nThe function uses editTask method provided by Task Services.","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"fillTask","qualifiedName":"create_task_view_model.CreateTaskViewModel.fillTask","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/fillTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This functions fills the task controller data.","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"taskDescriptionTextController","qualifiedName":"create_task_view_model.CreateTaskViewModel.taskDescriptionTextController","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskDescriptionTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"taskEndDate","qualifiedName":"create_task_view_model.CreateTaskViewModel.taskEndDate","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndDate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"taskEndTime","qualifiedName":"create_task_view_model.CreateTaskViewModel.taskEndTime","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndTime.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"taskTitleTextController","qualifiedName":"create_task_view_model.CreateTaskViewModel.taskTitleTextController","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskTitleTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CreateTaskViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md"}},{"name":"custom_alert_dialog","qualifiedName":"custom_alert_dialog","href":"widgets_custom_alert_dialog/widgets_custom_alert_dialog-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CustomAlertDialog","qualifiedName":"custom_alert_dialog.CustomAlertDialog","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This Class returns CustomAlertDialog widget. Custom Alert Dialog is a popup\nthat appeared in the screen showing Alert message along with the event buttons.\nThis extends stateless widget that means it cannot change its state during the\nruntime of a application.","enclosedBy":{"name":"custom_alert_dialog","type":"library","href":"widgets_custom_alert_dialog/widgets_custom_alert_dialog-library.md"}},{"name":"CustomAlertDialog","qualifiedName":"custom_alert_dialog.CustomAlertDialog.CustomAlertDialog","href":"widgets_custom_alert_dialog/CustomAlertDialog/CustomAlertDialog.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"build","qualifiedName":"custom_alert_dialog.CustomAlertDialog.build","href":"widgets_custom_alert_dialog/CustomAlertDialog/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"dialogSubTitle","qualifiedName":"custom_alert_dialog.CustomAlertDialog.dialogSubTitle","href":"widgets_custom_alert_dialog/CustomAlertDialog/dialogSubTitle.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"dialogTitle","qualifiedName":"custom_alert_dialog.CustomAlertDialog.dialogTitle","href":"widgets_custom_alert_dialog/CustomAlertDialog/dialogTitle.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"reverse","qualifiedName":"custom_alert_dialog.CustomAlertDialog.reverse","href":"widgets_custom_alert_dialog/CustomAlertDialog/reverse.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"secondaryButtonTap","qualifiedName":"custom_alert_dialog.CustomAlertDialog.secondaryButtonTap","href":"widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonTap.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"secondaryButtonText","qualifiedName":"custom_alert_dialog.CustomAlertDialog.secondaryButtonText","href":"widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonText.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"success","qualifiedName":"custom_alert_dialog.CustomAlertDialog.success","href":"widgets_custom_alert_dialog/CustomAlertDialog/success.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"successText","qualifiedName":"custom_alert_dialog.CustomAlertDialog.successText","href":"widgets_custom_alert_dialog/CustomAlertDialog/successText.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAlertDialog","type":"class","href":"widgets_custom_alert_dialog/CustomAlertDialog-class.md"}},{"name":"custom_avatar","qualifiedName":"custom_avatar","href":"widgets_custom_avatar/widgets_custom_avatar-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CustomAvatar","qualifiedName":"custom_avatar.CustomAvatar","href":"widgets_custom_avatar/CustomAvatar-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Creates a custom avatar.\nThe avatar is created using the image provided,\nor the first alphabet with a standard background color.","enclosedBy":{"name":"custom_avatar","type":"library","href":"widgets_custom_avatar/widgets_custom_avatar-library.md"}},{"name":"CustomAvatar","qualifiedName":"custom_avatar.CustomAvatar.CustomAvatar","href":"widgets_custom_avatar/CustomAvatar/CustomAvatar.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAvatar","type":"class","href":"widgets_custom_avatar/CustomAvatar-class.md"}},{"name":"build","qualifiedName":"custom_avatar.CustomAvatar.build","href":"widgets_custom_avatar/CustomAvatar/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CustomAvatar","type":"class","href":"widgets_custom_avatar/CustomAvatar-class.md"}},{"name":"cacheManager","qualifiedName":"custom_avatar.CustomAvatar.cacheManager","href":"widgets_custom_avatar/CustomAvatar/cacheManager.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAvatar","type":"class","href":"widgets_custom_avatar/CustomAvatar-class.md"}},{"name":"firstAlphabet","qualifiedName":"custom_avatar.CustomAvatar.firstAlphabet","href":"widgets_custom_avatar/CustomAvatar/firstAlphabet.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAvatar","type":"class","href":"widgets_custom_avatar/CustomAvatar-class.md"}},{"name":"fontSize","qualifiedName":"custom_avatar.CustomAvatar.fontSize","href":"widgets_custom_avatar/CustomAvatar/fontSize.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAvatar","type":"class","href":"widgets_custom_avatar/CustomAvatar-class.md"}},{"name":"imageUrl","qualifiedName":"custom_avatar.CustomAvatar.imageUrl","href":"widgets_custom_avatar/CustomAvatar/imageUrl.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAvatar","type":"class","href":"widgets_custom_avatar/CustomAvatar-class.md"}},{"name":"isImageNull","qualifiedName":"custom_avatar.CustomAvatar.isImageNull","href":"widgets_custom_avatar/CustomAvatar/isImageNull.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomAvatar","type":"class","href":"widgets_custom_avatar/CustomAvatar-class.md"}},{"name":"custom_drawer","qualifiedName":"custom_drawer","href":"widgets_custom_drawer/widgets_custom_drawer-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CustomDrawer","qualifiedName":"custom_drawer.CustomDrawer","href":"widgets_custom_drawer/CustomDrawer-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Creates a custom drawer for switching organizations.","enclosedBy":{"name":"custom_drawer","type":"library","href":"widgets_custom_drawer/widgets_custom_drawer-library.md"}},{"name":"CustomDrawer","qualifiedName":"custom_drawer.CustomDrawer.CustomDrawer","href":"widgets_custom_drawer/CustomDrawer/CustomDrawer.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomDrawer","type":"class","href":"widgets_custom_drawer/CustomDrawer-class.md"}},{"name":"build","qualifiedName":"custom_drawer.CustomDrawer.build","href":"widgets_custom_drawer/CustomDrawer/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CustomDrawer","type":"class","href":"widgets_custom_drawer/CustomDrawer-class.md"}},{"name":"exitButton","qualifiedName":"custom_drawer.CustomDrawer.exitButton","href":"widgets_custom_drawer/CustomDrawer/exitButton.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Button to exit the organization.","enclosedBy":{"name":"CustomDrawer","type":"class","href":"widgets_custom_drawer/CustomDrawer-class.md"}},{"name":"homeModel","qualifiedName":"custom_drawer.CustomDrawer.homeModel","href":"widgets_custom_drawer/CustomDrawer/homeModel.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"home model.","enclosedBy":{"name":"CustomDrawer","type":"class","href":"widgets_custom_drawer/CustomDrawer-class.md"}},{"name":"custom_drawer_view_model","qualifiedName":"custom_drawer_view_model","href":"view_model_widgets_view_models_custom_drawer_view_model/view_model_widgets_view_models_custom_drawer_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CustomDrawerViewModel","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CustomDrawerViewModel class helps to serve the data and\nto react to user's input for Custom Dialog Widget.","enclosedBy":{"name":"custom_drawer_view_model","type":"library","href":"view_model_widgets_view_models_custom_drawer_view_model/view_model_widgets_view_models_custom_drawer_view_model-library.md"}},{"name":"CustomDrawerViewModel","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.CustomDrawerViewModel","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/CustomDrawerViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"controller","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.controller","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/controller.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"dispose","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.dispose","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/dispose.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Discards any resources used by the object. After this is called, the\nobject is not in a usable state and should be discarded (calls to\naddListener will throw after the object is disposed).","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"initialize","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.initialize","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"isPresentinSwitchableOrg","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.isPresentinSwitchableOrg","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/isPresentinSwitchableOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function checks switchOrg is present in the switchAbleOrg.","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"notifyListeners","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.notifyListeners","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/notifyListeners.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Call all the registered listeners.","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"selectedOrg","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.selectedOrg","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/selectedOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"setSelectedOrganizationName","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.setSelectedOrganizationName","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/setSelectedOrganizationName.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function switches the current organization to new organization.","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"switchAbleOrg","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.switchAbleOrg","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchAbleOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"switchOrg","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.switchOrg","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function switch the current organization to another organization,\nif the organization(want switch to) is present.","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"targets","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.targets","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/targets.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"tutorialCoachMark","qualifiedName":"custom_drawer_view_model.CustomDrawerViewModel.tutorialCoachMark","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/tutorialCoachMark.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomDrawerViewModel","type":"class","href":"view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md"}},{"name":"custom_list_tile","qualifiedName":"custom_list_tile","href":"widgets_custom_list_tile/widgets_custom_list_tile-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CustomListTile","qualifiedName":"custom_list_tile.CustomListTile","href":"widgets_custom_list_tile/CustomListTile-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Returns a widget for rendering Customized tiles.\nA Tile shows the org info, user info, options that on tap user & org info.","enclosedBy":{"name":"custom_list_tile","type":"library","href":"widgets_custom_list_tile/widgets_custom_list_tile-library.md"}},{"name":"CustomListTile","qualifiedName":"custom_list_tile.CustomListTile.CustomListTile","href":"widgets_custom_list_tile/CustomListTile/CustomListTile.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"build","qualifiedName":"custom_list_tile.CustomListTile.build","href":"widgets_custom_list_tile/CustomListTile/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"index","qualifiedName":"custom_list_tile.CustomListTile.index","href":"widgets_custom_list_tile/CustomListTile/index.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"onTapOption","qualifiedName":"custom_list_tile.CustomListTile.onTapOption","href":"widgets_custom_list_tile/CustomListTile/onTapOption.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"onTapOrgInfo","qualifiedName":"custom_list_tile.CustomListTile.onTapOrgInfo","href":"widgets_custom_list_tile/CustomListTile/onTapOrgInfo.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"onTapUserInfo","qualifiedName":"custom_list_tile.CustomListTile.onTapUserInfo","href":"widgets_custom_list_tile/CustomListTile/onTapUserInfo.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"option","qualifiedName":"custom_list_tile.CustomListTile.option","href":"widgets_custom_list_tile/CustomListTile/option.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"orgInfo","qualifiedName":"custom_list_tile.CustomListTile.orgInfo","href":"widgets_custom_list_tile/CustomListTile/orgInfo.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"showIcon","qualifiedName":"custom_list_tile.CustomListTile.showIcon","href":"widgets_custom_list_tile/CustomListTile/showIcon.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"type","qualifiedName":"custom_list_tile.CustomListTile.type","href":"widgets_custom_list_tile/CustomListTile/type.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"userInfo","qualifiedName":"custom_list_tile.CustomListTile.userInfo","href":"widgets_custom_list_tile/CustomListTile/userInfo.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomListTile","type":"class","href":"widgets_custom_list_tile/CustomListTile-class.md"}},{"name":"custom_progress_dialog","qualifiedName":"custom_progress_dialog","href":"widgets_custom_progress_dialog/widgets_custom_progress_dialog-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CustomProgressDialog","qualifiedName":"custom_progress_dialog.CustomProgressDialog","href":"widgets_custom_progress_dialog/CustomProgressDialog-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"A progress dialogue which shows an activity indicator\nspinning clockwise if there is internet connectivity.\nOtherwise, it shows no-internet image and text.","enclosedBy":{"name":"custom_progress_dialog","type":"library","href":"widgets_custom_progress_dialog/widgets_custom_progress_dialog-library.md"}},{"name":"CustomProgressDialog","qualifiedName":"custom_progress_dialog.CustomProgressDialog.CustomProgressDialog","href":"widgets_custom_progress_dialog/CustomProgressDialog/CustomProgressDialog.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomProgressDialog","type":"class","href":"widgets_custom_progress_dialog/CustomProgressDialog-class.md"}},{"name":"build","qualifiedName":"custom_progress_dialog.CustomProgressDialog.build","href":"widgets_custom_progress_dialog/CustomProgressDialog/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CustomProgressDialog","type":"class","href":"widgets_custom_progress_dialog/CustomProgressDialog-class.md"}},{"name":"custom_theme","qualifiedName":"custom_theme","href":"constants_custom_theme/constants_custom_theme-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TalawaTheme","qualifiedName":"custom_theme.TalawaTheme","href":"constants_custom_theme/TalawaTheme-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This file contains various custom themes.\nFor instance, lightTheme, darkTheme, _lightTextTheme, _darkTextTheme, etc.\nThese are imported to other files/widgets to apply the required themes.","enclosedBy":{"name":"custom_theme","type":"library","href":"constants_custom_theme/constants_custom_theme-library.md"}},{"name":"TalawaTheme","qualifiedName":"custom_theme.TalawaTheme.TalawaTheme","href":"constants_custom_theme/TalawaTheme/TalawaTheme.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaTheme","type":"class","href":"constants_custom_theme/TalawaTheme-class.md"}},{"name":"darkTheme","qualifiedName":"custom_theme.TalawaTheme.darkTheme","href":"constants_custom_theme/TalawaTheme/darkTheme.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaTheme","type":"class","href":"constants_custom_theme/TalawaTheme-class.md"}},{"name":"lightTheme","qualifiedName":"custom_theme.TalawaTheme.lightTheme","href":"constants_custom_theme/TalawaTheme/lightTheme.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaTheme","type":"class","href":"constants_custom_theme/TalawaTheme-class.md"}},{"name":"database_mutation_functions","qualifiedName":"database_mutation_functions","href":"services_database_mutation_functions/services_database_mutation_functions-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"DataBaseMutationFunctions","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"DataBaseMutationFunctions class provides different services that are under the context of graphQL mutations and queries.","enclosedBy":{"name":"database_mutation_functions","type":"library","href":"services_database_mutation_functions/services_database_mutation_functions-library.md"}},{"name":"DataBaseMutationFunctions","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.DataBaseMutationFunctions","href":"services_database_mutation_functions/DataBaseMutationFunctions/DataBaseMutationFunctions.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"clientAuth","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.clientAuth","href":"services_database_mutation_functions/DataBaseMutationFunctions/clientAuth.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Client Auth for handling authenticated request.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"clientNonAuth","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.clientNonAuth","href":"services_database_mutation_functions/DataBaseMutationFunctions/clientNonAuth.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Client Auth for handling non-authenticated request.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"emailAccountPresent","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.emailAccountPresent","href":"services_database_mutation_functions/DataBaseMutationFunctions/emailAccountPresent.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Graphql error for handling.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"encounteredExceptionOrError","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.encounteredExceptionOrError","href":"services_database_mutation_functions/DataBaseMutationFunctions/encounteredExceptionOrError.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to check if any exceptions or error encountered. The return type is boolean.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"fetchOrgById","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.fetchOrgById","href":"services_database_mutation_functions/DataBaseMutationFunctions/fetchOrgById.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function fetch the organization using the id passed.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"gqlAuthMutation","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.gqlAuthMutation","href":"services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthMutation.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to run the graph-ql mutation for authenticated user.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"gqlAuthQuery","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.gqlAuthQuery","href":"services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthQuery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to run the graph-ql query for authentication.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"gqlNonAuthMutation","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.gqlNonAuthMutation","href":"services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthMutation.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to run the graph-ql mutation to authenticate the non signed-in user.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"gqlNonAuthQuery","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.gqlNonAuthQuery","href":"services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthQuery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to run the graph-ql query for the non signed-in user.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"init","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.init","href":"services_database_mutation_functions/DataBaseMutationFunctions/init.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"initialization function.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"memberRequestExist","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.memberRequestExist","href":"services_database_mutation_functions/DataBaseMutationFunctions/memberRequestExist.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Graphql error for handling.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"notifFeatureNotInstalled","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.notifFeatureNotInstalled","href":"services_database_mutation_functions/DataBaseMutationFunctions/notifFeatureNotInstalled.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Graphql error for handling.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"organizationNotFound","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.organizationNotFound","href":"services_database_mutation_functions/DataBaseMutationFunctions/organizationNotFound.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Graphql error for handling.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"refreshAccessToken","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.refreshAccessToken","href":"services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessToken.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to refresh the Authenication token to access the application.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"refreshAccessTokenExpiredException","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.refreshAccessTokenExpiredException","href":"services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessTokenExpiredException.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Graphql error for handling.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"userNotAuthenticated","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.userNotAuthenticated","href":"services_database_mutation_functions/DataBaseMutationFunctions/userNotAuthenticated.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Graphql error for handling.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"userNotFound","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.userNotFound","href":"services_database_mutation_functions/DataBaseMutationFunctions/userNotFound.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Graphql error for handling.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"wrongCredentials","qualifiedName":"database_mutation_functions.DataBaseMutationFunctions.wrongCredentials","href":"services_database_mutation_functions/DataBaseMutationFunctions/wrongCredentials.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Graphql error for handling.","enclosedBy":{"name":"DataBaseMutationFunctions","type":"class","href":"services_database_mutation_functions/DataBaseMutationFunctions-class.md"}},{"name":"date_time_picker","qualifiedName":"date_time_picker","href":"widgets_date_time_picker/widgets_date_time_picker-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"customDatePicker","qualifiedName":"date_time_picker.customDatePicker","href":"widgets_date_time_picker/customDatePicker.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"Shows a dialog containing a Material Design date picker.","enclosedBy":{"name":"date_time_picker","type":"library","href":"widgets_date_time_picker/widgets_date_time_picker-library.md"}},{"name":"customTimePicker","qualifiedName":"date_time_picker.customTimePicker","href":"widgets_date_time_picker/customTimePicker.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"Shows a dialog containing a material design time picker.","enclosedBy":{"name":"date_time_picker","type":"library","href":"widgets_date_time_picker/widgets_date_time_picker-library.md"}},{"name":"direct_chat_demo_data","qualifiedName":"direct_chat_demo_data","href":"demo_server_data_direct_chat_demo_data/demo_server_data_direct_chat_demo_data-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"directChatDemoData","qualifiedName":"direct_chat_demo_data.directChatDemoData","href":"demo_server_data_direct_chat_demo_data/directChatDemoData-constant.md","type":"top-level constant","overriddenDepth":0,"packageName":"talawa","desc":"This file contains demo data.","enclosedBy":{"name":"direct_chat_demo_data","type":"library","href":"demo_server_data_direct_chat_demo_data/demo_server_data_direct_chat_demo_data-library.md"}},{"name":"direct_chat_view_model","qualifiedName":"direct_chat_view_model","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"DirectChatViewModel","qualifiedName":"direct_chat_view_model.DirectChatViewModel","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This ViewModel class have different functions that are used interact with model in the context of Direct Chat.","enclosedBy":{"name":"direct_chat_view_model","type":"library","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model-library.md"}},{"name":"DirectChatViewModel","qualifiedName":"direct_chat_view_model.DirectChatViewModel.DirectChatViewModel","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/DirectChatViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"chatMessagesByUser","qualifiedName":"direct_chat_view_model.DirectChatViewModel.chatMessagesByUser","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatMessagesByUser.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"chatName","qualifiedName":"direct_chat_view_model.DirectChatViewModel.chatName","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatName.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"chatState","qualifiedName":"direct_chat_view_model.DirectChatViewModel.chatState","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatState.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"chats","qualifiedName":"direct_chat_view_model.DirectChatViewModel.chats","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chats.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"dispose","qualifiedName":"direct_chat_view_model.DirectChatViewModel.dispose","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/dispose.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Discards any resources used by the object. After this is called, the\nobject is not in a usable state and should be discarded (calls to\naddListener will throw after the object is disposed).","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"getChatMessages","qualifiedName":"direct_chat_view_model.DirectChatViewModel.getChatMessages","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/getChatMessages.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function get all messages for a chat.","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"initialise","qualifiedName":"direct_chat_view_model.DirectChatViewModel.initialise","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"listKey","qualifiedName":"direct_chat_view_model.DirectChatViewModel.listKey","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/listKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"name","qualifiedName":"direct_chat_view_model.DirectChatViewModel.name","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/name.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"refreshChats","qualifiedName":"direct_chat_view_model.DirectChatViewModel.refreshChats","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/refreshChats.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function refresh the chats.","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"sendMessageToDirectChat","qualifiedName":"direct_chat_view_model.DirectChatViewModel.sendMessageToDirectChat","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/sendMessageToDirectChat.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function send the message to Direct Chat.","enclosedBy":{"name":"DirectChatViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md"}},{"name":"direct_chats","qualifiedName":"direct_chats","href":"views_after_auth_screens_chat_direct_chats/views_after_auth_screens_chat_direct_chats-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChatTile","qualifiedName":"direct_chats.ChatTile","href":"views_after_auth_screens_chat_direct_chats/ChatTile-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ChatTile return a widget for a tile in the list of Direct Chats in the Chat List Screen.","enclosedBy":{"name":"direct_chats","type":"library","href":"views_after_auth_screens_chat_direct_chats/views_after_auth_screens_chat_direct_chats-library.md"}},{"name":"ChatTile","qualifiedName":"direct_chats.ChatTile.ChatTile","href":"views_after_auth_screens_chat_direct_chats/ChatTile/ChatTile.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatTile","type":"class","href":"views_after_auth_screens_chat_direct_chats/ChatTile-class.md"}},{"name":"build","qualifiedName":"direct_chats.ChatTile.build","href":"views_after_auth_screens_chat_direct_chats/ChatTile/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"ChatTile","type":"class","href":"views_after_auth_screens_chat_direct_chats/ChatTile-class.md"}},{"name":"chat","qualifiedName":"direct_chats.ChatTile.chat","href":"views_after_auth_screens_chat_direct_chats/ChatTile/chat.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatTile","type":"class","href":"views_after_auth_screens_chat_direct_chats/ChatTile-class.md"}},{"name":"model","qualifiedName":"direct_chats.ChatTile.model","href":"views_after_auth_screens_chat_direct_chats/ChatTile/model.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatTile","type":"class","href":"views_after_auth_screens_chat_direct_chats/ChatTile-class.md"}},{"name":"DirectChats","qualifiedName":"direct_chats.DirectChats","href":"views_after_auth_screens_chat_direct_chats/DirectChats-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"DirectChats return a statelessWidget for rendering all the directs\nchats of the current user in the Chat List Screen","enclosedBy":{"name":"direct_chats","type":"library","href":"views_after_auth_screens_chat_direct_chats/views_after_auth_screens_chat_direct_chats-library.md"}},{"name":"DirectChats","qualifiedName":"direct_chats.DirectChats.DirectChats","href":"views_after_auth_screens_chat_direct_chats/DirectChats/DirectChats.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DirectChats","type":"class","href":"views_after_auth_screens_chat_direct_chats/DirectChats-class.md"}},{"name":"build","qualifiedName":"direct_chats.DirectChats.build","href":"views_after_auth_screens_chat_direct_chats/DirectChats/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"DirectChats","type":"class","href":"views_after_auth_screens_chat_direct_chats/DirectChats-class.md"}},{"name":"edit_event_page","qualifiedName":"edit_event_page","href":"views_after_auth_screens_events_edit_event_page/views_after_auth_screens_events_edit_event_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EditEventPage","qualifiedName":"edit_event_page.EditEventPage","href":"views_after_auth_screens_events_edit_event_page/EditEventPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EditEventPage returns a widget that has mutable state _EditEventPageState.","enclosedBy":{"name":"edit_event_page","type":"library","href":"views_after_auth_screens_events_edit_event_page/views_after_auth_screens_events_edit_event_page-library.md"}},{"name":"EditEventPage","qualifiedName":"edit_event_page.EditEventPage.EditEventPage","href":"views_after_auth_screens_events_edit_event_page/EditEventPage/EditEventPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventPage","type":"class","href":"views_after_auth_screens_events_edit_event_page/EditEventPage-class.md"}},{"name":"createState","qualifiedName":"edit_event_page.EditEventPage.createState","href":"views_after_auth_screens_events_edit_event_page/EditEventPage/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"EditEventPage","type":"class","href":"views_after_auth_screens_events_edit_event_page/EditEventPage-class.md"}},{"name":"event","qualifiedName":"edit_event_page.EditEventPage.event","href":"views_after_auth_screens_events_edit_event_page/EditEventPage/event.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventPage","type":"class","href":"views_after_auth_screens_events_edit_event_page/EditEventPage-class.md"}},{"name":"edit_event_view_model","qualifiedName":"edit_event_view_model","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/view_model_after_auth_view_models_event_view_models_edit_event_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EditEventViewModel","qualifiedName":"edit_event_view_model.EditEventViewModel","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EditEventViewModel class have methods to interact with model in\nthe context of editing the event in the organization.","enclosedBy":{"name":"edit_event_view_model","type":"library","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/view_model_after_auth_view_models_event_view_models_edit_event_view_model-library.md"}},{"name":"EditEventViewModel","qualifiedName":"edit_event_view_model.EditEventViewModel.EditEventViewModel","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/EditEventViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"descriptionFocus","qualifiedName":"edit_event_view_model.EditEventViewModel.descriptionFocus","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/descriptionFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"eventDescriptionTextController","qualifiedName":"edit_event_view_model.EditEventViewModel.eventDescriptionTextController","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventDescriptionTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"eventEndDate","qualifiedName":"edit_event_view_model.EditEventViewModel.eventEndDate","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndDate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"eventEndTime","qualifiedName":"edit_event_view_model.EditEventViewModel.eventEndTime","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndTime.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"eventLocationTextController","qualifiedName":"edit_event_view_model.EditEventViewModel.eventLocationTextController","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventLocationTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"eventStartDate","qualifiedName":"edit_event_view_model.EditEventViewModel.eventStartDate","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartDate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"eventStartTime","qualifiedName":"edit_event_view_model.EditEventViewModel.eventStartTime","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartTime.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"eventTitleTextController","qualifiedName":"edit_event_view_model.EditEventViewModel.eventTitleTextController","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventTitleTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"formKey","qualifiedName":"edit_event_view_model.EditEventViewModel.formKey","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/formKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"initialize","qualifiedName":"edit_event_view_model.EditEventViewModel.initialize","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"isPublicSwitch","qualifiedName":"edit_event_view_model.EditEventViewModel.isPublicSwitch","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isPublicSwitch.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"isRegisterableSwitch","qualifiedName":"edit_event_view_model.EditEventViewModel.isRegisterableSwitch","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isRegisterableSwitch.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"locationFocus","qualifiedName":"edit_event_view_model.EditEventViewModel.locationFocus","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/locationFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"titleFocus","qualifiedName":"edit_event_view_model.EditEventViewModel.titleFocus","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/titleFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"updateEvent","qualifiedName":"edit_event_view_model.EditEventViewModel.updateEvent","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/updateEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to update an event.\nThe function uses editEvent function provided by eventService service.","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"validate","qualifiedName":"edit_event_view_model.EditEventViewModel.validate","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/validate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md"}},{"name":"edit_events_form","qualifiedName":"edit_events_form","href":"views_after_auth_screens_events_edit_events_form/views_after_auth_screens_events_edit_events_form-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EditEventForm","qualifiedName":"edit_events_form.EditEventForm","href":"views_after_auth_screens_events_edit_events_form/EditEventForm-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EditEventForm returns a widget of a Form for editing an event.\nThis widget is used in EditEventPage widget.","enclosedBy":{"name":"edit_events_form","type":"library","href":"views_after_auth_screens_events_edit_events_form/views_after_auth_screens_events_edit_events_form-library.md"}},{"name":"EditEventForm","qualifiedName":"edit_events_form.EditEventForm.EditEventForm","href":"views_after_auth_screens_events_edit_events_form/EditEventForm/EditEventForm.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventForm","type":"class","href":"views_after_auth_screens_events_edit_events_form/EditEventForm-class.md"}},{"name":"build","qualifiedName":"edit_events_form.EditEventForm.build","href":"views_after_auth_screens_events_edit_events_form/EditEventForm/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"EditEventForm","type":"class","href":"views_after_auth_screens_events_edit_events_form/EditEventForm-class.md"}},{"name":"model","qualifiedName":"edit_events_form.EditEventForm.model","href":"views_after_auth_screens_events_edit_events_form/EditEventForm/model.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditEventForm","type":"class","href":"views_after_auth_screens_events_edit_events_form/EditEventForm-class.md"}},{"name":"edit_profile_page","qualifiedName":"edit_profile_page","href":"views_after_auth_screens_profile_edit_profile_page/views_after_auth_screens_profile_edit_profile_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EditProfilePage","qualifiedName":"edit_profile_page.EditProfilePage","href":"views_after_auth_screens_profile_edit_profile_page/EditProfilePage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EditProfilePage returns a widget that has mutable state _EditProfilePageState.","enclosedBy":{"name":"edit_profile_page","type":"library","href":"views_after_auth_screens_profile_edit_profile_page/views_after_auth_screens_profile_edit_profile_page-library.md"}},{"name":"EditProfilePage","qualifiedName":"edit_profile_page.EditProfilePage.EditProfilePage","href":"views_after_auth_screens_profile_edit_profile_page/EditProfilePage/EditProfilePage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePage","type":"class","href":"views_after_auth_screens_profile_edit_profile_page/EditProfilePage-class.md"}},{"name":"createState","qualifiedName":"edit_profile_page.EditProfilePage.createState","href":"views_after_auth_screens_profile_edit_profile_page/EditProfilePage/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"EditProfilePage","type":"class","href":"views_after_auth_screens_profile_edit_profile_page/EditProfilePage-class.md"}},{"name":"edit_profile_view_model","qualifiedName":"edit_profile_view_model","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EditProfilePageViewModel","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EditProfilePageViewModel class helps to interact with model to serve data to edit profile views.","enclosedBy":{"name":"edit_profile_view_model","type":"library","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model-library.md"}},{"name":"EditProfilePageViewModel","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.EditProfilePageViewModel","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/EditProfilePageViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"databaseService","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.databaseService","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/databaseService.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"firstNameFocus","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.firstNameFocus","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"firstNameTextController","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.firstNameTextController","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"getImageFromGallery","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.getImageFromGallery","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/getImageFromGallery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get the image from gallery.\nThe function uses the _multiMediaPickerService services.","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"imageFile","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.imageFile","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/imageFile.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"initialize","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.initialize","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"lastNameFocus","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.lastNameFocus","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"lastNameTextController","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.lastNameTextController","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameTextController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"removeImage","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.removeImage","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/removeImage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function remove the selected image.","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"user","qualifiedName":"edit_profile_view_model.EditProfilePageViewModel.user","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/user.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md"}},{"name":"edit_task_page","qualifiedName":"edit_task_page","href":"views_after_auth_screens_tasks_edit_task_page/views_after_auth_screens_tasks_edit_task_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EditTaskPage","qualifiedName":"edit_task_page.EditTaskPage","href":"views_after_auth_screens_tasks_edit_task_page/EditTaskPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EditTaskPage returns a widget for page to edit the task for the user.","enclosedBy":{"name":"edit_task_page","type":"library","href":"views_after_auth_screens_tasks_edit_task_page/views_after_auth_screens_tasks_edit_task_page-library.md"}},{"name":"EditTaskPage","qualifiedName":"edit_task_page.EditTaskPage.EditTaskPage","href":"views_after_auth_screens_tasks_edit_task_page/EditTaskPage/EditTaskPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditTaskPage","type":"class","href":"views_after_auth_screens_tasks_edit_task_page/EditTaskPage-class.md"}},{"name":"build","qualifiedName":"edit_task_page.EditTaskPage.build","href":"views_after_auth_screens_tasks_edit_task_page/EditTaskPage/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"EditTaskPage","type":"class","href":"views_after_auth_screens_tasks_edit_task_page/EditTaskPage-class.md"}},{"name":"task","qualifiedName":"edit_task_page.EditTaskPage.task","href":"views_after_auth_screens_tasks_edit_task_page/EditTaskPage/task.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EditTaskPage","type":"class","href":"views_after_auth_screens_tasks_edit_task_page/EditTaskPage-class.md"}},{"name":"enums","qualifiedName":"enums","href":"enums_enums/enums_enums-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CallFor","qualifiedName":"enums.CallFor","href":"enums_enums/CallFor.md","type":"enum","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"enums","type":"library","href":"enums_enums/enums_enums-library.md"}},{"name":"CallFor","qualifiedName":"enums.CallFor.CallFor","href":"enums_enums/CallFor/CallFor.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CallFor","type":"enum","href":"enums_enums/CallFor.md"}},{"name":"values","qualifiedName":"enums.CallFor.values","href":"enums_enums/CallFor/values-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"A constant List of the values in this enum, in order of their declaration.","enclosedBy":{"name":"CallFor","type":"enum","href":"enums_enums/CallFor.md"}},{"name":"ChatState","qualifiedName":"enums.ChatState","href":"enums_enums/ChatState.md","type":"enum","overriddenDepth":0,"packageName":"talawa","desc":"Represents the state of the chat","enclosedBy":{"name":"enums","type":"library","href":"enums_enums/enums_enums-library.md"}},{"name":"ChatState","qualifiedName":"enums.ChatState.ChatState","href":"enums_enums/ChatState/ChatState.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChatState","type":"enum","href":"enums_enums/ChatState.md"}},{"name":"values","qualifiedName":"enums.ChatState.values","href":"enums_enums/ChatState/values-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"A constant List of the values in this enum, in order of their declaration.","enclosedBy":{"name":"ChatState","type":"enum","href":"enums_enums/ChatState.md"}},{"name":"MessageType","qualifiedName":"enums.MessageType","href":"enums_enums/MessageType.md","type":"enum","overriddenDepth":0,"packageName":"talawa","desc":"Represents the type of the Message","enclosedBy":{"name":"enums","type":"library","href":"enums_enums/enums_enums-library.md"}},{"name":"MessageType","qualifiedName":"enums.MessageType.MessageType","href":"enums_enums/MessageType/MessageType.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MessageType","type":"enum","href":"enums_enums/MessageType.md"}},{"name":"values","qualifiedName":"enums.MessageType.values","href":"enums_enums/MessageType/values-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"A constant List of the values in this enum, in order of their declaration.","enclosedBy":{"name":"MessageType","type":"enum","href":"enums_enums/MessageType.md"}},{"name":"ModalSheet","qualifiedName":"enums.ModalSheet","href":"enums_enums/ModalSheet.md","type":"enum","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"enums","type":"library","href":"enums_enums/enums_enums-library.md"}},{"name":"ModalSheet","qualifiedName":"enums.ModalSheet.ModalSheet","href":"enums_enums/ModalSheet/ModalSheet.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ModalSheet","type":"enum","href":"enums_enums/ModalSheet.md"}},{"name":"values","qualifiedName":"enums.ModalSheet.values","href":"enums_enums/ModalSheet/values-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"A constant List of the values in this enum, in order of their declaration.","enclosedBy":{"name":"ModalSheet","type":"enum","href":"enums_enums/ModalSheet.md"}},{"name":"TileType","qualifiedName":"enums.TileType","href":"enums_enums/TileType.md","type":"enum","overriddenDepth":0,"packageName":"talawa","desc":"Represents the type of the tile","enclosedBy":{"name":"enums","type":"library","href":"enums_enums/enums_enums-library.md"}},{"name":"TileType","qualifiedName":"enums.TileType.TileType","href":"enums_enums/TileType/TileType.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TileType","type":"enum","href":"enums_enums/TileType.md"}},{"name":"values","qualifiedName":"enums.TileType.values","href":"enums_enums/TileType/values-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"A constant List of the values in this enum, in order of their declaration.","enclosedBy":{"name":"TileType","type":"enum","href":"enums_enums/TileType.md"}},{"name":"ViewState","qualifiedName":"enums.ViewState","href":"enums_enums/ViewState.md","type":"enum","overriddenDepth":0,"packageName":"talawa","desc":"This file contains different enums.\nThe enum keyword is used to define an enumeration type in Dart.\nThe use case of enumeration is to store finite data members under the same type definition.\nRepresents the state of the view","enclosedBy":{"name":"enums","type":"library","href":"enums_enums/enums_enums-library.md"}},{"name":"ViewState","qualifiedName":"enums.ViewState.ViewState","href":"enums_enums/ViewState/ViewState.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ViewState","type":"enum","href":"enums_enums/ViewState.md"}},{"name":"values","qualifiedName":"enums.ViewState.values","href":"enums_enums/ViewState/values-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"A constant List of the values in this enum, in order of their declaration.","enclosedBy":{"name":"ViewState","type":"enum","href":"enums_enums/ViewState.md"}},{"name":"event_calendar","qualifiedName":"event_calendar","href":"views_after_auth_screens_events_event_calendar/views_after_auth_screens_events_event_calendar-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventCalendar","qualifiedName":"event_calendar.EventCalendar","href":"views_after_auth_screens_events_event_calendar/EventCalendar-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EventCalendar returns a widget that has mutable state _EventCalendarState.","enclosedBy":{"name":"event_calendar","type":"library","href":"views_after_auth_screens_events_event_calendar/views_after_auth_screens_events_event_calendar-library.md"}},{"name":"EventCalendar","qualifiedName":"event_calendar.EventCalendar.EventCalendar","href":"views_after_auth_screens_events_event_calendar/EventCalendar/EventCalendar.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventCalendar","type":"class","href":"views_after_auth_screens_events_event_calendar/EventCalendar-class.md"}},{"name":"createState","qualifiedName":"event_calendar.EventCalendar.createState","href":"views_after_auth_screens_events_event_calendar/EventCalendar/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"EventCalendar","type":"class","href":"views_after_auth_screens_events_event_calendar/EventCalendar-class.md"}},{"name":"eventList","qualifiedName":"event_calendar.EventCalendar.eventList","href":"views_after_auth_screens_events_event_calendar/EventCalendar/eventList.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventCalendar","type":"class","href":"views_after_auth_screens_events_event_calendar/EventCalendar-class.md"}},{"name":"event_card","qualifiedName":"event_card","href":"widgets_event_card/widgets_event_card-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventCard","qualifiedName":"event_card.EventCard","href":"widgets_event_card/EventCard-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class returns the EventCard widget.","enclosedBy":{"name":"event_card","type":"library","href":"widgets_event_card/widgets_event_card-library.md"}},{"name":"EventCard","qualifiedName":"event_card.EventCard.EventCard","href":"widgets_event_card/EventCard/EventCard.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventCard","type":"class","href":"widgets_event_card/EventCard-class.md"}},{"name":"build","qualifiedName":"event_card.EventCard.build","href":"widgets_event_card/EventCard/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"EventCard","type":"class","href":"widgets_event_card/EventCard-class.md"}},{"name":"event","qualifiedName":"event_card.EventCard.event","href":"widgets_event_card/EventCard/event.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventCard","type":"class","href":"widgets_event_card/EventCard-class.md"}},{"name":"eventTitleHighlightedText","qualifiedName":"event_card.EventCard.eventTitleHighlightedText","href":"widgets_event_card/EventCard/eventTitleHighlightedText.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventCard","type":"class","href":"widgets_event_card/EventCard-class.md"}},{"name":"eventTitleNormalText","qualifiedName":"event_card.EventCard.eventTitleNormalText","href":"widgets_event_card/EventCard/eventTitleNormalText.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventCard","type":"class","href":"widgets_event_card/EventCard-class.md"}},{"name":"isSearchItem","qualifiedName":"event_card.EventCard.isSearchItem","href":"widgets_event_card/EventCard/isSearchItem.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventCard","type":"class","href":"widgets_event_card/EventCard-class.md"}},{"name":"event_card_view_model","qualifiedName":"event_card_view_model","href":"view_model_widgets_view_models_event_card_view_model/view_model_widgets_view_models_event_card_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"event_chats","qualifiedName":"event_chats","href":"views_after_auth_screens_chat_event_chats/views_after_auth_screens_chat_event_chats-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventChats","qualifiedName":"event_chats.EventChats","href":"views_after_auth_screens_chat_event_chats/EventChats-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EventChats return a statelessWidget for rendering all the events\nchats of the current user in the Chat List Screen","enclosedBy":{"name":"event_chats","type":"library","href":"views_after_auth_screens_chat_event_chats/views_after_auth_screens_chat_event_chats-library.md"}},{"name":"EventChats","qualifiedName":"event_chats.EventChats.EventChats","href":"views_after_auth_screens_chat_event_chats/EventChats/EventChats.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventChats","type":"class","href":"views_after_auth_screens_chat_event_chats/EventChats-class.md"}},{"name":"build","qualifiedName":"event_chats.EventChats.build","href":"views_after_auth_screens_chat_event_chats/EventChats/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"EventChats","type":"class","href":"views_after_auth_screens_chat_event_chats/EventChats-class.md"}},{"name":"event_date_time_tile","qualifiedName":"event_date_time_tile","href":"widgets_event_date_time_tile/widgets_event_date_time_tile-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"DateTimeTile","qualifiedName":"event_date_time_tile.DateTimeTile","href":"widgets_event_date_time_tile/DateTimeTile-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Returns a widget tile(item) for displaying date and time.","enclosedBy":{"name":"event_date_time_tile","type":"library","href":"widgets_event_date_time_tile/widgets_event_date_time_tile-library.md"}},{"name":"DateTimeTile","qualifiedName":"event_date_time_tile.DateTimeTile.DateTimeTile","href":"widgets_event_date_time_tile/DateTimeTile/DateTimeTile.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DateTimeTile","type":"class","href":"widgets_event_date_time_tile/DateTimeTile-class.md"}},{"name":"build","qualifiedName":"event_date_time_tile.DateTimeTile.build","href":"widgets_event_date_time_tile/DateTimeTile/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"DateTimeTile","type":"class","href":"widgets_event_date_time_tile/DateTimeTile-class.md"}},{"name":"date","qualifiedName":"event_date_time_tile.DateTimeTile.date","href":"widgets_event_date_time_tile/DateTimeTile/date.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DateTimeTile","type":"class","href":"widgets_event_date_time_tile/DateTimeTile-class.md"}},{"name":"setDate","qualifiedName":"event_date_time_tile.DateTimeTile.setDate","href":"widgets_event_date_time_tile/DateTimeTile/setDate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DateTimeTile","type":"class","href":"widgets_event_date_time_tile/DateTimeTile-class.md"}},{"name":"setTime","qualifiedName":"event_date_time_tile.DateTimeTile.setTime","href":"widgets_event_date_time_tile/DateTimeTile/setTime.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DateTimeTile","type":"class","href":"widgets_event_date_time_tile/DateTimeTile-class.md"}},{"name":"time","qualifiedName":"event_date_time_tile.DateTimeTile.time","href":"widgets_event_date_time_tile/DateTimeTile/time.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DateTimeTile","type":"class","href":"widgets_event_date_time_tile/DateTimeTile-class.md"}},{"name":"event_info_body","qualifiedName":"event_info_body","href":"views_after_auth_screens_events_event_info_body/views_after_auth_screens_events_event_info_body-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventInfoBody","qualifiedName":"event_info_body.EventInfoBody","href":"views_after_auth_screens_events_event_info_body/EventInfoBody-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EventInfoBody returns a stateless widget which describes the body of a particular event.","enclosedBy":{"name":"event_info_body","type":"library","href":"views_after_auth_screens_events_event_info_body/views_after_auth_screens_events_event_info_body-library.md"}},{"name":"EventInfoBody","qualifiedName":"event_info_body.EventInfoBody.EventInfoBody","href":"views_after_auth_screens_events_event_info_body/EventInfoBody/EventInfoBody.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventInfoBody","type":"class","href":"views_after_auth_screens_events_event_info_body/EventInfoBody-class.md"}},{"name":"build","qualifiedName":"event_info_body.EventInfoBody.build","href":"views_after_auth_screens_events_event_info_body/EventInfoBody/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"EventInfoBody","type":"class","href":"views_after_auth_screens_events_event_info_body/EventInfoBody-class.md"}},{"name":"event_info_page","qualifiedName":"event_info_page","href":"views_after_auth_screens_events_event_info_page/views_after_auth_screens_events_event_info_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventInfoPage","qualifiedName":"event_info_page.EventInfoPage","href":"views_after_auth_screens_events_event_info_page/EventInfoPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EventInfoPage returns a widget that has mutable state _EventInfoPageState.","enclosedBy":{"name":"event_info_page","type":"library","href":"views_after_auth_screens_events_event_info_page/views_after_auth_screens_events_event_info_page-library.md"}},{"name":"EventInfoPage","qualifiedName":"event_info_page.EventInfoPage.EventInfoPage","href":"views_after_auth_screens_events_event_info_page/EventInfoPage/EventInfoPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventInfoPage","type":"class","href":"views_after_auth_screens_events_event_info_page/EventInfoPage-class.md"}},{"name":"args","qualifiedName":"event_info_page.EventInfoPage.args","href":"views_after_auth_screens_events_event_info_page/EventInfoPage/args.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventInfoPage","type":"class","href":"views_after_auth_screens_events_event_info_page/EventInfoPage-class.md"}},{"name":"createState","qualifiedName":"event_info_page.EventInfoPage.createState","href":"views_after_auth_screens_events_event_info_page/EventInfoPage/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"EventInfoPage","type":"class","href":"views_after_auth_screens_events_event_info_page/EventInfoPage-class.md"}},{"name":"event_info_view_model","qualifiedName":"event_info_view_model","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/view_model_after_auth_view_models_event_view_models_event_info_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventInfoViewModel","qualifiedName":"event_info_view_model.EventInfoViewModel","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EventInfoViewModel class helps interacting with model to serve view with the event information data.'","enclosedBy":{"name":"event_info_view_model","type":"library","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/view_model_after_auth_view_models_event_view_models_event_info_view_model-library.md"}},{"name":"EventInfoViewModel","qualifiedName":"event_info_view_model.EventInfoViewModel.EventInfoViewModel","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/EventInfoViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventInfoViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md"}},{"name":"event","qualifiedName":"event_info_view_model.EventInfoViewModel.event","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/event.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventInfoViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md"}},{"name":"exploreEventsInstance","qualifiedName":"event_info_view_model.EventInfoViewModel.exploreEventsInstance","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/exploreEventsInstance.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventInfoViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md"}},{"name":"fabTitle","qualifiedName":"event_info_view_model.EventInfoViewModel.fabTitle","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/fabTitle.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventInfoViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md"}},{"name":"getFabTitle","qualifiedName":"event_info_view_model.EventInfoViewModel.getFabTitle","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/getFabTitle.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function returns String type for the event registration status.","enclosedBy":{"name":"EventInfoViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md"}},{"name":"initialize","qualifiedName":"event_info_view_model.EventInfoViewModel.initialize","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"initialise with the event data fetched from the model.","enclosedBy":{"name":"EventInfoViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md"}},{"name":"registerForEvent","qualifiedName":"event_info_view_model.EventInfoViewModel.registerForEvent","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registerForEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function helps the user to register for an event.","enclosedBy":{"name":"EventInfoViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md"}},{"name":"registrants","qualifiedName":"event_info_view_model.EventInfoViewModel.registrants","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registrants.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventInfoViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md"}},{"name":"event_model","qualifiedName":"event_model","href":"models_events_event_model/models_events_event_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Event","qualifiedName":"event_model.Event","href":"models_events_event_model/Event-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates an event model and returns an Event instance.","enclosedBy":{"name":"event_model","type":"library","href":"models_events_event_model/models_events_event_model-library.md"}},{"name":"Event","qualifiedName":"event_model.Event.Event","href":"models_events_event_model/Event/Event.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"admins","qualifiedName":"event_model.Event.admins","href":"models_events_event_model/Event/admins.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"allDay","qualifiedName":"event_model.Event.allDay","href":"models_events_event_model/Event/allDay.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"attendees","qualifiedName":"event_model.Event.attendees","href":"models_events_event_model/Event/attendees.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"creator","qualifiedName":"event_model.Event.creator","href":"models_events_event_model/Event/creator.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"description","qualifiedName":"event_model.Event.description","href":"models_events_event_model/Event/description.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"endDate","qualifiedName":"event_model.Event.endDate","href":"models_events_event_model/Event/endDate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"endTime","qualifiedName":"event_model.Event.endTime","href":"models_events_event_model/Event/endTime.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"Event.fromJson","qualifiedName":"event_model.Event.fromJson","href":"models_events_event_model/Event/Event.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"id","qualifiedName":"event_model.Event.id","href":"models_events_event_model/Event/id.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"isPublic","qualifiedName":"event_model.Event.isPublic","href":"models_events_event_model/Event/isPublic.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"isRegisterable","qualifiedName":"event_model.Event.isRegisterable","href":"models_events_event_model/Event/isRegisterable.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"isRegistered","qualifiedName":"event_model.Event.isRegistered","href":"models_events_event_model/Event/isRegistered.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"latitude","qualifiedName":"event_model.Event.latitude","href":"models_events_event_model/Event/latitude.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"location","qualifiedName":"event_model.Event.location","href":"models_events_event_model/Event/location.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"longitude","qualifiedName":"event_model.Event.longitude","href":"models_events_event_model/Event/longitude.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"organization","qualifiedName":"event_model.Event.organization","href":"models_events_event_model/Event/organization.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"recurrence","qualifiedName":"event_model.Event.recurrence","href":"models_events_event_model/Event/recurrence.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"recurring","qualifiedName":"event_model.Event.recurring","href":"models_events_event_model/Event/recurring.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"registrants","qualifiedName":"event_model.Event.registrants","href":"models_events_event_model/Event/registrants.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"startDate","qualifiedName":"event_model.Event.startDate","href":"models_events_event_model/Event/startDate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"startTime","qualifiedName":"event_model.Event.startTime","href":"models_events_event_model/Event/startTime.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"title","qualifiedName":"event_model.Event.title","href":"models_events_event_model/Event/title.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Event","type":"class","href":"models_events_event_model/Event-class.md"}},{"name":"event_queries","qualifiedName":"event_queries","href":"utils_event_queries/utils_event_queries-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventQueries","qualifiedName":"event_queries.EventQueries","href":"utils_event_queries/EventQueries-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates queries related to the events.","enclosedBy":{"name":"event_queries","type":"library","href":"utils_event_queries/utils_event_queries-library.md"}},{"name":"EventQueries","qualifiedName":"event_queries.EventQueries.EventQueries","href":"utils_event_queries/EventQueries/EventQueries.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventQueries","type":"class","href":"utils_event_queries/EventQueries-class.md"}},{"name":"addEvent","qualifiedName":"event_queries.EventQueries.addEvent","href":"utils_event_queries/EventQueries/addEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventQueries","type":"class","href":"utils_event_queries/EventQueries-class.md"}},{"name":"deleteEvent","qualifiedName":"event_queries.EventQueries.deleteEvent","href":"utils_event_queries/EventQueries/deleteEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventQueries","type":"class","href":"utils_event_queries/EventQueries-class.md"}},{"name":"fetchOrgEvents","qualifiedName":"event_queries.EventQueries.fetchOrgEvents","href":"utils_event_queries/EventQueries/fetchOrgEvents.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventQueries","type":"class","href":"utils_event_queries/EventQueries-class.md"}},{"name":"registerForEvent","qualifiedName":"event_queries.EventQueries.registerForEvent","href":"utils_event_queries/EventQueries/registerForEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventQueries","type":"class","href":"utils_event_queries/EventQueries-class.md"}},{"name":"registrantsByEvent","qualifiedName":"event_queries.EventQueries.registrantsByEvent","href":"utils_event_queries/EventQueries/registrantsByEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventQueries","type":"class","href":"utils_event_queries/EventQueries-class.md"}},{"name":"updateEvent","qualifiedName":"event_queries.EventQueries.updateEvent","href":"utils_event_queries/EventQueries/updateEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventQueries","type":"class","href":"utils_event_queries/EventQueries-class.md"}},{"name":"event_search_delegate","qualifiedName":"event_search_delegate","href":"widgets_event_search_delegate/widgets_event_search_delegate-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventSearch","qualifiedName":"event_search_delegate.EventSearch","href":"widgets_event_search_delegate/EventSearch-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class returns a list of the events which match the search query.","enclosedBy":{"name":"event_search_delegate","type":"library","href":"widgets_event_search_delegate/widgets_event_search_delegate-library.md"}},{"name":"EventSearch","qualifiedName":"event_search_delegate.EventSearch.EventSearch","href":"widgets_event_search_delegate/EventSearch/EventSearch.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventSearch","type":"class","href":"widgets_event_search_delegate/EventSearch-class.md"}},{"name":"buildActions","qualifiedName":"event_search_delegate.EventSearch.buildActions","href":"widgets_event_search_delegate/EventSearch/buildActions.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Widgets to display after the search query in the AppBar.","enclosedBy":{"name":"EventSearch","type":"class","href":"widgets_event_search_delegate/EventSearch-class.md"}},{"name":"buildLeading","qualifiedName":"event_search_delegate.EventSearch.buildLeading","href":"widgets_event_search_delegate/EventSearch/buildLeading.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"A widget to display before the current query in the AppBar.","enclosedBy":{"name":"EventSearch","type":"class","href":"widgets_event_search_delegate/EventSearch-class.md"}},{"name":"buildResults","qualifiedName":"event_search_delegate.EventSearch.buildResults","href":"widgets_event_search_delegate/EventSearch/buildResults.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"The results shown after the user submits a search from the search page.","enclosedBy":{"name":"EventSearch","type":"class","href":"widgets_event_search_delegate/EventSearch-class.md"}},{"name":"buildSuggestions","qualifiedName":"event_search_delegate.EventSearch.buildSuggestions","href":"widgets_event_search_delegate/EventSearch/buildSuggestions.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Suggestions shown in the body of the search page while the user types a\nquery into the search field.","enclosedBy":{"name":"EventSearch","type":"class","href":"widgets_event_search_delegate/EventSearch-class.md"}},{"name":"buildSuggestionsSucess","qualifiedName":"event_search_delegate.EventSearch.buildSuggestionsSucess","href":"widgets_event_search_delegate/EventSearch/buildSuggestionsSucess.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventSearch","type":"class","href":"widgets_event_search_delegate/EventSearch-class.md"}},{"name":"eventList","qualifiedName":"event_search_delegate.EventSearch.eventList","href":"widgets_event_search_delegate/EventSearch/eventList.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventSearch","type":"class","href":"widgets_event_search_delegate/EventSearch-class.md"}},{"name":"exploreEventsViewModel","qualifiedName":"event_search_delegate.EventSearch.exploreEventsViewModel","href":"widgets_event_search_delegate/EventSearch/exploreEventsViewModel.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventSearch","type":"class","href":"widgets_event_search_delegate/EventSearch-class.md"}},{"name":"event_service","qualifiedName":"event_service","href":"services_event_service/services_event_service-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventService","qualifiedName":"event_service.EventService","href":"services_event_service/EventService-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EventService class provides different services in the context of Event.","enclosedBy":{"name":"event_service","type":"library","href":"services_event_service/services_event_service-library.md"}},{"name":"EventService","qualifiedName":"event_service.EventService.EventService","href":"services_event_service/EventService/EventService.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"deleteEvent","qualifiedName":"event_service.EventService.deleteEvent","href":"services_event_service/EventService/deleteEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to delete the event.","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"dispose","qualifiedName":"event_service.EventService.dispose","href":"services_event_service/EventService/dispose.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to cancel the stream subscription of an organization.","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"editEvent","qualifiedName":"event_service.EventService.editEvent","href":"services_event_service/EventService/editEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to edit an event.","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"eventStream","qualifiedName":"event_service.EventService.eventStream","href":"services_event_service/EventService/eventStream.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"The event stream.","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"fetchRegistrantsByEvent","qualifiedName":"event_service.EventService.fetchRegistrantsByEvent","href":"services_event_service/EventService/fetchRegistrantsByEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to fetch all registrants of an event.","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"getEvents","qualifiedName":"event_service.EventService.getEvents","href":"services_event_service/EventService/getEvents.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to fetch all the events of an organization.","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"registerForAnEvent","qualifiedName":"event_service.EventService.registerForAnEvent","href":"services_event_service/EventService/registerForAnEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to register user for an event.","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"setOrgStreamSubscription","qualifiedName":"event_service.EventService.setOrgStreamSubscription","href":"services_event_service/EventService/setOrgStreamSubscription.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to set stream subscription for an organization.","enclosedBy":{"name":"EventService","type":"class","href":"services_event_service/EventService-class.md"}},{"name":"event_tasks_page","qualifiedName":"event_tasks_page","href":"views_after_auth_screens_tasks_event_tasks_page/views_after_auth_screens_tasks_event_tasks_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"EventTasksPage","qualifiedName":"event_tasks_page.EventTasksPage","href":"views_after_auth_screens_tasks_event_tasks_page/EventTasksPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"EventTasksPage return a widget for Event Task Page that is created by event creator.","enclosedBy":{"name":"event_tasks_page","type":"library","href":"views_after_auth_screens_tasks_event_tasks_page/views_after_auth_screens_tasks_event_tasks_page-library.md"}},{"name":"EventTasksPage","qualifiedName":"event_tasks_page.EventTasksPage.EventTasksPage","href":"views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/EventTasksPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventTasksPage","type":"class","href":"views_after_auth_screens_tasks_event_tasks_page/EventTasksPage-class.md"}},{"name":"build","qualifiedName":"event_tasks_page.EventTasksPage.build","href":"views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"EventTasksPage","type":"class","href":"views_after_auth_screens_tasks_event_tasks_page/EventTasksPage-class.md"}},{"name":"eventId","qualifiedName":"event_tasks_page.EventTasksPage.eventId","href":"views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/eventId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"EventTasksPage","type":"class","href":"views_after_auth_screens_tasks_event_tasks_page/EventTasksPage-class.md"}},{"name":"events_demo_data","qualifiedName":"events_demo_data","href":"demo_server_data_events_demo_data/demo_server_data_events_demo_data-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"eventsDemoData","qualifiedName":"events_demo_data.eventsDemoData","href":"demo_server_data_events_demo_data/eventsDemoData-constant.md","type":"top-level constant","overriddenDepth":0,"packageName":"talawa","desc":"This file contains demo data. It contains a list of type Map<String, Object>\nand sample data of events.","enclosedBy":{"name":"events_demo_data","type":"library","href":"demo_server_data_events_demo_data/demo_server_data_events_demo_data-library.md"}},{"name":"explore_event_dialogue","qualifiedName":"explore_event_dialogue","href":"views_after_auth_screens_events_explore_event_dialogue/views_after_auth_screens_events_explore_event_dialogue-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ExploreEventDialog","qualifiedName":"explore_event_dialogue.ExploreEventDialog","href":"views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ExploreEventDialog returns a widget that has mutable state _ExploreEventDialogState.","enclosedBy":{"name":"explore_event_dialogue","type":"library","href":"views_after_auth_screens_events_explore_event_dialogue/views_after_auth_screens_events_explore_event_dialogue-library.md"}},{"name":"ExploreEventDialog","qualifiedName":"explore_event_dialogue.ExploreEventDialog.ExploreEventDialog","href":"views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/ExploreEventDialog.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreEventDialog","type":"class","href":"views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog-class.md"}},{"name":"createState","qualifiedName":"explore_event_dialogue.ExploreEventDialog.createState","href":"views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"ExploreEventDialog","type":"class","href":"views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog-class.md"}},{"name":"explore_events","qualifiedName":"explore_events","href":"views_after_auth_screens_events_explore_events/views_after_auth_screens_events_explore_events-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ExploreEvents","qualifiedName":"explore_events.ExploreEvents","href":"views_after_auth_screens_events_explore_events/ExploreEvents-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Shows the list of events with options to categorize them.","enclosedBy":{"name":"explore_events","type":"library","href":"views_after_auth_screens_events_explore_events/views_after_auth_screens_events_explore_events-library.md"}},{"name":"ExploreEvents","qualifiedName":"explore_events.ExploreEvents.ExploreEvents","href":"views_after_auth_screens_events_explore_events/ExploreEvents/ExploreEvents.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreEvents","type":"class","href":"views_after_auth_screens_events_explore_events/ExploreEvents-class.md"}},{"name":"build","qualifiedName":"explore_events.ExploreEvents.build","href":"views_after_auth_screens_events_explore_events/ExploreEvents/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"ExploreEvents","type":"class","href":"views_after_auth_screens_events_explore_events/ExploreEvents-class.md"}},{"name":"dropDownList","qualifiedName":"explore_events.ExploreEvents.dropDownList","href":"views_after_auth_screens_events_explore_events/ExploreEvents/dropDownList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Shows a list of dropdown taken from model and context.","enclosedBy":{"name":"ExploreEvents","type":"class","href":"views_after_auth_screens_events_explore_events/ExploreEvents-class.md"}},{"name":"homeModel","qualifiedName":"explore_events.ExploreEvents.homeModel","href":"views_after_auth_screens_events_explore_events/ExploreEvents/homeModel.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"homeModal is a type of MainScreenViewModel which provides methods to handle the data for this component.","enclosedBy":{"name":"ExploreEvents","type":"class","href":"views_after_auth_screens_events_explore_events/ExploreEvents-class.md"}},{"name":"explore_events_view_model","qualifiedName":"explore_events_view_model","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/view_model_after_auth_view_models_event_view_models_explore_events_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ExploreEventsViewModel","qualifiedName":"explore_events_view_model.ExploreEventsViewModel","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ExploreEventsViewModel class helps to interact with model to serve data to view for event explore section.","enclosedBy":{"name":"explore_events_view_model","type":"library","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/view_model_after_auth_view_models_event_view_models_explore_events_view_model-library.md"}},{"name":"ExploreEventsViewModel","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.ExploreEventsViewModel","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/ExploreEventsViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"checkIfExistsAndAddNewEvent","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.checkIfExistsAndAddNewEvent","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/checkIfExistsAndAddNewEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function add a new event if the event not exist.","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"choseValueFromDropdown","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.choseValueFromDropdown","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/choseValueFromDropdown.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function takes the choosen value from dropdown and\nreturn the filter events, if empty list then return relevant message.","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"chosenValue","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.chosenValue","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/chosenValue.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"deleteEvent","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.deleteEvent","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/deleteEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function deletes the event.","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"dispose","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.dispose","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/dispose.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Discards any resources used by the object. After this is called, the\nobject is not in a usable state and should be discarded (calls to\naddListener will throw after the object is disposed).","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"emptyListMessage","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.emptyListMessage","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/emptyListMessage.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"eventService","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.eventService","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/eventService.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"events","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.events","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/events.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"fetchNewEvents","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.fetchNewEvents","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/fetchNewEvents.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to fetch new events in the organization.\nThe function uses getEvents method from EventService.","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"initialise","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.initialise","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"refreshEvents","qualifiedName":"explore_events_view_model.ExploreEventsViewModel.refreshEvents","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/refreshEvents.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to refresh the events in the organization.\nThe function uses getEvents method from EventService.","enclosedBy":{"name":"ExploreEventsViewModel","type":"class","href":"view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md"}},{"name":"explore_tasks_view_model","qualifiedName":"explore_tasks_view_model","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ExploreTasksViewModel","qualifiedName":"explore_tasks_view_model.ExploreTasksViewModel","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ExploreTasksViewModel class helps to interact with model to serve data\nand react to user's input in Explore Task section.","enclosedBy":{"name":"explore_tasks_view_model","type":"library","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model-library.md"}},{"name":"ExploreTasksViewModel","qualifiedName":"explore_tasks_view_model.ExploreTasksViewModel.ExploreTasksViewModel","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/ExploreTasksViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreTasksViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md"}},{"name":"deleteTask","qualifiedName":"explore_tasks_view_model.ExploreTasksViewModel.deleteTask","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/deleteTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function deletes the task for an event.\nThe function uses deleteTask method of Task Service.","enclosedBy":{"name":"ExploreTasksViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md"}},{"name":"fetchTasks","qualifiedName":"explore_tasks_view_model.ExploreTasksViewModel.fetchTasks","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasks.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function fetch all the task for an event.\nThe function uses getTasksForEvent method of Task Service.","enclosedBy":{"name":"ExploreTasksViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md"}},{"name":"fetchTasksByUser","qualifiedName":"explore_tasks_view_model.ExploreTasksViewModel.fetchTasksByUser","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasksByUser.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function fetch tasks created by the current user for an event.\nThe function uses getTasksByUser method of Task Service.","enclosedBy":{"name":"ExploreTasksViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md"}},{"name":"tasks","qualifiedName":"explore_tasks_view_model.ExploreTasksViewModel.tasks","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/tasks.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ExploreTasksViewModel","type":"class","href":"view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md"}},{"name":"fetch_plugin_list","qualifiedName":"fetch_plugin_list","href":"plugins_fetch_plugin_list/plugins_fetch_plugin_list-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"FetchPluginList","qualifiedName":"fetch_plugin_list.FetchPluginList","href":"plugins_fetch_plugin_list/FetchPluginList-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class fetch plugins list.","enclosedBy":{"name":"fetch_plugin_list","type":"library","href":"plugins_fetch_plugin_list/plugins_fetch_plugin_list-library.md"}},{"name":"FetchPluginList","qualifiedName":"fetch_plugin_list.FetchPluginList.FetchPluginList","href":"plugins_fetch_plugin_list/FetchPluginList/FetchPluginList.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"Constructor of the class.","enclosedBy":{"name":"FetchPluginList","type":"class","href":"plugins_fetch_plugin_list/FetchPluginList-class.md"}},{"name":"box","qualifiedName":"fetch_plugin_list.FetchPluginList.box","href":"plugins_fetch_plugin_list/FetchPluginList/box.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"late initialize the box.","enclosedBy":{"name":"FetchPluginList","type":"class","href":"plugins_fetch_plugin_list/FetchPluginList-class.md"}},{"name":"fetchList","qualifiedName":"fetch_plugin_list.FetchPluginList.fetchList","href":"plugins_fetch_plugin_list/FetchPluginList/fetchList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Fetches plugins from server and stores them in Hive pluginBox.","enclosedBy":{"name":"FetchPluginList","type":"class","href":"plugins_fetch_plugin_list/FetchPluginList-class.md"}},{"name":"firebase_options","qualifiedName":"firebase_options","href":"firebase_options/firebase_options-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"DefaultFirebaseOptions","qualifiedName":"firebase_options.DefaultFirebaseOptions","href":"firebase_options/DefaultFirebaseOptions-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Default FirebaseOptions for use with your Firebase apps.","enclosedBy":{"name":"firebase_options","type":"library","href":"firebase_options/firebase_options-library.md"}},{"name":"DefaultFirebaseOptions","qualifiedName":"firebase_options.DefaultFirebaseOptions.DefaultFirebaseOptions","href":"firebase_options/DefaultFirebaseOptions/DefaultFirebaseOptions.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DefaultFirebaseOptions","type":"class","href":"firebase_options/DefaultFirebaseOptions-class.md"}},{"name":"android","qualifiedName":"firebase_options.DefaultFirebaseOptions.android","href":"firebase_options/DefaultFirebaseOptions/android.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Scaffolds androidFirebaseOptions around FirebaseOptions.","enclosedBy":{"name":"DefaultFirebaseOptions","type":"class","href":"firebase_options/DefaultFirebaseOptions-class.md"}},{"name":"currentPlatform","qualifiedName":"firebase_options.DefaultFirebaseOptions.currentPlatform","href":"firebase_options/DefaultFirebaseOptions/currentPlatform.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Builds and returns FirebaseOptions based on the current platform.","enclosedBy":{"name":"DefaultFirebaseOptions","type":"class","href":"firebase_options/DefaultFirebaseOptions-class.md"}},{"name":"ios","qualifiedName":"firebase_options.DefaultFirebaseOptions.ios","href":"firebase_options/DefaultFirebaseOptions/ios.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Scaffolds iosFirebaseOptions around FirebaseOptions.","enclosedBy":{"name":"DefaultFirebaseOptions","type":"class","href":"firebase_options/DefaultFirebaseOptions-class.md"}},{"name":"from_palisadoes","qualifiedName":"from_palisadoes","href":"widgets_from_palisadoes/widgets_from_palisadoes-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"FromPalisadoes","qualifiedName":"from_palisadoes.FromPalisadoes","href":"widgets_from_palisadoes/FromPalisadoes-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class generates the text \"From Palisadoes\" in a custom way.","enclosedBy":{"name":"from_palisadoes","type":"library","href":"widgets_from_palisadoes/widgets_from_palisadoes-library.md"}},{"name":"FromPalisadoes","qualifiedName":"from_palisadoes.FromPalisadoes.FromPalisadoes","href":"widgets_from_palisadoes/FromPalisadoes/FromPalisadoes.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"FromPalisadoes","type":"class","href":"widgets_from_palisadoes/FromPalisadoes-class.md"}},{"name":"build","qualifiedName":"from_palisadoes.FromPalisadoes.build","href":"widgets_from_palisadoes/FromPalisadoes/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"FromPalisadoes","type":"class","href":"widgets_from_palisadoes/FromPalisadoes-class.md"}},{"name":"generated_plugin_registrant","qualifiedName":"generated_plugin_registrant","href":"generated_plugin_registrant/generated_plugin_registrant-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"registerPlugins","qualifiedName":"generated_plugin_registrant.registerPlugins","href":"generated_plugin_registrant/registerPlugins.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"generated_plugin_registrant","type":"library","href":"generated_plugin_registrant/generated_plugin_registrant-library.md"}},{"name":"graphql_config","qualifiedName":"graphql_config","href":"services_graphql_config/services_graphql_config-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"GraphqlConfig","qualifiedName":"graphql_config.GraphqlConfig","href":"services_graphql_config/GraphqlConfig-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.\nTalawa uses graphQL for the integrating with the API's.\nYou can go through talawa-api, here.\nGraphqlConfig class provides service to configure graph ql API with talawa mobile-app.","enclosedBy":{"name":"graphql_config","type":"library","href":"services_graphql_config/services_graphql_config-library.md"}},{"name":"GraphqlConfig","qualifiedName":"graphql_config.GraphqlConfig.GraphqlConfig","href":"services_graphql_config/GraphqlConfig/GraphqlConfig.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"authClient","qualifiedName":"graphql_config.GraphqlConfig.authClient","href":"services_graphql_config/GraphqlConfig/authClient.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"clientToQuery","qualifiedName":"graphql_config.GraphqlConfig.clientToQuery","href":"services_graphql_config/GraphqlConfig/clientToQuery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"displayImgRoute","qualifiedName":"graphql_config.GraphqlConfig.displayImgRoute","href":"services_graphql_config/GraphqlConfig/displayImgRoute.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"getOrgUrl","qualifiedName":"graphql_config.GraphqlConfig.getOrgUrl","href":"services_graphql_config/GraphqlConfig/getOrgUrl.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get the organization URL.","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"getToken","qualifiedName":"graphql_config.GraphqlConfig.getToken","href":"services_graphql_config/GraphqlConfig/getToken.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get user the access token.","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"httpLink","qualifiedName":"graphql_config.GraphqlConfig.httpLink","href":"services_graphql_config/GraphqlConfig/httpLink.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"imageUrlKey","qualifiedName":"graphql_config.GraphqlConfig.imageUrlKey","href":"services_graphql_config/GraphqlConfig/imageUrlKey-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"orgURI","qualifiedName":"graphql_config.GraphqlConfig.orgURI","href":"services_graphql_config/GraphqlConfig/orgURI.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"test","qualifiedName":"graphql_config.GraphqlConfig.test","href":"services_graphql_config/GraphqlConfig/test.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"token","qualifiedName":"graphql_config.GraphqlConfig.token","href":"services_graphql_config/GraphqlConfig/token.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"urlKey","qualifiedName":"graphql_config.GraphqlConfig.urlKey","href":"services_graphql_config/GraphqlConfig/urlKey-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"webSocketLink","qualifiedName":"graphql_config.GraphqlConfig.webSocketLink","href":"services_graphql_config/GraphqlConfig/webSocketLink.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"GraphqlConfig","type":"class","href":"services_graphql_config/GraphqlConfig-class.md"}},{"name":"MockHttpClient","qualifiedName":"graphql_config.MockHttpClient","href":"services_graphql_config/MockHttpClient-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"A mock HTTP client designed for use when testing code that uses BaseClient.","enclosedBy":{"name":"graphql_config","type":"library","href":"services_graphql_config/services_graphql_config-library.md"}},{"name":"MockHttpClient","qualifiedName":"graphql_config.MockHttpClient.MockHttpClient","href":"services_graphql_config/MockHttpClient/MockHttpClient.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MockHttpClient","type":"class","href":"services_graphql_config/MockHttpClient-class.md"}},{"name":"send","qualifiedName":"graphql_config.MockHttpClient.send","href":"services_graphql_config/MockHttpClient/send.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Sends an HTTP request and asynchronously returns the response.","enclosedBy":{"name":"MockHttpClient","type":"class","href":"services_graphql_config/MockHttpClient-class.md"}},{"name":"individual_post","qualifiedName":"individual_post","href":"views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CommentTemplate","qualifiedName":"individual_post.CommentTemplate","href":"views_after_auth_screens_feed_individual_post/CommentTemplate-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CommentTemplate returns a widget of the individual user commented on the post.","enclosedBy":{"name":"individual_post","type":"library","href":"views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md"}},{"name":"CommentTemplate","qualifiedName":"individual_post.CommentTemplate.CommentTemplate","href":"views_after_auth_screens_feed_individual_post/CommentTemplate/CommentTemplate.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentTemplate","type":"class","href":"views_after_auth_screens_feed_individual_post/CommentTemplate-class.md"}},{"name":"build","qualifiedName":"individual_post.CommentTemplate.build","href":"views_after_auth_screens_feed_individual_post/CommentTemplate/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CommentTemplate","type":"class","href":"views_after_auth_screens_feed_individual_post/CommentTemplate-class.md"}},{"name":"comment","qualifiedName":"individual_post.CommentTemplate.comment","href":"views_after_auth_screens_feed_individual_post/CommentTemplate/comment.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CommentTemplate","type":"class","href":"views_after_auth_screens_feed_individual_post/CommentTemplate-class.md"}},{"name":"IndividualPageLikeSection","qualifiedName":"individual_post.IndividualPageLikeSection","href":"views_after_auth_screens_feed_individual_post/IndividualPageLikeSection-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"IndividualPageLikeSection returns a widget that show the list of all the users liked the post.","enclosedBy":{"name":"individual_post","type":"library","href":"views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md"}},{"name":"IndividualPageLikeSection","qualifiedName":"individual_post.IndividualPageLikeSection.IndividualPageLikeSection","href":"views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/IndividualPageLikeSection.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"IndividualPageLikeSection","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPageLikeSection-class.md"}},{"name":"build","qualifiedName":"individual_post.IndividualPageLikeSection.build","href":"views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"IndividualPageLikeSection","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPageLikeSection-class.md"}},{"name":"usersLiked","qualifiedName":"individual_post.IndividualPageLikeSection.usersLiked","href":"views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/usersLiked.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"IndividualPageLikeSection","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPageLikeSection-class.md"}},{"name":"IndividualPostCommentSection","qualifiedName":"individual_post.IndividualPostCommentSection","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"IndividualPostCommentSection returns a widget that show the list of all the users commented on the post.","enclosedBy":{"name":"individual_post","type":"library","href":"views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md"}},{"name":"IndividualPostCommentSection","qualifiedName":"individual_post.IndividualPostCommentSection.IndividualPostCommentSection","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/IndividualPostCommentSection.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"IndividualPostCommentSection","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md"}},{"name":"build","qualifiedName":"individual_post.IndividualPostCommentSection.build","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"IndividualPostCommentSection","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md"}},{"name":"comments","qualifiedName":"individual_post.IndividualPostCommentSection.comments","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/comments.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"IndividualPostCommentSection","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md"}},{"name":"postID","qualifiedName":"individual_post.IndividualPostCommentSection.postID","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/postID.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"IndividualPostCommentSection","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md"}},{"name":"IndividualPostView","qualifiedName":"individual_post.IndividualPostView","href":"views_after_auth_screens_feed_individual_post/IndividualPostView-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"IndividualPostView returns a widget that has mutable state _IndividualPostViewState.","enclosedBy":{"name":"individual_post","type":"library","href":"views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md"}},{"name":"IndividualPostView","qualifiedName":"individual_post.IndividualPostView.IndividualPostView","href":"views_after_auth_screens_feed_individual_post/IndividualPostView/IndividualPostView.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"IndividualPostView","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPostView-class.md"}},{"name":"createState","qualifiedName":"individual_post.IndividualPostView.createState","href":"views_after_auth_screens_feed_individual_post/IndividualPostView/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"IndividualPostView","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPostView-class.md"}},{"name":"post","qualifiedName":"individual_post.IndividualPostView.post","href":"views_after_auth_screens_feed_individual_post/IndividualPostView/post.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"IndividualPostView","type":"class","href":"views_after_auth_screens_feed_individual_post/IndividualPostView-class.md"}},{"name":"buildPadding","qualifiedName":"individual_post.buildPadding","href":"views_after_auth_screens_feed_individual_post/buildPadding.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"individual_post","type":"library","href":"views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md"}},{"name":"likedUserCircleAvatar","qualifiedName":"individual_post.likedUserCircleAvatar","href":"views_after_auth_screens_feed_individual_post/likedUserCircleAvatar.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"likedUserCircleAvatar returns a widget of the individual user liked the post.","enclosedBy":{"name":"individual_post","type":"library","href":"views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md"}},{"name":"invite_child","qualifiedName":"invite_child","href":"widgets_invite_child/widgets_invite_child-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"iconButton","qualifiedName":"invite_child.iconButton","href":"widgets_invite_child/iconButton.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"This function is for debugging purposes.\nIt prints \"tapped\" in the console for the developer to know that the button was tapped.","enclosedBy":{"name":"invite_child","type":"library","href":"widgets_invite_child/widgets_invite_child-library.md"}},{"name":"invite","qualifiedName":"invite_child.invite","href":"widgets_invite_child/invite.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"This widget gives us various options to invite someone to an organization.\nWe can use QR code scanner, social media platforms like twitter, whatsapp, telegram and many more.","enclosedBy":{"name":"invite_child","type":"library","href":"widgets_invite_child/widgets_invite_child-library.md"}},{"name":"join_organisation_after_auth","qualifiedName":"join_organisation_after_auth","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"JoinOrganisationAfterAuth","qualifiedName":"join_organisation_after_auth.JoinOrganisationAfterAuth","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"JoinOrganisationAfterAuth returns a widget for page to join the organization just after user authentication.","enclosedBy":{"name":"join_organisation_after_auth","type":"library","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth-library.md"}},{"name":"JoinOrganisationAfterAuth","qualifiedName":"join_organisation_after_auth.JoinOrganisationAfterAuth.JoinOrganisationAfterAuth","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/JoinOrganisationAfterAuth.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"JoinOrganisationAfterAuth","type":"class","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md"}},{"name":"build","qualifiedName":"join_organisation_after_auth.JoinOrganisationAfterAuth.build","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"JoinOrganisationAfterAuth","type":"class","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md"}},{"name":"orgId","qualifiedName":"join_organisation_after_auth.JoinOrganisationAfterAuth.orgId","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/orgId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"JoinOrganisationAfterAuth","type":"class","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md"}},{"name":"scanQR","qualifiedName":"join_organisation_after_auth.JoinOrganisationAfterAuth.scanQR","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/scanQR.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"scanQR returns a widget that is use in joining the organization via the QR code.","enclosedBy":{"name":"JoinOrganisationAfterAuth","type":"class","href":"views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md"}},{"name":"lang_switch","qualifiedName":"lang_switch","href":"widgets_lang_switch/widgets_lang_switch-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"LanguageTile","qualifiedName":"lang_switch.LanguageTile","href":"widgets_lang_switch/LanguageTile-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This widget enables language switch for \"internationalizing our app\".","enclosedBy":{"name":"lang_switch","type":"library","href":"widgets_lang_switch/widgets_lang_switch-library.md"}},{"name":"LanguageTile","qualifiedName":"lang_switch.LanguageTile.LanguageTile","href":"widgets_lang_switch/LanguageTile/LanguageTile.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LanguageTile","type":"class","href":"widgets_lang_switch/LanguageTile-class.md"}},{"name":"build","qualifiedName":"lang_switch.LanguageTile.build","href":"widgets_lang_switch/LanguageTile/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"LanguageTile","type":"class","href":"widgets_lang_switch/LanguageTile-class.md"}},{"name":"lang_view_model","qualifiedName":"lang_view_model","href":"view_model_lang_view_model/view_model_lang_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AppLanguage","qualifiedName":"lang_view_model.AppLanguage","href":"view_model_lang_view_model/AppLanguage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"AppLanguage view model class interact with modal in the context of the App Language.\nThe class provides methods that set's the language, change the language in the modal.","enclosedBy":{"name":"lang_view_model","type":"library","href":"view_model_lang_view_model/view_model_lang_view_model-library.md"}},{"name":"AppLanguage","qualifiedName":"lang_view_model.AppLanguage.AppLanguage","href":"view_model_lang_view_model/AppLanguage/AppLanguage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"appLanguageQuery","qualifiedName":"lang_view_model.AppLanguage.appLanguageQuery","href":"view_model_lang_view_model/AppLanguage/appLanguageQuery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function perform graphQL query to check the app language.\nThe function uses gqlAuthQuery method provided by Database Functions Services.","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"appLocal","qualifiedName":"lang_view_model.AppLanguage.appLocal","href":"view_model_lang_view_model/AppLanguage/appLocal.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"changeLanguage","qualifiedName":"lang_view_model.AppLanguage.changeLanguage","href":"view_model_lang_view_model/AppLanguage/changeLanguage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function change the app default language.","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"databaseFunctions","qualifiedName":"lang_view_model.AppLanguage.databaseFunctions","href":"view_model_lang_view_model/AppLanguage/databaseFunctions.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"dbLanguageUpdate","qualifiedName":"lang_view_model.AppLanguage.dbLanguageUpdate","href":"view_model_lang_view_model/AppLanguage/dbLanguageUpdate.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function updates the Database Language by running the graphQL mutations.","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"fetchLocale","qualifiedName":"lang_view_model.AppLanguage.fetchLocale","href":"view_model_lang_view_model/AppLanguage/fetchLocale.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function fetch the language of the user's app.","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"initialize","qualifiedName":"lang_view_model.AppLanguage.initialize","href":"view_model_lang_view_model/AppLanguage/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"isTest","qualifiedName":"lang_view_model.AppLanguage.isTest","href":"view_model_lang_view_model/AppLanguage/isTest.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"navigationService","qualifiedName":"lang_view_model.AppLanguage.navigationService","href":"view_model_lang_view_model/AppLanguage/navigationService.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"selectLanguagePress","qualifiedName":"lang_view_model.AppLanguage.selectLanguagePress","href":"view_model_lang_view_model/AppLanguage/selectLanguagePress.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function navigate user to /appSettingsPage route if the user is authenticated\nelse navigate to /setUrl route.","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"userLanguageQuery","qualifiedName":"lang_view_model.AppLanguage.userLanguageQuery","href":"view_model_lang_view_model/AppLanguage/userLanguageQuery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function perform graphQL query to check the user's language in the database.\nThe function uses gqlAuthQuery method provided by Database Functions Services.","enclosedBy":{"name":"AppLanguage","type":"class","href":"view_model_lang_view_model/AppLanguage-class.md"}},{"name":"language_icon","qualifiedName":"language_icon","href":"custom_painters_language_icon/custom_painters_language_icon-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"LanguageIcon","qualifiedName":"language_icon.LanguageIcon","href":"custom_painters_language_icon/LanguageIcon-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class draws the language icon using custom paint.\nCustomPaint is a widget from the Flutter SDK, which enables\nyou to use a canvas to draw different shapes.","enclosedBy":{"name":"language_icon","type":"library","href":"custom_painters_language_icon/custom_painters_language_icon-library.md"}},{"name":"LanguageIcon","qualifiedName":"language_icon.LanguageIcon.LanguageIcon","href":"custom_painters_language_icon/LanguageIcon/LanguageIcon.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LanguageIcon","type":"class","href":"custom_painters_language_icon/LanguageIcon-class.md"}},{"name":"paint","qualifiedName":"language_icon.LanguageIcon.paint","href":"custom_painters_language_icon/LanguageIcon/paint.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called whenever the object needs to paint. The given Canvas has its\ncoordinate space configured such that the origin is at the top left of the\nbox. The area of the box is the size of the size argument.","enclosedBy":{"name":"LanguageIcon","type":"class","href":"custom_painters_language_icon/LanguageIcon-class.md"}},{"name":"shouldRepaint","qualifiedName":"language_icon.LanguageIcon.shouldRepaint","href":"custom_painters_language_icon/LanguageIcon/shouldRepaint.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called whenever a new instance of the custom painter delegate class is\nprovided to the RenderCustomPaint object, or any time that a new\nCustomPaint object is created with a new instance of the custom painter\ndelegate class (which amounts to the same thing, because the latter is\nimplemented in terms of the former).","enclosedBy":{"name":"LanguageIcon","type":"class","href":"custom_painters_language_icon/LanguageIcon-class.md"}},{"name":"language_model","qualifiedName":"language_model","href":"models_language_language_model/models_language_language_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Language","qualifiedName":"language_model.Language","href":"models_language_language_model/Language-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates an langauge model.","enclosedBy":{"name":"language_model","type":"library","href":"models_language_language_model/models_language_language_model-library.md"}},{"name":"Language","qualifiedName":"language_model.Language.Language","href":"models_language_language_model/Language/Language.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Language","type":"class","href":"models_language_language_model/Language-class.md"}},{"name":"countryCode","qualifiedName":"language_model.Language.countryCode","href":"models_language_language_model/Language/countryCode.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Language","type":"class","href":"models_language_language_model/Language-class.md"}},{"name":"langCode","qualifiedName":"language_model.Language.langCode","href":"models_language_language_model/Language/langCode.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Language","type":"class","href":"models_language_language_model/Language-class.md"}},{"name":"langName","qualifiedName":"language_model.Language.langName","href":"models_language_language_model/Language/langName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Language","type":"class","href":"models_language_language_model/Language-class.md"}},{"name":"langSample","qualifiedName":"language_model.Language.langSample","href":"models_language_language_model/Language/langSample.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Language","type":"class","href":"models_language_language_model/Language-class.md"}},{"name":"like_button_view_model","qualifiedName":"like_button_view_model","href":"view_model_widgets_view_models_like_button_view_model/view_model_widgets_view_models_like_button_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"LikeButtonViewModel","qualifiedName":"like_button_view_model.LikeButtonViewModel","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"LikeButtonViewModel class helps to serve the data and\nto react to user's input for Like Button Widget.","enclosedBy":{"name":"like_button_view_model","type":"library","href":"view_model_widgets_view_models_like_button_view_model/view_model_widgets_view_models_like_button_view_model-library.md"}},{"name":"LikeButtonViewModel","qualifiedName":"like_button_view_model.LikeButtonViewModel.LikeButtonViewModel","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/LikeButtonViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"checkAndSetTheIsLiked","qualifiedName":"like_button_view_model.LikeButtonViewModel.checkAndSetTheIsLiked","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/checkAndSetTheIsLiked.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"dispose","qualifiedName":"like_button_view_model.LikeButtonViewModel.dispose","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/dispose.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Discards any resources used by the object. After this is called, the\nobject is not in a usable state and should be discarded (calls to\naddListener will throw after the object is disposed).","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"initialize","qualifiedName":"like_button_view_model.LikeButtonViewModel.initialize","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"isLiked","qualifiedName":"like_button_view_model.LikeButtonViewModel.isLiked","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/isLiked.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"likedBy","qualifiedName":"like_button_view_model.LikeButtonViewModel.likedBy","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likedBy.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"likesCount","qualifiedName":"like_button_view_model.LikeButtonViewModel.likesCount","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likesCount.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"setIsLiked","qualifiedName":"like_button_view_model.LikeButtonViewModel.setIsLiked","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/setIsLiked.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function set _isLike to true.","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"toggleIsLiked","qualifiedName":"like_button_view_model.LikeButtonViewModel.toggleIsLiked","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/toggleIsLiked.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function add like to the post if not liked and\nremove the like from the post if liked.","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"updatePost","qualifiedName":"like_button_view_model.LikeButtonViewModel.updatePost","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/updatePost.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function updates the Post.","enclosedBy":{"name":"LikeButtonViewModel","type":"class","href":"view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md"}},{"name":"locator","qualifiedName":"locator","href":"locator/locator-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"connectivity","qualifiedName":"locator.connectivity","href":"locator/connectivity.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for Connectivity.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"databaseFunctions","qualifiedName":"locator.databaseFunctions","href":"locator/databaseFunctions.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for DataBaseMutationFunctions.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"graphqlConfig","qualifiedName":"locator.graphqlConfig","href":"locator/graphqlConfig.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for GraphqlConfig.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"imageCropper","qualifiedName":"locator.imageCropper","href":"locator/imageCropper.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for ImageCropper.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"imagePicker","qualifiedName":"locator.imagePicker","href":"locator/imagePicker.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for ImagePicker.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"locator","qualifiedName":"locator.locator","href":"locator/locator.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"Intializaing the locator.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"navigationService","qualifiedName":"locator.navigationService","href":"locator/navigationService.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for NavigationService.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"organizationService","qualifiedName":"locator.organizationService","href":"locator/organizationService.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for OrganizationService.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"queries","qualifiedName":"locator.queries","href":"locator/queries.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for Queries.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"setupLocator","qualifiedName":"locator.setupLocator","href":"locator/setupLocator.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"This function registers the widgets/objects in \"GetIt\".","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"sizeConfig","qualifiedName":"locator.sizeConfig","href":"locator/sizeConfig.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for SizeConfig.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"userConfig","qualifiedName":"locator.userConfig","href":"locator/userConfig.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"creating GetIt for UserConfig.","enclosedBy":{"name":"locator","type":"library","href":"locator/locator-library.md"}},{"name":"login","qualifiedName":"login","href":"views_pre_auth_screens_login/views_pre_auth_screens_login-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Login","qualifiedName":"login.Login","href":"views_pre_auth_screens_login/Login-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This is the login widget.\nThere are two input fiels. The first one takes in the email and\nthe second one takes in the password of the user.\nThere is also a \"Forgot Password\" text button, which directs to\nthe \"recover password\" screen when pressed.\nAt the bottom, there is a login button to initiate the login.","enclosedBy":{"name":"login","type":"library","href":"views_pre_auth_screens_login/views_pre_auth_screens_login-library.md"}},{"name":"Login","qualifiedName":"login.Login.Login","href":"views_pre_auth_screens_login/Login/Login.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Login","type":"class","href":"views_pre_auth_screens_login/Login-class.md"}},{"name":"createState","qualifiedName":"login.Login.createState","href":"views_pre_auth_screens_login/Login/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"Login","type":"class","href":"views_pre_auth_screens_login/Login-class.md"}},{"name":"login_view_model","qualifiedName":"login_view_model","href":"view_model_pre_auth_view_models_login_view_model/view_model_pre_auth_view_models_login_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"LoginViewModel","qualifiedName":"login_view_model.LoginViewModel","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"LoginViewModel class helps to interact with model to serve data\nand react to user's input in Login View.","enclosedBy":{"name":"login_view_model","type":"library","href":"view_model_pre_auth_view_models_login_view_model/view_model_pre_auth_view_models_login_view_model-library.md"}},{"name":"LoginViewModel","qualifiedName":"login_view_model.LoginViewModel.LoginViewModel","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/LoginViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"email","qualifiedName":"login_view_model.LoginViewModel.email","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/email.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"emailFocus","qualifiedName":"login_view_model.LoginViewModel.emailFocus","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/emailFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"formKey","qualifiedName":"login_view_model.LoginViewModel.formKey","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/formKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"greeting","qualifiedName":"login_view_model.LoginViewModel.greeting","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/greeting.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"hidePassword","qualifiedName":"login_view_model.LoginViewModel.hidePassword","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/hidePassword.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"initialize","qualifiedName":"login_view_model.LoginViewModel.initialize","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"login","qualifiedName":"login_view_model.LoginViewModel.login","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/login.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to sign-in the user into application.","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"password","qualifiedName":"login_view_model.LoginViewModel.password","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/password.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"passwordFocus","qualifiedName":"login_view_model.LoginViewModel.passwordFocus","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/passwordFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"validate","qualifiedName":"login_view_model.LoginViewModel.validate","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel/validate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LoginViewModel","type":"class","href":"view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md"}},{"name":"main","qualifiedName":"main","href":"main/main-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"DemoPageView","qualifiedName":"main.DemoPageView","href":"main/DemoPageView-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"PageView is a scrollable list that works page by page.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"DemoPageView","qualifiedName":"main.DemoPageView.DemoPageView","href":"main/DemoPageView/DemoPageView.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DemoPageView","type":"class","href":"main/DemoPageView-class.md"}},{"name":"build","qualifiedName":"main.DemoPageView.build","href":"main/DemoPageView/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"DemoPageView","type":"class","href":"main/DemoPageView-class.md"}},{"name":"DemoViewModel","qualifiedName":"main.DemoViewModel","href":"main/DemoViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ViewModel uses property-based data binding to establish a connection.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"DemoViewModel","qualifiedName":"main.DemoViewModel.DemoViewModel","href":"main/DemoViewModel/DemoViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DemoViewModel","type":"class","href":"main/DemoViewModel-class.md"}},{"name":"title","qualifiedName":"main.DemoViewModel.title","href":"main/DemoViewModel/title.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Getter function of the title.","enclosedBy":{"name":"DemoViewModel","type":"class","href":"main/DemoViewModel-class.md"}},{"name":"MyApp","qualifiedName":"main.MyApp","href":"main/MyApp-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Main widget that sets up the quick actions, internationalization, routing , notifications.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"MyApp","qualifiedName":"main.MyApp.MyApp","href":"main/MyApp/MyApp.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MyApp","type":"class","href":"main/MyApp-class.md"}},{"name":"createState","qualifiedName":"main.MyApp.createState","href":"main/MyApp/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"MyApp","type":"class","href":"main/MyApp-class.md"}},{"name":"androidFirebaseOptions","qualifiedName":"main.androidFirebaseOptions","href":"main/androidFirebaseOptions.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"HashMap of Firebase options for android.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"channel","qualifiedName":"main.channel","href":"main/channel.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"Create a AndroidNotificationChannel for heads up notifications.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"flutterLocalNotificationsPlugin","qualifiedName":"main.flutterLocalNotificationsPlugin","href":"main/flutterLocalNotificationsPlugin.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"Initialize the FlutterLocalNotificationsPlugin package.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"iosFirebaseOptions","qualifiedName":"main.iosFirebaseOptions","href":"main/iosFirebaseOptions.md","type":"top-level property","overriddenDepth":0,"packageName":"talawa","desc":"HashMap of Firebase options for android.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"main","qualifiedName":"main.main","href":"main/main.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"First function to initialize the application, invoked automatically.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"setUpFirebase","qualifiedName":"main.setUpFirebase","href":"main/setUpFirebase.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"Initializes the firebase in the app according to the userplatform (android/iOS).","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"setUpFirebaseKeys","qualifiedName":"main.setUpFirebaseKeys","href":"main/setUpFirebaseKeys.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"Initializes the firebase keys in the app according to the userplatform (android/iOS).","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"setUpFirebaseMessaging","qualifiedName":"main.setUpFirebaseMessaging","href":"main/setUpFirebaseMessaging.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"Set up firebase instance, enbables messaging,listens to icoming messages.","enclosedBy":{"name":"main","type":"library","href":"main/main-library.md"}},{"name":"main_screen","qualifiedName":"main_screen","href":"views_main_screen/views_main_screen-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"MainScreen","qualifiedName":"main_screen.MainScreen","href":"views_main_screen/MainScreen-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"main_screen","type":"library","href":"views_main_screen/views_main_screen-library.md"}},{"name":"MainScreen","qualifiedName":"main_screen.MainScreen.MainScreen","href":"views_main_screen/MainScreen/MainScreen.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MainScreen","type":"class","href":"views_main_screen/MainScreen-class.md"}},{"name":"createState","qualifiedName":"main_screen.MainScreen.createState","href":"views_main_screen/MainScreen/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"MainScreen","type":"class","href":"views_main_screen/MainScreen-class.md"}},{"name":"mainScreenArgs","qualifiedName":"main_screen.MainScreen.mainScreenArgs","href":"views_main_screen/MainScreen/mainScreenArgs.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MainScreen","type":"class","href":"views_main_screen/MainScreen-class.md"}},{"name":"main_screen_view_model","qualifiedName":"main_screen_view_model","href":"view_model_main_screen_view_model/view_model_main_screen_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"MainScreenViewModel","qualifiedName":"main_screen_view_model.MainScreenViewModel","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"MainScreenViewModel class provide methods to interact with the modal to serve data in user's action in Main Screen Views.","enclosedBy":{"name":"main_screen_view_model","type":"library","href":"view_model_main_screen_view_model/view_model_main_screen_view_model-library.md"}},{"name":"MainScreenViewModel","qualifiedName":"main_screen_view_model.MainScreenViewModel.MainScreenViewModel","href":"view_model_main_screen_view_model/MainScreenViewModel/MainScreenViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"context","qualifiedName":"main_screen_view_model.MainScreenViewModel.context","href":"view_model_main_screen_view_model/MainScreenViewModel/context.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"context consist of parent info.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"currentPageIndex","qualifiedName":"main_screen_view_model.MainScreenViewModel.currentPageIndex","href":"view_model_main_screen_view_model/MainScreenViewModel/currentPageIndex.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"var for current page in index.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"fetchAndAddPlugins","qualifiedName":"main_screen_view_model.MainScreenViewModel.fetchAndAddPlugins","href":"view_model_main_screen_view_model/MainScreenViewModel/fetchAndAddPlugins.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Dynamically adds BottomNavigationBarItems in BottomNavigationBar.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"focusTarget","qualifiedName":"main_screen_view_model.MainScreenViewModel.focusTarget","href":"view_model_main_screen_view_model/MainScreenViewModel/focusTarget.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This returns a widget for a step in a tutorial.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"initialise","qualifiedName":"main_screen_view_model.MainScreenViewModel.initialise","href":"view_model_main_screen_view_model/MainScreenViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Initalizing function.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyBNChat","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyBNChat","href":"view_model_main_screen_view_model/MainScreenViewModel/keyBNChat.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyBNEvents","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyBNEvents","href":"view_model_main_screen_view_model/MainScreenViewModel/keyBNEvents.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyBNHome","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyBNHome","href":"view_model_main_screen_view_model/MainScreenViewModel/keyBNHome.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyBNPost","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyBNPost","href":"view_model_main_screen_view_model/MainScreenViewModel/keyBNPost.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyBNProfile","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyBNProfile","href":"view_model_main_screen_view_model/MainScreenViewModel/keyBNProfile.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyDrawerCurOrg","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyDrawerCurOrg","href":"view_model_main_screen_view_model/MainScreenViewModel/keyDrawerCurOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyDrawerJoinOrg","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyDrawerJoinOrg","href":"view_model_main_screen_view_model/MainScreenViewModel/keyDrawerJoinOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyDrawerLeaveCurrentOrg","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyDrawerLeaveCurrentOrg","href":"view_model_main_screen_view_model/MainScreenViewModel/keyDrawerLeaveCurrentOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keyDrawerSwitchableOrg","qualifiedName":"main_screen_view_model.MainScreenViewModel.keyDrawerSwitchableOrg","href":"view_model_main_screen_view_model/MainScreenViewModel/keyDrawerSwitchableOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySEAdd","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySEAdd","href":"view_model_main_screen_view_model/MainScreenViewModel/keySEAdd.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySECard","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySECard","href":"view_model_main_screen_view_model/MainScreenViewModel/keySECard.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySECategoryMenu","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySECategoryMenu","href":"view_model_main_screen_view_model/MainScreenViewModel/keySECategoryMenu.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySEDateFilter","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySEDateFilter","href":"view_model_main_screen_view_model/MainScreenViewModel/keySEDateFilter.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySHMenuIcon","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySHMenuIcon","href":"view_model_main_screen_view_model/MainScreenViewModel/keySHMenuIcon.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySHOrgName","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySHOrgName","href":"view_model_main_screen_view_model/MainScreenViewModel/keySHOrgName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySHPinnedPost","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySHPinnedPost","href":"view_model_main_screen_view_model/MainScreenViewModel/keySHPinnedPost.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySHPost","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySHPost","href":"view_model_main_screen_view_model/MainScreenViewModel/keySHPost.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySPAppSetting","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySPAppSetting","href":"view_model_main_screen_view_model/MainScreenViewModel/keySPAppSetting.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySPDonateUs","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySPDonateUs","href":"view_model_main_screen_view_model/MainScreenViewModel/keySPDonateUs.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySPEditProfile","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySPEditProfile","href":"view_model_main_screen_view_model/MainScreenViewModel/keySPEditProfile.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySPHelp","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySPHelp","href":"view_model_main_screen_view_model/MainScreenViewModel/keySPHelp.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySPInvite","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySPInvite","href":"view_model_main_screen_view_model/MainScreenViewModel/keySPInvite.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySPLogout","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySPLogout","href":"view_model_main_screen_view_model/MainScreenViewModel/keySPLogout.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"keySPPalisadoes","qualifiedName":"main_screen_view_model.MainScreenViewModel.keySPPalisadoes","href":"view_model_main_screen_view_model/MainScreenViewModel/keySPPalisadoes.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"navBarItems","qualifiedName":"main_screen_view_model.MainScreenViewModel.navBarItems","href":"view_model_main_screen_view_model/MainScreenViewModel/navBarItems.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Actual BottomNavigationBarItems that show up on the screen.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"onTabTapped","qualifiedName":"main_screen_view_model.MainScreenViewModel.onTabTapped","href":"view_model_main_screen_view_model/MainScreenViewModel/onTabTapped.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Handles click on BottomNavigationBarItem.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"pages","qualifiedName":"main_screen_view_model.MainScreenViewModel.pages","href":"view_model_main_screen_view_model/MainScreenViewModel/pages.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Contains the Widgets to be rendered for corresponding navbar items.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"pluginList","qualifiedName":"main_screen_view_model.MainScreenViewModel.pluginList","href":"view_model_main_screen_view_model/MainScreenViewModel/pluginList.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"list of all the pluginList.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"pluginPrototypeData","qualifiedName":"main_screen_view_model.MainScreenViewModel.pluginPrototypeData","href":"view_model_main_screen_view_model/MainScreenViewModel/pluginPrototypeData.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Maps the feature names with their proper Icon and Page.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"scaffoldKey","qualifiedName":"main_screen_view_model.MainScreenViewModel.scaffoldKey","href":"view_model_main_screen_view_model/MainScreenViewModel/scaffoldKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"showAppTour","qualifiedName":"main_screen_view_model.MainScreenViewModel.showAppTour","href":"view_model_main_screen_view_model/MainScreenViewModel/showAppTour.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"bool to determine if we wanna show the apptour.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"showHome","qualifiedName":"main_screen_view_model.MainScreenViewModel.showHome","href":"view_model_main_screen_view_model/MainScreenViewModel/showHome.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function shows the Home screen.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"showTutorial","qualifiedName":"main_screen_view_model.MainScreenViewModel.showTutorial","href":"view_model_main_screen_view_model/MainScreenViewModel/showTutorial.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function show tutorial to user.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"targets","qualifiedName":"main_screen_view_model.MainScreenViewModel.targets","href":"view_model_main_screen_view_model/MainScreenViewModel/targets.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"array of target.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"tourAddPost","qualifiedName":"main_screen_view_model.MainScreenViewModel.tourAddPost","href":"view_model_main_screen_view_model/MainScreenViewModel/tourAddPost.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function show the tutorial to add Post in the organization.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"tourChat","qualifiedName":"main_screen_view_model.MainScreenViewModel.tourChat","href":"view_model_main_screen_view_model/MainScreenViewModel/tourChat.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function show the tour of chats.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"tourComplete","qualifiedName":"main_screen_view_model.MainScreenViewModel.tourComplete","href":"view_model_main_screen_view_model/MainScreenViewModel/tourComplete.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"bool to determine if apptour is complete.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"tourEventTargets","qualifiedName":"main_screen_view_model.MainScreenViewModel.tourEventTargets","href":"view_model_main_screen_view_model/MainScreenViewModel/tourEventTargets.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function show the tutorial for Events.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"tourHomeTargets","qualifiedName":"main_screen_view_model.MainScreenViewModel.tourHomeTargets","href":"view_model_main_screen_view_model/MainScreenViewModel/tourHomeTargets.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"this functions starts the tour and info to be displayed is mentioned in this functions.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"tourProfile","qualifiedName":"main_screen_view_model.MainScreenViewModel.tourProfile","href":"view_model_main_screen_view_model/MainScreenViewModel/tourProfile.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function show the tutorial for the profile page.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"tourSkipped","qualifiedName":"main_screen_view_model.MainScreenViewModel.tourSkipped","href":"view_model_main_screen_view_model/MainScreenViewModel/tourSkipped.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"bool to determine if apptour is skipped.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"tutorialCoachMark","qualifiedName":"main_screen_view_model.MainScreenViewModel.tutorialCoachMark","href":"view_model_main_screen_view_model/MainScreenViewModel/tutorialCoachMark.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"tutorialCoachMark consist of coach used to give tutorial.","enclosedBy":{"name":"MainScreenViewModel","type":"class","href":"view_model_main_screen_view_model/MainScreenViewModel-class.md"}},{"name":"mainscreen_navigation_args","qualifiedName":"mainscreen_navigation_args","href":"models_mainscreen_navigation_args/models_mainscreen_navigation_args-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"MainScreenArgs","qualifiedName":"mainscreen_navigation_args.MainScreenArgs","href":"models_mainscreen_navigation_args/MainScreenArgs-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"mainscreen_navigation_args","type":"library","href":"models_mainscreen_navigation_args/models_mainscreen_navigation_args-library.md"}},{"name":"MainScreenArgs","qualifiedName":"mainscreen_navigation_args.MainScreenArgs.MainScreenArgs","href":"models_mainscreen_navigation_args/MainScreenArgs/MainScreenArgs.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MainScreenArgs","type":"class","href":"models_mainscreen_navigation_args/MainScreenArgs-class.md"}},{"name":"fromSignUp","qualifiedName":"mainscreen_navigation_args.MainScreenArgs.fromSignUp","href":"models_mainscreen_navigation_args/MainScreenArgs/fromSignUp.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MainScreenArgs","type":"class","href":"models_mainscreen_navigation_args/MainScreenArgs-class.md"}},{"name":"mainScreenIndex","qualifiedName":"mainscreen_navigation_args.MainScreenArgs.mainScreenIndex","href":"models_mainscreen_navigation_args/MainScreenArgs/mainScreenIndex.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MainScreenArgs","type":"class","href":"models_mainscreen_navigation_args/MainScreenArgs-class.md"}},{"name":"map_screen","qualifiedName":"map_screen","href":"views_after_auth_screens_venue_map_screen/views_after_auth_screens_venue_map_screen-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"MapScreen","qualifiedName":"map_screen.MapScreen","href":"views_after_auth_screens_venue_map_screen/MapScreen-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"MapScreen returns a widget that has mutable state _MapScreenState.","enclosedBy":{"name":"map_screen","type":"library","href":"views_after_auth_screens_venue_map_screen/views_after_auth_screens_venue_map_screen-library.md"}},{"name":"MapScreen","qualifiedName":"map_screen.MapScreen.MapScreen","href":"views_after_auth_screens_venue_map_screen/MapScreen/MapScreen.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MapScreen","type":"class","href":"views_after_auth_screens_venue_map_screen/MapScreen-class.md"}},{"name":"createState","qualifiedName":"map_screen.MapScreen.createState","href":"views_after_auth_screens_venue_map_screen/MapScreen/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"MapScreen","type":"class","href":"views_after_auth_screens_venue_map_screen/MapScreen-class.md"}},{"name":"latitude","qualifiedName":"map_screen.MapScreen.latitude","href":"views_after_auth_screens_venue_map_screen/MapScreen/latitude.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MapScreen","type":"class","href":"views_after_auth_screens_venue_map_screen/MapScreen-class.md"}},{"name":"longitude","qualifiedName":"map_screen.MapScreen.longitude","href":"views_after_auth_screens_venue_map_screen/MapScreen/longitude.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MapScreen","type":"class","href":"views_after_auth_screens_venue_map_screen/MapScreen-class.md"}},{"name":"model","qualifiedName":"map_screen.MapScreen.model","href":"views_after_auth_screens_venue_map_screen/MapScreen/model.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MapScreen","type":"class","href":"views_after_auth_screens_venue_map_screen/MapScreen-class.md"}},{"name":"member_name_tile","qualifiedName":"member_name_tile","href":"widgets_member_name_tile/widgets_member_name_tile-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"MemberNameTile","qualifiedName":"member_name_tile.MemberNameTile","href":"widgets_member_name_tile/MemberNameTile-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This widget returns a tile containing the name of the member.\nAlong with the name, there is a circle avatar which either contains\nthe image uploaded by the user or the first character of his/her name in\nuppercase.","enclosedBy":{"name":"member_name_tile","type":"library","href":"widgets_member_name_tile/widgets_member_name_tile-library.md"}},{"name":"MemberNameTile","qualifiedName":"member_name_tile.MemberNameTile.MemberNameTile","href":"widgets_member_name_tile/MemberNameTile/MemberNameTile.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MemberNameTile","type":"class","href":"widgets_member_name_tile/MemberNameTile-class.md"}},{"name":"build","qualifiedName":"member_name_tile.MemberNameTile.build","href":"widgets_member_name_tile/MemberNameTile/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"MemberNameTile","type":"class","href":"widgets_member_name_tile/MemberNameTile-class.md"}},{"name":"onDelete","qualifiedName":"member_name_tile.MemberNameTile.onDelete","href":"widgets_member_name_tile/MemberNameTile/onDelete.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MemberNameTile","type":"class","href":"widgets_member_name_tile/MemberNameTile-class.md"}},{"name":"userImage","qualifiedName":"member_name_tile.MemberNameTile.userImage","href":"widgets_member_name_tile/MemberNameTile/userImage.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MemberNameTile","type":"class","href":"widgets_member_name_tile/MemberNameTile-class.md"}},{"name":"userName","qualifiedName":"member_name_tile.MemberNameTile.userName","href":"widgets_member_name_tile/MemberNameTile/userName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MemberNameTile","type":"class","href":"widgets_member_name_tile/MemberNameTile-class.md"}},{"name":"multi_media_pick_service","qualifiedName":"multi_media_pick_service","href":"services_third_party_service_multi_media_pick_service/services_third_party_service_multi_media_pick_service-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"MultiMediaPickerService","qualifiedName":"multi_media_pick_service.MultiMediaPickerService","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This is a third party service which provide the service to select the image from.","enclosedBy":{"name":"multi_media_pick_service","type":"library","href":"services_third_party_service_multi_media_pick_service/services_third_party_service_multi_media_pick_service-library.md"}},{"name":"MultiMediaPickerService","qualifiedName":"multi_media_pick_service.MultiMediaPickerService.MultiMediaPickerService","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService/MultiMediaPickerService.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"MultiMediaPickerService","type":"class","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md"}},{"name":"cropImage","qualifiedName":"multi_media_pick_service.MultiMediaPickerService.cropImage","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService/cropImage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to crop the image selected by the user.","enclosedBy":{"name":"MultiMediaPickerService","type":"class","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md"}},{"name":"fileStream","qualifiedName":"multi_media_pick_service.MultiMediaPickerService.fileStream","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService/fileStream.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"This function returns the stream of files.","enclosedBy":{"name":"MultiMediaPickerService","type":"class","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md"}},{"name":"getPhotoFromGallery","qualifiedName":"multi_media_pick_service.MultiMediaPickerService.getPhotoFromGallery","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService/getPhotoFromGallery.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to pick the image from gallery or to click the image from user's camera.","enclosedBy":{"name":"MultiMediaPickerService","type":"class","href":"services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md"}},{"name":"navigation_service","qualifiedName":"navigation_service","href":"services_navigation_service/services_navigation_service-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"NavigationService","qualifiedName":"navigation_service.NavigationService","href":"services_navigation_service/NavigationService-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"NavigationService class provides different functions as service in the context of navigation.","enclosedBy":{"name":"navigation_service","type":"library","href":"services_navigation_service/services_navigation_service-library.md"}},{"name":"NavigationService","qualifiedName":"navigation_service.NavigationService.NavigationService","href":"services_navigation_service/NavigationService/NavigationService.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"fromInviteLink","qualifiedName":"navigation_service.NavigationService.fromInviteLink","href":"services_navigation_service/NavigationService/fromInviteLink.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"navigatorKey","qualifiedName":"navigation_service.NavigationService.navigatorKey","href":"services_navigation_service/NavigationService/navigatorKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"pop","qualifiedName":"navigation_service.NavigationService.pop","href":"services_navigation_service/NavigationService/pop.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function pops the current state.","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"popAndPushScreen","qualifiedName":"navigation_service.NavigationService.popAndPushScreen","href":"services_navigation_service/NavigationService/popAndPushScreen.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function pop the initial route and push the new route to the navigator.","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"pushDialog","qualifiedName":"navigation_service.NavigationService.pushDialog","href":"services_navigation_service/NavigationService/pushDialog.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to show the custom Dialog.","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"pushReplacementScreen","qualifiedName":"navigation_service.NavigationService.pushReplacementScreen","href":"services_navigation_service/NavigationService/pushReplacementScreen.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function push the route and replace the screen.","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"pushScreen","qualifiedName":"navigation_service.NavigationService.pushScreen","href":"services_navigation_service/NavigationService/pushScreen.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function push the route to the navigator.","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"removeAllAndPush","qualifiedName":"navigation_service.NavigationService.removeAllAndPush","href":"services_navigation_service/NavigationService/removeAllAndPush.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function remove all the routes till the particular route and add new route.","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"showSnackBar","qualifiedName":"navigation_service.NavigationService.showSnackBar","href":"services_navigation_service/NavigationService/showSnackBar.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This is used for the quick alert of duration: 2 seconds with text message(passed).","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"showTalawaErrorDialog","qualifiedName":"navigation_service.NavigationService.showTalawaErrorDialog","href":"services_navigation_service/NavigationService/showTalawaErrorDialog.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"showTalawaErrorSnackBar","qualifiedName":"navigation_service.NavigationService.showTalawaErrorSnackBar","href":"services_navigation_service/NavigationService/showTalawaErrorSnackBar.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"NavigationService","type":"class","href":"services_navigation_service/NavigationService-class.md"}},{"name":"options","qualifiedName":"options","href":"models_options_options/models_options_options-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Options","qualifiedName":"options.Options","href":"models_options_options/Options-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates a Option model.","enclosedBy":{"name":"options","type":"library","href":"models_options_options/models_options_options-library.md"}},{"name":"Options","qualifiedName":"options.Options.Options","href":"models_options_options/Options/Options.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Options","type":"class","href":"models_options_options/Options-class.md"}},{"name":"icon","qualifiedName":"options.Options.icon","href":"models_options_options/Options/icon.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Options","type":"class","href":"models_options_options/Options-class.md"}},{"name":"subtitle","qualifiedName":"options.Options.subtitle","href":"models_options_options/Options/subtitle.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Options","type":"class","href":"models_options_options/Options-class.md"}},{"name":"title","qualifiedName":"options.Options.title","href":"models_options_options/Options/title.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Options","type":"class","href":"models_options_options/Options-class.md"}},{"name":"trailingIconButton","qualifiedName":"options.Options.trailingIconButton","href":"models_options_options/Options/trailingIconButton.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Options","type":"class","href":"models_options_options/Options-class.md"}},{"name":"org_info","qualifiedName":"org_info","href":"models_organization_org_info/models_organization_org_info-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"OrgInfo","qualifiedName":"org_info.OrgInfo","href":"models_organization_org_info/OrgInfo-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates an organization-information model and returns an OrgInfo instance.","enclosedBy":{"name":"org_info","type":"library","href":"models_organization_org_info/models_organization_org_info-library.md"}},{"name":"OrgInfo","qualifiedName":"org_info.OrgInfo.OrgInfo","href":"models_organization_org_info/OrgInfo/OrgInfo.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"admins","qualifiedName":"org_info.OrgInfo.admins","href":"models_organization_org_info/OrgInfo/admins.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"creatorInfo","qualifiedName":"org_info.OrgInfo.creatorInfo","href":"models_organization_org_info/OrgInfo/creatorInfo.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"description","qualifiedName":"org_info.OrgInfo.description","href":"models_organization_org_info/OrgInfo/description.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"OrgInfo.fromJson","qualifiedName":"org_info.OrgInfo.fromJson","href":"models_organization_org_info/OrgInfo/OrgInfo.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"fromJsonToList","qualifiedName":"org_info.OrgInfo.fromJsonToList","href":"models_organization_org_info/OrgInfo/fromJsonToList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"id","qualifiedName":"org_info.OrgInfo.id","href":"models_organization_org_info/OrgInfo/id.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"image","qualifiedName":"org_info.OrgInfo.image","href":"models_organization_org_info/OrgInfo/image.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"isPublic","qualifiedName":"org_info.OrgInfo.isPublic","href":"models_organization_org_info/OrgInfo/isPublic.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"members","qualifiedName":"org_info.OrgInfo.members","href":"models_organization_org_info/OrgInfo/members.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"name","qualifiedName":"org_info.OrgInfo.name","href":"models_organization_org_info/OrgInfo/name.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfo","type":"class","href":"models_organization_org_info/OrgInfo-class.md"}},{"name":"OrgInfoAdapter","qualifiedName":"org_info.OrgInfoAdapter","href":"models_organization_org_info/OrgInfoAdapter-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"org_info","type":"library","href":"models_organization_org_info/models_organization_org_info-library.md"}},{"name":"operator ==","qualifiedName":"org_info.OrgInfoAdapter.==","href":"models_organization_org_info/OrgInfoAdapter/operator_equals.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"The equality operator.","enclosedBy":{"name":"OrgInfoAdapter","type":"class","href":"models_organization_org_info/OrgInfoAdapter-class.md"}},{"name":"OrgInfoAdapter","qualifiedName":"org_info.OrgInfoAdapter.OrgInfoAdapter","href":"models_organization_org_info/OrgInfoAdapter/OrgInfoAdapter.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrgInfoAdapter","type":"class","href":"models_organization_org_info/OrgInfoAdapter-class.md"}},{"name":"hashCode","qualifiedName":"org_info.OrgInfoAdapter.hashCode","href":"models_organization_org_info/OrgInfoAdapter/hashCode.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"The hash code for this object.","enclosedBy":{"name":"OrgInfoAdapter","type":"class","href":"models_organization_org_info/OrgInfoAdapter-class.md"}},{"name":"read","qualifiedName":"org_info.OrgInfoAdapter.read","href":"models_organization_org_info/OrgInfoAdapter/read.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Is called when a value has to be decoded.","enclosedBy":{"name":"OrgInfoAdapter","type":"class","href":"models_organization_org_info/OrgInfoAdapter-class.md"}},{"name":"typeId","qualifiedName":"org_info.OrgInfoAdapter.typeId","href":"models_organization_org_info/OrgInfoAdapter/typeId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Called for type registration","enclosedBy":{"name":"OrgInfoAdapter","type":"class","href":"models_organization_org_info/OrgInfoAdapter-class.md"}},{"name":"write","qualifiedName":"org_info.OrgInfoAdapter.write","href":"models_organization_org_info/OrgInfoAdapter/write.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Is called when a value has to be encoded.","enclosedBy":{"name":"OrgInfoAdapter","type":"class","href":"models_organization_org_info/OrgInfoAdapter-class.md"}},{"name":"org_service","qualifiedName":"org_service","href":"services_org_service/services_org_service-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"OrganizationService","qualifiedName":"org_service.OrganizationService","href":"services_org_service/OrganizationService-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"OrganizationService class provides the in the context of organizations.","enclosedBy":{"name":"org_service","type":"library","href":"services_org_service/services_org_service-library.md"}},{"name":"OrganizationService","qualifiedName":"org_service.OrganizationService.OrganizationService","href":"services_org_service/OrganizationService/OrganizationService.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationService","type":"class","href":"services_org_service/OrganizationService-class.md"}},{"name":"getOrgMembersList","qualifiedName":"org_service.OrganizationService.getOrgMembersList","href":"services_org_service/OrganizationService/getOrgMembersList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function fetch and returns the list of organization members.","enclosedBy":{"name":"OrganizationService","type":"class","href":"services_org_service/OrganizationService-class.md"}},{"name":"organization_feed","qualifiedName":"organization_feed","href":"views_after_auth_screens_feed_organization_feed/views_after_auth_screens_feed_organization_feed-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"OrganizationFeed","qualifiedName":"organization_feed.OrganizationFeed","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"OrganizationFeed returns a widget that shows the feed of the organization.","enclosedBy":{"name":"organization_feed","type":"library","href":"views_after_auth_screens_feed_organization_feed/views_after_auth_screens_feed_organization_feed-library.md"}},{"name":"OrganizationFeed","qualifiedName":"organization_feed.OrganizationFeed.OrganizationFeed","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed/OrganizationFeed.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeed","type":"class","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md"}},{"name":"build","qualifiedName":"organization_feed.OrganizationFeed.build","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"OrganizationFeed","type":"class","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md"}},{"name":"forTest","qualifiedName":"organization_feed.OrganizationFeed.forTest","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed/forTest.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeed","type":"class","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md"}},{"name":"homeModel","qualifiedName":"organization_feed.OrganizationFeed.homeModel","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed/homeModel.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeed","type":"class","href":"views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md"}},{"name":"organization_feed_view_model","qualifiedName":"organization_feed_view_model","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"OrganizationFeedViewModel","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"OrganizationFeedViewModel class helps to interact with model to serve data to view for organization feed section.","enclosedBy":{"name":"organization_feed_view_model","type":"library","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model-library.md"}},{"name":"OrganizationFeedViewModel","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.OrganizationFeedViewModel","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/OrganizationFeedViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"addNewPost","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.addNewPost","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/addNewPost.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function adds new Post.","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"buildNewPosts","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.buildNewPosts","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/buildNewPosts.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function initialise _posts with newPosts.","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"currentOrgName","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.currentOrgName","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/currentOrgName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"dispose","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.dispose","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/dispose.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Discards any resources used by the object. After this is called, the\nobject is not in a usable state and should be discarded (calls to\naddListener will throw after the object is disposed).","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"fetchNewPosts","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.fetchNewPosts","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/fetchNewPosts.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function fetches new posts in the organization.","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"initialise","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.initialise","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"initializeWithDemoData","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.initializeWithDemoData","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initializeWithDemoData.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"istest","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.istest","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/istest.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"navigateToIndividualPage","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.navigateToIndividualPage","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToIndividualPage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function navigate to individual post page.","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"navigateToPinnedPostPage","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.navigateToPinnedPostPage","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToPinnedPostPage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function navigate to pinned post page.","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"pinnedPosts","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.pinnedPosts","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/pinnedPosts.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"posts","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.posts","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/posts.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"setCurrentOrganizationName","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.setCurrentOrganizationName","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/setCurrentOrganizationName.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function sets the organization name after update.","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"updatedPost","qualifiedName":"organization_feed_view_model.OrganizationFeedViewModel.updatedPost","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/updatedPost.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function updates the post.","enclosedBy":{"name":"OrganizationFeedViewModel","type":"class","href":"view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md"}},{"name":"organization_list","qualifiedName":"organization_list","href":"widgets_organization_list/widgets_organization_list-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"OrganizationList","qualifiedName":"organization_list.OrganizationList","href":"widgets_organization_list/OrganizationList-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class returns the OrganizationList widget.","enclosedBy":{"name":"organization_list","type":"library","href":"widgets_organization_list/widgets_organization_list-library.md"}},{"name":"OrganizationList","qualifiedName":"organization_list.OrganizationList.OrganizationList","href":"widgets_organization_list/OrganizationList/OrganizationList.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationList","type":"class","href":"widgets_organization_list/OrganizationList-class.md"}},{"name":"build","qualifiedName":"organization_list.OrganizationList.build","href":"widgets_organization_list/OrganizationList/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"OrganizationList","type":"class","href":"widgets_organization_list/OrganizationList-class.md"}},{"name":"model","qualifiedName":"organization_list.OrganizationList.model","href":"widgets_organization_list/OrganizationList/model.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"model is a type of SelectOrganizationViewModel which provides methods to handle the data for this component.","enclosedBy":{"name":"OrganizationList","type":"class","href":"widgets_organization_list/OrganizationList-class.md"}},{"name":"organization_search_list","qualifiedName":"organization_search_list","href":"widgets_organization_search_list/widgets_organization_search_list-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"OrganizationSearchList","qualifiedName":"organization_search_list.OrganizationSearchList","href":"widgets_organization_search_list/OrganizationSearchList-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"OrganizationSearchList class return a widget that shows all\nthe matching organizations searched on the search bar.","enclosedBy":{"name":"organization_search_list","type":"library","href":"widgets_organization_search_list/widgets_organization_search_list-library.md"}},{"name":"OrganizationSearchList","qualifiedName":"organization_search_list.OrganizationSearchList.OrganizationSearchList","href":"widgets_organization_search_list/OrganizationSearchList/OrganizationSearchList.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationSearchList","type":"class","href":"widgets_organization_search_list/OrganizationSearchList-class.md"}},{"name":"build","qualifiedName":"organization_search_list.OrganizationSearchList.build","href":"widgets_organization_search_list/OrganizationSearchList/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"OrganizationSearchList","type":"class","href":"widgets_organization_search_list/OrganizationSearchList-class.md"}},{"name":"model","qualifiedName":"organization_search_list.OrganizationSearchList.model","href":"widgets_organization_search_list/OrganizationSearchList/model.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"OrganizationSearchList","type":"class","href":"widgets_organization_search_list/OrganizationSearchList-class.md"}},{"name":"pinned_carousel_widget","qualifiedName":"pinned_carousel_widget","href":"widgets_pinned_carousel_widget/widgets_pinned_carousel_widget-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CustomCarouselScroller","qualifiedName":"pinned_carousel_widget.CustomCarouselScroller","href":"widgets_pinned_carousel_widget/CustomCarouselScroller-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"pinned_carousel_widget","type":"library","href":"widgets_pinned_carousel_widget/widgets_pinned_carousel_widget-library.md"}},{"name":"CustomCarouselScroller","qualifiedName":"pinned_carousel_widget.CustomCarouselScroller.CustomCarouselScroller","href":"widgets_pinned_carousel_widget/CustomCarouselScroller/CustomCarouselScroller.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomCarouselScroller","type":"class","href":"widgets_pinned_carousel_widget/CustomCarouselScroller-class.md"}},{"name":"createState","qualifiedName":"pinned_carousel_widget.CustomCarouselScroller.createState","href":"widgets_pinned_carousel_widget/CustomCarouselScroller/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"CustomCarouselScroller","type":"class","href":"widgets_pinned_carousel_widget/CustomCarouselScroller-class.md"}},{"name":"navigateToIndividualPostPage","qualifiedName":"pinned_carousel_widget.CustomCarouselScroller.navigateToIndividualPostPage","href":"widgets_pinned_carousel_widget/CustomCarouselScroller/navigateToIndividualPostPage.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomCarouselScroller","type":"class","href":"widgets_pinned_carousel_widget/CustomCarouselScroller-class.md"}},{"name":"pinnedPosts","qualifiedName":"pinned_carousel_widget.CustomCarouselScroller.pinnedPosts","href":"widgets_pinned_carousel_widget/CustomCarouselScroller/pinnedPosts.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomCarouselScroller","type":"class","href":"widgets_pinned_carousel_widget/CustomCarouselScroller-class.md"}},{"name":"CustomCarouselScrollerState","qualifiedName":"pinned_carousel_widget.CustomCarouselScrollerState","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CustomCarouselScrollerState class return a widget that is\nused to generate slider for pinned post on the top of the Home Screen.","enclosedBy":{"name":"pinned_carousel_widget","type":"library","href":"widgets_pinned_carousel_widget/widgets_pinned_carousel_widget-library.md"}},{"name":"CustomCarouselScrollerState","qualifiedName":"pinned_carousel_widget.CustomCarouselScrollerState.CustomCarouselScrollerState","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState/CustomCarouselScrollerState.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomCarouselScrollerState","type":"class","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md"}},{"name":"build","qualifiedName":"pinned_carousel_widget.CustomCarouselScrollerState.build","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CustomCarouselScrollerState","type":"class","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md"}},{"name":"controller","qualifiedName":"pinned_carousel_widget.CustomCarouselScrollerState.controller","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState/controller.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomCarouselScrollerState","type":"class","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md"}},{"name":"pindex","qualifiedName":"pinned_carousel_widget.CustomCarouselScrollerState.pindex","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState/pindex.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomCarouselScrollerState","type":"class","href":"widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md"}},{"name":"PinnedPostCarousel","qualifiedName":"pinned_carousel_widget.PinnedPostCarousel","href":"widgets_pinned_carousel_widget/PinnedPostCarousel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"PinnedPostCarousel class returns a widget for pinned posts in\nthe slider/carousel on the top of the Home Screen.\nTapping on a post will redirect you to the respective post screen.","enclosedBy":{"name":"pinned_carousel_widget","type":"library","href":"widgets_pinned_carousel_widget/widgets_pinned_carousel_widget-library.md"}},{"name":"PinnedPostCarousel","qualifiedName":"pinned_carousel_widget.PinnedPostCarousel.PinnedPostCarousel","href":"widgets_pinned_carousel_widget/PinnedPostCarousel/PinnedPostCarousel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PinnedPostCarousel","type":"class","href":"widgets_pinned_carousel_widget/PinnedPostCarousel-class.md"}},{"name":"build","qualifiedName":"pinned_carousel_widget.PinnedPostCarousel.build","href":"widgets_pinned_carousel_widget/PinnedPostCarousel/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"PinnedPostCarousel","type":"class","href":"widgets_pinned_carousel_widget/PinnedPostCarousel-class.md"}},{"name":"navigateToIndividualPostPage","qualifiedName":"pinned_carousel_widget.PinnedPostCarousel.navigateToIndividualPostPage","href":"widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToIndividualPostPage.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PinnedPostCarousel","type":"class","href":"widgets_pinned_carousel_widget/PinnedPostCarousel-class.md"}},{"name":"navigateToPinnedPostPage","qualifiedName":"pinned_carousel_widget.PinnedPostCarousel.navigateToPinnedPostPage","href":"widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToPinnedPostPage.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PinnedPostCarousel","type":"class","href":"widgets_pinned_carousel_widget/PinnedPostCarousel-class.md"}},{"name":"pinnedPosts","qualifiedName":"pinned_carousel_widget.PinnedPostCarousel.pinnedPosts","href":"widgets_pinned_carousel_widget/PinnedPostCarousel/pinnedPosts.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PinnedPostCarousel","type":"class","href":"widgets_pinned_carousel_widget/PinnedPostCarousel-class.md"}},{"name":"pinned_post_demo_data","qualifiedName":"pinned_post_demo_data","href":"demo_server_data_pinned_post_demo_data/demo_server_data_pinned_post_demo_data-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"pinnedPostsDemoData","qualifiedName":"pinned_post_demo_data.pinnedPostsDemoData","href":"demo_server_data_pinned_post_demo_data/pinnedPostsDemoData-constant.md","type":"top-level constant","overriddenDepth":0,"packageName":"talawa","desc":"This file contains demo data for pinned posts. It contains a list of type Map<String, Object> and sample data.","enclosedBy":{"name":"pinned_post_demo_data","type":"library","href":"demo_server_data_pinned_post_demo_data/demo_server_data_pinned_post_demo_data-library.md"}},{"name":"pinned_post_page","qualifiedName":"pinned_post_page","href":"views_after_auth_screens_feed_pinned_post_page/views_after_auth_screens_feed_pinned_post_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"PinnedPostPage","qualifiedName":"pinned_post_page.PinnedPostPage","href":"views_after_auth_screens_feed_pinned_post_page/PinnedPostPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"PinnedPostPage returns a widget that shows the list of all the pinned post.","enclosedBy":{"name":"pinned_post_page","type":"library","href":"views_after_auth_screens_feed_pinned_post_page/views_after_auth_screens_feed_pinned_post_page-library.md"}},{"name":"PinnedPostPage","qualifiedName":"pinned_post_page.PinnedPostPage.PinnedPostPage","href":"views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/PinnedPostPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PinnedPostPage","type":"class","href":"views_after_auth_screens_feed_pinned_post_page/PinnedPostPage-class.md"}},{"name":"build","qualifiedName":"pinned_post_page.PinnedPostPage.build","href":"views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"PinnedPostPage","type":"class","href":"views_after_auth_screens_feed_pinned_post_page/PinnedPostPage-class.md"}},{"name":"pinnedPosts","qualifiedName":"pinned_post_page.PinnedPostPage.pinnedPosts","href":"views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/pinnedPosts.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PinnedPostPage","type":"class","href":"views_after_auth_screens_feed_pinned_post_page/PinnedPostPage-class.md"}},{"name":"post_demo_data","qualifiedName":"post_demo_data","href":"demo_server_data_post_demo_data/demo_server_data_post_demo_data-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"postsDemoData","qualifiedName":"post_demo_data.postsDemoData","href":"demo_server_data_post_demo_data/postsDemoData-constant.md","type":"top-level constant","overriddenDepth":0,"packageName":"talawa","desc":"This file contains demo data for posts. It contains a list of type Map<String, Object>\nand sample data of posts.","enclosedBy":{"name":"post_demo_data","type":"library","href":"demo_server_data_post_demo_data/demo_server_data_post_demo_data-library.md"}},{"name":"post_detailed_page","qualifiedName":"post_detailed_page","href":"widgets_post_detailed_page/widgets_post_detailed_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"DescriptionTextWidget","qualifiedName":"post_detailed_page.DescriptionTextWidget","href":"widgets_post_detailed_page/DescriptionTextWidget-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class sets up the post page.\nTo implement the \"show less\" and \"show more\" functions for the text,\nwe divide the text into two parts: firstHalf and secondHalf. A flag is set to\ntrack whether to display either the firstHalf or both(the entire text).","enclosedBy":{"name":"post_detailed_page","type":"library","href":"widgets_post_detailed_page/widgets_post_detailed_page-library.md"}},{"name":"DescriptionTextWidget","qualifiedName":"post_detailed_page.DescriptionTextWidget.DescriptionTextWidget","href":"widgets_post_detailed_page/DescriptionTextWidget/DescriptionTextWidget.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DescriptionTextWidget","type":"class","href":"widgets_post_detailed_page/DescriptionTextWidget-class.md"}},{"name":"createState","qualifiedName":"post_detailed_page.DescriptionTextWidget.createState","href":"widgets_post_detailed_page/DescriptionTextWidget/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"DescriptionTextWidget","type":"class","href":"widgets_post_detailed_page/DescriptionTextWidget-class.md"}},{"name":"text","qualifiedName":"post_detailed_page.DescriptionTextWidget.text","href":"widgets_post_detailed_page/DescriptionTextWidget/text.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DescriptionTextWidget","type":"class","href":"widgets_post_detailed_page/DescriptionTextWidget-class.md"}},{"name":"post_list_widget","qualifiedName":"post_list_widget","href":"widgets_post_list_widget/widgets_post_list_widget-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"PostListWidget","qualifiedName":"post_list_widget.PostListWidget","href":"widgets_post_list_widget/PostListWidget-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class receives a List of all the Post widgets and returns a ListView.","enclosedBy":{"name":"post_list_widget","type":"library","href":"widgets_post_list_widget/widgets_post_list_widget-library.md"}},{"name":"PostListWidget","qualifiedName":"post_list_widget.PostListWidget.PostListWidget","href":"widgets_post_list_widget/PostListWidget/PostListWidget.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostListWidget","type":"class","href":"widgets_post_list_widget/PostListWidget-class.md"}},{"name":"build","qualifiedName":"post_list_widget.PostListWidget.build","href":"widgets_post_list_widget/PostListWidget/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"PostListWidget","type":"class","href":"widgets_post_list_widget/PostListWidget-class.md"}},{"name":"function","qualifiedName":"post_list_widget.PostListWidget.function","href":"widgets_post_list_widget/PostListWidget/function.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostListWidget","type":"class","href":"widgets_post_list_widget/PostListWidget-class.md"}},{"name":"posts","qualifiedName":"post_list_widget.PostListWidget.posts","href":"widgets_post_list_widget/PostListWidget/posts.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostListWidget","type":"class","href":"widgets_post_list_widget/PostListWidget-class.md"}},{"name":"post_model","qualifiedName":"post_model","href":"models_post_post_model/models_post_post_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Comments","qualifiedName":"post_model.Comments","href":"models_post_post_model/Comments-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class convert between json and object for comments.","enclosedBy":{"name":"post_model","type":"library","href":"models_post_post_model/models_post_post_model-library.md"}},{"name":"Comments","qualifiedName":"post_model.Comments.Comments","href":"models_post_post_model/Comments/Comments.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Comments","type":"class","href":"models_post_post_model/Comments-class.md"}},{"name":"Comments.fromJson","qualifiedName":"post_model.Comments.fromJson","href":"models_post_post_model/Comments/Comments.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"Convert json to dart object.","enclosedBy":{"name":"Comments","type":"class","href":"models_post_post_model/Comments-class.md"}},{"name":"sId","qualifiedName":"post_model.Comments.sId","href":"models_post_post_model/Comments/sId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"these are dart object.","enclosedBy":{"name":"Comments","type":"class","href":"models_post_post_model/Comments-class.md"}},{"name":"toJson","qualifiedName":"post_model.Comments.toJson","href":"models_post_post_model/Comments/toJson.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Convert dart object to json.","enclosedBy":{"name":"Comments","type":"class","href":"models_post_post_model/Comments-class.md"}},{"name":"LikedBy","qualifiedName":"post_model.LikedBy","href":"models_post_post_model/LikedBy-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class convert between json and object for likedby.","enclosedBy":{"name":"post_model","type":"library","href":"models_post_post_model/models_post_post_model-library.md"}},{"name":"LikedBy","qualifiedName":"post_model.LikedBy.LikedBy","href":"models_post_post_model/LikedBy/LikedBy.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"LikedBy","type":"class","href":"models_post_post_model/LikedBy-class.md"}},{"name":"LikedBy.fromJson","qualifiedName":"post_model.LikedBy.fromJson","href":"models_post_post_model/LikedBy/LikedBy.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"JSON factory constructor.","enclosedBy":{"name":"LikedBy","type":"class","href":"models_post_post_model/LikedBy-class.md"}},{"name":"sId","qualifiedName":"post_model.LikedBy.sId","href":"models_post_post_model/LikedBy/sId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"These are dart object.","enclosedBy":{"name":"LikedBy","type":"class","href":"models_post_post_model/LikedBy-class.md"}},{"name":"toJson","qualifiedName":"post_model.LikedBy.toJson","href":"models_post_post_model/LikedBy/toJson.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Convert dart object to json.","enclosedBy":{"name":"LikedBy","type":"class","href":"models_post_post_model/LikedBy-class.md"}},{"name":"Post","qualifiedName":"post_model.Post","href":"models_post_post_model/Post-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates a Post model.","enclosedBy":{"name":"post_model","type":"library","href":"models_post_post_model/models_post_post_model-library.md"}},{"name":"Post","qualifiedName":"post_model.Post.Post","href":"models_post_post_model/Post/Post.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"comments","qualifiedName":"post_model.Post.comments","href":"models_post_post_model/Post/comments.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"comments for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"createdAt","qualifiedName":"post_model.Post.createdAt","href":"models_post_post_model/Post/createdAt.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"createdAt for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"creator","qualifiedName":"post_model.Post.creator","href":"models_post_post_model/Post/creator.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"creator for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"description","qualifiedName":"post_model.Post.description","href":"models_post_post_model/Post/description.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"description for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"Post.fromJson","qualifiedName":"post_model.Post.fromJson","href":"models_post_post_model/Post/Post.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"Creating a new Post instance from a map structure.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"getPostCreatedDuration","qualifiedName":"post_model.Post.getPostCreatedDuration","href":"models_post_post_model/Post/getPostCreatedDuration.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"this is to get duration of post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"imageUrl","qualifiedName":"post_model.Post.imageUrl","href":"models_post_post_model/Post/imageUrl.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"imageUrl for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"likedBy","qualifiedName":"post_model.Post.likedBy","href":"models_post_post_model/Post/likedBy.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"likedBy for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"organization","qualifiedName":"post_model.Post.organization","href":"models_post_post_model/Post/organization.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"organization for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"sId","qualifiedName":"post_model.Post.sId","href":"models_post_post_model/Post/sId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"unique identifier for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"videoUrl","qualifiedName":"post_model.Post.videoUrl","href":"models_post_post_model/Post/videoUrl.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"videoUrl for post.","enclosedBy":{"name":"Post","type":"class","href":"models_post_post_model/Post-class.md"}},{"name":"post_queries","qualifiedName":"post_queries","href":"utils_post_queries/utils_post_queries-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"PostQueries","qualifiedName":"post_queries.PostQueries","href":"utils_post_queries/PostQueries-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates queries related to posts.","enclosedBy":{"name":"post_queries","type":"library","href":"utils_post_queries/utils_post_queries-library.md"}},{"name":"PostQueries","qualifiedName":"post_queries.PostQueries.PostQueries","href":"utils_post_queries/PostQueries/PostQueries.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostQueries","type":"class","href":"utils_post_queries/PostQueries-class.md"}},{"name":"addLike","qualifiedName":"post_queries.PostQueries.addLike","href":"utils_post_queries/PostQueries/addLike.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Add Like to a post.","enclosedBy":{"name":"PostQueries","type":"class","href":"utils_post_queries/PostQueries-class.md"}},{"name":"getPostsById","qualifiedName":"post_queries.PostQueries.getPostsById","href":"utils_post_queries/PostQueries/getPostsById.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Getting Posts by Id.","enclosedBy":{"name":"PostQueries","type":"class","href":"utils_post_queries/PostQueries-class.md"}},{"name":"removeLike","qualifiedName":"post_queries.PostQueries.removeLike","href":"utils_post_queries/PostQueries/removeLike.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Remove Like from a post.","enclosedBy":{"name":"PostQueries","type":"class","href":"utils_post_queries/PostQueries-class.md"}},{"name":"uploadPost","qualifiedName":"post_queries.PostQueries.uploadPost","href":"utils_post_queries/PostQueries/uploadPost.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"Upload a post to database.","enclosedBy":{"name":"PostQueries","type":"class","href":"utils_post_queries/PostQueries-class.md"}},{"name":"post_service","qualifiedName":"post_service","href":"services_post_service/services_post_service-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"PostService","qualifiedName":"post_service.PostService","href":"services_post_service/PostService-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"PostService class provides functions in the context of a Post.","enclosedBy":{"name":"post_service","type":"library","href":"services_post_service/services_post_service-library.md"}},{"name":"PostService","qualifiedName":"post_service.PostService.PostService","href":"services_post_service/PostService/PostService.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostService","type":"class","href":"services_post_service/PostService-class.md"}},{"name":"addCommentLocally","qualifiedName":"post_service.PostService.addCommentLocally","href":"services_post_service/PostService/addCommentLocally.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostService","type":"class","href":"services_post_service/PostService-class.md"}},{"name":"addLike","qualifiedName":"post_service.PostService.addLike","href":"services_post_service/PostService/addLike.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to add Like to the Post.","enclosedBy":{"name":"PostService","type":"class","href":"services_post_service/PostService-class.md"}},{"name":"getPosts","qualifiedName":"post_service.PostService.getPosts","href":"services_post_service/PostService/getPosts.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function used to get all posts of an organization.\nThe function reference the organization Id from _currentOrg.","enclosedBy":{"name":"PostService","type":"class","href":"services_post_service/PostService-class.md"}},{"name":"postStream","qualifiedName":"post_service.PostService.postStream","href":"services_post_service/PostService/postStream.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostService","type":"class","href":"services_post_service/PostService-class.md"}},{"name":"removeLike","qualifiedName":"post_service.PostService.removeLike","href":"services_post_service/PostService/removeLike.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to remove like from the Post.","enclosedBy":{"name":"PostService","type":"class","href":"services_post_service/PostService-class.md"}},{"name":"setOrgStreamSubscription","qualifiedName":"post_service.PostService.setOrgStreamSubscription","href":"services_post_service/PostService/setOrgStreamSubscription.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostService","type":"class","href":"services_post_service/PostService-class.md"}},{"name":"updatedPostStream","qualifiedName":"post_service.PostService.updatedPostStream","href":"services_post_service/PostService/updatedPostStream.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostService","type":"class","href":"services_post_service/PostService-class.md"}},{"name":"post_widget","qualifiedName":"post_widget","href":"widgets_post_widget/widgets_post_widget-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"NewsPost","qualifiedName":"post_widget.NewsPost","href":"widgets_post_widget/NewsPost-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"post_widget","type":"library","href":"widgets_post_widget/widgets_post_widget-library.md"}},{"name":"NewsPost","qualifiedName":"post_widget.NewsPost.NewsPost","href":"widgets_post_widget/NewsPost/NewsPost.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"NewsPost","type":"class","href":"widgets_post_widget/NewsPost-class.md"}},{"name":"build","qualifiedName":"post_widget.NewsPost.build","href":"widgets_post_widget/NewsPost/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"NewsPost","type":"class","href":"widgets_post_widget/NewsPost-class.md"}},{"name":"function","qualifiedName":"post_widget.NewsPost.function","href":"widgets_post_widget/NewsPost/function.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"NewsPost","type":"class","href":"widgets_post_widget/NewsPost-class.md"}},{"name":"post","qualifiedName":"post_widget.NewsPost.post","href":"widgets_post_widget/NewsPost/post.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"NewsPost","type":"class","href":"widgets_post_widget/NewsPost-class.md"}},{"name":"PostContainer","qualifiedName":"post_widget.PostContainer","href":"widgets_post_widget/PostContainer-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"post_widget","type":"library","href":"widgets_post_widget/widgets_post_widget-library.md"}},{"name":"PostContainer","qualifiedName":"post_widget.PostContainer.PostContainer","href":"widgets_post_widget/PostContainer/PostContainer.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostContainer","type":"class","href":"widgets_post_widget/PostContainer-class.md"}},{"name":"createState","qualifiedName":"post_widget.PostContainer.createState","href":"widgets_post_widget/PostContainer/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"PostContainer","type":"class","href":"widgets_post_widget/PostContainer-class.md"}},{"name":"id","qualifiedName":"post_widget.PostContainer.id","href":"widgets_post_widget/PostContainer/id.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostContainer","type":"class","href":"widgets_post_widget/PostContainer-class.md"}},{"name":"PostContainerState","qualifiedName":"post_widget.PostContainerState","href":"widgets_post_widget/PostContainerState-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"post_widget","type":"library","href":"widgets_post_widget/widgets_post_widget-library.md"}},{"name":"PostContainerState","qualifiedName":"post_widget.PostContainerState.PostContainerState","href":"widgets_post_widget/PostContainerState/PostContainerState.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostContainerState","type":"class","href":"widgets_post_widget/PostContainerState-class.md"}},{"name":"build","qualifiedName":"post_widget.PostContainerState.build","href":"widgets_post_widget/PostContainerState/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"PostContainerState","type":"class","href":"widgets_post_widget/PostContainerState-class.md"}},{"name":"controller","qualifiedName":"post_widget.PostContainerState.controller","href":"widgets_post_widget/PostContainerState/controller.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostContainerState","type":"class","href":"widgets_post_widget/PostContainerState-class.md"}},{"name":"dispose","qualifiedName":"post_widget.PostContainerState.dispose","href":"widgets_post_widget/PostContainerState/dispose.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called when this object is removed from the tree permanently.","enclosedBy":{"name":"PostContainerState","type":"class","href":"widgets_post_widget/PostContainerState-class.md"}},{"name":"inView","qualifiedName":"post_widget.PostContainerState.inView","href":"widgets_post_widget/PostContainerState/inView.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostContainerState","type":"class","href":"widgets_post_widget/PostContainerState-class.md"}},{"name":"initState","qualifiedName":"post_widget.PostContainerState.initState","href":"widgets_post_widget/PostContainerState/initState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called when this object is inserted into the tree.","enclosedBy":{"name":"PostContainerState","type":"class","href":"widgets_post_widget/PostContainerState-class.md"}},{"name":"pindex","qualifiedName":"post_widget.PostContainerState.pindex","href":"widgets_post_widget/PostContainerState/pindex.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostContainerState","type":"class","href":"widgets_post_widget/PostContainerState-class.md"}},{"name":"startedPlaying","qualifiedName":"post_widget.PostContainerState.startedPlaying","href":"widgets_post_widget/PostContainerState/startedPlaying.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"PostContainerState","type":"class","href":"widgets_post_widget/PostContainerState-class.md"}},{"name":"profile_page","qualifiedName":"profile_page","href":"views_after_auth_screens_profile_profile_page/views_after_auth_screens_profile_profile_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ProfilePage","qualifiedName":"profile_page.ProfilePage","href":"views_after_auth_screens_profile_profile_page/ProfilePage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ProfilePage returns a widget that renders a page of user's profile.","enclosedBy":{"name":"profile_page","type":"library","href":"views_after_auth_screens_profile_profile_page/views_after_auth_screens_profile_profile_page-library.md"}},{"name":"ProfilePage","qualifiedName":"profile_page.ProfilePage.ProfilePage","href":"views_after_auth_screens_profile_profile_page/ProfilePage/ProfilePage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePage","type":"class","href":"views_after_auth_screens_profile_profile_page/ProfilePage-class.md"}},{"name":"build","qualifiedName":"profile_page.ProfilePage.build","href":"views_after_auth_screens_profile_profile_page/ProfilePage/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"ProfilePage","type":"class","href":"views_after_auth_screens_profile_profile_page/ProfilePage-class.md"}},{"name":"donate","qualifiedName":"profile_page.ProfilePage.donate","href":"views_after_auth_screens_profile_profile_page/ProfilePage/donate.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePage","type":"class","href":"views_after_auth_screens_profile_profile_page/ProfilePage-class.md"}},{"name":"homeModel","qualifiedName":"profile_page.ProfilePage.homeModel","href":"views_after_auth_screens_profile_profile_page/ProfilePage/homeModel.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePage","type":"class","href":"views_after_auth_screens_profile_profile_page/ProfilePage-class.md"}},{"name":"profile_page_view_model","qualifiedName":"profile_page_view_model","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/view_model_after_auth_view_models_profile_view_models_profile_page_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ProfilePageViewModel","qualifiedName":"profile_page_view_model.ProfilePageViewModel","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ProfilePageViewModel class helps to interact with model to serve data\nand react to user's input in Profile Page view.","enclosedBy":{"name":"profile_page_view_model","type":"library","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/view_model_after_auth_view_models_profile_view_models_profile_page_view_model-library.md"}},{"name":"ProfilePageViewModel","qualifiedName":"profile_page_view_model.ProfilePageViewModel.ProfilePageViewModel","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/ProfilePageViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"attachListener","qualifiedName":"profile_page_view_model.ProfilePageViewModel.attachListener","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/attachListener.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"bottomSheetHeight","qualifiedName":"profile_page_view_model.ProfilePageViewModel.bottomSheetHeight","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/bottomSheetHeight.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"changeCurrency","qualifiedName":"profile_page_view_model.ProfilePageViewModel.changeCurrency","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/changeCurrency.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This method changes the currency of the user for donation purpose.","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"currentOrg","qualifiedName":"profile_page_view_model.ProfilePageViewModel.currentOrg","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"currentUser","qualifiedName":"profile_page_view_model.ProfilePageViewModel.currentUser","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentUser.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"denomination","qualifiedName":"profile_page_view_model.ProfilePageViewModel.denomination","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/denomination.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"dominationButton","qualifiedName":"profile_page_view_model.ProfilePageViewModel.dominationButton","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/dominationButton.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This widget returns button for domination.","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"donationAmount","qualifiedName":"profile_page_view_model.ProfilePageViewModel.donationAmount","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationAmount.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"donationCurrency","qualifiedName":"profile_page_view_model.ProfilePageViewModel.donationCurrency","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrency.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"donationCurrencySymbol","qualifiedName":"profile_page_view_model.ProfilePageViewModel.donationCurrencySymbol","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrencySymbol.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"donationField","qualifiedName":"profile_page_view_model.ProfilePageViewModel.donationField","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationField.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"iconButton","qualifiedName":"profile_page_view_model.ProfilePageViewModel.iconButton","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/iconButton.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This widget returns the button for social media sharing option.","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"initialize","qualifiedName":"profile_page_view_model.ProfilePageViewModel.initialize","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"invite","qualifiedName":"profile_page_view_model.ProfilePageViewModel.invite","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/invite.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function generates the organization invitation link in a Dialog Box.\nDialog box contains the QR-code of organization invite link and social media sharing options.","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"logout","qualifiedName":"profile_page_view_model.ProfilePageViewModel.logout","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/logout.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This method destroys the user's session or sign out the user from app.\nThe function asks for the confimation in Custom Alert Dialog.","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"organisation","qualifiedName":"profile_page_view_model.ProfilePageViewModel.organisation","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/organisation.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"popBottomSheet","qualifiedName":"profile_page_view_model.ProfilePageViewModel.popBottomSheet","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/popBottomSheet.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"scaffoldKey","qualifiedName":"profile_page_view_model.ProfilePageViewModel.scaffoldKey","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/scaffoldKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"showSnackBar","qualifiedName":"profile_page_view_model.ProfilePageViewModel.showSnackBar","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/showSnackBar.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"updateSheetHeight","qualifiedName":"profile_page_view_model.ProfilePageViewModel.updateSheetHeight","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/updateSheetHeight.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"url","qualifiedName":"profile_page_view_model.ProfilePageViewModel.url","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/url.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"user","qualifiedName":"profile_page_view_model.ProfilePageViewModel.user","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/user.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProfilePageViewModel","type":"class","href":"view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md"}},{"name":"progress_dialog_view_model","qualifiedName":"progress_dialog_view_model","href":"view_model_widgets_view_models_progress_dialog_view_model/view_model_widgets_view_models_progress_dialog_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ProgressDialogViewModel","qualifiedName":"progress_dialog_view_model.ProgressDialogViewModel","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"ProgressDialogViewModel class helps to serve the data and\nto react to user's input for Progress Dialog Widget.","enclosedBy":{"name":"progress_dialog_view_model","type":"library","href":"view_model_widgets_view_models_progress_dialog_view_model/view_model_widgets_view_models_progress_dialog_view_model-library.md"}},{"name":"ProgressDialogViewModel","qualifiedName":"progress_dialog_view_model.ProgressDialogViewModel.ProgressDialogViewModel","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/ProgressDialogViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProgressDialogViewModel","type":"class","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md"}},{"name":"connectivityPresent","qualifiedName":"progress_dialog_view_model.ProgressDialogViewModel.connectivityPresent","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityPresent.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProgressDialogViewModel","type":"class","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md"}},{"name":"connectivityResult","qualifiedName":"progress_dialog_view_model.ProgressDialogViewModel.connectivityResult","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityResult.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProgressDialogViewModel","type":"class","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md"}},{"name":"initialise","qualifiedName":"progress_dialog_view_model.ProgressDialogViewModel.initialise","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ProgressDialogViewModel","type":"class","href":"view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md"}},{"name":"queries","qualifiedName":"queries","href":"utils_queries/utils_queries-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Queries","qualifiedName":"queries.Queries","href":"utils_queries/Queries-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class returns some queries for the application.","enclosedBy":{"name":"queries","type":"library","href":"utils_queries/utils_queries-library.md"}},{"name":"Queries","qualifiedName":"queries.Queries.Queries","href":"utils_queries/Queries/Queries.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"createDonation","qualifiedName":"queries.Queries.createDonation","href":"utils_queries/Queries/createDonation.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"createDonation creates a new donation transaction by taking the userId ,orgId ,nameOfOrg ,nameOfUser as parameters","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"fetchJoinInOrg","qualifiedName":"queries.Queries.fetchJoinInOrg","href":"utils_queries/Queries/fetchJoinInOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"fetchJoinInOrgByName","qualifiedName":"queries.Queries.fetchJoinInOrgByName","href":"utils_queries/Queries/fetchJoinInOrgByName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"fetchOrgById","qualifiedName":"queries.Queries.fetchOrgById","href":"utils_queries/Queries/fetchOrgById.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"fetchOrgDetailsById","qualifiedName":"queries.Queries.fetchOrgDetailsById","href":"utils_queries/Queries/fetchOrgDetailsById.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"fetchUserInfo","qualifiedName":"queries.Queries.fetchUserInfo","href":"utils_queries/Queries/fetchUserInfo.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"getPluginsList","qualifiedName":"queries.Queries.getPluginsList","href":"utils_queries/Queries/getPluginsList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"getPluginList queries all properties of pluginList from the server","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"joinOrgById","qualifiedName":"queries.Queries.joinOrgById","href":"utils_queries/Queries/joinOrgById.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"loginUser","qualifiedName":"queries.Queries.loginUser","href":"utils_queries/Queries/loginUser.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"logout","qualifiedName":"queries.Queries.logout","href":"utils_queries/Queries/logout.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"newUserLanguage","qualifiedName":"queries.Queries.newUserLanguage","href":"utils_queries/Queries/newUserLanguage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"refreshToken","qualifiedName":"queries.Queries.refreshToken","href":"utils_queries/Queries/refreshToken.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"registerUser","qualifiedName":"queries.Queries.registerUser","href":"utils_queries/Queries/registerUser.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"saveFcmToken","qualifiedName":"queries.Queries.saveFcmToken","href":"utils_queries/Queries/saveFcmToken.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"sendMembershipRequest","qualifiedName":"queries.Queries.sendMembershipRequest","href":"utils_queries/Queries/sendMembershipRequest.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"updateLanguage","qualifiedName":"queries.Queries.updateLanguage","href":"utils_queries/Queries/updateLanguage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"userLanguage","qualifiedName":"queries.Queries.userLanguage","href":"utils_queries/Queries/userLanguage.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Queries","type":"class","href":"utils_queries/Queries-class.md"}},{"name":"quick_actions","qualifiedName":"quick_actions","href":"constants_quick_actions/constants_quick_actions-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ShortCutMenu","qualifiedName":"quick_actions.ShortCutMenu","href":"constants_quick_actions/ShortCutMenu-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This file contains the shortcuts by which user can manage and interact with the\napplication. quick_actions package is used for this purpose.","enclosedBy":{"name":"quick_actions","type":"library","href":"constants_quick_actions/constants_quick_actions-library.md"}},{"name":"ShortCutMenu","qualifiedName":"quick_actions.ShortCutMenu.ShortCutMenu","href":"constants_quick_actions/ShortCutMenu/ShortCutMenu.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ShortCutMenu","type":"class","href":"constants_quick_actions/ShortCutMenu-class.md"}},{"name":"chatAction","qualifiedName":"quick_actions.ShortCutMenu.chatAction","href":"constants_quick_actions/ShortCutMenu/chatAction-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ShortCutMenu","type":"class","href":"constants_quick_actions/ShortCutMenu-class.md"}},{"name":"eventAction","qualifiedName":"quick_actions.ShortCutMenu.eventAction","href":"constants_quick_actions/ShortCutMenu/eventAction-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ShortCutMenu","type":"class","href":"constants_quick_actions/ShortCutMenu-class.md"}},{"name":"feedAction","qualifiedName":"quick_actions.ShortCutMenu.feedAction","href":"constants_quick_actions/ShortCutMenu/feedAction-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ShortCutMenu","type":"class","href":"constants_quick_actions/ShortCutMenu-class.md"}},{"name":"quickActionsList","qualifiedName":"quick_actions.ShortCutMenu.quickActionsList","href":"constants_quick_actions/ShortCutMenu/quickActionsList.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ShortCutMenu","type":"class","href":"constants_quick_actions/ShortCutMenu-class.md"}},{"name":"raised_round_edge_button","qualifiedName":"raised_round_edge_button","href":"widgets_raised_round_edge_button/widgets_raised_round_edge_button-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"RaisedRoundedButton","qualifiedName":"raised_round_edge_button.RaisedRoundedButton","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class returns a widget for a raised rounded button,\nfor example: login button in login screen.","enclosedBy":{"name":"raised_round_edge_button","type":"library","href":"widgets_raised_round_edge_button/widgets_raised_round_edge_button-library.md"}},{"name":"RaisedRoundedButton","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.RaisedRoundedButton","href":"widgets_raised_round_edge_button/RaisedRoundedButton/RaisedRoundedButton.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"backgroundColor","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.backgroundColor","href":"widgets_raised_round_edge_button/RaisedRoundedButton/backgroundColor.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"buttonLabel","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.buttonLabel","href":"widgets_raised_round_edge_button/RaisedRoundedButton/buttonLabel.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"createState","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.createState","href":"widgets_raised_round_edge_button/RaisedRoundedButton/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"height","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.height","href":"widgets_raised_round_edge_button/RaisedRoundedButton/height.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"onTap","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.onTap","href":"widgets_raised_round_edge_button/RaisedRoundedButton/onTap.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"showArrow","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.showArrow","href":"widgets_raised_round_edge_button/RaisedRoundedButton/showArrow.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"textColor","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.textColor","href":"widgets_raised_round_edge_button/RaisedRoundedButton/textColor.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"width","qualifiedName":"raised_round_edge_button.RaisedRoundedButton.width","href":"widgets_raised_round_edge_button/RaisedRoundedButton/width.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"RaisedRoundedButton","type":"class","href":"widgets_raised_round_edge_button/RaisedRoundedButton-class.md"}},{"name":"recover","qualifiedName":"recover","href":"views_pre_auth_screens_recover/views_pre_auth_screens_recover-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Recover","qualifiedName":"recover.Recover","href":"views_pre_auth_screens_recover/Recover-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class recovers the users password.\nThe users needs to enter his/her email and press on the button at the bottom to recover his/her password.","enclosedBy":{"name":"recover","type":"library","href":"views_pre_auth_screens_recover/views_pre_auth_screens_recover-library.md"}},{"name":"Recover","qualifiedName":"recover.Recover.Recover","href":"views_pre_auth_screens_recover/Recover/Recover.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Recover","type":"class","href":"views_pre_auth_screens_recover/Recover-class.md"}},{"name":"createState","qualifiedName":"recover.Recover.createState","href":"views_pre_auth_screens_recover/Recover/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"Recover","type":"class","href":"views_pre_auth_screens_recover/Recover-class.md"}},{"name":"rich_text","qualifiedName":"rich_text","href":"widgets_rich_text/widgets_rich_text-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"CustomRichText","qualifiedName":"rich_text.CustomRichText","href":"widgets_rich_text/CustomRichText-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"CustomRichText class returns a widget for customized rich/bold text.\nThese rich text are being used in form for changing the password.","enclosedBy":{"name":"rich_text","type":"library","href":"widgets_rich_text/widgets_rich_text-library.md"}},{"name":"CustomRichText","qualifiedName":"rich_text.CustomRichText.CustomRichText","href":"widgets_rich_text/CustomRichText/CustomRichText.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomRichText","type":"class","href":"widgets_rich_text/CustomRichText-class.md"}},{"name":"build","qualifiedName":"rich_text.CustomRichText.build","href":"widgets_rich_text/CustomRichText/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"CustomRichText","type":"class","href":"widgets_rich_text/CustomRichText-class.md"}},{"name":"words","qualifiedName":"rich_text.CustomRichText.words","href":"widgets_rich_text/CustomRichText/words.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"CustomRichText","type":"class","href":"widgets_rich_text/CustomRichText-class.md"}},{"name":"router","qualifiedName":"router","href":"router/router-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"generateRoute","qualifiedName":"router.generateRoute","href":"router/generateRoute.md","type":"function","overriddenDepth":0,"packageName":"talawa","desc":"The MaterialApp provides us with a property called generateRoute where\nwe can pass in a Function that returns a Route and takes in RouteSettings","enclosedBy":{"name":"router","type":"library","href":"router/router-library.md"}},{"name":"routing_constants","qualifiedName":"routing_constants","href":"constants_routing_constants/constants_routing_constants-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Routes","qualifiedName":"routing_constants.Routes","href":"constants_routing_constants/Routes-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This file contains the routes. These can be used to make push screen call via Routes.splashScreen to access these string.","enclosedBy":{"name":"routing_constants","type":"library","href":"constants_routing_constants/constants_routing_constants-library.md"}},{"name":"Routes","qualifiedName":"routing_constants.Routes.Routes","href":"constants_routing_constants/Routes/Routes.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"addTask","qualifiedName":"routing_constants.Routes.addTask","href":"constants_routing_constants/Routes/addTask-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"appSettings","qualifiedName":"routing_constants.Routes.appSettings","href":"constants_routing_constants/Routes/appSettings-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"calendar","qualifiedName":"routing_constants.Routes.calendar","href":"constants_routing_constants/Routes/calendar-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"chatMessageScreen","qualifiedName":"routing_constants.Routes.chatMessageScreen","href":"constants_routing_constants/Routes/chatMessageScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"createEventPage","qualifiedName":"routing_constants.Routes.createEventPage","href":"constants_routing_constants/Routes/createEventPage-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"demoPageViewRoute","qualifiedName":"routing_constants.Routes.demoPageViewRoute","href":"constants_routing_constants/Routes/demoPageViewRoute-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"editEventPage","qualifiedName":"routing_constants.Routes.editEventPage","href":"constants_routing_constants/Routes/editEventPage-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"editProfilePage","qualifiedName":"routing_constants.Routes.editProfilePage","href":"constants_routing_constants/Routes/editProfilePage-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"editTask","qualifiedName":"routing_constants.Routes.editTask","href":"constants_routing_constants/Routes/editTask-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"eventInfoPage","qualifiedName":"routing_constants.Routes.eventInfoPage","href":"constants_routing_constants/Routes/eventInfoPage-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"eventTasks","qualifiedName":"routing_constants.Routes.eventTasks","href":"constants_routing_constants/Routes/eventTasks-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"exploreEventsScreen","qualifiedName":"routing_constants.Routes.exploreEventsScreen","href":"constants_routing_constants/Routes/exploreEventsScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"homeScreen","qualifiedName":"routing_constants.Routes.homeScreen","href":"constants_routing_constants/Routes/homeScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"individualPost","qualifiedName":"routing_constants.Routes.individualPost","href":"constants_routing_constants/Routes/individualPost-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"joinOrg","qualifiedName":"routing_constants.Routes.joinOrg","href":"constants_routing_constants/Routes/joinOrg-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"languageSelectionRoute","qualifiedName":"routing_constants.Routes.languageSelectionRoute","href":"constants_routing_constants/Routes/languageSelectionRoute-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"loginScreen","qualifiedName":"routing_constants.Routes.loginScreen","href":"constants_routing_constants/Routes/loginScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"mainScreen","qualifiedName":"routing_constants.Routes.mainScreen","href":"constants_routing_constants/Routes/mainScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"mapScreen","qualifiedName":"routing_constants.Routes.mapScreen","href":"constants_routing_constants/Routes/mapScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"pinnedPostPage","qualifiedName":"routing_constants.Routes.pinnedPostPage","href":"constants_routing_constants/Routes/pinnedPostPage-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"profilePage","qualifiedName":"routing_constants.Routes.profilePage","href":"constants_routing_constants/Routes/profilePage-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"progressDialog","qualifiedName":"routing_constants.Routes.progressDialog","href":"constants_routing_constants/Routes/progressDialog-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"recoverScreen","qualifiedName":"routing_constants.Routes.recoverScreen","href":"constants_routing_constants/Routes/recoverScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"requestAccess","qualifiedName":"routing_constants.Routes.requestAccess","href":"constants_routing_constants/Routes/requestAccess-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"selectContact","qualifiedName":"routing_constants.Routes.selectContact","href":"constants_routing_constants/Routes/selectContact-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"selectOrgScreen","qualifiedName":"routing_constants.Routes.selectOrgScreen","href":"constants_routing_constants/Routes/selectOrgScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"setUrlScreen","qualifiedName":"routing_constants.Routes.setUrlScreen","href":"constants_routing_constants/Routes/setUrlScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"signupDetailScreen","qualifiedName":"routing_constants.Routes.signupDetailScreen","href":"constants_routing_constants/Routes/signupDetailScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"splashScreen","qualifiedName":"routing_constants.Routes.splashScreen","href":"constants_routing_constants/Routes/splashScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"updateScreen","qualifiedName":"routing_constants.Routes.updateScreen","href":"constants_routing_constants/Routes/updateScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"userTasks","qualifiedName":"routing_constants.Routes.userTasks","href":"constants_routing_constants/Routes/userTasks-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"waitingScreen","qualifiedName":"routing_constants.Routes.waitingScreen","href":"constants_routing_constants/Routes/waitingScreen-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"static variables.","enclosedBy":{"name":"Routes","type":"class","href":"constants_routing_constants/Routes-class.md"}},{"name":"select_contact","qualifiedName":"select_contact","href":"views_after_auth_screens_chat_select_contact/views_after_auth_screens_chat_select_contact-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SelectContact","qualifiedName":"select_contact.SelectContact","href":"views_after_auth_screens_chat_select_contact/SelectContact-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"SelectContact returns a widget that has mutable state _SelectContactState.","enclosedBy":{"name":"select_contact","type":"library","href":"views_after_auth_screens_chat_select_contact/views_after_auth_screens_chat_select_contact-library.md"}},{"name":"SelectContact","qualifiedName":"select_contact.SelectContact.SelectContact","href":"views_after_auth_screens_chat_select_contact/SelectContact/SelectContact.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectContact","type":"class","href":"views_after_auth_screens_chat_select_contact/SelectContact-class.md"}},{"name":"createState","qualifiedName":"select_contact.SelectContact.createState","href":"views_after_auth_screens_chat_select_contact/SelectContact/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"SelectContact","type":"class","href":"views_after_auth_screens_chat_select_contact/SelectContact-class.md"}},{"name":"select_contact_view_model","qualifiedName":"select_contact_view_model","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/view_model_after_auth_view_models_chat_view_models_select_contact_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SelectContactViewModel","qualifiedName":"select_contact_view_model.SelectContactViewModel","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"SelectContactViewModel class have different functions to interact with model.","enclosedBy":{"name":"select_contact_view_model","type":"library","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/view_model_after_auth_view_models_chat_view_models_select_contact_view_model-library.md"}},{"name":"SelectContactViewModel","qualifiedName":"select_contact_view_model.SelectContactViewModel.SelectContactViewModel","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/SelectContactViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectContactViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md"}},{"name":"getCurrentOrgUsersList","qualifiedName":"select_contact_view_model.SelectContactViewModel.getCurrentOrgUsersList","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/getCurrentOrgUsersList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get all users list of an current organization.","enclosedBy":{"name":"SelectContactViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md"}},{"name":"initialise","qualifiedName":"select_contact_view_model.SelectContactViewModel.initialise","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectContactViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md"}},{"name":"orgMembersList","qualifiedName":"select_contact_view_model.SelectContactViewModel.orgMembersList","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/orgMembersList.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectContactViewModel","type":"class","href":"view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md"}},{"name":"select_language","qualifiedName":"select_language","href":"views_pre_auth_screens_select_language/views_pre_auth_screens_select_language-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SelectLanguage","qualifiedName":"select_language.SelectLanguage","href":"views_pre_auth_screens_select_language/SelectLanguage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This widget enables us to select a different language.\nThe default language is English. We can choose among the options to switch the language.\nThere is a text button at the right bottom of the screen which changes the language when tapped.\nThe user finally gets redirected to the previous screen.","enclosedBy":{"name":"select_language","type":"library","href":"views_pre_auth_screens_select_language/views_pre_auth_screens_select_language-library.md"}},{"name":"SelectLanguage","qualifiedName":"select_language.SelectLanguage.SelectLanguage","href":"views_pre_auth_screens_select_language/SelectLanguage/SelectLanguage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectLanguage","type":"class","href":"views_pre_auth_screens_select_language/SelectLanguage-class.md"}},{"name":"createState","qualifiedName":"select_language.SelectLanguage.createState","href":"views_pre_auth_screens_select_language/SelectLanguage/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"SelectLanguage","type":"class","href":"views_pre_auth_screens_select_language/SelectLanguage-class.md"}},{"name":"select_organization","qualifiedName":"select_organization","href":"views_pre_auth_screens_select_organization/views_pre_auth_screens_select_organization-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SelectOrganization","qualifiedName":"select_organization.SelectOrganization","href":"views_pre_auth_screens_select_organization/SelectOrganization-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This widget lets the user select new organizations.","enclosedBy":{"name":"select_organization","type":"library","href":"views_pre_auth_screens_select_organization/views_pre_auth_screens_select_organization-library.md"}},{"name":"SelectOrganization","qualifiedName":"select_organization.SelectOrganization.SelectOrganization","href":"views_pre_auth_screens_select_organization/SelectOrganization/SelectOrganization.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganization","type":"class","href":"views_pre_auth_screens_select_organization/SelectOrganization-class.md"}},{"name":"createState","qualifiedName":"select_organization.SelectOrganization.createState","href":"views_pre_auth_screens_select_organization/SelectOrganization/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"SelectOrganization","type":"class","href":"views_pre_auth_screens_select_organization/SelectOrganization-class.md"}},{"name":"selectedOrgId","qualifiedName":"select_organization.SelectOrganization.selectedOrgId","href":"views_pre_auth_screens_select_organization/SelectOrganization/selectedOrgId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Contains Integer value for selected org id.","enclosedBy":{"name":"SelectOrganization","type":"class","href":"views_pre_auth_screens_select_organization/SelectOrganization-class.md"}},{"name":"select_organization_view_model","qualifiedName":"select_organization_view_model","href":"view_model_pre_auth_view_models_select_organization_view_model/view_model_pre_auth_view_models_select_organization_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SelectOrganizationViewModel","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"SelectOrganizationViewModel class helps to interact with model to serve data\nand react to user's input in Select Organization View.","enclosedBy":{"name":"select_organization_view_model","type":"library","href":"view_model_pre_auth_view_models_select_organization_view_model/view_model_pre_auth_view_models_select_organization_view_model-library.md"}},{"name":"SelectOrganizationViewModel","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.SelectOrganizationViewModel","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/SelectOrganizationViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"allOrgController","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.allOrgController","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/allOrgController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"controller","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.controller","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/controller.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"fetchMoreHelper","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.fetchMoreHelper","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/fetchMoreHelper.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function fetch more option.","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"initialise","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.initialise","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"onTapContinue","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.onTapContinue","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapContinue.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"onTapJoin","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.onTapJoin","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapJoin.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function make user to join the selected organization.\nThe function uses joinOrgById graph QL query.","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"orgId","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.orgId","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/orgId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"organizations","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.organizations","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/organizations.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"qrKey","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.qrKey","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/qrKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"result","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.result","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/result.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"searchActive","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.searchActive","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchActive.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"searchController","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.searchController","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"searchFocus","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.searchFocus","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"searching","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.searching","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searching.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"selectOrg","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.selectOrg","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function select the organization.","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"selectedOrganization","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.selectedOrganization","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectedOrganization.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"showSearchOrgList","qualifiedName":"select_organization_view_model.SelectOrganizationViewModel.showSearchOrgList","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/showSearchOrgList.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SelectOrganizationViewModel","type":"class","href":"view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md"}},{"name":"set_url","qualifiedName":"set_url","href":"views_pre_auth_screens_set_url/views_pre_auth_screens_set_url-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SetUrl","qualifiedName":"set_url.SetUrl","href":"views_pre_auth_screens_set_url/SetUrl-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This widget lets a user sign in/up with the organization url.","enclosedBy":{"name":"set_url","type":"library","href":"views_pre_auth_screens_set_url/views_pre_auth_screens_set_url-library.md"}},{"name":"SetUrl","qualifiedName":"set_url.SetUrl.SetUrl","href":"views_pre_auth_screens_set_url/SetUrl/SetUrl.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SetUrl","type":"class","href":"views_pre_auth_screens_set_url/SetUrl-class.md"}},{"name":"createState","qualifiedName":"set_url.SetUrl.createState","href":"views_pre_auth_screens_set_url/SetUrl/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"SetUrl","type":"class","href":"views_pre_auth_screens_set_url/SetUrl-class.md"}},{"name":"uri","qualifiedName":"set_url.SetUrl.uri","href":"views_pre_auth_screens_set_url/SetUrl/uri.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Variable.","enclosedBy":{"name":"SetUrl","type":"class","href":"views_pre_auth_screens_set_url/SetUrl-class.md"}},{"name":"set_url_view_model","qualifiedName":"set_url_view_model","href":"view_model_pre_auth_view_models_set_url_view_model/view_model_pre_auth_view_models_set_url_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SetUrlViewModel","qualifiedName":"set_url_view_model.SetUrlViewModel","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"SetUrlViewModel class helps to interact with model to serve data.","enclosedBy":{"name":"set_url_view_model","type":"library","href":"view_model_pre_auth_view_models_set_url_view_model/view_model_pre_auth_view_models_set_url_view_model-library.md"}},{"name":"SetUrlViewModel","qualifiedName":"set_url_view_model.SetUrlViewModel.SetUrlViewModel","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/SetUrlViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"checkURLandNavigate","qualifiedName":"set_url_view_model.SetUrlViewModel.checkURLandNavigate","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandNavigate.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function check the URL and navigate to the respective URL.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"checkURLandShowPopUp","qualifiedName":"set_url_view_model.SetUrlViewModel.checkURLandShowPopUp","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandShowPopUp.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function check the URL and navigate to the respective URL.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"formKey","qualifiedName":"set_url_view_model.SetUrlViewModel.formKey","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/formKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"formKey.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"greeting","qualifiedName":"set_url_view_model.SetUrlViewModel.greeting","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/greeting.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"qrController.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"imageUrlKey","qualifiedName":"set_url_view_model.SetUrlViewModel.imageUrlKey","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/imageUrlKey-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"imageUrlKey.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"initialise","qualifiedName":"set_url_view_model.SetUrlViewModel.initialise","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function initialises the variables.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"orgId","qualifiedName":"set_url_view_model.SetUrlViewModel.orgId","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/orgId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"organizationID.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"qrKey","qualifiedName":"set_url_view_model.SetUrlViewModel.qrKey","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/qrKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"qrKey.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"result","qualifiedName":"set_url_view_model.SetUrlViewModel.result","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/result.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"qrText.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"scanQR","qualifiedName":"set_url_view_model.SetUrlViewModel.scanQR","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/scanQR.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function create a widget which is used to scan the QR-code.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"url","qualifiedName":"set_url_view_model.SetUrlViewModel.url","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/url.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"url.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"urlFocus","qualifiedName":"set_url_view_model.SetUrlViewModel.urlFocus","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"urlFocus.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"urlKey","qualifiedName":"set_url_view_model.SetUrlViewModel.urlKey","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlKey-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"urlKey.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"validate","qualifiedName":"set_url_view_model.SetUrlViewModel.validate","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/validate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"qrValidator.","enclosedBy":{"name":"SetUrlViewModel","type":"class","href":"view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md"}},{"name":"signup_details","qualifiedName":"signup_details","href":"views_pre_auth_screens_signup_details/views_pre_auth_screens_signup_details-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SignUpDetails","qualifiedName":"signup_details.SignUpDetails","href":"views_pre_auth_screens_signup_details/SignUpDetails-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This widget takes the user details for signup. The form includes first name, last name, email, password, and password confirmation inputs.","enclosedBy":{"name":"signup_details","type":"library","href":"views_pre_auth_screens_signup_details/views_pre_auth_screens_signup_details-library.md"}},{"name":"SignUpDetails","qualifiedName":"signup_details.SignUpDetails.SignUpDetails","href":"views_pre_auth_screens_signup_details/SignUpDetails/SignUpDetails.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignUpDetails","type":"class","href":"views_pre_auth_screens_signup_details/SignUpDetails-class.md"}},{"name":"createState","qualifiedName":"signup_details.SignUpDetails.createState","href":"views_pre_auth_screens_signup_details/SignUpDetails/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"SignUpDetails","type":"class","href":"views_pre_auth_screens_signup_details/SignUpDetails-class.md"}},{"name":"selectedOrg","qualifiedName":"signup_details.SignUpDetails.selectedOrg","href":"views_pre_auth_screens_signup_details/SignUpDetails/selectedOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignUpDetails","type":"class","href":"views_pre_auth_screens_signup_details/SignUpDetails-class.md"}},{"name":"signup_details_view_model","qualifiedName":"signup_details_view_model","href":"view_model_pre_auth_view_models_signup_details_view_model/view_model_pre_auth_view_models_signup_details_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SignupDetailsViewModel","qualifiedName":"signup_details_view_model.SignupDetailsViewModel","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"SignupDetailsViewModel class helps to interact with model to serve data\nand react to user's input for Sign Up Details section.","enclosedBy":{"name":"signup_details_view_model","type":"library","href":"view_model_pre_auth_view_models_signup_details_view_model/view_model_pre_auth_view_models_signup_details_view_model-library.md"}},{"name":"SignupDetailsViewModel","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.SignupDetailsViewModel","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/SignupDetailsViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"confirmFocus","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.confirmFocus","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmFocus.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"confirmPassword","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.confirmPassword","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmPassword.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"email","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.email","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/email.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"firstName","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.firstName","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/firstName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"formKey","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.formKey","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/formKey.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"greeting","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.greeting","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/greeting.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"hidePassword","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.hidePassword","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/hidePassword.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"initialise","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.initialise","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"lastName","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.lastName","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/lastName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"password","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.password","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/password.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"selectedOrganization","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.selectedOrganization","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/selectedOrganization.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"signUp","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.signUp","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/signUp.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to sign up the user into the application by passing the data to database query.\nThe function uses gqlNonAuthMutation method provided by databaseFunctions services.","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"validate","qualifiedName":"signup_details_view_model.SignupDetailsViewModel.validate","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/validate.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupDetailsViewModel","type":"class","href":"view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md"}},{"name":"signup_progress_indicator","qualifiedName":"signup_progress_indicator","href":"widgets_signup_progress_indicator/widgets_signup_progress_indicator-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SignupProgressIndicator","qualifiedName":"signup_progress_indicator.SignupProgressIndicator","href":"widgets_signup_progress_indicator/SignupProgressIndicator-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class returns a widget for showing the\nprogress indicator/flow while Signing Up/ Registration.","enclosedBy":{"name":"signup_progress_indicator","type":"library","href":"widgets_signup_progress_indicator/widgets_signup_progress_indicator-library.md"}},{"name":"SignupProgressIndicator","qualifiedName":"signup_progress_indicator.SignupProgressIndicator.SignupProgressIndicator","href":"widgets_signup_progress_indicator/SignupProgressIndicator/SignupProgressIndicator.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupProgressIndicator","type":"class","href":"widgets_signup_progress_indicator/SignupProgressIndicator-class.md"}},{"name":"build","qualifiedName":"signup_progress_indicator.SignupProgressIndicator.build","href":"widgets_signup_progress_indicator/SignupProgressIndicator/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"SignupProgressIndicator","type":"class","href":"widgets_signup_progress_indicator/SignupProgressIndicator-class.md"}},{"name":"currentPageIndex","qualifiedName":"signup_progress_indicator.SignupProgressIndicator.currentPageIndex","href":"widgets_signup_progress_indicator/SignupProgressIndicator/currentPageIndex.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupProgressIndicator","type":"class","href":"widgets_signup_progress_indicator/SignupProgressIndicator-class.md"}},{"name":"progressLabel","qualifiedName":"signup_progress_indicator.SignupProgressIndicator.progressLabel","href":"widgets_signup_progress_indicator/SignupProgressIndicator/progressLabel.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SignupProgressIndicator","type":"class","href":"widgets_signup_progress_indicator/SignupProgressIndicator-class.md"}},{"name":"size_config","qualifiedName":"size_config","href":"services_size_config/services_size_config-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SizeConfig","qualifiedName":"size_config.SizeConfig","href":"services_size_config/SizeConfig-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"SizeConfig class is used to initialise the height and width of the media.","enclosedBy":{"name":"size_config","type":"library","href":"services_size_config/services_size_config-library.md"}},{"name":"SizeConfig","qualifiedName":"size_config.SizeConfig.SizeConfig","href":"services_size_config/SizeConfig/SizeConfig.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"blockSizeHorizontal","qualifiedName":"size_config.SizeConfig.blockSizeHorizontal","href":"services_size_config/SizeConfig/blockSizeHorizontal.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"blockSizeVertical","qualifiedName":"size_config.SizeConfig.blockSizeVertical","href":"services_size_config/SizeConfig/blockSizeVertical.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"init","qualifiedName":"size_config.SizeConfig.init","href":"services_size_config/SizeConfig/init.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"paddingTop","qualifiedName":"size_config.SizeConfig.paddingTop","href":"services_size_config/SizeConfig/paddingTop.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"safeBlockHorizontal","qualifiedName":"size_config.SizeConfig.safeBlockHorizontal","href":"services_size_config/SizeConfig/safeBlockHorizontal.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"safeBlockVertical","qualifiedName":"size_config.SizeConfig.safeBlockVertical","href":"services_size_config/SizeConfig/safeBlockVertical.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"screenHeight","qualifiedName":"size_config.SizeConfig.screenHeight","href":"services_size_config/SizeConfig/screenHeight.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"screenWidth","qualifiedName":"size_config.SizeConfig.screenWidth","href":"services_size_config/SizeConfig/screenWidth.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"test","qualifiedName":"size_config.SizeConfig.test","href":"services_size_config/SizeConfig/test.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SizeConfig","type":"class","href":"services_size_config/SizeConfig-class.md"}},{"name":"splash_screen","qualifiedName":"splash_screen","href":"splash_screen/splash_screen-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"SplashScreen","qualifiedName":"splash_screen.SplashScreen","href":"splash_screen/SplashScreen-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This widget return the SplashScreen. Splash Screen is the first screen that\nwe see when we run our application. It is also known as Launch Screen.","enclosedBy":{"name":"splash_screen","type":"library","href":"splash_screen/splash_screen-library.md"}},{"name":"SplashScreen","qualifiedName":"splash_screen.SplashScreen.SplashScreen","href":"splash_screen/SplashScreen/SplashScreen.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SplashScreen","type":"class","href":"splash_screen/SplashScreen-class.md"}},{"name":"createState","qualifiedName":"splash_screen.SplashScreen.createState","href":"splash_screen/SplashScreen/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"SplashScreen","type":"class","href":"splash_screen/SplashScreen-class.md"}},{"name":"mainScreenIndex","qualifiedName":"splash_screen.SplashScreen.mainScreenIndex","href":"splash_screen/SplashScreen/mainScreenIndex.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"SplashScreen","type":"class","href":"splash_screen/SplashScreen-class.md"}},{"name":"talawa_error_dialog","qualifiedName":"talawa_error_dialog","href":"widgets_talawa_error_dialog/widgets_talawa_error_dialog-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TalawaErrorDialog","qualifiedName":"talawa_error_dialog.TalawaErrorDialog","href":"widgets_talawa_error_dialog/TalawaErrorDialog-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"talawa_error_dialog","type":"library","href":"widgets_talawa_error_dialog/widgets_talawa_error_dialog-library.md"}},{"name":"TalawaErrorDialog","qualifiedName":"talawa_error_dialog.TalawaErrorDialog.TalawaErrorDialog","href":"widgets_talawa_error_dialog/TalawaErrorDialog/TalawaErrorDialog.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaErrorDialog","type":"class","href":"widgets_talawa_error_dialog/TalawaErrorDialog-class.md"}},{"name":"build","qualifiedName":"talawa_error_dialog.TalawaErrorDialog.build","href":"widgets_talawa_error_dialog/TalawaErrorDialog/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"TalawaErrorDialog","type":"class","href":"widgets_talawa_error_dialog/TalawaErrorDialog-class.md"}},{"name":"errorMessage","qualifiedName":"talawa_error_dialog.TalawaErrorDialog.errorMessage","href":"widgets_talawa_error_dialog/TalawaErrorDialog/errorMessage.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaErrorDialog","type":"class","href":"widgets_talawa_error_dialog/TalawaErrorDialog-class.md"}},{"name":"messageType","qualifiedName":"talawa_error_dialog.TalawaErrorDialog.messageType","href":"widgets_talawa_error_dialog/TalawaErrorDialog/messageType.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaErrorDialog","type":"class","href":"widgets_talawa_error_dialog/TalawaErrorDialog-class.md"}},{"name":"talawa_error_snackbar","qualifiedName":"talawa_error_snackbar","href":"widgets_talawa_error_snackbar/widgets_talawa_error_snackbar-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TalawaErrorSnackBar","qualifiedName":"talawa_error_snackbar.TalawaErrorSnackBar","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"talawa_error_snackbar","type":"library","href":"widgets_talawa_error_snackbar/widgets_talawa_error_snackbar-library.md"}},{"name":"TalawaErrorSnackBar","qualifiedName":"talawa_error_snackbar.TalawaErrorSnackBar.TalawaErrorSnackBar","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar/TalawaErrorSnackBar.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaErrorSnackBar","type":"class","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md"}},{"name":"build","qualifiedName":"talawa_error_snackbar.TalawaErrorSnackBar.build","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"TalawaErrorSnackBar","type":"class","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md"}},{"name":"errorMessage","qualifiedName":"talawa_error_snackbar.TalawaErrorSnackBar.errorMessage","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar/errorMessage.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaErrorSnackBar","type":"class","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md"}},{"name":"messageType","qualifiedName":"talawa_error_snackbar.TalawaErrorSnackBar.messageType","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar/messageType.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaErrorSnackBar","type":"class","href":"widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md"}},{"name":"talawa_logo","qualifiedName":"talawa_logo","href":"custom_painters_talawa_logo/custom_painters_talawa_logo-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AppLogo","qualifiedName":"talawa_logo.AppLogo","href":"custom_painters_talawa_logo/AppLogo-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class draws the app logo using custom paint.\nCustomPaint is a widget from the Flutter SDK, which enables\nyou to use a canvas to draw different shapes.","enclosedBy":{"name":"talawa_logo","type":"library","href":"custom_painters_talawa_logo/custom_painters_talawa_logo-library.md"}},{"name":"AppLogo","qualifiedName":"talawa_logo.AppLogo.AppLogo","href":"custom_painters_talawa_logo/AppLogo/AppLogo.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppLogo","type":"class","href":"custom_painters_talawa_logo/AppLogo-class.md"}},{"name":"paint","qualifiedName":"talawa_logo.AppLogo.paint","href":"custom_painters_talawa_logo/AppLogo/paint.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called whenever the object needs to paint. The given Canvas has its\ncoordinate space configured such that the origin is at the top left of the\nbox. The area of the box is the size of the size argument.","enclosedBy":{"name":"AppLogo","type":"class","href":"custom_painters_talawa_logo/AppLogo-class.md"}},{"name":"shouldRepaint","qualifiedName":"talawa_logo.AppLogo.shouldRepaint","href":"custom_painters_talawa_logo/AppLogo/shouldRepaint.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called whenever a new instance of the custom painter delegate class is\nprovided to the RenderCustomPaint object, or any time that a new\nCustomPaint object is created with a new instance of the custom painter\ndelegate class (which amounts to the same thing, because the latter is\nimplemented in terms of the former).","enclosedBy":{"name":"AppLogo","type":"class","href":"custom_painters_talawa_logo/AppLogo-class.md"}},{"name":"talawa_plugin_provider","qualifiedName":"talawa_plugin_provider","href":"plugins_talawa_plugin_provider/plugins_talawa_plugin_provider-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TalawaPluginProvider","qualifiedName":"talawa_plugin_provider.TalawaPluginProvider","href":"plugins_talawa_plugin_provider/TalawaPluginProvider-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"TalwaPluginProvider provides ability to implement features as plugins","enclosedBy":{"name":"talawa_plugin_provider","type":"library","href":"plugins_talawa_plugin_provider/plugins_talawa_plugin_provider-library.md"}},{"name":"TalawaPluginProvider","qualifiedName":"talawa_plugin_provider.TalawaPluginProvider.TalawaPluginProvider","href":"plugins_talawa_plugin_provider/TalawaPluginProvider/TalawaPluginProvider.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TalawaPluginProvider","type":"class","href":"plugins_talawa_plugin_provider/TalawaPluginProvider-class.md"}},{"name":"build","qualifiedName":"talawa_plugin_provider.TalawaPluginProvider.build","href":"plugins_talawa_plugin_provider/TalawaPluginProvider/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"build the Plugin combining local visibility property and serverVisible property","enclosedBy":{"name":"TalawaPluginProvider","type":"class","href":"plugins_talawa_plugin_provider/TalawaPluginProvider-class.md"}},{"name":"checkFromPluginList","qualifiedName":"talawa_plugin_provider.TalawaPluginProvider.checkFromPluginList","href":"plugins_talawa_plugin_provider/TalawaPluginProvider/checkFromPluginList.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"return bool decides the final visibility of the verifying from database and current OrgId","enclosedBy":{"name":"TalawaPluginProvider","type":"class","href":"plugins_talawa_plugin_provider/TalawaPluginProvider-class.md"}},{"name":"child","qualifiedName":"talawa_plugin_provider.TalawaPluginProvider.child","href":"plugins_talawa_plugin_provider/TalawaPluginProvider/child.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"child contains the widget for the plugin UI.","enclosedBy":{"name":"TalawaPluginProvider","type":"class","href":"plugins_talawa_plugin_provider/TalawaPluginProvider-class.md"}},{"name":"pluginName","qualifiedName":"talawa_plugin_provider.TalawaPluginProvider.pluginName","href":"plugins_talawa_plugin_provider/TalawaPluginProvider/pluginName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"name of plugin preferred with underscores(_) instead of spaces","enclosedBy":{"name":"TalawaPluginProvider","type":"class","href":"plugins_talawa_plugin_provider/TalawaPluginProvider-class.md"}},{"name":"visible","qualifiedName":"talawa_plugin_provider.TalawaPluginProvider.visible","href":"plugins_talawa_plugin_provider/TalawaPluginProvider/visible.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"visible is the property that decides visibility of the UI.","enclosedBy":{"name":"TalawaPluginProvider","type":"class","href":"plugins_talawa_plugin_provider/TalawaPluginProvider-class.md"}},{"name":"task_form","qualifiedName":"task_form","href":"widgets_task_form/widgets_task_form-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"DescriptionField","qualifiedName":"task_form.DescriptionField","href":"widgets_task_form/DescriptionField-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"task_form","type":"library","href":"widgets_task_form/widgets_task_form-library.md"}},{"name":"DescriptionField","qualifiedName":"task_form.DescriptionField.DescriptionField","href":"widgets_task_form/DescriptionField/DescriptionField.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"DescriptionField","type":"class","href":"widgets_task_form/DescriptionField-class.md"}},{"name":"build","qualifiedName":"task_form.DescriptionField.build","href":"widgets_task_form/DescriptionField/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"DescriptionField","type":"class","href":"widgets_task_form/DescriptionField-class.md"}},{"name":"TaskForm","qualifiedName":"task_form.TaskForm","href":"widgets_task_form/TaskForm-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"task_form","type":"library","href":"widgets_task_form/widgets_task_form-library.md"}},{"name":"TaskForm","qualifiedName":"task_form.TaskForm.TaskForm","href":"widgets_task_form/TaskForm/TaskForm.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskForm","type":"class","href":"widgets_task_form/TaskForm-class.md"}},{"name":"actionText","qualifiedName":"task_form.TaskForm.actionText","href":"widgets_task_form/TaskForm/actionText.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskForm","type":"class","href":"widgets_task_form/TaskForm-class.md"}},{"name":"createState","qualifiedName":"task_form.TaskForm.createState","href":"widgets_task_form/TaskForm/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"TaskForm","type":"class","href":"widgets_task_form/TaskForm-class.md"}},{"name":"onSave","qualifiedName":"task_form.TaskForm.onSave","href":"widgets_task_form/TaskForm/onSave.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskForm","type":"class","href":"widgets_task_form/TaskForm-class.md"}},{"name":"title","qualifiedName":"task_form.TaskForm.title","href":"widgets_task_form/TaskForm/title.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskForm","type":"class","href":"widgets_task_form/TaskForm-class.md"}},{"name":"TitleField","qualifiedName":"task_form.TitleField","href":"widgets_task_form/TitleField-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"task_form","type":"library","href":"widgets_task_form/widgets_task_form-library.md"}},{"name":"TitleField","qualifiedName":"task_form.TitleField.TitleField","href":"widgets_task_form/TitleField/TitleField.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TitleField","type":"class","href":"widgets_task_form/TitleField-class.md"}},{"name":"build","qualifiedName":"task_form.TitleField.build","href":"widgets_task_form/TitleField/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"TitleField","type":"class","href":"widgets_task_form/TitleField-class.md"}},{"name":"task_model","qualifiedName":"task_model","href":"models_task_task_model/models_task_task_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Task","qualifiedName":"task_model.Task","href":"models_task_task_model/Task-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"task_model","type":"library","href":"models_task_task_model/models_task_task_model-library.md"}},{"name":"Task","qualifiedName":"task_model.Task.Task","href":"models_task_task_model/Task/Task.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"createdAt","qualifiedName":"task_model.Task.createdAt","href":"models_task_task_model/Task/createdAt.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"creator","qualifiedName":"task_model.Task.creator","href":"models_task_task_model/Task/creator.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"deadline","qualifiedName":"task_model.Task.deadline","href":"models_task_task_model/Task/deadline.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"description","qualifiedName":"task_model.Task.description","href":"models_task_task_model/Task/description.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"event","qualifiedName":"task_model.Task.event","href":"models_task_task_model/Task/event.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"Task.fromJson","qualifiedName":"task_model.Task.fromJson","href":"models_task_task_model/Task/Task.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"/Creating a new Task instance from a map structure.","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"id","qualifiedName":"task_model.Task.id","href":"models_task_task_model/Task/id.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"title","qualifiedName":"task_model.Task.title","href":"models_task_task_model/Task/title.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Task","type":"class","href":"models_task_task_model/Task-class.md"}},{"name":"task_queries","qualifiedName":"task_queries","href":"utils_task_queries/utils_task_queries-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TaskQueries","qualifiedName":"task_queries.TaskQueries","href":"utils_task_queries/TaskQueries-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates queries for the tasks in the application.","enclosedBy":{"name":"task_queries","type":"library","href":"utils_task_queries/utils_task_queries-library.md"}},{"name":"TaskQueries","qualifiedName":"task_queries.TaskQueries.TaskQueries","href":"utils_task_queries/TaskQueries/TaskQueries.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskQueries","type":"class","href":"utils_task_queries/TaskQueries-class.md"}},{"name":"addTask","qualifiedName":"task_queries.TaskQueries.addTask","href":"utils_task_queries/TaskQueries/addTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskQueries","type":"class","href":"utils_task_queries/TaskQueries-class.md"}},{"name":"deleteTask","qualifiedName":"task_queries.TaskQueries.deleteTask","href":"utils_task_queries/TaskQueries/deleteTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskQueries","type":"class","href":"utils_task_queries/TaskQueries-class.md"}},{"name":"editTask","qualifiedName":"task_queries.TaskQueries.editTask","href":"utils_task_queries/TaskQueries/editTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskQueries","type":"class","href":"utils_task_queries/TaskQueries-class.md"}},{"name":"eventTasks","qualifiedName":"task_queries.TaskQueries.eventTasks","href":"utils_task_queries/TaskQueries/eventTasks.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskQueries","type":"class","href":"utils_task_queries/TaskQueries-class.md"}},{"name":"userTasks","qualifiedName":"task_queries.TaskQueries.userTasks","href":"utils_task_queries/TaskQueries/userTasks.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskQueries","type":"class","href":"utils_task_queries/TaskQueries-class.md"}},{"name":"task_schedule","qualifiedName":"task_schedule","href":"widgets_task_schedule/widgets_task_schedule-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TaskCard","qualifiedName":"task_schedule.TaskCard","href":"widgets_task_schedule/TaskCard-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"task_schedule","type":"library","href":"widgets_task_schedule/widgets_task_schedule-library.md"}},{"name":"TaskCard","qualifiedName":"task_schedule.TaskCard.TaskCard","href":"widgets_task_schedule/TaskCard/TaskCard.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskCard","type":"class","href":"widgets_task_schedule/TaskCard-class.md"}},{"name":"appointment","qualifiedName":"task_schedule.TaskCard.appointment","href":"widgets_task_schedule/TaskCard/appointment.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskCard","type":"class","href":"widgets_task_schedule/TaskCard-class.md"}},{"name":"build","qualifiedName":"task_schedule.TaskCard.build","href":"widgets_task_schedule/TaskCard/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"TaskCard","type":"class","href":"widgets_task_schedule/TaskCard-class.md"}},{"name":"showMoreOptions","qualifiedName":"task_schedule.TaskCard.showMoreOptions","href":"widgets_task_schedule/TaskCard/showMoreOptions.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskCard","type":"class","href":"widgets_task_schedule/TaskCard-class.md"}},{"name":"task","qualifiedName":"task_schedule.TaskCard.task","href":"widgets_task_schedule/TaskCard/task.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskCard","type":"class","href":"widgets_task_schedule/TaskCard-class.md"}},{"name":"TaskSchedule","qualifiedName":"task_schedule.TaskSchedule","href":"widgets_task_schedule/TaskSchedule-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"task_schedule","type":"library","href":"widgets_task_schedule/widgets_task_schedule-library.md"}},{"name":"TaskSchedule","qualifiedName":"task_schedule.TaskSchedule.TaskSchedule","href":"widgets_task_schedule/TaskSchedule/TaskSchedule.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskSchedule","type":"class","href":"widgets_task_schedule/TaskSchedule-class.md"}},{"name":"build","qualifiedName":"task_schedule.TaskSchedule.build","href":"widgets_task_schedule/TaskSchedule/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"TaskSchedule","type":"class","href":"widgets_task_schedule/TaskSchedule-class.md"}},{"name":"calendarTapped","qualifiedName":"task_schedule.TaskSchedule.calendarTapped","href":"widgets_task_schedule/TaskSchedule/calendarTapped.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskSchedule","type":"class","href":"widgets_task_schedule/TaskSchedule-class.md"}},{"name":"showMoreOptions","qualifiedName":"task_schedule.TaskSchedule.showMoreOptions","href":"widgets_task_schedule/TaskSchedule/showMoreOptions.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskSchedule","type":"class","href":"widgets_task_schedule/TaskSchedule-class.md"}},{"name":"tasks","qualifiedName":"task_schedule.TaskSchedule.tasks","href":"widgets_task_schedule/TaskSchedule/tasks.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskSchedule","type":"class","href":"widgets_task_schedule/TaskSchedule-class.md"}},{"name":"task_service","qualifiedName":"task_service","href":"services_task_service/services_task_service-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TaskService","qualifiedName":"task_service.TaskService","href":"services_task_service/TaskService-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"PostService class provides functions in the context of a Task.","enclosedBy":{"name":"task_service","type":"library","href":"services_task_service/services_task_service-library.md"}},{"name":"TaskService","qualifiedName":"task_service.TaskService.TaskService","href":"services_task_service/TaskService/TaskService.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskService","type":"class","href":"services_task_service/TaskService-class.md"}},{"name":"callbackNotifyListeners","qualifiedName":"task_service.TaskService.callbackNotifyListeners","href":"services_task_service/TaskService/callbackNotifyListeners.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskService","type":"class","href":"services_task_service/TaskService-class.md"}},{"name":"createTask","qualifiedName":"task_service.TaskService.createTask","href":"services_task_service/TaskService/createTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to create a new task for the event.","enclosedBy":{"name":"TaskService","type":"class","href":"services_task_service/TaskService-class.md"}},{"name":"deleteTask","qualifiedName":"task_service.TaskService.deleteTask","href":"services_task_service/TaskService/deleteTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to delete a task.","enclosedBy":{"name":"TaskService","type":"class","href":"services_task_service/TaskService-class.md"}},{"name":"editTask","qualifiedName":"task_service.TaskService.editTask","href":"services_task_service/TaskService/editTask.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to edit the task created by the user.","enclosedBy":{"name":"TaskService","type":"class","href":"services_task_service/TaskService-class.md"}},{"name":"getTasksByUser","qualifiedName":"task_service.TaskService.getTasksByUser","href":"services_task_service/TaskService/getTasksByUser.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to fetch and return all tasks added by the current user.","enclosedBy":{"name":"TaskService","type":"class","href":"services_task_service/TaskService-class.md"}},{"name":"getTasksForEvent","qualifiedName":"task_service.TaskService.getTasksForEvent","href":"services_task_service/TaskService/getTasksForEvent.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to get all the tasks for the event.","enclosedBy":{"name":"TaskService","type":"class","href":"services_task_service/TaskService-class.md"}},{"name":"tasks","qualifiedName":"task_service.TaskService.tasks","href":"services_task_service/TaskService/tasks.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TaskService","type":"class","href":"services_task_service/TaskService-class.md"}},{"name":"telegram_logo","qualifiedName":"telegram_logo","href":"custom_painters_telegram_logo/custom_painters_telegram_logo-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TelegramLogo","qualifiedName":"telegram_logo.TelegramLogo","href":"custom_painters_telegram_logo/TelegramLogo-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class draws the telegram logo using custom paint.\nCustomPaint is a widget from the Flutter SDK, which enables\nyou to use a canvas to draw different shapes.","enclosedBy":{"name":"telegram_logo","type":"library","href":"custom_painters_telegram_logo/custom_painters_telegram_logo-library.md"}},{"name":"TelegramLogo","qualifiedName":"telegram_logo.TelegramLogo.TelegramLogo","href":"custom_painters_telegram_logo/TelegramLogo/TelegramLogo.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TelegramLogo","type":"class","href":"custom_painters_telegram_logo/TelegramLogo-class.md"}},{"name":"paint","qualifiedName":"telegram_logo.TelegramLogo.paint","href":"custom_painters_telegram_logo/TelegramLogo/paint.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called whenever the object needs to paint. The given Canvas has its\ncoordinate space configured such that the origin is at the top left of the\nbox. The area of the box is the size of the size argument.","enclosedBy":{"name":"TelegramLogo","type":"class","href":"custom_painters_telegram_logo/TelegramLogo-class.md"}},{"name":"shouldRepaint","qualifiedName":"telegram_logo.TelegramLogo.shouldRepaint","href":"custom_painters_telegram_logo/TelegramLogo/shouldRepaint.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called whenever a new instance of the custom painter delegate class is\nprovided to the RenderCustomPaint object, or any time that a new\nCustomPaint object is created with a new instance of the custom painter\ndelegate class (which amounts to the same thing, because the latter is\nimplemented in terms of the former).","enclosedBy":{"name":"TelegramLogo","type":"class","href":"custom_painters_telegram_logo/TelegramLogo-class.md"}},{"name":"theme_switch","qualifiedName":"theme_switch","href":"widgets_theme_switch/widgets_theme_switch-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"ChangeThemeTile","qualifiedName":"theme_switch.ChangeThemeTile","href":"widgets_theme_switch/ChangeThemeTile-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class enables theme switch.\nIt returns a ListTile which contains a Toggle button to switch between Dark and Light Themes.","enclosedBy":{"name":"theme_switch","type":"library","href":"widgets_theme_switch/widgets_theme_switch-library.md"}},{"name":"ChangeThemeTile","qualifiedName":"theme_switch.ChangeThemeTile.ChangeThemeTile","href":"widgets_theme_switch/ChangeThemeTile/ChangeThemeTile.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"ChangeThemeTile","type":"class","href":"widgets_theme_switch/ChangeThemeTile-class.md"}},{"name":"build","qualifiedName":"theme_switch.ChangeThemeTile.build","href":"widgets_theme_switch/ChangeThemeTile/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"ChangeThemeTile","type":"class","href":"widgets_theme_switch/ChangeThemeTile-class.md"}},{"name":"theme_view_model","qualifiedName":"theme_view_model","href":"view_model_theme_view_model/view_model_theme_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"AppTheme","qualifiedName":"theme_view_model.AppTheme","href":"view_model_theme_view_model/AppTheme-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"AppTheme class is a type of View Model to serve data from modal to views in the context of App Themes.","enclosedBy":{"name":"theme_view_model","type":"library","href":"view_model_theme_view_model/view_model_theme_view_model-library.md"}},{"name":"AppTheme","qualifiedName":"theme_view_model.AppTheme.AppTheme","href":"view_model_theme_view_model/AppTheme/AppTheme.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"view_model_theme_view_model/AppTheme-class.md"}},{"name":"initialize","qualifiedName":"theme_view_model.AppTheme.initialize","href":"view_model_theme_view_model/AppTheme/initialize.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"view_model_theme_view_model/AppTheme-class.md"}},{"name":"isdarkTheme","qualifiedName":"theme_view_model.AppTheme.isdarkTheme","href":"view_model_theme_view_model/AppTheme/isdarkTheme.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"view_model_theme_view_model/AppTheme-class.md"}},{"name":"key","qualifiedName":"theme_view_model.AppTheme.key","href":"view_model_theme_view_model/AppTheme/key.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"AppTheme","type":"class","href":"view_model_theme_view_model/AppTheme-class.md"}},{"name":"switchTheme","qualifiedName":"theme_view_model.AppTheme.switchTheme","href":"view_model_theme_view_model/AppTheme/switchTheme.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function switches the app theme.","enclosedBy":{"name":"AppTheme","type":"class","href":"view_model_theme_view_model/AppTheme-class.md"}},{"name":"timeout","qualifiedName":"timeout","href":"constants_timeout/constants_timeout-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"TimeOuts","qualifiedName":"timeout.TimeOuts","href":"constants_timeout/TimeOuts-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"Class to define constant timeout to bring consistency in the code.","enclosedBy":{"name":"timeout","type":"library","href":"constants_timeout/constants_timeout-library.md"}},{"name":"TimeOuts","qualifiedName":"timeout.TimeOuts.TimeOuts","href":"constants_timeout/TimeOuts/TimeOuts.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"TimeOuts","type":"class","href":"constants_timeout/TimeOuts-class.md"}},{"name":"large","qualifiedName":"timeout.TimeOuts.large","href":"constants_timeout/TimeOuts/large-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"For large timeout, used for large data fetch.","enclosedBy":{"name":"TimeOuts","type":"class","href":"constants_timeout/TimeOuts-class.md"}},{"name":"mediums","qualifiedName":"timeout.TimeOuts.mediums","href":"constants_timeout/TimeOuts/mediums-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"For medium timeout, used for medium data fetch.","enclosedBy":{"name":"TimeOuts","type":"class","href":"constants_timeout/TimeOuts-class.md"}},{"name":"small","qualifiedName":"timeout.TimeOuts.small","href":"constants_timeout/TimeOuts/small-constant.md","type":"constant","overriddenDepth":0,"packageName":"talawa","desc":"For small timeout, used for small data fetch.","enclosedBy":{"name":"TimeOuts","type":"class","href":"constants_timeout/TimeOuts-class.md"}},{"name":"user_config","qualifiedName":"user_config","href":"services_user_config/services_user_config-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"UserConfig","qualifiedName":"user_config.UserConfig","href":"services_user_config/UserConfig-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"UserConfig class provides different services in the context of the User.","enclosedBy":{"name":"user_config","type":"library","href":"services_user_config/services_user_config-library.md"}},{"name":"UserConfig","qualifiedName":"user_config.UserConfig.UserConfig","href":"services_user_config/UserConfig/UserConfig.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"currentOrg","qualifiedName":"user_config.UserConfig.currentOrg","href":"services_user_config/UserConfig/currentOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"currentOrgInfoController","qualifiedName":"user_config.UserConfig.currentOrgInfoController","href":"services_user_config/UserConfig/currentOrgInfoController.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"currentOrgInfoStream","qualifiedName":"user_config.UserConfig.currentOrgInfoStream","href":"services_user_config/UserConfig/currentOrgInfoStream.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"currentOrgName","qualifiedName":"user_config.UserConfig.currentOrgName","href":"services_user_config/UserConfig/currentOrgName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"currentUser","qualifiedName":"user_config.UserConfig.currentUser","href":"services_user_config/UserConfig/currentUser.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"initialiseStream","qualifiedName":"user_config.UserConfig.initialiseStream","href":"services_user_config/UserConfig/initialiseStream.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"saveCurrentOrgInHive","qualifiedName":"user_config.UserConfig.saveCurrentOrgInHive","href":"services_user_config/UserConfig/saveCurrentOrgInHive.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"saveUserInHive","qualifiedName":"user_config.UserConfig.saveUserInHive","href":"services_user_config/UserConfig/saveUserInHive.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"updateAccessToken","qualifiedName":"user_config.UserConfig.updateAccessToken","href":"services_user_config/UserConfig/updateAccessToken.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to updated the access token of the user.","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"updateUser","qualifiedName":"user_config.UserConfig.updateUser","href":"services_user_config/UserConfig/updateUser.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to update the user details.","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"updateUserAdminOrg","qualifiedName":"user_config.UserConfig.updateUserAdminOrg","href":"services_user_config/UserConfig/updateUserAdminOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to update the organization admin.","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"updateUserCreatedOrg","qualifiedName":"user_config.UserConfig.updateUserCreatedOrg","href":"services_user_config/UserConfig/updateUserCreatedOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to update the user created organization.","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"updateUserJoinedOrg","qualifiedName":"user_config.UserConfig.updateUserJoinedOrg","href":"services_user_config/UserConfig/updateUserJoinedOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to update the user joined organization.","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"updateUserMemberRequestOrg","qualifiedName":"user_config.UserConfig.updateUserMemberRequestOrg","href":"services_user_config/UserConfig/updateUserMemberRequestOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to update the user request to join the organization.","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"userLoggedIn","qualifiedName":"user_config.UserConfig.userLoggedIn","href":"services_user_config/UserConfig/userLoggedIn.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function is used to log in the user.","enclosedBy":{"name":"UserConfig","type":"class","href":"services_user_config/UserConfig-class.md"}},{"name":"user_info","qualifiedName":"user_info","href":"models_user_user_info/models_user_user_info-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"User","qualifiedName":"user_info.User","href":"models_user_user_info/User-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates a User model and returns a user instance.","enclosedBy":{"name":"user_info","type":"library","href":"models_user_user_info/models_user_user_info-library.md"}},{"name":"User","qualifiedName":"user_info.User.User","href":"models_user_user_info/User/User.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"adminFor","qualifiedName":"user_info.User.adminFor","href":"models_user_user_info/User/adminFor.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"authToken","qualifiedName":"user_info.User.authToken","href":"models_user_user_info/User/authToken.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"createdOrganizations","qualifiedName":"user_info.User.createdOrganizations","href":"models_user_user_info/User/createdOrganizations.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"email","qualifiedName":"user_info.User.email","href":"models_user_user_info/User/email.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"firstName","qualifiedName":"user_info.User.firstName","href":"models_user_user_info/User/firstName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"User.fromJson","qualifiedName":"user_info.User.fromJson","href":"models_user_user_info/User/User.fromJson.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"id","qualifiedName":"user_info.User.id","href":"models_user_user_info/User/id.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"image","qualifiedName":"user_info.User.image","href":"models_user_user_info/User/image.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"joinedOrganizations","qualifiedName":"user_info.User.joinedOrganizations","href":"models_user_user_info/User/joinedOrganizations.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"lastName","qualifiedName":"user_info.User.lastName","href":"models_user_user_info/User/lastName.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"membershipRequests","qualifiedName":"user_info.User.membershipRequests","href":"models_user_user_info/User/membershipRequests.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"print","qualifiedName":"user_info.User.print","href":"models_user_user_info/User/print.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"refreshToken","qualifiedName":"user_info.User.refreshToken","href":"models_user_user_info/User/refreshToken.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"update","qualifiedName":"user_info.User.update","href":"models_user_user_info/User/update.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"updateAdminFor","qualifiedName":"user_info.User.updateAdminFor","href":"models_user_user_info/User/updateAdminFor.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"updateCreatedOrg","qualifiedName":"user_info.User.updateCreatedOrg","href":"models_user_user_info/User/updateCreatedOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"updateJoinedOrg","qualifiedName":"user_info.User.updateJoinedOrg","href":"models_user_user_info/User/updateJoinedOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"updateMemberRequestOrg","qualifiedName":"user_info.User.updateMemberRequestOrg","href":"models_user_user_info/User/updateMemberRequestOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"User","type":"class","href":"models_user_user_info/User-class.md"}},{"name":"UserAdapter","qualifiedName":"user_info.UserAdapter","href":"models_user_user_info/UserAdapter-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"user_info","type":"library","href":"models_user_user_info/models_user_user_info-library.md"}},{"name":"operator ==","qualifiedName":"user_info.UserAdapter.==","href":"models_user_user_info/UserAdapter/operator_equals.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"The equality operator.","enclosedBy":{"name":"UserAdapter","type":"class","href":"models_user_user_info/UserAdapter-class.md"}},{"name":"UserAdapter","qualifiedName":"user_info.UserAdapter.UserAdapter","href":"models_user_user_info/UserAdapter/UserAdapter.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserAdapter","type":"class","href":"models_user_user_info/UserAdapter-class.md"}},{"name":"hashCode","qualifiedName":"user_info.UserAdapter.hashCode","href":"models_user_user_info/UserAdapter/hashCode.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"The hash code for this object.","enclosedBy":{"name":"UserAdapter","type":"class","href":"models_user_user_info/UserAdapter-class.md"}},{"name":"read","qualifiedName":"user_info.UserAdapter.read","href":"models_user_user_info/UserAdapter/read.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Is called when a value has to be decoded.","enclosedBy":{"name":"UserAdapter","type":"class","href":"models_user_user_info/UserAdapter-class.md"}},{"name":"typeId","qualifiedName":"user_info.UserAdapter.typeId","href":"models_user_user_info/UserAdapter/typeId.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"Called for type registration","enclosedBy":{"name":"UserAdapter","type":"class","href":"models_user_user_info/UserAdapter-class.md"}},{"name":"write","qualifiedName":"user_info.UserAdapter.write","href":"models_user_user_info/UserAdapter/write.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Is called when a value has to be encoded.","enclosedBy":{"name":"UserAdapter","type":"class","href":"models_user_user_info/UserAdapter-class.md"}},{"name":"user_tasks_page","qualifiedName":"user_tasks_page","href":"views_after_auth_screens_tasks_user_tasks_page/views_after_auth_screens_tasks_user_tasks_page-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"UserTasksPage","qualifiedName":"user_tasks_page.UserTasksPage","href":"views_after_auth_screens_tasks_user_tasks_page/UserTasksPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"UserTasksPage returns a widget for page of User Tasks.","enclosedBy":{"name":"user_tasks_page","type":"library","href":"views_after_auth_screens_tasks_user_tasks_page/views_after_auth_screens_tasks_user_tasks_page-library.md"}},{"name":"UserTasksPage","qualifiedName":"user_tasks_page.UserTasksPage.UserTasksPage","href":"views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/UserTasksPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"UserTasksPage","type":"class","href":"views_after_auth_screens_tasks_user_tasks_page/UserTasksPage-class.md"}},{"name":"build","qualifiedName":"user_tasks_page.UserTasksPage.build","href":"views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"UserTasksPage","type":"class","href":"views_after_auth_screens_tasks_user_tasks_page/UserTasksPage-class.md"}},{"name":"validators","qualifiedName":"validators","href":"utils_validators/utils_validators-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"Validator","qualifiedName":"validators.Validator","href":"utils_validators/Validator-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creats various validator methods for the application.\nThey are used to validate information given by the users.","enclosedBy":{"name":"validators","type":"library","href":"utils_validators/utils_validators-library.md"}},{"name":"Validator","qualifiedName":"validators.Validator.Validator","href":"utils_validators/Validator/Validator.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"validateEmail","qualifiedName":"validators.Validator.validateEmail","href":"utils_validators/Validator/validateEmail.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"validateEventForm","qualifiedName":"validators.Validator.validateEventForm","href":"utils_validators/Validator/validateEventForm.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"validateFirstName","qualifiedName":"validators.Validator.validateFirstName","href":"utils_validators/Validator/validateFirstName.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"validateLastName","qualifiedName":"validators.Validator.validateLastName","href":"utils_validators/Validator/validateLastName.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"validatePassword","qualifiedName":"validators.Validator.validatePassword","href":"utils_validators/Validator/validatePassword.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"validatePasswordConfirm","qualifiedName":"validators.Validator.validatePasswordConfirm","href":"utils_validators/Validator/validatePasswordConfirm.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"validateURL","qualifiedName":"validators.Validator.validateURL","href":"utils_validators/Validator/validateURL.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"validateUrlExistence","qualifiedName":"validators.Validator.validateUrlExistence","href":"utils_validators/Validator/validateUrlExistence.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"Validator","type":"class","href":"utils_validators/Validator-class.md"}},{"name":"video_widget","qualifiedName":"video_widget","href":"widgets_video_widget/widgets_video_widget-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"VideoWidget","qualifiedName":"video_widget.VideoWidget","href":"widgets_video_widget/VideoWidget-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class creates a video widget.","enclosedBy":{"name":"video_widget","type":"library","href":"widgets_video_widget/widgets_video_widget-library.md"}},{"name":"VideoWidget","qualifiedName":"video_widget.VideoWidget.VideoWidget","href":"widgets_video_widget/VideoWidget/VideoWidget.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"VideoWidget","type":"class","href":"widgets_video_widget/VideoWidget-class.md"}},{"name":"createState","qualifiedName":"video_widget.VideoWidget.createState","href":"widgets_video_widget/VideoWidget/createState.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Creates the mutable state for this widget at a given location in the tree.","enclosedBy":{"name":"VideoWidget","type":"class","href":"widgets_video_widget/VideoWidget-class.md"}},{"name":"play","qualifiedName":"video_widget.VideoWidget.play","href":"widgets_video_widget/VideoWidget/play.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"VideoWidget","type":"class","href":"widgets_video_widget/VideoWidget-class.md"}},{"name":"url","qualifiedName":"video_widget.VideoWidget.url","href":"widgets_video_widget/VideoWidget/url.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"VideoWidget","type":"class","href":"widgets_video_widget/VideoWidget-class.md"}},{"name":"waiting_to_join_private_org","qualifiedName":"waiting_to_join_private_org","href":"views_pre_auth_screens_waiting_to_join_private_org/views_pre_auth_screens_waiting_to_join_private_org-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"WaitingPage","qualifiedName":"waiting_to_join_private_org.WaitingPage","href":"views_pre_auth_screens_waiting_to_join_private_org/WaitingPage-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class returns a widget which shows the request sent by the user to join a private organization.","enclosedBy":{"name":"waiting_to_join_private_org","type":"library","href":"views_pre_auth_screens_waiting_to_join_private_org/views_pre_auth_screens_waiting_to_join_private_org-library.md"}},{"name":"WaitingPage","qualifiedName":"waiting_to_join_private_org.WaitingPage.WaitingPage","href":"views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/WaitingPage.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"WaitingPage","type":"class","href":"views_pre_auth_screens_waiting_to_join_private_org/WaitingPage-class.md"}},{"name":"build","qualifiedName":"waiting_to_join_private_org.WaitingPage.build","href":"views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/build.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Describes the part of the user interface represented by this widget.","enclosedBy":{"name":"WaitingPage","type":"class","href":"views_pre_auth_screens_waiting_to_join_private_org/WaitingPage-class.md"}},{"name":"waiting_view_model","qualifiedName":"waiting_view_model","href":"view_model_pre_auth_view_models_waiting_view_model/view_model_pre_auth_view_models_waiting_view_model-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"WaitingViewModel","qualifiedName":"waiting_view_model.WaitingViewModel","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"WaitingViewModel class helps to interact with model to serve data\nand react to user's input for Waiting section.","enclosedBy":{"name":"waiting_view_model","type":"library","href":"view_model_pre_auth_view_models_waiting_view_model/view_model_pre_auth_view_models_waiting_view_model-library.md"}},{"name":"WaitingViewModel","qualifiedName":"waiting_view_model.WaitingViewModel.WaitingViewModel","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/WaitingViewModel.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"WaitingViewModel","type":"class","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md"}},{"name":"currentUser","qualifiedName":"waiting_view_model.WaitingViewModel.currentUser","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/currentUser.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"WaitingViewModel","type":"class","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md"}},{"name":"greeting","qualifiedName":"waiting_view_model.WaitingViewModel.greeting","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/greeting.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"WaitingViewModel","type":"class","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md"}},{"name":"initialise","qualifiedName":"waiting_view_model.WaitingViewModel.initialise","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/initialise.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"WaitingViewModel","type":"class","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md"}},{"name":"joinOrg","qualifiedName":"waiting_view_model.WaitingViewModel.joinOrg","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/joinOrg.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"WaitingViewModel","type":"class","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md"}},{"name":"logout","qualifiedName":"waiting_view_model.WaitingViewModel.logout","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/logout.md","type":"method","overriddenDepth":0,"packageName":"talawa","desc":"This function ends the session for the user or logout the user from the application.","enclosedBy":{"name":"WaitingViewModel","type":"class","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md"}},{"name":"pendingRequestOrg","qualifiedName":"waiting_view_model.WaitingViewModel.pendingRequestOrg","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/pendingRequestOrg.md","type":"property","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"WaitingViewModel","type":"class","href":"view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md"}},{"name":"whatsapp_logo","qualifiedName":"whatsapp_logo","href":"custom_painters_whatsapp_logo/custom_painters_whatsapp_logo-library.md","type":"library","overriddenDepth":0,"packageName":"talawa","desc":""},{"name":"WhatsappLogo","qualifiedName":"whatsapp_logo.WhatsappLogo","href":"custom_painters_whatsapp_logo/WhatsappLogo-class.md","type":"class","overriddenDepth":0,"packageName":"talawa","desc":"This class draws the whatsapp logo using custom paint.\nCustomPaint is a widget from the Flutter SDK, which enables\nyou to use a canvas to draw different shapes.","enclosedBy":{"name":"whatsapp_logo","type":"library","href":"custom_painters_whatsapp_logo/custom_painters_whatsapp_logo-library.md"}},{"name":"WhatsappLogo","qualifiedName":"whatsapp_logo.WhatsappLogo.WhatsappLogo","href":"custom_painters_whatsapp_logo/WhatsappLogo/WhatsappLogo.md","type":"constructor","overriddenDepth":0,"packageName":"talawa","desc":"","enclosedBy":{"name":"WhatsappLogo","type":"class","href":"custom_painters_whatsapp_logo/WhatsappLogo-class.md"}},{"name":"paint","qualifiedName":"whatsapp_logo.WhatsappLogo.paint","href":"custom_painters_whatsapp_logo/WhatsappLogo/paint.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called whenever the object needs to paint. The given Canvas has its\ncoordinate space configured such that the origin is at the top left of the\nbox. The area of the box is the size of the size argument.","enclosedBy":{"name":"WhatsappLogo","type":"class","href":"custom_painters_whatsapp_logo/WhatsappLogo-class.md"}},{"name":"shouldRepaint","qualifiedName":"whatsapp_logo.WhatsappLogo.shouldRepaint","href":"custom_painters_whatsapp_logo/WhatsappLogo/shouldRepaint.md","type":"method","overriddenDepth":1,"packageName":"talawa","desc":"Called whenever a new instance of the custom painter delegate class is\nprovided to the RenderCustomPaint object, or any time that a new\nCustomPaint object is created with a new instance of the custom painter\ndelegate class (which amounts to the same thing, because the latter is\nimplemented in terms of the former).","enclosedBy":{"name":"WhatsappLogo","type":"class","href":"custom_painters_whatsapp_logo/WhatsappLogo-class.md"}}] diff --git a/talawa-mobile-docs/index.md b/talawa-mobile-docs/index.md new file mode 100644 index 000000000..a21691b89 --- /dev/null +++ b/talawa-mobile-docs/index.md @@ -0,0 +1,654 @@ + + + +# talawa - Dart API docs + + +

Talawa

+

💬 Join the community on Slack

+

talawa-logo-lite-200x200

+

License: GPL v3 +GitHub stars +GitHub forks +codecov

+

Talawa is a comprehensive platform that aims to revolutionize the way organizations manage and interact with their data and content. Talawa empowers administrators to access and manage content with ease through the Talawa Admin interface, ensuring that information remains up-to-date and accessible to the platform's members.

+

With the Talawa API facilitating smooth communication between all parts of the platform, Talawa offers a cohesive and exceptional user experience for both administrators and members, making it a powerful tool for data management and content delivery seamlessly. Talawa is a modular open source project to manage group activities of both non-profit organizations and businesses.

+

Core features include:

+
    +
  1. Membership management
  2. +
  3. Groups management
  4. +
  5. Event registrations
  6. +
  7. Recurring meetings
  8. +
  9. Facilities registrations
  10. +
+

talawa is based on the original quito code created by the Palisadoes Foundation as part of its annual Calico Challenge program. Calico provides paid summer internships for Jamaican university students to work on selected open source projects. They are mentored by software professionals and receive stipends based on the completion of predefined milestones. Calico was started in 2015. Visit The Palisadoes Foundation's website for more details on its origin and activities.

+

Talawa Components

+

talawa has these major software components:

+
    +
  1. talawa: A mobile application with social media features
  2. +
  3. talawa-api: An API providing access to user data and features
  4. +
  5. talawa-admin: A web based administrative portal
  6. +
  7. talawa-docs: The online documentation website
  8. +
+

Documentation

+

Get familiar with talawa:

+
    +
  1. Read our Talawa Mobile App installation guide to get setup quickly.
  2. +
  3. The complete talawa documentation set can be found here.
  4. +
  5. Want to contribute? Look at CONTRIBUTING.md to get started.
  6. +
  7. Visit the Talawa GitHub to see the code.
  8. +
+ + +## Libraries + +##### [access_request_screen](views_after_auth_screens_join_org_after_auth_access_request_screen/views_after_auth_screens_join_org_after_auth_access_request_screen-library.md) + + + +##### [access_request_view_model](view_model_access_request_view_model/view_model_access_request_view_model-library.md) + + + +##### [add_members_bottom_sheet](widgets_add_members_bottom_sheet/widgets_add_members_bottom_sheet-library.md) + + + +##### [add_post_page](views_after_auth_screens_add_post_page/views_after_auth_screens_add_post_page-library.md) + + + +##### [add_post_view_model](view_model_after_auth_view_models_add_post_view_models_add_post_view_model/view_model_after_auth_view_models_add_post_view_models_add_post_view_model-library.md) + + + +##### [app_localization](utils_app_localization/utils_app_localization-library.md) + + + +##### [app_settings_page](views_after_auth_screens_app_settings_app_settings_page/views_after_auth_screens_app_settings_app_settings_page-library.md) + + + +##### [apptheme](apptheme/apptheme-library.md) + + + +##### [base_view](views_base_view/views_base_view-library.md) + + + +##### [base_view_model](view_model_base_view_model/view_model_base_view_model-library.md) + + + +##### [change_password](views_pre_auth_screens_change_password/views_pre_auth_screens_change_password-library.md) + + + +##### [chat_input_field](views_after_auth_screens_chat_widgets_chat_input_field/views_after_auth_screens_chat_widgets_chat_input_field-library.md) + + + +##### [chat_list_screen](views_after_auth_screens_chat_chat_list_screen/views_after_auth_screens_chat_chat_list_screen-library.md) + + + +##### [chat_list_tile_data_model](models_chats_chat_list_tile_data_model/models_chats_chat_list_tile_data_model-library.md) + + + +##### [chat_message](models_chats_chat_message/models_chats_chat_message-library.md) + + + +##### [chat_message_bubble](views_after_auth_screens_chat_widgets_chat_message_bubble/views_after_auth_screens_chat_widgets_chat_message_bubble-library.md) + + + +##### [chat_message_screen](views_after_auth_screens_chat_chat_message_screen/views_after_auth_screens_chat_chat_message_screen-library.md) + + + +##### [chat_queries](utils_chat_queries/utils_chat_queries-library.md) + + + +##### [chat_service](services_chat_service/services_chat_service-library.md) + + + +##### [chat_user](models_chats_chat_user/models_chats_chat_user-library.md) + + + +##### [comment_model](models_comment_comment_model/models_comment_comment_model-library.md) + + + +##### [comment_queries](utils_comment_queries/utils_comment_queries-library.md) + + + +##### [comment_service](services_comment_service/services_comment_service-library.md) + + + +##### [comments_view_model](view_model_widgets_view_models_comments_view_model/view_model_widgets_view_models_comments_view_model-library.md) + + + +##### [constants](constants_constants/constants_constants-library.md) + + + +##### [create_event_form](views_after_auth_screens_events_create_event_form/views_after_auth_screens_events_create_event_form-library.md) + + + +##### [create_event_page](views_after_auth_screens_events_create_event_page/views_after_auth_screens_events_create_event_page-library.md) + + + +##### [create_event_view_model](view_model_after_auth_view_models_event_view_models_create_event_view_model/view_model_after_auth_view_models_event_view_models_create_event_view_model-library.md) + + + +##### [create_task_page](views_after_auth_screens_tasks_create_task_page/views_after_auth_screens_tasks_create_task_page-library.md) + + + +##### [create_task_view_model](view_model_after_auth_view_models_task_view_models_create_task_view_model/view_model_after_auth_view_models_task_view_models_create_task_view_model-library.md) + + + +##### [custom_alert_dialog](widgets_custom_alert_dialog/widgets_custom_alert_dialog-library.md) + + + +##### [custom_avatar](widgets_custom_avatar/widgets_custom_avatar-library.md) + + + +##### [custom_drawer](widgets_custom_drawer/widgets_custom_drawer-library.md) + + + +##### [custom_drawer_view_model](view_model_widgets_view_models_custom_drawer_view_model/view_model_widgets_view_models_custom_drawer_view_model-library.md) + + + +##### [custom_list_tile](widgets_custom_list_tile/widgets_custom_list_tile-library.md) + + + +##### [custom_progress_dialog](widgets_custom_progress_dialog/widgets_custom_progress_dialog-library.md) + + + +##### [custom_theme](constants_custom_theme/constants_custom_theme-library.md) + + + +##### [database_mutation_functions](services_database_mutation_functions/services_database_mutation_functions-library.md) + + + +##### [date_time_picker](widgets_date_time_picker/widgets_date_time_picker-library.md) + + + +##### [direct_chat_demo_data](demo_server_data_direct_chat_demo_data/demo_server_data_direct_chat_demo_data-library.md) + + + +##### [direct_chat_view_model](view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model-library.md) + + + +##### [direct_chats](views_after_auth_screens_chat_direct_chats/views_after_auth_screens_chat_direct_chats-library.md) + + + +##### [edit_event_page](views_after_auth_screens_events_edit_event_page/views_after_auth_screens_events_edit_event_page-library.md) + + + +##### [edit_event_view_model](view_model_after_auth_view_models_event_view_models_edit_event_view_model/view_model_after_auth_view_models_event_view_models_edit_event_view_model-library.md) + + + +##### [edit_events_form](views_after_auth_screens_events_edit_events_form/views_after_auth_screens_events_edit_events_form-library.md) + + + +##### [edit_profile_page](views_after_auth_screens_profile_edit_profile_page/views_after_auth_screens_profile_edit_profile_page-library.md) + + + +##### [edit_profile_view_model](view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model-library.md) + + + +##### [edit_task_page](views_after_auth_screens_tasks_edit_task_page/views_after_auth_screens_tasks_edit_task_page-library.md) + + + +##### [enums](enums_enums/enums_enums-library.md) + + + +##### [event_calendar](views_after_auth_screens_events_event_calendar/views_after_auth_screens_events_event_calendar-library.md) + + + +##### [event_card](widgets_event_card/widgets_event_card-library.md) + + + +##### [event_card_view_model](view_model_widgets_view_models_event_card_view_model/view_model_widgets_view_models_event_card_view_model-library.md) + + + +##### [event_chats](views_after_auth_screens_chat_event_chats/views_after_auth_screens_chat_event_chats-library.md) + + + +##### [event_date_time_tile](widgets_event_date_time_tile/widgets_event_date_time_tile-library.md) + + + +##### [event_info_body](views_after_auth_screens_events_event_info_body/views_after_auth_screens_events_event_info_body-library.md) + + + +##### [event_info_page](views_after_auth_screens_events_event_info_page/views_after_auth_screens_events_event_info_page-library.md) + + + +##### [event_info_view_model](view_model_after_auth_view_models_event_view_models_event_info_view_model/view_model_after_auth_view_models_event_view_models_event_info_view_model-library.md) + + + +##### [event_model](models_events_event_model/models_events_event_model-library.md) + + + +##### [event_queries](utils_event_queries/utils_event_queries-library.md) + + + +##### [event_search_delegate](widgets_event_search_delegate/widgets_event_search_delegate-library.md) + + + +##### [event_service](services_event_service/services_event_service-library.md) + + + +##### [event_tasks_page](views_after_auth_screens_tasks_event_tasks_page/views_after_auth_screens_tasks_event_tasks_page-library.md) + + + +##### [events_demo_data](demo_server_data_events_demo_data/demo_server_data_events_demo_data-library.md) + + + +##### [explore_event_dialogue](views_after_auth_screens_events_explore_event_dialogue/views_after_auth_screens_events_explore_event_dialogue-library.md) + + + +##### [explore_events](views_after_auth_screens_events_explore_events/views_after_auth_screens_events_explore_events-library.md) + + + +##### [explore_events_view_model](view_model_after_auth_view_models_event_view_models_explore_events_view_model/view_model_after_auth_view_models_event_view_models_explore_events_view_model-library.md) + + + +##### [explore_tasks_view_model](view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model-library.md) + + + +##### [fetch_plugin_list](plugins_fetch_plugin_list/plugins_fetch_plugin_list-library.md) + + + +##### [firebase_options](firebase_options/firebase_options-library.md) + + + +##### [from_palisadoes](widgets_from_palisadoes/widgets_from_palisadoes-library.md) + + + +##### [generated_plugin_registrant](generated_plugin_registrant/generated_plugin_registrant-library.md) + + + +##### [graphql_config](services_graphql_config/services_graphql_config-library.md) + + + +##### [individual_post](views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md) + + + +##### [invite_child](widgets_invite_child/widgets_invite_child-library.md) + + + +##### [join_organisation_after_auth](views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth-library.md) + + + +##### [lang_switch](widgets_lang_switch/widgets_lang_switch-library.md) + + + +##### [lang_view_model](view_model_lang_view_model/view_model_lang_view_model-library.md) + + + +##### [language_icon](custom_painters_language_icon/custom_painters_language_icon-library.md) + + + +##### [language_model](models_language_language_model/models_language_language_model-library.md) + + + +##### [like_button_view_model](view_model_widgets_view_models_like_button_view_model/view_model_widgets_view_models_like_button_view_model-library.md) + + + +##### [locator](locator/locator-library.md) + + + +##### [login](views_pre_auth_screens_login/views_pre_auth_screens_login-library.md) + + + +##### [login_view_model](view_model_pre_auth_view_models_login_view_model/view_model_pre_auth_view_models_login_view_model-library.md) + + + +##### [main](main/main-library.md) + + + +##### [main_screen](views_main_screen/views_main_screen-library.md) + + + +##### [main_screen_view_model](view_model_main_screen_view_model/view_model_main_screen_view_model-library.md) + + + +##### [mainscreen_navigation_args](models_mainscreen_navigation_args/models_mainscreen_navigation_args-library.md) + + + +##### [map_screen](views_after_auth_screens_venue_map_screen/views_after_auth_screens_venue_map_screen-library.md) + + + +##### [member_name_tile](widgets_member_name_tile/widgets_member_name_tile-library.md) + + + +##### [multi_media_pick_service](services_third_party_service_multi_media_pick_service/services_third_party_service_multi_media_pick_service-library.md) + + + +##### [navigation_service](services_navigation_service/services_navigation_service-library.md) + + + +##### [options](models_options_options/models_options_options-library.md) + + + +##### [org_info](models_organization_org_info/models_organization_org_info-library.md) + + + +##### [org_service](services_org_service/services_org_service-library.md) + + + +##### [organization_feed](views_after_auth_screens_feed_organization_feed/views_after_auth_screens_feed_organization_feed-library.md) + + + +##### [organization_feed_view_model](view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model-library.md) + + + +##### [organization_list](widgets_organization_list/widgets_organization_list-library.md) + + + +##### [organization_search_list](widgets_organization_search_list/widgets_organization_search_list-library.md) + + + +##### [pinned_carousel_widget](widgets_pinned_carousel_widget/widgets_pinned_carousel_widget-library.md) + + + +##### [pinned_post_demo_data](demo_server_data_pinned_post_demo_data/demo_server_data_pinned_post_demo_data-library.md) + + + +##### [pinned_post_page](views_after_auth_screens_feed_pinned_post_page/views_after_auth_screens_feed_pinned_post_page-library.md) + + + +##### [post_demo_data](demo_server_data_post_demo_data/demo_server_data_post_demo_data-library.md) + + + +##### [post_detailed_page](widgets_post_detailed_page/widgets_post_detailed_page-library.md) + + + +##### [post_list_widget](widgets_post_list_widget/widgets_post_list_widget-library.md) + + + +##### [post_model](models_post_post_model/models_post_post_model-library.md) + + + +##### [post_queries](utils_post_queries/utils_post_queries-library.md) + + + +##### [post_service](services_post_service/services_post_service-library.md) + + + +##### [post_widget](widgets_post_widget/widgets_post_widget-library.md) + + + +##### [profile_page](views_after_auth_screens_profile_profile_page/views_after_auth_screens_profile_profile_page-library.md) + + + +##### [profile_page_view_model](view_model_after_auth_view_models_profile_view_models_profile_page_view_model/view_model_after_auth_view_models_profile_view_models_profile_page_view_model-library.md) + + + +##### [progress_dialog_view_model](view_model_widgets_view_models_progress_dialog_view_model/view_model_widgets_view_models_progress_dialog_view_model-library.md) + + + +##### [queries](utils_queries/utils_queries-library.md) + + + +##### [quick_actions](constants_quick_actions/constants_quick_actions-library.md) + + + +##### [raised_round_edge_button](widgets_raised_round_edge_button/widgets_raised_round_edge_button-library.md) + + + +##### [recover](views_pre_auth_screens_recover/views_pre_auth_screens_recover-library.md) + + + +##### [rich_text](widgets_rich_text/widgets_rich_text-library.md) + + + +##### [router](router/router-library.md) + + + +##### [routing_constants](constants_routing_constants/constants_routing_constants-library.md) + + + +##### [select_contact](views_after_auth_screens_chat_select_contact/views_after_auth_screens_chat_select_contact-library.md) + + + +##### [select_contact_view_model](view_model_after_auth_view_models_chat_view_models_select_contact_view_model/view_model_after_auth_view_models_chat_view_models_select_contact_view_model-library.md) + + + +##### [select_language](views_pre_auth_screens_select_language/views_pre_auth_screens_select_language-library.md) + + + +##### [select_organization](views_pre_auth_screens_select_organization/views_pre_auth_screens_select_organization-library.md) + + + +##### [select_organization_view_model](view_model_pre_auth_view_models_select_organization_view_model/view_model_pre_auth_view_models_select_organization_view_model-library.md) + + + +##### [set_url](views_pre_auth_screens_set_url/views_pre_auth_screens_set_url-library.md) + + + +##### [set_url_view_model](view_model_pre_auth_view_models_set_url_view_model/view_model_pre_auth_view_models_set_url_view_model-library.md) + + + +##### [signup_details](views_pre_auth_screens_signup_details/views_pre_auth_screens_signup_details-library.md) + + + +##### [signup_details_view_model](view_model_pre_auth_view_models_signup_details_view_model/view_model_pre_auth_view_models_signup_details_view_model-library.md) + + + +##### [signup_progress_indicator](widgets_signup_progress_indicator/widgets_signup_progress_indicator-library.md) + + + +##### [size_config](services_size_config/services_size_config-library.md) + + + +##### [splash_screen](splash_screen/splash_screen-library.md) + + + +##### [talawa_error_dialog](widgets_talawa_error_dialog/widgets_talawa_error_dialog-library.md) + + + +##### [talawa_error_snackbar](widgets_talawa_error_snackbar/widgets_talawa_error_snackbar-library.md) + + + +##### [talawa_logo](custom_painters_talawa_logo/custom_painters_talawa_logo-library.md) + + + +##### [talawa_plugin_provider](plugins_talawa_plugin_provider/plugins_talawa_plugin_provider-library.md) + + + +##### [task_form](widgets_task_form/widgets_task_form-library.md) + + + +##### [task_model](models_task_task_model/models_task_task_model-library.md) + + + +##### [task_queries](utils_task_queries/utils_task_queries-library.md) + + + +##### [task_schedule](widgets_task_schedule/widgets_task_schedule-library.md) + + + +##### [task_service](services_task_service/services_task_service-library.md) + + + +##### [telegram_logo](custom_painters_telegram_logo/custom_painters_telegram_logo-library.md) + + + +##### [theme_switch](widgets_theme_switch/widgets_theme_switch-library.md) + + + +##### [theme_view_model](view_model_theme_view_model/view_model_theme_view_model-library.md) + + + +##### [timeout](constants_timeout/constants_timeout-library.md) + + + +##### [user_config](services_user_config/services_user_config-library.md) + + + +##### [user_info](models_user_user_info/models_user_user_info-library.md) + + + +##### [user_tasks_page](views_after_auth_screens_tasks_user_tasks_page/views_after_auth_screens_tasks_user_tasks_page-library.md) + + + +##### [validators](utils_validators/utils_validators-library.md) + + + +##### [video_widget](widgets_video_widget/widgets_video_widget-library.md) + + + +##### [waiting_to_join_private_org](views_pre_auth_screens_waiting_to_join_private_org/views_pre_auth_screens_waiting_to_join_private_org-library.md) + + + +##### [waiting_view_model](view_model_pre_auth_view_models_waiting_view_model/view_model_pre_auth_view_models_waiting_view_model-library.md) + + + +##### [whatsapp_logo](custom_painters_whatsapp_logo/custom_painters_whatsapp_logo-library.md) + + + + + + + + + diff --git a/talawa-mobile-docs/locator/connectivity.md b/talawa-mobile-docs/locator/connectivity.md new file mode 100644 index 000000000..07e3320df --- /dev/null +++ b/talawa-mobile-docs/locator/connectivity.md @@ -0,0 +1,36 @@ + + + +# connectivity top-level property + + + + + + + + + +[Connectivity](https://pub.dev/documentation/connectivity_plus/4.0.2/connectivity_plus/Connectivity-class.html) connectivity + +_final_ + + + +

creating GetIt for Connectivity.

+ + + +## Implementation + +```dart +final connectivity = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/databaseFunctions.md b/talawa-mobile-docs/locator/databaseFunctions.md new file mode 100644 index 000000000..0c16f0a36 --- /dev/null +++ b/talawa-mobile-docs/locator/databaseFunctions.md @@ -0,0 +1,36 @@ + + + +# databaseFunctions top-level property + + + + + + + + + +[DataBaseMutationFunctions](../services_database_mutation_functions/DataBaseMutationFunctions-class.md) databaseFunctions + +_final_ + + + +

creating GetIt for DataBaseMutationFunctions.

+ + + +## Implementation + +```dart +final databaseFunctions = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/graphqlConfig.md b/talawa-mobile-docs/locator/graphqlConfig.md new file mode 100644 index 000000000..68ae14fd6 --- /dev/null +++ b/talawa-mobile-docs/locator/graphqlConfig.md @@ -0,0 +1,36 @@ + + + +# graphqlConfig top-level property + + + + + + + + + +[GraphqlConfig](../services_graphql_config/GraphqlConfig-class.md) graphqlConfig + +_final_ + + + +

creating GetIt for GraphqlConfig.

+ + + +## Implementation + +```dart +final graphqlConfig = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/imageCropper.md b/talawa-mobile-docs/locator/imageCropper.md new file mode 100644 index 000000000..19e98b7bf --- /dev/null +++ b/talawa-mobile-docs/locator/imageCropper.md @@ -0,0 +1,36 @@ + + + +# imageCropper top-level property + + + + + + + + + +[ImageCropper](https://pub.dev/documentation/image_cropper/4.0.1/image_cropper/ImageCropper-class.html) imageCropper + +_final_ + + + +

creating GetIt for ImageCropper.

+ + + +## Implementation + +```dart +final imageCropper = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/imagePicker.md b/talawa-mobile-docs/locator/imagePicker.md new file mode 100644 index 000000000..a2c8b70a0 --- /dev/null +++ b/talawa-mobile-docs/locator/imagePicker.md @@ -0,0 +1,36 @@ + + + +# imagePicker top-level property + + + + + + + + + +[ImagePicker](https://pub.dev/documentation/image_picker/1.0.2/image_picker/ImagePicker-class.html) imagePicker + +_final_ + + + +

creating GetIt for ImagePicker.

+ + + +## Implementation + +```dart +final imagePicker = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/locator-library.md b/talawa-mobile-docs/locator/locator-library.md new file mode 100644 index 000000000..0df1b4e88 --- /dev/null +++ b/talawa-mobile-docs/locator/locator-library.md @@ -0,0 +1,141 @@ + + + + +# locator library + + + + + + + + + + + + + + + +## Properties + +##### [connectivity](../locator/connectivity.md) → [Connectivity](https://pub.dev/documentation/connectivity_plus/4.0.2/connectivity_plus/Connectivity-class.html) + + + +creating GetIt for Connectivity. +_final_ + + + +##### [databaseFunctions](../locator/databaseFunctions.md) → [DataBaseMutationFunctions](../services_database_mutation_functions/DataBaseMutationFunctions-class.md) + + + +creating GetIt for DataBaseMutationFunctions. +_final_ + + + +##### [graphqlConfig](../locator/graphqlConfig.md) → [GraphqlConfig](../services_graphql_config/GraphqlConfig-class.md) + + + +creating GetIt for GraphqlConfig. +_final_ + + + +##### [imageCropper](../locator/imageCropper.md) → [ImageCropper](https://pub.dev/documentation/image_cropper/4.0.1/image_cropper/ImageCropper-class.html) + + + +creating GetIt for ImageCropper. +_final_ + + + +##### [imagePicker](../locator/imagePicker.md) → [ImagePicker](https://pub.dev/documentation/image_picker/1.0.2/image_picker/ImagePicker-class.html) + + + +creating GetIt for ImagePicker. +_final_ + + + +##### [locator](../locator/locator.md) ↔ [GetIt](https://pub.dev/documentation/get_it/7.6.0/get_it/GetIt-class.html) + + + +Intializaing the locator. +_read / write_ + + + +##### [navigationService](../locator/navigationService.md) → [NavigationService](../services_navigation_service/NavigationService-class.md) + + + +creating GetIt for NavigationService. +_final_ + + + +##### [organizationService](../locator/organizationService.md) → [OrganizationService](../services_org_service/OrganizationService-class.md) + + + +creating GetIt for OrganizationService. +_final_ + + + +##### [queries](../locator/queries.md) → [Queries](../utils_queries/Queries-class.md) + + + +creating GetIt for Queries. +_final_ + + + +##### [sizeConfig](../locator/sizeConfig.md) → [SizeConfig](../services_size_config/SizeConfig-class.md) + + + +creating GetIt for SizeConfig. +_final_ + + + +##### [userConfig](../locator/userConfig.md) → [UserConfig](../services_user_config/UserConfig-class.md) + + + +creating GetIt for UserConfig. +_final_ + + + + +## Functions + +##### [setupLocator](../locator/setupLocator.md)() void + + + +This function registers the widgets/objects in "GetIt". + + + + + + + + + + + + diff --git a/talawa-mobile-docs/locator/locator.md b/talawa-mobile-docs/locator/locator.md new file mode 100644 index 000000000..80b1db462 --- /dev/null +++ b/talawa-mobile-docs/locator/locator.md @@ -0,0 +1,36 @@ + + + +# locator top-level property + + + + + + + + + +[GetIt](https://pub.dev/documentation/get_it/7.6.0/get_it/GetIt-class.html) locator + +_read / write_ + + + +

Intializaing the locator.

+ + + +## Implementation + +```dart +GetIt locator = GetIt.instance; +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/navigationService.md b/talawa-mobile-docs/locator/navigationService.md new file mode 100644 index 000000000..2df4db664 --- /dev/null +++ b/talawa-mobile-docs/locator/navigationService.md @@ -0,0 +1,36 @@ + + + +# navigationService top-level property + + + + + + + + + +[NavigationService](../services_navigation_service/NavigationService-class.md) navigationService + +_final_ + + + +

creating GetIt for NavigationService.

+ + + +## Implementation + +```dart +final navigationService = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/organizationService.md b/talawa-mobile-docs/locator/organizationService.md new file mode 100644 index 000000000..2ed728c6b --- /dev/null +++ b/talawa-mobile-docs/locator/organizationService.md @@ -0,0 +1,36 @@ + + + +# organizationService top-level property + + + + + + + + + +[OrganizationService](../services_org_service/OrganizationService-class.md) organizationService + +_final_ + + + +

creating GetIt for OrganizationService.

+ + + +## Implementation + +```dart +final organizationService = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/queries.md b/talawa-mobile-docs/locator/queries.md new file mode 100644 index 000000000..5c95eaf58 --- /dev/null +++ b/talawa-mobile-docs/locator/queries.md @@ -0,0 +1,36 @@ + + + +# queries top-level property + + + + + + + + + +[Queries](../utils_queries/Queries-class.md) queries + +_final_ + + + +

creating GetIt for Queries.

+ + + +## Implementation + +```dart +final queries = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/setupLocator.md b/talawa-mobile-docs/locator/setupLocator.md new file mode 100644 index 000000000..9fc6a16ec --- /dev/null +++ b/talawa-mobile-docs/locator/setupLocator.md @@ -0,0 +1,104 @@ + + + +# setupLocator function + + + + + + + + + + +void setupLocator +() + + + + + +

This function registers the widgets/objects in "GetIt".

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void setupLocator() { + //services + locator.registerSingleton(NavigationService()); + + //sizeConfig + locator.registerSingleton(SizeConfig()); + + locator.registerSingleton(Validator()); + + //userConfig + locator.registerSingleton(UserConfig()); + + //Services + locator.registerLazySingleton(() => PostService()); + locator.registerLazySingleton(() => EventService()); + locator.registerLazySingleton(() => TaskService()); + locator.registerLazySingleton(() => CommentService()); + locator.registerLazySingleton(() => OrganizationService()); + locator.registerLazySingleton(() => MultiMediaPickerService()); + locator.registerLazySingleton(() => Connectivity()); + locator.registerLazySingleton(() => ChatService()); + locator.registerLazySingleton(() => ImageCropper()); + locator.registerLazySingleton(() => ImagePicker()); + + //graphql + locator.registerSingleton(GraphqlConfig()); + + //databaseMutationFunction + locator.registerSingleton(DataBaseMutationFunctions()); + + //queries + locator.registerSingleton(Queries()); + + //Page viewModels + locator.registerFactory(() => DemoViewModel()); + // locator.registerFactory(() => OrganizationFeedViewModel()); + locator.registerFactory(() => OrganizationFeedViewModel()); + locator.registerFactory(() => SetUrlViewModel()); + locator.registerFactory(() => LoginViewModel()); + + locator.registerFactory(() => SelectOrganizationViewModel()); + locator.registerFactory(() => SignupDetailsViewModel()); + locator.registerFactory(() => WaitingViewModel()); + locator.registerFactory(() => ExploreEventsViewModel()); + locator.registerFactory(() => ExploreTasksViewModel()); + locator.registerFactory(() => CreateTaskViewModel()); + locator.registerFactory(() => MainScreenViewModel()); + locator.registerFactory(() => ProfilePageViewModel()); + locator.registerFactory(() => EditProfilePageViewModel()); + locator.registerFactory(() => CreateEventViewModel()); + locator.registerFactory(() => EditEventViewModel()); + locator.registerFactory(() => AddPostViewModel()); + locator.registerFactory(() => EventInfoViewModel()); + + //Widgets viewModels + locator.registerFactory(() => ProgressDialogViewModel()); + locator.registerFactory(() => CustomDrawerViewModel()); + locator.registerFactory(() => LikeButtonViewModel()); + locator.registerFactory(() => AppLanguage()); + locator.registerFactory(() => CommentsViewModel()); + locator.registerFactory(() => AppTheme()); + locator.registerFactory(() => DirectChatViewModel()); + locator.registerFactory(() => AccessScreenViewModel()); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/locator/sizeConfig.md b/talawa-mobile-docs/locator/sizeConfig.md new file mode 100644 index 000000000..413c9f786 --- /dev/null +++ b/talawa-mobile-docs/locator/sizeConfig.md @@ -0,0 +1,36 @@ + + + +# sizeConfig top-level property + + + + + + + + + +[SizeConfig](../services_size_config/SizeConfig-class.md) sizeConfig + +_final_ + + + +

creating GetIt for SizeConfig.

+ + + +## Implementation + +```dart +final sizeConfig = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/locator/userConfig.md b/talawa-mobile-docs/locator/userConfig.md new file mode 100644 index 000000000..cb96aca54 --- /dev/null +++ b/talawa-mobile-docs/locator/userConfig.md @@ -0,0 +1,36 @@ + + + +# userConfig top-level property + + + + + + + + + +[UserConfig](../services_user_config/UserConfig-class.md) userConfig + +_final_ + + + +

creating GetIt for UserConfig.

+ + + +## Implementation + +```dart +final userConfig = locator(); +``` + + + + + + + + diff --git a/talawa-mobile-docs/main/DemoPageView-class.md b/talawa-mobile-docs/main/DemoPageView-class.md new file mode 100644 index 000000000..08b2e0d15 --- /dev/null +++ b/talawa-mobile-docs/main/DemoPageView-class.md @@ -0,0 +1,190 @@ + + + +# DemoPageView class + + + + + + + + + +

PageView is a scrollable list that works page by page.

+

DemoPageView is demo PageView of Talawa Mobile App.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- DemoPageView + + + + + + + + +## Constructors + +[DemoPageView](../main/DemoPageView/DemoPageView.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../main/DemoPageView/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/main/DemoPageView/DemoPageView.md b/talawa-mobile-docs/main/DemoPageView/DemoPageView.md new file mode 100644 index 000000000..dbddcb13a --- /dev/null +++ b/talawa-mobile-docs/main/DemoPageView/DemoPageView.md @@ -0,0 +1,29 @@ + + + +# DemoPageView constructor + + + + + + +const +DemoPageView({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + + + + +## Implementation + +```dart +const DemoPageView({required Key key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/main/DemoPageView/build.md b/talawa-mobile-docs/main/DemoPageView/build.md new file mode 100644 index 000000000..9fd20f775 --- /dev/null +++ b/talawa-mobile-docs/main/DemoPageView/build.md @@ -0,0 +1,82 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + FetchPluginList(); + return BaseView( + builder: (context, model, child) => Scaffold( + appBar: AppBar( + title: + Text(AppLocalizations.of(context)!.strictTranslate('Demo Page')), + ), + body: Container( + child: Text(model.title), + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/main/DemoViewModel-class.md b/talawa-mobile-docs/main/DemoViewModel-class.md new file mode 100644 index 000000000..3c395e0ad --- /dev/null +++ b/talawa-mobile-docs/main/DemoViewModel-class.md @@ -0,0 +1,191 @@ + + + +# DemoViewModel class + + + + + + + + + +

ViewModel uses property-based data binding to establish a connection.

+

between the ViewModel and the View, and drives the View changes +through the ViewModel. DemoViewModel is the ViewModel for DemoPageView.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- DemoViewModel + + + + + + + + +## Constructors + +[DemoViewModel](../main/DemoViewModel/DemoViewModel.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [title](../main/DemoViewModel/title.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Getter function of the title. +_read-only_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/main/DemoViewModel/DemoViewModel.md b/talawa-mobile-docs/main/DemoViewModel/DemoViewModel.md new file mode 100644 index 000000000..1295f2c65 --- /dev/null +++ b/talawa-mobile-docs/main/DemoViewModel/DemoViewModel.md @@ -0,0 +1,24 @@ + + + +# DemoViewModel constructor + + + + + + + +DemoViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/main/DemoViewModel/title.md b/talawa-mobile-docs/main/DemoViewModel/title.md new file mode 100644 index 000000000..0e5577801 --- /dev/null +++ b/talawa-mobile-docs/main/DemoViewModel/title.md @@ -0,0 +1,42 @@ + + + +# title property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) title + + + + + +

Getter function of the title.

+

params: +None +returns:

+
    +
  • String: title of the model
  • +
+ + + +## Implementation + +```dart +String get title => _title; +``` + + + + + + + + diff --git a/talawa-mobile-docs/main/MyApp-class.md b/talawa-mobile-docs/main/MyApp-class.md new file mode 100644 index 000000000..c76b3c6a3 --- /dev/null +++ b/talawa-mobile-docs/main/MyApp-class.md @@ -0,0 +1,189 @@ + + + +# MyApp class + + + + + + + + + +

Main widget that sets up the quick actions, internationalization, routing , notifications.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- MyApp + + + + + + + + +## Constructors + +[MyApp](../main/MyApp/MyApp.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../main/MyApp/createState.md)() _MyAppState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/main/MyApp/MyApp.md b/talawa-mobile-docs/main/MyApp/MyApp.md new file mode 100644 index 000000000..d0bf0fead --- /dev/null +++ b/talawa-mobile-docs/main/MyApp/MyApp.md @@ -0,0 +1,24 @@ + + + +# MyApp constructor + + + + + + + +MyApp() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/main/MyApp/createState.md b/talawa-mobile-docs/main/MyApp/createState.md new file mode 100644 index 000000000..b001fadad --- /dev/null +++ b/talawa-mobile-docs/main/MyApp/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_MyAppState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_MyAppState createState() => _MyAppState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/main/androidFirebaseOptions.md b/talawa-mobile-docs/main/androidFirebaseOptions.md new file mode 100644 index 000000000..268b1a3b4 --- /dev/null +++ b/talawa-mobile-docs/main/androidFirebaseOptions.md @@ -0,0 +1,36 @@ + + + +# androidFirebaseOptions top-level property + + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> androidFirebaseOptions + +_read / write_ + + + +

HashMap of Firebase options for android.

+ + + +## Implementation + +```dart +late Map androidFirebaseOptions; +``` + + + + + + + + diff --git a/talawa-mobile-docs/main/channel.md b/talawa-mobile-docs/main/channel.md new file mode 100644 index 000000000..5f4cada3f --- /dev/null +++ b/talawa-mobile-docs/main/channel.md @@ -0,0 +1,36 @@ + + + +# channel top-level property + + + + + + + + + +[AndroidNotificationChannel](https://pub.dev/documentation/flutter_local_notifications/15.1.0+1/flutter_local_notifications/AndroidNotificationChannel-class.html) channel + +_read / write_ + + + +

Create a AndroidNotificationChannel for heads up notifications.

+ + + +## Implementation + +```dart +late AndroidNotificationChannel channel; +``` + + + + + + + + diff --git a/talawa-mobile-docs/main/flutterLocalNotificationsPlugin.md b/talawa-mobile-docs/main/flutterLocalNotificationsPlugin.md new file mode 100644 index 000000000..fb311aba4 --- /dev/null +++ b/talawa-mobile-docs/main/flutterLocalNotificationsPlugin.md @@ -0,0 +1,36 @@ + + + +# flutterLocalNotificationsPlugin top-level property + + + + + + + + + +[FlutterLocalNotificationsPlugin](https://pub.dev/documentation/flutter_local_notifications/15.1.0+1/flutter_local_notifications/FlutterLocalNotificationsPlugin-class.html) flutterLocalNotificationsPlugin + +_read / write_ + + + +

Initialize the FlutterLocalNotificationsPlugin package.

+ + + +## Implementation + +```dart +late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; +``` + + + + + + + + diff --git a/talawa-mobile-docs/main/iosFirebaseOptions.md b/talawa-mobile-docs/main/iosFirebaseOptions.md new file mode 100644 index 000000000..a92e5f8da --- /dev/null +++ b/talawa-mobile-docs/main/iosFirebaseOptions.md @@ -0,0 +1,36 @@ + + + +# iosFirebaseOptions top-level property + + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> iosFirebaseOptions + +_read / write_ + + + +

HashMap of Firebase options for android.

+ + + +## Implementation + +```dart +late Map iosFirebaseOptions; +``` + + + + + + + + diff --git a/talawa-mobile-docs/main/main-library.md b/talawa-mobile-docs/main/main-library.md new file mode 100644 index 000000000..1041a7965 --- /dev/null +++ b/talawa-mobile-docs/main/main-library.md @@ -0,0 +1,128 @@ + + + + +# main library + + + + + + + + + + + +## Classes + +##### [DemoPageView](../main/DemoPageView-class.md) + + + +PageView is a scrollable list that works page by page. + + +##### [DemoViewModel](../main/DemoViewModel-class.md) + + + +ViewModel uses property-based data binding to establish a connection. + + +##### [MyApp](../main/MyApp-class.md) + + + +Main widget that sets up the quick actions, internationalization, routing , notifications. + + + + + + +## Properties + +##### [androidFirebaseOptions](../main/androidFirebaseOptions.md) ↔ [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> + + + +HashMap of Firebase options for android. +_read / write_ + + + +##### [channel](../main/channel.md) ↔ [AndroidNotificationChannel](https://pub.dev/documentation/flutter_local_notifications/15.1.0+1/flutter_local_notifications/AndroidNotificationChannel-class.html) + + + +Create a AndroidNotificationChannel for heads up notifications. +_read / write_ + + + +##### [flutterLocalNotificationsPlugin](../main/flutterLocalNotificationsPlugin.md) ↔ [FlutterLocalNotificationsPlugin](https://pub.dev/documentation/flutter_local_notifications/15.1.0+1/flutter_local_notifications/FlutterLocalNotificationsPlugin-class.html) + + + +Initialize the FlutterLocalNotificationsPlugin package. +_read / write_ + + + +##### [iosFirebaseOptions](../main/iosFirebaseOptions.md) ↔ [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> + + + +HashMap of Firebase options for android. +_read / write_ + + + + +## Functions + +##### [main](../main/main.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +First function to initialize the application, invoked automatically. + + + + +##### [setUpFirebase](../main/setUpFirebase.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +Initializes the firebase in the app according to the userplatform (android/iOS). + + + + +##### [setUpFirebaseKeys](../main/setUpFirebaseKeys.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +Initializes the firebase keys in the app according to the userplatform (android/iOS). + + + + +##### [setUpFirebaseMessaging](../main/setUpFirebaseMessaging.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +Set up firebase instance, enbables messaging,listens to icoming messages. + + + + + + + + + + + + diff --git a/talawa-mobile-docs/main/main.md b/talawa-mobile-docs/main/main.md new file mode 100644 index 000000000..457242910 --- /dev/null +++ b/talawa-mobile-docs/main/main.md @@ -0,0 +1,95 @@ + + + +# main function + + + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> main +() + + + + + +

First function to initialize the application, invoked automatically.

+

params: + None

+

returns:

+
    +
  • Future<void>: resolves if the application was successfully initialized.
  • +
+ + + +## Implementation + +```dart +Future main() async { + // Returns an instance of the binding that implements WidgetsBinding. + WidgetsFlutterBinding.ensureInitialized(); + + if (!kIsWeb) { + channel = const AndroidNotificationChannel( + 'high_importance_channel', // id + 'High Importance Notifications', // title + description: + 'This channel is used for important notifications.', // description + importance: Importance.high, + ); + + flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); + + // Create an Android Notification Channel. + // We use this channel in the `AndroidManifest.xml` file to override the + // default FCM channel to enable heads up notifications. + await flutterLocalNotificationsPlugin + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin>() + ?.createNotificationChannel(channel); + } + + final Directory dir = await path.getApplicationDocumentsDirectory(); + Hive + ..init(dir.path) + ..registerAdapter(UserAdapter()) + ..registerAdapter(OrgInfoAdapter()); + + await Hive.openBox('currentUser'); + await Hive.openBox('currentOrg'); + + await Hive.openBox('pluginBox'); + await Hive.openBox('url'); + + final urlBox = await Hive.openBox('url'); + + try { + if (urlBox.get('url') != null) { + await setUpFirebaseKeys(); + + await setUpFirebase(); + await setUpFirebaseMessaging(); + } + } catch (e) { + print("Firebase not working"); + } + + setupLocator(); + // The runApp() function takes the given Widget and makes it the root of the widget tree. + runApp(MyApp()); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/main/setUpFirebase.md b/talawa-mobile-docs/main/setUpFirebase.md new file mode 100644 index 000000000..91557e294 --- /dev/null +++ b/talawa-mobile-docs/main/setUpFirebase.md @@ -0,0 +1,50 @@ + + + +# setUpFirebase function + + + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> setUpFirebase +() + + + + + +

Initializes the firebase in the app according to the userplatform (android/iOS).

+

params: + None

+

returns:

+
    +
  • Future<void>: promise that will be fulfilled Firebase is setted up in app.
  • +
+ + + +## Implementation + +```dart +Future setUpFirebase() async { + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform( + androidFirebaseOptions, + iosFirebaseOptions, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/main/setUpFirebaseKeys.md b/talawa-mobile-docs/main/setUpFirebaseKeys.md new file mode 100644 index 000000000..ca716d0d6 --- /dev/null +++ b/talawa-mobile-docs/main/setUpFirebaseKeys.md @@ -0,0 +1,62 @@ + + + +# setUpFirebaseKeys function + + + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> setUpFirebaseKeys +() + + + + + +

Initializes the firebase keys in the app according to the userplatform (android/iOS).

+

params: + None

+

returns:

+
    +
  • Future<void>: promise that will be fulfilled Firebase keys are setted up.
  • +
+ + + +## Implementation + +```dart +Future setUpFirebaseKeys() async { + final androidFirebaseOptionsBox = + await Hive.openBox('androidFirebaseOptions'); + final androidFirebaseOptionsMap = androidFirebaseOptionsBox + .get('androidFirebaseOptions') as Map?; + + final iosFirebaseOptionsBox = await Hive.openBox('iosFirebaseOptions'); + final iosFirebaseOptionsMap = + iosFirebaseOptionsBox.get('iosFirebaseOptions') as Map?; + if (androidFirebaseOptionsMap != null) { + androidFirebaseOptions = androidFirebaseOptionsMap.map((key, value) { + return MapEntry(key.toString(), value); + }); + } + if (iosFirebaseOptionsMap != null) { + iosFirebaseOptions = iosFirebaseOptionsMap.map((key, value) { + return MapEntry(key.toString(), value); + }); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/main/setUpFirebaseMessaging.md b/talawa-mobile-docs/main/setUpFirebaseMessaging.md new file mode 100644 index 000000000..d28c01b84 --- /dev/null +++ b/talawa-mobile-docs/main/setUpFirebaseMessaging.md @@ -0,0 +1,79 @@ + + + +# setUpFirebaseMessaging function + + + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> setUpFirebaseMessaging +() + + + + + +

Set up firebase instance, enbables messaging,listens to icoming messages.

+

params: + None

+

returns:

+
    +
  • Future<void>: promise that will be fulfilled Firebase is setted up.
  • +
+ + + +## Implementation + +```dart +Future setUpFirebaseMessaging() async { + /// Set the background messaging handler early on, as a named top-level function + FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); + + // Update the iOS foreground notification presentation options to allow heads up notifications. + await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( + alert: true, + badge: true, + sound: true, + ); + + FirebaseMessaging.instance + .getInitialMessage() + .then((RemoteMessage? message) {}); + + FirebaseMessaging.onMessage.listen((RemoteMessage message) { + final RemoteNotification? notification = message.notification; + final AndroidNotification? android = message.notification?.android; + if (notification != null && android != null && !kIsWeb) { + flutterLocalNotificationsPlugin.show( + notification.hashCode, + notification.title, + notification.body, + NotificationDetails( + android: AndroidNotificationDetails( + channel.id, + channel.name, + channelDescription: channel.description, + icon: 'launch_background', + ), + ), + ); + } + }); + + FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {}); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md new file mode 100644 index 000000000..7a107b767 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md @@ -0,0 +1,133 @@ + + + +# ChatListTileDataModel class + + + + + + + + + +

This class creates JSON code using the JsonSerializable package.

+ + + + + + + + + +**Annotations** + +- @[JsonSerializable](https://pub.dev/documentation/json_annotation/4.8.1/json_annotation/JsonSerializable-class.html)() + + +## Constructors + +[ChatListTileDataModel](../models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.md) ([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatUser](../models_chats_chat_user/ChatUser-class.md)>? users, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id) + + + +[ChatListTileDataModel.fromJson](../models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + _factory_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [id](../models_chats_chat_list_tile_data_model/ChatListTileDataModel/id.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [users](../models_chats_chat_list_tile_data_model/ChatListTileDataModel/users.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatUser](../models_chats_chat_user/ChatUser-class.md)>? + + + + +_read / write_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toJson](../models_chats_chat_list_tile_data_model/ChatListTileDataModel/toJson.md)() [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.fromJson.md b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.fromJson.md new file mode 100644 index 000000000..c969f9259 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.fromJson.md @@ -0,0 +1,30 @@ + + + +# ChatListTileDataModel.fromJson constructor + + + + + + + +ChatListTileDataModel.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + + + + +## Implementation + +```dart +factory ChatListTileDataModel.fromJson(Map json) => + _$ChatListTileDataModelFromJson(json); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.md b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.md new file mode 100644 index 000000000..ee3832b37 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/ChatListTileDataModel.md @@ -0,0 +1,29 @@ + + + +# ChatListTileDataModel constructor + + + + + + + +ChatListTileDataModel([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatUser](../../models_chats_chat_user/ChatUser-class.md)>? users, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id) + + + + + +## Implementation + +```dart +ChatListTileDataModel(this.users, this.id); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/id.md b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/id.md new file mode 100644 index 000000000..833ed271b --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/id.md @@ -0,0 +1,32 @@ + + + +# id property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id + +_read / write_ + + + + + + +## Implementation + +```dart +String? id; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/toJson.md b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/toJson.md new file mode 100644 index 000000000..8b766cc4e --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/toJson.md @@ -0,0 +1,34 @@ + + + +# toJson method + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> toJson +() + + + + + + + + +## Implementation + +```dart +Map toJson() => _$ChatListTileDataModelToJson(this); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/users.md b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/users.md new file mode 100644 index 000000000..58ed251cb --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/ChatListTileDataModel/users.md @@ -0,0 +1,32 @@ + + + +# users property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatUser](../../models_chats_chat_user/ChatUser-class.md)>? users + +_read / write_ + + + + + + +## Implementation + +```dart +List? users; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_list_tile_data_model/models_chats_chat_list_tile_data_model-library.md b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/models_chats_chat_list_tile_data_model-library.md new file mode 100644 index 000000000..796cc4e88 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_list_tile_data_model/models_chats_chat_list_tile_data_model-library.md @@ -0,0 +1,38 @@ + + + + +# chat_list_tile_data_model library + + + + + + + + + + + +## Classes + +##### [ChatListTileDataModel](../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md) + + + +This class creates JSON code using the JsonSerializable package. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/ChatMessage-class.md b/talawa-mobile-docs/models_chats_chat_message/ChatMessage-class.md new file mode 100644 index 000000000..4c38ab423 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/ChatMessage-class.md @@ -0,0 +1,151 @@ + + + +# ChatMessage class + + + + + + + + + +

This class creates JSON code for chat message using the JsonSerializable package.

+ + + + + + + + + +**Annotations** + +- @[JsonSerializable](https://pub.dev/documentation/json_annotation/4.8.1/json_annotation/JsonSerializable-class.html)(explicitToJson: true) + + +## Constructors + +[ChatMessage](../models_chats_chat_message/ChatMessage/ChatMessage.md) ([String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [ChatUser](../models_chats_chat_user/ChatUser-class.md)? sender, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? messageContent, [ChatUser](../models_chats_chat_user/ChatUser-class.md)? receiver) + + + +[ChatMessage.fromJson](../models_chats_chat_message/ChatMessage/ChatMessage.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + _factory_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [id](../models_chats_chat_message/ChatMessage/id.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [messageContent](../models_chats_chat_message/ChatMessage/messageContent.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [receiver](../models_chats_chat_message/ChatMessage/receiver.md) ↔ [ChatUser](../models_chats_chat_user/ChatUser-class.md)? + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [sender](../models_chats_chat_message/ChatMessage/sender.md) ↔ [ChatUser](../models_chats_chat_user/ChatUser-class.md)? + + + + +_read / write_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toJson](../models_chats_chat_message/ChatMessage/toJson.md)() [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/ChatMessage/ChatMessage.fromJson.md b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/ChatMessage.fromJson.md new file mode 100644 index 000000000..514060af9 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/ChatMessage.fromJson.md @@ -0,0 +1,30 @@ + + + +# ChatMessage.fromJson constructor + + + + + + + +ChatMessage.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + + + + +## Implementation + +```dart +factory ChatMessage.fromJson(Map json) => + _$ChatMessageFromJson(json); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/ChatMessage/ChatMessage.md b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/ChatMessage.md new file mode 100644 index 000000000..78e85c05d --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/ChatMessage.md @@ -0,0 +1,34 @@ + + + +# ChatMessage constructor + + + + + + + +ChatMessage([String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [ChatUser](../../models_chats_chat_user/ChatUser-class.md)? sender, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? messageContent, [ChatUser](../../models_chats_chat_user/ChatUser-class.md)? receiver) + + + + + +## Implementation + +```dart +ChatMessage( + this.id, + this.sender, + this.messageContent, + this.receiver, +); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/ChatMessage/id.md b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/id.md new file mode 100644 index 000000000..833ed271b --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/id.md @@ -0,0 +1,32 @@ + + + +# id property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id + +_read / write_ + + + + + + +## Implementation + +```dart +String? id; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/ChatMessage/messageContent.md b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/messageContent.md new file mode 100644 index 000000000..372a20d7a --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/messageContent.md @@ -0,0 +1,32 @@ + + + +# messageContent property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? messageContent + +_read / write_ + + + + + + +## Implementation + +```dart +String? messageContent; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/ChatMessage/receiver.md b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/receiver.md new file mode 100644 index 000000000..7887b8cf4 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/receiver.md @@ -0,0 +1,32 @@ + + + +# receiver property + + + + + + + +[ChatUser](../../models_chats_chat_user/ChatUser-class.md)? receiver + +_read / write_ + + + + + + +## Implementation + +```dart +ChatUser? receiver; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/ChatMessage/sender.md b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/sender.md new file mode 100644 index 000000000..4b8806efb --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/sender.md @@ -0,0 +1,32 @@ + + + +# sender property + + + + + + + +[ChatUser](../../models_chats_chat_user/ChatUser-class.md)? sender + +_read / write_ + + + + + + +## Implementation + +```dart +ChatUser? sender; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/ChatMessage/toJson.md b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/toJson.md new file mode 100644 index 000000000..0f7c47e94 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/ChatMessage/toJson.md @@ -0,0 +1,34 @@ + + + +# toJson method + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> toJson +() + + + + + + + + +## Implementation + +```dart +Map toJson() => _$ChatMessageToJson(this); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_message/models_chats_chat_message-library.md b/talawa-mobile-docs/models_chats_chat_message/models_chats_chat_message-library.md new file mode 100644 index 000000000..b21336f76 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_message/models_chats_chat_message-library.md @@ -0,0 +1,38 @@ + + + + +# chat_message library + + + + + + + + + + + +## Classes + +##### [ChatMessage](../models_chats_chat_message/ChatMessage-class.md) + + + +This class creates JSON code for chat message using the JsonSerializable package. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_user/ChatUser-class.md b/talawa-mobile-docs/models_chats_chat_user/ChatUser-class.md new file mode 100644 index 000000000..18020e727 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_user/ChatUser-class.md @@ -0,0 +1,142 @@ + + + +# ChatUser class + + + + + + + + + +

This class creates JSON code for chat user using the JsonSerializable package.

+ + + + + + + + + +**Annotations** + +- @[JsonSerializable](https://pub.dev/documentation/json_annotation/4.8.1/json_annotation/JsonSerializable-class.html)() + + +## Constructors + +[ChatUser](../models_chats_chat_user/ChatUser/ChatUser.md) ({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image}) + + + +[ChatUser.fromJson](../models_chats_chat_user/ChatUser/ChatUser.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + _factory_ + + +## Properties + +##### [firstName](../models_chats_chat_user/ChatUser/firstName.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [id](../models_chats_chat_user/ChatUser/id.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [image](../models_chats_chat_user/ChatUser/image.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toJson](../models_chats_chat_user/ChatUser/toJson.md)() [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_user/ChatUser/ChatUser.fromJson.md b/talawa-mobile-docs/models_chats_chat_user/ChatUser/ChatUser.fromJson.md new file mode 100644 index 000000000..4283c825f --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_user/ChatUser/ChatUser.fromJson.md @@ -0,0 +1,30 @@ + + + +# ChatUser.fromJson constructor + + + + + + + +ChatUser.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + + + + +## Implementation + +```dart +factory ChatUser.fromJson(Map json) => + _$ChatUserFromJson(json); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_user/ChatUser/ChatUser.md b/talawa-mobile-docs/models_chats_chat_user/ChatUser/ChatUser.md new file mode 100644 index 000000000..5b6db09b4 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_user/ChatUser/ChatUser.md @@ -0,0 +1,29 @@ + + + +# ChatUser constructor + + + + + + + +ChatUser({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image}) + + + + + +## Implementation + +```dart +ChatUser({this.firstName, this.id, this.image}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_user/ChatUser/firstName.md b/talawa-mobile-docs/models_chats_chat_user/ChatUser/firstName.md new file mode 100644 index 000000000..0fbc84727 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_user/ChatUser/firstName.md @@ -0,0 +1,32 @@ + + + +# firstName property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstName + +_read / write_ + + + + + + +## Implementation + +```dart +String? firstName; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_user/ChatUser/id.md b/talawa-mobile-docs/models_chats_chat_user/ChatUser/id.md new file mode 100644 index 000000000..833ed271b --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_user/ChatUser/id.md @@ -0,0 +1,32 @@ + + + +# id property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id + +_read / write_ + + + + + + +## Implementation + +```dart +String? id; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_user/ChatUser/image.md b/talawa-mobile-docs/models_chats_chat_user/ChatUser/image.md new file mode 100644 index 000000000..db1007542 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_user/ChatUser/image.md @@ -0,0 +1,32 @@ + + + +# image property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image + +_read / write_ + + + + + + +## Implementation + +```dart +String? image; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_user/ChatUser/toJson.md b/talawa-mobile-docs/models_chats_chat_user/ChatUser/toJson.md new file mode 100644 index 000000000..8c0124f88 --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_user/ChatUser/toJson.md @@ -0,0 +1,34 @@ + + + +# toJson method + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> toJson +() + + + + + + + + +## Implementation + +```dart +Map toJson() => _$ChatUserToJson(this); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_chats_chat_user/models_chats_chat_user-library.md b/talawa-mobile-docs/models_chats_chat_user/models_chats_chat_user-library.md new file mode 100644 index 000000000..793e8e89e --- /dev/null +++ b/talawa-mobile-docs/models_chats_chat_user/models_chats_chat_user-library.md @@ -0,0 +1,38 @@ + + + + +# chat_user library + + + + + + + + + + + +## Classes + +##### [ChatUser](../models_chats_chat_user/ChatUser-class.md) + + + +This class creates JSON code for chat user using the JsonSerializable package. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/Comment-class.md b/talawa-mobile-docs/models_comment_comment_model/Comment-class.md new file mode 100644 index 000000000..e00460d30 --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/Comment-class.md @@ -0,0 +1,141 @@ + + + +# Comment class + + + + + + + + + +

This class returns a Comment instance.

+ + + + +## Constructors + +[Comment](../models_comment_comment_model/Comment/Comment.md) ({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? text, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? createdAt, [User](../models_user_user_info/User-class.md)? creator, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? post, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? likeCount}) + + + +[Comment.fromJson](../models_comment_comment_model/Comment/Comment.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + _factory_ + + +## Properties + +##### [createdAt](../models_comment_comment_model/Comment/createdAt.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [creator](../models_comment_comment_model/Comment/creator.md) ↔ [User](../models_user_user_info/User-class.md)? + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [likeCount](../models_comment_comment_model/Comment/likeCount.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [post](../models_comment_comment_model/Comment/post.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [text](../models_comment_comment_model/Comment/text.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/Comment/Comment.fromJson.md b/talawa-mobile-docs/models_comment_comment_model/Comment/Comment.fromJson.md new file mode 100644 index 000000000..15a902170 --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/Comment/Comment.fromJson.md @@ -0,0 +1,43 @@ + + + +# Comment.fromJson constructor + + + + + + + +Comment.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + + + + +## Implementation + +```dart +factory Comment.fromJson(Map json) { + return Comment( + text: json['text'] as String?, + createdAt: json['createdAt'] as String?, + creator: json['creator'] == null + ? null + //Creating a new User instance from a map structure. + : User.fromJson( + json['creator'] as Map, + fromOrg: true, + ), + post: json['post'] as String?, + likeCount: json['likeCount'] as String?, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/Comment/Comment.md b/talawa-mobile-docs/models_comment_comment_model/Comment/Comment.md new file mode 100644 index 000000000..120962bcc --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/Comment/Comment.md @@ -0,0 +1,29 @@ + + + +# Comment constructor + + + + + + + +Comment({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? text, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? createdAt, [User](../../models_user_user_info/User-class.md)? creator, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? post, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? likeCount}) + + + + + +## Implementation + +```dart +Comment({this.text, this.createdAt, this.creator, this.post, this.likeCount}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/Comment/createdAt.md b/talawa-mobile-docs/models_comment_comment_model/Comment/createdAt.md new file mode 100644 index 000000000..6f4a3a12e --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/Comment/createdAt.md @@ -0,0 +1,32 @@ + + + +# createdAt property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? createdAt + +_read / write_ + + + + + + +## Implementation + +```dart +String? createdAt; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/Comment/creator.md b/talawa-mobile-docs/models_comment_comment_model/Comment/creator.md new file mode 100644 index 000000000..8dcdc334b --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/Comment/creator.md @@ -0,0 +1,32 @@ + + + +# creator property + + + + + + + +[User](../../models_user_user_info/User-class.md)? creator + +_read / write_ + + + + + + +## Implementation + +```dart +User? creator; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/Comment/likeCount.md b/talawa-mobile-docs/models_comment_comment_model/Comment/likeCount.md new file mode 100644 index 000000000..d4ba33db5 --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/Comment/likeCount.md @@ -0,0 +1,32 @@ + + + +# likeCount property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? likeCount + +_read / write_ + + + + + + +## Implementation + +```dart +String? likeCount; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/Comment/post.md b/talawa-mobile-docs/models_comment_comment_model/Comment/post.md new file mode 100644 index 000000000..60ba62c80 --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/Comment/post.md @@ -0,0 +1,32 @@ + + + +# post property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? post + +_read / write_ + + + + + + +## Implementation + +```dart +String? post; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/Comment/text.md b/talawa-mobile-docs/models_comment_comment_model/Comment/text.md new file mode 100644 index 000000000..3e3c81333 --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/Comment/text.md @@ -0,0 +1,32 @@ + + + +# text property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? text + +_read / write_ + + + + + + +## Implementation + +```dart +String? text; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_comment_comment_model/models_comment_comment_model-library.md b/talawa-mobile-docs/models_comment_comment_model/models_comment_comment_model-library.md new file mode 100644 index 000000000..85d3df1ba --- /dev/null +++ b/talawa-mobile-docs/models_comment_comment_model/models_comment_comment_model-library.md @@ -0,0 +1,38 @@ + + + + +# comment_model library + + + + + + + + + + + +## Classes + +##### [Comment](../models_comment_comment_model/Comment-class.md) + + + +This class returns a Comment instance. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event-class.md b/talawa-mobile-docs/models_events_event_model/Event-class.md new file mode 100644 index 000000000..0ab22c2ff --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event-class.md @@ -0,0 +1,285 @@ + + + +# Event class + + + + + + + + + +

This class creates an event model and returns an Event instance.

+ + + + +## Constructors + +[Event](../models_events_event_model/Event/Event.md) ({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? title, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? attendees, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? location, [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? latitude, [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? longitude, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? recurring, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? allDay, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? startDate, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? endDate, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? startTime, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? endTime, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? recurrence, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isPublic, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isRegistered, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isRegisterable, [User](../models_user_user_info/User-class.md)? creator, [OrgInfo](../models_organization_org_info/OrgInfo-class.md)? organization, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>? admins, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>? registrants}) + + + +[Event.fromJson](../models_events_event_model/Event/Event.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + _factory_ + + +## Properties + +##### [admins](../models_events_event_model/Event/admins.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>? + + + + +_read / write_ + + + +##### [allDay](../models_events_event_model/Event/allDay.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + + +_read / write_ + + + +##### [attendees](../models_events_event_model/Event/attendees.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [creator](../models_events_event_model/Event/creator.md) ↔ [User](../models_user_user_info/User-class.md)? + + + + +_read / write_ + + + +##### [description](../models_events_event_model/Event/description.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [endDate](../models_events_event_model/Event/endDate.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [endTime](../models_events_event_model/Event/endTime.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [id](../models_events_event_model/Event/id.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [isPublic](../models_events_event_model/Event/isPublic.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + + +_read / write_ + + + +##### [isRegisterable](../models_events_event_model/Event/isRegisterable.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + + +_read / write_ + + + +##### [isRegistered](../models_events_event_model/Event/isRegistered.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + + +_read / write_ + + + +##### [latitude](../models_events_event_model/Event/latitude.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + +##### [location](../models_events_event_model/Event/location.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [longitude](../models_events_event_model/Event/longitude.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + +##### [organization](../models_events_event_model/Event/organization.md) ↔ [OrgInfo](../models_organization_org_info/OrgInfo-class.md)? + + + + +_read / write_ + + + +##### [recurrence](../models_events_event_model/Event/recurrence.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [recurring](../models_events_event_model/Event/recurring.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + + +_read / write_ + + + +##### [registrants](../models_events_event_model/Event/registrants.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>? + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [startDate](../models_events_event_model/Event/startDate.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [startTime](../models_events_event_model/Event/startTime.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [title](../models_events_event_model/Event/title.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/Event.fromJson.md b/talawa-mobile-docs/models_events_event_model/Event/Event.fromJson.md new file mode 100644 index 000000000..9a7ea61a0 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/Event.fromJson.md @@ -0,0 +1,72 @@ + + + +# Event.fromJson constructor + + + + + + + +Event.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + + + + +## Implementation + +```dart +factory Event.fromJson( + Map json, +) { + return Event( + id: json['_id'] as String, + title: json['title'] as String?, + description: json['description'] as String?, + attendees: json['attendees'] as String?, + location: json['location'] as String?, + longitude: json['longitude'] as double?, + latitude: json['latitude'] as double?, + recurring: json['recurring'] as bool?, + allDay: json['allDay'] as bool?, + startDate: json['startDate'] as String?, + endDate: json['endDate'] as String?, + startTime: json['startTime'] as String?, + endTime: json['endTime'] as String?, + recurrence: json['recurrence'] as String?, + isPublic: json['isPublic'] as bool?, + isRegistered: json['isRegistered'] as bool?, + isRegisterable: json['isRegisterable'] as bool?, + creator: json['creator'] == null + ? null + //Creating a new User instance from a map structure. + : User.fromJson( + json['creator'] as Map, + fromOrg: true, + ), + organization: json['organization'] == null + ? null + //Creating a new OrgInfo instance from a map structure. + : OrgInfo.fromJson(json['organization'] as Map), + admins: json['admins'] == null + ? null + : (json['admins'] as List?) + ?.map( + (e) => User.fromJson(e as Map, fromOrg: true), + ) + .toList(), + registrants: (json['registrants'] as List?) + ?.map((e) => User.fromJson(e as Map, fromOrg: false)) + .toList(), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/Event.md b/talawa-mobile-docs/models_events_event_model/Event/Event.md new file mode 100644 index 000000000..399d73b89 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/Event.md @@ -0,0 +1,51 @@ + + + +# Event constructor + + + + + + + +Event({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? title, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? attendees, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? location, [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? latitude, [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? longitude, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? recurring, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? allDay, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? startDate, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? endDate, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? startTime, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? endTime, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? recurrence, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isPublic, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isRegistered, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isRegisterable, [User](../../models_user_user_info/User-class.md)? creator, [OrgInfo](../../models_organization_org_info/OrgInfo-class.md)? organization, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>? admins, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>? registrants}) + + + + + +## Implementation + +```dart +Event({ + this.id, + this.title, + this.description, + this.attendees, + this.location, + this.latitude, + this.longitude, + this.recurring, + this.allDay, + this.startDate, + this.endDate, + this.startTime, + this.endTime, + this.recurrence, + this.isPublic, + this.isRegistered, + this.isRegisterable, + this.creator, + this.organization, + this.admins, + this.registrants, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/admins.md b/talawa-mobile-docs/models_events_event_model/Event/admins.md new file mode 100644 index 000000000..d97a3be09 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/admins.md @@ -0,0 +1,32 @@ + + + +# admins property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>? admins + +_read / write_ + + + + + + +## Implementation + +```dart +List? admins; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/allDay.md b/talawa-mobile-docs/models_events_event_model/Event/allDay.md new file mode 100644 index 000000000..630774560 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/allDay.md @@ -0,0 +1,32 @@ + + + +# allDay property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? allDay + +_read / write_ + + + + + + +## Implementation + +```dart +bool? allDay; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/attendees.md b/talawa-mobile-docs/models_events_event_model/Event/attendees.md new file mode 100644 index 000000000..203b6c667 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/attendees.md @@ -0,0 +1,32 @@ + + + +# attendees property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? attendees + +_read / write_ + + + + + + +## Implementation + +```dart +String? attendees; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/creator.md b/talawa-mobile-docs/models_events_event_model/Event/creator.md new file mode 100644 index 000000000..8dcdc334b --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/creator.md @@ -0,0 +1,32 @@ + + + +# creator property + + + + + + + +[User](../../models_user_user_info/User-class.md)? creator + +_read / write_ + + + + + + +## Implementation + +```dart +User? creator; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/description.md b/talawa-mobile-docs/models_events_event_model/Event/description.md new file mode 100644 index 000000000..274483eb8 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/description.md @@ -0,0 +1,32 @@ + + + +# description property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description + +_read / write_ + + + + + + +## Implementation + +```dart +String? description; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/endDate.md b/talawa-mobile-docs/models_events_event_model/Event/endDate.md new file mode 100644 index 000000000..71cdad30e --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/endDate.md @@ -0,0 +1,32 @@ + + + +# endDate property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? endDate + +_read / write_ + + + + + + +## Implementation + +```dart +String? endDate; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/endTime.md b/talawa-mobile-docs/models_events_event_model/Event/endTime.md new file mode 100644 index 000000000..b494d8a61 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/endTime.md @@ -0,0 +1,32 @@ + + + +# endTime property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? endTime + +_read / write_ + + + + + + +## Implementation + +```dart +String? endTime; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/id.md b/talawa-mobile-docs/models_events_event_model/Event/id.md new file mode 100644 index 000000000..833ed271b --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/id.md @@ -0,0 +1,32 @@ + + + +# id property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id + +_read / write_ + + + + + + +## Implementation + +```dart +String? id; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/isPublic.md b/talawa-mobile-docs/models_events_event_model/Event/isPublic.md new file mode 100644 index 000000000..115e149ff --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/isPublic.md @@ -0,0 +1,32 @@ + + + +# isPublic property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isPublic + +_read / write_ + + + + + + +## Implementation + +```dart +bool? isPublic; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/isRegisterable.md b/talawa-mobile-docs/models_events_event_model/Event/isRegisterable.md new file mode 100644 index 000000000..80a87ac5d --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/isRegisterable.md @@ -0,0 +1,32 @@ + + + +# isRegisterable property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isRegisterable + +_read / write_ + + + + + + +## Implementation + +```dart +bool? isRegisterable; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/isRegistered.md b/talawa-mobile-docs/models_events_event_model/Event/isRegistered.md new file mode 100644 index 000000000..0b7abce17 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/isRegistered.md @@ -0,0 +1,32 @@ + + + +# isRegistered property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isRegistered + +_read / write_ + + + + + + +## Implementation + +```dart +bool? isRegistered; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/latitude.md b/talawa-mobile-docs/models_events_event_model/Event/latitude.md new file mode 100644 index 000000000..0f6aa819f --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/latitude.md @@ -0,0 +1,32 @@ + + + +# latitude property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? latitude + +_read / write_ + + + + + + +## Implementation + +```dart +double? latitude; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/location.md b/talawa-mobile-docs/models_events_event_model/Event/location.md new file mode 100644 index 000000000..d2fde2690 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/location.md @@ -0,0 +1,32 @@ + + + +# location property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? location + +_read / write_ + + + + + + +## Implementation + +```dart +String? location; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/longitude.md b/talawa-mobile-docs/models_events_event_model/Event/longitude.md new file mode 100644 index 000000000..0b3b00660 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/longitude.md @@ -0,0 +1,32 @@ + + + +# longitude property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? longitude + +_read / write_ + + + + + + +## Implementation + +```dart +double? longitude; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/organization.md b/talawa-mobile-docs/models_events_event_model/Event/organization.md new file mode 100644 index 000000000..8138745ec --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/organization.md @@ -0,0 +1,32 @@ + + + +# organization property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)? organization + +_read / write_ + + + + + + +## Implementation + +```dart +OrgInfo? organization; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/recurrence.md b/talawa-mobile-docs/models_events_event_model/Event/recurrence.md new file mode 100644 index 000000000..95763e6de --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/recurrence.md @@ -0,0 +1,32 @@ + + + +# recurrence property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? recurrence + +_read / write_ + + + + + + +## Implementation + +```dart +String? recurrence; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/recurring.md b/talawa-mobile-docs/models_events_event_model/Event/recurring.md new file mode 100644 index 000000000..b9223bf40 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/recurring.md @@ -0,0 +1,32 @@ + + + +# recurring property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? recurring + +_read / write_ + + + + + + +## Implementation + +```dart +bool? recurring; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/registrants.md b/talawa-mobile-docs/models_events_event_model/Event/registrants.md new file mode 100644 index 000000000..77c0d2342 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/registrants.md @@ -0,0 +1,32 @@ + + + +# registrants property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>? registrants + +_read / write_ + + + + + + +## Implementation + +```dart +List? registrants; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/startDate.md b/talawa-mobile-docs/models_events_event_model/Event/startDate.md new file mode 100644 index 000000000..a3a268368 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/startDate.md @@ -0,0 +1,32 @@ + + + +# startDate property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? startDate + +_read / write_ + + + + + + +## Implementation + +```dart +String? startDate; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/startTime.md b/talawa-mobile-docs/models_events_event_model/Event/startTime.md new file mode 100644 index 000000000..45d78625a --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/startTime.md @@ -0,0 +1,32 @@ + + + +# startTime property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? startTime + +_read / write_ + + + + + + +## Implementation + +```dart +String? startTime; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/Event/title.md b/talawa-mobile-docs/models_events_event_model/Event/title.md new file mode 100644 index 000000000..79dd02590 --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/Event/title.md @@ -0,0 +1,32 @@ + + + +# title property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? title + +_read / write_ + + + + + + +## Implementation + +```dart +String? title; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_events_event_model/models_events_event_model-library.md b/talawa-mobile-docs/models_events_event_model/models_events_event_model-library.md new file mode 100644 index 000000000..2ccf09efa --- /dev/null +++ b/talawa-mobile-docs/models_events_event_model/models_events_event_model-library.md @@ -0,0 +1,38 @@ + + + + +# event_model library + + + + + + + + + + + +## Classes + +##### [Event](../models_events_event_model/Event-class.md) + + + +This class creates an event model and returns an Event instance. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_language_language_model/Language-class.md b/talawa-mobile-docs/models_language_language_model/Language-class.md new file mode 100644 index 000000000..b17705b6b --- /dev/null +++ b/talawa-mobile-docs/models_language_language_model/Language-class.md @@ -0,0 +1,128 @@ + + + +# Language class + + + + + + + + + +

This class creates an langauge model.

+ + + + +## Constructors + +[Language](../models_language_language_model/Language/Language.md) ({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) countryCode, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) langCode, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) langName, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) langSample}) + + + + +## Properties + +##### [countryCode](../models_language_language_model/Language/countryCode.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [langCode](../models_language_language_model/Language/langCode.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [langName](../models_language_language_model/Language/langName.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [langSample](../models_language_language_model/Language/langSample.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_language_language_model/Language/Language.md b/talawa-mobile-docs/models_language_language_model/Language/Language.md new file mode 100644 index 000000000..04c52d10b --- /dev/null +++ b/talawa-mobile-docs/models_language_language_model/Language/Language.md @@ -0,0 +1,34 @@ + + + +# Language constructor + + + + + + + +Language({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) countryCode, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) langCode, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) langName, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) langSample}) + + + + + +## Implementation + +```dart +Language({ + required this.countryCode, + required this.langCode, + required this.langName, + required this.langSample, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_language_language_model/Language/countryCode.md b/talawa-mobile-docs/models_language_language_model/Language/countryCode.md new file mode 100644 index 000000000..c832d751b --- /dev/null +++ b/talawa-mobile-docs/models_language_language_model/Language/countryCode.md @@ -0,0 +1,32 @@ + + + +# countryCode property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) countryCode + +_final_ + + + + + + +## Implementation + +```dart +final String countryCode; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_language_language_model/Language/langCode.md b/talawa-mobile-docs/models_language_language_model/Language/langCode.md new file mode 100644 index 000000000..e6ca157cf --- /dev/null +++ b/talawa-mobile-docs/models_language_language_model/Language/langCode.md @@ -0,0 +1,32 @@ + + + +# langCode property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) langCode + +_final_ + + + + + + +## Implementation + +```dart +final String langCode; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_language_language_model/Language/langName.md b/talawa-mobile-docs/models_language_language_model/Language/langName.md new file mode 100644 index 000000000..95636992c --- /dev/null +++ b/talawa-mobile-docs/models_language_language_model/Language/langName.md @@ -0,0 +1,32 @@ + + + +# langName property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) langName + +_final_ + + + + + + +## Implementation + +```dart +final String langName; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_language_language_model/Language/langSample.md b/talawa-mobile-docs/models_language_language_model/Language/langSample.md new file mode 100644 index 000000000..0dbe17a12 --- /dev/null +++ b/talawa-mobile-docs/models_language_language_model/Language/langSample.md @@ -0,0 +1,32 @@ + + + +# langSample property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) langSample + +_final_ + + + + + + +## Implementation + +```dart +final String langSample; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_language_language_model/models_language_language_model-library.md b/talawa-mobile-docs/models_language_language_model/models_language_language_model-library.md new file mode 100644 index 000000000..72573e5ab --- /dev/null +++ b/talawa-mobile-docs/models_language_language_model/models_language_language_model-library.md @@ -0,0 +1,38 @@ + + + + +# language_model library + + + + + + + + + + + +## Classes + +##### [Language](../models_language_language_model/Language-class.md) + + + +This class creates an langauge model. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs-class.md b/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs-class.md new file mode 100644 index 000000000..f6a0d3d74 --- /dev/null +++ b/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs-class.md @@ -0,0 +1,109 @@ + + + +# MainScreenArgs class + + + + + + + + + + + + + +## Constructors + +[MainScreenArgs](../models_mainscreen_navigation_args/MainScreenArgs/MainScreenArgs.md) ({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) fromSignUp = false, required [int](https://api.flutter.dev/flutter/dart-core/int-class.html) mainScreenIndex}) + + + + +## Properties + +##### [fromSignUp](../models_mainscreen_navigation_args/MainScreenArgs/fromSignUp.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [mainScreenIndex](../models_mainscreen_navigation_args/MainScreenArgs/mainScreenIndex.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/MainScreenArgs.md b/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/MainScreenArgs.md new file mode 100644 index 000000000..7e83ed6f2 --- /dev/null +++ b/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/MainScreenArgs.md @@ -0,0 +1,29 @@ + + + +# MainScreenArgs constructor + + + + + + + +MainScreenArgs({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) fromSignUp = false, required [int](https://api.flutter.dev/flutter/dart-core/int-class.html) mainScreenIndex}) + + + + + +## Implementation + +```dart +MainScreenArgs({this.fromSignUp = false, required this.mainScreenIndex}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/fromSignUp.md b/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/fromSignUp.md new file mode 100644 index 000000000..65dbae94c --- /dev/null +++ b/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/fromSignUp.md @@ -0,0 +1,32 @@ + + + +# fromSignUp property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) fromSignUp + +_final_ + + + + + + +## Implementation + +```dart +final bool fromSignUp; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/mainScreenIndex.md b/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/mainScreenIndex.md new file mode 100644 index 000000000..570058a34 --- /dev/null +++ b/talawa-mobile-docs/models_mainscreen_navigation_args/MainScreenArgs/mainScreenIndex.md @@ -0,0 +1,32 @@ + + + +# mainScreenIndex property + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) mainScreenIndex + +_final_ + + + + + + +## Implementation + +```dart +final int mainScreenIndex; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_mainscreen_navigation_args/models_mainscreen_navigation_args-library.md b/talawa-mobile-docs/models_mainscreen_navigation_args/models_mainscreen_navigation_args-library.md new file mode 100644 index 000000000..d14163037 --- /dev/null +++ b/talawa-mobile-docs/models_mainscreen_navigation_args/models_mainscreen_navigation_args-library.md @@ -0,0 +1,38 @@ + + + + +# mainscreen_navigation_args library + + + + + + + + + + + +## Classes + +##### [MainScreenArgs](../models_mainscreen_navigation_args/MainScreenArgs-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_options_options/Options-class.md b/talawa-mobile-docs/models_options_options/Options-class.md new file mode 100644 index 000000000..f5c9eabca --- /dev/null +++ b/talawa-mobile-docs/models_options_options/Options-class.md @@ -0,0 +1,128 @@ + + + +# Options class + + + + + + + + + +

This class creates a Option model.

+ + + + +## Constructors + +[Options](../models_options_options/Options/Options.md) ({required [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) icon, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) subtitle, [IconButton](https://api.flutter.dev/flutter/material/IconButton-class.html)? trailingIconButton}) + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [icon](../models_options_options/Options/icon.md) ↔ [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [subtitle](../models_options_options/Options/subtitle.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read / write_ + + + +##### [title](../models_options_options/Options/title.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read / write_ + + + +##### [trailingIconButton](../models_options_options/Options/trailingIconButton.md) ↔ [IconButton](https://api.flutter.dev/flutter/material/IconButton-class.html)? + + + + +_read / write_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_options_options/Options/Options.md b/talawa-mobile-docs/models_options_options/Options/Options.md new file mode 100644 index 000000000..ec36ee551 --- /dev/null +++ b/talawa-mobile-docs/models_options_options/Options/Options.md @@ -0,0 +1,34 @@ + + + +# Options constructor + + + + + + + +Options({required [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) icon, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) subtitle, [IconButton](https://api.flutter.dev/flutter/material/IconButton-class.html)? trailingIconButton}) + + + + + +## Implementation + +```dart +Options({ + required this.icon, + required this.title, + required this.subtitle, + this.trailingIconButton, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_options_options/Options/icon.md b/talawa-mobile-docs/models_options_options/Options/icon.md new file mode 100644 index 000000000..4e9035472 --- /dev/null +++ b/talawa-mobile-docs/models_options_options/Options/icon.md @@ -0,0 +1,32 @@ + + + +# icon property + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) icon + +_read / write_ + + + + + + +## Implementation + +```dart +Widget icon; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_options_options/Options/subtitle.md b/talawa-mobile-docs/models_options_options/Options/subtitle.md new file mode 100644 index 000000000..49c653f7e --- /dev/null +++ b/talawa-mobile-docs/models_options_options/Options/subtitle.md @@ -0,0 +1,32 @@ + + + +# subtitle property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) subtitle + +_read / write_ + + + + + + +## Implementation + +```dart +String subtitle; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_options_options/Options/title.md b/talawa-mobile-docs/models_options_options/Options/title.md new file mode 100644 index 000000000..7f3fec8c9 --- /dev/null +++ b/talawa-mobile-docs/models_options_options/Options/title.md @@ -0,0 +1,32 @@ + + + +# title property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) title + +_read / write_ + + + + + + +## Implementation + +```dart +String title; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_options_options/Options/trailingIconButton.md b/talawa-mobile-docs/models_options_options/Options/trailingIconButton.md new file mode 100644 index 000000000..d9b9f553f --- /dev/null +++ b/talawa-mobile-docs/models_options_options/Options/trailingIconButton.md @@ -0,0 +1,32 @@ + + + +# trailingIconButton property + + + + + + + +[IconButton](https://api.flutter.dev/flutter/material/IconButton-class.html)? trailingIconButton + +_read / write_ + + + + + + +## Implementation + +```dart +IconButton? trailingIconButton; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_options_options/models_options_options-library.md b/talawa-mobile-docs/models_options_options/models_options_options-library.md new file mode 100644 index 000000000..259ad5747 --- /dev/null +++ b/talawa-mobile-docs/models_options_options/models_options_options-library.md @@ -0,0 +1,38 @@ + + + + +# options library + + + + + + + + + + + +## Classes + +##### [Options](../models_options_options/Options-class.md) + + + +This class creates a Option model. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo-class.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo-class.md new file mode 100644 index 000000000..2be8742b9 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo-class.md @@ -0,0 +1,187 @@ + + + +# OrgInfo class + + + + + + + + + +

This class creates an organization-information model and returns an OrgInfo instance.

+ + + + + + + + + +**Annotations** + +- @[HiveType](https://pub.dev/documentation/hive/2.2.3/hive/HiveType-class.html)(typeId: 2) + + +## Constructors + +[OrgInfo](../models_organization_org_info/OrgInfo/OrgInfo.md) ({[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>? admins, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>? members, [User](../models_user_user_info/User-class.md)? creatorInfo, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isPublic, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name}) + + + +[OrgInfo.fromJson](../models_organization_org_info/OrgInfo/OrgInfo.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json1, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) memberRequest = false}) + + _factory_ + + +## Properties + +##### [admins](../models_organization_org_info/OrgInfo/admins.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>? + + + + +_read / write_ + + + +##### [creatorInfo](../models_organization_org_info/OrgInfo/creatorInfo.md) ↔ [User](../models_user_user_info/User-class.md)? + + + + +_read / write_ + + + +##### [description](../models_organization_org_info/OrgInfo/description.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [id](../models_organization_org_info/OrgInfo/id.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [image](../models_organization_org_info/OrgInfo/image.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [isPublic](../models_organization_org_info/OrgInfo/isPublic.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + + +_read / write_ + + + +##### [members](../models_organization_org_info/OrgInfo/members.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>? + + + + +_read / write_ + + + +##### [name](../models_organization_org_info/OrgInfo/name.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [fromJsonToList](../models_organization_org_info/OrgInfo/fromJsonToList.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html) json) [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/OrgInfo.fromJson.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/OrgInfo.fromJson.md new file mode 100644 index 000000000..45cbc5eae --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/OrgInfo.fromJson.md @@ -0,0 +1,67 @@ + + + +# OrgInfo.fromJson constructor + + + + + + + +OrgInfo.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json1, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) memberRequest = false}) + + + + + +## Implementation + +```dart +factory OrgInfo.fromJson( + Map json1, { + bool memberRequest = false, +}) { + Map json; + if (memberRequest) { + json = json1['organization'] as Map; + } else { + json = json1; + } + return OrgInfo( + id: json['_id'] != null ? json['_id'] as String : null, + image: json['image'] != null ? json['image'] as String? : null, + name: json['name'] != null ? json['name'] as String? : null, + description: + json['description'] != null ? json['description'] as String? : null, + isPublic: json['isPublic'] != null ? json['isPublic'] as bool? : null, + creatorInfo: json['creator'] != null + ? User.fromJson( + json['creator'] as Map, + fromOrg: true, + ) + : null, + members: json['members'] != null + ? (json['members'] as List?) + ?.map( + (e) => User.fromJson(e as Map, fromOrg: true), + ) + .toList() + : null, + admins: json['admins'] != null + ? (json['admins'] as List?) + ?.map( + (e) => User.fromJson(e as Map, fromOrg: true), + ) + .toList() + : null, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/OrgInfo.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/OrgInfo.md new file mode 100644 index 000000000..ec3cdccb2 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/OrgInfo.md @@ -0,0 +1,38 @@ + + + +# OrgInfo constructor + + + + + + + +OrgInfo({[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>? admins, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>? members, [User](../../models_user_user_info/User-class.md)? creatorInfo, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isPublic, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name}) + + + + + +## Implementation + +```dart +OrgInfo({ + this.admins, + this.members, + this.creatorInfo, + this.description, + this.id, + this.image, + this.isPublic, + this.name, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/admins.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/admins.md new file mode 100644 index 000000000..ed855ec72 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/admins.md @@ -0,0 +1,36 @@ + + + +# admins property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(3) +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>? admins + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(3) +List? admins; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/creatorInfo.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/creatorInfo.md new file mode 100644 index 000000000..96f589033 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/creatorInfo.md @@ -0,0 +1,36 @@ + + + +# creatorInfo property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(7) +[User](../../models_user_user_info/User-class.md)? creatorInfo + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(7) +User? creatorInfo; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/description.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/description.md new file mode 100644 index 000000000..0dd524bef --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/description.md @@ -0,0 +1,36 @@ + + + +# description property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(5) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(5) +String? description; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/fromJsonToList.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/fromJsonToList.md new file mode 100644 index 000000000..f675364e6 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/fromJsonToList.md @@ -0,0 +1,41 @@ + + + +# fromJsonToList method + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> fromJsonToList +([List](https://api.flutter.dev/flutter/dart-core/List-class.html) json) + + + + + + + + +## Implementation + +```dart +List fromJsonToList(List json) { + final List orgList = []; + json.forEach((element) { + final OrgInfo org = OrgInfo.fromJson(element as Map); + orgList.add(org); + }); + return orgList; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/id.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/id.md new file mode 100644 index 000000000..41593eb6c --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/id.md @@ -0,0 +1,36 @@ + + + +# id property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(1) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(1) +String? id; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/image.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/image.md new file mode 100644 index 000000000..307a6d894 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/image.md @@ -0,0 +1,36 @@ + + + +# image property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(0) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(0) +String? image; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/isPublic.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/isPublic.md new file mode 100644 index 000000000..2ab544f2a --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/isPublic.md @@ -0,0 +1,36 @@ + + + +# isPublic property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(6) +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isPublic + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(6) +bool? isPublic; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/members.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/members.md new file mode 100644 index 000000000..0613169d6 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/members.md @@ -0,0 +1,36 @@ + + + +# members property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(4) +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>? members + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(4) +List? members; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfo/name.md b/talawa-mobile-docs/models_organization_org_info/OrgInfo/name.md new file mode 100644 index 000000000..e69ccaed4 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfo/name.md @@ -0,0 +1,36 @@ + + + +# name property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(2) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(2) +String? name; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter-class.md b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter-class.md new file mode 100644 index 000000000..159351022 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter-class.md @@ -0,0 +1,130 @@ + + + +# OrgInfoAdapter class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [TypeAdapter](https://pub.dev/documentation/hive/2.2.3/hive/TypeAdapter-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> +- OrgInfoAdapter + + + + + + + + +## Constructors + +[OrgInfoAdapter](../models_organization_org_info/OrgInfoAdapter/OrgInfoAdapter.md) () + + + + +## Properties + +##### [hashCode](../models_organization_org_info/OrgInfoAdapter/hashCode.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyoverride_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [typeId](../models_organization_org_info/OrgInfoAdapter/typeId.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +Called for type registration +_final_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [read](../models_organization_org_info/OrgInfoAdapter/read.md)([BinaryReader](https://pub.dev/documentation/hive/2.2.3/hive/BinaryReader-class.html) reader) [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + +Is called when a value has to be decoded. +_override_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [write](../models_organization_org_info/OrgInfoAdapter/write.md)([BinaryWriter](https://pub.dev/documentation/hive/2.2.3/hive/BinaryWriter-class.html) writer, [OrgInfo](../models_organization_org_info/OrgInfo-class.md) obj) void + + + +Is called when a value has to be encoded. +_override_ + + + + + +## Operators + +##### [operator ==](../models_organization_org_info/OrgInfoAdapter/operator_equals.md)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_override_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/OrgInfoAdapter.md b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/OrgInfoAdapter.md new file mode 100644 index 000000000..82ac945fd --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/OrgInfoAdapter.md @@ -0,0 +1,24 @@ + + + +# OrgInfoAdapter constructor + + + + + + + +OrgInfoAdapter() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/hashCode.md b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/hashCode.md new file mode 100644 index 000000000..3f59c03a5 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/hashCode.md @@ -0,0 +1,65 @@ + + + +# hashCode property + + + + + + + + + +**Annotations** + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) hashCode + +_override_ + + + +

The hash code for this object.

+

A hash code is a single integer which represents the state of the object +that affects operator == comparisons.

+

All objects have hash codes. +The default hash code implemented by Object +represents only the identity of the object, +the same way as the default operator == implementation only considers objects +equal if they are identical (see identityHashCode).

+

If operator == is overridden to use the object state instead, +the hash code must also be changed to represent that state, +otherwise the object cannot be used in hash based data structures +like the default Set and Map implementations.

+

Hash codes must be the same for objects that are equal to each other +according to operator ==. +The hash code of an object should only change if the object changes +in a way that affects equality. +There are no further requirements for the hash codes. +They need not be consistent between executions of the same program +and there are no distribution guarantees.

+

Objects that are not equal are allowed to have the same hash code. +It is even technically allowed that all instances have the same hash code, +but if clashes happen too often, +it may reduce the efficiency of hash-based data structures +like HashSet or HashMap.

+

If a subclass overrides hashCode, it should override the +operator == operator as well to maintain consistency.

+ + + +## Implementation + +```dart +@override +int get hashCode => typeId.hashCode; +``` + + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/operator_equals.md b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/operator_equals.md new file mode 100644 index 000000000..5a89901e1 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/operator_equals.md @@ -0,0 +1,67 @@ + + + +# operator == method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) operator == +([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) + +_override_ + + + +

The equality operator.

+

The default behavior for all Objects is to return true if and +only if this object and other are the same object.

+

Override this method to specify a different equality relation on +a class. The overriding method must still be an equivalence relation. +That is, it must be:

+
    +
  • +

    Total: It must return a boolean for all arguments. It should never throw.

    +
  • +
  • +

    Reflexive: For all objects o, o == o must be true.

    +
  • +
  • +

    Symmetric: For all objects o1 and o2, o1 == o2 and o2 == o1 must +either both be true, or both be false.

    +
  • +
  • +

    Transitive: For all objects o1, o2, and o3, if o1 == o2 and +o2 == o3 are true, then o1 == o3 must be true.

    +
  • +
+

The method should also be consistent over time, +so whether two objects are equal should only change +if at least one of the objects was modified.

+

If a subclass overrides the equality operator, it should override +the hashCode method as well to maintain consistency.

+ + + +## Implementation + +```dart +@override +bool operator ==(Object other) => + identical(this, other) || + other is OrgInfoAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/read.md b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/read.md new file mode 100644 index 000000000..730b1101e --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/read.md @@ -0,0 +1,52 @@ + + + +# read method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md) read +([BinaryReader](https://pub.dev/documentation/hive/2.2.3/hive/BinaryReader-class.html) reader) + +_override_ + + + +

Is called when a value has to be decoded.

+ + + +## Implementation + +```dart +@override +OrgInfo read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return OrgInfo( + admins: (fields[3] as List?)?.cast(), + members: (fields[4] as List?)?.cast(), + creatorInfo: fields[7] as User?, + description: fields[5] as String?, + id: fields[1] as String?, + image: fields[0] as String?, + isPublic: fields[6] as bool?, + name: fields[2] as String?, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/typeId.md b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/typeId.md new file mode 100644 index 000000000..185e25a2c --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/typeId.md @@ -0,0 +1,37 @@ + + + +# typeId property + + + + + + + +**Annotations** + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) typeId + +_final_ + + + +

Called for type registration

+ + + +## Implementation + +```dart +@override +final int typeId = 2; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/write.md b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/write.md new file mode 100644 index 000000000..65e6d9ac0 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/OrgInfoAdapter/write.md @@ -0,0 +1,56 @@ + + + +# write method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void write +([BinaryWriter](https://pub.dev/documentation/hive/2.2.3/hive/BinaryWriter-class.html) writer, [OrgInfo](../../models_organization_org_info/OrgInfo-class.md) obj) + +_override_ + + + +

Is called when a value has to be encoded.

+ + + +## Implementation + +```dart +@override +void write(BinaryWriter writer, OrgInfo obj) { + writer + ..writeByte(8) + ..writeByte(0) + ..write(obj.image) + ..writeByte(1) + ..write(obj.id) + ..writeByte(2) + ..write(obj.name) + ..writeByte(3) + ..write(obj.admins) + ..writeByte(4) + ..write(obj.members) + ..writeByte(5) + ..write(obj.description) + ..writeByte(6) + ..write(obj.isPublic) + ..writeByte(7) + ..write(obj.creatorInfo); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_organization_org_info/models_organization_org_info-library.md b/talawa-mobile-docs/models_organization_org_info/models_organization_org_info-library.md new file mode 100644 index 000000000..1372e1194 --- /dev/null +++ b/talawa-mobile-docs/models_organization_org_info/models_organization_org_info-library.md @@ -0,0 +1,45 @@ + + + + +# org_info library + + + + + + + + + + + +## Classes + +##### [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + +This class creates an organization-information model and returns an OrgInfo instance. + + +##### [OrgInfoAdapter](../models_organization_org_info/OrgInfoAdapter-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Comments-class.md b/talawa-mobile-docs/models_post_post_model/Comments-class.md new file mode 100644 index 000000000..d23910940 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Comments-class.md @@ -0,0 +1,114 @@ + + + +# Comments class + + + + + + + + + +

This class convert between json and object for comments.

+ + + + +## Constructors + +[Comments](../models_post_post_model/Comments/Comments.md) ({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? sId}) + + + +[Comments.fromJson](../models_post_post_model/Comments/Comments.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + +Convert json to dart object. + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [sId](../models_post_post_model/Comments/sId.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + +these are dart object. +_read / write_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toJson](../models_post_post_model/Comments/toJson.md)() [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> + + + +Convert dart object to json. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Comments/Comments.fromJson.md b/talawa-mobile-docs/models_post_post_model/Comments/Comments.fromJson.md new file mode 100644 index 000000000..7edc28297 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Comments/Comments.fromJson.md @@ -0,0 +1,38 @@ + + + +# Comments.fromJson constructor + + + + + + + +Comments.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + +

Convert json to dart object.

+

params: +None +returns:

+
    +
  • Map<String, dynamic>: Dart object is returned.
  • +
+ + + +## Implementation + +```dart +Comments.fromJson(Map json) { + sId = json['_id'] as String?; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Comments/Comments.md b/talawa-mobile-docs/models_post_post_model/Comments/Comments.md new file mode 100644 index 000000000..ea2aab3be --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Comments/Comments.md @@ -0,0 +1,29 @@ + + + +# Comments constructor + + + + + + + +Comments({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? sId}) + + + + + +## Implementation + +```dart +Comments({this.sId}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Comments/sId.md b/talawa-mobile-docs/models_post_post_model/Comments/sId.md new file mode 100644 index 000000000..398d78335 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Comments/sId.md @@ -0,0 +1,37 @@ + + + +# sId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? sId + +_read / write_ + + + +

these are dart object.

+

params:

+
    +
  • sId : unique identifier for post
  • +
+ + + +## Implementation + +```dart +String? sId; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Comments/toJson.md b/talawa-mobile-docs/models_post_post_model/Comments/toJson.md new file mode 100644 index 000000000..41171d83c --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Comments/toJson.md @@ -0,0 +1,45 @@ + + + +# toJson method + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> toJson +() + + + + + +

Convert dart object to json.

+

params: + None

+

returns:

+
    +
  • Map<String, dynamic>: json is returned.
  • +
+ + + +## Implementation + +```dart +Map toJson() { + final Map data = {}; + data['_id'] = this.sId; + return data; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/LikedBy-class.md b/talawa-mobile-docs/models_post_post_model/LikedBy-class.md new file mode 100644 index 000000000..414225f56 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/LikedBy-class.md @@ -0,0 +1,114 @@ + + + +# LikedBy class + + + + + + + + + +

This class convert between json and object for likedby.

+ + + + +## Constructors + +[LikedBy](../models_post_post_model/LikedBy/LikedBy.md) ({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? sId}) + + + +[LikedBy.fromJson](../models_post_post_model/LikedBy/LikedBy.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + +JSON factory constructor. + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [sId](../models_post_post_model/LikedBy/sId.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + +These are dart object. +_read / write_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toJson](../models_post_post_model/LikedBy/toJson.md)() [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> + + + +Convert dart object to json. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/LikedBy/LikedBy.fromJson.md b/talawa-mobile-docs/models_post_post_model/LikedBy/LikedBy.fromJson.md new file mode 100644 index 000000000..16f42a9a4 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/LikedBy/LikedBy.fromJson.md @@ -0,0 +1,32 @@ + + + +# LikedBy.fromJson constructor + + + + + + + +LikedBy.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + +

JSON factory constructor.

+ + + +## Implementation + +```dart +LikedBy.fromJson(Map json) { + sId = json['_id'] as String?; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/LikedBy/LikedBy.md b/talawa-mobile-docs/models_post_post_model/LikedBy/LikedBy.md new file mode 100644 index 000000000..81c5321ef --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/LikedBy/LikedBy.md @@ -0,0 +1,29 @@ + + + +# LikedBy constructor + + + + + + + +LikedBy({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? sId}) + + + + + +## Implementation + +```dart +LikedBy({this.sId}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/LikedBy/sId.md b/talawa-mobile-docs/models_post_post_model/LikedBy/sId.md new file mode 100644 index 000000000..ecdee0591 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/LikedBy/sId.md @@ -0,0 +1,37 @@ + + + +# sId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? sId + +_read / write_ + + + +

These are dart object.

+

params:

+
    +
  • sId : unique identifier for post
  • +
+ + + +## Implementation + +```dart +String? sId; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/LikedBy/toJson.md b/talawa-mobile-docs/models_post_post_model/LikedBy/toJson.md new file mode 100644 index 000000000..41171d83c --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/LikedBy/toJson.md @@ -0,0 +1,45 @@ + + + +# toJson method + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> toJson +() + + + + + +

Convert dart object to json.

+

params: + None

+

returns:

+
    +
  • Map<String, dynamic>: json is returned.
  • +
+ + + +## Implementation + +```dart +Map toJson() { + final Map data = {}; + data['_id'] = this.sId; + return data; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post-class.md b/talawa-mobile-docs/models_post_post_model/Post-class.md new file mode 100644 index 000000000..aed8de17d --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post-class.md @@ -0,0 +1,186 @@ + + + +# Post class + + + + + + + + + +

This class creates a Post model.

+ + + + +## Constructors + +[Post](../models_post_post_model/Post/Post.md) ({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) sId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description, [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? createdAt, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? imageUrl, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? videoUrl, required [User](../models_user_user_info/User-class.md)? creator, [OrgInfo](../models_organization_org_info/OrgInfo-class.md)? organization, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../models_post_post_model/LikedBy-class.md)>? likedBy, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comments](../models_post_post_model/Comments-class.md)>? comments}) + + + +[Post.fromJson](../models_post_post_model/Post/Post.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + +Creating a new Post instance from a map structure. + + +## Properties + +##### [comments](../models_post_post_model/Post/comments.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comments](../models_post_post_model/Comments-class.md)>? + + + +comments for post. +_read / write_ + + + +##### [createdAt](../models_post_post_model/Post/createdAt.md) ↔ [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? + + + +createdAt for post. +_read / write_ + + + +##### [creator](../models_post_post_model/Post/creator.md) ↔ [User](../models_user_user_info/User-class.md)? + + + +creator for post. +_read / write_ + + + +##### [description](../models_post_post_model/Post/description.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + +description for post. +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [imageUrl](../models_post_post_model/Post/imageUrl.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + +imageUrl for post. +_read / write_ + + + +##### [likedBy](../models_post_post_model/Post/likedBy.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../models_post_post_model/LikedBy-class.md)>? + + + +likedBy for post. +_read / write_ + + + +##### [organization](../models_post_post_model/Post/organization.md) ↔ [OrgInfo](../models_organization_org_info/OrgInfo-class.md)? + + + +organization for post. +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [sId](../models_post_post_model/Post/sId.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +unique identifier for post. +_read / write_ + + + +##### [videoUrl](../models_post_post_model/Post/videoUrl.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + +videoUrl for post. +_read / write_ + + + + + +## Methods + +##### [getPostCreatedDuration](../models_post_post_model/Post/getPostCreatedDuration.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +this is to get duration of post. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/Post.fromJson.md b/talawa-mobile-docs/models_post_post_model/Post/Post.fromJson.md new file mode 100644 index 000000000..7dba822b4 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/Post.fromJson.md @@ -0,0 +1,65 @@ + + + +# Post.fromJson constructor + + + + + + + +Post.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + +

Creating a new Post instance from a map structure.

+

params: +None +returns:

+
    +
  • PostObject: Dart Object for posts
  • +
+ + + +## Implementation + +```dart +/// +/// params: +/// None +/// returns: +/// * `PostObject`: Dart Object for posts +Post.fromJson(Map json) { + sId = json['_id'] as String; + description = json['text'] as String?; + createdAt = DateTime.parse(json['createdAt'] as String); + imageUrl = json['imageUrl'] as String?; + videoUrl = json['videoUrl'] as String?; + creator = json['creator'] != null + ? User.fromJson(json['creator'] as Map, fromOrg: true) + : null; + organization = json['organization'] != null + ? OrgInfo.fromJson(json['organization'] as Map) + : null; + if (json['likedBy'] != null) { + likedBy = []; + json['likedBy'].forEach((v) { + likedBy?.add(LikedBy.fromJson(v as Map)); + }); + } + if (json['comments'] != null) { + comments = []; + json['comments'].forEach((v) { + comments?.add(Comments.fromJson(v as Map)); + }); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/Post.md b/talawa-mobile-docs/models_post_post_model/Post/Post.md new file mode 100644 index 000000000..829c0b018 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/Post.md @@ -0,0 +1,39 @@ + + + +# Post constructor + + + + + + + +Post({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) sId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description, [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? createdAt, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? imageUrl, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? videoUrl, required [User](../../models_user_user_info/User-class.md)? creator, [OrgInfo](../../models_organization_org_info/OrgInfo-class.md)? organization, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../../models_post_post_model/LikedBy-class.md)>? likedBy, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comments](../../models_post_post_model/Comments-class.md)>? comments}) + + + + + +## Implementation + +```dart +Post({ + required this.sId, + this.description, + this.createdAt, + this.imageUrl, + this.videoUrl, + required this.creator, + this.organization, + this.likedBy, + this.comments, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/comments.md b/talawa-mobile-docs/models_post_post_model/Post/comments.md new file mode 100644 index 000000000..ecf348966 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/comments.md @@ -0,0 +1,33 @@ + + + +# comments property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comments](../../models_post_post_model/Comments-class.md)>? comments + +_read / write_ + + + +

comments for post.

+ + + +## Implementation + +```dart +List? comments; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/createdAt.md b/talawa-mobile-docs/models_post_post_model/Post/createdAt.md new file mode 100644 index 000000000..6238dfa3c --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/createdAt.md @@ -0,0 +1,33 @@ + + + +# createdAt property + + + + + + + +[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? createdAt + +_read / write_ + + + +

createdAt for post.

+ + + +## Implementation + +```dart +DateTime? createdAt; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/creator.md b/talawa-mobile-docs/models_post_post_model/Post/creator.md new file mode 100644 index 000000000..a7a0a80a4 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/creator.md @@ -0,0 +1,33 @@ + + + +# creator property + + + + + + + +[User](../../models_user_user_info/User-class.md)? creator + +_read / write_ + + + +

creator for post.

+ + + +## Implementation + +```dart +User? creator; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/description.md b/talawa-mobile-docs/models_post_post_model/Post/description.md new file mode 100644 index 000000000..a34d1f7ab --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/description.md @@ -0,0 +1,33 @@ + + + +# description property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description + +_read / write_ + + + +

description for post.

+ + + +## Implementation + +```dart +String? description; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/getPostCreatedDuration.md b/talawa-mobile-docs/models_post_post_model/Post/getPostCreatedDuration.md new file mode 100644 index 000000000..561e42567 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/getPostCreatedDuration.md @@ -0,0 +1,55 @@ + + + +# getPostCreatedDuration method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) getPostCreatedDuration +() + + + + + +

this is to get duration of post.

+

params: + None

+

returns:

+
    +
  • String: date is returned in ago form.
  • +
+ + + +## Implementation + +```dart +String getPostCreatedDuration() { + if (DateTime.now().difference(this.createdAt!).inSeconds < 60) { + return '${DateTime.now().difference(this.createdAt!).inSeconds} Seconds Ago'; + } else if (DateTime.now().difference(this.createdAt!).inMinutes < 60) { + return '${DateTime.now().difference(this.createdAt!).inMinutes} Minutes Ago'; + } else if (DateTime.now().difference(this.createdAt!).inHours < 24) { + return '${DateTime.now().difference(this.createdAt!).inHours} Hours Ago'; + } else if (DateTime.now().difference(this.createdAt!).inDays < 30) { + return '${DateTime.now().difference(this.createdAt!).inDays} Days Ago'; + } else if (DateTime.now().difference(this.createdAt!).inDays < 365) { + return '${DateTime.now().difference(this.createdAt!).inDays ~/ 30} Months Ago'; + } else { + return '${DateTime.now().difference(this.createdAt!).inDays ~/ 365} Years Ago'; + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/imageUrl.md b/talawa-mobile-docs/models_post_post_model/Post/imageUrl.md new file mode 100644 index 000000000..ccbaf0864 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/imageUrl.md @@ -0,0 +1,33 @@ + + + +# imageUrl property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? imageUrl + +_read / write_ + + + +

imageUrl for post.

+ + + +## Implementation + +```dart +String? imageUrl; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/likedBy.md b/talawa-mobile-docs/models_post_post_model/Post/likedBy.md new file mode 100644 index 000000000..3568e7dd8 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/likedBy.md @@ -0,0 +1,33 @@ + + + +# likedBy property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../../models_post_post_model/LikedBy-class.md)>? likedBy + +_read / write_ + + + +

likedBy for post.

+ + + +## Implementation + +```dart +List? likedBy; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/organization.md b/talawa-mobile-docs/models_post_post_model/Post/organization.md new file mode 100644 index 000000000..87e5b3d75 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/organization.md @@ -0,0 +1,33 @@ + + + +# organization property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)? organization + +_read / write_ + + + +

organization for post.

+ + + +## Implementation + +```dart +OrgInfo? organization; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/sId.md b/talawa-mobile-docs/models_post_post_model/Post/sId.md new file mode 100644 index 000000000..1a82d26e6 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/sId.md @@ -0,0 +1,33 @@ + + + +# sId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) sId + +_read / write_ + + + +

unique identifier for post.

+ + + +## Implementation + +```dart +late String sId; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/Post/videoUrl.md b/talawa-mobile-docs/models_post_post_model/Post/videoUrl.md new file mode 100644 index 000000000..12fb954e3 --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/Post/videoUrl.md @@ -0,0 +1,33 @@ + + + +# videoUrl property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? videoUrl + +_read / write_ + + + +

videoUrl for post.

+ + + +## Implementation + +```dart +String? videoUrl; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_post_post_model/models_post_post_model-library.md b/talawa-mobile-docs/models_post_post_model/models_post_post_model-library.md new file mode 100644 index 000000000..6aa60a57a --- /dev/null +++ b/talawa-mobile-docs/models_post_post_model/models_post_post_model-library.md @@ -0,0 +1,52 @@ + + + + +# post_model library + + + + + + + + + + + +## Classes + +##### [Comments](../models_post_post_model/Comments-class.md) + + + +This class convert between json and object for comments. + + +##### [LikedBy](../models_post_post_model/LikedBy-class.md) + + + +This class convert between json and object for likedby. + + +##### [Post](../models_post_post_model/Post-class.md) + + + +This class creates a Post model. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task-class.md b/talawa-mobile-docs/models_task_task_model/Task-class.md new file mode 100644 index 000000000..622477968 --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task-class.md @@ -0,0 +1,158 @@ + + + +# Task class + + + + + + + + + + + + + +## Constructors + +[Task](../models_task_task_model/Task/Task.md) ({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) id, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [User](../models_user_user_info/User-class.md) creator, required [Event](../models_events_event_model/Event-class.md) event, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) createdAt, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? deadline}) + + _const_ + +[Task.fromJson](../models_task_task_model/Task/Task.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + +/Creating a new Task instance from a map structure. _factory_ + + +## Properties + +##### [createdAt](../models_task_task_model/Task/createdAt.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [creator](../models_task_task_model/Task/creator.md) → [User](../models_user_user_info/User-class.md) + + + + +_final_ + + + +##### [deadline](../models_task_task_model/Task/deadline.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + +##### [description](../models_task_task_model/Task/description.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + +##### [event](../models_task_task_model/Task/event.md) → [Event](../models_events_event_model/Event-class.md) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [id](../models_task_task_model/Task/id.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [title](../models_task_task_model/Task/title.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/Task.fromJson.md b/talawa-mobile-docs/models_task_task_model/Task/Task.fromJson.md new file mode 100644 index 000000000..f1c2c1fb0 --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/Task.fromJson.md @@ -0,0 +1,47 @@ + + + +# Task.fromJson constructor + + + + + + + +Task.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json) + + +

/Creating a new Task instance from a map structure.

+ + + +## Implementation + +```dart +factory Task.fromJson( + Map json, +) { + return Task( + id: json['_id'] as String, + title: json['title'] as String, + creator: User.fromJson( + json['creator'] as Map, + fromOrg: true, + ), + event: Event.fromJson( + json['event'] as Map, + ), + createdAt: json['createdAt'] as String, + description: json['description'] as String?, + deadline: json['deadline'] as String?, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/Task.md b/talawa-mobile-docs/models_task_task_model/Task/Task.md new file mode 100644 index 000000000..ee67ef19e --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/Task.md @@ -0,0 +1,37 @@ + + + +# Task constructor + + + + + + +const +Task({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) id, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [User](../../models_user_user_info/User-class.md) creator, required [Event](../../models_events_event_model/Event-class.md) event, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) createdAt, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? deadline}) + + + + + +## Implementation + +```dart +const Task({ + required this.id, + required this.title, + required this.creator, + required this.event, + required this.createdAt, + this.description, + this.deadline, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/createdAt.md b/talawa-mobile-docs/models_task_task_model/Task/createdAt.md new file mode 100644 index 000000000..84314f52c --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/createdAt.md @@ -0,0 +1,32 @@ + + + +# createdAt property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) createdAt + +_final_ + + + + + + +## Implementation + +```dart +final String createdAt; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/creator.md b/talawa-mobile-docs/models_task_task_model/Task/creator.md new file mode 100644 index 000000000..b5c8e0836 --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/creator.md @@ -0,0 +1,32 @@ + + + +# creator property + + + + + + + +[User](../../models_user_user_info/User-class.md) creator + +_final_ + + + + + + +## Implementation + +```dart +final User creator; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/deadline.md b/talawa-mobile-docs/models_task_task_model/Task/deadline.md new file mode 100644 index 000000000..21dd7e7e7 --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/deadline.md @@ -0,0 +1,32 @@ + + + +# deadline property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? deadline + +_final_ + + + + + + +## Implementation + +```dart +final String? deadline; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/description.md b/talawa-mobile-docs/models_task_task_model/Task/description.md new file mode 100644 index 000000000..ae3e97fef --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/description.md @@ -0,0 +1,32 @@ + + + +# description property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? description + +_final_ + + + + + + +## Implementation + +```dart +final String? description; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/event.md b/talawa-mobile-docs/models_task_task_model/Task/event.md new file mode 100644 index 000000000..9714bc41a --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/event.md @@ -0,0 +1,32 @@ + + + +# event property + + + + + + + +[Event](../../models_events_event_model/Event-class.md) event + +_final_ + + + + + + +## Implementation + +```dart +final Event event; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/id.md b/talawa-mobile-docs/models_task_task_model/Task/id.md new file mode 100644 index 000000000..672a052c2 --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/id.md @@ -0,0 +1,32 @@ + + + +# id property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) id + +_final_ + + + + + + +## Implementation + +```dart +final String id; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/Task/title.md b/talawa-mobile-docs/models_task_task_model/Task/title.md new file mode 100644 index 000000000..7c14a3864 --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/Task/title.md @@ -0,0 +1,32 @@ + + + +# title property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) title + +_final_ + + + + + + +## Implementation + +```dart +final String title; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_task_task_model/models_task_task_model-library.md b/talawa-mobile-docs/models_task_task_model/models_task_task_model-library.md new file mode 100644 index 000000000..3aed89965 --- /dev/null +++ b/talawa-mobile-docs/models_task_task_model/models_task_task_model-library.md @@ -0,0 +1,38 @@ + + + + +# task_model library + + + + + + + + + + + +## Classes + +##### [Task](../models_task_task_model/Task-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User-class.md b/talawa-mobile-docs/models_user_user_info/User-class.md new file mode 100644 index 000000000..2f8832131 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User-class.md @@ -0,0 +1,311 @@ + + + +# User class + + + + + + + + + +

This class creates a User model and returns a user instance.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [HiveObject](https://pub.dev/documentation/hive/2.2.3/hive/HiveObject-class.html) +- User + + + + + + +**Annotations** + +- @[HiveType](https://pub.dev/documentation/hive/2.2.3/hive/HiveType-class.html)(typeId: 1) + + +## Constructors + +[User](../models_user_user_info/User/User.md) ({[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)>? adminFor, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)>? createdOrganizations, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? email, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)>? joinedOrganizations, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? lastName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? authToken, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? refreshToken, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)>? membershipRequests}) + + + +[User.fromJson](../models_user_user_info/User/User.fromJson.md) ([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json1, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) fromOrg = false}) + + _factory_ + + +## Properties + +##### [adminFor](../models_user_user_info/User/adminFor.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)>? + + + + +_read / write_ + + + +##### [authToken](../models_user_user_info/User/authToken.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [box](https://pub.dev/documentation/hive/2.2.3/hive/HiveObjectMixin/box.html) → [BoxBase](https://pub.dev/documentation/hive/2.2.3/hive/BoxBase-class.html)? + + + +Get the box in which this object is stored. Returns null if object has +not been added to a box yet. +_read-onlyinherited_ + + + +##### [createdOrganizations](../models_user_user_info/User/createdOrganizations.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)>? + + + + +_read / write_ + + + +##### [email](../models_user_user_info/User/email.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [firstName](../models_user_user_info/User/firstName.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [id](../models_user_user_info/User/id.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [image](../models_user_user_info/User/image.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [isInBox](https://pub.dev/documentation/hive/2.2.3/hive/HiveObjectMixin/isInBox.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Returns whether this object is currently stored in a box. +_read-onlyinherited_ + + + +##### [joinedOrganizations](../models_user_user_info/User/joinedOrganizations.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)>? + + + + +_read / write_ + + + +##### [key](https://pub.dev/documentation/hive/2.2.3/hive/HiveObjectMixin/key.html) → dynamic + + + +Get the key associated with this object. Returns null if object has +not been added to a box yet. +_read-onlyinherited_ + + + +##### [lastName](../models_user_user_info/User/lastName.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [membershipRequests](../models_user_user_info/User/membershipRequests.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)>? + + + + +_read / write_ + + + +##### [refreshToken](../models_user_user_info/User/refreshToken.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [delete](https://pub.dev/documentation/hive/2.2.3/hive/HiveObjectMixin/delete.html)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +Deletes this object from the box it is stored in. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [print](../models_user_user_info/User/print.md)() void + + + + + + + + +##### [save](https://pub.dev/documentation/hive/2.2.3/hive/HiveObjectMixin/save.html)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +Persists this object. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [update](../models_user_user_info/User/update.md)([User](../models_user_user_info/User-class.md) details) void + + + + + + + + +##### [updateAdminFor](../models_user_user_info/User/updateAdminFor.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> orgList) void + + + + + + + + +##### [updateCreatedOrg](../models_user_user_info/User/updateCreatedOrg.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> orgList) void + + + + + + + + +##### [updateJoinedOrg](../models_user_user_info/User/updateJoinedOrg.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> orgList) void + + + + + + + + +##### [updateMemberRequestOrg](../models_user_user_info/User/updateMemberRequestOrg.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> orgList) void + + + + + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/User.fromJson.md b/talawa-mobile-docs/models_user_user_info/User/User.fromJson.md new file mode 100644 index 000000000..c568f69e4 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/User.fromJson.md @@ -0,0 +1,71 @@ + + + +# User.fromJson constructor + + + + + + + +User.fromJson([Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> json1, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) fromOrg = false}) + + + + + +## Implementation + +```dart +factory User.fromJson(Map json1, {bool fromOrg = false}) { + Map json; + if (fromOrg) { + json = json1; + } else { + json = json1['user'] as Map; + } + return User( + authToken: fromOrg ? ' ' : json1['accessToken'] as String?, + refreshToken: fromOrg ? ' ' : json1['refreshToken'] as String?, + id: json['_id'] as String?, + firstName: + json['firstName'] != null ? json['firstName'] as String? : null, + lastName: json['lastName'] != null ? json['lastName'] as String? : null, + email: json['email'] != null ? json['email'] as String? : null, + image: json['image'] != null ? json['image'] as String? : null, + adminFor: json['adminFor'] != null + ? (json['adminFor'] as List?) + ?.map((e) => OrgInfo.fromJson(e as Map)) + .toList() + : null, + createdOrganizations: json['createdOrganizations'] != null + ? (json['createdOrganizations'] as List?) + ?.map((e) => OrgInfo.fromJson(e as Map)) + .toList() + : null, + joinedOrganizations: json['joinedOrganizations'] != null + ? (json['joinedOrganizations'] as List?) + ?.map((e) => OrgInfo.fromJson(e as Map)) + .toList() + : null, + membershipRequests: json['membershipRequests'] != null + ? (json['membershipRequests'] as List?) + ?.map( + (e) => OrgInfo.fromJson( + e as Map, + memberRequest: true, + ), + ) + .toList() + : null, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/User.md b/talawa-mobile-docs/models_user_user_info/User/User.md new file mode 100644 index 000000000..2e34c1ed0 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/User.md @@ -0,0 +1,41 @@ + + + +# User constructor + + + + + + + +User({[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)>? adminFor, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)>? createdOrganizations, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? email, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)>? joinedOrganizations, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? lastName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? authToken, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? refreshToken, [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)>? membershipRequests}) + + + + + +## Implementation + +```dart +User({ + this.adminFor, + this.createdOrganizations, + this.email, + this.firstName, + this.id, + this.image, + this.joinedOrganizations, + this.lastName, + this.authToken, + this.refreshToken, + this.membershipRequests, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/adminFor.md b/talawa-mobile-docs/models_user_user_info/User/adminFor.md new file mode 100644 index 000000000..f32ef5aca --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/adminFor.md @@ -0,0 +1,36 @@ + + + +# adminFor property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(9) +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)>? adminFor + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(9) +List? adminFor = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/authToken.md b/talawa-mobile-docs/models_user_user_info/User/authToken.md new file mode 100644 index 000000000..f378cbba3 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/authToken.md @@ -0,0 +1,36 @@ + + + +# authToken property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(0) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? authToken + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(0) +String? authToken; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/createdOrganizations.md b/talawa-mobile-docs/models_user_user_info/User/createdOrganizations.md new file mode 100644 index 000000000..791251b39 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/createdOrganizations.md @@ -0,0 +1,36 @@ + + + +# createdOrganizations property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(8) +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)>? createdOrganizations + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(8) +List? createdOrganizations = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/email.md b/talawa-mobile-docs/models_user_user_info/User/email.md new file mode 100644 index 000000000..34b599f1b --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/email.md @@ -0,0 +1,36 @@ + + + +# email property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(5) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? email + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(5) +String? email; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/firstName.md b/talawa-mobile-docs/models_user_user_info/User/firstName.md new file mode 100644 index 000000000..b782ee7af --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/firstName.md @@ -0,0 +1,36 @@ + + + +# firstName property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(3) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstName + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(3) +String? firstName; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/id.md b/talawa-mobile-docs/models_user_user_info/User/id.md new file mode 100644 index 000000000..1f2e418e5 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/id.md @@ -0,0 +1,36 @@ + + + +# id property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(2) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? id + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(2) +String? id; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/image.md b/talawa-mobile-docs/models_user_user_info/User/image.md new file mode 100644 index 000000000..ff44e85e0 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/image.md @@ -0,0 +1,36 @@ + + + +# image property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(6) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? image + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(6) +String? image; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/joinedOrganizations.md b/talawa-mobile-docs/models_user_user_info/User/joinedOrganizations.md new file mode 100644 index 000000000..364ee575b --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/joinedOrganizations.md @@ -0,0 +1,36 @@ + + + +# joinedOrganizations property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(7) +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)>? joinedOrganizations + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(7) +List? joinedOrganizations = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/lastName.md b/talawa-mobile-docs/models_user_user_info/User/lastName.md new file mode 100644 index 000000000..b02f4c180 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/lastName.md @@ -0,0 +1,36 @@ + + + +# lastName property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(4) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? lastName + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(4) +String? lastName; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/membershipRequests.md b/talawa-mobile-docs/models_user_user_info/User/membershipRequests.md new file mode 100644 index 000000000..483f6a9df --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/membershipRequests.md @@ -0,0 +1,36 @@ + + + +# membershipRequests property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(10) +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)>? membershipRequests + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(10) +List? membershipRequests = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/print.md b/talawa-mobile-docs/models_user_user_info/User/print.md new file mode 100644 index 000000000..9887d704a --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/print.md @@ -0,0 +1,46 @@ + + + +# print method + + + + + + + + +void print +() + + + + + + + + +## Implementation + +```dart +void print() { + debugPrint('authToken: ${this.authToken}'); + debugPrint('refreshToken: ${this.refreshToken}'); + debugPrint('_id: ${this.id}'); + debugPrint('firstName: ${this.firstName}'); + debugPrint('lastName: ${this.lastName}'); + debugPrint('image: ${this.image}'); + debugPrint('email: ${this.email}'); + debugPrint('joinedOrganizations: ${this.joinedOrganizations}'); + debugPrint('adminFor: ${this.adminFor}'); + debugPrint('createdOrganizations: ${this.createdOrganizations}'); + debugPrint('membershipRequests: ${this.membershipRequests}'); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/refreshToken.md b/talawa-mobile-docs/models_user_user_info/User/refreshToken.md new file mode 100644 index 000000000..87c25db04 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/refreshToken.md @@ -0,0 +1,36 @@ + + + +# refreshToken property + + + + + + + +**Annotations** + +- @[HiveField](https://pub.dev/documentation/hive/2.2.3/hive/HiveField-class.html)(1) +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? refreshToken + +_read / write_ + + + + + + +## Implementation + +```dart +@HiveField(1) +String? refreshToken; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/update.md b/talawa-mobile-docs/models_user_user_info/User/update.md new file mode 100644 index 000000000..a11d0f023 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/update.md @@ -0,0 +1,45 @@ + + + +# update method + + + + + + + + +void update +([User](../../models_user_user_info/User-class.md) details) + + + + + + + + +## Implementation + +```dart +void update(User details) { + this.firstName = details.firstName; + this.lastName = details.lastName; + this.email = details.email; + this.image = details.image; + this.authToken = details.authToken; + this.refreshToken = details.refreshToken; + this.joinedOrganizations = details.joinedOrganizations; + this.createdOrganizations = details.createdOrganizations; + this.membershipRequests = details.membershipRequests; + this.adminFor = details.adminFor; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/updateAdminFor.md b/talawa-mobile-docs/models_user_user_info/User/updateAdminFor.md new file mode 100644 index 000000000..0d104cd52 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/updateAdminFor.md @@ -0,0 +1,36 @@ + + + +# updateAdminFor method + + + + + + + + +void updateAdminFor +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> orgList) + + + + + + + + +## Implementation + +```dart +void updateAdminFor(List orgList) { + this.adminFor = orgList; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/updateCreatedOrg.md b/talawa-mobile-docs/models_user_user_info/User/updateCreatedOrg.md new file mode 100644 index 000000000..384f2a363 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/updateCreatedOrg.md @@ -0,0 +1,36 @@ + + + +# updateCreatedOrg method + + + + + + + + +void updateCreatedOrg +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> orgList) + + + + + + + + +## Implementation + +```dart +void updateCreatedOrg(List orgList) { + this.createdOrganizations = orgList; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/updateJoinedOrg.md b/talawa-mobile-docs/models_user_user_info/User/updateJoinedOrg.md new file mode 100644 index 000000000..ce7eb1d64 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/updateJoinedOrg.md @@ -0,0 +1,36 @@ + + + +# updateJoinedOrg method + + + + + + + + +void updateJoinedOrg +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> orgList) + + + + + + + + +## Implementation + +```dart +void updateJoinedOrg(List orgList) { + this.joinedOrganizations = orgList; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/User/updateMemberRequestOrg.md b/talawa-mobile-docs/models_user_user_info/User/updateMemberRequestOrg.md new file mode 100644 index 000000000..a64ede2dc --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/User/updateMemberRequestOrg.md @@ -0,0 +1,36 @@ + + + +# updateMemberRequestOrg method + + + + + + + + +void updateMemberRequestOrg +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> orgList) + + + + + + + + +## Implementation + +```dart +void updateMemberRequestOrg(List orgList) { + this.membershipRequests = [...membershipRequests!, ...orgList]; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/UserAdapter-class.md b/talawa-mobile-docs/models_user_user_info/UserAdapter-class.md new file mode 100644 index 000000000..128bc0ea4 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/UserAdapter-class.md @@ -0,0 +1,130 @@ + + + +# UserAdapter class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [TypeAdapter](https://pub.dev/documentation/hive/2.2.3/hive/TypeAdapter-class.html)<[User](../models_user_user_info/User-class.md)> +- UserAdapter + + + + + + + + +## Constructors + +[UserAdapter](../models_user_user_info/UserAdapter/UserAdapter.md) () + + + + +## Properties + +##### [hashCode](../models_user_user_info/UserAdapter/hashCode.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyoverride_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [typeId](../models_user_user_info/UserAdapter/typeId.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +Called for type registration +_final_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [read](../models_user_user_info/UserAdapter/read.md)([BinaryReader](https://pub.dev/documentation/hive/2.2.3/hive/BinaryReader-class.html) reader) [User](../models_user_user_info/User-class.md) + + + +Is called when a value has to be decoded. +_override_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [write](../models_user_user_info/UserAdapter/write.md)([BinaryWriter](https://pub.dev/documentation/hive/2.2.3/hive/BinaryWriter-class.html) writer, [User](../models_user_user_info/User-class.md) obj) void + + + +Is called when a value has to be encoded. +_override_ + + + + + +## Operators + +##### [operator ==](../models_user_user_info/UserAdapter/operator_equals.md)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_override_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/UserAdapter/UserAdapter.md b/talawa-mobile-docs/models_user_user_info/UserAdapter/UserAdapter.md new file mode 100644 index 000000000..cd7b0178d --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/UserAdapter/UserAdapter.md @@ -0,0 +1,24 @@ + + + +# UserAdapter constructor + + + + + + + +UserAdapter() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/UserAdapter/hashCode.md b/talawa-mobile-docs/models_user_user_info/UserAdapter/hashCode.md new file mode 100644 index 000000000..8cc047694 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/UserAdapter/hashCode.md @@ -0,0 +1,65 @@ + + + +# hashCode property + + + + + + + + + +**Annotations** + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) hashCode + +_override_ + + + +

The hash code for this object.

+

A hash code is a single integer which represents the state of the object +that affects operator == comparisons.

+

All objects have hash codes. +The default hash code implemented by Object +represents only the identity of the object, +the same way as the default operator == implementation only considers objects +equal if they are identical (see identityHashCode).

+

If operator == is overridden to use the object state instead, +the hash code must also be changed to represent that state, +otherwise the object cannot be used in hash based data structures +like the default Set and Map implementations.

+

Hash codes must be the same for objects that are equal to each other +according to operator ==. +The hash code of an object should only change if the object changes +in a way that affects equality. +There are no further requirements for the hash codes. +They need not be consistent between executions of the same program +and there are no distribution guarantees.

+

Objects that are not equal are allowed to have the same hash code. +It is even technically allowed that all instances have the same hash code, +but if clashes happen too often, +it may reduce the efficiency of hash-based data structures +like HashSet or HashMap.

+

If a subclass overrides hashCode, it should override the +operator == operator as well to maintain consistency.

+ + + +## Implementation + +```dart +@override +int get hashCode => typeId.hashCode; +``` + + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/UserAdapter/operator_equals.md b/talawa-mobile-docs/models_user_user_info/UserAdapter/operator_equals.md new file mode 100644 index 000000000..2138164e9 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/UserAdapter/operator_equals.md @@ -0,0 +1,67 @@ + + + +# operator == method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) operator == +([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) + +_override_ + + + +

The equality operator.

+

The default behavior for all Objects is to return true if and +only if this object and other are the same object.

+

Override this method to specify a different equality relation on +a class. The overriding method must still be an equivalence relation. +That is, it must be:

+
    +
  • +

    Total: It must return a boolean for all arguments. It should never throw.

    +
  • +
  • +

    Reflexive: For all objects o, o == o must be true.

    +
  • +
  • +

    Symmetric: For all objects o1 and o2, o1 == o2 and o2 == o1 must +either both be true, or both be false.

    +
  • +
  • +

    Transitive: For all objects o1, o2, and o3, if o1 == o2 and +o2 == o3 are true, then o1 == o3 must be true.

    +
  • +
+

The method should also be consistent over time, +so whether two objects are equal should only change +if at least one of the objects was modified.

+

If a subclass overrides the equality operator, it should override +the hashCode method as well to maintain consistency.

+ + + +## Implementation + +```dart +@override +bool operator ==(Object other) => + identical(this, other) || + other is UserAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/UserAdapter/read.md b/talawa-mobile-docs/models_user_user_info/UserAdapter/read.md new file mode 100644 index 000000000..8431b02dd --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/UserAdapter/read.md @@ -0,0 +1,55 @@ + + + +# read method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[User](../../models_user_user_info/User-class.md) read +([BinaryReader](https://pub.dev/documentation/hive/2.2.3/hive/BinaryReader-class.html) reader) + +_override_ + + + +

Is called when a value has to be decoded.

+ + + +## Implementation + +```dart +@override +User read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return User( + adminFor: (fields[9] as List?)?.cast(), + createdOrganizations: (fields[8] as List?)?.cast(), + email: fields[5] as String?, + firstName: fields[3] as String?, + id: fields[2] as String?, + image: fields[6] as String?, + joinedOrganizations: (fields[7] as List?)?.cast(), + lastName: fields[4] as String?, + authToken: fields[0] as String?, + refreshToken: fields[1] as String?, + membershipRequests: (fields[10] as List?)?.cast(), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/UserAdapter/typeId.md b/talawa-mobile-docs/models_user_user_info/UserAdapter/typeId.md new file mode 100644 index 000000000..2fc04cff0 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/UserAdapter/typeId.md @@ -0,0 +1,37 @@ + + + +# typeId property + + + + + + + +**Annotations** + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) typeId + +_final_ + + + +

Called for type registration

+ + + +## Implementation + +```dart +@override +final int typeId = 1; +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/UserAdapter/write.md b/talawa-mobile-docs/models_user_user_info/UserAdapter/write.md new file mode 100644 index 000000000..5d2fbb7a7 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/UserAdapter/write.md @@ -0,0 +1,62 @@ + + + +# write method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void write +([BinaryWriter](https://pub.dev/documentation/hive/2.2.3/hive/BinaryWriter-class.html) writer, [User](../../models_user_user_info/User-class.md) obj) + +_override_ + + + +

Is called when a value has to be encoded.

+ + + +## Implementation + +```dart +@override +void write(BinaryWriter writer, User obj) { + writer + ..writeByte(11) + ..writeByte(0) + ..write(obj.authToken) + ..writeByte(1) + ..write(obj.refreshToken) + ..writeByte(2) + ..write(obj.id) + ..writeByte(3) + ..write(obj.firstName) + ..writeByte(4) + ..write(obj.lastName) + ..writeByte(5) + ..write(obj.email) + ..writeByte(6) + ..write(obj.image) + ..writeByte(7) + ..write(obj.joinedOrganizations) + ..writeByte(8) + ..write(obj.createdOrganizations) + ..writeByte(9) + ..write(obj.adminFor) + ..writeByte(10) + ..write(obj.membershipRequests); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/models_user_user_info/models_user_user_info-library.md b/talawa-mobile-docs/models_user_user_info/models_user_user_info-library.md new file mode 100644 index 000000000..2f7570090 --- /dev/null +++ b/talawa-mobile-docs/models_user_user_info/models_user_user_info-library.md @@ -0,0 +1,45 @@ + + + + +# user_info library + + + + + + + + + + + +## Classes + +##### [User](../models_user_user_info/User-class.md) + + + +This class creates a User model and returns a user instance. + + +##### [UserAdapter](../models_user_user_info/UserAdapter-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList-class.md b/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList-class.md new file mode 100644 index 000000000..84893bd0b --- /dev/null +++ b/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList-class.md @@ -0,0 +1,110 @@ + + + +# FetchPluginList class + + + + + + + + + +

This class fetch plugins list.

+ + + + +## Constructors + +[FetchPluginList](../plugins_fetch_plugin_list/FetchPluginList/FetchPluginList.md) () + +Constructor of the class. + + +## Properties + +##### [box](../plugins_fetch_plugin_list/FetchPluginList/box.md) ↔ [Box](https://pub.dev/documentation/hive/2.2.3/hive/Box-class.html) + + + +late initialize the box. +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [fetchList](../plugins_fetch_plugin_list/FetchPluginList/fetchList.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +Fetches plugins from server and stores them in Hive pluginBox. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/FetchPluginList.md b/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/FetchPluginList.md new file mode 100644 index 000000000..55304e7c1 --- /dev/null +++ b/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/FetchPluginList.md @@ -0,0 +1,32 @@ + + + +# FetchPluginList constructor + + + + + + + +FetchPluginList() + + +

Constructor of the class.

+ + + +## Implementation + +```dart +FetchPluginList() { + fetchList(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/box.md b/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/box.md new file mode 100644 index 000000000..a40276966 --- /dev/null +++ b/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/box.md @@ -0,0 +1,33 @@ + + + +# box property + + + + + + + +[Box](https://pub.dev/documentation/hive/2.2.3/hive/Box-class.html) box + +_read / write_ + + + +

late initialize the box.

+ + + +## Implementation + +```dart +late Box box; +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/fetchList.md b/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/fetchList.md new file mode 100644 index 000000000..4a819919a --- /dev/null +++ b/talawa-mobile-docs/plugins_fetch_plugin_list/FetchPluginList/fetchList.md @@ -0,0 +1,50 @@ + + + +# fetchList method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> fetchList +() + + + + + +

Fetches plugins from server and stores them in Hive pluginBox.

+

params: + None

+

returns:

+
    +
  • Future<void>: it returns Future of void
  • +
+ + + +## Implementation + +```dart +Future fetchList() async { + late final GraphQLClient client = graphqlConfig.clientToQuery(); + final QueryResult result = await client.query( + QueryOptions( + document: gql(queries.getPluginsList()), + ), + ); + box = Hive.box('pluginBox'); + box.put('plugins', result.data!["getPlugins"]); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_fetch_plugin_list/plugins_fetch_plugin_list-library.md b/talawa-mobile-docs/plugins_fetch_plugin_list/plugins_fetch_plugin_list-library.md new file mode 100644 index 000000000..a2d80f3b5 --- /dev/null +++ b/talawa-mobile-docs/plugins_fetch_plugin_list/plugins_fetch_plugin_list-library.md @@ -0,0 +1,38 @@ + + + + +# fetch_plugin_list library + + + + + + + + + + + +## Classes + +##### [FetchPluginList](../plugins_fetch_plugin_list/FetchPluginList-class.md) + + + +This class fetch plugins list. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider-class.md b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider-class.md new file mode 100644 index 000000000..85a8d898a --- /dev/null +++ b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider-class.md @@ -0,0 +1,225 @@ + + + +# TalawaPluginProvider class + + + + + + + + + +

TalwaPluginProvider provides ability to implement features as plugins

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- TalawaPluginProvider + + + + + + + + +## Constructors + +[TalawaPluginProvider](../plugins_talawa_plugin_provider/TalawaPluginProvider/TalawaPluginProvider.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, @[required](https://pub.dev/documentation/meta/1.8.0/meta/required-constant.html) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)? child, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) visible, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) pluginName}) + + _const_ + + +## Properties + +##### [child](../plugins_talawa_plugin_provider/TalawaPluginProvider/child.md) → [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)? + + + +child contains the widget for the plugin UI. +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [pluginName](../plugins_talawa_plugin_provider/TalawaPluginProvider/pluginName.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +name of plugin preferred with underscores(_) instead of spaces +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [visible](../plugins_talawa_plugin_provider/TalawaPluginProvider/visible.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +visible is the property that decides visibility of the UI. +_final_ + + + + + +## Methods + +##### [build](../plugins_talawa_plugin_provider/TalawaPluginProvider/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +build the Plugin combining local visibility property and serverVisible property +_override_ + + + +##### [checkFromPluginList](../plugins_talawa_plugin_provider/TalawaPluginProvider/checkFromPluginList.md)() [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +return bool decides the final visibility of the verifying from database and current OrgId + + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/TalawaPluginProvider.md b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/TalawaPluginProvider.md new file mode 100644 index 000000000..fc8bbf280 --- /dev/null +++ b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/TalawaPluginProvider.md @@ -0,0 +1,34 @@ + + + +# TalawaPluginProvider constructor + + + + + + +const +TalawaPluginProvider({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, @[required](https://pub.dev/documentation/meta/1.8.0/meta/required-constant.html) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)? child, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) visible, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) pluginName}) + + + + + +## Implementation + +```dart +const TalawaPluginProvider({ + Key? key, + @required this.child, + required this.visible, + required this.pluginName, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/build.md b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/build.md new file mode 100644 index 000000000..1c71ed24b --- /dev/null +++ b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/build.md @@ -0,0 +1,41 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

build the Plugin combining local visibility property and serverVisible property

+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + var serverVisible = false; + serverVisible = checkFromPluginList(); + return serverVisible || visible ? child! : Container(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/checkFromPluginList.md b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/checkFromPluginList.md new file mode 100644 index 000000000..b432bce74 --- /dev/null +++ b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/checkFromPluginList.md @@ -0,0 +1,60 @@ + + + +# checkFromPluginList method + + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) checkFromPluginList +() + + + + + +

return bool decides the final visibility of the verifying from database and current OrgId

+ + + +## Implementation + +```dart +bool checkFromPluginList() { + final UserConfig userConfig = locator(); + final Box box; + bool res = false; + box = Hive.box('pluginBox'); + var pluginList = box.get('plugins'); + pluginList ??= []; // if null then make it [] + + ///mapping over the list from the server + pluginList + .map( + (plugin) => { + if (plugin["pluginName"] == pluginName) + { + if (plugin["pluginInstallStatus"] as bool) + { + res = plugin["pluginInstallStatus"] as bool || + plugin["installedOrgs"] + .contains(userConfig.currentOrg.id) as bool + } + } + }, + ) + .toList(); + return res; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/child.md b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/child.md new file mode 100644 index 000000000..35ec65b91 --- /dev/null +++ b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/child.md @@ -0,0 +1,33 @@ + + + +# child property + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)? child + +_final_ + + + +

child contains the widget for the plugin UI.

+ + + +## Implementation + +```dart +final Widget? child; +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/pluginName.md b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/pluginName.md new file mode 100644 index 000000000..9825d8933 --- /dev/null +++ b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/pluginName.md @@ -0,0 +1,33 @@ + + + +# pluginName property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) pluginName + +_final_ + + + +

name of plugin preferred with underscores(_) instead of spaces

+ + + +## Implementation + +```dart +final String pluginName; +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/visible.md b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/visible.md new file mode 100644 index 000000000..bacba07b8 --- /dev/null +++ b/talawa-mobile-docs/plugins_talawa_plugin_provider/TalawaPluginProvider/visible.md @@ -0,0 +1,33 @@ + + + +# visible property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) visible + +_final_ + + + +

visible is the property that decides visibility of the UI.

+ + + +## Implementation + +```dart +final bool visible; +``` + + + + + + + diff --git a/talawa-mobile-docs/plugins_talawa_plugin_provider/plugins_talawa_plugin_provider-library.md b/talawa-mobile-docs/plugins_talawa_plugin_provider/plugins_talawa_plugin_provider-library.md new file mode 100644 index 000000000..e6d50cae7 --- /dev/null +++ b/talawa-mobile-docs/plugins_talawa_plugin_provider/plugins_talawa_plugin_provider-library.md @@ -0,0 +1,38 @@ + + + + +# talawa_plugin_provider library + + + + + + + + + + + +## Classes + +##### [TalawaPluginProvider](../plugins_talawa_plugin_provider/TalawaPluginProvider-class.md) + + + +TalwaPluginProvider provides ability to implement features as plugins + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/router/generateRoute.md b/talawa-mobile-docs/router/generateRoute.md new file mode 100644 index 000000000..cdb9d89fb --- /dev/null +++ b/talawa-mobile-docs/router/generateRoute.md @@ -0,0 +1,294 @@ + + + +# generateRoute function + + + + + + + + + + +[Route](https://api.flutter.dev/flutter/widgets/Route-class.html) generateRoute +([RouteSettings](https://api.flutter.dev/flutter/widgets/RouteSettings-class.html) settings) + + + + + +

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

+ + + +## Implementation + +```dart +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. + // We use the name to determine which view to return. + switch (settings.name) { + // Returns the SplashScreen + case Routes.splashScreen: + final int mainScreenIndex = settings.arguments! as int; + return MaterialPageRoute( + builder: (context) => SplashScreen( + key: const Key('SplashScreen'), + mainScreenIndex: mainScreenIndex, + ), + ); + + // Returns the SelectLanguage Widget + case Routes.languageSelectionRoute: + return MaterialPageRoute( + builder: (context) => const SelectLanguage(key: Key('SelectLanguage')), + ); + + // Returns the SetUrl Widget + case Routes.setUrlScreen: + final String uri = settings.arguments!.toString(); + return MaterialPageRoute( + builder: (context) => SetUrl( + key: const Key('SetUrl'), + uri: uri, + ), + ); + + // Returns the Login Widget + case Routes.loginScreen: + return MaterialPageRoute( + builder: (context) => const Login(key: Key('Login')), + ); + + // Returns the SelectOrganization Widget + case Routes.selectOrgScreen: + final String id = settings.arguments!.toString(); + return CupertinoPageRoute( + builder: (context) => SelectOrganization( + key: const Key('Signup'), + selectedOrgId: id, + ), + ); + + // Returns the SignUpDetails Widget + case Routes.signupDetailScreen: + final OrgInfo org = settings.arguments! as OrgInfo; + return CupertinoPageRoute( + builder: (context) => SignUpDetails( + key: const Key('Signup'), + selectedOrg: org, + ), + ); + + // Returns the WaitingPge Widget + case Routes.waitingScreen: + return CupertinoPageRoute( + builder: (context) => const WaitingPage(key: Key('Waiting')), + ); + + // Returns the Recover Widget + case Routes.recoverScreen: + return MaterialPageRoute( + builder: (context) => const Recover(key: Key('Recover')), + ); + + // Returns the ChangePass Widget + case Routes.updateScreen: + return MaterialPageRoute( + builder: (context) => const ChangePass(key: Key('Update')), + ); + + // Returns the OrganizationFeed Widget + case Routes.homeScreen: + return MaterialPageRoute( + builder: (context) => const OrganizationFeed(key: Key('HomeScreen')), + ); + + // Returns the MainScreen Widget + case Routes.mainScreen: + final MainScreenArgs mainScreenArgs = + settings.arguments! as MainScreenArgs; + // final bool fromSignUp = settings.arguments! as bool; + return MaterialPageRoute( + builder: (context) => MainScreen( + key: const Key('MainScreen'), + mainScreenArgs: mainScreenArgs, + ), + ); + + // Returns the IndividualPostView Widget + case Routes.individualPost: + final Post post = settings.arguments! as Post; + return MaterialPageRoute( + builder: (context) => IndividualPostView( + key: const Key('IndividualPost'), + post: post, + ), + ); + + // Returns the PinnedPostPgae Widget + case Routes.pinnedPostPage: + final List pinnedPosts = settings.arguments! as List; + return MaterialPageRoute( + builder: (context) => PinnedPostPage(pinnedPosts: pinnedPosts), + ); + + // Returns the ExploreEvents Widget + case Routes.exploreEventsScreen: + return MaterialPageRoute( + builder: (context) => const ExploreEvents(key: Key('ExploreEvents')), + ); + + // Returns the EventInfoPage Widget + case Routes.eventInfoPage: + final Map args = + settings.arguments! as Map; + return MaterialPageRoute( + builder: (context) => EventInfoPage( + key: const Key('EventInfo'), + args: args, + ), + ); + + // Returns the CreateEventPage Widget + case Routes.createEventPage: + return MaterialPageRoute( + builder: (context) => const CreateEventPage(key: Key('CreateEvent')), + ); + + // Returns the ProfilePage Widget + case Routes.profilePage: + return MaterialPageRoute( + builder: (context) => const ProfilePage(key: Key('Profile')), + ); + + // Returns the EditProfilePage Widget + case Routes.editProfilePage: + return MaterialPageRoute( + builder: (context) => const EditProfilePage(key: Key('EditProfile')), + ); + + // Returns the JoinOrganizationAfterAuth Widget + case Routes.joinOrg: + final String id = settings.arguments!.toString(); + return MaterialPageRoute( + builder: (context) => JoinOrganisationAfterAuth( + key: const Key('JoinOrganisationAfterAuth'), + orgId: id, + ), + ); + + 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; + return MaterialPageRoute( + builder: (context) => EditEventPage( + key: const Key('EditEvent'), + event: event, + ), + ); + + // Returns the AppSettingsPage Widget + case Routes.appSettings: + return MaterialPageRoute( + builder: (context) => const AppSettingsPage(key: Key('AppSettings')), + ); + + // Returns the ChatMessageScreen Widget + case Routes.chatMessageScreen: + final List arguments = settings.arguments! as List; + final String chatId = arguments[0] as String; + final DirectChatViewModel model = arguments[1] as DirectChatViewModel; + return MaterialPageRoute( + builder: (context) => ChatMessageScreen( + key: const Key('ChatMessageScreen'), + chatId: chatId, + model: model, + ), + ); + + // Returns the MapScreen Widget + case Routes.mapScreen: + final arguments = settings.arguments! as Map; + final model = arguments['model'] as CreateEventViewModel?; + final latitude = arguments['latitude'] as double; + final longitude = arguments['longitude'] as double; + return MaterialPageRoute( + builder: (context) => MapScreen( + model, + latitude, + longitude, + key: const Key('MapScreen'), + ), + ); + case Routes.calendar: + return MaterialPageRoute( + builder: (context) => EventCalendar( + settings.arguments! as List, + key: const Key('Calendar'), + ), + ); + case Routes.eventTasks: + final eventId = settings.arguments! as String; + return MaterialPageRoute( + builder: (context) => EventTasksPage( + eventId: eventId, + key: const Key('EventTasks'), + ), + ); + case Routes.userTasks: + return MaterialPageRoute( + builder: (context) => const UserTasksPage( + key: Key('UserTasks'), + ), + ); + case Routes.addTask: + final eventId = settings.arguments! as String; + return MaterialPageRoute( + builder: (context) => CreateTaskPage( + key: const Key('AddTask'), + eventId: eventId, + ), + ); + case Routes.editTask: + final task = settings.arguments! as Task; + return MaterialPageRoute( + builder: (context) => EditTaskPage( + key: const Key('EditTask'), + task: task, + ), + ); + // Returns the DemoPageView Widget by default + case Routes.selectContact: + return MaterialPageRoute( + builder: (context) => const SelectContact(key: Key('selectContact')), + ); + default: + return MaterialPageRoute( + builder: (context) => const DemoPageView( + key: Key("DemoPage"), + ), + ); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/router/router-library.md b/talawa-mobile-docs/router/router-library.md new file mode 100644 index 000000000..c8ba8c929 --- /dev/null +++ b/talawa-mobile-docs/router/router-library.md @@ -0,0 +1,41 @@ + + + + +# router library + + + + + + + + + + + + + + + + +## Functions + +##### [generateRoute](../router/generateRoute.md)([RouteSettings](https://api.flutter.dev/flutter/widgets/RouteSettings-class.html) settings) [Route](https://api.flutter.dev/flutter/widgets/Route-class.html) + + + +The MaterialApp provides us with a property called generateRoute where +we can pass in a Function that returns a Route and takes in RouteSettings + + + + + + + + + + + + diff --git a/talawa-mobile-docs/search.md b/talawa-mobile-docs/search.md new file mode 100644 index 000000000..0fedbdcfd --- /dev/null +++ b/talawa-mobile-docs/search.md @@ -0,0 +1,6 @@ +# 404 + +Oops, something's gone wrong :-( + +You've tried to visit a page that doesn't exist. Luckily this site has other +[pages](index.md). diff --git a/talawa-mobile-docs/services_chat_service/ChatService-class.md b/talawa-mobile-docs/services_chat_service/ChatService-class.md new file mode 100644 index 000000000..113930640 --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/ChatService-class.md @@ -0,0 +1,152 @@ + + + +# ChatService class + + + + + + + + + +

ChatService class provides different services for direct chats of the user.

+

Services include:

+
    +
  • sendMessageToDirectChat - used to send messages.
  • +
  • getDirectChatsByUserId - used to get all chats by the user.
  • +
  • getDirectChatMessagesByChatId - used to get all chats of a user with another user.
  • +
+ + + + +## Constructors + +[ChatService](../services_chat_service/ChatService/ChatService.md) () + + + + +## Properties + +##### [chatListStream](../services_chat_service/ChatService/chatListStream.md) → [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[ChatListTileDataModel](../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md)> + + + + +_read-only_ + + + +##### [chatMessagesStream](../services_chat_service/ChatService/chatMessagesStream.md) → [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[ChatMessage](../models_chats_chat_message/ChatMessage-class.md)> + + + + +_read-only_ + + + +##### [chatStream](../services_chat_service/ChatService/chatStream.md) ↔ [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[QueryResult](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/QueryResult-class.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?>> + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [getDirectChatMessagesByChatId](../services_chat_service/ChatService/getDirectChatMessagesByChatId.md)(dynamic chatId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to get all the chat messages of a particular chat by the user. + + + + +##### [getDirectChatsByUserId](../services_chat_service/ChatService/getDirectChatsByUserId.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to get all the chats by the user. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [sendMessageToDirectChat](../services_chat_service/ChatService/sendMessageToDirectChat.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) messageContent) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to send the message in the direct chats. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_chat_service/ChatService/ChatService.md b/talawa-mobile-docs/services_chat_service/ChatService/ChatService.md new file mode 100644 index 000000000..3dfdea61a --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/ChatService/ChatService.md @@ -0,0 +1,33 @@ + + + +# ChatService constructor + + + + + + + +ChatService() + + + + + +## Implementation + +```dart +ChatService() { + _dbFunctions = locator(); + _chatListStream = _chatController.stream.asBroadcastStream(); + _chatMessagesStream = _chatMessageController.stream.asBroadcastStream(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_chat_service/ChatService/chatListStream.md b/talawa-mobile-docs/services_chat_service/ChatService/chatListStream.md new file mode 100644 index 000000000..2f7d5759e --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/ChatService/chatListStream.md @@ -0,0 +1,35 @@ + + + +# chatListStream property + + + + + + + + + +[Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[ChatListTileDataModel](../../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md)> chatListStream + + + + + + + + +## Implementation + +```dart +Stream get chatListStream => _chatListStream; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_chat_service/ChatService/chatMessagesStream.md b/talawa-mobile-docs/services_chat_service/ChatService/chatMessagesStream.md new file mode 100644 index 000000000..740897507 --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/ChatService/chatMessagesStream.md @@ -0,0 +1,35 @@ + + + +# chatMessagesStream property + + + + + + + + + +[Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[ChatMessage](../../models_chats_chat_message/ChatMessage-class.md)> chatMessagesStream + + + + + + + + +## Implementation + +```dart +Stream get chatMessagesStream => _chatMessagesStream; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_chat_service/ChatService/chatStream.md b/talawa-mobile-docs/services_chat_service/ChatService/chatStream.md new file mode 100644 index 000000000..be41fbc55 --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/ChatService/chatStream.md @@ -0,0 +1,32 @@ + + + +# chatStream property + + + + + + + +[Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[QueryResult](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/QueryResult-class.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?>> chatStream + +_read / write_ + + + + + + +## Implementation + +```dart +late Stream chatStream; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_chat_service/ChatService/getDirectChatMessagesByChatId.md b/talawa-mobile-docs/services_chat_service/ChatService/getDirectChatMessagesByChatId.md new file mode 100644 index 000000000..bf6686a9c --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/ChatService/getDirectChatMessagesByChatId.md @@ -0,0 +1,52 @@ + + + +# getDirectChatMessagesByChatId method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getDirectChatMessagesByChatId +(dynamic chatId) + + + + + +

This function is used to get all the chat messages of a particular chat by the user.

+

parameters required:

+
    +
  • chatId - id of the direct chat.
  • +
+ + + +## Implementation + +```dart +Future getDirectChatMessagesByChatId(chatId) async { + // trigger graphQL query to get all the chat messages of a particular chat using [chatId]. + final String query = + ChatQueries().fetchDirectChatMessagesByChatId(chatId as String); + + final result = await _dbFunctions.gqlAuthQuery(query); + + final messages = result.data['directChatsMessagesByChatID'] as List; + + messages.forEach((message) { + final chatMessage = ChatMessage.fromJson(message as Map); + _chatMessageController.add(chatMessage); + }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_chat_service/ChatService/getDirectChatsByUserId.md b/talawa-mobile-docs/services_chat_service/ChatService/getDirectChatsByUserId.md new file mode 100644 index 000000000..0ae91a2ae --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/ChatService/getDirectChatsByUserId.md @@ -0,0 +1,58 @@ + + + +# getDirectChatsByUserId method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getDirectChatsByUserId +() + + + + + +

This function is used to get all the chats by the user.

+

parameters required:

+
    +
  • usedId - current user id, to get all the direct chats associated with this id.
  • +
+ + + +## Implementation + +```dart +Future getDirectChatsByUserId() async { + final userId = _userConfig.currentUser.id; + + // trigger graphQL query to get all the chats of the user using [userId]. + final String query = ChatQueries().fetchDirectChatsByUserId(userId!); + + final result = await _dbFunctions.gqlAuthQuery(query); + + final directMessageList = result.data['directChatsByUserID'] as List; + + // loop through the result [directMessageList] and append the element to the directChat. + directMessageList.forEach((chat) { + final directChat = + ChatListTileDataModel.fromJson(chat as Map); + + directChat.users!.forEach((element) { + if (element.id != userId) _chatController.add(directChat); + }); + }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_chat_service/ChatService/sendMessageToDirectChat.md b/talawa-mobile-docs/services_chat_service/ChatService/sendMessageToDirectChat.md new file mode 100644 index 000000000..903348164 --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/ChatService/sendMessageToDirectChat.md @@ -0,0 +1,57 @@ + + + +# sendMessageToDirectChat method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> sendMessageToDirectChat +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) messageContent) + + + + + +

This function is used to send the message in the direct chats.

+

parameters required:

+
    +
  • chatId - id of the direct chat where message need to be send.
  • +
  • messageContent - the text that need to be send.
  • +
+ + + +## Implementation + +```dart +Future sendMessageToDirectChat( + String chatId, + String messageContent, +) async { + // trigger graphQL mutation to push the message in the Database. + final result = await _dbFunctions.gqlAuthMutation( + ChatQueries().sendMessageToDirectChat(), + variables: {"chatId": chatId, "messageContent": messageContent}, + ); + + final message = ChatMessage.fromJson( + result.data['sendMessageToDirectChat'] as Map, + ); + + _chatMessageController.add(message); + + debugPrint(result.data.toString()); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_chat_service/services_chat_service-library.md b/talawa-mobile-docs/services_chat_service/services_chat_service-library.md new file mode 100644 index 000000000..a59fdbcae --- /dev/null +++ b/talawa-mobile-docs/services_chat_service/services_chat_service-library.md @@ -0,0 +1,38 @@ + + + + +# chat_service library + + + + + + + + + + + +## Classes + +##### [ChatService](../services_chat_service/ChatService-class.md) + + + +ChatService class provides different services for direct chats of the user. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_comment_service/CommentService-class.md b/talawa-mobile-docs/services_comment_service/CommentService-class.md new file mode 100644 index 000000000..b3599d7f7 --- /dev/null +++ b/talawa-mobile-docs/services_comment_service/CommentService-class.md @@ -0,0 +1,115 @@ + + + +# CommentService class + + + + + + + + + +

CommentService class have different member functions which provides service in the context of commenting.

+

Services include:

+
    +
  • createComments - used to add comment on the post.
  • +
  • getCommentsForPost - used to get all comments on the post.
  • +
+ + + + +## Constructors + +[CommentService](../services_comment_service/CommentService/CommentService.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createComments](../services_comment_service/CommentService/createComments.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) text) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to add comment on the post. + + + + +##### [getCommentsForPost](../services_comment_service/CommentService/getCommentsForPost.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to fetch all comments on the post. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_comment_service/CommentService/CommentService.md b/talawa-mobile-docs/services_comment_service/CommentService/CommentService.md new file mode 100644 index 000000000..c59a7cc7e --- /dev/null +++ b/talawa-mobile-docs/services_comment_service/CommentService/CommentService.md @@ -0,0 +1,31 @@ + + + +# CommentService constructor + + + + + + + +CommentService() + + + + + +## Implementation + +```dart +CommentService() { + _dbFunctions = locator(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_comment_service/CommentService/createComments.md b/talawa-mobile-docs/services_comment_service/CommentService/createComments.md new file mode 100644 index 000000000..741c7348c --- /dev/null +++ b/talawa-mobile-docs/services_comment_service/CommentService/createComments.md @@ -0,0 +1,53 @@ + + + +# createComments method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> createComments +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) text) + + + + + +

This function is used to add comment on the post.

+

parameters:

+
    +
  • postId - Post id where comment need to be added.
  • +
  • text - content of the comment.
  • +
+ + + +## Implementation + +```dart +Future createComments(String postId, String text) async { + print("comment service called"); + final String createCommentQuery = CommentQueries().createComment(); + final result = await _dbFunctions.gqlAuthMutation( + createCommentQuery, + variables: { + 'postId': postId, //Add your variables here + 'text': text + }, + ); + print("comment added"); + print(result); + return result; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_comment_service/CommentService/getCommentsForPost.md b/talawa-mobile-docs/services_comment_service/CommentService/getCommentsForPost.md new file mode 100644 index 000000000..956c67208 --- /dev/null +++ b/talawa-mobile-docs/services_comment_service/CommentService/getCommentsForPost.md @@ -0,0 +1,46 @@ + + + +# getCommentsForPost method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) getCommentsForPost +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postId) + + + + + +

This function is used to fetch all comments on the post.

+

parameters:

+
    +
  • postId - Post id for which comments need to be fetched.
  • +
+ + + +## Implementation + +```dart +Future getCommentsForPost(String postId) async { + final String getCommmentQuery = CommentQueries().getPostsComments(postId); + final result = await _dbFunctions.gqlAuthMutation(getCommmentQuery); + if (result.data != null) { + return result.data["commentsByPost"] as List; + } + return []; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_comment_service/services_comment_service-library.md b/talawa-mobile-docs/services_comment_service/services_comment_service-library.md new file mode 100644 index 000000000..392683045 --- /dev/null +++ b/talawa-mobile-docs/services_comment_service/services_comment_service-library.md @@ -0,0 +1,38 @@ + + + + +# comment_service library + + + + + + + + + + + +## Classes + +##### [CommentService](../services_comment_service/CommentService-class.md) + + + +CommentService class have different member functions which provides service in the context of commenting. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions-class.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions-class.md new file mode 100644 index 000000000..90c047dce --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions-class.md @@ -0,0 +1,264 @@ + + + +# DataBaseMutationFunctions class + + + + + + + + + +

DataBaseMutationFunctions class provides different services that are under the context of graphQL mutations and queries.

+

Services include:

+
    +
  • encounteredExceptionOrError
  • +
  • gqlAuthQuery
  • +
  • gqlAuthMutation
  • +
  • gqlNonAuthMutation
  • +
  • gqlNonAuthQuery
  • +
  • refreshAccessToken
  • +
  • fetchOrgById
  • +
+ + + + +## Constructors + +[DataBaseMutationFunctions](../services_database_mutation_functions/DataBaseMutationFunctions/DataBaseMutationFunctions.md) () + + + + +## Properties + +##### [clientAuth](../services_database_mutation_functions/DataBaseMutationFunctions/clientAuth.md) ↔ [GraphQLClient](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/GraphQLClient-class.html) + + + +Client Auth for handling authenticated request. +_read / write_ + + + +##### [clientNonAuth](../services_database_mutation_functions/DataBaseMutationFunctions/clientNonAuth.md) ↔ [GraphQLClient](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/GraphQLClient-class.html) + + + +Client Auth for handling non-authenticated request. +_read / write_ + + + +##### [emailAccountPresent](../services_database_mutation_functions/DataBaseMutationFunctions/emailAccountPresent.md) ↔ [GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) + + + +Graphql error for handling. +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [memberRequestExist](../services_database_mutation_functions/DataBaseMutationFunctions/memberRequestExist.md) ↔ [GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) + + + +Graphql error for handling. +_read / write_ + + + +##### [notifFeatureNotInstalled](../services_database_mutation_functions/DataBaseMutationFunctions/notifFeatureNotInstalled.md) ↔ [GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) + + + +Graphql error for handling. +_read / write_ + + + +##### [organizationNotFound](../services_database_mutation_functions/DataBaseMutationFunctions/organizationNotFound.md) ↔ [GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) + + + +Graphql error for handling. +_read / write_ + + + +##### [refreshAccessTokenExpiredException](../services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessTokenExpiredException.md) ↔ [GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) + + + +Graphql error for handling. +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [userNotAuthenticated](../services_database_mutation_functions/DataBaseMutationFunctions/userNotAuthenticated.md) ↔ [GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) + + + +Graphql error for handling. +_read / write_ + + + +##### [userNotFound](../services_database_mutation_functions/DataBaseMutationFunctions/userNotFound.md) ↔ [GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) + + + +Graphql error for handling. +_read / write_ + + + +##### [wrongCredentials](../services_database_mutation_functions/DataBaseMutationFunctions/wrongCredentials.md) ↔ [GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) + + + +Graphql error for handling. +_read / write_ + + + + + +## Methods + +##### [encounteredExceptionOrError](../services_database_mutation_functions/DataBaseMutationFunctions/encounteredExceptionOrError.md)([OperationException](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/OperationException-class.html) exception, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showSnackBar = true}) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? + + + +This function is used to check if any exceptions or error encountered. The return type is boolean. + + + + +##### [fetchOrgById](../services_database_mutation_functions/DataBaseMutationFunctions/fetchOrgById.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) id) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function fetch the organization using the id passed. + + + + +##### [gqlAuthMutation](../services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthMutation.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) mutation, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? variables}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to run the graph-ql mutation for authenticated user. + + + + +##### [gqlAuthQuery](../services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthQuery.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) query, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? variables}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to run the graph-ql query for authentication. + + + + +##### [gqlNonAuthMutation](../services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthMutation.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) mutation, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? variables, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) reCall = true}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to run the graph-ql mutation to authenticate the non signed-in user. + + + + +##### [gqlNonAuthQuery](../services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthQuery.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) query, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? variables}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[QueryResult](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/QueryResult-class.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?>?> + + + +This function is used to run the graph-ql query for the non signed-in user. + + + + +##### [init](../services_database_mutation_functions/DataBaseMutationFunctions/init.md)() void + + + +initialization function. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [refreshAccessToken](../services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessToken.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) refreshToken) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + +This function is used to refresh the Authenication token to access the application. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/DataBaseMutationFunctions.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/DataBaseMutationFunctions.md new file mode 100644 index 000000000..cd5b61c64 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/DataBaseMutationFunctions.md @@ -0,0 +1,24 @@ + + + +# DataBaseMutationFunctions constructor + + + + + + + +DataBaseMutationFunctions() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/clientAuth.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/clientAuth.md new file mode 100644 index 000000000..4c673497f --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/clientAuth.md @@ -0,0 +1,33 @@ + + + +# clientAuth property + + + + + + + +[GraphQLClient](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/GraphQLClient-class.html) clientAuth + +_read / write_ + + + +

Client Auth for handling authenticated request.

+ + + +## Implementation + +```dart +late GraphQLClient clientAuth; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/clientNonAuth.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/clientNonAuth.md new file mode 100644 index 000000000..4b73d5782 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/clientNonAuth.md @@ -0,0 +1,33 @@ + + + +# clientNonAuth property + + + + + + + +[GraphQLClient](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/GraphQLClient-class.html) clientNonAuth + +_read / write_ + + + +

Client Auth for handling non-authenticated request.

+ + + +## Implementation + +```dart +late GraphQLClient clientNonAuth; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/emailAccountPresent.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/emailAccountPresent.md new file mode 100644 index 000000000..62e143ed2 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/emailAccountPresent.md @@ -0,0 +1,34 @@ + + + +# emailAccountPresent property + + + + + + + +[GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) emailAccountPresent + +_read / write_ + + + +

Graphql error for handling.

+ + + +## Implementation + +```dart +GraphQLError emailAccountPresent = + const GraphQLError(message: 'Email address already exists'); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/encounteredExceptionOrError.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/encounteredExceptionOrError.md new file mode 100644 index 000000000..f08740a42 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/encounteredExceptionOrError.md @@ -0,0 +1,175 @@ + + + +# encounteredExceptionOrError method + + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? encounteredExceptionOrError +([OperationException](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/OperationException-class.html) exception, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showSnackBar = true}) + + + + + +

This function is used to check if any exceptions or error encountered. The return type is boolean.

+

params:

+
    +
  • exception: OperationException which occur when calling for graphql post request
  • +
  • showSnackBar: Tell if the the place where this function is called wants a SnackBar on error
  • +
+

returns:

+
    +
  • bool?: returns a bool whether or not their is error, can be null
  • +
+ + + +## Implementation + +```dart +bool? encounteredExceptionOrError( + OperationException exception, { + bool showSnackBar = true, +}) { + // if server link is wrong. + if (exception.linkException != null) { + // debugPrint(exception.linkException.toString()); + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorSnackBar( + "Server not running/wrong url", + MessageType.info, + ), + ); + } + return false; + } + + /// looping through graphQL errors. + debugPrint(exception.graphqlErrors.toString()); + for (int i = 0; i < exception.graphqlErrors.length; i++) { + // if the error message is "Access Token has expired. Please refresh session.: Undefined location" + if (exception.graphqlErrors[i].message == + refreshAccessTokenExpiredException.message) { + print('token refreshed'); + refreshAccessToken(userConfig.currentUser.refreshToken!).then( + (value) => graphqlConfig + .getToken() + .then((value) => databaseFunctions.init()), + ); + print('client refreshed'); + return true; + } + + /// if the error message is "User is not authenticated" + if (exception.graphqlErrors[i].message == userNotAuthenticated.message) { + print('client refreshed'); + refreshAccessToken(userConfig.currentUser.refreshToken!).then( + (value) => graphqlConfig + .getToken() + .then((value) => databaseFunctions.init()), + ); + return true; + } + + /// if the error message is "User not found" + if (exception.graphqlErrors[i].message == userNotFound.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "No account registered with this email", + MessageType.error, + ), + ); + } + return false; + } + + /// if the error message is "Membership Request already exists" + if (exception.graphqlErrors[i].message == memberRequestExist.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Membership request already exist", + MessageType.error, + ), + ); + } + return false; + } + + /// if the error message is "Invalid credentials" + if (exception.graphqlErrors[i].message == wrongCredentials.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Enter a valid password", + MessageType.error, + ), + ); + } + return false; + } + + /// if the error message is "Organization not found" + if (exception.graphqlErrors[i].message == organizationNotFound.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Organization Not Found", + MessageType.error, + ), + ); + } + return false; + } + + /// if the error message is "Email address already exists" + if (exception.graphqlErrors[i].message == emailAccountPresent.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Account with this email already registered", + MessageType.error, + ), + ); + } + return false; + } + if (exception.graphqlErrors[i].message == + notifFeatureNotInstalled.message) { + if (showSnackBar) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Notification Feature is not installed", + MessageType.error, + ), + ); + } + return false; + } + } + // if the error is unknown + + WidgetsBinding.instance.addPostFrameCallback( + (_) => navigationService.showTalawaErrorDialog( + "Something went wrong!", + MessageType.error, + ), + ); + return false; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/fetchOrgById.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/fetchOrgById.md new file mode 100644 index 000000000..8fb60f819 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/fetchOrgById.md @@ -0,0 +1,60 @@ + + + +# fetchOrgById method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) fetchOrgById +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) id) + + + + + +

This function fetch the organization using the id passed.

+

params:

+
    +
  • id: id that identifies a particular org
  • +
+

returns:

+
    +
  • Future<dynamic>: it returns Future of dynamic
  • +
+ + + +## Implementation + +```dart +Future fetchOrgById(String id) async { + final QueryResult result = await clientNonAuth + .mutate(MutationOptions(document: gql(_query.fetchOrgById(id)))); + // if there is an error or exception in [result] + if (result.hasException) { + final exception = encounteredExceptionOrError(result.exception!); + if (exception!) { + fetchOrgById(id); + } + } else if (result.data != null && result.isConcrete) { + return OrgInfo.fromJson( + // ignore: collection_methods_unrelated_type + (result.data!['organizations'] as Map)[0] + as Map, + ); + } + return false; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthMutation.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthMutation.md new file mode 100644 index 000000000..ea11a8fe9 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthMutation.md @@ -0,0 +1,64 @@ + + + +# gqlAuthMutation method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) gqlAuthMutation +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) mutation, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? variables}) + + + + + +

This function is used to run the graph-ql mutation for authenticated user.

+

params:

+
    +
  • mutation: mutation is used to change/add/delete data in graphql, for more info read graphql docs
  • +
  • variables: variables to be passed with mutation
  • +
+

returns:

+
    +
  • Future<dynamic>: it returns Future of dynamic
  • +
+ + + +## Implementation + +```dart +Future gqlAuthMutation( + String mutation, { + Map? variables, +}) async { + final QueryResult result = await clientAuth.mutate( + MutationOptions( + document: gql(mutation), + variables: variables ?? {}, + ), + ); + // if there is an error or exception in [result] + if (result.hasException) { + final exception = encounteredExceptionOrError(result.exception!); + if (exception!) { + gqlAuthMutation(mutation, variables: variables); + } + } else if (result.data != null && result.isConcrete) { + return result; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthQuery.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthQuery.md new file mode 100644 index 000000000..a90ff7cf5 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlAuthQuery.md @@ -0,0 +1,63 @@ + + + +# gqlAuthQuery method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) gqlAuthQuery +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) query, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? variables}) + + + + + +

This function is used to run the graph-ql query for authentication.

+

params:

+
    +
  • query: query is used to fetch data in graphql, for more info read graphql docs
  • +
  • variables: variables to be passed with query
  • +
+

returns:

+
    +
  • Future<dynamic>: it returns Future of dynamic
  • +
+ + + +## Implementation + +```dart +Future gqlAuthQuery( + String query, { + Map? variables, +}) async { + final QueryOptions options = QueryOptions( + document: gql(query), + variables: variables ?? {}, + ); + final QueryResult result = await clientAuth.query(options); + // if there is an error or exception in [result] + if (result.hasException) { + final exception = encounteredExceptionOrError(result.exception!); + if (exception!) { + gqlAuthQuery(query, variables: variables); + } + } else if (result.data != null && result.isConcrete) { + return result; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthMutation.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthMutation.md new file mode 100644 index 000000000..8791e72a2 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthMutation.md @@ -0,0 +1,66 @@ + + + +# gqlNonAuthMutation method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) gqlNonAuthMutation +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) mutation, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? variables, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) reCall = true}) + + + + + +

This function is used to run the graph-ql mutation to authenticate the non signed-in user.

+

params:

+
    +
  • mutation: mutation is used to change/add/delete data in graphql, for more info read graphql docs
  • +
  • variables: variables to be passed with mutation
  • +
  • reCall: when not first fetch call
  • +
+

returns:

+
    +
  • Future<dynamic>: it returns Future of dynamic
  • +
+ + + +## Implementation + +```dart +Future gqlNonAuthMutation( + String mutation, { + Map? variables, + bool reCall = true, +}) async { + final QueryResult result = await clientNonAuth.mutate( + MutationOptions( + document: gql(mutation), + variables: variables ?? {}, + ), + ); + // if there is an error or exception in [result] + if (result.hasException) { + final exception = encounteredExceptionOrError(result.exception!); + if (exception! && reCall) { + gqlNonAuthMutation(mutation, variables: variables); + } + } else if (result.data != null && result.isConcrete) { + return result; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthQuery.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthQuery.md new file mode 100644 index 000000000..6f2ac2bdf --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/gqlNonAuthQuery.md @@ -0,0 +1,64 @@ + + + +# gqlNonAuthQuery method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[QueryResult](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/QueryResult-class.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?>?> gqlNonAuthQuery +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) query, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? variables}) + + + + + +

This function is used to run the graph-ql query for the non signed-in user.

+

params:

+
    +
  • query: query is used to fetch data in graphql, for more info read graphql docs
  • +
  • variables: variables to be passed with query
  • +
+

returns:

+
    +
  • Future<QueryResult<Object?>?>: it returns Future of QueryResult, contains all data
  • +
+ + + +## Implementation + +```dart +Future?> gqlNonAuthQuery( + String query, { + Map? variables, +}) async { + final queryOptions = QueryOptions( + document: gql(query), + variables: variables ?? {}, + ); + final result = await clientNonAuth.query(queryOptions); + QueryResult? finalRes; + // if there is an error or exception in [result] + if (result.hasException) { + final exception = encounteredExceptionOrError(result.exception!); + if (exception!) { + finalRes = await gqlNonAuthQuery(query, variables: variables); + } + } else if (result.data != null && result.isConcrete) { + return result; + } + return finalRes; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/init.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/init.md new file mode 100644 index 000000000..c31b1aeb8 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/init.md @@ -0,0 +1,43 @@ + + + +# init method + + + + + + + + +void init +() + + + + + +

initialization function.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void init() { + clientNonAuth = graphqlConfig.clientToQuery(); + clientAuth = graphqlConfig.authClient(); + _query = Queries(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/memberRequestExist.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/memberRequestExist.md new file mode 100644 index 000000000..ec1aaa4f9 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/memberRequestExist.md @@ -0,0 +1,34 @@ + + + +# memberRequestExist property + + + + + + + +[GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) memberRequestExist + +_read / write_ + + + +

Graphql error for handling.

+ + + +## Implementation + +```dart +GraphQLError memberRequestExist = + const GraphQLError(message: 'Membership Request already exists'); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/notifFeatureNotInstalled.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/notifFeatureNotInstalled.md new file mode 100644 index 000000000..3047b0b22 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/notifFeatureNotInstalled.md @@ -0,0 +1,36 @@ + + + +# notifFeatureNotInstalled property + + + + + + + +[GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) notifFeatureNotInstalled + +_read / write_ + + + +

Graphql error for handling.

+ + + +## Implementation + +```dart +GraphQLError notifFeatureNotInstalled = const GraphQLError( + message: + 'Failed to determine project ID: Error while making request: getaddrinfo ENOTFOUND metadata.google.internal. Error code: ENOTFOUND', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/organizationNotFound.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/organizationNotFound.md new file mode 100644 index 000000000..14aac023b --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/organizationNotFound.md @@ -0,0 +1,34 @@ + + + +# organizationNotFound property + + + + + + + +[GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) organizationNotFound + +_read / write_ + + + +

Graphql error for handling.

+ + + +## Implementation + +```dart +GraphQLError organizationNotFound = + const GraphQLError(message: 'Organization not found'); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessToken.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessToken.md new file mode 100644 index 000000000..b89af5e64 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessToken.md @@ -0,0 +1,73 @@ + + + +# refreshAccessToken method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> refreshAccessToken +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) refreshToken) + + + + + +

This function is used to refresh the Authenication token to access the application.

+

params:

+
    +
  • refreshToken: Needed for authentication
  • +
+

returns:

+
    +
  • Future<bool>: it returns Future of dynamic
  • +
+ + + +## Implementation + +```dart +Future refreshAccessToken(String refreshToken) async { + // run the graphQL mutation + final QueryResult result = await clientNonAuth.mutate( + MutationOptions( + document: gql( + _query.refreshToken(refreshToken), + ), + ), + ); + // if there is an error or exception in [result] + if (result.hasException) { + final exception = encounteredExceptionOrError(result.exception!); + if (exception!) { + refreshAccessToken(refreshToken); + } else { + navigationService.pop(); + } + } else if (result.data != null && result.isConcrete) { + userConfig.updateAccessToken( + refreshToken: (result.data!['refreshToken'] + as Map)['refreshToken'] + .toString(), + accessToken: (result.data!['refreshToken'] + as Map)['accessToken'] + .toString(), + ); + databaseFunctions.init(); + return true; + } + return false; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessTokenExpiredException.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessTokenExpiredException.md new file mode 100644 index 000000000..6a2180548 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/refreshAccessTokenExpiredException.md @@ -0,0 +1,36 @@ + + + +# refreshAccessTokenExpiredException property + + + + + + + +[GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) refreshAccessTokenExpiredException + +_read / write_ + + + +

Graphql error for handling.

+ + + +## Implementation + +```dart +GraphQLError refreshAccessTokenExpiredException = const GraphQLError( + message: + 'Access Token has expired. Please refresh session.: Undefined location', +); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/userNotAuthenticated.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/userNotAuthenticated.md new file mode 100644 index 000000000..a812e0ddc --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/userNotAuthenticated.md @@ -0,0 +1,34 @@ + + + +# userNotAuthenticated property + + + + + + + +[GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) userNotAuthenticated + +_read / write_ + + + +

Graphql error for handling.

+ + + +## Implementation + +```dart +GraphQLError userNotAuthenticated = + const GraphQLError(message: 'User is not authenticated'); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/userNotFound.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/userNotFound.md new file mode 100644 index 000000000..032289659 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/userNotFound.md @@ -0,0 +1,33 @@ + + + +# userNotFound property + + + + + + + +[GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) userNotFound + +_read / write_ + + + +

Graphql error for handling.

+ + + +## Implementation + +```dart +GraphQLError userNotFound = const GraphQLError(message: 'User not found'); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/wrongCredentials.md b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/wrongCredentials.md new file mode 100644 index 000000000..a0a4a26d5 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/DataBaseMutationFunctions/wrongCredentials.md @@ -0,0 +1,34 @@ + + + +# wrongCredentials property + + + + + + + +[GraphQLError](https://pub.dev/documentation/gql_exec/1.0.1-alpha+1690479830973/execution/GraphQLError-class.html) wrongCredentials + +_read / write_ + + + +

Graphql error for handling.

+ + + +## Implementation + +```dart +GraphQLError wrongCredentials = + const GraphQLError(message: 'Invalid credentials'); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_database_mutation_functions/services_database_mutation_functions-library.md b/talawa-mobile-docs/services_database_mutation_functions/services_database_mutation_functions-library.md new file mode 100644 index 000000000..31230d7d5 --- /dev/null +++ b/talawa-mobile-docs/services_database_mutation_functions/services_database_mutation_functions-library.md @@ -0,0 +1,38 @@ + + + + +# database_mutation_functions library + + + + + + + + + + + +## Classes + +##### [DataBaseMutationFunctions](../services_database_mutation_functions/DataBaseMutationFunctions-class.md) + + + +DataBaseMutationFunctions class provides different services that are under the context of graphQL mutations and queries. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService-class.md b/talawa-mobile-docs/services_event_service/EventService-class.md new file mode 100644 index 000000000..7a9e701c0 --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService-class.md @@ -0,0 +1,174 @@ + + + +# EventService class + + + + + + + + + +

EventService class provides different services in the context of Event.

+

Services include:

+
    +
  • setOrgStreamSubscription : to set organization stream subscription for user.
  • +
  • getEvents : to get all events of the organization.
  • +
  • fetchRegistrantsByEvent : to fetch all registrants of an event.
  • +
  • registerForAnEvent : to register for an event.
  • +
  • deleteEvent : to delete an event.
  • +
  • editEvent : to edit the event.
  • +
  • dispose : to cancel the stream subscription of an organization.
  • +
+ + + + +## Constructors + +[EventService](../services_event_service/EventService/EventService.md) () + + + + +## Properties + +##### [eventStream](../services_event_service/EventService/eventStream.md) → [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[Event](../models_events_event_model/Event-class.md)> + + + +The event stream. +_read-only_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [deleteEvent](../services_event_service/EventService/deleteEvent.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to delete the event. + + + + +##### [dispose](../services_event_service/EventService/dispose.md)() void + + + +This function is used to cancel the stream subscription of an organization. + + + + +##### [editEvent](../services_event_service/EventService/editEvent.md)({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId, required [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> variables}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to edit an event. + + + + +##### [fetchRegistrantsByEvent](../services_event_service/EventService/fetchRegistrantsByEvent.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to fetch all registrants of an event. + + + + +##### [getEvents](../services_event_service/EventService/getEvents.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to fetch all the events of an organization. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [registerForAnEvent](../services_event_service/EventService/registerForAnEvent.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to register user for an event. + + + + +##### [setOrgStreamSubscription](../services_event_service/EventService/setOrgStreamSubscription.md)() void + + + +This function is used to set stream subscription for an organization. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/EventService.md b/talawa-mobile-docs/services_event_service/EventService/EventService.md new file mode 100644 index 000000000..8d9d30976 --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/EventService.md @@ -0,0 +1,34 @@ + + + +# EventService constructor + + + + + + + +EventService() + + + + + +## Implementation + +```dart +EventService() { + _eventStream = _eventStreamController.stream.asBroadcastStream(); + _currentOrg = _userConfig.currentOrg; + _userConfig.initialiseStream(); + setOrgStreamSubscription(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/deleteEvent.md b/talawa-mobile-docs/services_event_service/EventService/deleteEvent.md new file mode 100644 index 000000000..3c3c53776 --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/deleteEvent.md @@ -0,0 +1,55 @@ + + + +# deleteEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) deleteEvent +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) + + + + + +

This function is used to delete the event.

+

params:

+
    +
  • eventId: id of an event
  • +
+

returns:

+
    +
  • Future<dynamic>: Information about the event deletion
  • +
+ + + +## Implementation + +```dart +Future deleteEvent(String eventId) async { + navigationService.pushDialog( + const CustomProgressDialog(key: Key('DeleteEventProgress')), + ); + final tokenResult = await _dbFunctions + .refreshAccessToken(userConfig.currentUser.refreshToken!); + debugPrint(tokenResult.toString()); + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().deleteEvent(eventId), + ); + navigationService.pop(); + return result; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/dispose.md b/talawa-mobile-docs/services_event_service/EventService/dispose.md new file mode 100644 index 000000000..5eb528fee --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/dispose.md @@ -0,0 +1,41 @@ + + + +# dispose method + + + + + + + + +void dispose +() + + + + + +

This function is used to cancel the stream subscription of an organization.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void dispose() { + _currentOrganizationStreamSubscription.cancel(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/editEvent.md b/talawa-mobile-docs/services_event_service/EventService/editEvent.md new file mode 100644 index 000000000..51f6f640e --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/editEvent.md @@ -0,0 +1,68 @@ + + + +# editEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> editEvent +({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId, required [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> variables}) + + + + + +

This function is used to edit an event.

+

params:

+
    +
  • eventId: id of an event
  • +
  • variables: this will be map type and contain all the event details need to be update.
  • +
+

returns:

+
    +
  • Future<void>: void return
  • +
+ + + +## Implementation + +```dart +Future editEvent({ + required String eventId, + required Map variables, +}) async { + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('EditEventProgress'), + ), + ); + final tokenResult = await _dbFunctions + .refreshAccessToken(userConfig.currentUser.refreshToken!); + debugPrint(tokenResult.toString()); + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().updateEvent(eventId: eventId), + variables: variables, + ); + navigationService.pop(); + if (result != null) { + navigationService.removeAllAndPush( + Routes.exploreEventsScreen, + Routes.mainScreen, + arguments: MainScreenArgs(mainScreenIndex: 0, fromSignUp: false), + ); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/eventStream.md b/talawa-mobile-docs/services_event_service/EventService/eventStream.md new file mode 100644 index 000000000..e243c8385 --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/eventStream.md @@ -0,0 +1,42 @@ + + + +# eventStream property + + + + + + + + + +[Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[Event](../../models_events_event_model/Event-class.md)> eventStream + + + + + +

The event stream.

+

params: +None +returns:

+
    +
  • Stream<Event>: returns the event stream
  • +
+ + + +## Implementation + +```dart +Stream get eventStream => _eventStream; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/fetchRegistrantsByEvent.md b/talawa-mobile-docs/services_event_service/EventService/fetchRegistrantsByEvent.md new file mode 100644 index 000000000..512594624 --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/fetchRegistrantsByEvent.md @@ -0,0 +1,49 @@ + + + +# fetchRegistrantsByEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) fetchRegistrantsByEvent +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) + + + + + +

This function is used to fetch all registrants of an event.

+

params:

+
    +
  • eventId: id of an event.
  • +
+

returns:

+
    +
  • Future<dynamic>: Information about event registrants.
  • +
+ + + +## Implementation + +```dart +Future fetchRegistrantsByEvent(String eventId) async { + await _dbFunctions.refreshAccessToken(userConfig.currentUser.refreshToken!); + final result = await _dbFunctions.gqlAuthQuery( + EventQueries().registrantsByEvent(eventId), + ); + return result; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/getEvents.md b/talawa-mobile-docs/services_event_service/EventService/getEvents.md new file mode 100644 index 000000000..031bd6276 --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/getEvents.md @@ -0,0 +1,62 @@ + + + +# getEvents method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getEvents +() + + + + + +

This function is used to fetch all the events of an organization.

+

params: + None

+

returns:

+
    +
  • Future<void>: void
  • +
+ + + +## Implementation + +```dart +Future getEvents() async { + // refresh user's access token + await _dbFunctions.refreshAccessToken(userConfig.currentUser.refreshToken!); + _dbFunctions.init(); + + // get current organization id + final String currentOrgID = _currentOrg.id!; + // mutation to fetch the events + final String mutation = EventQueries().fetchOrgEvents(currentOrgID); + final result = await _dbFunctions.gqlAuthMutation(mutation); + + if (result == null) return; + final List eventsJson = result.data!["eventsByOrganization"] as List; + eventsJson.forEach((eventJsonData) { + final Event event = Event.fromJson(eventJsonData as Map); + event.isRegistered = event.registrants?.any( + (registrant) => registrant.id == _userConfig.currentUser.id, + ) ?? + false; + _eventStreamController.add(event); + }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/registerForAnEvent.md b/talawa-mobile-docs/services_event_service/EventService/registerForAnEvent.md new file mode 100644 index 000000000..d0714cd54 --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/registerForAnEvent.md @@ -0,0 +1,53 @@ + + + +# registerForAnEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) registerForAnEvent +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) + + + + + +

This function is used to register user for an event.

+

params:

+
    +
  • eventId: id of an event.
  • +
+

returns:

+
    +
  • Future<dynamic>: Information about the event registration.
  • +
+ + + +## Implementation + +```dart +Future registerForAnEvent(String eventId) async { + final tokenResult = await _dbFunctions + .refreshAccessToken(userConfig.currentUser.refreshToken!); + debugPrint(tokenResult.toString()); + final Map variables = {'eventId': eventId}; + final result = await _dbFunctions.gqlAuthMutation( + EventQueries().registerForEvent(), + variables: variables, + ); + return result; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/EventService/setOrgStreamSubscription.md b/talawa-mobile-docs/services_event_service/EventService/setOrgStreamSubscription.md new file mode 100644 index 000000000..3aae01406 --- /dev/null +++ b/talawa-mobile-docs/services_event_service/EventService/setOrgStreamSubscription.md @@ -0,0 +1,44 @@ + + + +# setOrgStreamSubscription method + + + + + + + + +void setOrgStreamSubscription +() + + + + + +

This function is used to set stream subscription for an organization.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void setOrgStreamSubscription() { + _currentOrganizationStreamSubscription = + _userConfig.currentOrgInfoStream.listen((updatedOrganization) { + _currentOrg = updatedOrganization; + }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_event_service/services_event_service-library.md b/talawa-mobile-docs/services_event_service/services_event_service-library.md new file mode 100644 index 000000000..61682396c --- /dev/null +++ b/talawa-mobile-docs/services_event_service/services_event_service-library.md @@ -0,0 +1,38 @@ + + + + +# event_service library + + + + + + + + + + + +## Classes + +##### [EventService](../services_event_service/EventService-class.md) + + + +EventService class provides different services in the context of Event. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig-class.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig-class.md new file mode 100644 index 000000000..9d5a105a2 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig-class.md @@ -0,0 +1,207 @@ + + + +# GraphqlConfig class + + + + + + + + + +

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. +Talawa uses graphQL for the integrating with the API's. +You can go through talawa-api, here. +GraphqlConfig class provides service to configure graph ql API with talawa mobile-app.

+ + + + +## Constructors + +[GraphqlConfig](../services_graphql_config/GraphqlConfig/GraphqlConfig.md) () + + + + +## Properties + +##### [displayImgRoute](../services_graphql_config/GraphqlConfig/displayImgRoute.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [httpLink](../services_graphql_config/GraphqlConfig/httpLink.md) ↔ [HttpLink](https://pub.dev/documentation/gql_http_link/1.0.1/gql_http_link/HttpLink-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [webSocketLink](../services_graphql_config/GraphqlConfig/webSocketLink.md) ↔ [WebSocketLink](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/WebSocketLink-class.html) + + + + +_read / write_ + + + + + +## Methods + +##### [authClient](../services_graphql_config/GraphqlConfig/authClient.md)() [GraphQLClient](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/GraphQLClient-class.html) + + + + + + + + +##### [clientToQuery](../services_graphql_config/GraphqlConfig/clientToQuery.md)() [GraphQLClient](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/GraphQLClient-class.html) + + + + + + + + +##### [getOrgUrl](../services_graphql_config/GraphqlConfig/getOrgUrl.md)() void + + + +This function is used to get the organization URL. + + + + +##### [getToken](../services_graphql_config/GraphqlConfig/getToken.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to get user the access token. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [test](../services_graphql_config/GraphqlConfig/test.md)() void + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + +## Static Properties + +##### [orgURI](../services_graphql_config/GraphqlConfig/orgURI.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [token](../services_graphql_config/GraphqlConfig/token.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + + + + + + +## Constants + +##### [imageUrlKey](../services_graphql_config/GraphqlConfig/imageUrlKey-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [urlKey](../services_graphql_config/GraphqlConfig/urlKey-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/GraphqlConfig.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/GraphqlConfig.md new file mode 100644 index 000000000..035b0463c --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/GraphqlConfig.md @@ -0,0 +1,24 @@ + + + +# GraphqlConfig constructor + + + + + + + +GraphqlConfig() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/authClient.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/authClient.md new file mode 100644 index 000000000..aaacdd320 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/authClient.md @@ -0,0 +1,41 @@ + + + +# authClient method + + + + + + + + +[GraphQLClient](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/GraphQLClient-class.html) authClient +() + + + + + + + + +## Implementation + +```dart +GraphQLClient authClient() { + final AuthLink authLink = AuthLink(getToken: () async => 'Bearer $token'); + final Link finalAuthLink = authLink.concat(httpLink); + return GraphQLClient( + cache: GraphQLCache(partialDataPolicy: PartialDataCachePolicy.accept), + link: finalAuthLink, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/clientToQuery.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/clientToQuery.md new file mode 100644 index 000000000..25b35a9ac --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/clientToQuery.md @@ -0,0 +1,42 @@ + + + +# clientToQuery method + + + + + + + + +[GraphQLClient](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/GraphQLClient-class.html) clientToQuery +() + + + + + + + + +## Implementation + +```dart +GraphQLClient clientToQuery() { + //TODO: Implement websocket link from OrgUrl + // final link = Link.split( + // (request) => request.isSubscription, webSocketLink, httpLink); + return GraphQLClient( + cache: GraphQLCache(partialDataPolicy: PartialDataCachePolicy.accept), + link: httpLink, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/displayImgRoute.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/displayImgRoute.md new file mode 100644 index 000000000..0f5ca8520 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/displayImgRoute.md @@ -0,0 +1,32 @@ + + + +# displayImgRoute property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? displayImgRoute + +_read / write_ + + + + + + +## Implementation + +```dart +String? displayImgRoute; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/getOrgUrl.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/getOrgUrl.md new file mode 100644 index 000000000..fceac943c --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/getOrgUrl.md @@ -0,0 +1,44 @@ + + + +# getOrgUrl method + + + + + + + + +void getOrgUrl +() + + + + + +

This function is used to get the organization URL.

+ + + +## Implementation + +```dart +void getOrgUrl() { + final box = Hive.box('url'); + final String? url = box.get(urlKey) as String?; + final String? imgUrl = box.get(imageUrlKey) as String?; + orgURI = url ?? ' '; + displayImgRoute = imgUrl ?? ' '; + httpLink = HttpLink(orgURI!); + clientToQuery(); + authClient(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/getToken.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/getToken.md new file mode 100644 index 000000000..e2d6dda0d --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/getToken.md @@ -0,0 +1,40 @@ + + + +# getToken method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) getToken +() + + + + + +

This function is used to get user the access token.

+ + + +## Implementation + +```dart +Future getToken() async { + final authToken = userConfig.currentUser.authToken; + token = authToken; + getOrgUrl(); + return true; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/httpLink.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/httpLink.md new file mode 100644 index 000000000..763c79612 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/httpLink.md @@ -0,0 +1,32 @@ + + + +# httpLink property + + + + + + + +[HttpLink](https://pub.dev/documentation/gql_http_link/1.0.1/gql_http_link/HttpLink-class.html) httpLink + +_read / write_ + + + + + + +## Implementation + +```dart +late HttpLink httpLink; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/imageUrlKey-constant.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/imageUrlKey-constant.md new file mode 100644 index 000000000..e12d339b1 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/imageUrlKey-constant.md @@ -0,0 +1,32 @@ + + + +# imageUrlKey constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const imageUrlKey + + + + + + + + +## Implementation + +```dart +static const imageUrlKey = "imageUrl"; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/orgURI.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/orgURI.md new file mode 100644 index 000000000..4c6dd0299 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/orgURI.md @@ -0,0 +1,32 @@ + + + +# orgURI property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? orgURI + +_read / write_ + + + + + + +## Implementation + +```dart +static String? orgURI = ' '; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/test.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/test.md new file mode 100644 index 000000000..8b19dcfa4 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/test.md @@ -0,0 +1,39 @@ + + + +# test method + + + + + + + + +void test +() + + + + + + + + +## Implementation + +```dart +void test() { + httpLink = HttpLink( + 'https://talawa-graphql-api.herokuapp.com/graphql', + httpClient: MockHttpClient(), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/token.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/token.md new file mode 100644 index 000000000..16321bc25 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/token.md @@ -0,0 +1,32 @@ + + + +# token property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? token + +_read / write_ + + + + + + +## Implementation + +```dart +static String? token; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/urlKey-constant.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/urlKey-constant.md new file mode 100644 index 000000000..d90752c59 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/urlKey-constant.md @@ -0,0 +1,32 @@ + + + +# urlKey constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const urlKey + + + + + + + + +## Implementation + +```dart +static const urlKey = "url"; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/GraphqlConfig/webSocketLink.md b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/webSocketLink.md new file mode 100644 index 000000000..1284f5e82 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/GraphqlConfig/webSocketLink.md @@ -0,0 +1,32 @@ + + + +# webSocketLink property + + + + + + + +[WebSocketLink](https://pub.dev/documentation/graphql/5.2.0-beta.4/graphql/WebSocketLink-class.html) webSocketLink + +_read / write_ + + + + + + +## Implementation + +```dart +late WebSocketLink webSocketLink; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/MockHttpClient-class.md b/talawa-mobile-docs/services_graphql_config/MockHttpClient-class.md new file mode 100644 index 000000000..44dbf5957 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/MockHttpClient-class.md @@ -0,0 +1,203 @@ + + + +# MockHttpClient class + + + + + + + + + +

A mock HTTP client designed for use when testing code that uses BaseClient.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [Mock](https://pub.dev/documentation/mockito/5.4.0/mockito/Mock-class.html) +- MockHttpClient + +**Implemented types** + +- [Client](https://pub.dev/documentation/http/0.13.6/http/Client-class.html) + + + + + + + +## Constructors + +[MockHttpClient](../services_graphql_config/MockHttpClient/MockHttpClient.md) () + + + + +## Properties + +##### [hashCode](https://pub.dev/documentation/mockito/5.4.0/mockito/Mock/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [close](https://pub.dev/documentation/http/0.13.6/http/Client/close.html)() void + + + +Closes the client and cleans up any resources associated with it. +_inherited_ + + + +##### [delete](https://pub.dev/documentation/http/0.13.6/http/Client/delete.html)([Uri](https://api.flutter.dev/flutter/dart-core/Uri-class.html) url, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [String](https://api.flutter.dev/flutter/dart-core/String-class.html)>? headers, [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)? body, [Encoding](https://api.flutter.dev/flutter/dart-convert/Encoding-class.html)? encoding}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Response](https://pub.dev/documentation/http/0.13.6/http/Response-class.html)> + + + +Sends an HTTP DELETE request with the given headers to the given URL. +_inherited_ + + + +##### [get](https://pub.dev/documentation/http/0.13.6/http/Client/get.html)([Uri](https://api.flutter.dev/flutter/dart-core/Uri-class.html) url, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [String](https://api.flutter.dev/flutter/dart-core/String-class.html)>? headers}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Response](https://pub.dev/documentation/http/0.13.6/http/Response-class.html)> + + + +Sends an HTTP GET request with the given headers to the given URL. +_inherited_ + + + +##### [head](https://pub.dev/documentation/http/0.13.6/http/Client/head.html)([Uri](https://api.flutter.dev/flutter/dart-core/Uri-class.html) url, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [String](https://api.flutter.dev/flutter/dart-core/String-class.html)>? headers}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Response](https://pub.dev/documentation/http/0.13.6/http/Response-class.html)> + + + +Sends an HTTP HEAD request with the given headers to the given URL. +_inherited_ + + + +##### [noSuchMethod](https://pub.dev/documentation/mockito/5.4.0/mockito/Mock/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation, {[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)? returnValue, [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)? returnValueForMissingStub = deferToDefaultResponse}) dynamic + + + +Handles method stubbing, method call verification, and real method calls. +_inherited_ + + + +##### [patch](https://pub.dev/documentation/http/0.13.6/http/Client/patch.html)([Uri](https://api.flutter.dev/flutter/dart-core/Uri-class.html) url, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [String](https://api.flutter.dev/flutter/dart-core/String-class.html)>? headers, [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)? body, [Encoding](https://api.flutter.dev/flutter/dart-convert/Encoding-class.html)? encoding}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Response](https://pub.dev/documentation/http/0.13.6/http/Response-class.html)> + + + +Sends an HTTP PATCH request with the given headers and body to the given +URL. +_inherited_ + + + +##### [post](https://pub.dev/documentation/http/0.13.6/http/Client/post.html)([Uri](https://api.flutter.dev/flutter/dart-core/Uri-class.html) url, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [String](https://api.flutter.dev/flutter/dart-core/String-class.html)>? headers, [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)? body, [Encoding](https://api.flutter.dev/flutter/dart-convert/Encoding-class.html)? encoding}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Response](https://pub.dev/documentation/http/0.13.6/http/Response-class.html)> + + + +Sends an HTTP POST request with the given headers and body to the given +URL. +_inherited_ + + + +##### [put](https://pub.dev/documentation/http/0.13.6/http/Client/put.html)([Uri](https://api.flutter.dev/flutter/dart-core/Uri-class.html) url, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [String](https://api.flutter.dev/flutter/dart-core/String-class.html)>? headers, [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)? body, [Encoding](https://api.flutter.dev/flutter/dart-convert/Encoding-class.html)? encoding}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Response](https://pub.dev/documentation/http/0.13.6/http/Response-class.html)> + + + +Sends an HTTP PUT request with the given headers and body to the given +URL. +_inherited_ + + + +##### [read](https://pub.dev/documentation/http/0.13.6/http/Client/read.html)([Uri](https://api.flutter.dev/flutter/dart-core/Uri-class.html) url, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [String](https://api.flutter.dev/flutter/dart-core/String-class.html)>? headers}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> + + + +Sends an HTTP GET request with the given headers to the given URL and +returns a Future that completes to the body of the response as a String. +_inherited_ + + + +##### [readBytes](https://pub.dev/documentation/http/0.13.6/http/Client/readBytes.html)([Uri](https://api.flutter.dev/flutter/dart-core/Uri-class.html) url, {[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [String](https://api.flutter.dev/flutter/dart-core/String-class.html)>? headers}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Uint8List](https://api.flutter.dev/flutter/dart-typed_data/Uint8List-class.html)> + + + +Sends an HTTP GET request with the given headers to the given URL and +returns a Future that completes to the body of the response as a list of +bytes. +_inherited_ + + + +##### [send](../services_graphql_config/MockHttpClient/send.md)([BaseRequest](https://pub.dev/documentation/http/0.13.6/http/BaseRequest-class.html)? request) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[StreamedResponse](https://pub.dev/documentation/http/0.13.6/http/StreamedResponse-class.html)> + + + +Sends an HTTP request and asynchronously returns the response. +_override_ + + + +##### [toString](https://pub.dev/documentation/mockito/5.4.0/mockito/Mock/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://pub.dev/documentation/mockito/5.4.0/mockito/Mock/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/MockHttpClient/MockHttpClient.md b/talawa-mobile-docs/services_graphql_config/MockHttpClient/MockHttpClient.md new file mode 100644 index 000000000..e5de34c93 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/MockHttpClient/MockHttpClient.md @@ -0,0 +1,24 @@ + + + +# MockHttpClient constructor + + + + + + + +MockHttpClient() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/MockHttpClient/send.md b/talawa-mobile-docs/services_graphql_config/MockHttpClient/send.md new file mode 100644 index 000000000..d2358b904 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/MockHttpClient/send.md @@ -0,0 +1,47 @@ + + + +# send method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[StreamedResponse](https://pub.dev/documentation/http/0.13.6/http/StreamedResponse-class.html)> send +([BaseRequest](https://pub.dev/documentation/http/0.13.6/http/BaseRequest-class.html)? request) + +_override_ + + + +

Sends an HTTP request and asynchronously returns the response.

+ + + +## Implementation + +```dart +@override +Future send(http.BaseRequest? request) => + // ignore: invalid_use_of_visible_for_testing_member + super.noSuchMethod( + Invocation.method(#send, [request]), + returnValue: Future.value( + http.StreamedResponse( + Stream.fromIterable(const [[]]), + 500, + ), + ), + ) as Future; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_graphql_config/services_graphql_config-library.md b/talawa-mobile-docs/services_graphql_config/services_graphql_config-library.md new file mode 100644 index 000000000..ddc74cda1 --- /dev/null +++ b/talawa-mobile-docs/services_graphql_config/services_graphql_config-library.md @@ -0,0 +1,48 @@ + + + + +# graphql_config library + + + + + + + + + + + +## Classes + +##### [GraphqlConfig](../services_graphql_config/GraphqlConfig-class.md) + + + +GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. +Talawa uses graphQL for the integrating with the API's. +You can go through talawa-api, here. +GraphqlConfig class provides service to configure graph ql API with talawa mobile-app. + + +##### [MockHttpClient](../services_graphql_config/MockHttpClient-class.md) + + + +A mock HTTP client designed for use when testing code that uses BaseClient. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService-class.md b/talawa-mobile-docs/services_navigation_service/NavigationService-class.md new file mode 100644 index 000000000..5485dfc4e --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService-class.md @@ -0,0 +1,203 @@ + + + +# NavigationService class + + + + + + + + + +

NavigationService class provides different functions as service in the context of navigation.

+

Services include:

+
    +
  • pushScreen
  • +
  • popAndPushScreen
  • +
  • pushReplacementScreen
  • +
  • removeAllAndPush
  • +
  • showSnackBar
  • +
  • pushDialog
  • +
  • showTalawaErrorWidget
  • +
  • showTalawaErrorDialog
  • +
  • pop
  • +
+ + + + +## Constructors + +[NavigationService](../services_navigation_service/NavigationService/NavigationService.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [navigatorKey](../services_navigation_service/NavigationService/navigatorKey.md) ↔ [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[NavigatorState](https://api.flutter.dev/flutter/widgets/NavigatorState-class.html)> + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [fromInviteLink](../services_navigation_service/NavigationService/fromInviteLink.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> routeNames, [List](https://api.flutter.dev/flutter/dart-core/List-class.html) arguments) void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [pop](../services_navigation_service/NavigationService/pop.md)() void + + + +This function pops the current state. + + + + +##### [popAndPushScreen](../services_navigation_service/NavigationService/popAndPushScreen.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) routeName, {dynamic arguments}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function pop the initial route and push the new route to the navigator. + + + + +##### [pushDialog](../services_navigation_service/NavigationService/pushDialog.md)([Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) dialog) void + + + +This function is used to show the custom Dialog. + + + + +##### [pushReplacementScreen](../services_navigation_service/NavigationService/pushReplacementScreen.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) routeName, {dynamic arguments}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function push the route and replace the screen. + + + + +##### [pushScreen](../services_navigation_service/NavigationService/pushScreen.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) routeName, {dynamic arguments}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function push the route to the navigator. + + + + +##### [removeAllAndPush](../services_navigation_service/NavigationService/removeAllAndPush.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) routeName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) tillRoute, {dynamic arguments}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function remove all the routes till the particular route and add new route. + + + + +##### [showSnackBar](../services_navigation_service/NavigationService/showSnackBar.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) message, {[Duration](https://api.flutter.dev/flutter/dart-core/Duration-class.html) duration = const Duration(seconds: 2)}) void + + + +This is used for the quick alert of duration: 2 seconds with text message(passed). + + + + +##### [showTalawaErrorDialog](../services_navigation_service/NavigationService/showTalawaErrorDialog.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage, [MessageType](../enums_enums/MessageType.md) messageType) void + + + + + + + + +##### [showTalawaErrorSnackBar](../services_navigation_service/NavigationService/showTalawaErrorSnackBar.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage, [MessageType](../enums_enums/MessageType.md) messageType, {[Duration](https://api.flutter.dev/flutter/dart-core/Duration-class.html) duration = const Duration(seconds: 2)}) void + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/NavigationService.md b/talawa-mobile-docs/services_navigation_service/NavigationService/NavigationService.md new file mode 100644 index 000000000..e32f96455 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/NavigationService.md @@ -0,0 +1,24 @@ + + + +# NavigationService constructor + + + + + + + +NavigationService() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/fromInviteLink.md b/talawa-mobile-docs/services_navigation_service/NavigationService/fromInviteLink.md new file mode 100644 index 000000000..e65d09b54 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/fromInviteLink.md @@ -0,0 +1,40 @@ + + + +# fromInviteLink method + + + + + + + + +void fromInviteLink +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> routeNames, [List](https://api.flutter.dev/flutter/dart-core/List-class.html) arguments) + + + + + + + + +## Implementation + +```dart +void fromInviteLink(List routeNames, List arguments) { + int i = 0; + removeAllAndPush('/${routeNames[i]}', '/', arguments: arguments[i]); + for (i = 1; i < routeNames.length; i++) { + pushScreen('/${routeNames[i]}', arguments: arguments[i]); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/navigatorKey.md b/talawa-mobile-docs/services_navigation_service/NavigationService/navigatorKey.md new file mode 100644 index 000000000..ba78b322e --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/navigatorKey.md @@ -0,0 +1,32 @@ + + + +# navigatorKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[NavigatorState](https://api.flutter.dev/flutter/widgets/NavigatorState-class.html)> navigatorKey + +_read / write_ + + + + + + +## Implementation + +```dart +GlobalKey navigatorKey = GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/pop.md b/talawa-mobile-docs/services_navigation_service/NavigationService/pop.md new file mode 100644 index 000000000..fcf90d6f1 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/pop.md @@ -0,0 +1,37 @@ + + + +# pop method + + + + + + + + +void pop +() + + + + + +

This function pops the current state.

+ + + +## Implementation + +```dart +void pop() { + return navigatorKey.currentState!.pop(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/popAndPushScreen.md b/talawa-mobile-docs/services_navigation_service/NavigationService/popAndPushScreen.md new file mode 100644 index 000000000..2dd7b0e99 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/popAndPushScreen.md @@ -0,0 +1,43 @@ + + + +# popAndPushScreen method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) popAndPushScreen +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) routeName, {dynamic arguments}) + + + + + +

This function pop the initial route and push the new route to the navigator.

+

params:

+
    +
  • routeName
  • +
  • arguments : necessary data for the route
  • +
+ + + +## Implementation + +```dart +Future popAndPushScreen(String routeName, {dynamic arguments}) { + navigatorKey.currentState!.pop(); + return pushScreen(routeName, arguments: arguments); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/pushDialog.md b/talawa-mobile-docs/services_navigation_service/NavigationService/pushDialog.md new file mode 100644 index 000000000..1c6f2e7e0 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/pushDialog.md @@ -0,0 +1,44 @@ + + + +# pushDialog method + + + + + + + + +void pushDialog +([Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) dialog) + + + + + +

This function is used to show the custom Dialog.

+ + + +## Implementation + +```dart +void pushDialog(Widget dialog) { + showDialog( + context: navigatorKey.currentContext!, + barrierColor: Colors.transparent, + barrierDismissible: false, + builder: (BuildContext context) { + return dialog; + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/pushReplacementScreen.md b/talawa-mobile-docs/services_navigation_service/NavigationService/pushReplacementScreen.md new file mode 100644 index 000000000..d424e9278 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/pushReplacementScreen.md @@ -0,0 +1,43 @@ + + + +# pushReplacementScreen method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) pushReplacementScreen +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) routeName, {dynamic arguments}) + + + + + +

This function push the route and replace the screen.

+

params:

+
    +
  • routeName
  • +
  • arguments : necessary data for the route
  • +
+ + + +## Implementation + +```dart +Future pushReplacementScreen(String routeName, {dynamic arguments}) { + return navigatorKey.currentState! + .pushReplacementNamed(routeName, arguments: arguments); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/pushScreen.md b/talawa-mobile-docs/services_navigation_service/NavigationService/pushScreen.md new file mode 100644 index 000000000..cee221613 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/pushScreen.md @@ -0,0 +1,43 @@ + + + +# pushScreen method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) pushScreen +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) routeName, {dynamic arguments}) + + + + + +

This function push the route to the navigator.

+

params:

+
    +
  • routeName
  • +
  • arguments : necessary data for the route
  • +
+ + + +## Implementation + +```dart +Future pushScreen(String routeName, {dynamic arguments}) { + return navigatorKey.currentState! + .pushNamed(routeName, arguments: arguments); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/removeAllAndPush.md b/talawa-mobile-docs/services_navigation_service/NavigationService/removeAllAndPush.md new file mode 100644 index 000000000..675e9d430 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/removeAllAndPush.md @@ -0,0 +1,51 @@ + + + +# removeAllAndPush method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) removeAllAndPush +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) routeName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) tillRoute, {dynamic arguments}) + + + + + +

This function remove all the routes till the particular route and add new route.

+

params:

+
    +
  • routeName : route that need to add
  • +
  • tillRoute : remove all route until this route.
  • +
  • arguments : necessary data for the route
  • +
+ + + +## Implementation + +```dart +Future removeAllAndPush( + String routeName, + String tillRoute, { + dynamic arguments, +}) { + return navigatorKey.currentState!.pushNamedAndRemoveUntil( + routeName, + ModalRoute.withName(tillRoute), + arguments: arguments, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/showSnackBar.md b/talawa-mobile-docs/services_navigation_service/NavigationService/showSnackBar.md new file mode 100644 index 000000000..26dee20c0 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/showSnackBar.md @@ -0,0 +1,46 @@ + + + +# showSnackBar method + + + + + + + + +void showSnackBar +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) message, {[Duration](https://api.flutter.dev/flutter/dart-core/Duration-class.html) duration = const Duration(seconds: 2)}) + + + + + +

This is used for the quick alert of duration: 2 seconds with text message(passed).

+ + + +## Implementation + +```dart +void showSnackBar( + String message, { + Duration duration = const Duration(seconds: 2), +}) { + ScaffoldMessenger.of(navigatorKey.currentContext!).showSnackBar( + SnackBar( + behavior: SnackBarBehavior.floating, + duration: duration, + content: Text(message), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/showTalawaErrorDialog.md b/talawa-mobile-docs/services_navigation_service/NavigationService/showTalawaErrorDialog.md new file mode 100644 index 000000000..553dac12b --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/showTalawaErrorDialog.md @@ -0,0 +1,46 @@ + + + +# showTalawaErrorDialog method + + + + + + + + +void showTalawaErrorDialog +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage, [MessageType](../../enums_enums/MessageType.md) messageType) + + + + + + + + +## Implementation + +```dart +void showTalawaErrorDialog(String errorMessage, MessageType messageType) { + showDialog( + context: navigatorKey.currentContext!, + barrierColor: Colors.transparent, + barrierDismissible: false, + builder: (BuildContext context) { + return TalawaErrorDialog( + errorMessage, + messageType: messageType, + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/NavigationService/showTalawaErrorSnackBar.md b/talawa-mobile-docs/services_navigation_service/NavigationService/showTalawaErrorSnackBar.md new file mode 100644 index 000000000..565c77500 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/NavigationService/showTalawaErrorSnackBar.md @@ -0,0 +1,49 @@ + + + +# showTalawaErrorSnackBar method + + + + + + + + +void showTalawaErrorSnackBar +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage, [MessageType](../../enums_enums/MessageType.md) messageType, {[Duration](https://api.flutter.dev/flutter/dart-core/Duration-class.html) duration = const Duration(seconds: 2)}) + + + + + + + + +## Implementation + +```dart +void showTalawaErrorSnackBar( + String errorMessage, + MessageType messageType, { + Duration duration = const Duration(seconds: 2), +}) { + ScaffoldMessenger.of(navigatorKey.currentContext!).showSnackBar( + SnackBar( + padding: EdgeInsets.zero, + content: TalawaErrorSnackBar( + messageType: messageType, + errorMessage: errorMessage, + ), + backgroundColor: const Color.fromRGBO(65, 65, 66, 1), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_navigation_service/services_navigation_service-library.md b/talawa-mobile-docs/services_navigation_service/services_navigation_service-library.md new file mode 100644 index 000000000..5ce8587f9 --- /dev/null +++ b/talawa-mobile-docs/services_navigation_service/services_navigation_service-library.md @@ -0,0 +1,38 @@ + + + + +# navigation_service library + + + + + + + + + + + +## Classes + +##### [NavigationService](../services_navigation_service/NavigationService-class.md) + + + +NavigationService class provides different functions as service in the context of navigation. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_org_service/OrganizationService-class.md b/talawa-mobile-docs/services_org_service/OrganizationService-class.md new file mode 100644 index 000000000..dec422519 --- /dev/null +++ b/talawa-mobile-docs/services_org_service/OrganizationService-class.md @@ -0,0 +1,105 @@ + + + +# OrganizationService class + + + + + + + + + +

OrganizationService class provides the in the context of organizations.

+

Services include:

+
    +
  • getOrgMembersList : to get all organizations members
  • +
+ + + + +## Constructors + +[OrganizationService](../services_org_service/OrganizationService/OrganizationService.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [getOrgMembersList](../services_org_service/OrganizationService/getOrgMembersList.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>> + + + +This function fetch and returns the list of organization members. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_org_service/OrganizationService/OrganizationService.md b/talawa-mobile-docs/services_org_service/OrganizationService/OrganizationService.md new file mode 100644 index 000000000..6827db76d --- /dev/null +++ b/talawa-mobile-docs/services_org_service/OrganizationService/OrganizationService.md @@ -0,0 +1,31 @@ + + + +# OrganizationService constructor + + + + + + + +OrganizationService() + + + + + +## Implementation + +```dart +OrganizationService() { + _dbFunctions = locator(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_org_service/OrganizationService/getOrgMembersList.md b/talawa-mobile-docs/services_org_service/OrganizationService/getOrgMembersList.md new file mode 100644 index 000000000..b44d1f1de --- /dev/null +++ b/talawa-mobile-docs/services_org_service/OrganizationService/getOrgMembersList.md @@ -0,0 +1,54 @@ + + + +# getOrgMembersList method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>> getOrgMembersList +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) + + + + + +

This function fetch and returns the list of organization members.

+

params:

+
    +
  • orgId : id of the organization for which members list need be fetched.
  • +
+ + + +## Implementation + +```dart +Future> getOrgMembersList(String orgId) async { + final String query = Queries().fetchOrgDetailsById(orgId); + // fetching from database using graphQL mutations. + final result = await _dbFunctions.gqlAuthMutation(query); + final List orgMembersResult = + result.data['organizations'][0]['members'] as List; + final List orgMembersList = []; + orgMembersResult.forEach((jsonElement) { + final User member = + User.fromJson(jsonElement as Map, fromOrg: true); + orgMembersList.add(member); + }); + + // return list + return orgMembersList; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_org_service/services_org_service-library.md b/talawa-mobile-docs/services_org_service/services_org_service-library.md new file mode 100644 index 000000000..13bfece06 --- /dev/null +++ b/talawa-mobile-docs/services_org_service/services_org_service-library.md @@ -0,0 +1,38 @@ + + + + +# org_service library + + + + + + + + + + + +## Classes + +##### [OrganizationService](../services_org_service/OrganizationService-class.md) + + + +OrganizationService class provides the in the context of organizations. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService-class.md b/talawa-mobile-docs/services_post_service/PostService-class.md new file mode 100644 index 000000000..41a1ca683 --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService-class.md @@ -0,0 +1,162 @@ + + + +# PostService class + + + + + + + + + +

PostService class provides functions in the context of a Post.

+

Services include:

+
    +
  • getPosts : to get all posts of the organization.
  • +
  • addLike : to add like to the post.
  • +
  • removeLike : to remove the like from the post.
  • +
+ + + + +## Constructors + +[PostService](../services_post_service/PostService/PostService.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [postStream](../services_post_service/PostService/postStream.md) → [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)>> + + + + +_read-only_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [updatedPostStream](../services_post_service/PostService/updatedPostStream.md) → [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[Post](../models_post_post_model/Post-class.md)> + + + + +_read-only_ + + + + + +## Methods + +##### [addCommentLocally](../services_post_service/PostService/addCommentLocally.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) void + + + + + + + + +##### [addLike](../services_post_service/PostService/addLike.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to add Like to the Post. + + + + +##### [getPosts](../services_post_service/PostService/getPosts.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function used to get all posts of an organization. +The function reference the organization Id from _currentOrg. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [removeLike](../services_post_service/PostService/removeLike.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to remove like from the Post. + + + + +##### [setOrgStreamSubscription](../services_post_service/PostService/setOrgStreamSubscription.md)() void + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService/PostService.md b/talawa-mobile-docs/services_post_service/PostService/PostService.md new file mode 100644 index 000000000..0ee01b0b6 --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService/PostService.md @@ -0,0 +1,36 @@ + + + +# PostService constructor + + + + + + + +PostService() + + + + + +## Implementation + +```dart +PostService() { + _postStream = _postStreamController.stream.asBroadcastStream(); + _updatedPostStream = + _updatedPostStreamController.stream.asBroadcastStream(); + _currentOrg = _userConfig.currentOrg; + setOrgStreamSubscription(); + getPosts(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService/addCommentLocally.md b/talawa-mobile-docs/services_post_service/PostService/addCommentLocally.md new file mode 100644 index 000000000..f2123c5d5 --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService/addCommentLocally.md @@ -0,0 +1,41 @@ + + + +# addCommentLocally method + + + + + + + + +void addCommentLocally +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) + + + + + + + + +## Implementation + +```dart +void addCommentLocally(String postID) { + for (int i = 0; i < _posts.length; i++) { + if (_posts[i].sId == postID) { + _posts[i].comments!.add(Comments(sId: postID)); + _updatedPostStreamController.add(_posts[i]); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService/addLike.md b/talawa-mobile-docs/services_post_service/PostService/addLike.md new file mode 100644 index 000000000..6e68fdc7f --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService/addLike.md @@ -0,0 +1,48 @@ + + + +# addLike method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> addLike +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) + + + + + +

This function is used to add Like to the Post.

+

params:

+
    +
  • postId : id of the post where like need to be added.
  • +
+ + + +## Implementation + +```dart +Future addLike(String postID) async { + _localAddLike(postID); + final String mutation = PostQueries().addLike(); + // run the graphQl mutation. + final result = await _dbFunctions + .gqlAuthMutation(mutation, variables: {"postID": postID}); + print(result); + // return result + return result; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService/getPosts.md b/talawa-mobile-docs/services_post_service/PostService/getPosts.md new file mode 100644 index 000000000..84b9cdacb --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService/getPosts.md @@ -0,0 +1,55 @@ + + + +# getPosts method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getPosts +() + + + + + +

This function used to get all posts of an organization. +The function reference the organization Id from _currentOrg.

+ + + +## Implementation + +```dart +Future getPosts() async { + // variables + final String currentOrgID = _currentOrg.id!; + final String query = PostQueries().getPostsById(currentOrgID); + final result = await _dbFunctions.gqlAuthQuery(query); + + //Checking if the dbFunctions return the postJSON, if not return. + if (result.data!['postsByOrganization'] == null) return; + + final List postsJson = result.data!['postsByOrganization'] as List; + + postsJson.forEach((postJson) { + final Post post = Post.fromJson(postJson as Map); + if (!_renderedPostID.contains(post.sId)) { + _posts.insert(0, post); + _renderedPostID.add(post.sId); + } + }); + _postStreamController.add(_posts); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService/postStream.md b/talawa-mobile-docs/services_post_service/PostService/postStream.md new file mode 100644 index 000000000..80065aede --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService/postStream.md @@ -0,0 +1,35 @@ + + + +# postStream property + + + + + + + + + +[Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)>> postStream + + + + + + + + +## Implementation + +```dart +Stream> get postStream => _postStream; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService/removeLike.md b/talawa-mobile-docs/services_post_service/PostService/removeLike.md new file mode 100644 index 000000000..fed21d019 --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService/removeLike.md @@ -0,0 +1,46 @@ + + + +# removeLike method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> removeLike +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) + + + + + +

This function is used to remove like from the Post.

+

params:

+
    +
  • postId : id of the post where like need to be removed.
  • +
+ + + +## Implementation + +```dart +Future removeLike(String postID) async { + _removeLocal(postID); + final String mutation = PostQueries().removeLike(); + final result = await _dbFunctions + .gqlAuthMutation(mutation, variables: {"postID": postID}); + print(result); + return result; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService/setOrgStreamSubscription.md b/talawa-mobile-docs/services_post_service/PostService/setOrgStreamSubscription.md new file mode 100644 index 000000000..f4ee899b4 --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService/setOrgStreamSubscription.md @@ -0,0 +1,43 @@ + + + +# setOrgStreamSubscription method + + + + + + + + +void setOrgStreamSubscription +() + + + + + + + + +## Implementation + +```dart +void setOrgStreamSubscription() { + _userConfig.currentOrgInfoStream.listen((updatedOrganization) { + if (updatedOrganization != _currentOrg) { + print("org changes from post service"); + _renderedPostID.clear(); + _currentOrg = updatedOrganization; + getPosts(); + } + }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/PostService/updatedPostStream.md b/talawa-mobile-docs/services_post_service/PostService/updatedPostStream.md new file mode 100644 index 000000000..3048a2fe6 --- /dev/null +++ b/talawa-mobile-docs/services_post_service/PostService/updatedPostStream.md @@ -0,0 +1,35 @@ + + + +# updatedPostStream property + + + + + + + + + +[Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[Post](../../models_post_post_model/Post-class.md)> updatedPostStream + + + + + + + + +## Implementation + +```dart +Stream get updatedPostStream => _updatedPostStream; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_post_service/services_post_service-library.md b/talawa-mobile-docs/services_post_service/services_post_service-library.md new file mode 100644 index 000000000..4a739d0e2 --- /dev/null +++ b/talawa-mobile-docs/services_post_service/services_post_service-library.md @@ -0,0 +1,38 @@ + + + + +# post_service library + + + + + + + + + + + +## Classes + +##### [PostService](../services_post_service/PostService-class.md) + + + +PostService class provides functions in the context of a Post. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig-class.md b/talawa-mobile-docs/services_size_config/SizeConfig-class.md new file mode 100644 index 000000000..d0897bbeb --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig-class.md @@ -0,0 +1,175 @@ + + + +# SizeConfig class + + + + + + + + + +

SizeConfig class is used to initialise the height and width of the media.

+ + + + +## Constructors + +[SizeConfig](../services_size_config/SizeConfig/SizeConfig.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [init](../services_size_config/SizeConfig/init.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [test](../services_size_config/SizeConfig/test.md)() void + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + +## Static Properties + +##### [blockSizeHorizontal](../services_size_config/SizeConfig/blockSizeHorizontal.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + +##### [blockSizeVertical](../services_size_config/SizeConfig/blockSizeVertical.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + +##### [paddingTop](../services_size_config/SizeConfig/paddingTop.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + +##### [safeBlockHorizontal](../services_size_config/SizeConfig/safeBlockHorizontal.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + +##### [safeBlockVertical](../services_size_config/SizeConfig/safeBlockVertical.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + +##### [screenHeight](../services_size_config/SizeConfig/screenHeight.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + +##### [screenWidth](../services_size_config/SizeConfig/screenWidth.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_read / write_ + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/SizeConfig.md b/talawa-mobile-docs/services_size_config/SizeConfig/SizeConfig.md new file mode 100644 index 000000000..7a2926039 --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/SizeConfig.md @@ -0,0 +1,24 @@ + + + +# SizeConfig constructor + + + + + + + +SizeConfig() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/blockSizeHorizontal.md b/talawa-mobile-docs/services_size_config/SizeConfig/blockSizeHorizontal.md new file mode 100644 index 000000000..c497d83ad --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/blockSizeHorizontal.md @@ -0,0 +1,32 @@ + + + +# blockSizeHorizontal property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? blockSizeHorizontal + +_read / write_ + + + + + + +## Implementation + +```dart +static double? blockSizeHorizontal; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/blockSizeVertical.md b/talawa-mobile-docs/services_size_config/SizeConfig/blockSizeVertical.md new file mode 100644 index 000000000..1d691b2cf --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/blockSizeVertical.md @@ -0,0 +1,32 @@ + + + +# blockSizeVertical property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? blockSizeVertical + +_read / write_ + + + + + + +## Implementation + +```dart +static double? blockSizeVertical; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/init.md b/talawa-mobile-docs/services_size_config/SizeConfig/init.md new file mode 100644 index 000000000..793880339 --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/init.md @@ -0,0 +1,49 @@ + + + +# init method + + + + + + + + +void init +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + + + + +## Implementation + +```dart +void init(BuildContext context) { + _mediaQueryData = MediaQuery.of(context); + screenWidth = _mediaQueryData.size.width; + screenHeight = _mediaQueryData.size.height; + blockSizeHorizontal = screenWidth! / 100; + blockSizeVertical = screenHeight! / 100; + + _safeAreaHorizontal = + _mediaQueryData.padding.left + _mediaQueryData.padding.right; + _safeAreaVertical = + _mediaQueryData.padding.top + _mediaQueryData.padding.bottom; + safeBlockHorizontal = (screenWidth! - _safeAreaHorizontal) / 100; + safeBlockVertical = (screenHeight! - _safeAreaVertical) / 100; + debugPrint("safeBlockHorizontal: $safeBlockHorizontal"); + debugPrint("safeBlockVertical: $safeBlockVertical"); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/paddingTop.md b/talawa-mobile-docs/services_size_config/SizeConfig/paddingTop.md new file mode 100644 index 000000000..28987e0b3 --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/paddingTop.md @@ -0,0 +1,32 @@ + + + +# paddingTop property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? paddingTop + +_read / write_ + + + + + + +## Implementation + +```dart +static double? paddingTop; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/safeBlockHorizontal.md b/talawa-mobile-docs/services_size_config/SizeConfig/safeBlockHorizontal.md new file mode 100644 index 000000000..296f95581 --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/safeBlockHorizontal.md @@ -0,0 +1,32 @@ + + + +# safeBlockHorizontal property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? safeBlockHorizontal + +_read / write_ + + + + + + +## Implementation + +```dart +static double? safeBlockHorizontal; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/safeBlockVertical.md b/talawa-mobile-docs/services_size_config/SizeConfig/safeBlockVertical.md new file mode 100644 index 000000000..aa09b2ba7 --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/safeBlockVertical.md @@ -0,0 +1,32 @@ + + + +# safeBlockVertical property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? safeBlockVertical + +_read / write_ + + + + + + +## Implementation + +```dart +static double? safeBlockVertical; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/screenHeight.md b/talawa-mobile-docs/services_size_config/SizeConfig/screenHeight.md new file mode 100644 index 000000000..4aab01da1 --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/screenHeight.md @@ -0,0 +1,32 @@ + + + +# screenHeight property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? screenHeight + +_read / write_ + + + + + + +## Implementation + +```dart +static double? screenHeight; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/screenWidth.md b/talawa-mobile-docs/services_size_config/SizeConfig/screenWidth.md new file mode 100644 index 000000000..5f14d7c95 --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/screenWidth.md @@ -0,0 +1,32 @@ + + + +# screenWidth property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? screenWidth + +_read / write_ + + + + + + +## Implementation + +```dart +static double? screenWidth; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/SizeConfig/test.md b/talawa-mobile-docs/services_size_config/SizeConfig/test.md new file mode 100644 index 000000000..1f2a3819e --- /dev/null +++ b/talawa-mobile-docs/services_size_config/SizeConfig/test.md @@ -0,0 +1,48 @@ + + + +# test method + + + + + + + + +void test +() + + + + + + + + +## Implementation + +```dart +void test() { + _mediaQueryData = + const MediaQueryData(size: Size(360, 684), padding: EdgeInsets.zero); + screenWidth = _mediaQueryData.size.width; + screenHeight = _mediaQueryData.size.height; + blockSizeHorizontal = screenWidth! / 100; + blockSizeVertical = screenHeight! / 100; + + _safeAreaHorizontal = + _mediaQueryData.padding.left + _mediaQueryData.padding.right; + _safeAreaVertical = + _mediaQueryData.padding.top + _mediaQueryData.padding.bottom; + safeBlockHorizontal = (screenWidth! - _safeAreaHorizontal) / 100; + safeBlockVertical = (screenHeight! - _safeAreaVertical) / 100; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_size_config/services_size_config-library.md b/talawa-mobile-docs/services_size_config/services_size_config-library.md new file mode 100644 index 000000000..040d2d32b --- /dev/null +++ b/talawa-mobile-docs/services_size_config/services_size_config-library.md @@ -0,0 +1,38 @@ + + + + +# size_config library + + + + + + + + + + + +## Classes + +##### [SizeConfig](../services_size_config/SizeConfig-class.md) + + + +SizeConfig class is used to initialise the height and width of the media. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService-class.md b/talawa-mobile-docs/services_task_service/TaskService-class.md new file mode 100644 index 000000000..12a51accd --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService-class.md @@ -0,0 +1,163 @@ + + + +# TaskService class + + + + + + + + + +

PostService class provides functions in the context of a Task.

+

Services include:

+
    +
  • getTasksForEvent : to get the task for the event.
  • +
  • getTasksByUser : to get the task added by the user.
  • +
  • editTask : to edit the task added by the user.
  • +
  • createTask : to create the task for the event.
  • +
  • deleteTask : to delete the task added by the user.
  • +
+ + + + +## Constructors + +[TaskService](../services_task_service/TaskService/TaskService.md) () + + + + +## Properties + +##### [callbackNotifyListeners](../services_task_service/TaskService/callbackNotifyListeners.md) ↔ [VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [tasks](../services_task_service/TaskService/tasks.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Task](../models_task_task_model/Task-class.md)> + + + + +_read-only_ + + + + + +## Methods + +##### [createTask](../services_task_service/TaskService/createTask.md)({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) deadline, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + +This function is used to create a new task for the event. + + + + +##### [deleteTask](../services_task_service/TaskService/deleteTask.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) creatorId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to delete a task. + + + + +##### [editTask](../services_task_service/TaskService/editTask.md)({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) deadline, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + +This function is used to edit the task created by the user. + + + + +##### [getTasksByUser](../services_task_service/TaskService/getTasksByUser.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to fetch and return all tasks added by the current user. + + + + +##### [getTasksForEvent](../services_task_service/TaskService/getTasksForEvent.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to get all the tasks for the event. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService/TaskService.md b/talawa-mobile-docs/services_task_service/TaskService/TaskService.md new file mode 100644 index 000000000..14f9eba9f --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService/TaskService.md @@ -0,0 +1,24 @@ + + + +# TaskService constructor + + + + + + + +TaskService() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService/callbackNotifyListeners.md b/talawa-mobile-docs/services_task_service/TaskService/callbackNotifyListeners.md new file mode 100644 index 000000000..13f1edc6f --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService/callbackNotifyListeners.md @@ -0,0 +1,32 @@ + + + +# callbackNotifyListeners property + + + + + + + +[VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) callbackNotifyListeners + +_read / write_ + + + + + + +## Implementation + +```dart +late VoidCallback callbackNotifyListeners; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService/createTask.md b/talawa-mobile-docs/services_task_service/TaskService/createTask.md new file mode 100644 index 000000000..3e08ed9d6 --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService/createTask.md @@ -0,0 +1,66 @@ + + + +# createTask method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> createTask +({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) deadline, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId}) + + + + + +

This function is used to create a new task for the event.

+

params:

+
    +
  • title : task title.
  • +
  • description : task description.
  • +
  • deadline : task deadline.
  • +
  • eventId : Event for which task need to be create.
  • +
+ + + +## Implementation + +```dart +Future createTask({ + required String title, + required String description, + required String deadline, + required String eventId, +}) async { + _databaseMutationFunctions + .refreshAccessToken(_userConfig.currentUser.refreshToken!); + final res = await _databaseMutationFunctions.gqlAuthMutation( + TaskQueries.addTask( + title: title, + description: description, + deadline: deadline, + eventId: eventId, + ), + ); + + if (res != null) { + final task = res.data!['createTask'] as Map; + _tasks.add(Task.fromJson(task)); + callbackNotifyListeners(); + return true; + } + return false; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService/deleteTask.md b/talawa-mobile-docs/services_task_service/TaskService/deleteTask.md new file mode 100644 index 000000000..2487482bc --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService/deleteTask.md @@ -0,0 +1,48 @@ + + + +# deleteTask method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> deleteTask +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) creatorId) + + + + + +

This function is used to delete a task.

+

params:

+
    +
  • taskId : id of a task need to be deleted.
  • +
  • creatorId : id of the task creator.
  • +
+ + + +## Implementation + +```dart +Future deleteTask(String taskId, String creatorId) async { + if (creatorId == _userConfig.currentUser.id) { + await _databaseMutationFunctions + .refreshAccessToken(_userConfig.currentUser.refreshToken!); + final res = await _databaseMutationFunctions + .gqlAuthMutation(TaskQueries.deleteTask(taskId)); + if (res != null) _tasks.removeWhere((task) => task.id == taskId); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService/editTask.md b/talawa-mobile-docs/services_task_service/TaskService/editTask.md new file mode 100644 index 000000000..e0ff4bf2c --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService/editTask.md @@ -0,0 +1,72 @@ + + + +# editTask method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> editTask +({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) deadline, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId}) + + + + + +

This function is used to edit the task created by the user.

+

params:

+
    +
  • title : task title.
  • +
  • description : task description.
  • +
  • deadline : task deadline.
  • +
  • taskId : task Id.
  • +
+ + + +## Implementation + +```dart +Future editTask({ + required String title, + required String description, + required String deadline, + required String taskId, +}) async { + _databaseMutationFunctions + .refreshAccessToken(_userConfig.currentUser.refreshToken!); + final res = await _databaseMutationFunctions.gqlAuthMutation( + TaskQueries.editTask( + title: title, + description: description, + deadline: deadline, + taskId: taskId, + ), + ); + + // if res is not null. + if (res != null) { + final updatedtaskJson = res.data!['updateTask'] as Map; + final index = _tasks.indexWhere((task) => task.id == taskId); + if (index == -1) return false; + final updatedtask = Task.fromJson(updatedtaskJson); + updatedtask.event.title = _tasks[index].event.title; + _tasks[index] = updatedtask; + callbackNotifyListeners(); + // if successfully updated then return true. + return true; + } + return false; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService/getTasksByUser.md b/talawa-mobile-docs/services_task_service/TaskService/getTasksByUser.md new file mode 100644 index 000000000..ce9e59af3 --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService/getTasksByUser.md @@ -0,0 +1,48 @@ + + + +# getTasksByUser method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getTasksByUser +() + + + + + +

This function is used to fetch and return all tasks added by the current user.

+ + + +## Implementation + +```dart +Future getTasksByUser() async { + await _databaseMutationFunctions + .refreshAccessToken(_userConfig.currentUser.refreshToken!); + final res = await _databaseMutationFunctions + .gqlNonAuthQuery(TaskQueries.userTasks(_userConfig.currentUser.id!)); + + if (res != null) { + _tasks.clear(); + final tasksList = res.data!['tasksByUser'] as List; + tasksList.forEach((task) { + _tasks.add(Task.fromJson(task as Map)); + }); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService/getTasksForEvent.md b/talawa-mobile-docs/services_task_service/TaskService/getTasksForEvent.md new file mode 100644 index 000000000..21536bf75 --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService/getTasksForEvent.md @@ -0,0 +1,52 @@ + + + +# getTasksForEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getTasksForEvent +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) + + + + + +

This function is used to get all the tasks for the event.

+

params:

+
    +
  • eventId : id of an event for which tasks need to fetched,
  • +
+ + + +## Implementation + +```dart +Future getTasksForEvent(String eventId) async { + await _databaseMutationFunctions + .refreshAccessToken(_userConfig.currentUser.refreshToken!); + final res = await _databaseMutationFunctions + .gqlNonAuthQuery(TaskQueries.eventTasks(eventId)); + + if (res != null) { + _tasks.clear(); + final tasksList = res.data!['tasksByEvent'] as List; + tasksList.forEach((task) { + _tasks.add(Task.fromJson(task as Map)); + }); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/TaskService/tasks.md b/talawa-mobile-docs/services_task_service/TaskService/tasks.md new file mode 100644 index 000000000..aad6505b3 --- /dev/null +++ b/talawa-mobile-docs/services_task_service/TaskService/tasks.md @@ -0,0 +1,35 @@ + + + +# tasks property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Task](../../models_task_task_model/Task-class.md)> tasks + + + + + + + + +## Implementation + +```dart +List get tasks => _tasks; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_task_service/services_task_service-library.md b/talawa-mobile-docs/services_task_service/services_task_service-library.md new file mode 100644 index 000000000..74a1bb179 --- /dev/null +++ b/talawa-mobile-docs/services_task_service/services_task_service-library.md @@ -0,0 +1,38 @@ + + + + +# task_service library + + + + + + + + + + + +## Classes + +##### [TaskService](../services_task_service/TaskService-class.md) + + + +PostService class provides functions in the context of a Task. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md new file mode 100644 index 000000000..318a00e23 --- /dev/null +++ b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md @@ -0,0 +1,125 @@ + + + +# MultiMediaPickerService class + + + + + + + + + +

This is a third party service which provide the service to select the image from.

+

gallery and then image can be cropped as well.

+

Services include:

+
    +
  • getPhotoFromGallery - Used to select photo from gallery.
  • +
  • cropImage - Used to crop the selected image.
  • +
+ + + + +## Constructors + +[MultiMediaPickerService](../services_third_party_service_multi_media_pick_service/MultiMediaPickerService/MultiMediaPickerService.md) () + + + + +## Properties + +##### [fileStream](../services_third_party_service_multi_media_pick_service/MultiMediaPickerService/fileStream.md) → [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html) + + + +This function returns the stream of files. +_read-only_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [cropImage](../services_third_party_service_multi_media_pick_service/MultiMediaPickerService/cropImage.md)({required [File](https://api.flutter.dev/flutter/dart-io/File-class.html) imageFile}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[File](https://api.flutter.dev/flutter/dart-io/File-class.html)?> + + + +This function is used to crop the image selected by the user. + + + + +##### [getPhotoFromGallery](../services_third_party_service_multi_media_pick_service/MultiMediaPickerService/getPhotoFromGallery.md)({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) camera = false}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[File](https://api.flutter.dev/flutter/dart-io/File-class.html)?> + + + +This function is used to pick the image from gallery or to click the image from user's camera. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/MultiMediaPickerService.md b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/MultiMediaPickerService.md new file mode 100644 index 000000000..28c50264b --- /dev/null +++ b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/MultiMediaPickerService.md @@ -0,0 +1,32 @@ + + + +# MultiMediaPickerService constructor + + + + + + + +MultiMediaPickerService() + + + + + +## Implementation + +```dart +MultiMediaPickerService() { + _picker = locator(); + _fileStream = _fileStreamController.stream.asBroadcastStream(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/cropImage.md b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/cropImage.md new file mode 100644 index 000000000..fdff8f3c1 --- /dev/null +++ b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/cropImage.md @@ -0,0 +1,77 @@ + + + +# cropImage method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[File](https://api.flutter.dev/flutter/dart-io/File-class.html)?> cropImage +({required [File](https://api.flutter.dev/flutter/dart-io/File-class.html) imageFile}) + + + + + +

This function is used to crop the image selected by the user.

+

The function accepts a File type image and returns File type of cropped image.

+

params:

+
    +
  • imageFile: the image file to be cropped.
  • +
+

returns:

+
    +
  • Future<File?>: the image after been cropped.
  • +
+ + + +## Implementation + +```dart +Future cropImage({required File imageFile}) async { + // try, to crop the image and returns a File with cropped image path. + try { + final CroppedFile? croppedImage = await locator().cropImage( + sourcePath: imageFile.path, + aspectRatioPresets: [ + CropAspectRatioPreset.square, + CropAspectRatioPreset.original, + ], + uiSettings: [ + AndroidUiSettings( + toolbarTitle: 'Crop Image', + toolbarColor: const Color(0xff18191A), + toolbarWidgetColor: Colors.white, + backgroundColor: Colors.black, + cropGridColor: Colors.white, + initAspectRatio: CropAspectRatioPreset.original, + lockAspectRatio: false, + ), + IOSUiSettings( + minimumAspectRatio: 1.0, + ) + ], + ); + if (croppedImage != null) { + return File(croppedImage.path); + } + } catch (e) { + print( + "MultiMediaPickerService : Exception occurred while cropping Image", + ); + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/fileStream.md b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/fileStream.md new file mode 100644 index 000000000..71d2ea7a2 --- /dev/null +++ b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/fileStream.md @@ -0,0 +1,42 @@ + + + +# fileStream property + + + + + + + + + +[Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html) fileStream + + + + + +

This function returns the stream of files.

+

params: +None.

+

returns:

+
    +
  • Stream<dynamic>: Stream of files.
  • +
+ + + +## Implementation + +```dart +Stream get fileStream => _fileStream; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/getPhotoFromGallery.md b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/getPhotoFromGallery.md new file mode 100644 index 000000000..d97759f54 --- /dev/null +++ b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/MultiMediaPickerService/getPhotoFromGallery.md @@ -0,0 +1,78 @@ + + + +# getPhotoFromGallery method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[File](https://api.flutter.dev/flutter/dart-io/File-class.html)?> getPhotoFromGallery +({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) camera = false}) + + + + + +

This function is used to pick the image from gallery or to click the image from user's camera.

+

The function first ask for the permission to access the camera, if denied then returns a message in.

+

custom Dialog Box. This function returns a File type for which camera variable is false by default.

+

params:

+
    +
  • camera: if true then open camera for image, else open gallery to select image.
  • +
+

returns:

+
    +
  • Future<File?>: the image the user choosed.
  • +
+ + + +## Implementation + +```dart +Future getPhotoFromGallery({bool camera = false}) async { + // asking for user's camera access permission. + try { + // checking for the image source, it could be camera or gallery. + final image = await _picker.pickImage( + source: camera ? ImageSource.camera : ImageSource.gallery, + ); + // if image is selected or not null, call the cropImage function that provide service to crop the selected image. + if (image != null) { + return await cropImage(imageFile: File(image.path)); + } + } catch (e) { + // if the permission denied or error occurs. + if (e is PlatformException && e.code == 'camera_access_denied') { + // push the dialog alert with the message. + locator().pushDialog( + CustomAlertDialog( + success: () { + locator().pop(); + openAppSettings(); + }, + dialogTitle: 'Permission Denied', + successText: 'SETTINGS', + dialogSubTitle: + "Camera permission is required, to use this feature, give permission from app settings", + ), + ); + } + print( + "MultiMediaPickerService : Exception occurred while choosing photo from the gallery $e", + ); + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/services_third_party_service_multi_media_pick_service-library.md b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/services_third_party_service_multi_media_pick_service-library.md new file mode 100644 index 000000000..5eecc0aa8 --- /dev/null +++ b/talawa-mobile-docs/services_third_party_service_multi_media_pick_service/services_third_party_service_multi_media_pick_service-library.md @@ -0,0 +1,38 @@ + + + + +# multi_media_pick_service library + + + + + + + + + + + +## Classes + +##### [MultiMediaPickerService](../services_third_party_service_multi_media_pick_service/MultiMediaPickerService-class.md) + + + +This is a third party service which provide the service to select the image from. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig-class.md b/talawa-mobile-docs/services_user_config/UserConfig-class.md new file mode 100644 index 000000000..01c67b0d4 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig-class.md @@ -0,0 +1,237 @@ + + + +# UserConfig class + + + + + + + + + +

UserConfig class provides different services in the context of the User.

+

Services include:

+
    +
  • userLoggedIn : helps to make user logged in to the application.
  • +
  • updateUserJoinedOrg : helps to update the user joined organization.
  • +
  • updateUserCreatedOrg : helps to update the user created organization.
  • +
  • updateUserMemberRequestOrg : helps to update the User membership request for the organization.
  • +
  • updateUserAdminOrg : helps to update the Admin of the Organization.
  • +
  • updateAccessToken : helps to update the access token of an user.
  • +
  • updateUser : helps to update the user.
  • +
+ + + + +## Constructors + +[UserConfig](../services_user_config/UserConfig/UserConfig.md) () + + + + +## Properties + +##### [currentOrg](../services_user_config/UserConfig/currentOrg.md) ↔ [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + + +_read / write_ + + + +##### [currentOrgInfoController](../services_user_config/UserConfig/currentOrgInfoController.md) → [StreamController](https://api.flutter.dev/flutter/dart-async/StreamController-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> + + + + +_read-only_ + + + +##### [currentOrgInfoStream](../services_user_config/UserConfig/currentOrgInfoStream.md) → [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> + + + + +_read-only_ + + + +##### [currentOrgName](../services_user_config/UserConfig/currentOrgName.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read-only_ + + + +##### [currentUser](../services_user_config/UserConfig/currentUser.md) ↔ [User](../models_user_user_info/User-class.md) + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [initialiseStream](../services_user_config/UserConfig/initialiseStream.md)() void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [saveCurrentOrgInHive](../services_user_config/UserConfig/saveCurrentOrgInHive.md)([OrgInfo](../models_organization_org_info/OrgInfo-class.md) saveOrgAsCurrent) void + + + + + + + + +##### [saveUserInHive](../services_user_config/UserConfig/saveUserInHive.md)() void + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [updateAccessToken](../services_user_config/UserConfig/updateAccessToken.md)({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) accessToken, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) refreshToken}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to updated the access token of the user. + + + + +##### [updateUser](../services_user_config/UserConfig/updateUser.md)([User](../models_user_user_info/User-class.md) updatedUserDetails) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + +This function is used to update the user details. + + + + +##### [updateUserAdminOrg](../services_user_config/UserConfig/updateUserAdminOrg.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> orgDetails) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to update the organization admin. + + + + +##### [updateUserCreatedOrg](../services_user_config/UserConfig/updateUserCreatedOrg.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> orgDetails) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to update the user created organization. + + + + +##### [updateUserJoinedOrg](../services_user_config/UserConfig/updateUserJoinedOrg.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> orgDetails) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to update the user joined organization. + + + + +##### [updateUserMemberRequestOrg](../services_user_config/UserConfig/updateUserMemberRequestOrg.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> orgDetails) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function is used to update the user request to join the organization. + + + + +##### [userLoggedIn](../services_user_config/UserConfig/userLoggedIn.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + +This function is used to log in the user. + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/UserConfig.md b/talawa-mobile-docs/services_user_config/UserConfig/UserConfig.md new file mode 100644 index 000000000..9472b066e --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/UserConfig.md @@ -0,0 +1,24 @@ + + + +# UserConfig constructor + + + + + + + +UserConfig() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/currentOrg.md b/talawa-mobile-docs/services_user_config/UserConfig/currentOrg.md new file mode 100644 index 000000000..a83a2ef49 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/currentOrg.md @@ -0,0 +1,53 @@ + + + +# currentOrg property + + + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md) currentOrg + + + + + + + + +## Implementation + +```dart +OrgInfo get currentOrg => _currentOrg!; +``` + + + + + +currentOrg= +([OrgInfo](../../models_organization_org_info/OrgInfo-class.md) org) + + + + + + + +## Implementation + +```dart +set currentOrg(OrgInfo org) => _currentOrg = org; +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/currentOrgInfoController.md b/talawa-mobile-docs/services_user_config/UserConfig/currentOrgInfoController.md new file mode 100644 index 000000000..6fccf53f6 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/currentOrgInfoController.md @@ -0,0 +1,36 @@ + + + +# currentOrgInfoController property + + + + + + + + + +[StreamController](https://api.flutter.dev/flutter/dart-async/StreamController-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> currentOrgInfoController + + + + + + + + +## Implementation + +```dart +StreamController get currentOrgInfoController => + _currentOrgInfoController; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/currentOrgInfoStream.md b/talawa-mobile-docs/services_user_config/UserConfig/currentOrgInfoStream.md new file mode 100644 index 000000000..4a2a60ece --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/currentOrgInfoStream.md @@ -0,0 +1,35 @@ + + + +# currentOrgInfoStream property + + + + + + + + + +[Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> currentOrgInfoStream + + + + + + + + +## Implementation + +```dart +Stream get currentOrgInfoStream => _currentOrgInfoStream; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/currentOrgName.md b/talawa-mobile-docs/services_user_config/UserConfig/currentOrgName.md new file mode 100644 index 000000000..64d6a00c5 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/currentOrgName.md @@ -0,0 +1,35 @@ + + + +# currentOrgName property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) currentOrgName + + + + + + + + +## Implementation + +```dart +String get currentOrgName => _currentOrg!.name!; +``` + + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/currentUser.md b/talawa-mobile-docs/services_user_config/UserConfig/currentUser.md new file mode 100644 index 000000000..77f70037a --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/currentUser.md @@ -0,0 +1,55 @@ + + + +# currentUser property + + + + + + + + + +[User](../../models_user_user_info/User-class.md) currentUser + + + + + + + + +## Implementation + +```dart +User get currentUser => _currentUser!; +``` + + + + + +currentUser= +([User](../../models_user_user_info/User-class.md) user) + + + + + + + +## Implementation + +```dart +set currentUser(User user) { + _currentUser = user; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/initialiseStream.md b/talawa-mobile-docs/services_user_config/UserConfig/initialiseStream.md new file mode 100644 index 000000000..0fda93269 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/initialiseStream.md @@ -0,0 +1,37 @@ + + + +# initialiseStream method + + + + + + + + +void initialiseStream +() + + + + + + + + +## Implementation + +```dart +void initialiseStream() { + _currentOrgInfoStream = + _currentOrgInfoController.stream.asBroadcastStream(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/saveCurrentOrgInHive.md b/talawa-mobile-docs/services_user_config/UserConfig/saveCurrentOrgInHive.md new file mode 100644 index 000000000..6eb038ac8 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/saveCurrentOrgInHive.md @@ -0,0 +1,43 @@ + + + +# saveCurrentOrgInHive method + + + + + + + + +void saveCurrentOrgInHive +([OrgInfo](../../models_organization_org_info/OrgInfo-class.md) saveOrgAsCurrent) + + + + + + + + +## Implementation + +```dart +void saveCurrentOrgInHive(OrgInfo saveOrgAsCurrent) { + _currentOrg = saveOrgAsCurrent; + _currentOrgInfoController.add(_currentOrg!); + final box = Hive.box('currentOrg'); + if (box.get('org') == null) { + box.put('org', _currentOrg!); + } else { + box.put('org', _currentOrg!); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/saveUserInHive.md b/talawa-mobile-docs/services_user_config/UserConfig/saveUserInHive.md new file mode 100644 index 000000000..53dcd9a8a --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/saveUserInHive.md @@ -0,0 +1,41 @@ + + + +# saveUserInHive method + + + + + + + + +void saveUserInHive +() + + + + + + + + +## Implementation + +```dart +void saveUserInHive() { + final box = Hive.box('currentUser'); + if (box.get('user') == null) { + box.put('user', _currentUser!); + } else { + box.put('user', _currentUser!); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/updateAccessToken.md b/talawa-mobile-docs/services_user_config/UserConfig/updateAccessToken.md new file mode 100644 index 000000000..7d38a3491 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/updateAccessToken.md @@ -0,0 +1,47 @@ + + + +# updateAccessToken method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) updateAccessToken +({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) accessToken, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) refreshToken}) + + + + + +

This function is used to updated the access token of the user.

+

params:

+
    +
  • accessToken
  • +
  • refreshToken
  • +
+ + + +## Implementation + +```dart +Future updateAccessToken({ + required String accessToken, + required String refreshToken, +}) async { + _currentUser!.refreshToken = refreshToken; + _currentUser!.authToken = accessToken; + saveUserInHive(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/updateUser.md b/talawa-mobile-docs/services_user_config/UserConfig/updateUser.md new file mode 100644 index 000000000..d10b9600b --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/updateUser.md @@ -0,0 +1,50 @@ + + + +# updateUser method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> updateUser +([User](../../models_user_user_info/User-class.md) updatedUserDetails) + + + + + +

This function is used to update the user details.

+

params:

+
    +
  • updatedUserDetails : User type variable containing all the details of an user need to be updated.
  • +
+ + + +## Implementation + +```dart +Future updateUser(User updatedUserDetails) async { + try { + _currentUser = updatedUserDetails; + saveUserInHive(); + graphqlConfig.getToken(); + databaseFunctions.init(); + return true; + } on Exception catch (e) { + debugPrint(e.toString()); + return false; + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/updateUserAdminOrg.md b/talawa-mobile-docs/services_user_config/UserConfig/updateUserAdminOrg.md new file mode 100644 index 000000000..399b73f5e --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/updateUserAdminOrg.md @@ -0,0 +1,42 @@ + + + +# updateUserAdminOrg method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) updateUserAdminOrg +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> orgDetails) + + + + + +

This function is used to update the organization admin.

+

params:

+
    +
  • orgDetails : details of the organization.
  • +
+ + + +## Implementation + +```dart +Future updateUserAdminOrg(List orgDetails) async { + _currentUser!.updateAdminFor(orgDetails); + saveUserInHive(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/updateUserCreatedOrg.md b/talawa-mobile-docs/services_user_config/UserConfig/updateUserCreatedOrg.md new file mode 100644 index 000000000..36ff305c0 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/updateUserCreatedOrg.md @@ -0,0 +1,42 @@ + + + +# updateUserCreatedOrg method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) updateUserCreatedOrg +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> orgDetails) + + + + + +

This function is used to update the user created organization.

+

params:

+
    +
  • orgDetails : details of the organization that user created.
  • +
+ + + +## Implementation + +```dart +Future updateUserCreatedOrg(List orgDetails) async { + _currentUser!.updateCreatedOrg(orgDetails); + saveUserInHive(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/updateUserJoinedOrg.md b/talawa-mobile-docs/services_user_config/UserConfig/updateUserJoinedOrg.md new file mode 100644 index 000000000..2b99aa06a --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/updateUserJoinedOrg.md @@ -0,0 +1,42 @@ + + + +# updateUserJoinedOrg method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) updateUserJoinedOrg +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> orgDetails) + + + + + +

This function is used to update the user joined organization.

+

params:

+
    +
  • orgDetails : details of the organization that user joined.
  • +
+ + + +## Implementation + +```dart +Future updateUserJoinedOrg(List orgDetails) async { + _currentUser!.updateJoinedOrg(orgDetails); + saveUserInHive(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/updateUserMemberRequestOrg.md b/talawa-mobile-docs/services_user_config/UserConfig/updateUserMemberRequestOrg.md new file mode 100644 index 000000000..8cef35b6a --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/updateUserMemberRequestOrg.md @@ -0,0 +1,42 @@ + + + +# updateUserMemberRequestOrg method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) updateUserMemberRequestOrg +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> orgDetails) + + + + + +

This function is used to update the user request to join the organization.

+

params:

+
    +
  • orgDetails : details of the organization that user requested to join.
  • +
+ + + +## Implementation + +```dart +Future updateUserMemberRequestOrg(List orgDetails) async { + _currentUser!.updateMemberRequestOrg(orgDetails); + saveUserInHive(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/UserConfig/userLoggedIn.md b/talawa-mobile-docs/services_user_config/UserConfig/userLoggedIn.md new file mode 100644 index 000000000..7ff776029 --- /dev/null +++ b/talawa-mobile-docs/services_user_config/UserConfig/userLoggedIn.md @@ -0,0 +1,78 @@ + + + +# userLoggedIn method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> userLoggedIn +() + + + + + +

This function is used to log in the user.

+ + + +## Implementation + +```dart +Future userLoggedIn() async { + initialiseStream(); + final boxUser = Hive.box('currentUser'); + final boxOrg = Hive.box('currentOrg'); + _currentOrg = + boxOrg.get('org') ?? OrgInfo(name: 'Organization Name', id: 'null'); + _currentOrgInfoController.add(_currentOrg!); + + _currentUser = boxUser.get('user'); + // if there is not currentUser then returns false. + if (_currentUser == null) { + _currentUser = User(id: 'null', authToken: 'null'); + return false; + } + // generate access token + graphqlConfig.getToken().then((value) async { + databaseFunctions.init(); + try { + final QueryResult result = await databaseFunctions.gqlAuthQuery( + queries.fetchUserInfo, + variables: {'id': currentUser.id}, + ) as QueryResult; + final User userInfo = User.fromJson( + result.data!['users'][0] as Map, + fromOrg: true, + ); + userInfo.authToken = userConfig.currentUser.authToken; + userInfo.refreshToken = userConfig.currentUser.refreshToken; + userConfig.updateUser(userInfo); + _currentOrg ??= _currentUser!.joinedOrganizations![0]; + _currentOrgInfoController.add(_currentOrg!); + + saveUserInHive(); + return true; + } on Exception catch (e) { + print(e); + navigationService.showTalawaErrorSnackBar( + "Couldn't update User details", + MessageType.error, + ); + } + }); + return true; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/services_user_config/services_user_config-library.md b/talawa-mobile-docs/services_user_config/services_user_config-library.md new file mode 100644 index 000000000..3fb10c55d --- /dev/null +++ b/talawa-mobile-docs/services_user_config/services_user_config-library.md @@ -0,0 +1,38 @@ + + + + +# user_config library + + + + + + + + + + + +## Classes + +##### [UserConfig](../services_user_config/UserConfig-class.md) + + + +UserConfig class provides different services in the context of the User. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/splash_screen/SplashScreen-class.md b/talawa-mobile-docs/splash_screen/SplashScreen-class.md new file mode 100644 index 000000000..ec5863795 --- /dev/null +++ b/talawa-mobile-docs/splash_screen/SplashScreen-class.md @@ -0,0 +1,199 @@ + + + +# SplashScreen class + + + + + + + + + +

This widget return the SplashScreen. Splash Screen is the first screen that +we see when we run our application. It is also known as Launch Screen.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- SplashScreen + + + + + + + + +## Constructors + +[SplashScreen](../splash_screen/SplashScreen/SplashScreen.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, [int](https://api.flutter.dev/flutter/dart-core/int-class.html) mainScreenIndex = 0}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [mainScreenIndex](../splash_screen/SplashScreen/mainScreenIndex.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../splash_screen/SplashScreen/createState.md)() _SplashScreenState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/splash_screen/SplashScreen/SplashScreen.md b/talawa-mobile-docs/splash_screen/SplashScreen/SplashScreen.md new file mode 100644 index 000000000..f1eb432e8 --- /dev/null +++ b/talawa-mobile-docs/splash_screen/SplashScreen/SplashScreen.md @@ -0,0 +1,30 @@ + + + +# SplashScreen constructor + + + + + + +const +SplashScreen({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, [int](https://api.flutter.dev/flutter/dart-core/int-class.html) mainScreenIndex = 0}) + + + + + +## Implementation + +```dart +const SplashScreen({required Key key, this.mainScreenIndex = 0}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/splash_screen/SplashScreen/createState.md b/talawa-mobile-docs/splash_screen/SplashScreen/createState.md new file mode 100644 index 000000000..23428f6f6 --- /dev/null +++ b/talawa-mobile-docs/splash_screen/SplashScreen/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_SplashScreenState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_SplashScreenState createState() => _SplashScreenState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/splash_screen/SplashScreen/mainScreenIndex.md b/talawa-mobile-docs/splash_screen/SplashScreen/mainScreenIndex.md new file mode 100644 index 000000000..570058a34 --- /dev/null +++ b/talawa-mobile-docs/splash_screen/SplashScreen/mainScreenIndex.md @@ -0,0 +1,32 @@ + + + +# mainScreenIndex property + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) mainScreenIndex + +_final_ + + + + + + +## Implementation + +```dart +final int mainScreenIndex; +``` + + + + + + + diff --git a/talawa-mobile-docs/splash_screen/splash_screen-library.md b/talawa-mobile-docs/splash_screen/splash_screen-library.md new file mode 100644 index 000000000..ea4583ae6 --- /dev/null +++ b/talawa-mobile-docs/splash_screen/splash_screen-library.md @@ -0,0 +1,39 @@ + + + + +# splash_screen library + + + + + + + + + + + +## Classes + +##### [SplashScreen](../splash_screen/SplashScreen-class.md) + + + +This widget return the SplashScreen. Splash Screen is the first screen that +we see when we run our application. It is also known as Launch Screen. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations-class.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations-class.md new file mode 100644 index 000000000..d54ee7ff2 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations-class.md @@ -0,0 +1,169 @@ + + + +# AppLocalizations class + + + + + + + + + +

This class provides methods to localize the application so that it can be available +to users with different languages.

+ + + + +## Constructors + +[AppLocalizations](../utils_app_localization/AppLocalizations/AppLocalizations.md) ([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest = false}) + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [isTest](../utils_app_localization/AppLocalizations/isTest.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [locale](../utils_app_localization/AppLocalizations/locale.md) → [Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [load](../utils_app_localization/AppLocalizations/load.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + + + + + + +##### [loadTest](../utils_app_localization/AppLocalizations/loadTest.md)([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[AppLocalizations](../utils_app_localization/AppLocalizations-class.md)> + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [strictTranslate](../utils_app_localization/AppLocalizations/strictTranslate.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) key) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [translate](../utils_app_localization/AppLocalizations/translate.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html)? key) [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + +## Static Methods + +##### [of](../utils_app_localization/AppLocalizations/of.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [AppLocalizations](../utils_app_localization/AppLocalizations-class.md)? + + + + + + + + + + + +## Constants + +##### [delegate](../utils_app_localization/AppLocalizations/delegate-constant.md) const [LocalizationsDelegate](https://api.flutter.dev/flutter/widgets/LocalizationsDelegate-class.html)<[AppLocalizations](../utils_app_localization/AppLocalizations-class.md)> + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/AppLocalizations.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/AppLocalizations.md new file mode 100644 index 000000000..bb06e087a --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/AppLocalizations.md @@ -0,0 +1,32 @@ + + + +# AppLocalizations constructor + + + + + + + +AppLocalizations([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest = false}) + + + + + +## Implementation + +```dart +AppLocalizations( + this.locale, { + this.isTest = false, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/delegate-constant.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/delegate-constant.md new file mode 100644 index 000000000..3725a88e1 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/delegate-constant.md @@ -0,0 +1,33 @@ + + + +# delegate constant + + + + + + + +[LocalizationsDelegate](https://api.flutter.dev/flutter/widgets/LocalizationsDelegate-class.html)<[AppLocalizations](../../utils_app_localization/AppLocalizations-class.md)> const delegate + + + + + + + + +## Implementation + +```dart +static const LocalizationsDelegate delegate = + AppLocalizationsDelegate(); +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/isTest.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/isTest.md new file mode 100644 index 000000000..9f3b4dc75 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/isTest.md @@ -0,0 +1,32 @@ + + + +# isTest property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest + +_read / write_ + + + + + + +## Implementation + +```dart +bool isTest; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/load.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/load.md new file mode 100644 index 000000000..9cfd30ec1 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/load.md @@ -0,0 +1,46 @@ + + + +# load method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> load +() + + + + + + + + +## Implementation + +```dart +Future load() async { + // Load the language JSON file from the "lang" folder + final String jsonString = + await rootBundle.loadString('lang/${locale.languageCode}.json'); + final Map jsonMap = + json.decode(jsonString) as Map; + + _localizedStrings = jsonMap.map((key, value) { + return MapEntry(key, value.toString()); + }); + + return true; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/loadTest.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/loadTest.md new file mode 100644 index 000000000..4f4197b06 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/loadTest.md @@ -0,0 +1,36 @@ + + + +# loadTest method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[AppLocalizations](../../utils_app_localization/AppLocalizations-class.md)> loadTest +([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale) + + + + + + + + +## Implementation + +```dart +Future loadTest(Locale locale) async { + return AppLocalizations(locale); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/locale.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/locale.md new file mode 100644 index 000000000..ba00de796 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/locale.md @@ -0,0 +1,32 @@ + + + +# locale property + + + + + + + +[Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale + +_final_ + + + + + + +## Implementation + +```dart +final Locale locale; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/of.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/of.md new file mode 100644 index 000000000..492424bf7 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/of.md @@ -0,0 +1,36 @@ + + + +# of method + + + + + + + + +[AppLocalizations](../../utils_app_localization/AppLocalizations-class.md)? of +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + + + + +## Implementation + +```dart +static AppLocalizations? of(BuildContext context) { + return Localizations.of(context, AppLocalizations); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/strictTranslate.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/strictTranslate.md new file mode 100644 index 000000000..e05a4107d --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/strictTranslate.md @@ -0,0 +1,44 @@ + + + +# strictTranslate method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) strictTranslate +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) key) + + + + + + + + +## Implementation + +```dart +String strictTranslate(String key) { + if (isTest) return key; + + // ignore: unnecessary_null_comparison + if (key == null) { + return '...'; + } + + final String translate = _localizedStrings[key] ?? key; + return translate; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizations/translate.md b/talawa-mobile-docs/utils_app_localization/AppLocalizations/translate.md new file mode 100644 index 000000000..0b7412122 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizations/translate.md @@ -0,0 +1,42 @@ + + + +# translate method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? translate +([String](https://api.flutter.dev/flutter/dart-core/String-class.html)? key) + + + + + + + + +## Implementation + +```dart +String? translate(String? key) { + if (isTest) return key; + + // ignore: unnecessary_null_comparison + if (key == null) { + return '...'; + } + return _localizedStrings[key]; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate-class.md b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate-class.md new file mode 100644 index 000000000..0c6f3c2d0 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate-class.md @@ -0,0 +1,150 @@ + + + +# AppLocalizationsDelegate class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [LocalizationsDelegate](https://api.flutter.dev/flutter/widgets/LocalizationsDelegate-class.html)<[AppLocalizations](../utils_app_localization/AppLocalizations-class.md)> +- AppLocalizationsDelegate + + + + + + + + +## Constructors + +[AppLocalizationsDelegate](../utils_app_localization/AppLocalizationsDelegate/AppLocalizationsDelegate.md) ({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest = false}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [isTest](../utils_app_localization/AppLocalizationsDelegate/isTest.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [type](https://api.flutter.dev/flutter/widgets/LocalizationsDelegate/type.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +The type of the object returned by the load method, T by default. +_read-onlyinherited_ + + + + + +## Methods + +##### [isSupported](../utils_app_localization/AppLocalizationsDelegate/isSupported.md)([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether resources for the given locale can be loaded by this delegate. +_override_ + + + +##### [load](../utils_app_localization/AppLocalizationsDelegate/load.md)([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[AppLocalizations](../utils_app_localization/AppLocalizations-class.md)> + + + +Start loading the resources for locale. The returned future completes +when the resources have finished loading. +_override_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [shouldReload](../utils_app_localization/AppLocalizationsDelegate/shouldReload.md)(covariant [AppLocalizationsDelegate](../utils_app_localization/AppLocalizationsDelegate-class.md) old) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Returns true if the resources for this delegate should be loaded +again by calling the load method. +_override_ + + + +##### [toString](https://api.flutter.dev/flutter/widgets/LocalizationsDelegate/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/AppLocalizationsDelegate.md b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/AppLocalizationsDelegate.md new file mode 100644 index 000000000..3f42f908e --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/AppLocalizationsDelegate.md @@ -0,0 +1,31 @@ + + + +# AppLocalizationsDelegate constructor + + + + + + +const +AppLocalizationsDelegate({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest = false}) + + + + + +## Implementation + +```dart +const AppLocalizationsDelegate({ + this.isTest = false, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/isSupported.md b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/isSupported.md new file mode 100644 index 000000000..e2529fec1 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/isSupported.md @@ -0,0 +1,43 @@ + + + +# isSupported method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isSupported +([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale) + +_override_ + + + +

Whether resources for the given locale can be loaded by this delegate.

+

Return true if the instance of T loaded by this delegate's load +method supports the given locale's language.

+ + + +## Implementation + +```dart +@override +bool isSupported(Locale locale) { + // Include all of your supported language codes here + return ['en', 'es', 'fr', 'hi', 'zh', 'de', 'ja', 'pt'] + .contains(locale.languageCode); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/isTest.md b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/isTest.md new file mode 100644 index 000000000..e6e920cda --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/isTest.md @@ -0,0 +1,32 @@ + + + +# isTest property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest + +_final_ + + + + + + +## Implementation + +```dart +final bool isTest; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/load.md b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/load.md new file mode 100644 index 000000000..0e0684946 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/load.md @@ -0,0 +1,52 @@ + + + +# load method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[AppLocalizations](../../utils_app_localization/AppLocalizations-class.md)> load +([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) locale) + +_override_ + + + +

Start loading the resources for locale. The returned future completes +when the resources have finished loading.

+

It's assumed that this method will return an object that contains a +collection of related string resources (typically defined with one method +per resource). The object will be retrieved with Localizations.of.

+ + + +## Implementation + +```dart +@override +Future load(Locale locale) async { + // AppLocalizations class is where the JSON loading actually runs + final AppLocalizations localizations = + AppLocalizations(locale, isTest: isTest); + if (isTest) { + await localizations.loadTest(locale); + } else { + await localizations.load(); + } + + return localizations; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/shouldReload.md b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/shouldReload.md new file mode 100644 index 000000000..232890b37 --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/AppLocalizationsDelegate/shouldReload.md @@ -0,0 +1,41 @@ + + + +# shouldReload method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) shouldReload +(covariant [AppLocalizationsDelegate](../../utils_app_localization/AppLocalizationsDelegate-class.md) old) + +_override_ + + + +

Returns true if the resources for this delegate should be loaded +again by calling the load method.

+

This method is called whenever its Localizations widget is +rebuilt. If it returns true then dependent widgets will be rebuilt +after load has completed.

+ + + +## Implementation + +```dart +@override +bool shouldReload(AppLocalizationsDelegate old) => false; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_app_localization/utils_app_localization-library.md b/talawa-mobile-docs/utils_app_localization/utils_app_localization-library.md new file mode 100644 index 000000000..7bfdb2bfc --- /dev/null +++ b/talawa-mobile-docs/utils_app_localization/utils_app_localization-library.md @@ -0,0 +1,46 @@ + + + + +# app_localization library + + + + + + + + + + + +## Classes + +##### [AppLocalizations](../utils_app_localization/AppLocalizations-class.md) + + + +This class provides methods to localize the application so that it can be available +to users with different languages. + + +##### [AppLocalizationsDelegate](../utils_app_localization/AppLocalizationsDelegate-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_chat_queries/ChatQueries-class.md b/talawa-mobile-docs/utils_chat_queries/ChatQueries-class.md new file mode 100644 index 000000000..3c20eb991 --- /dev/null +++ b/talawa-mobile-docs/utils_chat_queries/ChatQueries-class.md @@ -0,0 +1,128 @@ + + + +# ChatQueries class + + + + + + + + + +

This class creates the queries dealing with chats.

+ + + + +## Constructors + +[ChatQueries](../utils_chat_queries/ChatQueries/ChatQueries.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [messageSentToDirectChatsubscription](../utils_chat_queries/ChatQueries/messageSentToDirectChatsubscription.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read-only_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [fetchDirectChatMessagesByChatId](../utils_chat_queries/ChatQueries/fetchDirectChatMessagesByChatId.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [fetchDirectChatsByUserId](../utils_chat_queries/ChatQueries/fetchDirectChatsByUserId.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [sendMessageToDirectChat](../utils_chat_queries/ChatQueries/sendMessageToDirectChat.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_chat_queries/ChatQueries/ChatQueries.md b/talawa-mobile-docs/utils_chat_queries/ChatQueries/ChatQueries.md new file mode 100644 index 000000000..55e0facb0 --- /dev/null +++ b/talawa-mobile-docs/utils_chat_queries/ChatQueries/ChatQueries.md @@ -0,0 +1,24 @@ + + + +# ChatQueries constructor + + + + + + + +ChatQueries() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_chat_queries/ChatQueries/fetchDirectChatMessagesByChatId.md b/talawa-mobile-docs/utils_chat_queries/ChatQueries/fetchDirectChatMessagesByChatId.md new file mode 100644 index 000000000..c18224b70 --- /dev/null +++ b/talawa-mobile-docs/utils_chat_queries/ChatQueries/fetchDirectChatMessagesByChatId.md @@ -0,0 +1,53 @@ + + + +# fetchDirectChatMessagesByChatId method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fetchDirectChatMessagesByChatId +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId) + + + + + + + + +## Implementation + +```dart +String fetchDirectChatMessagesByChatId(String chatId) { + return ''' + query { + directChatsMessagesByChatID(id: "$chatId") { + _id + messageContent + sender { + _id + firstName + image + } + receiver { + _id + firstName + image + } + } + } + '''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_chat_queries/ChatQueries/fetchDirectChatsByUserId.md b/talawa-mobile-docs/utils_chat_queries/ChatQueries/fetchDirectChatsByUserId.md new file mode 100644 index 000000000..37412a513 --- /dev/null +++ b/talawa-mobile-docs/utils_chat_queries/ChatQueries/fetchDirectChatsByUserId.md @@ -0,0 +1,47 @@ + + + +# fetchDirectChatsByUserId method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fetchDirectChatsByUserId +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId) + + + + + + + + +## Implementation + +```dart +String fetchDirectChatsByUserId(String userId) { + return ''' + query { + directChatsByUserID(id: "$userId") { + _id + users{ + _id + firstName + email + } + } + } + '''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_chat_queries/ChatQueries/messageSentToDirectChatsubscription.md b/talawa-mobile-docs/utils_chat_queries/ChatQueries/messageSentToDirectChatsubscription.md new file mode 100644 index 000000000..9a57c45da --- /dev/null +++ b/talawa-mobile-docs/utils_chat_queries/ChatQueries/messageSentToDirectChatsubscription.md @@ -0,0 +1,52 @@ + + + +# messageSentToDirectChatsubscription property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) messageSentToDirectChatsubscription + + + + + + + + +## Implementation + +```dart +String get messageSentToDirectChatsubscription => ''' + subscription{ + messageSentToDirectChat{ + _id + messageContent + sender { + _id + firstName + image + } + receiver { + _id + firstName + image + } + } + } +'''; +``` + + + + + + + + diff --git a/talawa-mobile-docs/utils_chat_queries/ChatQueries/sendMessageToDirectChat.md b/talawa-mobile-docs/utils_chat_queries/ChatQueries/sendMessageToDirectChat.md new file mode 100644 index 000000000..55f028004 --- /dev/null +++ b/talawa-mobile-docs/utils_chat_queries/ChatQueries/sendMessageToDirectChat.md @@ -0,0 +1,54 @@ + + + +# sendMessageToDirectChat method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) sendMessageToDirectChat +() + + + + + + + + +## Implementation + +```dart +String sendMessageToDirectChat() { + return ''' + mutation sendMessageToDirectChat( + \$chatId: ID! + \$messageContent: String! + ){ + sendMessageToDirectChat( + chatId: \$chatId + messageContent: \$messageContent + ) { + messageContent + sender{ + firstName + } + receiver{ + firstName + } + } + } + '''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_chat_queries/utils_chat_queries-library.md b/talawa-mobile-docs/utils_chat_queries/utils_chat_queries-library.md new file mode 100644 index 000000000..6d67046a3 --- /dev/null +++ b/talawa-mobile-docs/utils_chat_queries/utils_chat_queries-library.md @@ -0,0 +1,38 @@ + + + + +# chat_queries library + + + + + + + + + + + +## Classes + +##### [ChatQueries](../utils_chat_queries/ChatQueries-class.md) + + + +This class creates the queries dealing with chats. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_comment_queries/CommentQueries-class.md b/talawa-mobile-docs/utils_comment_queries/CommentQueries-class.md new file mode 100644 index 000000000..f32182947 --- /dev/null +++ b/talawa-mobile-docs/utils_comment_queries/CommentQueries-class.md @@ -0,0 +1,110 @@ + + + +# CommentQueries class + + + + + + + + + +

This class creates the queries dealing with comments.

+ + + + +## Constructors + +[CommentQueries](../utils_comment_queries/CommentQueries/CommentQueries.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createComment](../utils_comment_queries/CommentQueries/createComment.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [getPostsComments](../utils_comment_queries/CommentQueries/getPostsComments.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_comment_queries/CommentQueries/CommentQueries.md b/talawa-mobile-docs/utils_comment_queries/CommentQueries/CommentQueries.md new file mode 100644 index 000000000..ce3490c52 --- /dev/null +++ b/talawa-mobile-docs/utils_comment_queries/CommentQueries/CommentQueries.md @@ -0,0 +1,24 @@ + + + +# CommentQueries constructor + + + + + + + +CommentQueries() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_comment_queries/CommentQueries/createComment.md b/talawa-mobile-docs/utils_comment_queries/CommentQueries/createComment.md new file mode 100644 index 000000000..3557c7507 --- /dev/null +++ b/talawa-mobile-docs/utils_comment_queries/CommentQueries/createComment.md @@ -0,0 +1,46 @@ + + + +# createComment method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) createComment +() + + + + + + + + +## Implementation + +```dart +String createComment() { + return """ + mutation createComment(\$postId: ID!, \$text: String!) { + createComment(postId: \$postId, + data:{ + text: \$text, + } + ){ + _id + } + } +"""; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_comment_queries/CommentQueries/getPostsComments.md b/talawa-mobile-docs/utils_comment_queries/CommentQueries/getPostsComments.md new file mode 100644 index 000000000..b497be68e --- /dev/null +++ b/talawa-mobile-docs/utils_comment_queries/CommentQueries/getPostsComments.md @@ -0,0 +1,48 @@ + + + +# getPostsComments method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) getPostsComments +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postId) + + + + + + + + +## Implementation + +```dart +String getPostsComments(String postId) { + return """ + query{ + commentsByPost(id: "$postId"){ + _id + text + createdAt + creator{ + firstName + lastName + } + } + } + """; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_comment_queries/utils_comment_queries-library.md b/talawa-mobile-docs/utils_comment_queries/utils_comment_queries-library.md new file mode 100644 index 000000000..9e0b120ae --- /dev/null +++ b/talawa-mobile-docs/utils_comment_queries/utils_comment_queries-library.md @@ -0,0 +1,38 @@ + + + + +# comment_queries library + + + + + + + + + + + +## Classes + +##### [CommentQueries](../utils_comment_queries/CommentQueries-class.md) + + + +This class creates the queries dealing with comments. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/EventQueries-class.md b/talawa-mobile-docs/utils_event_queries/EventQueries-class.md new file mode 100644 index 000000000..102d42421 --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/EventQueries-class.md @@ -0,0 +1,146 @@ + + + +# EventQueries class + + + + + + + + + +

This class creates queries related to the events.

+ + + + +## Constructors + +[EventQueries](../utils_event_queries/EventQueries/EventQueries.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [addEvent](../utils_event_queries/EventQueries/addEvent.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [deleteEvent](../utils_event_queries/EventQueries/deleteEvent.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) id) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [fetchOrgEvents](../utils_event_queries/EventQueries/fetchOrgEvents.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [registerForEvent](../utils_event_queries/EventQueries/registerForEvent.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [registrantsByEvent](../utils_event_queries/EventQueries/registrantsByEvent.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [updateEvent](../utils_event_queries/EventQueries/updateEvent.md)({dynamic eventId}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/EventQueries/EventQueries.md b/talawa-mobile-docs/utils_event_queries/EventQueries/EventQueries.md new file mode 100644 index 000000000..817931179 --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/EventQueries/EventQueries.md @@ -0,0 +1,24 @@ + + + +# EventQueries constructor + + + + + + + +EventQueries() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/EventQueries/addEvent.md b/talawa-mobile-docs/utils_event_queries/EventQueries/addEvent.md new file mode 100644 index 000000000..d82a4ff80 --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/EventQueries/addEvent.md @@ -0,0 +1,71 @@ + + + +# addEvent method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) addEvent +() + + + + + + + + +## Implementation + +```dart +String addEvent() { + return """ + mutation createEvent( \$organizationId: ID!, + \$title:String!, + \$description: String!, + \$startTime: Time, + \$endTime: Time, + \$allDay: Boolean!, + \$recurring: Boolean!, + \$isPublic: Boolean!, + \$isRegisterable: Boolean!, + \$location: String, + \$startDate : Date!, + \$endDate : Date!, + ) { + createEvent( + data:{ + organizationId: \$organizationId, + title: \$title, + description: \$description, + isPublic: \$isPublic, + isRegisterable: \$isRegisterable, + recurring: \$recurring, + allDay: \$allDay, + startTime: \$startTime, + endTime: \$endTime, + startDate: \$startDate, + endDate: \$endDate, + location: \$location, + } + ){ + _id + title + description + } + } +"""; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/EventQueries/deleteEvent.md b/talawa-mobile-docs/utils_event_queries/EventQueries/deleteEvent.md new file mode 100644 index 000000000..fd57a07e3 --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/EventQueries/deleteEvent.md @@ -0,0 +1,44 @@ + + + +# deleteEvent method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) deleteEvent +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) id) + + + + + + + + +## Implementation + +```dart +String deleteEvent(String id) { + return """ + mutation { + removeEvent( + id: "$id", + ){ + _id + } + } + """; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/EventQueries/fetchOrgEvents.md b/talawa-mobile-docs/utils_event_queries/EventQueries/fetchOrgEvents.md new file mode 100644 index 000000000..9c6a6308f --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/EventQueries/fetchOrgEvents.md @@ -0,0 +1,72 @@ + + + +# fetchOrgEvents method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fetchOrgEvents +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) + + + + + + + + +## Implementation + +```dart +String fetchOrgEvents(String orgId) { + return """ + query { + eventsByOrganization(id: "$orgId"){ + _id + organization { + _id + image + } + title + description + isPublic + isRegisterable + recurring + recurrance + startDate + endDate + allDay + startTime + endTime + location + creator{ + _id + firstName + lastName + } + admins { + firstName + lastName + } + registrants { + user { + _id + } + } + } + } + """; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/EventQueries/registerForEvent.md b/talawa-mobile-docs/utils_event_queries/EventQueries/registerForEvent.md new file mode 100644 index 000000000..c99105710 --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/EventQueries/registerForEvent.md @@ -0,0 +1,45 @@ + + + +# registerForEvent method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) registerForEvent +() + + + + + + + + +## Implementation + +```dart +String registerForEvent() { + return """ + mutation registerForEvent(\$eventId: ID!) { + registerForEvent(id: \$eventId) + { + _id + title + description + } + } +"""; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/EventQueries/registrantsByEvent.md b/talawa-mobile-docs/utils_event_queries/EventQueries/registrantsByEvent.md new file mode 100644 index 000000000..36f685036 --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/EventQueries/registrantsByEvent.md @@ -0,0 +1,45 @@ + + + +# registrantsByEvent method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) registrantsByEvent +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) + + + + + + + + +## Implementation + +```dart +String registrantsByEvent(String eventId) { + return ''' + query { + registrantsByEvent(id: "$eventId") { + _id + firstName + lastName + image + } + } + '''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/EventQueries/updateEvent.md b/talawa-mobile-docs/utils_event_queries/EventQueries/updateEvent.md new file mode 100644 index 000000000..3d5cf74f9 --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/EventQueries/updateEvent.md @@ -0,0 +1,67 @@ + + + +# updateEvent method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) updateEvent +({dynamic eventId}) + + + + + + + + +## Implementation + +```dart +String updateEvent({ + eventId, +}) { + return """mutation updateEvent( + \$title:String!, + \$description: String!, + \$startTime: Time, + \$endTime: Time, + \$allDay: Boolean!, + \$recurring: Boolean!, + \$isPublic: Boolean!, + \$isRegisterable: Boolean!, + \$location: String, + ) { + updateEvent( + id: "$eventId" + data:{ + title: \$title, + description: \$description, + isPublic: \$isPublic, + isRegisterable: \$isRegisterable, + recurring: \$recurring, + allDay: \$allDay, + startTime: \$startTime + endTime: \$endTime + location: \$location + } + ){ + _id + title + description + } + }"""; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_event_queries/utils_event_queries-library.md b/talawa-mobile-docs/utils_event_queries/utils_event_queries-library.md new file mode 100644 index 000000000..c69f1c400 --- /dev/null +++ b/talawa-mobile-docs/utils_event_queries/utils_event_queries-library.md @@ -0,0 +1,38 @@ + + + + +# event_queries library + + + + + + + + + + + +## Classes + +##### [EventQueries](../utils_event_queries/EventQueries-class.md) + + + +This class creates queries related to the events. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_post_queries/PostQueries-class.md b/talawa-mobile-docs/utils_post_queries/PostQueries-class.md new file mode 100644 index 000000000..c42cbf66c --- /dev/null +++ b/talawa-mobile-docs/utils_post_queries/PostQueries-class.md @@ -0,0 +1,128 @@ + + + +# PostQueries class + + + + + + + + + +

This class creates queries related to posts.

+ + + + +## Constructors + +[PostQueries](../utils_post_queries/PostQueries/PostQueries.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [addLike](../utils_post_queries/PostQueries/addLike.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Add Like to a post. + + + + +##### [getPostsById](../utils_post_queries/PostQueries/getPostsById.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Getting Posts by Id. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [removeLike](../utils_post_queries/PostQueries/removeLike.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Remove Like from a post. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [uploadPost](../utils_post_queries/PostQueries/uploadPost.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Upload a post to database. + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_post_queries/PostQueries/PostQueries.md b/talawa-mobile-docs/utils_post_queries/PostQueries/PostQueries.md new file mode 100644 index 000000000..6e2213d08 --- /dev/null +++ b/talawa-mobile-docs/utils_post_queries/PostQueries/PostQueries.md @@ -0,0 +1,24 @@ + + + +# PostQueries constructor + + + + + + + +PostQueries() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_post_queries/PostQueries/addLike.md b/talawa-mobile-docs/utils_post_queries/PostQueries/addLike.md new file mode 100644 index 000000000..75f191c97 --- /dev/null +++ b/talawa-mobile-docs/utils_post_queries/PostQueries/addLike.md @@ -0,0 +1,50 @@ + + + +# addLike method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) addLike +() + + + + + +

Add Like to a post.

+

params: + None

+

returns:

+
    +
  • String: The query related to addingLike
  • +
+ + + +## Implementation + +```dart +String addLike() { + return """ + mutation likePost(\$postID: ID!) { + likePost( id: \$postID,) + { + _id + } + } +"""; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_post_queries/PostQueries/getPostsById.md b/talawa-mobile-docs/utils_post_queries/PostQueries/getPostsById.md new file mode 100644 index 000000000..ed6fb741c --- /dev/null +++ b/talawa-mobile-docs/utils_post_queries/PostQueries/getPostsById.md @@ -0,0 +1,74 @@ + + + +# getPostsById method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) getPostsById +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) + + + + + +

Getting Posts by Id.

+

params:

+
    +
  • orgId: The organisation id
  • +
+

returns:

+
    +
  • String: The query related to gettingPostsbyId
  • +
+ + + +## Implementation + +```dart +String getPostsById(String orgId) { + return """ + query { + postsByOrganization(id: "$orgId",orderBy: createdAt_DESC ) + { + _id + text + createdAt + imageUrl + videoUrl + title + commentCount + likeCount + creator{ + _id + firstName + lastName + image + } + organization{ + _id + } + likedBy{ + _id + } + comments{ + _id + } + } + } +"""; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_post_queries/PostQueries/removeLike.md b/talawa-mobile-docs/utils_post_queries/PostQueries/removeLike.md new file mode 100644 index 000000000..e43f174fc --- /dev/null +++ b/talawa-mobile-docs/utils_post_queries/PostQueries/removeLike.md @@ -0,0 +1,53 @@ + + + +# removeLike method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) removeLike +() + + + + + +

Remove Like from a post.

+

params: + None

+

returns:

+
    +
  • String: The query related to removingLike
  • +
+ + + +## Implementation + +```dart +String removeLike() { + return """ + mutation unlikePost(\$postID: ID!) { + unlikePost( id: \$postID,) + { + _id + likedBy{ + _id + } + } + } +"""; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_post_queries/PostQueries/uploadPost.md b/talawa-mobile-docs/utils_post_queries/PostQueries/uploadPost.md new file mode 100644 index 000000000..59d03b867 --- /dev/null +++ b/talawa-mobile-docs/utils_post_queries/PostQueries/uploadPost.md @@ -0,0 +1,63 @@ + + + +# uploadPost method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) uploadPost +() + + + + + +

Upload a post to database.

+

params: + None

+

returns:

+
    +
  • String: The query related to uploadingPost.
  • +
+ + + +## Implementation + +```dart +String uploadPost() { + return ''' + mutation CreatePost( + \$text: String! + \$title: String! + \$imageUrl: URL + \$videoUrl: URL + \$organizationId: ID! +) { + createPost( + data: { + text: \$text + title: \$title + imageUrl: \$imageUrl + videoUrl: \$videoUrl + organizationId: \$organizationId + } + ) { + _id + } +} + '''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_post_queries/utils_post_queries-library.md b/talawa-mobile-docs/utils_post_queries/utils_post_queries-library.md new file mode 100644 index 000000000..b2562cc70 --- /dev/null +++ b/talawa-mobile-docs/utils_post_queries/utils_post_queries-library.md @@ -0,0 +1,38 @@ + + + + +# post_queries library + + + + + + + + + + + +## Classes + +##### [PostQueries](../utils_post_queries/PostQueries-class.md) + + + +This class creates queries related to posts. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries-class.md b/talawa-mobile-docs/utils_queries/Queries-class.md new file mode 100644 index 000000000..7b1fc116f --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries-class.md @@ -0,0 +1,245 @@ + + + +# Queries class + + + + + + + + + +

This class returns some queries for the application.

+ + + + +## Constructors + +[Queries](../utils_queries/Queries/Queries.md) () + + + + +## Properties + +##### [fetchJoinInOrg](../utils_queries/Queries/fetchJoinInOrg.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read-only_ + + + +##### [fetchJoinInOrgByName](../utils_queries/Queries/fetchJoinInOrgByName.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read-only_ + + + +##### [fetchUserInfo](../utils_queries/Queries/fetchUserInfo.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createDonation](../utils_queries/Queries/createDonation.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) nameOfOrg, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) nameOfUser, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) payPalId, [double](https://api.flutter.dev/flutter/dart-core/double-class.html) amount) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +createDonation creates a new donation transaction by taking the userId ,orgId ,nameOfOrg ,nameOfUser as parameters + + + + +##### [fetchOrgById](../utils_queries/Queries/fetchOrgById.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [fetchOrgDetailsById](../utils_queries/Queries/fetchOrgDetailsById.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [getPluginsList](../utils_queries/Queries/getPluginsList.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +getPluginList queries all properties of pluginList from the server + + + + +##### [joinOrgById](../utils_queries/Queries/joinOrgById.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [loginUser](../utils_queries/Queries/loginUser.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) email, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) password) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [logout](../utils_queries/Queries/logout.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [newUserLanguage](../utils_queries/Queries/newUserLanguage.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [refreshToken](../utils_queries/Queries/refreshToken.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) refreshToken) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [registerUser](../utils_queries/Queries/registerUser.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) firstName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) lastName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) email, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) password) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [saveFcmToken](../utils_queries/Queries/saveFcmToken.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html)? token) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [sendMembershipRequest](../utils_queries/Queries/sendMembershipRequest.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [updateLanguage](../utils_queries/Queries/updateLanguage.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) languageCode) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [userLanguage](../utils_queries/Queries/userLanguage.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/Queries.md b/talawa-mobile-docs/utils_queries/Queries/Queries.md new file mode 100644 index 000000000..b25607632 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/Queries.md @@ -0,0 +1,24 @@ + + + +# Queries constructor + + + + + + + +Queries() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/createDonation.md b/talawa-mobile-docs/utils_queries/Queries/createDonation.md new file mode 100644 index 000000000..3aed8b44e --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/createDonation.md @@ -0,0 +1,61 @@ + + + +# createDonation method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) createDonation +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) nameOfOrg, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) nameOfUser, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) payPalId, [double](https://api.flutter.dev/flutter/dart-core/double-class.html) amount) + + + + + +

createDonation creates a new donation transaction by taking the userId ,orgId ,nameOfOrg ,nameOfUser as parameters

+ + + +## Implementation + +```dart +String createDonation( + String userId, + String orgId, + String nameOfOrg, + String nameOfUser, + String payPalId, + double amount, +) { + return ''' + mutation createDonationMutation { createDonation( + userId :"$userId" + orgId :"$orgId", + nameOfOrg:"$nameOfOrg", + nameOfUser:"$nameOfUser", + payPalId:"$payPalId" + amount :$amount + ){ + _id + payPalId + userId + orgId + payPalId + nameOfUser + } + } + '''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/fetchJoinInOrg.md b/talawa-mobile-docs/utils_queries/Queries/fetchJoinInOrg.md new file mode 100644 index 000000000..33bb1607a --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/fetchJoinInOrg.md @@ -0,0 +1,55 @@ + + + +# fetchJoinInOrg property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fetchJoinInOrg + + + + + + + + +## Implementation + +```dart +String get fetchJoinInOrg { + return """ + query organizationsConnection(\$first: Int, \$skip: Int){ + organizationsConnection( + first: \$first, + skip: \$skip, + orderBy: name_ASC + ){ + image + _id + name + image + isPublic + creator{ + firstName + lastName + } + } + } +"""; +} +``` + + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/fetchJoinInOrgByName.md b/talawa-mobile-docs/utils_queries/Queries/fetchJoinInOrgByName.md new file mode 100644 index 000000000..02bcbb617 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/fetchJoinInOrgByName.md @@ -0,0 +1,64 @@ + + + +# fetchJoinInOrgByName property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fetchJoinInOrgByName + + + + + + + + +## Implementation + +```dart +String get fetchJoinInOrgByName { + return """ + query organizationsConnection( + \$first: Int, + \$skip: Int, + \$nameStartsWith: String + ){ + organizationsConnection( + where:{ + name_starts_with: \$nameStartsWith, + visibleInSearch: true, + isPublic: true, + } + first: \$first, + skip: \$skip, + orderBy: name_ASC + ){ + image + _id + name + image + isPublic + creator{ + firstName + lastName + } + } + } +"""; +} +``` + + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/fetchOrgById.md b/talawa-mobile-docs/utils_queries/Queries/fetchOrgById.md new file mode 100644 index 000000000..ea2c109b2 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/fetchOrgById.md @@ -0,0 +1,50 @@ + + + +# fetchOrgById method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fetchOrgById +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) + + + + + + + + +## Implementation + +```dart +String fetchOrgById(String orgId) { + return ''' + query{ + organizations(id: "$orgId"){ + image + _id + name + image + isPublic + creator{ + firstName + lastName + } + } + } +'''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/fetchOrgDetailsById.md b/talawa-mobile-docs/utils_queries/Queries/fetchOrgDetailsById.md new file mode 100644 index 000000000..f311d621c --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/fetchOrgDetailsById.md @@ -0,0 +1,60 @@ + + + +# fetchOrgDetailsById method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fetchOrgDetailsById +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) + + + + + + + + +## Implementation + +```dart +String fetchOrgDetailsById(String orgId) { + return ''' + query{ + organizations(id: "$orgId"){ + image + _id + name + admins{ + _id + } + description + isPublic + creator{ + _id + firstName + lastName + } + members{ + _id + firstName + lastName + image + } + } + } +'''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/fetchUserInfo.md b/talawa-mobile-docs/utils_queries/Queries/fetchUserInfo.md new file mode 100644 index 000000000..c038293e5 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/fetchUserInfo.md @@ -0,0 +1,86 @@ + + + +# fetchUserInfo property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fetchUserInfo + +_read / write_ + + + + + + +## Implementation + +```dart +String fetchUserInfo = ''' + query Users(\$id: ID!){ + users(where: { id: \$id }) { + _id + firstName + lastName + email + image + joinedOrganizations{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + + } + createdOrganizations{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + } + membershipRequests{ + organization{ + _id + name + image + isPublic + creator{ + _id + firstName + lastName + image + } + } + } + adminFor{ + _id + } + } + } + '''; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/getPluginsList.md b/talawa-mobile-docs/utils_queries/Queries/getPluginsList.md new file mode 100644 index 000000000..66e39ef68 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/getPluginsList.md @@ -0,0 +1,48 @@ + + + +# getPluginsList method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) getPluginsList +() + + + + + +

getPluginList queries all properties of pluginList from the server

+ + + +## Implementation + +```dart +String getPluginsList() { + return ''' +query { +getPlugins { + _id + pluginName + pluginCreatedBy + pluginDesc + pluginInstallStatus + installedOrgs +} +} +'''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/joinOrgById.md b/talawa-mobile-docs/utils_queries/Queries/joinOrgById.md new file mode 100644 index 000000000..6b3a9c800 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/joinOrgById.md @@ -0,0 +1,55 @@ + + + +# joinOrgById method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joinOrgById +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) + + + + + + + + +## Implementation + +```dart +String joinOrgById(String orgId) { + return ''' + mutation { + joinPublicOrganization(organizationId: "$orgId") { + joinedOrganizations{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + + } + } + } +'''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/loginUser.md b/talawa-mobile-docs/utils_queries/Queries/loginUser.md new file mode 100644 index 000000000..31a470855 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/loginUser.md @@ -0,0 +1,110 @@ + + + +# loginUser method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) loginUser +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) email, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) password) + + + + + + + + +## Implementation + +```dart +String loginUser(String email, String password) { + return """ + mutation { + login(data: {email: "$email", password: "$password"}){ + accessToken + user{ + _id + firstName + lastName + email + image + joinedOrganizations{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + } + createdOrganizations{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + } + membershipRequests{ + organization{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + } + } + adminFor{ + _id + } + } + refreshToken + androidFirebaseOptions { + apiKey + appId + messagingSenderId + projectId + storageBucket + } + iosFirebaseOptions { + apiKey + appId + messagingSenderId + projectId + storageBucket + iosClientId + iosBundleId + } + } + } + """; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/logout.md b/talawa-mobile-docs/utils_queries/Queries/logout.md new file mode 100644 index 000000000..673bb3885 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/logout.md @@ -0,0 +1,40 @@ + + + +# logout method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) logout +() + + + + + + + + +## Implementation + +```dart +String logout() { + return """ + mutation { + logout + } + """; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/newUserLanguage.md b/talawa-mobile-docs/utils_queries/Queries/newUserLanguage.md new file mode 100644 index 000000000..a22689f7d --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/newUserLanguage.md @@ -0,0 +1,40 @@ + + + +# newUserLanguage method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) newUserLanguage +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId) + + + + + + + + +## Implementation + +```dart +String newUserLanguage(String userId) { + return ''' + query{ + userLanguage(userId:"$userId") + } +'''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/refreshToken.md b/talawa-mobile-docs/utils_queries/Queries/refreshToken.md new file mode 100644 index 000000000..c384ab091 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/refreshToken.md @@ -0,0 +1,43 @@ + + + +# refreshToken method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) refreshToken +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) refreshToken) + + + + + + + + +## Implementation + +```dart +String refreshToken(String refreshToken) { + return ''' + mutation{ + refreshToken(refreshToken: "$refreshToken"){ + accessToken + refreshToken + } + } + '''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/registerUser.md b/talawa-mobile-docs/utils_queries/Queries/registerUser.md new file mode 100644 index 000000000..19b4402c6 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/registerUser.md @@ -0,0 +1,100 @@ + + + +# registerUser method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) registerUser +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) firstName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) lastName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) email, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) password) + + + + + + + + +## Implementation + +```dart +String registerUser( + String firstName, + String lastName, + String email, + String password, +) { + return """ + mutation{ + signUp(data: {firstName: "$firstName", lastName: "$lastName", email: "$email", password: "$password"}) + { + accessToken + user{ + _id + firstName + lastName + email + image + joinedOrganizations{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + } + createdOrganizations{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + } + membershipRequests{ + organization{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + } + } + adminFor{ + _id + } + } + refreshToken + } + } + """; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/saveFcmToken.md b/talawa-mobile-docs/utils_queries/Queries/saveFcmToken.md new file mode 100644 index 000000000..0b8bab769 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/saveFcmToken.md @@ -0,0 +1,40 @@ + + + +# saveFcmToken method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) saveFcmToken +([String](https://api.flutter.dev/flutter/dart-core/String-class.html)? token) + + + + + + + + +## Implementation + +```dart +String saveFcmToken(String? token) { + return """ + mutation { + saveFcmToken(token: "$token") + } + """; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/sendMembershipRequest.md b/talawa-mobile-docs/utils_queries/Queries/sendMembershipRequest.md new file mode 100644 index 000000000..033475b2b --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/sendMembershipRequest.md @@ -0,0 +1,54 @@ + + + +# sendMembershipRequest method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) sendMembershipRequest +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId) + + + + + + + + +## Implementation + +```dart +String sendMembershipRequest(String orgId) { + return ''' + mutation { + sendMembershipRequest(organizationId: "$orgId"){ + organization{ + _id + name + image + description + isPublic + creator{ + _id + firstName + lastName + image + } + } + } + } +'''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/updateLanguage.md b/talawa-mobile-docs/utils_queries/Queries/updateLanguage.md new file mode 100644 index 000000000..4f786b799 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/updateLanguage.md @@ -0,0 +1,44 @@ + + + +# updateLanguage method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) updateLanguage +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) languageCode) + + + + + + + + +## Implementation + +```dart +String updateLanguage(String languageCode) { + return ''' + mutation { + updateLanguage(languageCode: "$languageCode"){ + _id + firstName + appLanguageCode + } + } + '''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/Queries/userLanguage.md b/talawa-mobile-docs/utils_queries/Queries/userLanguage.md new file mode 100644 index 000000000..7e07be5a6 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/Queries/userLanguage.md @@ -0,0 +1,40 @@ + + + +# userLanguage method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) userLanguage +() + + + + + + + + +## Implementation + +```dart +String userLanguage() { + return ''' + query{ + myLanguage + } +'''; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_queries/utils_queries-library.md b/talawa-mobile-docs/utils_queries/utils_queries-library.md new file mode 100644 index 000000000..79e7d49e6 --- /dev/null +++ b/talawa-mobile-docs/utils_queries/utils_queries-library.md @@ -0,0 +1,38 @@ + + + + +# queries library + + + + + + + + + + + +## Classes + +##### [Queries](../utils_queries/Queries-class.md) + + + +This class returns some queries for the application. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_task_queries/TaskQueries-class.md b/talawa-mobile-docs/utils_task_queries/TaskQueries-class.md new file mode 100644 index 000000000..9c6198bcd --- /dev/null +++ b/talawa-mobile-docs/utils_task_queries/TaskQueries-class.md @@ -0,0 +1,139 @@ + + + +# TaskQueries class + + + + + + + + + +

This class creates queries for the tasks in the application.

+ + + + +## Constructors + +[TaskQueries](../utils_task_queries/TaskQueries/TaskQueries.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + +## Static Methods + +##### [addTask](../utils_task_queries/TaskQueries/addTask.md)({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) deadline, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [deleteTask](../utils_task_queries/TaskQueries/deleteTask.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [editTask](../utils_task_queries/TaskQueries/editTask.md)({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) deadline, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [eventTasks](../utils_task_queries/TaskQueries/eventTasks.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + +##### [userTasks](../utils_task_queries/TaskQueries/userTasks.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_task_queries/TaskQueries/TaskQueries.md b/talawa-mobile-docs/utils_task_queries/TaskQueries/TaskQueries.md new file mode 100644 index 000000000..aa01fdd0c --- /dev/null +++ b/talawa-mobile-docs/utils_task_queries/TaskQueries/TaskQueries.md @@ -0,0 +1,24 @@ + + + +# TaskQueries constructor + + + + + + + +TaskQueries() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_task_queries/TaskQueries/addTask.md b/talawa-mobile-docs/utils_task_queries/TaskQueries/addTask.md new file mode 100644 index 000000000..9152376d4 --- /dev/null +++ b/talawa-mobile-docs/utils_task_queries/TaskQueries/addTask.md @@ -0,0 +1,61 @@ + + + +# addTask method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) addTask +({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) deadline, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId}) + + + + + + + + +## Implementation + +```dart +static String addTask({ + required String title, + required String description, + required String deadline, + required String eventId, +}) => + ''' + mutation { + createTask( + data: { title: "$title", description: "$description", deadline: "$deadline" } + eventId: "$eventId" + ) { + _id + title + description + createdAt + deadline + creator { + _id + firstName + } + event { + _id + title + } + } + } + '''; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_task_queries/TaskQueries/deleteTask.md b/talawa-mobile-docs/utils_task_queries/TaskQueries/deleteTask.md new file mode 100644 index 000000000..6c2ee6db3 --- /dev/null +++ b/talawa-mobile-docs/utils_task_queries/TaskQueries/deleteTask.md @@ -0,0 +1,40 @@ + + + +# deleteTask method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) deleteTask +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId) + + + + + + + + +## Implementation + +```dart +static String deleteTask(String taskId) => ''' + mutation { + removeTask(id: "$taskId") { + _id + } + } +'''; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_task_queries/TaskQueries/editTask.md b/talawa-mobile-docs/utils_task_queries/TaskQueries/editTask.md new file mode 100644 index 000000000..f176f847f --- /dev/null +++ b/talawa-mobile-docs/utils_task_queries/TaskQueries/editTask.md @@ -0,0 +1,59 @@ + + + +# editTask method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) editTask +({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) deadline, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId}) + + + + + + + + +## Implementation + +```dart +static String editTask({ + required String title, + required String description, + required String deadline, + required String taskId, +}) => + ''' + mutation { + updateTask( + data: { title: "$title", description: "$description", deadline: "$deadline" } + id: "$taskId" + ) { + _id + title + description + createdAt + deadline + creator { + _id + } + event { + _id + } + } + } + '''; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_task_queries/TaskQueries/eventTasks.md b/talawa-mobile-docs/utils_task_queries/TaskQueries/eventTasks.md new file mode 100644 index 000000000..4b5260c94 --- /dev/null +++ b/talawa-mobile-docs/utils_task_queries/TaskQueries/eventTasks.md @@ -0,0 +1,52 @@ + + + +# eventTasks method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventTasks +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) + + + + + + + + +## Implementation + +```dart +static String eventTasks(String eventId) => ''' + query { + tasksByEvent(id: "$eventId") { + _id + title + description + createdAt + deadline + creator { + _id + firstName + } + event { + _id + title + } + } + } +'''; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_task_queries/TaskQueries/userTasks.md b/talawa-mobile-docs/utils_task_queries/TaskQueries/userTasks.md new file mode 100644 index 000000000..0c3064b19 --- /dev/null +++ b/talawa-mobile-docs/utils_task_queries/TaskQueries/userTasks.md @@ -0,0 +1,52 @@ + + + +# userTasks method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) userTasks +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId) + + + + + + + + +## Implementation + +```dart +static String userTasks(String userId) => ''' + query { + tasksByUser(id: "$userId") { + _id + title + description + createdAt + deadline + creator { + _id + firstName + } + event { + _id + title + } + } + } +'''; +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_task_queries/utils_task_queries-library.md b/talawa-mobile-docs/utils_task_queries/utils_task_queries-library.md new file mode 100644 index 000000000..b1fba2ded --- /dev/null +++ b/talawa-mobile-docs/utils_task_queries/utils_task_queries-library.md @@ -0,0 +1,38 @@ + + + + +# task_queries library + + + + + + + + + + + +## Classes + +##### [TaskQueries](../utils_task_queries/TaskQueries-class.md) + + + +This class creates queries for the tasks in the application. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator-class.md b/talawa-mobile-docs/utils_validators/Validator-class.md new file mode 100644 index 000000000..f179f31a1 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator-class.md @@ -0,0 +1,167 @@ + + + +# Validator class + + + + + + + + + +

This class creats various validator methods for the application. +They are used to validate information given by the users.

+ + + + +## Constructors + +[Validator](../utils_validators/Validator/Validator.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [validateUrlExistence](../utils_validators/Validator/validateUrlExistence.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) url) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)?> + + + + + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + +## Static Methods + +##### [validateEmail](../utils_validators/Validator/validateEmail.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) email) [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + + + + + +##### [validateEventForm](../utils_validators/Validator/validateEventForm.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? label) [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + + + + + +##### [validateFirstName](../utils_validators/Validator/validateFirstName.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value) [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + + + + + +##### [validateLastName](../utils_validators/Validator/validateLastName.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value) [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + + + + + +##### [validatePassword](../utils_validators/Validator/validatePassword.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) password) [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + + + + + +##### [validatePasswordConfirm](../utils_validators/Validator/validatePasswordConfirm.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) comparator) [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + + + + + +##### [validateURL](../utils_validators/Validator/validateURL.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value) [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/Validator.md b/talawa-mobile-docs/utils_validators/Validator/Validator.md new file mode 100644 index 000000000..4aa170cc1 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/Validator.md @@ -0,0 +1,24 @@ + + + +# Validator constructor + + + + + + + +Validator() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/validateEmail.md b/talawa-mobile-docs/utils_validators/Validator/validateEmail.md new file mode 100644 index 000000000..b167aec82 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/validateEmail.md @@ -0,0 +1,48 @@ + + + +# validateEmail method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? validateEmail +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) email) + + + + + + + + +## Implementation + +```dart +static String? validateEmail( + String email, +) { + // If email is empty return. + if (email.isEmpty) { + return "Email must not be left blank"; + } + const String pattern = + r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$"; + final RegExp regex = RegExp(pattern); + if (!regex.hasMatch(email)) { + return 'Please enter a valid Email Address'; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/validateEventForm.md b/talawa-mobile-docs/utils_validators/Validator/validateEventForm.md new file mode 100644 index 000000000..2742c9277 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/validateEventForm.md @@ -0,0 +1,45 @@ + + + +# validateEventForm method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? validateEventForm +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? label) + + + + + + + + +## Implementation + +```dart +static String? validateEventForm(String value, String? label) { + if (value.isEmpty) { + return '$label must not be left blank.'; + } + // ignore: unnecessary_raw_strings + const String pattern = r'(?=.*?[A-Za-z]).+'; + final RegExp regex = RegExp(pattern); + if (!regex.hasMatch(value)) { + return "Invalid $label"; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/validateFirstName.md b/talawa-mobile-docs/utils_validators/Validator/validateFirstName.md new file mode 100644 index 000000000..bef755da6 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/validateFirstName.md @@ -0,0 +1,45 @@ + + + +# validateFirstName method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? validateFirstName +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value) + + + + + + + + +## Implementation + +```dart +static String? validateFirstName(String value) { + if (value.isEmpty) { + return 'Firstname must not be left blank.'; + } + // ignore: unnecessary_raw_strings + const String pattern = r'(?=.*?[A-Za-z]).+'; + final RegExp regex = RegExp(pattern); + if (!regex.hasMatch(value)) { + return "Invalid Firstname"; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/validateLastName.md b/talawa-mobile-docs/utils_validators/Validator/validateLastName.md new file mode 100644 index 000000000..d0f24762f --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/validateLastName.md @@ -0,0 +1,45 @@ + + + +# validateLastName method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? validateLastName +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value) + + + + + + + + +## Implementation + +```dart +static String? validateLastName(String value) { + if (value.isEmpty) { + return 'Lastname must not be left blank.'; + } + // ignore: unnecessary_raw_strings + const String pattern = r"(?=.*?[A-Za-z]).+"; + final RegExp regex = RegExp(pattern); + if (!regex.hasMatch(value)) { + return "Invalid Lastname"; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/validatePassword.md b/talawa-mobile-docs/utils_validators/Validator/validatePassword.md new file mode 100644 index 000000000..f79ec49c7 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/validatePassword.md @@ -0,0 +1,57 @@ + + + +# validatePassword method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? validatePassword +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) password) + + + + + + + + +## Implementation + +```dart +static String? validatePassword( + String password, +) { + // If password is empty return. + if (password.isEmpty) { + return "Password must not be left blank"; + } + const String pattern = + r'^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[!@#\$&*%^~.]).{8,}$'; + final RegExp regExp = RegExp(pattern); + + //Regex for no spaces allowed + const String noSpaces = r'^\S+$'; + final RegExp noSpaceRegex = RegExp(noSpaces); + + if (!noSpaceRegex.hasMatch(password)) { + return "Password must not contain spaces"; + } + if (!regExp.hasMatch(password)) { + return "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)"; + } + + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/validatePasswordConfirm.md b/talawa-mobile-docs/utils_validators/Validator/validatePasswordConfirm.md new file mode 100644 index 000000000..aa89e2f44 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/validatePasswordConfirm.md @@ -0,0 +1,42 @@ + + + +# validatePasswordConfirm method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? validatePasswordConfirm +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) comparator) + + + + + + + + +## Implementation + +```dart +static String? validatePasswordConfirm( + String value, + String comparator, +) { + if (value != comparator) { + return 'Password does not match original'; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/validateURL.md b/talawa-mobile-docs/utils_validators/Validator/validateURL.md new file mode 100644 index 000000000..b1608f917 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/validateURL.md @@ -0,0 +1,45 @@ + + + +# validateURL method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? validateURL +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value) + + + + + + + + +## Implementation + +```dart +static String? validateURL( + String value, +) { + if (value.isEmpty) { + return 'Please verify URL first'; + } + final bool validURL = Uri.parse(value).isAbsolute; + if (!validURL) { + return 'Enter a valid URL'; + } + return null; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/Validator/validateUrlExistence.md b/talawa-mobile-docs/utils_validators/Validator/validateUrlExistence.md new file mode 100644 index 000000000..568b5ec31 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/Validator/validateUrlExistence.md @@ -0,0 +1,42 @@ + + + +# validateUrlExistence method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)?> validateUrlExistence +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) url) + + + + + + + + +## Implementation + +```dart +Future validateUrlExistence(String url) async { + try { + await http.get(Uri.parse(url)); + return true; + } on Exception catch (e) { + debugPrint(e.toString()); + return false; + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/utils_validators/utils_validators-library.md b/talawa-mobile-docs/utils_validators/utils_validators-library.md new file mode 100644 index 000000000..e19c39fe8 --- /dev/null +++ b/talawa-mobile-docs/utils_validators/utils_validators-library.md @@ -0,0 +1,39 @@ + + + + +# validators library + + + + + + + + + + + +## Classes + +##### [Validator](../utils_validators/Validator-class.md) + + + +This class creats various validator methods for the application. +They are used to validate information given by the users. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel-class.md b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel-class.md new file mode 100644 index 000000000..dcb8604ea --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel-class.md @@ -0,0 +1,233 @@ + + + +# AccessScreenViewModel class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- AccessScreenViewModel + + + + + + + + +## Constructors + +[AccessScreenViewModel](../view_model_access_request_view_model/AccessScreenViewModel/AccessScreenViewModel.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [optionalMessageController](../view_model_access_request_view_model/AccessScreenViewModel/optionalMessageController.md) → [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_final_ + + + +##### [organizations](../view_model_access_request_view_model/AccessScreenViewModel/organizations.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> + + + + +_read / write_ + + + +##### [orgId](../view_model_access_request_view_model/AccessScreenViewModel/orgId.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [selectedOrganization](../view_model_access_request_view_model/AccessScreenViewModel/selectedOrganization.md) ↔ [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + + +_read / write_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [initialise](../view_model_access_request_view_model/AccessScreenViewModel/initialise.md)([OrgInfo](../models_organization_org_info/OrgInfo-class.md) org) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [sendMembershipRequest](../view_model_access_request_view_model/AccessScreenViewModel/sendMembershipRequest.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + + + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/AccessScreenViewModel.md b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/AccessScreenViewModel.md new file mode 100644 index 000000000..067994386 --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/AccessScreenViewModel.md @@ -0,0 +1,24 @@ + + + +# AccessScreenViewModel constructor + + + + + + + +AccessScreenViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/initialise.md b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/initialise.md new file mode 100644 index 000000000..7bb061c66 --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/initialise.md @@ -0,0 +1,36 @@ + + + +# initialise method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> initialise +([OrgInfo](../../models_organization_org_info/OrgInfo-class.md) org) + + + + + + + + +## Implementation + +```dart +Future initialise(OrgInfo org) async { + selectedOrganization = org; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/optionalMessageController.md b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/optionalMessageController.md new file mode 100644 index 000000000..3feae3226 --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/optionalMessageController.md @@ -0,0 +1,32 @@ + + + +# optionalMessageController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) optionalMessageController + +_final_ + + + + + + +## Implementation + +```dart +final optionalMessageController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/orgId.md b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/orgId.md new file mode 100644 index 000000000..8401c3532 --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/orgId.md @@ -0,0 +1,32 @@ + + + +# orgId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId + +_read / write_ + + + + + + +## Implementation + +```dart +late String orgId; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/organizations.md b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/organizations.md new file mode 100644 index 000000000..d267d675b --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/organizations.md @@ -0,0 +1,32 @@ + + + +# organizations property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> organizations + +_read / write_ + + + + + + +## Implementation + +```dart +late List organizations = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/selectedOrganization.md b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/selectedOrganization.md new file mode 100644 index 000000000..1c7a65ca8 --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/selectedOrganization.md @@ -0,0 +1,32 @@ + + + +# selectedOrganization property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md) selectedOrganization + +_read / write_ + + + + + + +## Implementation + +```dart +late OrgInfo selectedOrganization = OrgInfo(id: '-1'); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/sendMembershipRequest.md b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/sendMembershipRequest.md new file mode 100644 index 000000000..badfa2c33 --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/AccessScreenViewModel/sendMembershipRequest.md @@ -0,0 +1,58 @@ + + + +# sendMembershipRequest method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> sendMembershipRequest +() + + + + + + + + +## Implementation + +```dart +Future 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)['organization'] as Map, + ); + 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, + ); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_access_request_view_model/view_model_access_request_view_model-library.md b/talawa-mobile-docs/view_model_access_request_view_model/view_model_access_request_view_model-library.md new file mode 100644 index 000000000..4f6d0332c --- /dev/null +++ b/talawa-mobile-docs/view_model_access_request_view_model/view_model_access_request_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# access_request_view_model library + + + + + + + + + + + +## Classes + +##### [AccessScreenViewModel](../view_model_access_request_view_model/AccessScreenViewModel-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md new file mode 100644 index 000000000..d1cf1ebe1 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md @@ -0,0 +1,262 @@ + + + +# AddPostViewModel class + + + + + + + + + +

AddPostViewModel class have different functions that are used.

+

to interact with the model to add a new post in the organization.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- AddPostViewModel + + + + + + + + +## Constructors + +[AddPostViewModel](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/AddPostViewModel.md) () + + + + +## Properties + +##### [controller](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/controller.md) → [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + +Post body text controller. +_read-only_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [imageFile](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/imageFile.md) → [File](https://api.flutter.dev/flutter/dart-io/File-class.html)? + + + +The image file that is to be uploaded. +_read-only_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [orgName](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/orgName.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +The organisation name. +_read-only_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [titleController](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/titleController.md) → [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + +Post title text controller. +_read-only_ + + + +##### [userName](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/userName.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +The Username. +_read-only_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [getImageFromGallery](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/getImageFromGallery.md)({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) camera = false}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to get the image from gallery. + + + + +##### [initialise](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/initialise.md)() void + + + +This function is usedto do initialisation of stuff in the view model. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeImage](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/removeImage.md)() void + + + +This function removes the image selected. + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [uploadPost](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/uploadPost.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function uploads the post finally, and navigate the success message or error message in Snack Bar. + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/AddPostViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/AddPostViewModel.md new file mode 100644 index 000000000..3c75d173a --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/AddPostViewModel.md @@ -0,0 +1,24 @@ + + + +# AddPostViewModel constructor + + + + + + + +AddPostViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/controller.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/controller.md new file mode 100644 index 000000000..6bfa5f1a3 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/controller.md @@ -0,0 +1,42 @@ + + + +# controller property + + + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) controller + + + + + +

Post body text controller.

+

params: +None +returns:

+
    +
  • TextEditingController: The main text controller of the post body
  • +
+ + + +## Implementation + +```dart +TextEditingController get controller => _controller; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/getImageFromGallery.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/getImageFromGallery.md new file mode 100644 index 000000000..4b687e6e2 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/getImageFromGallery.md @@ -0,0 +1,55 @@ + + + +# getImageFromGallery method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getImageFromGallery +({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) camera = false}) + + + + + +

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.
  • +
+

returns:

+
    +
  • Future<void>: Getting image from gallery returns future
  • +
+ + + +## Implementation + +```dart +Future getImageFromGallery({bool camera = false}) async { + final image = + await _multiMediaPickerService.getPhotoFromGallery(camera: camera); + if (image != null) { + _imageFile = image; + _navigationService.showTalawaErrorSnackBar( + "Image is added", + MessageType.info, + ); + notifyListeners(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/imageFile.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/imageFile.md new file mode 100644 index 000000000..19699241f --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/imageFile.md @@ -0,0 +1,42 @@ + + + +# imageFile property + + + + + + + + + +[File](https://api.flutter.dev/flutter/dart-io/File-class.html)? imageFile + + + + + +

The image file that is to be uploaded.

+

params: +None +returns:

+
    +
  • File?: The image file
  • +
+ + + +## Implementation + +```dart +File? get imageFile => _imageFile; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/initialise.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/initialise.md new file mode 100644 index 000000000..ab0e08b7e --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/initialise.md @@ -0,0 +1,46 @@ + + + +# initialise method + + + + + + + + +void initialise +() + + + + + +

This function is usedto do initialisation of stuff in the view model.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void initialise() { + _currentUser = locator().currentUser; + _navigationService = locator(); + _selectedOrg = locator().currentOrg; + _imageFile = null; + _multiMediaPickerService = locator(); + _dbFunctions = locator(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/orgName.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/orgName.md new file mode 100644 index 000000000..1006f7768 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/orgName.md @@ -0,0 +1,42 @@ + + + +# orgName property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgName + + + + + +

The organisation name.

+

params: +None +returns:

+
    +
  • String: The organisation name
  • +
+ + + +## Implementation + +```dart +String get orgName => _selectedOrg.name!; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/removeImage.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/removeImage.md new file mode 100644 index 000000000..43fd648c6 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/removeImage.md @@ -0,0 +1,42 @@ + + + +# removeImage method + + + + + + + + +void removeImage +() + + + + + +

This function removes the image selected.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void removeImage() { + _imageFile = null; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/titleController.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/titleController.md new file mode 100644 index 000000000..d3fac7285 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/titleController.md @@ -0,0 +1,42 @@ + + + +# titleController property + + + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) titleController + + + + + +

Post title text controller.

+

params: +None +returns:

+
    +
  • TextEditingController: The text controller of the title body
  • +
+ + + +## Implementation + +```dart +TextEditingController get titleController => _titleController; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/uploadPost.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/uploadPost.md new file mode 100644 index 000000000..4fc93630b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/uploadPost.md @@ -0,0 +1,68 @@ + + + +# uploadPost method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> uploadPost +() + + + + + +

This function uploads the post finally, and navigate the success message or error message in Snack Bar.

+

params: + None

+

returns:

+
    +
  • Future<void>: Uploading post by contacting queries
  • +
+ + + +## Implementation + +```dart +Future uploadPost() async { + // {TODO: } + if (_imageFile == null) { + try { + await _dbFunctions.gqlAuthMutation( + PostQueries().uploadPost(), + variables: { + "text": _controller.text, + "organizationId": _selectedOrg.id, + "title": _titleController.text + }, + ); + _navigationService.showTalawaErrorSnackBar( + "Post is uploaded", + MessageType.info, + ); + } on Exception catch (_) { + _navigationService.showTalawaErrorSnackBar( + "Something went wrong", + MessageType.error, + ); + } + } + removeImage(); + _controller.text = ""; + _titleController.text = ""; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/userName.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/userName.md new file mode 100644 index 000000000..91033806d --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel/userName.md @@ -0,0 +1,42 @@ + + + +# userName property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) userName + + + + + +

The Username.

+

params: +None +returns:

+
    +
  • String: The username of the currentUser
  • +
+ + + +## Implementation + +```dart +String get userName => _currentUser.firstName! + _currentUser.lastName!; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/view_model_after_auth_view_models_add_post_view_models_add_post_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/view_model_after_auth_view_models_add_post_view_models_add_post_view_model-library.md new file mode 100644 index 000000000..abcf04d8d --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_add_post_view_models_add_post_view_model/view_model_after_auth_view_models_add_post_view_models_add_post_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# add_post_view_model library + + + + + + + + + + + +## Classes + +##### [AddPostViewModel](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md) + + + +AddPostViewModel class have different functions that are used. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md new file mode 100644 index 000000000..ba22f8b88 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md @@ -0,0 +1,276 @@ + + + +# DirectChatViewModel class + + + + + + + + + +

This ViewModel class have different functions that are used interact with model in the context of Direct Chat.

+

Functions include:

+
    +
  • initialise : Initialise the states.
  • +
  • getChatMessages : to get all the messages of a chat.
  • +
  • sendMessageToDirectChat : to send the message to chat.
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- DirectChatViewModel + + + + + + + + +## Constructors + +[DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/DirectChatViewModel.md) () + + + + +## Properties + +##### [chatMessagesByUser](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatMessagesByUser.md) → [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatMessage](../models_chats_chat_message/ChatMessage-class.md)>> + + + + +_read-only_ + + + +##### [chats](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chats.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatListTileDataModel](../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md)> + + + + +_read-only_ + + + +##### [chatState](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatState.md) ↔ [ChatState](../enums_enums/ChatState.md) + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [listKey](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/listKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[AnimatedListState](https://api.flutter.dev/flutter/widgets/AnimatedListState-class.html)> + + + + +_final_ + + + +##### [name](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/name.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [chatName](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatName.md)(dynamic chatId) void + + + + + + + + +##### [dispose](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/dispose.md)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_override_ + + + +##### [getChatMessages](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/getChatMessages.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function get all messages for a chat. + + + + +##### [initialise](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/initialise.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [refreshChats](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/refreshChats.md)() void + + + +This function refresh the chats. + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [sendMessageToDirectChat](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/sendMessageToDirectChat.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) messageContent) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function send the message to Direct Chat. + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/DirectChatViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/DirectChatViewModel.md new file mode 100644 index 000000000..04646cdf5 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/DirectChatViewModel.md @@ -0,0 +1,24 @@ + + + +# DirectChatViewModel constructor + + + + + + + +DirectChatViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatMessagesByUser.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatMessagesByUser.md new file mode 100644 index 000000000..77f46270e --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatMessagesByUser.md @@ -0,0 +1,35 @@ + + + +# chatMessagesByUser property + + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatMessage](../../models_chats_chat_message/ChatMessage-class.md)>> chatMessagesByUser + + + + + + + + +## Implementation + +```dart +Map> get chatMessagesByUser => _chatMessagesByUser; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatName.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatName.md new file mode 100644 index 000000000..5c2f3625b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatName.md @@ -0,0 +1,43 @@ + + + +# chatName method + + + + + + + + +void chatName +(dynamic chatId) + + + + + + + + +## Implementation + +```dart +void chatName(chatId) { + final List users = + _chats.firstWhere((element) => element.id == chatId).users!; + + users.forEach((element) { + if (element.id != userConfig.currentUser.id!) { + name = element.firstName; + } + }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatState.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatState.md new file mode 100644 index 000000000..0ebdda61c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chatState.md @@ -0,0 +1,32 @@ + + + +# chatState property + + + + + + + +[ChatState](../../enums_enums/ChatState.md) chatState + +_read / write_ + + + + + + +## Implementation + +```dart +ChatState chatState = ChatState.initial; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chats.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chats.md new file mode 100644 index 000000000..81f69657a --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/chats.md @@ -0,0 +1,35 @@ + + + +# chats property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[ChatListTileDataModel](../../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md)> chats + + + + + + + + +## Implementation + +```dart +List get chats => _chats; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/dispose.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/dispose.md new file mode 100644 index 000000000..551ec7916 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/dispose.md @@ -0,0 +1,47 @@ + + + +# dispose method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void dispose +() + +_override_ + + + +

Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed).

+

This method should only be called by the object's owner.

+

This method does not notify listeners, and clears the listener list once +it is called. Consumers of this class must decide on whether to notify +listeners or not immediately before disposal.

+ + + +## Implementation + +```dart +@override +void dispose() { + _chatMessageSubscription?.cancel(); + _chatListSubscription.cancel(); + super.dispose(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/getChatMessages.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/getChatMessages.md new file mode 100644 index 000000000..bf87af3bc --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/getChatMessages.md @@ -0,0 +1,54 @@ + + + +# getChatMessages method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getChatMessages +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId) + + + + + +

This function get all messages for a chat.

+

params:

+
    +
  • chatId : id of a chat for which messages need to be fetched.
  • +
+ + + +## Implementation + +```dart +Future getChatMessages(String chatId) async { + _chatMessagesByUser.clear(); + chatState = ChatState.loading; + // await _chatService.getMessagesFromDirectChat(); + // variable + final List messages = []; + _chatMessageSubscription = + _chatService.chatMessagesStream.listen((newMessage) { + messages.add(newMessage); + _chatMessagesByUser[chatId] = messages; + }); + // use `chatService` services + await _chatService.getDirectChatMessagesByChatId(chatId); + chatState = ChatState.complete; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/initialise.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/initialise.md new file mode 100644 index 000000000..1ddffc5e0 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/initialise.md @@ -0,0 +1,47 @@ + + + +# initialise method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> initialise +() + + + + + + + + +## Implementation + +```dart +Future initialise() async { + setState(ViewState.busy); + chatState = ChatState.loading; + + _chatListSubscription = _chatService.chatListStream.listen((newChat) { + _uniqueChatIds.add(newChat.id!); + _chats.insert(0, newChat); + }); + + await _chatService.getDirectChatsByUserId(); + + chatState = ChatState.complete; + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/listKey.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/listKey.md new file mode 100644 index 000000000..64ba84797 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/listKey.md @@ -0,0 +1,32 @@ + + + +# listKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[AnimatedListState](https://api.flutter.dev/flutter/widgets/AnimatedListState-class.html)> listKey + +_final_ + + + + + + +## Implementation + +```dart +final listKey = GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/name.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/name.md new file mode 100644 index 000000000..8a9acbd90 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/name.md @@ -0,0 +1,32 @@ + + + +# name property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name + +_read / write_ + + + + + + +## Implementation + +```dart +String? name; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/refreshChats.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/refreshChats.md new file mode 100644 index 000000000..87d21035e --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/refreshChats.md @@ -0,0 +1,40 @@ + + + +# refreshChats method + + + + + + + + +void refreshChats +() + + + + + +

This function refresh the chats.

+ + + +## Implementation + +```dart +void refreshChats() { + _chats.clear(); + _uniqueChatIds.clear(); + notifyListeners(); + _chatService.getDirectChatsByUserId(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/sendMessageToDirectChat.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/sendMessageToDirectChat.md new file mode 100644 index 000000000..d1cf19519 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel/sendMessageToDirectChat.md @@ -0,0 +1,50 @@ + + + +# sendMessageToDirectChat method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> sendMessageToDirectChat +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) messageContent) + + + + + +

This function send the message to Direct Chat.

+

params:

+
    +
  • chatId : id of a chat where message need to be send.
  • +
  • messageContent : content of a message.
  • +
+ + + +## Implementation + +```dart +Future sendMessageToDirectChat( + String chatId, + String messageContent, +) async { + chatState = ChatState.loading; + _chatService.chatMessagesStream.listen((newMessage) { + _chatMessagesByUser[chatId]!.add(newMessage); + }); + await _chatService.sendMessageToDirectChat(chatId, messageContent); + chatState = ChatState.complete; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model-library.md new file mode 100644 index 000000000..e1737c8bb --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/view_model_after_auth_view_models_chat_view_models_direct_chat_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# direct_chat_view_model library + + + + + + + + + + + +## Classes + +##### [DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) + + + +This ViewModel class have different functions that are used interact with model in the context of Direct Chat. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md new file mode 100644 index 000000000..d1b8cd05b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md @@ -0,0 +1,211 @@ + + + +# SelectContactViewModel class + + + + + + + + + +

SelectContactViewModel class have different functions to interact with model.

+

Functions include:

+
    +
  • getCurrentOrgUsersList : to get all users of current organization.
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- SelectContactViewModel + + + + + + + + +## Constructors + +[SelectContactViewModel](../view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/SelectContactViewModel.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [orgMembersList](../view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/orgMembersList.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)> + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [getCurrentOrgUsersList](../view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/getCurrentOrgUsersList.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to get all users list of an current organization. + + + + +##### [initialise](../view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/initialise.md)() void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/SelectContactViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/SelectContactViewModel.md new file mode 100644 index 000000000..195db77ac --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/SelectContactViewModel.md @@ -0,0 +1,24 @@ + + + +# SelectContactViewModel constructor + + + + + + + +SelectContactViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/getCurrentOrgUsersList.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/getCurrentOrgUsersList.md new file mode 100644 index 000000000..8c9f8c8cd --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/getCurrentOrgUsersList.md @@ -0,0 +1,42 @@ + + + +# getCurrentOrgUsersList method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getCurrentOrgUsersList +() + + + + + +

This function is used to get all users list of an current organization.

+ + + +## Implementation + +```dart +Future getCurrentOrgUsersList() async { + if (orgMembersList.isEmpty) { + orgMembersList = await _organizationService + .getOrgMembersList(userConfig.currentOrg.id!); + } + + //return orgMembersList; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/initialise.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/initialise.md new file mode 100644 index 000000000..a51657cbb --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/initialise.md @@ -0,0 +1,36 @@ + + + +# initialise method + + + + + + + + +void initialise +() + + + + + + + + +## Implementation + +```dart +void initialise() { + _organizationService = locator(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/orgMembersList.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/orgMembersList.md new file mode 100644 index 000000000..fc9910f37 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel/orgMembersList.md @@ -0,0 +1,32 @@ + + + +# orgMembersList property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)> orgMembersList + +_read / write_ + + + + + + +## Implementation + +```dart +late List orgMembersList = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/view_model_after_auth_view_models_chat_view_models_select_contact_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/view_model_after_auth_view_models_chat_view_models_select_contact_view_model-library.md new file mode 100644 index 000000000..8d9207601 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_chat_view_models_select_contact_view_model/view_model_after_auth_view_models_chat_view_models_select_contact_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# select_contact_view_model library + + + + + + + + + + + +## Classes + +##### [SelectContactViewModel](../view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md) + + + +SelectContactViewModel class have different functions to interact with model. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md new file mode 100644 index 000000000..38267d729 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md @@ -0,0 +1,432 @@ + + + +# CreateEventViewModel class + + + + + + + + + +

CreateEventViewModel class have methods to interact with model in.

+

the context of creating the event in the organization.

+

Methods include:

+
    +
  • createEvent : to create an event.
  • +
  • getImageFromGallery : to select image for a post.
  • +
  • removeImage : to remove the image.
  • +
  • getCurrentOrgUsersList : to get all user list of current organization.
  • +
  • removeUserFromList : to remove a user from list.
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- CreateEventViewModel + + + + + + + + +## Constructors + +[CreateEventViewModel](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/CreateEventViewModel.md) () + + + + +## Properties + +##### [descriptionFocus](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/descriptionFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + +DescriptionFocus FocusNode. +_read / write_ + + + +##### [eventDescriptionTextController](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventDescriptionTextController.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + +Event Description Text Controller. +_read / write_ + + + +##### [eventEndDate](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndDate.md) ↔ [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) + + + +Event End Date. +_read / write_ + + + +##### [eventEndTime](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndTime.md) ↔ [TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) + + + +Event End Time. +_read / write_ + + + +##### [eventLocationTextController](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventLocationTextController.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + +Event Location Text Controller. +_read / write_ + + + +##### [eventStartDate](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartDate.md) ↔ [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) + + + +Event Start Date. +_read / write_ + + + +##### [eventStartTime](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartTime.md) ↔ [TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) + + + +Event Start Time. +_read / write_ + + + +##### [eventTitleTextController](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventTitleTextController.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + +Event Title Text Controller. +_read / write_ + + + +##### [formKey](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/formKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> + + + +Global FormKey. +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [imageFile](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/imageFile.md) → [File](https://api.flutter.dev/flutter/dart-io/File-class.html)? + + + +Getter to return imageFile. +_read-only_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [isPublicSwitch](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isPublicSwitch.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Public Event or Not. +_read / write_ + + + +##### [isRegisterableSwitch](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isRegisterableSwitch.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +If event is registerable after creation. +_read / write_ + + + +##### [latitude](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/latitude.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + +Latitude store. +_read / write_ + + + +##### [locationFocus](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/locationFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + +LocationFocus FocusNode. +_read / write_ + + + +##### [longitude](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/longitude.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + +Longitude store. +_read / write_ + + + +##### [memberCheckedMap](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/memberCheckedMap.md) → [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + +Getter to return members map. +_read-only_ + + + +##### [orgMembersList](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/orgMembersList.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)> + + + +Organisation Members List. +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [selectedMembers](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/selectedMembers.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)> + + + +Getter to return selected members. +_read-only_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [titleFocus](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/titleFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + +TitleFocus FocusNode. +_read / write_ + + + +##### [validate](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/validate.md) ↔ [AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) + + + +AutoValidateMode default to disabled. +_read / write_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [buildUserList](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/buildUserList.md)() void + + + +This function build the user list. + + + + +##### [createEvent](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/createEvent.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to create the event for the organization. + + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [getCurrentOrgUsersList](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getCurrentOrgUsersList.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)>> + + + +This function fetch all the users in the current organization and return List. + + + + +##### [getImageFromGallery](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getImageFromGallery.md)({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) camera = false}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to get the image from gallery. + + + + +##### [initialize](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/initialize.md)() void + + + +Function To Initialize. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeImage](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeImage.md)() void + + + +This function remove the selected image. + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [removeUserFromList](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeUserFromList.md)({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId}) void + + + +This function is used to remove a user from user's list. + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/CreateEventViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/CreateEventViewModel.md new file mode 100644 index 000000000..50eb1089f --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/CreateEventViewModel.md @@ -0,0 +1,24 @@ + + + +# CreateEventViewModel constructor + + + + + + + +CreateEventViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/buildUserList.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/buildUserList.md new file mode 100644 index 000000000..49b43c3ff --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/buildUserList.md @@ -0,0 +1,50 @@ + + + +# buildUserList method + + + + + + + + +void buildUserList +() + + + + + +

This function build the user list.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void buildUserList() { + _selectedMembers.clear(); + + // loop through the organization member list + + orgMembersList.forEach((orgMember) { + if (_memberCheckedMap[orgMember.id] == true) { + _selectedMembers.add(orgMember); + } + }); + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/createEvent.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/createEvent.md new file mode 100644 index 000000000..e02be1250 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/createEvent.md @@ -0,0 +1,106 @@ + + + +# createEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> createEvent +() + + + + + +

This function is used to create the event for the organization.

+

The function uses database_mutation_functions services to call the graphQL mutation +for creating an event and passes the required variables for the event.

+

params: + None

+

returns:

+
    +
  • Future<void>: Asynchronous function for creating event
  • +
+ + + +## Implementation + +```dart +Future createEvent() async { + titleFocus.unfocus(); + locationFocus.unfocus(); + descriptionFocus.unfocus(); + validate = AutovalidateMode.always; + if (formKey.currentState!.validate()) { + validate = AutovalidateMode.disabled; + + // variables initialisation + final DateTime startDate = eventStartDate; + final DateTime endDate = eventEndDate; + final DateTime startTime = DateTime( + startDate.year, + startDate.month, + startDate.day, + eventStartTime.hour, + eventStartTime.minute, + ); + final DateTime endTime = DateTime( + endDate.year, + endDate.month, + endDate.day, + eventEndTime.hour, + eventEndTime.minute, + ); + + // all required data for creating an event + final Map variables = { + 'startDate': DateFormat('yyyy-MM-dd').format(startDate), + 'endDate': DateFormat('yyyy-MM-dd').format(endDate), + 'organizationId': _currentOrg.id, + 'title': eventTitleTextController.text, + 'description': eventDescriptionTextController.text, + 'location': eventLocationTextController.text, + 'isPublic': isPublicSwitch, + 'isRegisterable': isRegisterableSwitch, + 'recurring': false, + 'allDay': false, + 'startTime': '${DateFormat('HH:mm:ss').format(startTime)}Z', + 'endTime': '${DateFormat('HH:mm:ss').format(endTime)}Z', + if (latitude != null) 'latitude': latitude, + if (longitude != null) 'longitude': longitude, + }; + + navigationService.pushDialog( + const CustomProgressDialog(key: Key('EventCreationProgress')), + ); + final tokenResult = await databaseFunctions + .refreshAccessToken(userConfig.currentUser.refreshToken!); + print(tokenResult); + // invoke the `gqlAuthMutation` function of `databaseFunctions` + // service along with the mutation query and variable map. + final result = await databaseFunctions.gqlAuthMutation( + EventQueries().addEvent(), + variables: variables, + ); + navigationService.pop(); + if (result != null) { + navigationService.pop(); + + await _eventService.getEvents(); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/descriptionFocus.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/descriptionFocus.md new file mode 100644 index 000000000..2d720cdd9 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/descriptionFocus.md @@ -0,0 +1,33 @@ + + + +# descriptionFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) descriptionFocus + +_read / write_ + + + +

DescriptionFocus FocusNode.

+ + + +## Implementation + +```dart +FocusNode descriptionFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventDescriptionTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventDescriptionTextController.md new file mode 100644 index 000000000..abda49060 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventDescriptionTextController.md @@ -0,0 +1,34 @@ + + + +# eventDescriptionTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) eventDescriptionTextController + +_read / write_ + + + +

Event Description Text Controller.

+ + + +## Implementation + +```dart +TextEditingController eventDescriptionTextController = + TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndDate.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndDate.md new file mode 100644 index 000000000..2eae857b1 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndDate.md @@ -0,0 +1,33 @@ + + + +# eventEndDate property + + + + + + + +[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) eventEndDate + +_read / write_ + + + +

Event End Date.

+ + + +## Implementation + +```dart +DateTime eventEndDate = DateTime.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndTime.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndTime.md new file mode 100644 index 000000000..18d766fed --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventEndTime.md @@ -0,0 +1,33 @@ + + + +# eventEndTime property + + + + + + + +[TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) eventEndTime + +_read / write_ + + + +

Event End Time.

+ + + +## Implementation + +```dart +TimeOfDay eventEndTime = TimeOfDay.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventLocationTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventLocationTextController.md new file mode 100644 index 000000000..d371ed22b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventLocationTextController.md @@ -0,0 +1,33 @@ + + + +# eventLocationTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) eventLocationTextController + +_read / write_ + + + +

Event Location Text Controller.

+ + + +## Implementation + +```dart +TextEditingController eventLocationTextController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartDate.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartDate.md new file mode 100644 index 000000000..d568203e3 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartDate.md @@ -0,0 +1,33 @@ + + + +# eventStartDate property + + + + + + + +[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) eventStartDate + +_read / write_ + + + +

Event Start Date.

+ + + +## Implementation + +```dart +DateTime eventStartDate = DateTime.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartTime.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartTime.md new file mode 100644 index 000000000..0ba2d449b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventStartTime.md @@ -0,0 +1,33 @@ + + + +# eventStartTime property + + + + + + + +[TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) eventStartTime + +_read / write_ + + + +

Event Start Time.

+ + + +## Implementation + +```dart +TimeOfDay eventStartTime = TimeOfDay.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventTitleTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventTitleTextController.md new file mode 100644 index 000000000..0ff98f1e4 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/eventTitleTextController.md @@ -0,0 +1,33 @@ + + + +# eventTitleTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) eventTitleTextController + +_read / write_ + + + +

Event Title Text Controller.

+ + + +## Implementation + +```dart +TextEditingController eventTitleTextController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/formKey.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/formKey.md new file mode 100644 index 000000000..8d24a83fc --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/formKey.md @@ -0,0 +1,33 @@ + + + +# formKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> formKey + +_final_ + + + +

Global FormKey.

+ + + +## Implementation + +```dart +final formKey = GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getCurrentOrgUsersList.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getCurrentOrgUsersList.md new file mode 100644 index 000000000..dd2d7bc7f --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getCurrentOrgUsersList.md @@ -0,0 +1,54 @@ + + + +# getCurrentOrgUsersList method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)>> getCurrentOrgUsersList +() + + + + + +

This function fetch all the users in the current organization and return List.

+

params: + None

+

returns:

+
    +
  • Future<List<User>>: Current Organization Users List
  • +
+ + + +## Implementation + +```dart +Future> getCurrentOrgUsersList() async { + if (orgMembersList.isEmpty) { + orgMembersList = await organizationService + .getOrgMembersList(userConfig.currentOrg.id!); + } + + // loop through list + orgMembersList.forEach((orgMember) { + _memberCheckedMap.putIfAbsent(orgMember.id!, () => false); + _memberCheckedMap.putIfAbsent(orgMember.id!, () => false); + }); + // return list + return orgMembersList; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getImageFromGallery.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getImageFromGallery.md new file mode 100644 index 000000000..8401473f6 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/getImageFromGallery.md @@ -0,0 +1,51 @@ + + + +# getImageFromGallery method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getImageFromGallery +({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) camera = false}) + + + + + +

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.
  • +
+

returns:

+
    +
  • Future<void>: Asynchronous function for getting image from gallery
  • +
+ + + +## Implementation + +```dart +Future getImageFromGallery({bool camera = false}) async { + final image = + await _multiMediaPickerService.getPhotoFromGallery(camera: camera); + if (image != null) { + _imageFile = image; + notifyListeners(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/imageFile.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/imageFile.md new file mode 100644 index 000000000..041c6defc --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/imageFile.md @@ -0,0 +1,42 @@ + + + +# imageFile property + + + + + + + + + +[File](https://api.flutter.dev/flutter/dart-io/File-class.html)? imageFile + + + + + +

Getter to return imageFile.

+

params: +None

+

returns:

+
    +
  • File?: Returns imageFile.
  • +
+ + + +## Implementation + +```dart +File? get imageFile => _imageFile; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/initialize.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/initialize.md new file mode 100644 index 000000000..1f60b376d --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/initialize.md @@ -0,0 +1,45 @@ + + + +# initialize method + + + + + + + + +void initialize +() + + + + + +

Function To Initialize.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void initialize() { + _currentOrg = _userConfig.currentOrg; + //_organizationService = locator(); + + _imageFile = null; + _multiMediaPickerService = locator(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isPublicSwitch.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isPublicSwitch.md new file mode 100644 index 000000000..8c49650a2 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isPublicSwitch.md @@ -0,0 +1,33 @@ + + + +# isPublicSwitch property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isPublicSwitch + +_read / write_ + + + +

Public Event or Not.

+ + + +## Implementation + +```dart +bool isPublicSwitch = true; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isRegisterableSwitch.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isRegisterableSwitch.md new file mode 100644 index 000000000..4c0808ed0 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/isRegisterableSwitch.md @@ -0,0 +1,33 @@ + + + +# isRegisterableSwitch property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isRegisterableSwitch + +_read / write_ + + + +

If event is registerable after creation.

+ + + +## Implementation + +```dart +bool isRegisterableSwitch = true; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/latitude.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/latitude.md new file mode 100644 index 000000000..da17e9b9c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/latitude.md @@ -0,0 +1,33 @@ + + + +# latitude property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? latitude + +_read / write_ + + + +

Latitude store.

+ + + +## Implementation + +```dart +double? latitude; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/locationFocus.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/locationFocus.md new file mode 100644 index 000000000..df230e493 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/locationFocus.md @@ -0,0 +1,33 @@ + + + +# locationFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) locationFocus + +_read / write_ + + + +

LocationFocus FocusNode.

+ + + +## Implementation + +```dart +FocusNode locationFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/longitude.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/longitude.md new file mode 100644 index 000000000..eba02e97c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/longitude.md @@ -0,0 +1,33 @@ + + + +# longitude property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? longitude + +_read / write_ + + + +

Longitude store.

+ + + +## Implementation + +```dart +double? longitude; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/memberCheckedMap.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/memberCheckedMap.md new file mode 100644 index 000000000..81076cdb6 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/memberCheckedMap.md @@ -0,0 +1,43 @@ + + + +# memberCheckedMap property + + + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> memberCheckedMap + + + + + +

Getter to return members map.

+

params: +None

+

returns:

+
    +
  • Map<String, bool>: Returns a map of entries with id and boolean if they are +selected for events or not in bottom sheet.
  • +
+ + + +## Implementation + +```dart +Map get memberCheckedMap => _memberCheckedMap; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/orgMembersList.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/orgMembersList.md new file mode 100644 index 000000000..5e26fd928 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/orgMembersList.md @@ -0,0 +1,33 @@ + + + +# orgMembersList property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)> orgMembersList + +_read / write_ + + + +

Organisation Members List.

+ + + +## Implementation + +```dart +late List orgMembersList = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeImage.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeImage.md new file mode 100644 index 000000000..11b3c4f3e --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeImage.md @@ -0,0 +1,42 @@ + + + +# removeImage method + + + + + + + + +void removeImage +() + + + + + +

This function remove the selected image.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void removeImage() { + _imageFile = null; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeUserFromList.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeUserFromList.md new file mode 100644 index 000000000..eafdab6ec --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/removeUserFromList.md @@ -0,0 +1,46 @@ + + + +# removeUserFromList method + + + + + + + + +void removeUserFromList +({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId}) + + + + + +

This function is used to remove a user from user's list.

+

params:

+
    +
  • userId: id of the user that need to be removed.
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void removeUserFromList({required String userId}) { + _selectedMembers.removeWhere((user) => user.id == userId); + _memberCheckedMap[userId] = false; + + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/selectedMembers.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/selectedMembers.md new file mode 100644 index 000000000..cc72b1eb8 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/selectedMembers.md @@ -0,0 +1,42 @@ + + + +# selectedMembers property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)> selectedMembers + + + + + +

Getter to return selected members.

+

params: +None

+

returns:

+
    +
  • List<User>: Returns a list of selectedMembers for events
  • +
+ + + +## Implementation + +```dart +List get selectedMembers => _selectedMembers; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/titleFocus.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/titleFocus.md new file mode 100644 index 000000000..dafe064f7 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/titleFocus.md @@ -0,0 +1,33 @@ + + + +# titleFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) titleFocus + +_read / write_ + + + +

TitleFocus FocusNode.

+ + + +## Implementation + +```dart +FocusNode titleFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/validate.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/validate.md new file mode 100644 index 000000000..0c6ee84f7 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel/validate.md @@ -0,0 +1,33 @@ + + + +# validate property + + + + + + + +[AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) validate + +_read / write_ + + + +

AutoValidateMode default to disabled.

+ + + +## Implementation + +```dart +AutovalidateMode validate = AutovalidateMode.disabled; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/view_model_after_auth_view_models_event_view_models_create_event_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/view_model_after_auth_view_models_event_view_models_create_event_view_model-library.md new file mode 100644 index 000000000..71a028978 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_create_event_view_model/view_model_after_auth_view_models_event_view_models_create_event_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# create_event_view_model library + + + + + + + + + + + +## Classes + +##### [CreateEventViewModel](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md) + + + +CreateEventViewModel class have methods to interact with model in. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md new file mode 100644 index 000000000..d2eed60cf --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md @@ -0,0 +1,330 @@ + + + +# EditEventViewModel class + + + + + + + + + +

EditEventViewModel class have methods to interact with model in +the context of editing the event in the organization.

+

Methods include:

+
    +
  • updateEvent : to update an event.
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- EditEventViewModel + + + + + + + + +## Constructors + +[EditEventViewModel](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/EditEventViewModel.md) () + + + + +## Properties + +##### [descriptionFocus](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/descriptionFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_read / write_ + + + +##### [eventDescriptionTextController](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventDescriptionTextController.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [eventEndDate](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndDate.md) ↔ [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) + + + + +_read / write_ + + + +##### [eventEndTime](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndTime.md) ↔ [TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) + + + + +_read / write_ + + + +##### [eventLocationTextController](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventLocationTextController.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [eventStartDate](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartDate.md) ↔ [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) + + + + +_read / write_ + + + +##### [eventStartTime](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartTime.md) ↔ [TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) + + + + +_read / write_ + + + +##### [eventTitleTextController](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventTitleTextController.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [formKey](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/formKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [isPublicSwitch](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isPublicSwitch.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [isRegisterableSwitch](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isRegisterableSwitch.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [locationFocus](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/locationFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [titleFocus](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/titleFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_read / write_ + + + +##### [validate](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/validate.md) ↔ [AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) + + + + +_read / write_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [initialize](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/initialize.md)([Event](../models_events_event_model/Event-class.md) event) void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [updateEvent](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/updateEvent.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to update an event. +The function uses editEvent function provided by eventService service. + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/EditEventViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/EditEventViewModel.md new file mode 100644 index 000000000..13fcad2a0 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/EditEventViewModel.md @@ -0,0 +1,24 @@ + + + +# EditEventViewModel constructor + + + + + + + +EditEventViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/descriptionFocus.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/descriptionFocus.md new file mode 100644 index 000000000..42e3cadfa --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/descriptionFocus.md @@ -0,0 +1,32 @@ + + + +# descriptionFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) descriptionFocus + +_read / write_ + + + + + + +## Implementation + +```dart +FocusNode descriptionFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventDescriptionTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventDescriptionTextController.md new file mode 100644 index 000000000..6c46c7d62 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventDescriptionTextController.md @@ -0,0 +1,33 @@ + + + +# eventDescriptionTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) eventDescriptionTextController + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController eventDescriptionTextController = + TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndDate.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndDate.md new file mode 100644 index 000000000..9e06aaece --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndDate.md @@ -0,0 +1,32 @@ + + + +# eventEndDate property + + + + + + + +[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) eventEndDate + +_read / write_ + + + + + + +## Implementation + +```dart +DateTime eventEndDate = DateTime.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndTime.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndTime.md new file mode 100644 index 000000000..fbcf2e3a5 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventEndTime.md @@ -0,0 +1,32 @@ + + + +# eventEndTime property + + + + + + + +[TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) eventEndTime + +_read / write_ + + + + + + +## Implementation + +```dart +TimeOfDay eventEndTime = TimeOfDay.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventLocationTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventLocationTextController.md new file mode 100644 index 000000000..65a364695 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventLocationTextController.md @@ -0,0 +1,32 @@ + + + +# eventLocationTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) eventLocationTextController + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController eventLocationTextController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartDate.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartDate.md new file mode 100644 index 000000000..0f6005ef7 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartDate.md @@ -0,0 +1,32 @@ + + + +# eventStartDate property + + + + + + + +[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) eventStartDate + +_read / write_ + + + + + + +## Implementation + +```dart +DateTime eventStartDate = DateTime.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartTime.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartTime.md new file mode 100644 index 000000000..4a0fbcbd6 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventStartTime.md @@ -0,0 +1,32 @@ + + + +# eventStartTime property + + + + + + + +[TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) eventStartTime + +_read / write_ + + + + + + +## Implementation + +```dart +TimeOfDay eventStartTime = TimeOfDay.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventTitleTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventTitleTextController.md new file mode 100644 index 000000000..a8880e96a --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/eventTitleTextController.md @@ -0,0 +1,32 @@ + + + +# eventTitleTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) eventTitleTextController + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController eventTitleTextController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/formKey.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/formKey.md new file mode 100644 index 000000000..d7de0e859 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/formKey.md @@ -0,0 +1,32 @@ + + + +# formKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> formKey + +_final_ + + + + + + +## Implementation + +```dart +final formKey = GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/initialize.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/initialize.md new file mode 100644 index 000000000..1ecb6819c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/initialize.md @@ -0,0 +1,37 @@ + + + +# initialize method + + + + + + + + +void initialize +([Event](../../models_events_event_model/Event-class.md) event) + + + + + + + + +## Implementation + +```dart +void initialize(Event event) { + _event = event; + _fillEditForm(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isPublicSwitch.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isPublicSwitch.md new file mode 100644 index 000000000..3f1458f4b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isPublicSwitch.md @@ -0,0 +1,32 @@ + + + +# isPublicSwitch property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isPublicSwitch + +_read / write_ + + + + + + +## Implementation + +```dart +bool isPublicSwitch = true; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isRegisterableSwitch.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isRegisterableSwitch.md new file mode 100644 index 000000000..02f53c66c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/isRegisterableSwitch.md @@ -0,0 +1,32 @@ + + + +# isRegisterableSwitch property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isRegisterableSwitch + +_read / write_ + + + + + + +## Implementation + +```dart +bool isRegisterableSwitch = false; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/locationFocus.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/locationFocus.md new file mode 100644 index 000000000..bd199d216 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/locationFocus.md @@ -0,0 +1,32 @@ + + + +# locationFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) locationFocus + +_read / write_ + + + + + + +## Implementation + +```dart +FocusNode locationFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/titleFocus.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/titleFocus.md new file mode 100644 index 000000000..43897adf9 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/titleFocus.md @@ -0,0 +1,32 @@ + + + +# titleFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) titleFocus + +_read / write_ + + + + + + +## Implementation + +```dart +FocusNode titleFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/updateEvent.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/updateEvent.md new file mode 100644 index 000000000..5befd21fe --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/updateEvent.md @@ -0,0 +1,73 @@ + + + +# updateEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> updateEvent +() + + + + + +

This function is used to update an event. +The function uses editEvent function provided by eventService service.

+ + + +## Implementation + +```dart +Future updateEvent() async { + titleFocus.unfocus(); + locationFocus.unfocus(); + descriptionFocus.unfocus(); + validate = AutovalidateMode.always; + if (formKey.currentState!.validate()) { + validate = AutovalidateMode.disabled; + final DateTime startTime = DateTime( + eventStartDate.year, + eventStartDate.month, + eventStartDate.day, + eventStartTime.hour, + eventStartTime.minute, + ); + final DateTime endTime = DateTime( + eventEndDate.year, + eventEndDate.month, + eventEndDate.day, + eventEndTime.hour, + eventEndTime.minute, + ); + // map for the required data to update an event. + final Map variables = { + 'title': eventTitleTextController.text, + 'description': eventDescriptionTextController.text, + 'location': eventLocationTextController.text, + 'isPublic': isPublicSwitch, + 'isRegisterable': isRegisterableSwitch, + 'recurring': false, + 'allDay': false, + 'startDate': DateFormat('yyyy-MM-dd').format(eventStartDate), + 'endDate': DateFormat('yyyy-MM-dd').format(eventEndDate), + 'startTime': '${DateFormat('HH:mm:ss').format(startTime)}Z', + 'endTime': '${DateFormat('HH:mm:ss').format(endTime)}Z', + }; + _eventService.editEvent(eventId: _event.id!, variables: variables); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/validate.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/validate.md new file mode 100644 index 000000000..7dd63a4d4 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel/validate.md @@ -0,0 +1,32 @@ + + + +# validate property + + + + + + + +[AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) validate + +_read / write_ + + + + + + +## Implementation + +```dart +AutovalidateMode validate = AutovalidateMode.disabled; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/view_model_after_auth_view_models_event_view_models_edit_event_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/view_model_after_auth_view_models_event_view_models_edit_event_view_model-library.md new file mode 100644 index 000000000..ea15b6471 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_edit_event_view_model/view_model_after_auth_view_models_event_view_models_edit_event_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# edit_event_view_model library + + + + + + + + + + + +## Classes + +##### [EditEventViewModel](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md) + + + +EditEventViewModel class have methods to interact with model in +the context of editing the event in the organization. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md new file mode 100644 index 000000000..ca90a6094 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md @@ -0,0 +1,248 @@ + + + +# EventInfoViewModel class + + + + + + + + + +

EventInfoViewModel class helps interacting with model to serve view with the event information data.'

+

Methods include:

+
    +
  • registerForEvent : to register user for an event.
  • +
  • getFabTitle : to get the status of "registration" for an event.
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- EventInfoViewModel + + + + + + + + +## Constructors + +[EventInfoViewModel](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/EventInfoViewModel.md) () + + + + +## Properties + +##### [event](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/event.md) ↔ [Event](../models_events_event_model/Event-class.md) + + + + +_read / write_ + + + +##### [exploreEventsInstance](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/exploreEventsInstance.md) ↔ [ExploreEventsViewModel](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) + + + + +_read / write_ + + + +##### [fabTitle](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/fabTitle.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [registrants](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registrants.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../models_user_user_info/User-class.md)> + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [getFabTitle](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/getFabTitle.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +This function returns String type for the event registration status. + + + + +##### [initialize](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/initialize.md)({required [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> args}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +initialise with the event data fetched from the model. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [registerForEvent](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registerForEvent.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function helps the user to register for an event. + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/EventInfoViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/EventInfoViewModel.md new file mode 100644 index 000000000..e97f40787 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/EventInfoViewModel.md @@ -0,0 +1,24 @@ + + + +# EventInfoViewModel constructor + + + + + + + +EventInfoViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/event.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/event.md new file mode 100644 index 000000000..c2c81ab4f --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/event.md @@ -0,0 +1,32 @@ + + + +# event property + + + + + + + +[Event](../../models_events_event_model/Event-class.md) event + +_read / write_ + + + + + + +## Implementation + +```dart +late Event event; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/exploreEventsInstance.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/exploreEventsInstance.md new file mode 100644 index 000000000..577772d85 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/exploreEventsInstance.md @@ -0,0 +1,32 @@ + + + +# exploreEventsInstance property + + + + + + + +[ExploreEventsViewModel](../../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) exploreEventsInstance + +_read / write_ + + + + + + +## Implementation + +```dart +late ExploreEventsViewModel exploreEventsInstance; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/fabTitle.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/fabTitle.md new file mode 100644 index 000000000..ec2aa5e29 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/fabTitle.md @@ -0,0 +1,32 @@ + + + +# fabTitle property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) fabTitle + +_read / write_ + + + + + + +## Implementation + +```dart +late String fabTitle; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/getFabTitle.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/getFabTitle.md new file mode 100644 index 000000000..2c51f02c8 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/getFabTitle.md @@ -0,0 +1,43 @@ + + + +# getFabTitle method + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) getFabTitle +() + + + + + +

This function returns String type for the event registration status.

+ + + +## Implementation + +```dart +String getFabTitle() { + if (event.isRegisterable == false) { + return "Not Registrable"; + } else if (event.isRegistered == true) { + return "Registered"; + } else { + return "Register"; + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/initialize.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/initialize.md new file mode 100644 index 000000000..4c6cd87ca --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/initialize.md @@ -0,0 +1,54 @@ + + + +# initialize method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> initialize +({required [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> args}) + + + + + +

initialise with the event data fetched from the model.

+ + + +## Implementation + +```dart +Future initialize({required Map args}) async { + event = args["event"] as Event; + exploreEventsInstance = + args["exploreEventViewModel"] as ExploreEventsViewModel; + fabTitle = getFabTitle(); + setState(ViewState.busy); + final fetchRegistrantsByEventQueryResult = await locator() + .fetchRegistrantsByEvent(event.id!) as QueryResult; + final registrantsJsonList = fetchRegistrantsByEventQueryResult + .data!['registrantsByEvent'] as List; + registrants = registrantsJsonList + .map( + (registrantJson) => User.fromJson( + registrantJson! as Map, + fromOrg: true, + ), + ) + .toList(); + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registerForEvent.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registerForEvent.md new file mode 100644 index 000000000..453b65075 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registerForEvent.md @@ -0,0 +1,58 @@ + + + +# registerForEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> registerForEvent +() + + + + + +

This function helps the user to register for an event.

+ + + +## Implementation + +```dart +Future registerForEvent() async { + // if event registration is open and user not already registered for the event. + if (event.isRegisterable == true && event.isRegistered == false) { + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('RegisterEvent'), + ), + ); + + // use `registerForAnEvent` function provided by `EventService` service. + final registerResult = + await locator().registerForAnEvent(event.id!); + //final registerResult = await EventService().registerForAnEvent(event.id!); + // if the registration is successful. + if (registerResult != null) { + event.isRegistered = true; + registrants.add(locator().currentUser); + } + print(registerResult); + fabTitle = getFabTitle(); + navigationService.pop(); + notifyListeners(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registrants.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registrants.md new file mode 100644 index 000000000..3074b46da --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel/registrants.md @@ -0,0 +1,32 @@ + + + +# registrants property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[User](../../models_user_user_info/User-class.md)> registrants + +_read / write_ + + + + + + +## Implementation + +```dart +late List registrants; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/view_model_after_auth_view_models_event_view_models_event_info_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/view_model_after_auth_view_models_event_view_models_event_info_view_model-library.md new file mode 100644 index 000000000..d652071d5 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_event_info_view_model/view_model_after_auth_view_models_event_view_models_event_info_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# event_info_view_model library + + + + + + + + + + + +## Classes + +##### [EventInfoViewModel](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md) + + + +EventInfoViewModel class helps interacting with model to serve view with the event information data.' + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md new file mode 100644 index 000000000..0db9f1f4b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md @@ -0,0 +1,281 @@ + + + +# ExploreEventsViewModel class + + + + + + + + + +

ExploreEventsViewModel class helps to interact with model to serve data to view for event explore section.

+

Methods include:

+
    +
  • fetchNewEvents : to fetch new events in the organization.
  • +
  • refreshEvents : to refersh the event.
  • +
  • checkIfExistsAndAddNewEvent : to check if the event exists or not, if now add a new event.
  • +
  • deleteEvent : to delete the event.
  • +
  • choseValueFromDropdown : to return the relevant message in the dropdown after any action.
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- ExploreEventsViewModel + + + + + + + + +## Constructors + +[ExploreEventsViewModel](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/ExploreEventsViewModel.md) () + + + + +## Properties + +##### [chosenValue](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/chosenValue.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read-only_ + + + +##### [emptyListMessage](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/emptyListMessage.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read-only_ + + + +##### [events](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/events.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../models_events_event_model/Event-class.md)> + + + + +_read-only_ + + + +##### [eventService](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/eventService.md) → [EventService](../services_event_service/EventService-class.md) + + + + +_read-only_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [checkIfExistsAndAddNewEvent](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/checkIfExistsAndAddNewEvent.md)([Event](../models_events_event_model/Event-class.md) newEvent) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function add a new event if the event not exist. + + + + +##### [choseValueFromDropdown](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/choseValueFromDropdown.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function takes the choosen value from dropdown and +return the filter events, if empty list then return relevant message. + + + + +##### [deleteEvent](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/deleteEvent.md)({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function deletes the event. + + + + +##### [dispose](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/dispose.md)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_override_ + + + +##### [fetchNewEvents](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/fetchNewEvents.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to fetch new events in the organization. +The function uses getEvents method from EventService. + + + + +##### [initialise](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/initialise.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [refreshEvents](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/refreshEvents.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to refresh the events in the organization. +The function uses getEvents method from EventService. + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/ExploreEventsViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/ExploreEventsViewModel.md new file mode 100644 index 000000000..ee83f259c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/ExploreEventsViewModel.md @@ -0,0 +1,24 @@ + + + +# ExploreEventsViewModel constructor + + + + + + + +ExploreEventsViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/checkIfExistsAndAddNewEvent.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/checkIfExistsAndAddNewEvent.md new file mode 100644 index 000000000..e16d37fb2 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/checkIfExistsAndAddNewEvent.md @@ -0,0 +1,47 @@ + + + +# checkIfExistsAndAddNewEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> checkIfExistsAndAddNewEvent +([Event](../../models_events_event_model/Event-class.md) newEvent) + + + + + +

This function add a new event if the event not exist.

+

params:

+
    +
  • newEvent : Event type variable containing data to create a new event.
  • +
+ + + +## Implementation + +```dart +Future checkIfExistsAndAddNewEvent(Event newEvent) async { + // checking if the `newEvent.id` is unique and not exist already. + if ((!_uniqueEventIds.contains(newEvent.id)) && + (newEvent.organization!.id == userConfig.currentOrg.id)) { + _uniqueEventIds.add(newEvent.id!); + _parseEventDateTime(newEvent); + notifyListeners(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/choseValueFromDropdown.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/choseValueFromDropdown.md new file mode 100644 index 000000000..a875ad66a --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/choseValueFromDropdown.md @@ -0,0 +1,117 @@ + + + +# choseValueFromDropdown method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> choseValueFromDropdown +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) value) + + + + + +

This function takes the choosen value from dropdown and +return the filter events, if empty list then return relevant message.

+

params:

+
    +
  • value : choosen value from dropdown.
  • +
+ + + +## Implementation + +```dart +Future choseValueFromDropdown(String value) async { + _chosenValue = value; + notifyListeners(); + setState(ViewState.busy); + + switch (_chosenValue) { + // if `_chosenValue` is "All events". + case 'All Events': + { + // all events + _events = _bufferEvents; + // if list is empty + _emptyListMessage = "Looks like there aren't any events."; + } + break; + // if `_chosenValue` is "created event". + case 'Created Events': + { + // loop through the `_events` list and check + // for the creator id matched the current user id. + _events = List.from( + _bufferEvents.where( + (element) => element.creator!.id == userConfig.currentUser.id, + ), + ); + // if list is empty + _emptyListMessage = "You have not created any event."; + } + break; + // if `_chosenValue` is "Registered Events". + case 'Registered Events': + { + // loop through the `_events` list and filter elements + // if `element.isRegistered` is true and user is not the creator. + _events = List.from( + _bufferEvents.where( + (element) => + element.isRegistered == true && + element.creator!.id != userConfig.currentUser.id, + ), + ); + // if list is empty + _emptyListMessage = "No registered events are present"; + } + break; + // if `_chosenValue` is "Registered Events". + case 'Public Events': + { + // loop through the `_events` list and filter elements + // with the `isPublic` as true. + _events = _bufferEvents + .where((element) => element.isPublic == true) + .toList(); + + // if list is empty + _emptyListMessage = "There aren't any public events."; + } + break; + case 'Private Events': + { + // loop through the `_events` list and filter elements + // with the `isPublic` as false. + _events = _bufferEvents + .where((element) => element.isPublic == false) + .toList(); + // if list is empty + _emptyListMessage = "There aren't any private events."; + } + break; + + default: + { + _events = _bufferEvents; + } + } + await Future.delayed(const Duration(milliseconds: 500)); + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/chosenValue.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/chosenValue.md new file mode 100644 index 000000000..d75248d69 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/chosenValue.md @@ -0,0 +1,35 @@ + + + +# chosenValue property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) chosenValue + + + + + + + + +## Implementation + +```dart +String get chosenValue => _chosenValue; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/deleteEvent.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/deleteEvent.md new file mode 100644 index 000000000..62435c10d --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/deleteEvent.md @@ -0,0 +1,64 @@ + + + +# deleteEvent method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> deleteEvent +({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId}) + + + + + +

This function deletes the event.

+

params:

+
    +
  • eventId : id of the event that need to be delete.
  • +
+ + + +## Implementation + +```dart +Future deleteEvent({required String eventId}) async { + // push the custom alert dialog to ask for confirmation. + navigationService.pushDialog( + CustomAlertDialog( + reverse: true, + dialogSubTitle: 'Are you sure you want to delete this event?', + successText: 'Delete', + success: () { + navigationService.pop(); + _eventService.deleteEvent(eventId).then( + (result) async { + if (result != null) { + navigationService.pop(); + setState(ViewState.busy); + print(result); + _uniqueEventIds.remove(eventId); + _events.removeWhere((element) => element.id == eventId); + await Future.delayed(const Duration(milliseconds: 500)); + setState(ViewState.idle); + } + }, + ); + }, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/dispose.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/dispose.md new file mode 100644 index 000000000..6c23fac6a --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/dispose.md @@ -0,0 +1,47 @@ + + + +# dispose method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void dispose +() + +_override_ + + + +

Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed).

+

This method should only be called by the object's owner.

+

This method does not notify listeners, and clears the listener list once +it is called. Consumers of this class must decide on whether to notify +listeners or not immediately before disposal.

+ + + +## Implementation + +```dart +@override +void dispose() { + _eventStreamSubscription.cancel(); + _currentOrganizationStreamSubscription.cancel(); + super.dispose(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/emptyListMessage.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/emptyListMessage.md new file mode 100644 index 000000000..9f89f47ba --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/emptyListMessage.md @@ -0,0 +1,35 @@ + + + +# emptyListMessage property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) emptyListMessage + + + + + + + + +## Implementation + +```dart +String get emptyListMessage => _emptyListMessage; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/eventService.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/eventService.md new file mode 100644 index 000000000..face3b442 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/eventService.md @@ -0,0 +1,35 @@ + + + +# eventService property + + + + + + + + + +[EventService](../../services_event_service/EventService-class.md) eventService + + + + + + + + +## Implementation + +```dart +EventService get eventService => _eventService; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/events.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/events.md new file mode 100644 index 000000000..c267070c5 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/events.md @@ -0,0 +1,35 @@ + + + +# events property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../../models_events_event_model/Event-class.md)> events + + + + + + + + +## Implementation + +```dart +List get events => _events; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/fetchNewEvents.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/fetchNewEvents.md new file mode 100644 index 000000000..9722f847c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/fetchNewEvents.md @@ -0,0 +1,41 @@ + + + +# fetchNewEvents method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> fetchNewEvents +() + + + + + +

This function is used to fetch new events in the organization. +The function uses getEvents method from EventService.

+ + + +## Implementation + +```dart +Future fetchNewEvents() async { + setState(ViewState.busy); + notifyListeners(); + await _eventService.getEvents(); + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/initialise.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/initialise.md new file mode 100644 index 000000000..cb43c5c96 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/initialise.md @@ -0,0 +1,45 @@ + + + +# initialise method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> initialise +() + + + + + + + + +## Implementation + +```dart +Future initialise() async { + setState(ViewState.busy); + _currentOrganizationStreamSubscription = userConfig.currentOrgInfoStream + .listen((updatedOrganization) => refreshEvents()); + await _eventService.getEvents(); + + _eventStreamSubscription = _eventService.eventStream.listen( + (newEvent) => checkIfExistsAndAddNewEvent(newEvent), + ); + _bufferEvents = _events; + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/refreshEvents.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/refreshEvents.md new file mode 100644 index 000000000..ed1c495c5 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel/refreshEvents.md @@ -0,0 +1,42 @@ + + + +# refreshEvents method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> refreshEvents +() + + + + + +

This function is used to refresh the events in the organization. +The function uses getEvents method from EventService.

+ + + +## Implementation + +```dart +Future refreshEvents() async { + setState(ViewState.busy); + _events.clear(); + _uniqueEventIds.clear(); + await _eventService.getEvents(); + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/view_model_after_auth_view_models_event_view_models_explore_events_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/view_model_after_auth_view_models_event_view_models_explore_events_view_model-library.md new file mode 100644 index 000000000..c28d0174c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_event_view_models_explore_events_view_model/view_model_after_auth_view_models_event_view_models_explore_events_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# explore_events_view_model library + + + + + + + + + + + +## Classes + +##### [ExploreEventsViewModel](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) + + + +ExploreEventsViewModel class helps to interact with model to serve data to view for event explore section. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md new file mode 100644 index 000000000..3241daad6 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md @@ -0,0 +1,306 @@ + + + +# OrganizationFeedViewModel class + + + + + + + + + +

OrganizationFeedViewModel class helps to interact with model to serve data to view for organization feed section.

+

Methods include:

+
    +
  • setCurrentOrganizationName : to set current organization name.
  • +
  • fetchNewPosts : to fetch new posts in the organization.
  • +
  • navigateToIndividualPage : to navigate to individual page.
  • +
  • navigateToPinnedPostPage : to navigate to pinned post page.
  • +
  • addNewPost : to add new post in the organization.
  • +
  • updatedPost : to update a post in the organization.
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- OrganizationFeedViewModel + + + + + + + + +## Constructors + +[OrganizationFeedViewModel](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/OrganizationFeedViewModel.md) () + + + + +## Properties + +##### [currentOrgName](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/currentOrgName.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read-only_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [istest](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/istest.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [pinnedPosts](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/pinnedPosts.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> + + + + +_read-only_ + + + +##### [posts](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/posts.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> + + + + +_read-only_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [addNewPost](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/addNewPost.md)([Post](../models_post_post_model/Post-class.md) newPost) void + + + +This function adds new Post. + + + + +##### [buildNewPosts](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/buildNewPosts.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> newPosts) void + + + +This function initialise _posts with newPosts. + + + + +##### [dispose](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/dispose.md)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_override_ + + + +##### [fetchNewPosts](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/fetchNewPosts.md)() void + + + +This function fetches new posts in the organization. + + + + +##### [initialise](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initialise.md)({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest = false}) void + + + + + + + + +##### [initializeWithDemoData](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initializeWithDemoData.md)() void + + + + + + + + +##### [navigateToIndividualPage](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToIndividualPage.md)([Post](../models_post_post_model/Post-class.md) post) void + + + +This function navigate to individual post page. + + + + +##### [navigateToPinnedPostPage](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToPinnedPostPage.md)() void + + + +This function navigate to pinned post page. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setCurrentOrganizationName](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/setCurrentOrganizationName.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) updatedOrganization) void + + + +This function sets the organization name after update. + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [updatedPost](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/updatedPost.md)([Post](../models_post_post_model/Post-class.md) post) void + + + +This function updates the post. + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/OrganizationFeedViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/OrganizationFeedViewModel.md new file mode 100644 index 000000000..67813533b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/OrganizationFeedViewModel.md @@ -0,0 +1,24 @@ + + + +# OrganizationFeedViewModel constructor + + + + + + + +OrganizationFeedViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/addNewPost.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/addNewPost.md new file mode 100644 index 000000000..8c2c03afe --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/addNewPost.md @@ -0,0 +1,42 @@ + + + +# addNewPost method + + + + + + + + +void addNewPost +([Post](../../models_post_post_model/Post-class.md) newPost) + + + + + +

This function adds new Post.

+

params:

+
    +
  • newPost
  • +
+ + + +## Implementation + +```dart +void addNewPost(Post newPost) { + _posts.insert(0, newPost); + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/buildNewPosts.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/buildNewPosts.md new file mode 100644 index 000000000..55261441c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/buildNewPosts.md @@ -0,0 +1,42 @@ + + + +# buildNewPosts method + + + + + + + + +void buildNewPosts +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> newPosts) + + + + + +

This function initialise _posts with newPosts.

+

params:

+
    +
  • newPosts
  • +
+ + + +## Implementation + +```dart +void buildNewPosts(List newPosts) { + _posts = newPosts; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/currentOrgName.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/currentOrgName.md new file mode 100644 index 000000000..9688a5a1b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/currentOrgName.md @@ -0,0 +1,35 @@ + + + +# currentOrgName property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) currentOrgName + + + + + + + + +## Implementation + +```dart +String get currentOrgName => _currentOrgName; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/dispose.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/dispose.md new file mode 100644 index 000000000..b9bddb208 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/dispose.md @@ -0,0 +1,49 @@ + + + +# dispose method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void dispose +() + +_override_ + + + +

Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed).

+

This method should only be called by the object's owner.

+

This method does not notify listeners, and clears the listener list once +it is called. Consumers of this class must decide on whether to notify +listeners or not immediately before disposal.

+ + + +## Implementation + +```dart +@override +void dispose() { + // Canceling the subscription so that there will be no rebuild after the widget is disposed. + _currentOrganizationStreamSubscription.cancel(); + _postsSubscription.cancel(); + _updatePostSubscription.cancel(); + super.dispose(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/fetchNewPosts.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/fetchNewPosts.md new file mode 100644 index 000000000..a01c185d7 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/fetchNewPosts.md @@ -0,0 +1,37 @@ + + + +# fetchNewPosts method + + + + + + + + +void fetchNewPosts +() + + + + + +

This function fetches new posts in the organization.

+ + + +## Implementation + +```dart +void fetchNewPosts() { + _postService.getPosts(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initialise.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initialise.md new file mode 100644 index 000000000..cea956cdb --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initialise.md @@ -0,0 +1,58 @@ + + + +# initialise method + + + + + + + + +void initialise +({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest = false}) + + + + + + + + +## Implementation + +```dart +void initialise( + // bool forTest, + { + bool isTest = false, +}) { + // For caching/initializing the current organization after the stream subscription has canceled and the stream is updated + + _currentOrgName = _userConfig.currentOrg.name!; + // ------ + // Attaching the stream subscription to rebuild the widgets automatically + _currentOrganizationStreamSubscription = + _userConfig.currentOrgInfoStream.listen( + (updatedOrganization) => + setCurrentOrganizationName(updatedOrganization.name!), + ); + _postsSubscription = _postService.postStream.listen((newPosts) { + return buildNewPosts(newPosts); + }); + + _updatePostSubscription = + _postService.updatedPostStream.listen((post) => updatedPost(post)); + if (isTest) { + istest = true; + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initializeWithDemoData.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initializeWithDemoData.md new file mode 100644 index 000000000..a6589facc --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/initializeWithDemoData.md @@ -0,0 +1,46 @@ + + + +# initializeWithDemoData method + + + + + + + + +void initializeWithDemoData +() + + + + + + + + +## Implementation + +```dart +void initializeWithDemoData() { + // final postJsonResult = postsDemoData; + // + // ------ + // // Calling function to ge the post for the only 1st time. + // _postService.getPosts(); + // + // //fetching pinnedPosts + // final pinnedPostJsonResult = pinnedPostsDemoData; + // pinnedPostJsonResult.forEach((pinnedPostJsonData) { + // _pinnedPosts.add(Post.fromJson(pinnedPostJsonData)); + // }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/istest.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/istest.md new file mode 100644 index 000000000..7b27c4dd8 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/istest.md @@ -0,0 +1,32 @@ + + + +# istest property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) istest + +_read / write_ + + + + + + +## Implementation + +```dart +bool istest = false; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToIndividualPage.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToIndividualPage.md new file mode 100644 index 000000000..82d923bcd --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToIndividualPage.md @@ -0,0 +1,38 @@ + + + +# navigateToIndividualPage method + + + + + + + + +void navigateToIndividualPage +([Post](../../models_post_post_model/Post-class.md) post) + + + + + +

This function navigate to individual post page.

+ + + +## Implementation + +```dart +void navigateToIndividualPage(Post post) { + // uses `pushScreen` method by `navigationService` service. + _navigationService.pushScreen(Routes.individualPost, arguments: post); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToPinnedPostPage.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToPinnedPostPage.md new file mode 100644 index 000000000..75f8159c1 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/navigateToPinnedPostPage.md @@ -0,0 +1,41 @@ + + + +# navigateToPinnedPostPage method + + + + + + + + +void navigateToPinnedPostPage +() + + + + + +

This function navigate to pinned post page.

+ + + +## Implementation + +```dart +void navigateToPinnedPostPage() { + // uses `pushScreen` method by `navigationService` service. + _navigationService.pushScreen( + Routes.pinnedPostPage, + arguments: _pinnedPosts, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/pinnedPosts.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/pinnedPosts.md new file mode 100644 index 000000000..88ef2709e --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/pinnedPosts.md @@ -0,0 +1,41 @@ + + + +# pinnedPosts property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> pinnedPosts + + + + + + + + +## Implementation + +```dart +List get pinnedPosts { + if (istest) { + _pinnedPosts = []; + return _pinnedPosts; + } + return _pinnedPosts; +} +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/posts.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/posts.md new file mode 100644 index 000000000..be2240d6a --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/posts.md @@ -0,0 +1,41 @@ + + + +# posts property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> posts + + + + + + + + +## Implementation + +```dart +List get posts { + // if (istest) { + // _posts = pinnedPostsDemoData.map((e) => Post.fromJson(e)).toList(); + // return _posts; + // } + return _posts; +} +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/setCurrentOrganizationName.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/setCurrentOrganizationName.md new file mode 100644 index 000000000..df80565db --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/setCurrentOrganizationName.md @@ -0,0 +1,48 @@ + + + +# setCurrentOrganizationName method + + + + + + + + +void setCurrentOrganizationName +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) updatedOrganization) + + + + + +

This function sets the organization name after update.

+

params:

+
    +
  • updatedOrganization : updated organization name.
  • +
+ + + +## Implementation + +```dart +void setCurrentOrganizationName(String updatedOrganization) { + // if `updatedOrganization` is not same to `_currentOrgName`. + if (updatedOrganization != _currentOrgName) { + _posts.clear(); + _renderedPostID.clear(); + _currentOrgName = updatedOrganization; + notifyListeners(); + } + // _postService.getPosts(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/updatedPost.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/updatedPost.md new file mode 100644 index 000000000..ad276dec3 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel/updatedPost.md @@ -0,0 +1,47 @@ + + + +# updatedPost method + + + + + + + + +void updatedPost +([Post](../../models_post_post_model/Post-class.md) post) + + + + + +

This function updates the post.

+

params:

+
    +
  • post
  • +
+ + + +## Implementation + +```dart +void updatedPost(Post post) { + for (int i = 0; i < _posts.length; i++) { + if (_posts[i].sId == post.sId) { + _posts[i] = post; + notifyListeners(); + break; + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model-library.md new file mode 100644 index 000000000..4f9361201 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/view_model_after_auth_view_models_feed_view_models_organization_feed_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# organization_feed_view_model library + + + + + + + + + + + +## Classes + +##### [OrganizationFeedViewModel](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md) + + + +OrganizationFeedViewModel class helps to interact with model to serve data to view for organization feed section. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md new file mode 100644 index 000000000..f83ea766c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md @@ -0,0 +1,275 @@ + + + +# EditProfilePageViewModel class + + + + + + + + + +

EditProfilePageViewModel class helps to interact with model to serve data to edit profile views.

+

Methods include:

+
    +
  • getImageFromGallery
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- EditProfilePageViewModel + + + + + + + + +## Constructors + +[EditProfilePageViewModel](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/EditProfilePageViewModel.md) () + + + + +## Properties + +##### [databaseService](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/databaseService.md) → [DataBaseMutationFunctions](../services_database_mutation_functions/DataBaseMutationFunctions-class.md) + + + + +_final_ + + + +##### [firstNameFocus](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_read / write_ + + + +##### [firstNameTextController](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameTextController.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [imageFile](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/imageFile.md) ↔ [File](https://api.flutter.dev/flutter/dart-io/File-class.html)? + + + + +_read / write_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [lastNameFocus](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_read / write_ + + + +##### [lastNameTextController](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameTextController.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [user](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/user.md) → [User](../models_user_user_info/User-class.md) + + + + +_final_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [getImageFromGallery](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/getImageFromGallery.md)({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) camera = false}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to get the image from gallery. +The function uses the _multiMediaPickerService services. + + + + +##### [initialize](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/initialize.md)() void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeImage](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/removeImage.md)() void + + + +This function remove the selected image. + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/EditProfilePageViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/EditProfilePageViewModel.md new file mode 100644 index 000000000..0bac4a494 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/EditProfilePageViewModel.md @@ -0,0 +1,24 @@ + + + +# EditProfilePageViewModel constructor + + + + + + + +EditProfilePageViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/databaseService.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/databaseService.md new file mode 100644 index 000000000..611b93985 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/databaseService.md @@ -0,0 +1,32 @@ + + + +# databaseService property + + + + + + + +[DataBaseMutationFunctions](../../services_database_mutation_functions/DataBaseMutationFunctions-class.md) databaseService + +_final_ + + + + + + +## Implementation + +```dart +final databaseService = databaseFunctions; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameFocus.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameFocus.md new file mode 100644 index 000000000..48ab5e6a5 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameFocus.md @@ -0,0 +1,32 @@ + + + +# firstNameFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) firstNameFocus + +_read / write_ + + + + + + +## Implementation + +```dart +FocusNode firstNameFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameTextController.md new file mode 100644 index 000000000..ad9f13aa6 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/firstNameTextController.md @@ -0,0 +1,32 @@ + + + +# firstNameTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) firstNameTextController + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController firstNameTextController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/getImageFromGallery.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/getImageFromGallery.md new file mode 100644 index 000000000..b1f5eda7c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/getImageFromGallery.md @@ -0,0 +1,47 @@ + + + +# getImageFromGallery method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> getImageFromGallery +({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) camera = false}) + + + + + +

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.
  • +
+ + + +## Implementation + +```dart +Future getImageFromGallery({bool camera = false}) async { + final image = + await _multiMediaPickerService.getPhotoFromGallery(camera: camera); + if (image != null) { + imageFile = image; + notifyListeners(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/imageFile.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/imageFile.md new file mode 100644 index 000000000..57c47fbe1 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/imageFile.md @@ -0,0 +1,32 @@ + + + +# imageFile property + + + + + + + +[File](https://api.flutter.dev/flutter/dart-io/File-class.html)? imageFile + +_read / write_ + + + + + + +## Implementation + +```dart +late File? imageFile; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/initialize.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/initialize.md new file mode 100644 index 000000000..0c1fdae5c --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/initialize.md @@ -0,0 +1,37 @@ + + + +# initialize method + + + + + + + + +void initialize +() + + + + + + + + +## Implementation + +```dart +void initialize() { + imageFile = null; + _multiMediaPickerService = locator(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameFocus.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameFocus.md new file mode 100644 index 000000000..e304beed0 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameFocus.md @@ -0,0 +1,32 @@ + + + +# lastNameFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) lastNameFocus + +_read / write_ + + + + + + +## Implementation + +```dart +FocusNode lastNameFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameTextController.md new file mode 100644 index 000000000..e7cd6c0a2 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/lastNameTextController.md @@ -0,0 +1,32 @@ + + + +# lastNameTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) lastNameTextController + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController lastNameTextController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/removeImage.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/removeImage.md new file mode 100644 index 000000000..2f0f573c0 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/removeImage.md @@ -0,0 +1,38 @@ + + + +# removeImage method + + + + + + + + +void removeImage +() + + + + + +

This function remove the selected image.

+ + + +## Implementation + +```dart +void removeImage() { + imageFile = null; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/user.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/user.md new file mode 100644 index 000000000..d20415aec --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel/user.md @@ -0,0 +1,32 @@ + + + +# user property + + + + + + + +[User](../../models_user_user_info/User-class.md) user + +_final_ + + + + + + +## Implementation + +```dart +final user = userConfig.currentUser; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model-library.md new file mode 100644 index 000000000..6d453459b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/view_model_after_auth_view_models_profile_view_models_edit_profile_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# edit_profile_view_model library + + + + + + + + + + + +## Classes + +##### [EditProfilePageViewModel](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md) + + + +EditProfilePageViewModel class helps to interact with model to serve data to edit profile views. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md new file mode 100644 index 000000000..399f3e789 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md @@ -0,0 +1,385 @@ + + + +# ProfilePageViewModel class + + + + + + + + + +

ProfilePageViewModel class helps to interact with model to serve data +and react to user's input in Profile Page view.

+

Methods include:

+
    +
  • logout
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- ProfilePageViewModel + + + + + + + + +## Constructors + +[ProfilePageViewModel](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/ProfilePageViewModel.md) () + + + + +## Properties + +##### [bottomSheetHeight](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/bottomSheetHeight.md) ↔ [double](https://api.flutter.dev/flutter/dart-core/double-class.html) + + + + +_read / write_ + + + +##### [currentOrg](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentOrg.md) ↔ [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + + +_read / write_ + + + +##### [currentUser](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentUser.md) ↔ [User](../models_user_user_info/User-class.md) + + + + +_read / write_ + + + +##### [denomination](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/denomination.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> + + + + +_final_ + + + +##### [donationAmount](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationAmount.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [donationCurrency](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrency.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read / write_ + + + +##### [donationCurrencySymbol](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrencySymbol.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read / write_ + + + +##### [donationField](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationField.md) → [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [organisation](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/organisation.md) ↔ [Box](https://pub.dev/documentation/hive/2.2.3/hive/Box-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> + + + + +_latefinal_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [scaffoldKey](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/scaffoldKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[ScaffoldState](https://api.flutter.dev/flutter/material/ScaffoldState-class.html)> + + + + +_final_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [url](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/url.md) ↔ [Box](https://pub.dev/documentation/hive/2.2.3/hive/Box-class.html) + + + + +_latefinal_ + + + +##### [user](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/user.md) ↔ [Box](https://pub.dev/documentation/hive/2.2.3/hive/Box-class.html)<[User](../models_user_user_info/User-class.md)> + + + + +_latefinal_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [attachListener](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/attachListener.md)([Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setter) void + + + + + + + + +##### [changeCurrency](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/changeCurrency.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setter) void + + + +This method changes the currency of the user for donation purpose. + + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [dominationButton](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/dominationButton.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) amount, [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setter) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +This widget returns button for domination. + + + + +##### [iconButton](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/iconButton.md)([Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) icon, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) onTap) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +This widget returns the button for social media sharing option. + + + + +##### [initialize](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/initialize.md)() void + + + + + + + + +##### [invite](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/invite.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) void + + + +This function generates the organization invitation link in a Dialog Box. +Dialog box contains the QR-code of organization invite link and social media sharing options. + + + + +##### [logout](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/logout.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This method destroys the user's session or sign out the user from app. +The function asks for the confimation in Custom Alert Dialog. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [popBottomSheet](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/popBottomSheet.md)() void + + + + + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [showSnackBar](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/showSnackBar.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) message) void + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [updateSheetHeight](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/updateSheetHeight.md)() void + + + + + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/ProfilePageViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/ProfilePageViewModel.md new file mode 100644 index 000000000..d85feb283 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/ProfilePageViewModel.md @@ -0,0 +1,24 @@ + + + +# ProfilePageViewModel constructor + + + + + + + +ProfilePageViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/attachListener.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/attachListener.md new file mode 100644 index 000000000..edcf92782 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/attachListener.md @@ -0,0 +1,50 @@ + + + +# attachListener method + + + + + + + + +void attachListener +([Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setter) + + + + + + + + +## Implementation + +```dart +void attachListener(Function setter) { + donationField.addListener(() { + if (donationField.hasFocus) { + setter(() { + bottomSheetHeight = SizeConfig.screenHeight! * 0.8725; + }); + } else { + Future.delayed(const Duration(milliseconds: 300), () { + { + setter(() { + bottomSheetHeight = SizeConfig.screenHeight! * 0.68; + }); + } + }); + } + }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/bottomSheetHeight.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/bottomSheetHeight.md new file mode 100644 index 000000000..6b02dd542 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/bottomSheetHeight.md @@ -0,0 +1,32 @@ + + + +# bottomSheetHeight property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html) bottomSheetHeight + +_read / write_ + + + + + + +## Implementation + +```dart +double bottomSheetHeight = SizeConfig.screenHeight! * 0.68; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/changeCurrency.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/changeCurrency.md new file mode 100644 index 000000000..123044aa4 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/changeCurrency.md @@ -0,0 +1,46 @@ + + + +# changeCurrency method + + + + + + + + +void changeCurrency +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setter) + + + + + +

This method changes the currency of the user for donation purpose.

+ + + +## Implementation + +```dart +void changeCurrency(BuildContext context, Function setter) { + showCurrencyPicker( + context: context, + currencyFilter: supportedCurrencies, + onSelect: (Currency currency) { + setter(() { + donationCurrency = currency.code; + donationCurrencySymbol = currency.symbol; + }); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentOrg.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentOrg.md new file mode 100644 index 000000000..6455d508d --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentOrg.md @@ -0,0 +1,32 @@ + + + +# currentOrg property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md) currentOrg + +_read / write_ + + + + + + +## Implementation + +```dart +late OrgInfo currentOrg; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentUser.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentUser.md new file mode 100644 index 000000000..e955d4062 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/currentUser.md @@ -0,0 +1,32 @@ + + + +# currentUser property + + + + + + + +[User](../../models_user_user_info/User-class.md) currentUser + +_read / write_ + + + + + + +## Implementation + +```dart +late User currentUser; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/denomination.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/denomination.md new file mode 100644 index 000000000..d75e715f0 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/denomination.md @@ -0,0 +1,32 @@ + + + +# denomination property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> denomination + +_final_ + + + + + + +## Implementation + +```dart +final List denomination = ['1', '5', '10']; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/dominationButton.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/dominationButton.md new file mode 100644 index 000000000..b69ecf716 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/dominationButton.md @@ -0,0 +1,68 @@ + + + +# dominationButton method + + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) dominationButton +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) amount, [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setter) + + + + + +

This widget returns button for domination.

+

params:

+
    +
  • amount : donation Amount.
  • +
  • setter : Function type, which on tap set the amount to donationAmount.
  • +
+ + + +## Implementation + +```dart +Widget dominationButton( + String amount, + BuildContext context, + Function setter, +) { + return InkWell( + onTap: () { + setter(() { + donationAmount.text = amount; + }); + }, + child: Container( + padding: EdgeInsets.symmetric( + vertical: SizeConfig.screenHeight! * 0.02, + horizontal: SizeConfig.screenWidth! * 0.075, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: donationAmount.text == amount + ? Theme.of(context).colorScheme.secondary + : Theme.of(context).colorScheme.primary, + ), + child: Text( + '$donationCurrencySymbol $amount', + style: Theme.of(context).textTheme.titleMedium, + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationAmount.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationAmount.md new file mode 100644 index 000000000..9ce57b258 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationAmount.md @@ -0,0 +1,32 @@ + + + +# donationAmount property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) donationAmount + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController donationAmount = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrency.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrency.md new file mode 100644 index 000000000..aacae7fd4 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrency.md @@ -0,0 +1,32 @@ + + + +# donationCurrency property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) donationCurrency + +_read / write_ + + + + + + +## Implementation + +```dart +String donationCurrency = "USD"; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrencySymbol.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrencySymbol.md new file mode 100644 index 000000000..bd1213350 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationCurrencySymbol.md @@ -0,0 +1,32 @@ + + + +# donationCurrencySymbol property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) donationCurrencySymbol + +_read / write_ + + + + + + +## Implementation + +```dart +String donationCurrencySymbol = "\$"; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationField.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationField.md new file mode 100644 index 000000000..a8002fbd9 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/donationField.md @@ -0,0 +1,32 @@ + + + +# donationField property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) donationField + +_final_ + + + + + + +## Implementation + +```dart +final FocusNode donationField = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/iconButton.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/iconButton.md new file mode 100644 index 000000000..3c4daade7 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/iconButton.md @@ -0,0 +1,52 @@ + + + +# iconButton method + + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) iconButton +([Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) icon, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) onTap) + + + + + +

This widget returns the button for social media sharing option.

+

params:

+
    +
  • icon : This is Widget type with icon details.
  • +
  • onTap : This is Function, which invoke on tap.
  • +
+ + + +## Implementation + +```dart +Widget iconButton(Widget icon, Function onTap) { + return Stack( + children: [ + IconButton( + onPressed: () { + print('tapped'); + onTap(); + }, + icon: icon, + ), + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/initialize.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/initialize.md new file mode 100644 index 000000000..831375087 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/initialize.md @@ -0,0 +1,39 @@ + + + +# initialize method + + + + + + + + +void initialize +() + + + + + + + + +## Implementation + +```dart +void initialize() { + setState(ViewState.busy); + currentOrg = _userConfig.currentOrg; + currentUser = _userConfig.currentUser; + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/invite.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/invite.md new file mode 100644 index 000000000..3126aa8f9 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/invite.md @@ -0,0 +1,134 @@ + + + +# invite method + + + + + + + + +void invite +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + +

This function generates the organization invitation link in a Dialog Box. +Dialog box contains the QR-code of organization invite link and social media sharing options.

+ + + +## Implementation + +```dart +void invite(BuildContext context) { + _appLanguageService.initialize(); + // organization url + final String url = + 'https://cyberwake.github.io/applink/invite?selectLang=${_appLanguageService.appLocal.languageCode}&setUrl=${GraphqlConfig.orgURI}&selectOrg=${userConfig.currentOrg.id!}'; + // QR + final String qrData = + '${GraphqlConfig.orgURI}?orgid=${userConfig.currentOrg.id!}'; + print(url); + print(qrData); + showModalBottomSheet( + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + builder: (BuildContext context) { + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: Container( + height: MediaQuery.of(context).size.height * 0.75, + decoration: const BoxDecoration( + color: Colors.white, + ), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + QrImage( + data: qrData, + version: QrVersions.auto, + size: 200.0, + foregroundColor: Colors.black, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.08, + ), + Text( + 'Scan the QR to join ${userConfig.currentOrg.name}', + style: const TextStyle(color: Colors.black), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.02, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.min, + children: [ + iconButton( + const FaIcon( + FontAwesomeIcons.twitter, + size: 35, + color: Color(0xFF1DA1F2), + ), + () async => SocialShare.shareTwitter('Join us', url: url), + ), + iconButton( + CustomPaint( + size: const Size( + 50, + 50 * 1.004, + ), //You can Replace [WIDTH] with your desired width for Custom Paint and height will be calculated automatically + painter: WhatsappLogo(), + ), + () async => SocialShare.shareWhatsapp(url), + ), + iconButton( + CustomPaint( + size: Size( + 45, + (45 * 1).toDouble(), + ), //You can Replace [WIDTH] with your desired width for Custom Paint and height will be calculated automatically + painter: TelegramLogo(), + ), + () async => SocialShare.shareTelegram(url), + ), + iconButton( + const FaIcon( + FontAwesomeIcons.shareNodes, + size: 30, + color: Color(0xff40c351), + ), + () async => SocialShare.shareOptions(url), + ), + ], + ) + ], + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/logout.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/logout.md new file mode 100644 index 000000000..32f820dbc --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/logout.md @@ -0,0 +1,86 @@ + + + +# logout method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> logout +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + +

This method destroys the user's session or sign out the user from app. +The function asks for the confimation in Custom Alert Dialog.

+ + + +## Implementation + +```dart +Future logout(BuildContext context) async { + // push custom alert dialog with the confirmation message. + navigationService.pushDialog( + CustomAlertDialog( + reverse: true, + dialogSubTitle: 'Are you sure you want to logout?', + successText: 'Logout', + success: () async { + try { + final result = await databaseFunctions + .gqlAuthMutation(queries.logout()) as QueryResult?; + if (result != null && result.data!['logout'] == true) { + navigationService.pop(); + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('LogoutProgress'), + ), + ); + Future.delayed(const Duration(seconds: 1)).then((value) { + user = Hive.box('currentUser'); + url = Hive.box('url'); + final androidFirebaseOptionsBox = + Hive.box('androidFirebaseOptions'); + final iosFirebaseOptionsBox = Hive.box('iosFirebaseOptions'); + organisation = Hive.box('currentOrg'); + user.clear(); + url.clear(); + androidFirebaseOptionsBox.clear(); + iosFirebaseOptionsBox.clear(); + try { + Firebase.app() + .delete(); // Deleting app will stop all Firebase plugins + } catch (e) { + debugPrint("ERROR: Unable to delete firebase app $e"); + } + organisation.clear(); + navigationService.pop(); + navigationService.removeAllAndPush( + '/selectLang', + '/', + arguments: '0', + ); + }); + } + } catch (e) { + print(e); + } + }, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/organisation.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/organisation.md new file mode 100644 index 000000000..3d34e04e3 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/organisation.md @@ -0,0 +1,32 @@ + + + +# organisation property + + + + + + + +[Box](https://pub.dev/documentation/hive/2.2.3/hive/Box-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> organisation + +_latefinal_ + + + + + + +## Implementation + +```dart +late final Box organisation; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/popBottomSheet.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/popBottomSheet.md new file mode 100644 index 000000000..13718f6ff --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/popBottomSheet.md @@ -0,0 +1,36 @@ + + + +# popBottomSheet method + + + + + + + + +void popBottomSheet +() + + + + + + + + +## Implementation + +```dart +void popBottomSheet() { + _navigationService.pop(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/scaffoldKey.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/scaffoldKey.md new file mode 100644 index 000000000..2ecabe500 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/scaffoldKey.md @@ -0,0 +1,32 @@ + + + +# scaffoldKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[ScaffoldState](https://api.flutter.dev/flutter/material/ScaffoldState-class.html)> scaffoldKey + +_final_ + + + + + + +## Implementation + +```dart +final GlobalKey scaffoldKey = GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/showSnackBar.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/showSnackBar.md new file mode 100644 index 000000000..aabf7b6b9 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/showSnackBar.md @@ -0,0 +1,36 @@ + + + +# showSnackBar method + + + + + + + + +void showSnackBar +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) message) + + + + + + + + +## Implementation + +```dart +void showSnackBar(String message) { + _navigationService.showTalawaErrorDialog(message, MessageType.error); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/updateSheetHeight.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/updateSheetHeight.md new file mode 100644 index 000000000..e79f361a2 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/updateSheetHeight.md @@ -0,0 +1,37 @@ + + + +# updateSheetHeight method + + + + + + + + +void updateSheetHeight +() + + + + + + + + +## Implementation + +```dart +void updateSheetHeight() { + bottomSheetHeight = SizeConfig.screenHeight! * 0.65; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/url.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/url.md new file mode 100644 index 000000000..0c2f3bed7 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/url.md @@ -0,0 +1,32 @@ + + + +# url property + + + + + + + +[Box](https://pub.dev/documentation/hive/2.2.3/hive/Box-class.html) url + +_latefinal_ + + + + + + +## Implementation + +```dart +late final Box url; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/user.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/user.md new file mode 100644 index 000000000..441993dc6 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel/user.md @@ -0,0 +1,32 @@ + + + +# user property + + + + + + + +[Box](https://pub.dev/documentation/hive/2.2.3/hive/Box-class.html)<[User](../../models_user_user_info/User-class.md)> user + +_latefinal_ + + + + + + +## Implementation + +```dart +late final Box user; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/view_model_after_auth_view_models_profile_view_models_profile_page_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/view_model_after_auth_view_models_profile_view_models_profile_page_view_model-library.md new file mode 100644 index 000000000..02602c2f7 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_profile_view_models_profile_page_view_model/view_model_after_auth_view_models_profile_view_models_profile_page_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# profile_page_view_model library + + + + + + + + + + + +## Classes + +##### [ProfilePageViewModel](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md) + + + +ProfilePageViewModel class helps to interact with model to serve data +and react to user's input in Profile Page view. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md new file mode 100644 index 000000000..4050b66df --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md @@ -0,0 +1,252 @@ + + + +# CreateTaskViewModel class + + + + + + + + + +

CreateTaskViewModel class helps to interact with model to serve data +and react to user's input in Create Task view.

+

Methods include:

+
    +
  • fillTask
  • +
  • `editTask
  • +
  • createTask
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- CreateTaskViewModel + + + + + + + + +## Constructors + +[CreateTaskViewModel](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/CreateTaskViewModel.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [taskDescriptionTextController](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskDescriptionTextController.md) → [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_final_ + + + +##### [taskEndDate](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndDate.md) ↔ [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) + + + + +_read / write_ + + + +##### [taskEndTime](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndTime.md) ↔ [TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) + + + + +_read / write_ + + + +##### [taskTitleTextController](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskTitleTextController.md) → [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_final_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [createTask](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/createTask.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + +This function creates a new task for an event. +The function uses createTask method provided by Task Services. + + + + +##### [dispose](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/dispose.md)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_override_ + + + +##### [editTask](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/editTask.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> + + + +This function updates the task. +The function uses editTask method provided by Task Services. + + + + +##### [fillTask](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/fillTask.md)([Task](../models_task_task_model/Task-class.md) task) void + + + +This functions fills the task controller data. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/CreateTaskViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/CreateTaskViewModel.md new file mode 100644 index 000000000..ddf303088 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/CreateTaskViewModel.md @@ -0,0 +1,24 @@ + + + +# CreateTaskViewModel constructor + + + + + + + +CreateTaskViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/createTask.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/createTask.md new file mode 100644 index 000000000..5bcc17868 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/createTask.md @@ -0,0 +1,54 @@ + + + +# createTask method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> createTask +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) + + + + + +

This function creates a new task for an event. +The function uses createTask method provided by Task Services.

+

params:

+
    +
  • eventId : id of the event for which task need to be add.
  • +
+ + + +## Implementation + +```dart +Future createTask(String eventId) async { + final deadline = DateTime( + taskEndDate.year, + taskEndDate.month, + taskEndDate.day, + taskEndTime.hour, + taskEndTime.minute, + ); + return _taskService.createTask( + title: taskTitleTextController.text, + description: taskDescriptionTextController.text, + deadline: deadline.microsecondsSinceEpoch.toString(), + eventId: eventId, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/dispose.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/dispose.md new file mode 100644 index 000000000..220418033 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/dispose.md @@ -0,0 +1,47 @@ + + + +# dispose method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void dispose +() + +_override_ + + + +

Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed).

+

This method should only be called by the object's owner.

+

This method does not notify listeners, and clears the listener list once +it is called. Consumers of this class must decide on whether to notify +listeners or not immediately before disposal.

+ + + +## Implementation + +```dart +@override +void dispose() { + taskTitleTextController.dispose(); + taskDescriptionTextController.dispose(); + super.dispose(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/editTask.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/editTask.md new file mode 100644 index 000000000..bb4079d46 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/editTask.md @@ -0,0 +1,54 @@ + + + +# editTask method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> editTask +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId) + + + + + +

This function updates the task. +The function uses editTask method provided by Task Services.

+

params:

+
    +
  • taskId : id of the task that needs to be updated.
  • +
+ + + +## Implementation + +```dart +Future editTask(String taskId) async { + final deadline = DateTime( + taskEndDate.year, + taskEndDate.month, + taskEndDate.day, + taskEndTime.hour, + taskEndTime.minute, + ); + return _taskService.editTask( + title: taskTitleTextController.text, + description: taskDescriptionTextController.text, + deadline: deadline.microsecondsSinceEpoch.toString(), + taskId: taskId, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/fillTask.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/fillTask.md new file mode 100644 index 000000000..5bea4157a --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/fillTask.md @@ -0,0 +1,47 @@ + + + +# fillTask method + + + + + + + + +void fillTask +([Task](../../models_task_task_model/Task-class.md) task) + + + + + +

This functions fills the task controller data.

+

params:

+
    +
  • task : Task type contain task data.
  • +
+ + + +## Implementation + +```dart +void fillTask(Task task) { + taskTitleTextController.text = task.title; + taskDescriptionTextController.text = task.description ?? ''; + if (task.deadline != null) { + taskEndDate = + DateTime.fromMicrosecondsSinceEpoch(int.parse(task.deadline!)); + taskEndTime = TimeOfDay.fromDateTime(taskEndDate); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskDescriptionTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskDescriptionTextController.md new file mode 100644 index 000000000..7f032da66 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskDescriptionTextController.md @@ -0,0 +1,32 @@ + + + +# taskDescriptionTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) taskDescriptionTextController + +_final_ + + + + + + +## Implementation + +```dart +final taskDescriptionTextController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndDate.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndDate.md new file mode 100644 index 000000000..696d43408 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndDate.md @@ -0,0 +1,32 @@ + + + +# taskEndDate property + + + + + + + +[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) taskEndDate + +_read / write_ + + + + + + +## Implementation + +```dart +DateTime taskEndDate = DateTime.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndTime.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndTime.md new file mode 100644 index 000000000..3e1250440 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskEndTime.md @@ -0,0 +1,32 @@ + + + +# taskEndTime property + + + + + + + +[TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) taskEndTime + +_read / write_ + + + + + + +## Implementation + +```dart +TimeOfDay taskEndTime = TimeOfDay.now(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskTitleTextController.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskTitleTextController.md new file mode 100644 index 000000000..9936df399 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel/taskTitleTextController.md @@ -0,0 +1,32 @@ + + + +# taskTitleTextController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) taskTitleTextController + +_final_ + + + + + + +## Implementation + +```dart +final taskTitleTextController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/view_model_after_auth_view_models_task_view_models_create_task_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/view_model_after_auth_view_models_task_view_models_create_task_view_model-library.md new file mode 100644 index 000000000..cfbe42c2b --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_create_task_view_model/view_model_after_auth_view_models_task_view_models_create_task_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# create_task_view_model library + + + + + + + + + + + +## Classes + +##### [CreateTaskViewModel](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md) + + + +CreateTaskViewModel class helps to interact with model to serve data +and react to user's input in Create Task view. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md new file mode 100644 index 000000000..688e124ea --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md @@ -0,0 +1,226 @@ + + + +# ExploreTasksViewModel class + + + + + + + + + +

ExploreTasksViewModel class helps to interact with model to serve data +and react to user's input in Explore Task section.

+

Methods include:

+
    +
  • fetchTasks
  • +
  • `fetchTasksByUser
  • +
  • deleteTask
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- ExploreTasksViewModel + + + + + + + + +## Constructors + +[ExploreTasksViewModel](../view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/ExploreTasksViewModel.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [tasks](../view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/tasks.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Task](../models_task_task_model/Task-class.md)> + + + + +_read-only_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [deleteTask](../view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/deleteTask.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) creatorId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function deletes the task for an event. +The function uses deleteTask method of Task Service. + + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [fetchTasks](../view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasks.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function fetch all the task for an event. +The function uses getTasksForEvent method of Task Service. + + + + +##### [fetchTasksByUser](../view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasksByUser.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function fetch tasks created by the current user for an event. +The function uses getTasksByUser method of Task Service. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/ExploreTasksViewModel.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/ExploreTasksViewModel.md new file mode 100644 index 000000000..3d09387b0 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/ExploreTasksViewModel.md @@ -0,0 +1,31 @@ + + + +# ExploreTasksViewModel constructor + + + + + + + +ExploreTasksViewModel() + + + + + +## Implementation + +```dart +ExploreTasksViewModel() { + _taskService.callbackNotifyListeners = () => notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/deleteTask.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/deleteTask.md new file mode 100644 index 000000000..45d4afc88 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/deleteTask.md @@ -0,0 +1,44 @@ + + + +# deleteTask method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> deleteTask +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) taskId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) creatorId) + + + + + +

This function deletes the task for an event. +The function uses deleteTask method of Task Service.

+

params:

+
    +
  • taskId : id of the task need to be deleted.
  • +
  • creatorId : id of the task creator.
  • +
+ + + +## Implementation + +```dart +Future deleteTask(String taskId, String creatorId) async { + await _taskService.deleteTask(taskId, creatorId); + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasks.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasks.md new file mode 100644 index 000000000..fc7f65268 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasks.md @@ -0,0 +1,44 @@ + + + +# fetchTasks method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> fetchTasks +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId) + + + + + +

This function fetch all the task for an event. +The function uses getTasksForEvent method of Task Service.

+

params:

+
    +
  • eventId : id of an event for which tasks need to be fetched.
  • +
+ + + +## Implementation + +```dart +Future fetchTasks(String eventId) async { + setState(ViewState.busy); + await _taskService.getTasksForEvent(eventId); + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasksByUser.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasksByUser.md new file mode 100644 index 000000000..968e5f374 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/fetchTasksByUser.md @@ -0,0 +1,40 @@ + + + +# fetchTasksByUser method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> fetchTasksByUser +() + + + + + +

This function fetch tasks created by the current user for an event. +The function uses getTasksByUser method of Task Service.

+ + + +## Implementation + +```dart +Future fetchTasksByUser() async { + setState(ViewState.busy); + await _taskService.getTasksByUser(); + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/tasks.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/tasks.md new file mode 100644 index 000000000..a04396c29 --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel/tasks.md @@ -0,0 +1,35 @@ + + + +# tasks property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Task](../../models_task_task_model/Task-class.md)> tasks + + + + + + + + +## Implementation + +```dart +List get tasks => _taskService.tasks; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model-library.md b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model-library.md new file mode 100644 index 000000000..bdfdc5fcf --- /dev/null +++ b/talawa-mobile-docs/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/view_model_after_auth_view_models_task_view_models_explore_tasks_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# explore_tasks_view_model library + + + + + + + + + + + +## Classes + +##### [ExploreTasksViewModel](../view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md) + + + +ExploreTasksViewModel class helps to interact with model to serve data +and react to user's input in Explore Task section. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_base_view_model/BaseModel-class.md b/talawa-mobile-docs/view_model_base_view_model/BaseModel-class.md new file mode 100644 index 000000000..873cf71cf --- /dev/null +++ b/talawa-mobile-docs/view_model_base_view_model/BaseModel-class.md @@ -0,0 +1,206 @@ + + + +# BaseModel class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- BaseModel + + + +**Implementers** + +- [AccessScreenViewModel](../view_model_access_request_view_model/AccessScreenViewModel-class.md) +- [AddPostViewModel](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md) +- [AppLanguage](../view_model_lang_view_model/AppLanguage-class.md) +- [AppTheme](../view_model_theme_view_model/AppTheme-class.md) +- [CommentsViewModel](../view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md) +- [CreateEventViewModel](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md) +- [CreateTaskViewModel](../view_model_after_auth_view_models_task_view_models_create_task_view_model/CreateTaskViewModel-class.md) +- [CustomDrawerViewModel](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md) +- [DemoViewModel](../main/DemoViewModel-class.md) +- [DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) +- [EditEventViewModel](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md) +- [EditProfilePageViewModel](../view_model_after_auth_view_models_profile_view_models_edit_profile_view_model/EditProfilePageViewModel-class.md) +- [EventInfoViewModel](../view_model_after_auth_view_models_event_view_models_event_info_view_model/EventInfoViewModel-class.md) +- [ExploreEventsViewModel](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) +- [ExploreTasksViewModel](../view_model_after_auth_view_models_task_view_models_explore_tasks_view_model/ExploreTasksViewModel-class.md) +- [LikeButtonViewModel](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md) +- [LoginViewModel](../view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md) +- [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md) +- [OrganizationFeedViewModel](../view_model_after_auth_view_models_feed_view_models_organization_feed_view_model/OrganizationFeedViewModel-class.md) +- [ProfilePageViewModel](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md) +- [ProgressDialogViewModel](../view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md) +- [SelectContactViewModel](../view_model_after_auth_view_models_chat_view_models_select_contact_view_model/SelectContactViewModel-class.md) +- [SelectOrganizationViewModel](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) +- [SetUrlViewModel](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md) +- [SignupDetailsViewModel](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md) +- [WaitingViewModel](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md) + + + + + +## Constructors + +[BaseModel](../view_model_base_view_model/BaseModel/BaseModel.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-only_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-only_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_base_view_model/BaseModel/BaseModel.md b/talawa-mobile-docs/view_model_base_view_model/BaseModel/BaseModel.md new file mode 100644 index 000000000..679d13ccb --- /dev/null +++ b/talawa-mobile-docs/view_model_base_view_model/BaseModel/BaseModel.md @@ -0,0 +1,24 @@ + + + +# BaseModel constructor + + + + + + + +BaseModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_base_view_model/BaseModel/isBusy.md b/talawa-mobile-docs/view_model_base_view_model/BaseModel/isBusy.md new file mode 100644 index 000000000..e7de222ca --- /dev/null +++ b/talawa-mobile-docs/view_model_base_view_model/BaseModel/isBusy.md @@ -0,0 +1,35 @@ + + + +# isBusy property + + + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isBusy + + + + + + + + +## Implementation + +```dart +bool get isBusy => _state == ViewState.busy; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_base_view_model/BaseModel/setState.md b/talawa-mobile-docs/view_model_base_view_model/BaseModel/setState.md new file mode 100644 index 000000000..a225602b8 --- /dev/null +++ b/talawa-mobile-docs/view_model_base_view_model/BaseModel/setState.md @@ -0,0 +1,37 @@ + + + +# setState method + + + + + + + + +void setState +([ViewState](../../enums_enums/ViewState.md) viewState) + + + + + + + + +## Implementation + +```dart +void setState(ViewState viewState) { + _state = viewState; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_base_view_model/BaseModel/state.md b/talawa-mobile-docs/view_model_base_view_model/BaseModel/state.md new file mode 100644 index 000000000..1c802c49d --- /dev/null +++ b/talawa-mobile-docs/view_model_base_view_model/BaseModel/state.md @@ -0,0 +1,35 @@ + + + +# state property + + + + + + + + + +[ViewState](../../enums_enums/ViewState.md) state + + + + + + + + +## Implementation + +```dart +ViewState get state => _state; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_base_view_model/view_model_base_view_model-library.md b/talawa-mobile-docs/view_model_base_view_model/view_model_base_view_model-library.md new file mode 100644 index 000000000..95dcbc20c --- /dev/null +++ b/talawa-mobile-docs/view_model_base_view_model/view_model_base_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# base_view_model library + + + + + + + + + + + +## Classes + +##### [BaseModel](../view_model_base_view_model/BaseModel-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage-class.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage-class.md new file mode 100644 index 000000000..2927d291d --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage-class.md @@ -0,0 +1,292 @@ + + + +# AppLanguage class + + + + + + + + + +

AppLanguage view model class interact with modal in the context of the App Language. +The class provides methods that set's the language, change the language in the modal.

+

Methods include:

+
    +
  • fetchLocale
  • +
  • changeLanguage
  • +
  • selectLanguagePress
  • +
  • dbLanguageUpdate
  • +
  • appLanguageQuery
  • +
  • userLanguageQuery
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- AppLanguage + + + + + + + + +## Constructors + +[AppLanguage](../view_model_lang_view_model/AppLanguage/AppLanguage.md) ({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest = false}) + + + + +## Properties + +##### [appLocal](../view_model_lang_view_model/AppLanguage/appLocal.md) → [Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) + + + + +_read-only_ + + + +##### [databaseFunctions](../view_model_lang_view_model/AppLanguage/databaseFunctions.md) → [DataBaseMutationFunctions](../services_database_mutation_functions/DataBaseMutationFunctions-class.md) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [isTest](../view_model_lang_view_model/AppLanguage/isTest.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [navigationService](../view_model_lang_view_model/AppLanguage/navigationService.md) → [NavigationService](../services_navigation_service/NavigationService-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [appLanguageQuery](../view_model_lang_view_model/AppLanguage/appLanguageQuery.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function perform graphQL query to check the app language. +The function uses gqlAuthQuery method provided by Database Functions Services. + + + + +##### [changeLanguage](../view_model_lang_view_model/AppLanguage/changeLanguage.md)([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) type) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function change the app default language. + + + + +##### [dbLanguageUpdate](../view_model_lang_view_model/AppLanguage/dbLanguageUpdate.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function updates the Database Language by running the graphQL mutations. + + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [fetchLocale](../view_model_lang_view_model/AppLanguage/fetchLocale.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function fetch the language of the user's app. + + + + +##### [initialize](../view_model_lang_view_model/AppLanguage/initialize.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [selectLanguagePress](../view_model_lang_view_model/AppLanguage/selectLanguagePress.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function navigate user to /appSettingsPage route if the user is authenticated +else navigate to /setUrl route. + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [userLanguageQuery](../view_model_lang_view_model/AppLanguage/userLanguageQuery.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function perform graphQL query to check the user's language in the database. +The function uses gqlAuthQuery method provided by Database Functions Services. + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/AppLanguage.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/AppLanguage.md new file mode 100644 index 000000000..893a5b3d7 --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/AppLanguage.md @@ -0,0 +1,29 @@ + + + +# AppLanguage constructor + + + + + + + +AppLanguage({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest = false}) + + + + + +## Implementation + +```dart +AppLanguage({this.isTest = false}); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/appLanguageQuery.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/appLanguageQuery.md new file mode 100644 index 000000000..5720f3225 --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/appLanguageQuery.md @@ -0,0 +1,42 @@ + + + +# appLanguageQuery method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> appLanguageQuery +() + + + + + +

This function perform graphQL query to check the app language. +The function uses gqlAuthQuery method provided by Database Functions Services.

+ + + +## Implementation + +```dart +Future appLanguageQuery() async { + try { + await databaseFunctions.gqlAuthQuery(queries.userLanguage()); + } catch (e) { + print(e); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/appLocal.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/appLocal.md new file mode 100644 index 000000000..6dfb7e022 --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/appLocal.md @@ -0,0 +1,35 @@ + + + +# appLocal property + + + + + + + + + +[Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) appLocal + + + + + + + + +## Implementation + +```dart +Locale get appLocal => _appLocale; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/changeLanguage.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/changeLanguage.md new file mode 100644 index 000000000..623634d01 --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/changeLanguage.md @@ -0,0 +1,94 @@ + + + +# changeLanguage method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> changeLanguage +([Locale](https://api.flutter.dev/flutter/dart-ui/Locale-class.html) type) + + + + + +

This function change the app default language.

+

params:

+
    +
  • type : Locale type, the language need to be updated with.
  • +
+ + + +## Implementation + +```dart +Future changeLanguage(Locale type) async { + // if the app language is of same [type]. + if (_appLocale == type) { + return; + } + + if (isTest) { + _appLocale = type; + } else { + final prefs = await SharedPreferences.getInstance(); + if (type == const Locale("es")) { + //If selected language is spanish + _appLocale = const Locale("es"); + await prefs.setString('language_code', 'es'); + await prefs.setString('countryCode', 'ES'); + } else if (type == const Locale("fr")) { + //If selected language is french + _appLocale = const Locale("fr"); + await prefs.setString('language_code', 'fr'); + await prefs.setString('countryCode', 'FR'); + } else if (type == const Locale("hi")) { + //If selected language is hindi + _appLocale = const Locale("hi"); + await prefs.setString('language_code', 'hi'); + await prefs.setString('countryCode', 'IN'); + } else if (type == const Locale("zh")) { + //If selected language is Chinese + _appLocale = const Locale("zh"); + await prefs.setString('language_code', 'zh'); + await prefs.setString('countryCode', 'CN'); + } else if (type == const Locale("de")) { + //If selected language is Chinese + _appLocale = const Locale("de"); + await prefs.setString('language_code', 'de'); + await prefs.setString('countryCode', 'GE'); + } else if (type == const Locale("ja")) { + //If selected language is Chinese + _appLocale = const Locale("ja"); + await prefs.setString('language_code', 'ja'); + await prefs.setString('countryCode', 'JP'); + } else if (type == const Locale("pt")) { + //If selected language is Chinese + _appLocale = const Locale("pt"); + await prefs.setString('language_code', 'pt'); + await prefs.setString('countryCode', 'PT'); + } else { + //If selected language is english + _appLocale = const Locale("en"); + await prefs.setString('language_code', 'en'); + await prefs.setString('countryCode', 'US'); + } + } + + /// notifying the consumers + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/databaseFunctions.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/databaseFunctions.md new file mode 100644 index 000000000..3d86d3cd6 --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/databaseFunctions.md @@ -0,0 +1,32 @@ + + + +# databaseFunctions property + + + + + + + +[DataBaseMutationFunctions](../../services_database_mutation_functions/DataBaseMutationFunctions-class.md) databaseFunctions + +_final_ + + + + + + +## Implementation + +```dart +final databaseFunctions = locator(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/dbLanguageUpdate.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/dbLanguageUpdate.md new file mode 100644 index 000000000..82e5677ef --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/dbLanguageUpdate.md @@ -0,0 +1,43 @@ + + + +# dbLanguageUpdate method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> dbLanguageUpdate +() + + + + + +

This function updates the Database Language by running the graphQL mutations.

+ + + +## Implementation + +```dart +Future dbLanguageUpdate() async { + try { + await databaseFunctions + .gqlAuthMutation(queries.updateLanguage(_appLocale.languageCode)); + print('Language Updated in Database'); + } catch (e) { + print(e); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/fetchLocale.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/fetchLocale.md new file mode 100644 index 000000000..6958ea213 --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/fetchLocale.md @@ -0,0 +1,41 @@ + + + +# fetchLocale method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> fetchLocale +() + + + + + +

This function fetch the language of the user's app.

+ + + +## Implementation + +```dart +Future fetchLocale() async { + final prefs = await SharedPreferences.getInstance(); + final String langCode = prefs.getString('language_code') ?? 'en'; + _appLocale = Locale(langCode); + + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/initialize.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/initialize.md new file mode 100644 index 000000000..8892ae6b8 --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/initialize.md @@ -0,0 +1,37 @@ + + + +# initialize method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> initialize +() + + + + + + + + +## Implementation + +```dart +Future initialize() async { + _appLocale = const Locale('en'); + await fetchLocale(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/isTest.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/isTest.md new file mode 100644 index 000000000..e6e920cda --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/isTest.md @@ -0,0 +1,32 @@ + + + +# isTest property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isTest + +_final_ + + + + + + +## Implementation + +```dart +final bool isTest; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/navigationService.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/navigationService.md new file mode 100644 index 000000000..e7dcec48a --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/navigationService.md @@ -0,0 +1,32 @@ + + + +# navigationService property + + + + + + + +[NavigationService](../../services_navigation_service/NavigationService-class.md) navigationService + +_final_ + + + + + + +## Implementation + +```dart +final navigationService = locator(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/selectLanguagePress.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/selectLanguagePress.md new file mode 100644 index 000000000..22b21ec3f --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/selectLanguagePress.md @@ -0,0 +1,44 @@ + + + +# selectLanguagePress method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> selectLanguagePress +() + + + + + +

This function navigate user to /appSettingsPage route if the user is authenticated +else navigate to /setUrl route.

+ + + +## Implementation + +```dart +Future selectLanguagePress() async { + final bool userLoggedIn = await userConfig.userLoggedIn(); + if (userLoggedIn) { + dbLanguageUpdate(); + navigationService.popAndPushScreen('/appSettingsPage', arguments: ''); + } else { + navigationService.pushScreen('/setUrl', arguments: ''); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/userLanguageQuery.md b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/userLanguageQuery.md new file mode 100644 index 000000000..2a4c097b7 --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/AppLanguage/userLanguageQuery.md @@ -0,0 +1,46 @@ + + + +# userLanguageQuery method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> userLanguageQuery +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) userId) + + + + + +

This function perform graphQL query to check the user's language in the database. +The function uses gqlAuthQuery method provided by Database Functions Services.

+

params:

+
    +
  • userId : user for which language need to be fetch.
  • +
+ + + +## Implementation + +```dart +Future userLanguageQuery(String userId) async { + try { + await databaseFunctions.gqlAuthQuery(queries.newUserLanguage(userId)); + } catch (e) { + print(e); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_lang_view_model/view_model_lang_view_model-library.md b/talawa-mobile-docs/view_model_lang_view_model/view_model_lang_view_model-library.md new file mode 100644 index 000000000..6ab708dcf --- /dev/null +++ b/talawa-mobile-docs/view_model_lang_view_model/view_model_lang_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# lang_view_model library + + + + + + + + + + + +## Classes + +##### [AppLanguage](../view_model_lang_view_model/AppLanguage-class.md) + + + +AppLanguage view model class interact with modal in the context of the App Language. +The class provides methods that set's the language, change the language in the modal. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel-class.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel-class.md new file mode 100644 index 000000000..6935ca705 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel-class.md @@ -0,0 +1,616 @@ + + + +# MainScreenViewModel class + + + + + + + + + +

MainScreenViewModel class provide methods to interact with the modal to serve data in user's action in Main Screen Views.

+

The functions in this class are +mainly in the context of Tutorials for different componenets of the App.

+

Functions include:

+
    +
  • showTutorial
  • +
  • showHome
  • +
  • tourEventTargets
  • +
  • tourAddPost
  • +
  • tourChat
  • +
  • tourProfile
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- MainScreenViewModel + + + + + + + + +## Constructors + +[MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel/MainScreenViewModel.md) () + + + + +## Properties + +##### [context](../view_model_main_screen_view_model/MainScreenViewModel/context.md) ↔ [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) + + + +context consist of parent info. +_read / write_ + + + +##### [currentPageIndex](../view_model_main_screen_view_model/MainScreenViewModel/currentPageIndex.md) ↔ [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +var for current page in index. +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [keyBNChat](../view_model_main_screen_view_model/MainScreenViewModel/keyBNChat.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keyBNEvents](../view_model_main_screen_view_model/MainScreenViewModel/keyBNEvents.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keyBNHome](../view_model_main_screen_view_model/MainScreenViewModel/keyBNHome.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keyBNPost](../view_model_main_screen_view_model/MainScreenViewModel/keyBNPost.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keyBNProfile](../view_model_main_screen_view_model/MainScreenViewModel/keyBNProfile.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySEAdd](../view_model_main_screen_view_model/MainScreenViewModel/keySEAdd.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySECard](../view_model_main_screen_view_model/MainScreenViewModel/keySECard.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySECategoryMenu](../view_model_main_screen_view_model/MainScreenViewModel/keySECategoryMenu.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySEDateFilter](../view_model_main_screen_view_model/MainScreenViewModel/keySEDateFilter.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySHMenuIcon](../view_model_main_screen_view_model/MainScreenViewModel/keySHMenuIcon.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySHOrgName](../view_model_main_screen_view_model/MainScreenViewModel/keySHOrgName.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySHPinnedPost](../view_model_main_screen_view_model/MainScreenViewModel/keySHPinnedPost.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySHPost](../view_model_main_screen_view_model/MainScreenViewModel/keySHPost.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySPAppSetting](../view_model_main_screen_view_model/MainScreenViewModel/keySPAppSetting.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySPDonateUs](../view_model_main_screen_view_model/MainScreenViewModel/keySPDonateUs.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySPEditProfile](../view_model_main_screen_view_model/MainScreenViewModel/keySPEditProfile.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySPHelp](../view_model_main_screen_view_model/MainScreenViewModel/keySPHelp.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySPInvite](../view_model_main_screen_view_model/MainScreenViewModel/keySPInvite.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySPLogout](../view_model_main_screen_view_model/MainScreenViewModel/keySPLogout.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keySPPalisadoes](../view_model_main_screen_view_model/MainScreenViewModel/keySPPalisadoes.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [navBarItems](../view_model_main_screen_view_model/MainScreenViewModel/navBarItems.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[BottomNavigationBarItem](https://api.flutter.dev/flutter/widgets/BottomNavigationBarItem-class.html)> + + + +Actual BottomNavigationBarItems that show up on the screen. +_read / write_ + + + +##### [pages](../view_model_main_screen_view_model/MainScreenViewModel/pages.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html)> + + + +Contains the Widgets to be rendered for corresponding navbar items. +_read / write_ + + + +##### [pluginList](../view_model_main_screen_view_model/MainScreenViewModel/pluginList.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html) + + + +list of all the pluginList. +_read / write_ + + + +##### [pluginPrototypeData](../view_model_main_screen_view_model/MainScreenViewModel/pluginPrototypeData.md) ↔ [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html) + + + +Maps the feature names with their proper Icon and Page. +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [showAppTour](../view_model_main_screen_view_model/MainScreenViewModel/showAppTour.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +bool to determine if we wanna show the apptour. +_read / write_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [targets](../view_model_main_screen_view_model/MainScreenViewModel/targets.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html)> + + + +array of target. +_final_ + + + +##### [tourComplete](../view_model_main_screen_view_model/MainScreenViewModel/tourComplete.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +bool to determine if apptour is complete. +_read / write_ + + + +##### [tourSkipped](../view_model_main_screen_view_model/MainScreenViewModel/tourSkipped.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +bool to determine if apptour is skipped. +_read / write_ + + + +##### [tutorialCoachMark](../view_model_main_screen_view_model/MainScreenViewModel/tutorialCoachMark.md) ↔ [TutorialCoachMark](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TutorialCoachMark-class.html) + + + +tutorialCoachMark consist of coach used to give tutorial. +_read / write_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [fetchAndAddPlugins](../view_model_main_screen_view_model/MainScreenViewModel/fetchAndAddPlugins.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) void + + + +Dynamically adds BottomNavigationBarItems in BottomNavigationBar. + + + + +##### [focusTarget](../view_model_main_screen_view_model/MainScreenViewModel/focusTarget.md)([GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> key, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) keyName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isCircle = false, [ContentAlign](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/ContentAlign.html) align = ContentAlign.bottom, [CrossAxisAlignment](https://api.flutter.dev/flutter/rendering/CrossAxisAlignment.html) crossAlign = CrossAxisAlignment.start, [Alignment](https://api.flutter.dev/flutter/painting/Alignment-class.html) skipAlignment = Alignment.topRight, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? next, [CrossAxisAlignment](https://api.flutter.dev/flutter/rendering/CrossAxisAlignment.html) nextCrossAlign = CrossAxisAlignment.end, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isEnd = false}) [TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html) + + + +This returns a widget for a step in a tutorial. + + + + +##### [initialise](../view_model_main_screen_view_model/MainScreenViewModel/initialise.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) ctx, {required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) fromSignUp, required [int](https://api.flutter.dev/flutter/dart-core/int-class.html) mainScreenIndex}) void + + + +Initalizing function. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [onTabTapped](../view_model_main_screen_view_model/MainScreenViewModel/onTabTapped.md)([int](https://api.flutter.dev/flutter/dart-core/int-class.html) index) void + + + +Handles click on BottomNavigationBarItem. + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [showHome](../view_model_main_screen_view_model/MainScreenViewModel/showHome.md)([TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html) clickedTarget) void + + + +This function shows the Home screen. + + + + +##### [showTutorial](../view_model_main_screen_view_model/MainScreenViewModel/showTutorial.md)({required dynamic onClickTarget([TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html)), required dynamic onFinish()}) void + + + +This function show tutorial to user. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [tourAddPost](../view_model_main_screen_view_model/MainScreenViewModel/tourAddPost.md)() void + + + +This function show the tutorial to add Post in the organization. + + + + +##### [tourChat](../view_model_main_screen_view_model/MainScreenViewModel/tourChat.md)() void + + + +This function show the tour of chats. + + + + +##### [tourEventTargets](../view_model_main_screen_view_model/MainScreenViewModel/tourEventTargets.md)() void + + + +This function show the tutorial for Events. + + + + +##### [tourHomeTargets](../view_model_main_screen_view_model/MainScreenViewModel/tourHomeTargets.md)() void + + + +this functions starts the tour and info to be displayed is mentioned in this functions. + + + + +##### [tourProfile](../view_model_main_screen_view_model/MainScreenViewModel/tourProfile.md)() void + + + +This function show the tutorial for the profile page. + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + +## Static Properties + +##### [keyDrawerCurOrg](../view_model_main_screen_view_model/MainScreenViewModel/keyDrawerCurOrg.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keyDrawerJoinOrg](../view_model_main_screen_view_model/MainScreenViewModel/keyDrawerJoinOrg.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keyDrawerLeaveCurrentOrg](../view_model_main_screen_view_model/MainScreenViewModel/keyDrawerLeaveCurrentOrg.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [keyDrawerSwitchableOrg](../view_model_main_screen_view_model/MainScreenViewModel/keyDrawerSwitchableOrg.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +static variables. +_final_ + + + +##### [scaffoldKey](../view_model_main_screen_view_model/MainScreenViewModel/scaffoldKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[ScaffoldState](https://api.flutter.dev/flutter/material/ScaffoldState-class.html)> + + + +static variables. +_final_ + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/MainScreenViewModel.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/MainScreenViewModel.md new file mode 100644 index 000000000..0351920dc --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/MainScreenViewModel.md @@ -0,0 +1,24 @@ + + + +# MainScreenViewModel constructor + + + + + + + +MainScreenViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/context.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/context.md new file mode 100644 index 000000000..e4087fcab --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/context.md @@ -0,0 +1,33 @@ + + + +# context property + + + + + + + +[BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context + +_read / write_ + + + +

context consist of parent info.

+ + + +## Implementation + +```dart +late BuildContext context; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/currentPageIndex.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/currentPageIndex.md new file mode 100644 index 000000000..93f295260 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/currentPageIndex.md @@ -0,0 +1,33 @@ + + + +# currentPageIndex property + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) currentPageIndex + +_read / write_ + + + +

var for current page in index.

+ + + +## Implementation + +```dart +int currentPageIndex = 0; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/fetchAndAddPlugins.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/fetchAndAddPlugins.md new file mode 100644 index 000000000..9e2ca0105 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/fetchAndAddPlugins.md @@ -0,0 +1,142 @@ + + + +# fetchAndAddPlugins method + + + + + + + + +void fetchAndAddPlugins +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + +

Dynamically adds BottomNavigationBarItems in BottomNavigationBar.

+

by mapping over the data received from the server.

+

params:

+
    +
  • context: its the same context you use everywhere in the flutter framework refer flutter docs for more info.
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void fetchAndAddPlugins( + BuildContext context, +) { + navBarItems = [ + BottomNavigationBarItem( + icon: Icon( + Icons.home, + key: keyBNHome, + ), + label: AppLocalizations.of(context)!.strictTranslate('Home'), + ), + BottomNavigationBarItem( + icon: Icon( + Icons.event_note, + key: keyBNEvents, + ), + label: AppLocalizations.of(context)!.strictTranslate('Events'), + ), + BottomNavigationBarItem( + icon: Icon( + Icons.add_box, + key: keyBNPost, + ), + label: AppLocalizations.of(context)!.strictTranslate('Add'), + ), + BottomNavigationBarItem( + icon: Icon( + Icons.chat_outlined, + key: keyBNChat, + ), + label: AppLocalizations.of(context)!.strictTranslate('Chat'), + ), + BottomNavigationBarItem( + icon: Icon( + Icons.account_circle, + key: keyBNProfile, + ), + label: AppLocalizations.of(context)!.strictTranslate('Profile'), + ) + ]; + + pages = [ + OrganizationFeed( + key: const Key("HomeView"), + homeModel: this, + ), + ExploreEvents( + key: const Key('ExploreEvents'), + homeModel: this, + ), + AddPost( + key: const Key('AddPost'), + drawerKey: MainScreenViewModel.scaffoldKey, + ), + const ChatPage( + key: Key('Chats'), + ), + ProfilePage( + key: keySPEditProfile, + homeModel: this, + ), + ]; + + pluginList = (Hive.box('pluginBox').get('plugins') ?? []) as List; + + pluginList.forEach((plugin) { + if (pluginPrototypeData.containsKey( + (plugin as Map)["pluginName"] as String, + ) && + plugin["pluginInstallStatus"] as bool) { + navBarItems.add( + BottomNavigationBarItem( + icon: Icon( + (pluginPrototypeData[plugin["pluginName"]] + as Map)["icon"] as IconData, + ), + label: AppLocalizations.of(context)!.strictTranslate( + plugin["pluginName"] as String, + ), + ), + ); + pages.add( + (pluginPrototypeData[plugin["pluginName"]] + as Map)["class"] as StatelessWidget, + ); + } + }); + + /// Causes the app check the plugins updates in every 300 sec + /// + /// updated and re-render the navbar + Timer.periodic(const Duration(seconds: 300), (timer) { + FetchPluginList(); + final newPluginList = + (Hive.box('pluginBox').get('plugins') ?? []) as List; + + if (listEquals(pluginList, newPluginList)) { + notifyListeners(); + } + }); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/focusTarget.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/focusTarget.md new file mode 100644 index 000000000..0e1e09f12 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/focusTarget.md @@ -0,0 +1,124 @@ + + + +# focusTarget method + + + + + + + + +[TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html) focusTarget +([GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> key, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) keyName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) description, {[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isCircle = false, [ContentAlign](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/ContentAlign.html) align = ContentAlign.bottom, [CrossAxisAlignment](https://api.flutter.dev/flutter/rendering/CrossAxisAlignment.html) crossAlign = CrossAxisAlignment.start, [Alignment](https://api.flutter.dev/flutter/painting/Alignment-class.html) skipAlignment = Alignment.topRight, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? next, [CrossAxisAlignment](https://api.flutter.dev/flutter/rendering/CrossAxisAlignment.html) nextCrossAlign = CrossAxisAlignment.end, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isEnd = false}) + + + + + +

This returns a widget for a step in a tutorial.

+

params:

+
    +
  • key: key of type GlobalKey.
  • +
  • keyName: key where the widget shows.
  • +
  • description: description of the step.
  • +
  • isCircle: bool to specify if circle
  • +
  • align: align of type ContentAlign to align button.
  • +
  • crossAlign: Cross align axes
  • +
  • skipAlignment: to give alignment of skip option
  • +
  • next: Functiontype, this show the next step orkey` to show the tour of.
  • +
  • nextCrossAlign: nextCrossAlign to give alignment of next option
  • +
  • isEnd: true if last step of the tour.
  • +
+

returns:

+
    +
  • TargetFocus: This return widget foa a step in a tut
  • +
+ + + +## Implementation + +```dart +TargetFocus focusTarget( + GlobalKey key, + String keyName, + String description, { + bool isCircle = false, + ContentAlign align = ContentAlign.bottom, + CrossAxisAlignment crossAlign = CrossAxisAlignment.start, + Alignment skipAlignment = Alignment.topRight, + Function? next, + CrossAxisAlignment nextCrossAlign = CrossAxisAlignment.end, + bool isEnd = false, +}) { + return TargetFocus( + enableOverlayTab: true, + color: Colors.transparent, + identify: keyName, + keyTarget: key, + alignSkip: skipAlignment, + shape: isCircle ? ShapeLightFocus.Circle : ShapeLightFocus.RRect, + contents: [ + TargetContent( + align: align, + builder: (context, controller) { + return Container( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: crossAlign, + children: [ + Text( + description, + style: TextStyle( + color: Theme.of(context).colorScheme.background, + fontSize: 20, + ), + ), + ], + ), + ); + }, + ), + TargetContent( + align: ContentAlign.custom, + customPosition: CustomTargetContentPosition( + bottom: SizeConfig.screenHeight! * 0.025, + ), + builder: (context, controller) { + return GestureDetector( + onTap: () { + if (next != null) { + // ignore: avoid_dynamic_calls + next(); + } + tutorialCoachMark.next(); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: nextCrossAlign, + children: [ + Text( + isEnd ? 'COMPLETE' : 'NEXT', + style: TextStyle( + color: Theme.of(context).colorScheme.background, + fontSize: 20, + ), + ), + ], + ), + ); + }, + ), + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/initialise.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/initialise.md new file mode 100644 index 000000000..6f3695326 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/initialise.md @@ -0,0 +1,85 @@ + + + +# initialise method + + + + + + + + +void initialise +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) ctx, {required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) fromSignUp, required [int](https://api.flutter.dev/flutter/dart-core/int-class.html) mainScreenIndex}) + + + + + +

Initalizing function.

+

params:

+
    +
  • ctx: BuildContext, contain parent info
  • +
  • fromSignUp: Bool to find user entry
  • +
  • mainScreenIndex: Index to find tab on mainScreen
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void initialise( + BuildContext ctx, { + required bool fromSignUp, + required int mainScreenIndex, +}) { + currentPageIndex = mainScreenIndex; + showAppTour = fromSignUp; + + pluginPrototypeData = { + "Donation": { + "icon": Icons.attach_money_outlined, + "page": const ChangeThemeTile(), + } + }; + + notifyListeners(); + if (!showAppTour) { + tourComplete = true; + tourSkipped = false; + } else { + Future.delayed( + const Duration(seconds: 1), + () => navigationService.pushDialog( + CustomAlertDialog( + dialogTitle: 'App Tour', + dialogSubTitle: 'Start app tour to know talawa functioning', + successText: 'Start', + secondaryButtonText: 'Skip', + success: () { + context = ctx; + navigationService.pop(); + tourHomeTargets(); + }, + secondaryButtonTap: () { + tourComplete = false; + tourSkipped = true; + notifyListeners(); + }, + ), + ), + ); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNChat.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNChat.md new file mode 100644 index 000000000..b879914b1 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNChat.md @@ -0,0 +1,33 @@ + + + +# keyBNChat property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyBNChat + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keyBNChat = GlobalKey(debugLabel: "ChatTab"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNEvents.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNEvents.md new file mode 100644 index 000000000..e30a54fde --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNEvents.md @@ -0,0 +1,33 @@ + + + +# keyBNEvents property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyBNEvents + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keyBNEvents = GlobalKey(debugLabel: "EventTab"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNHome.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNHome.md new file mode 100644 index 000000000..769994405 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNHome.md @@ -0,0 +1,33 @@ + + + +# keyBNHome property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyBNHome + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keyBNHome = GlobalKey(debugLabel: "HomeTab"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNPost.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNPost.md new file mode 100644 index 000000000..fffa66901 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNPost.md @@ -0,0 +1,33 @@ + + + +# keyBNPost property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyBNPost + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keyBNPost = GlobalKey(debugLabel: "PostTab"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNProfile.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNProfile.md new file mode 100644 index 000000000..911ddc8b6 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyBNProfile.md @@ -0,0 +1,33 @@ + + + +# keyBNProfile property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyBNProfile + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keyBNProfile = GlobalKey(debugLabel: "ProfileTab"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerCurOrg.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerCurOrg.md new file mode 100644 index 000000000..e719516e7 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerCurOrg.md @@ -0,0 +1,34 @@ + + + +# keyDrawerCurOrg property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyDrawerCurOrg + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +static final GlobalKey keyDrawerCurOrg = + GlobalKey(debugLabel: "DrawerCurrentOrg"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerJoinOrg.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerJoinOrg.md new file mode 100644 index 000000000..384fecced --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerJoinOrg.md @@ -0,0 +1,34 @@ + + + +# keyDrawerJoinOrg property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyDrawerJoinOrg + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +static final GlobalKey keyDrawerJoinOrg = + GlobalKey(debugLabel: "DrawerJoinOrg"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerLeaveCurrentOrg.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerLeaveCurrentOrg.md new file mode 100644 index 000000000..1c4a7087d --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerLeaveCurrentOrg.md @@ -0,0 +1,34 @@ + + + +# keyDrawerLeaveCurrentOrg property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyDrawerLeaveCurrentOrg + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +static final GlobalKey keyDrawerLeaveCurrentOrg = + GlobalKey(debugLabel: "DrawerLeaveCurrentOr"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerSwitchableOrg.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerSwitchableOrg.md new file mode 100644 index 000000000..decbb6072 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keyDrawerSwitchableOrg.md @@ -0,0 +1,34 @@ + + + +# keyDrawerSwitchableOrg property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keyDrawerSwitchableOrg + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +static final GlobalKey keyDrawerSwitchableOrg = + GlobalKey(debugLabel: "DrawerSwitchableOrg"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySEAdd.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySEAdd.md new file mode 100644 index 000000000..0644acd2d --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySEAdd.md @@ -0,0 +1,33 @@ + + + +# keySEAdd property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySEAdd + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySEAdd = GlobalKey(debugLabel: "EventScreenAdd"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySECard.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySECard.md new file mode 100644 index 000000000..52a9e67ab --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySECard.md @@ -0,0 +1,33 @@ + + + +# keySECard property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySECard + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySECard = GlobalKey(debugLabel: "EventScreenCard"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySECategoryMenu.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySECategoryMenu.md new file mode 100644 index 000000000..729b2b95e --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySECategoryMenu.md @@ -0,0 +1,34 @@ + + + +# keySECategoryMenu property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySECategoryMenu + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySECategoryMenu = + GlobalKey(debugLabel: "EventScreenCategory"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySEDateFilter.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySEDateFilter.md new file mode 100644 index 000000000..f2d5f5e1d --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySEDateFilter.md @@ -0,0 +1,34 @@ + + + +# keySEDateFilter property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySEDateFilter + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySEDateFilter = + GlobalKey(debugLabel: "EventScreenDateFilter"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHMenuIcon.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHMenuIcon.md new file mode 100644 index 000000000..89c78447f --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHMenuIcon.md @@ -0,0 +1,33 @@ + + + +# keySHMenuIcon property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySHMenuIcon + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySHMenuIcon = GlobalKey(debugLabel: "HomeScreenMenuIcon"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHOrgName.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHOrgName.md new file mode 100644 index 000000000..2960a23f9 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHOrgName.md @@ -0,0 +1,33 @@ + + + +# keySHOrgName property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySHOrgName + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySHOrgName = GlobalKey(debugLabel: "HomeScreenOrgName"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHPinnedPost.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHPinnedPost.md new file mode 100644 index 000000000..3afe39943 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHPinnedPost.md @@ -0,0 +1,34 @@ + + + +# keySHPinnedPost property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySHPinnedPost + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySHPinnedPost = + GlobalKey(debugLabel: "HomeScreenPinnedPost"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHPost.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHPost.md new file mode 100644 index 000000000..1dcf20665 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySHPost.md @@ -0,0 +1,33 @@ + + + +# keySHPost property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySHPost + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySHPost = GlobalKey(debugLabel: "HomeScreenPost"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPAppSetting.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPAppSetting.md new file mode 100644 index 000000000..fec002077 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPAppSetting.md @@ -0,0 +1,34 @@ + + + +# keySPAppSetting property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySPAppSetting + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySPAppSetting = + GlobalKey(debugLabel: "ProfileScreenAppSetting"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPDonateUs.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPDonateUs.md new file mode 100644 index 000000000..c912d760f --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPDonateUs.md @@ -0,0 +1,34 @@ + + + +# keySPDonateUs property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySPDonateUs + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySPDonateUs = + GlobalKey(debugLabel: "ProfileScreenDonateUs"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPEditProfile.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPEditProfile.md new file mode 100644 index 000000000..9d406c2f9 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPEditProfile.md @@ -0,0 +1,33 @@ + + + +# keySPEditProfile property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySPEditProfile + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySPEditProfile = GlobalKey(debugLabel: "ProfileScreenEdit"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPHelp.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPHelp.md new file mode 100644 index 000000000..f1e340f21 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPHelp.md @@ -0,0 +1,33 @@ + + + +# keySPHelp property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySPHelp + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySPHelp = GlobalKey(debugLabel: "ProfileScreenHelp"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPInvite.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPInvite.md new file mode 100644 index 000000000..8bda57f92 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPInvite.md @@ -0,0 +1,33 @@ + + + +# keySPInvite property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySPInvite + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySPInvite = GlobalKey(debugLabel: "ProfileScreenInvite"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPLogout.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPLogout.md new file mode 100644 index 000000000..418965242 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPLogout.md @@ -0,0 +1,33 @@ + + + +# keySPLogout property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySPLogout + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySPLogout = GlobalKey(debugLabel: "ProfileScreenLogout"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPPalisadoes.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPPalisadoes.md new file mode 100644 index 000000000..71ef98a27 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/keySPPalisadoes.md @@ -0,0 +1,34 @@ + + + +# keySPPalisadoes property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> keySPPalisadoes + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +final GlobalKey keySPPalisadoes = + GlobalKey(debugLabel: "ProfileScreenPalisadoes"); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/navBarItems.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/navBarItems.md new file mode 100644 index 000000000..48e1b405b --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/navBarItems.md @@ -0,0 +1,33 @@ + + + +# navBarItems property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[BottomNavigationBarItem](https://api.flutter.dev/flutter/widgets/BottomNavigationBarItem-class.html)> navBarItems + +_read / write_ + + + +

Actual BottomNavigationBarItems that show up on the screen.

+ + + +## Implementation + +```dart +List navBarItems = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/onTabTapped.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/onTabTapped.md new file mode 100644 index 000000000..7bae5460f --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/onTabTapped.md @@ -0,0 +1,44 @@ + + + +# onTabTapped method + + + + + + + + +void onTabTapped +([int](https://api.flutter.dev/flutter/dart-core/int-class.html) index) + + + + + +

Handles click on BottomNavigationBarItem.

+

params:

+
    +
  • index: it is track of current page index.
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void onTabTapped(int index) { + currentPageIndex = index; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pages.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pages.md new file mode 100644 index 000000000..d4bc8e82f --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pages.md @@ -0,0 +1,34 @@ + + + +# pages property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html)> pages + +_read / write_ + + + +

Contains the Widgets to be rendered for corresponding navbar items.

+

Features that should be implemented as plugins should be kept here.

+ + + +## Implementation + +```dart +List pages = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pluginList.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pluginList.md new file mode 100644 index 000000000..8b7b6fca1 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pluginList.md @@ -0,0 +1,33 @@ + + + +# pluginList property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html) pluginList + +_read / write_ + + + +

list of all the pluginList.

+ + + +## Implementation + +```dart +List pluginList = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pluginPrototypeData.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pluginPrototypeData.md new file mode 100644 index 000000000..3974228ed --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/pluginPrototypeData.md @@ -0,0 +1,37 @@ + + + +# pluginPrototypeData property + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html) pluginPrototypeData + +_read / write_ + + + +

Maps the feature names with their proper Icon and Page.

+

icon contains the IconData corresponding to plugin's icon. +page contains the corresponding page to be displayed. +Name of the feature provided by the admin must exactly match with the. +name stored here.

+ + + +## Implementation + +```dart +Map pluginPrototypeData = {}; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/scaffoldKey.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/scaffoldKey.md new file mode 100644 index 000000000..e72672b7e --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/scaffoldKey.md @@ -0,0 +1,34 @@ + + + +# scaffoldKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[ScaffoldState](https://api.flutter.dev/flutter/material/ScaffoldState-class.html)> scaffoldKey + +_final_ + + + +

static variables.

+ + + +## Implementation + +```dart +static final GlobalKey scaffoldKey = + GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showAppTour.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showAppTour.md new file mode 100644 index 000000000..a1d5c5f11 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showAppTour.md @@ -0,0 +1,33 @@ + + + +# showAppTour property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showAppTour + +_read / write_ + + + +

bool to determine if we wanna show the apptour.

+ + + +## Implementation + +```dart +late bool showAppTour; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showHome.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showHome.md new file mode 100644 index 000000000..b91cffd68 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showHome.md @@ -0,0 +1,49 @@ + + + +# showHome method + + + + + + + + +void showHome +([TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html) clickedTarget) + + + + + +

This function shows the Home screen.

+

params:

+
    +
  • clickedTarget: object to identify clickedTarget.
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void showHome(TargetFocus clickedTarget) { + switch (clickedTarget.identify) { + case "keySHMenuIcon": + scaffoldKey.currentState!.openDrawer(); + break; + case "keyDrawerLeaveCurrentOrg": + navigationService.pop(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showTutorial.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showTutorial.md new file mode 100644 index 000000000..010e415b6 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/showTutorial.md @@ -0,0 +1,69 @@ + + + +# showTutorial method + + + + + + + + +void showTutorial +({required dynamic onClickTarget([TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html)), required dynamic onFinish()}) + + + + + +

This function show tutorial to user.

+

params:

+
    +
  • onClickTarget: Its a function which is required to run desired tasks on click.
  • +
  • onFinish: Its a function which is required to run desired tasks on finish
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void showTutorial({ + required dynamic Function(TargetFocus) onClickTarget, + required dynamic Function() onFinish, +}) { + tutorialCoachMark = TutorialCoachMark( + targets: targets, + colorShadow: Theme.of(context).colorScheme.secondaryContainer, + textSkip: "SKIP", + textStyleSkip: TextStyle( + color: Theme.of(context).colorScheme.background, + fontSize: 20, + ), + paddingFocus: 10, + opacityShadow: 1.0, + onFinish: onFinish, + onClickTarget: onClickTarget, + onSkip: () { + if (scaffoldKey.currentState!.isDrawerOpen) { + navigationService.pop(); + } + tourSkipped = true; + onTabTapped(0); + }, + onClickOverlay: (target) { + onClickTarget(target); + }, + )..show(context: context); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/targets.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/targets.md new file mode 100644 index 000000000..1a70dc391 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/targets.md @@ -0,0 +1,33 @@ + + + +# targets property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html)> targets + +_final_ + + + +

array of target.

+ + + +## Implementation + +```dart +final List targets = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourAddPost.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourAddPost.md new file mode 100644 index 000000000..aff76a556 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourAddPost.md @@ -0,0 +1,59 @@ + + + +# tourAddPost method + + + + + + + + +void tourAddPost +() + + + + + +

This function show the tutorial to add Post in the organization.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void tourAddPost() { + targets.clear(); + targets.add( + focusTarget( + keyBNPost, + 'keyBNPost', + 'This is the Create post tab here you can add post to the current selected organization', + isCircle: true, + align: ContentAlign.top, + ), + ); + showTutorial( + onFinish: () { + onTabTapped(currentPageIndex + 1); + if (!tourComplete && !tourSkipped) { + tourChat(); + } + }, + onClickTarget: (TargetFocus a) {}, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourChat.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourChat.md new file mode 100644 index 000000000..9386279f5 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourChat.md @@ -0,0 +1,59 @@ + + + +# tourChat method + + + + + + + + +void tourChat +() + + + + + +

This function show the tour of chats.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void tourChat() { + targets.clear(); + targets.add( + focusTarget( + keyBNChat, + 'keyBNChat', + 'This is the Chat tab here you can see all your messages of the current selected organization', + isCircle: true, + align: ContentAlign.top, + ), + ); + showTutorial( + onFinish: () { + onTabTapped(currentPageIndex + 1); + if (!tourComplete && !tourSkipped) { + tourProfile(); + } + }, + onClickTarget: (TargetFocus a) {}, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourComplete.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourComplete.md new file mode 100644 index 000000000..f95abfaf6 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourComplete.md @@ -0,0 +1,33 @@ + + + +# tourComplete property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) tourComplete + +_read / write_ + + + +

bool to determine if apptour is complete.

+ + + +## Implementation + +```dart +bool tourComplete = false; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourEventTargets.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourEventTargets.md new file mode 100644 index 000000000..35a537747 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourEventTargets.md @@ -0,0 +1,88 @@ + + + +# tourEventTargets method + + + + + + + + +void tourEventTargets +() + + + + + +

This function show the tutorial for Events.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void tourEventTargets() { + targets.clear(); + targets.add( + focusTarget( + keyBNEvents, + 'keyBNEvents', + 'This is the Events tab here you can see all event related information of the current selected organization', + isCircle: true, + align: ContentAlign.top, + ), + ); + targets.add( + focusTarget( + keySECategoryMenu, + 'keySECategoryMenu', + 'Filter Events based on categories', + ), + ); + targets.add( + focusTarget( + keySEDateFilter, + 'keySEDateFilter', + 'Filter Events between selected dates', + ), + ); + targets.add( + focusTarget( + keySECard, + 'keySECard', + 'Description of event to see more details click on the card', + ), + ); + targets.add( + focusTarget( + keySEAdd, + 'keySEAdd', + 'You can create a new event from here', + align: ContentAlign.top, + ), + ); + showTutorial( + onFinish: () { + onTabTapped(currentPageIndex + 1); + if (!tourComplete && !tourSkipped) { + tourAddPost(); + } + }, + onClickTarget: (TargetFocus a) {}, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourHomeTargets.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourHomeTargets.md new file mode 100644 index 000000000..8a9dbd83b --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourHomeTargets.md @@ -0,0 +1,122 @@ + + + +# tourHomeTargets method + + + + + + + + +void tourHomeTargets +() + + + + + +

this functions starts the tour and info to be displayed is mentioned in this functions.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void tourHomeTargets() { + targets.clear(); + targets.add( + focusTarget( + keySHOrgName, + 'keySHOrgName', + 'Current selected Organization Name', + ), + ); + targets.add( + focusTarget( + keySHMenuIcon, + 'keySHMenuIcon', + 'Click this button to see options related to switching, joining and leaving organization(s)', + isCircle: true, + next: () => scaffoldKey.currentState!.openDrawer(), + ), + ); + targets.add( + focusTarget( + keyDrawerCurOrg, + 'keyDrawerCurOrg', + "Current selected Organization's Name appears here", + ), + ); + targets.add( + focusTarget( + keyDrawerSwitchableOrg, + 'keyDrawerSwitchableOrg', + "All your joined organizations appear over here you can click on them to change the current organization", + ), + ); + targets.add( + focusTarget( + keyDrawerJoinOrg, + 'keyDrawerJoinOrg', + "From this button you can join other listed organizations", + align: ContentAlign.top, + ), + ); + targets.add( + focusTarget( + keyDrawerLeaveCurrentOrg, + 'keyDrawerLeaveCurrentOrg', + "To leave the current organization you can use this option", + align: ContentAlign.top, + next: () => navigationService.pop(), + ), + ); + targets.add( + focusTarget( + keyBNHome, + 'keyBNHome', + "This is the home tab here you can see the latest post from other members of the current organization", + isCircle: true, + align: ContentAlign.top, + ), + ); + targets.add( + focusTarget( + keySHPinnedPost, + 'keySHPinnedPost', + "This section displays all the important post set by the organization admin(s)", + align: ContentAlign.bottom, + ), + ); + targets.add( + focusTarget( + keySHPost, + 'keySHPost', + "This is the post card you can like and comment on the post from the options available", + align: ContentAlign.bottom, + ), + ); + showTutorial( + onClickTarget: showHome, + onFinish: () { + onTabTapped(currentPageIndex + 1); + if (!tourComplete && !tourSkipped) { + tourEventTargets(); + } + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourProfile.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourProfile.md new file mode 100644 index 000000000..9aae9bc64 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourProfile.md @@ -0,0 +1,96 @@ + + + +# tourProfile method + + + + + + + + +void tourProfile +() + + + + + +

This function show the tutorial for the profile page.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void tourProfile() { + targets.clear(); + targets.add( + focusTarget( + keyBNProfile, + 'keyBNProfile', + 'This is the Profile tab here you can see all options related to account, app setting, invitation, help etc', + isCircle: true, + align: ContentAlign.top, + nextCrossAlign: CrossAxisAlignment.start, + ), + ); + targets.add( + focusTarget( + keySPAppSetting, + 'keySPAppSetting', + 'You can edit application settings like language, theme etc from here', + ), + ); + targets.add( + focusTarget( + keySPHelp, + 'keySPHelp', + 'For any help we are always there. You can reach us from here', + ), + ); + targets.add( + focusTarget( + keySPDonateUs, + 'keySPDonateUs', + 'To help your organization grow you can support them financially from here', + ), + ); + targets.add( + focusTarget( + keySPInvite, + 'keySPInvite', + 'Wanna invite colleague, invite them from here', + ), + ); + targets.add( + focusTarget( + keySPPalisadoes, + 'keySPPalisadoes', + 'You are all set to go lets get you in', + isEnd: true, + ), + ); + showTutorial( + onFinish: () { + if (!tourComplete && !tourSkipped) { + tourComplete = true; + onTabTapped(0); + } + }, + onClickTarget: (TargetFocus a) {}, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourSkipped.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourSkipped.md new file mode 100644 index 000000000..46465249e --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tourSkipped.md @@ -0,0 +1,33 @@ + + + +# tourSkipped property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) tourSkipped + +_read / write_ + + + +

bool to determine if apptour is skipped.

+ + + +## Implementation + +```dart +bool tourSkipped = false; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tutorialCoachMark.md b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tutorialCoachMark.md new file mode 100644 index 000000000..e6c7406f7 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/MainScreenViewModel/tutorialCoachMark.md @@ -0,0 +1,33 @@ + + + +# tutorialCoachMark property + + + + + + + +[TutorialCoachMark](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TutorialCoachMark-class.html) tutorialCoachMark + +_read / write_ + + + +

tutorialCoachMark consist of coach used to give tutorial.

+ + + +## Implementation + +```dart +late TutorialCoachMark tutorialCoachMark; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_main_screen_view_model/view_model_main_screen_view_model-library.md b/talawa-mobile-docs/view_model_main_screen_view_model/view_model_main_screen_view_model-library.md new file mode 100644 index 000000000..5d8d53324 --- /dev/null +++ b/talawa-mobile-docs/view_model_main_screen_view_model/view_model_main_screen_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# main_screen_view_model library + + + + + + + + + + + +## Classes + +##### [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md) + + + +MainScreenViewModel class provide methods to interact with the modal to serve data in user's action in Main Screen Views. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md new file mode 100644 index 000000000..c2c1a9d09 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md @@ -0,0 +1,275 @@ + + + +# LoginViewModel class + + + + + + + + + +

LoginViewModel class helps to interact with model to serve data +and react to user's input in Login View.

+

Methods include:

+
    +
  • login
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- LoginViewModel + + + + + + + + +## Constructors + +[LoginViewModel](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/LoginViewModel.md) () + + + + +## Properties + +##### [email](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/email.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [emailFocus](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/emailFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_read / write_ + + + +##### [formKey](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/formKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> + + + + +_final_ + + + +##### [greeting](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/greeting.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [hidePassword](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/hidePassword.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [password](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/password.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [passwordFocus](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/passwordFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [validate](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/validate.md) ↔ [AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) + + + + +_read / write_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [initialize](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/initialize.md)() void + + + + + + + + +##### [login](../view_model_pre_auth_view_models_login_view_model/LoginViewModel/login.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to sign-in the user into application. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/LoginViewModel.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/LoginViewModel.md new file mode 100644 index 000000000..c37c0bbc5 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/LoginViewModel.md @@ -0,0 +1,24 @@ + + + +# LoginViewModel constructor + + + + + + + +LoginViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/email.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/email.md new file mode 100644 index 000000000..8fc948122 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/email.md @@ -0,0 +1,32 @@ + + + +# email property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) email + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController email = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/emailFocus.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/emailFocus.md new file mode 100644 index 000000000..ecd01d588 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/emailFocus.md @@ -0,0 +1,32 @@ + + + +# emailFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) emailFocus + +_read / write_ + + + + + + +## Implementation + +```dart +FocusNode emailFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/formKey.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/formKey.md new file mode 100644 index 000000000..d7de0e859 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/formKey.md @@ -0,0 +1,32 @@ + + + +# formKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> formKey + +_final_ + + + + + + +## Implementation + +```dart +final formKey = GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/greeting.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/greeting.md new file mode 100644 index 000000000..de486919b --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/greeting.md @@ -0,0 +1,32 @@ + + + +# greeting property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> greeting + +_read / write_ + + + + + + +## Implementation + +```dart +late List> greeting; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/hidePassword.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/hidePassword.md new file mode 100644 index 000000000..bd2ce20b9 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/hidePassword.md @@ -0,0 +1,32 @@ + + + +# hidePassword property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) hidePassword + +_read / write_ + + + + + + +## Implementation + +```dart +bool hidePassword = true; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/initialize.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/initialize.md new file mode 100644 index 000000000..048ef7ef8 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/initialize.md @@ -0,0 +1,64 @@ + + + +# initialize method + + + + + + + + +void initialize +() + + + + + + + + +## Implementation + +```dart +void initialize() { + // greating message + greeting = [ + { + 'text': "We're ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall + }, + { + 'text': 'Glad ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24) + }, + { + 'text': "you're ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall + }, + { + 'text': 'Back ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24) + }, + ]; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/login.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/login.md new file mode 100644 index 000000000..dc101fdbe --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/login.md @@ -0,0 +1,107 @@ + + + +# login method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> login +() + + + + + +

This function is used to sign-in the user into application.

+ + + +## Implementation + +```dart +Future login() async { + emailFocus.unfocus(); + passwordFocus.unfocus(); + validate = AutovalidateMode.always; + // if the email and password are not empty. + if (formKey.currentState!.validate()) { + validate = AutovalidateMode.disabled; + navigationService + .pushDialog(const CustomProgressDialog(key: Key('LoginProgress'))); + databaseFunctions.init(); + try { + // run the graph QL query to login the user, passing `email` and `password`. + final result = await databaseFunctions + .gqlNonAuthMutation(queries.loginUser(email.text, password.text)); + navigationService.pop(); + // if user found. + if (result != null) { + final User loggedInUser = + User.fromJson(result.data!['login'] as Map); + userConfig.updateUser(loggedInUser); + // if user has not already joined any organization. + if (userConfig.currentUser.joinedOrganizations!.isEmpty) { + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ); + } else { + userConfig.saveCurrentOrgInHive( + userConfig.currentUser.joinedOrganizations![0], + ); + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: MainScreenArgs(mainScreenIndex: 0, fromSignUp: false), + ); + } + final loginResult = result.data['login'] as Map; + androidFirebaseOptions = + loginResult['androidFirebaseOptions'] as Map; + iosFirebaseOptions = + loginResult['iosFirebaseOptions'] as Map; + if (androidFirebaseOptions['apiKey'] != null || + iosFirebaseOptions['apiKey'] != null) { + await setUpFirebase(); + + final token = await FirebaseMessaging.instance.getToken(); + await databaseFunctions.gqlAuthMutation( + queries.saveFcmToken(token), + ); + + await setUpFirebaseMessaging(); + + final androidFirebaseOptionsBox = + await Hive.openBox('androidFirebaseOptions'); + androidFirebaseOptionsBox.put( + 'androidFirebaseOptions', + androidFirebaseOptions, + ); + + final iosFirebaseOptionsBox = + await Hive.openBox('iosFirebaseOptions'); + iosFirebaseOptionsBox.put( + 'iosFirebaseOptions', + iosFirebaseOptions, + ); + } + } + } on Exception catch (e) { + print('here'); + print(e); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/password.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/password.md new file mode 100644 index 000000000..b344a9fed --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/password.md @@ -0,0 +1,32 @@ + + + +# password property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) password + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController password = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/passwordFocus.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/passwordFocus.md new file mode 100644 index 000000000..2b7716a5d --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/passwordFocus.md @@ -0,0 +1,32 @@ + + + +# passwordFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) passwordFocus + +_read / write_ + + + + + + +## Implementation + +```dart +FocusNode passwordFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/validate.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/validate.md new file mode 100644 index 000000000..7dd63a4d4 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/LoginViewModel/validate.md @@ -0,0 +1,32 @@ + + + +# validate property + + + + + + + +[AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) validate + +_read / write_ + + + + + + +## Implementation + +```dart +AutovalidateMode validate = AutovalidateMode.disabled; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/view_model_pre_auth_view_models_login_view_model-library.md b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/view_model_pre_auth_view_models_login_view_model-library.md new file mode 100644 index 000000000..b183f6c11 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_login_view_model/view_model_pre_auth_view_models_login_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# login_view_model library + + + + + + + + + + + +## Classes + +##### [LoginViewModel](../view_model_pre_auth_view_models_login_view_model/LoginViewModel-class.md) + + + +LoginViewModel class helps to interact with model to serve data +and react to user's input in Login View. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md new file mode 100644 index 000000000..f7fa3a76d --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md @@ -0,0 +1,340 @@ + + + +# SelectOrganizationViewModel class + + + + + + + + + +

SelectOrganizationViewModel class helps to interact with model to serve data +and react to user's input in Select Organization View.

+

Methods include:

+
    +
  • selectOrg
  • +
  • onTapJoin
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- SelectOrganizationViewModel + + + + + + + + +## Constructors + +[SelectOrganizationViewModel](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/SelectOrganizationViewModel.md) () + + + + +## Properties + +##### [allOrgController](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/allOrgController.md) → [ScrollController](https://api.flutter.dev/flutter/widgets/ScrollController-class.html) + + + + +_final_ + + + +##### [controller](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/controller.md) → [ScrollController](https://api.flutter.dev/flutter/widgets/ScrollController-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [organizations](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/organizations.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> + + + + +_read / write_ + + + +##### [orgId](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/orgId.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read / write_ + + + +##### [qrKey](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/qrKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + + +_final_ + + + +##### [result](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/result.md) ↔ [Barcode](https://pub.dev/documentation/qr_code_scanner/1.0.1/qr_code_scanner/Barcode-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [searchController](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchController.md) → [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_final_ + + + +##### [searchFocus](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchFocus.md) → [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_final_ + + + +##### [searching](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searching.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [selectedOrganization](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectedOrganization.md) ↔ [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + + +_read / write_ + + + +##### [showSearchOrgList](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/showSearchOrgList.md) ↔ [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + + +_read / write_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [fetchMoreHelper](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/fetchMoreHelper.md)([FetchMore](https://pub.dev/documentation/graphql_flutter/5.2.0-beta.5/graphql_flutter/FetchMore.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?> fetchMore, [List](https://api.flutter.dev/flutter/dart-core/List-class.html) organizations) void + + + +This function fetch more option. + + + + +##### [initialise](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/initialise.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) initialData) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [onTapContinue](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapContinue.md)() void + + + + + + + + +##### [onTapJoin](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapJoin.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function make user to join the selected organization. +The function uses joinOrgById graph QL query. + + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [searchActive](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchActive.md)() void + + + + + + + + +##### [selectOrg](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectOrg.md)([OrgInfo](../models_organization_org_info/OrgInfo-class.md) item) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function select the organization. + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/SelectOrganizationViewModel.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/SelectOrganizationViewModel.md new file mode 100644 index 000000000..a03045c93 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/SelectOrganizationViewModel.md @@ -0,0 +1,24 @@ + + + +# SelectOrganizationViewModel constructor + + + + + + + +SelectOrganizationViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/allOrgController.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/allOrgController.md new file mode 100644 index 000000000..0e3bcabd3 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/allOrgController.md @@ -0,0 +1,32 @@ + + + +# allOrgController property + + + + + + + +[ScrollController](https://api.flutter.dev/flutter/widgets/ScrollController-class.html) allOrgController + +_final_ + + + + + + +## Implementation + +```dart +final ScrollController allOrgController = ScrollController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/controller.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/controller.md new file mode 100644 index 000000000..00b8f4d3b --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/controller.md @@ -0,0 +1,32 @@ + + + +# controller property + + + + + + + +[ScrollController](https://api.flutter.dev/flutter/widgets/ScrollController-class.html) controller + +_final_ + + + + + + +## Implementation + +```dart +final ScrollController controller = ScrollController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/fetchMoreHelper.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/fetchMoreHelper.md new file mode 100644 index 000000000..e7c1a5972 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/fetchMoreHelper.md @@ -0,0 +1,52 @@ + + + +# fetchMoreHelper method + + + + + + + + +void fetchMoreHelper +([FetchMore](https://pub.dev/documentation/graphql_flutter/5.2.0-beta.5/graphql_flutter/FetchMore.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?> fetchMore, [List](https://api.flutter.dev/flutter/dart-core/List-class.html) organizations) + + + + + +

This function fetch more option.

+ + + +## Implementation + +```dart +void fetchMoreHelper(FetchMore fetchMore, List organizations) { + fetchMore( + FetchMoreOptions( + variables: { + "first": organizations.length + 15, + "skip": organizations.length, + }, + updateQuery: (existingOrganizations, newOrganizations) { + return { + 'organizationsConnection': [ + ...existingOrganizations!["organizationsConnection"], + ...newOrganizations!['organizationsConnection'], + ], + }; + }, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/initialise.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/initialise.md new file mode 100644 index 000000000..a13f60bf1 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/initialise.md @@ -0,0 +1,52 @@ + + + +# initialise method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> initialise +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) initialData) + + + + + + + + +## Implementation + +```dart +Future initialise(String initialData) async { + searchFocus.addListener(searchActive); + if (!initialData.contains('-1')) { + databaseFunctions.init(); + final fetch = await databaseFunctions.fetchOrgById(initialData); + if (fetch.runtimeType == OrgInfo) { + selectedOrganization = fetch as OrgInfo; + if (userConfig.currentUser.refreshToken?.isEmpty ?? true) { + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: selectedOrganization, + ); + } else { + selectOrg(selectedOrganization); + } + setState(ViewState.idle); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapContinue.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapContinue.md new file mode 100644 index 000000000..916f8b18a --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapContinue.md @@ -0,0 +1,48 @@ + + + +# onTapContinue method + + + + + + + + +void onTapContinue +() + + + + + + + + +## Implementation + +```dart +void onTapContinue() { + // if user selected any organization. + if (selectedOrganization.id != '-1') { + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: selectedOrganization, + ); + } else { + navigationService.showTalawaErrorSnackBar( + 'Select one organization to continue', + MessageType.warning, + duration: const Duration(milliseconds: 750), + ); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapJoin.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapJoin.md new file mode 100644 index 000000000..c13233237 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/onTapJoin.md @@ -0,0 +1,88 @@ + + + +# onTapJoin method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> onTapJoin +() + + + + + +

This function make user to join the selected organization. +The function uses joinOrgById graph QL query.

+ + + +## Implementation + +```dart +Future onTapJoin() async { + // if `selectedOrganization` is public. + if (selectedOrganization.isPublic == true) { + try { + // run the graph QL mutation + final QueryResult result = await databaseFunctions.gqlAuthMutation( + queries.joinOrgById(selectedOrganization.id!), + ) as QueryResult; + + final List? joinedOrg = + ((result.data!['joinPublicOrganization'] + as Map)['joinedOrganizations'] + as List?) + ?.map((e) => OrgInfo.fromJson(e as Map)) + .toList(); + userConfig.updateUserJoinedOrg(joinedOrg!); + // if user joined organization length is 1 + if (userConfig.currentUser.joinedOrganizations!.length == 1) { + userConfig.saveCurrentOrgInHive( + userConfig.currentUser.joinedOrganizations![0], + ); + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: MainScreenArgs(mainScreenIndex: 0), + ); + } else { + navigationService.pop(); + navigationService.showTalawaErrorSnackBar( + 'Joined ${selectedOrganization.name} successfully', + MessageType.info, + ); + } + } on Exception catch (e) { + print(e); + navigationService.showTalawaErrorSnackBar( + 'SomeThing went wrong', + MessageType.error, + ); + } + } + // else { + // try { + // // navigationService.pushScreen(Routes.requestAccess); + // } on Exception catch (e) { + // print(e); + // navigationService.showTalawaErrorSnackBar( + // 'SomeThing went wrong', + // MessageType.error, + // ); + // } + // } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/orgId.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/orgId.md new file mode 100644 index 000000000..8401c3532 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/orgId.md @@ -0,0 +1,32 @@ + + + +# orgId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId + +_read / write_ + + + + + + +## Implementation + +```dart +late String orgId; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/organizations.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/organizations.md new file mode 100644 index 000000000..d267d675b --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/organizations.md @@ -0,0 +1,32 @@ + + + +# organizations property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> organizations + +_read / write_ + + + + + + +## Implementation + +```dart +late List organizations = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/qrKey.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/qrKey.md new file mode 100644 index 000000000..1106a10ec --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/qrKey.md @@ -0,0 +1,32 @@ + + + +# qrKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> qrKey + +_final_ + + + + + + +## Implementation + +```dart +final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/result.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/result.md new file mode 100644 index 000000000..9e5c1d6a2 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/result.md @@ -0,0 +1,32 @@ + + + +# result property + + + + + + + +[Barcode](https://pub.dev/documentation/qr_code_scanner/1.0.1/qr_code_scanner/Barcode-class.html) result + +_read / write_ + + + + + + +## Implementation + +```dart +late Barcode result; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchActive.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchActive.md new file mode 100644 index 000000000..da4b165c2 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchActive.md @@ -0,0 +1,40 @@ + + + +# searchActive method + + + + + + + + +void searchActive +() + + + + + + + + +## Implementation + +```dart +void searchActive() { + if (searchFocus.hasFocus) { + organizations = []; + searching = true; + setState(ViewState.idle); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchController.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchController.md new file mode 100644 index 000000000..5f278031a --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchController.md @@ -0,0 +1,32 @@ + + + +# searchController property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) searchController + +_final_ + + + + + + +## Implementation + +```dart +final TextEditingController searchController = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchFocus.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchFocus.md new file mode 100644 index 000000000..a2cadd525 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searchFocus.md @@ -0,0 +1,32 @@ + + + +# searchFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) searchFocus + +_final_ + + + + + + +## Implementation + +```dart +final FocusNode searchFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searching.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searching.md new file mode 100644 index 000000000..427df2c30 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/searching.md @@ -0,0 +1,32 @@ + + + +# searching property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) searching + +_read / write_ + + + + + + +## Implementation + +```dart +bool searching = false; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectOrg.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectOrg.md new file mode 100644 index 000000000..6a6ccd37b --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectOrg.md @@ -0,0 +1,91 @@ + + + +# selectOrg method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> selectOrg +([OrgInfo](../../models_organization_org_info/OrgInfo-class.md) item) + + + + + +

This function select the organization.

+

params:

+
    +
  • item : Selected organization data.
  • +
+ + + +## Implementation + +```dart +Future selectOrg(OrgInfo item) async { + print(item.id); + bool orgAlreadyJoined = false; + bool orgRequestAlreadyPresent = false; + final bool userLoggedIn = await userConfig.userLoggedIn(); + // if user session not expirec + if (userLoggedIn) { + // check if user has already joined the selected organization. + userConfig.currentUser.joinedOrganizations!.forEach((element) { + if (element.id! == item.id) { + orgAlreadyJoined = true; + } + }); + // check if user has already send the membership request to the selected organization. + userConfig.currentUser.membershipRequests!.forEach((element) { + if (element.id! == item.id) { + orgRequestAlreadyPresent = true; + } + }); + // if not already joined and not memebrship request. + if (!orgAlreadyJoined && !orgRequestAlreadyPresent) { + selectedOrganization = item; + notifyListeners(); + onTapJoin(); + // print(selectedOrganization.isPublic); + + if (!selectedOrganization.isPublic!) { + navigationService.pushScreen( + Routes.requestAccess, + arguments: selectedOrganization, + ); + } + } else if (orgAlreadyJoined) { + selectedOrganization = OrgInfo(id: '-1'); + navigationService.showTalawaErrorSnackBar( + 'Organisation already joined', + MessageType.warning, + ); + } else { + navigationService.showTalawaErrorSnackBar( + 'Membership request already sent', + MessageType.warning, + ); + } + } else { + selectedOrganization = item; + notifyListeners(); + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: selectedOrganization, + ); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectedOrganization.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectedOrganization.md new file mode 100644 index 000000000..1c7a65ca8 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/selectedOrganization.md @@ -0,0 +1,32 @@ + + + +# selectedOrganization property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md) selectedOrganization + +_read / write_ + + + + + + +## Implementation + +```dart +late OrgInfo selectedOrganization = OrgInfo(id: '-1'); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/showSearchOrgList.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/showSearchOrgList.md new file mode 100644 index 000000000..c8c83bdd4 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel/showSearchOrgList.md @@ -0,0 +1,32 @@ + + + +# showSearchOrgList property + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) showSearchOrgList + +_read / write_ + + + + + + +## Implementation + +```dart +late Widget showSearchOrgList = Container(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/view_model_pre_auth_view_models_select_organization_view_model-library.md b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/view_model_pre_auth_view_models_select_organization_view_model-library.md new file mode 100644 index 000000000..074705cdc --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_select_organization_view_model/view_model_pre_auth_view_models_select_organization_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# select_organization_view_model library + + + + + + + + + + + +## Classes + +##### [SelectOrganizationViewModel](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) + + + +SelectOrganizationViewModel class helps to interact with model to serve data +and react to user's input in Select Organization View. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md new file mode 100644 index 000000000..eea1cc27f --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md @@ -0,0 +1,319 @@ + + + +# SetUrlViewModel class + + + + + + + + + +

SetUrlViewModel class helps to interact with model to serve data.

+

and react to user's input for Set Url Section. +Methods include:

+
    +
  • checkURLandNavigate
  • +
  • scanQR
  • +
  • initialise
  • +
  • checkURLandNavigate
  • +
  • checkURLandShowPopUp
  • +
  • scanQR
  • +
  • _onQRViewCreated
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- SetUrlViewModel + + + + + + + + +## Constructors + +[SetUrlViewModel](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/SetUrlViewModel.md) () + + + + +## Properties + +##### [formKey](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/formKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> + + + +formKey. +_final_ + + + +##### [greeting](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/greeting.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> + + + +qrController. +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [orgId](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/orgId.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +organizationID. +_read / write_ + + + +##### [qrKey](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/qrKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> + + + +qrKey. +_final_ + + + +##### [result](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/result.md) ↔ [Barcode](https://pub.dev/documentation/qr_code_scanner/1.0.1/qr_code_scanner/Barcode-class.html) + + + +qrText. +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [url](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/url.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + +url. +_read / write_ + + + +##### [urlFocus](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + +urlFocus. +_read / write_ + + + +##### [validate](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/validate.md) ↔ [AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) + + + +qrValidator. +_read / write_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [checkURLandNavigate](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandNavigate.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) navigateTo, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) argument) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function check the URL and navigate to the respective URL. + + + + +##### [checkURLandShowPopUp](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandShowPopUp.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) argument) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function check the URL and navigate to the respective URL. + + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [initialise](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/initialise.md)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) inviteUrl = ''}) void + + + +This function initialises the variables. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [scanQR](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/scanQR.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) void + + + +This function create a widget which is used to scan the QR-code. + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + +## Constants + +##### [imageUrlKey](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/imageUrlKey-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +imageUrlKey. + + + + +##### [urlKey](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlKey-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +urlKey. + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/SetUrlViewModel.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/SetUrlViewModel.md new file mode 100644 index 000000000..e77e026ae --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/SetUrlViewModel.md @@ -0,0 +1,24 @@ + + + +# SetUrlViewModel constructor + + + + + + + +SetUrlViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandNavigate.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandNavigate.md new file mode 100644 index 000000000..3d400b257 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandNavigate.md @@ -0,0 +1,72 @@ + + + +# checkURLandNavigate method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> checkURLandNavigate +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) navigateTo, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) argument) + + + + + +

This function check the URL and navigate to the respective URL.

+

params:

+
    +
  • navigateTo: url
  • +
  • argument: message
  • +
+

returns:

+
    +
  • Future<void>: void
  • +
+ + + +## Implementation + +```dart +Future checkURLandNavigate(String navigateTo, String argument) async { + urlFocus.unfocus(); + validate = AutovalidateMode.always; + + /// if the url is valid. + if (formKey.currentState!.validate()) { + navigationService + .pushDialog(const CustomProgressDialog(key: Key('UrlCheckProgress'))); + validate = AutovalidateMode.disabled; + final String uri = url.text.trim(); + final bool? urlPresent = + await locator().validateUrlExistence(uri); + if (urlPresent! == true) { + final box = Hive.box('url'); + box.put(urlKey, uri); + box.put(imageUrlKey, "$uri/talawa/"); + + navigationService.pop(); + graphqlConfig.getOrgUrl(); + navigationService.pushScreen(navigateTo, arguments: argument); + } else { + navigationService.pop(); + navigationService.showTalawaErrorSnackBar( + "URL doesn't exist/no connection please check", + MessageType.error, + ); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandShowPopUp.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandShowPopUp.md new file mode 100644 index 000000000..bdfe2ca46 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/checkURLandShowPopUp.md @@ -0,0 +1,73 @@ + + + +# checkURLandShowPopUp method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> checkURLandShowPopUp +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) argument) + + + + + +

This function check the URL and navigate to the respective URL.

+

params:

+
    +
  • argument: message
  • +
+

returns:

+
    +
  • Future<void>: sdf
  • +
+ + + +## Implementation + +```dart +Future checkURLandShowPopUp(String argument) async { + urlFocus.unfocus(); + validate = AutovalidateMode.always; + + // if the url is valid. + if (formKey.currentState!.validate()) { + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('UrlCheckProgress'), + ), + ); + validate = AutovalidateMode.disabled; + final String uri = url.text.trim(); + final bool? urlPresent = + await locator().validateUrlExistence(uri); + if (urlPresent! == true) { + final box = Hive.box('url'); + box.put(urlKey, uri); + box.put(imageUrlKey, "$uri/talawa/"); + navigationService.pop(); + graphqlConfig.getOrgUrl(); + navigationService.showSnackBar("Url is valid"); + } else { + navigationService.pop(); + navigationService.showTalawaErrorDialog( + "URL doesn't exist/no connection please check", + MessageType.info, + ); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/formKey.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/formKey.md new file mode 100644 index 000000000..dc694cea6 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/formKey.md @@ -0,0 +1,33 @@ + + + +# formKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> formKey + +_final_ + + + +

formKey.

+ + + +## Implementation + +```dart +final formKey = GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/greeting.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/greeting.md new file mode 100644 index 000000000..3c142332f --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/greeting.md @@ -0,0 +1,33 @@ + + + +# greeting property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> greeting + +_read / write_ + + + +

qrController.

+ + + +## Implementation + +```dart +late List> greeting; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/imageUrlKey-constant.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/imageUrlKey-constant.md new file mode 100644 index 000000000..6c8a4090a --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/imageUrlKey-constant.md @@ -0,0 +1,33 @@ + + + +# imageUrlKey constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const imageUrlKey + + + + + +

imageUrlKey.

+ + + +## Implementation + +```dart +static const imageUrlKey = "imageUrl"; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/initialise.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/initialise.md new file mode 100644 index 000000000..828addb8f --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/initialise.md @@ -0,0 +1,89 @@ + + + +# initialise method + + + + + + + + +void initialise +({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) inviteUrl = ''}) + + + + + +

This function initialises the variables.

+

params:

+
    +
  • inviteUrl: url
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void initialise({String inviteUrl = ''}) { + final uri = inviteUrl; + if (uri.isNotEmpty) { + /// assigning the invite server url to the url text controller. + url.text = uri; + final box = Hive.box('url'); + box.put(urlKey, uri); + box.put(imageUrlKey, "$uri/talawa/"); + graphqlConfig.getOrgUrl(); + } + + /// greeting message. + greeting = [ + { + 'text': 'Join ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24, fontWeight: FontWeight.w700) + }, + { + 'text': 'and ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall + }, + { + 'text': 'Collaborate ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24, fontWeight: FontWeight.w700) + }, + { + 'text': 'with your ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall + }, + { + 'text': 'Organizations', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall! + .copyWith(fontSize: 24, color: const Color(0xFF4285F4)) + }, + ]; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/orgId.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/orgId.md new file mode 100644 index 000000000..0dd4df433 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/orgId.md @@ -0,0 +1,33 @@ + + + +# orgId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId + +_read / write_ + + + +

organizationID.

+ + + +## Implementation + +```dart +String orgId = '-1'; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/qrKey.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/qrKey.md new file mode 100644 index 000000000..911a3ddbb --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/qrKey.md @@ -0,0 +1,33 @@ + + + +# qrKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html)>> qrKey + +_final_ + + + +

qrKey.

+ + + +## Implementation + +```dart +final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/result.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/result.md new file mode 100644 index 000000000..e23ab6061 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/result.md @@ -0,0 +1,33 @@ + + + +# result property + + + + + + + +[Barcode](https://pub.dev/documentation/qr_code_scanner/1.0.1/qr_code_scanner/Barcode-class.html) result + +_read / write_ + + + +

qrText.

+ + + +## Implementation + +```dart +late Barcode result; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/scanQR.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/scanQR.md new file mode 100644 index 000000000..ead578be1 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/scanQR.md @@ -0,0 +1,93 @@ + + + +# scanQR method + + + + + + + + +void scanQR +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + +

This function create a widget which is used to scan the QR-code.

+

params:

+
    +
  • context: BuildContext
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void scanQR(BuildContext context) { + showModalBottomSheet( + context: context, + barrierColor: Colors.transparent, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + builder: (BuildContext context) { + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: Container( + height: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondary, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 250, + width: 250, + child: QRView( + key: qrKey, + onQRViewCreated: _onQRViewCreated, + overlay: QrScannerOverlayShape( + borderRadius: 10, + borderLength: 20, + borderWidth: 10, + cutOutSize: 250, + ), + /*overlayMargin: EdgeInsets.all(50)*/ + ), + ), + SizedBox( + height: SizeConfig.safeBlockVertical! * 4, + ), + const Text('Scan QR'), + SizedBox( + height: SizeConfig.safeBlockVertical! * 4, + ) + ], + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/url.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/url.md new file mode 100644 index 000000000..2f3e57fc8 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/url.md @@ -0,0 +1,33 @@ + + + +# url property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) url + +_read / write_ + + + +

url.

+ + + +## Implementation + +```dart +TextEditingController url = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlFocus.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlFocus.md new file mode 100644 index 000000000..bc8e159cf --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlFocus.md @@ -0,0 +1,33 @@ + + + +# urlFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) urlFocus + +_read / write_ + + + +

urlFocus.

+ + + +## Implementation + +```dart +FocusNode urlFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlKey-constant.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlKey-constant.md new file mode 100644 index 000000000..3e462eee9 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/urlKey-constant.md @@ -0,0 +1,33 @@ + + + +# urlKey constant + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const urlKey + + + + + +

urlKey.

+ + + +## Implementation + +```dart +static const urlKey = "url"; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/validate.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/validate.md new file mode 100644 index 000000000..4c7538890 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel/validate.md @@ -0,0 +1,33 @@ + + + +# validate property + + + + + + + +[AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) validate + +_read / write_ + + + +

qrValidator.

+ + + +## Implementation + +```dart +AutovalidateMode validate = AutovalidateMode.disabled; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/view_model_pre_auth_view_models_set_url_view_model-library.md b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/view_model_pre_auth_view_models_set_url_view_model-library.md new file mode 100644 index 000000000..040465868 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_set_url_view_model/view_model_pre_auth_view_models_set_url_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# set_url_view_model library + + + + + + + + + + + +## Classes + +##### [SetUrlViewModel](../view_model_pre_auth_view_models_set_url_view_model/SetUrlViewModel-class.md) + + + +SetUrlViewModel class helps to interact with model to serve data. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md new file mode 100644 index 000000000..68a80ada5 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md @@ -0,0 +1,303 @@ + + + +# SignupDetailsViewModel class + + + + + + + + + +

SignupDetailsViewModel class helps to interact with model to serve data +and react to user's input for Sign Up Details section.

+

Methods include:

+
    +
  • signUp
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- SignupDetailsViewModel + + + + + + + + +## Constructors + +[SignupDetailsViewModel](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/SignupDetailsViewModel.md) () + + + + +## Properties + +##### [confirmFocus](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmFocus.md) ↔ [FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) + + + + +_read / write_ + + + +##### [confirmPassword](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmPassword.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [email](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/email.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [firstName](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/firstName.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [formKey](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/formKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> + + + + +_final_ + + + +##### [greeting](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/greeting.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [hidePassword](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/hidePassword.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [lastName](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/lastName.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [password](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/password.md) ↔ [TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [selectedOrganization](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/selectedOrganization.md) ↔ [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + + +_read / write_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [validate](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/validate.md) ↔ [AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) + + + + +_read / write_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [initialise](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/initialise.md)([OrgInfo](../models_organization_org_info/OrgInfo-class.md) org) void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [signUp](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/signUp.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + +This function is used to sign up the user into the application by passing the data to database query. +The function uses gqlNonAuthMutation method provided by databaseFunctions services. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/SignupDetailsViewModel.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/SignupDetailsViewModel.md new file mode 100644 index 000000000..de1282e24 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/SignupDetailsViewModel.md @@ -0,0 +1,24 @@ + + + +# SignupDetailsViewModel constructor + + + + + + + +SignupDetailsViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmFocus.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmFocus.md new file mode 100644 index 000000000..66b9c41cb --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmFocus.md @@ -0,0 +1,32 @@ + + + +# confirmFocus property + + + + + + + +[FocusNode](https://api.flutter.dev/flutter/widgets/FocusNode-class.html) confirmFocus + +_read / write_ + + + + + + +## Implementation + +```dart +FocusNode confirmFocus = FocusNode(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmPassword.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmPassword.md new file mode 100644 index 000000000..be24345f1 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/confirmPassword.md @@ -0,0 +1,32 @@ + + + +# confirmPassword property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) confirmPassword + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController confirmPassword = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/email.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/email.md new file mode 100644 index 000000000..8fc948122 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/email.md @@ -0,0 +1,32 @@ + + + +# email property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) email + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController email = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/firstName.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/firstName.md new file mode 100644 index 000000000..05e3d39ab --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/firstName.md @@ -0,0 +1,32 @@ + + + +# firstName property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) firstName + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController firstName = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/formKey.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/formKey.md new file mode 100644 index 000000000..d7de0e859 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/formKey.md @@ -0,0 +1,32 @@ + + + +# formKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[FormState](https://api.flutter.dev/flutter/widgets/FormState-class.html)> formKey + +_final_ + + + + + + +## Implementation + +```dart +final formKey = GlobalKey(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/greeting.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/greeting.md new file mode 100644 index 000000000..de486919b --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/greeting.md @@ -0,0 +1,32 @@ + + + +# greeting property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> greeting + +_read / write_ + + + + + + +## Implementation + +```dart +late List> greeting; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/hidePassword.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/hidePassword.md new file mode 100644 index 000000000..bd2ce20b9 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/hidePassword.md @@ -0,0 +1,32 @@ + + + +# hidePassword property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) hidePassword + +_read / write_ + + + + + + +## Implementation + +```dart +bool hidePassword = true; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/initialise.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/initialise.md new file mode 100644 index 000000000..eb0ac9473 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/initialise.md @@ -0,0 +1,64 @@ + + + +# initialise method + + + + + + + + +void initialise +([OrgInfo](../../models_organization_org_info/OrgInfo-class.md) org) + + + + + + + + +## Implementation + +```dart +void initialise(OrgInfo org) { + selectedOrganization = org; + // greeting message + greeting = [ + { + 'text': "Let's ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall + }, + { + 'text': 'get ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall + }, + { + 'text': "you ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall + }, + { + 'text': 'SignUp ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24) + }, + ]; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/lastName.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/lastName.md new file mode 100644 index 000000000..7f599f492 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/lastName.md @@ -0,0 +1,32 @@ + + + +# lastName property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) lastName + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController lastName = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/password.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/password.md new file mode 100644 index 000000000..b344a9fed --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/password.md @@ -0,0 +1,32 @@ + + + +# password property + + + + + + + +[TextEditingController](https://api.flutter.dev/flutter/widgets/TextEditingController-class.html) password + +_read / write_ + + + + + + +## Implementation + +```dart +TextEditingController password = TextEditingController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/selectedOrganization.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/selectedOrganization.md new file mode 100644 index 000000000..627e15c4d --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/selectedOrganization.md @@ -0,0 +1,32 @@ + + + +# selectedOrganization property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md) selectedOrganization + +_read / write_ + + + + + + +## Implementation + +```dart +late OrgInfo selectedOrganization; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/signUp.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/signUp.md new file mode 100644 index 000000000..a21b802c3 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/signUp.md @@ -0,0 +1,128 @@ + + + +# signUp method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> signUp +() + + + + + +

This function is used to sign up the user into the application by passing the data to database query. +The function uses gqlNonAuthMutation method provided by databaseFunctions services.

+ + + +## Implementation + +```dart +Future signUp() async { + FocusScope.of(navigationService.navigatorKey.currentContext!).unfocus(); + setState(ViewState.busy); + validate = AutovalidateMode.always; + setState(ViewState.idle); + if (formKey.currentState!.validate()) { + validate = AutovalidateMode.disabled; + navigationService + .pushDialog(const CustomProgressDialog(key: Key('SignUpProgress'))); + databaseFunctions.init(); + try { + final result = await databaseFunctions.gqlNonAuthMutation( + queries.registerUser( + firstName.text, + lastName.text, + email.text, + password.text, + ), + ); + navigationService.pop(); + if (result != null) { + final User signedInUser = + User.fromJson(result.data!['signUp'] as Map); + final bool userSaved = await userConfig.updateUser(signedInUser); + final bool tokenRefreshed = await graphqlConfig.getToken() as bool; + // if user successfully saved and access token is also generated. + if (userSaved && tokenRefreshed) { + // if the selected organization is public. + if (selectedOrganization.isPublic!) { + try { + final QueryResult result = + await databaseFunctions.gqlAuthMutation( + queries.joinOrgById(selectedOrganization.id!), + ) as QueryResult; + + final List? joinedOrg = (result + .data!['joinPublicOrganization'] + ['joinedOrganizations'] as List?) + ?.map((e) => OrgInfo.fromJson(e as Map)) + .toList(); + userConfig.updateUserJoinedOrg(joinedOrg!); + userConfig.saveCurrentOrgInHive( + userConfig.currentUser.joinedOrganizations![0], + ); + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: + MainScreenArgs(mainScreenIndex: 0, fromSignUp: true), + ); + } on Exception catch (e) { + print(e); + navigationService.showTalawaErrorSnackBar( + 'SomeThing went wrong', + MessageType.error, + ); + } + } else { + try { + final QueryResult result = + await databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest(selectedOrganization.id!), + ) as QueryResult; + + final OrgInfo membershipRequest = OrgInfo.fromJson( + result.data!['sendMembershipRequest']['organization'] + as Map, + ); + userConfig.updateUserMemberRequestOrg([membershipRequest]); + navigationService.pop(); + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ); + } on Exception catch (e) { + print(e); + navigationService.showTalawaErrorSnackBar( + 'SomeThing went wrong', + MessageType.error, + ); + } + } + } + } + } on Exception catch (e) { + print(e); + navigationService.showTalawaErrorSnackBar( + 'SomeThing went wrong', + MessageType.error, + ); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/validate.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/validate.md new file mode 100644 index 000000000..7dd63a4d4 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel/validate.md @@ -0,0 +1,32 @@ + + + +# validate property + + + + + + + +[AutovalidateMode](https://api.flutter.dev/flutter/widgets/AutovalidateMode.html) validate + +_read / write_ + + + + + + +## Implementation + +```dart +AutovalidateMode validate = AutovalidateMode.disabled; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/view_model_pre_auth_view_models_signup_details_view_model-library.md b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/view_model_pre_auth_view_models_signup_details_view_model-library.md new file mode 100644 index 000000000..24e8f4fda --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_signup_details_view_model/view_model_pre_auth_view_models_signup_details_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# signup_details_view_model library + + + + + + + + + + + +## Classes + +##### [SignupDetailsViewModel](../view_model_pre_auth_view_models_signup_details_view_model/SignupDetailsViewModel-class.md) + + + +SignupDetailsViewModel class helps to interact with model to serve data +and react to user's input for Sign Up Details section. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md new file mode 100644 index 000000000..71a25deca --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md @@ -0,0 +1,239 @@ + + + +# WaitingViewModel class + + + + + + + + + +

WaitingViewModel class helps to interact with model to serve data +and react to user's input for Waiting section.

+

Methods include:

+
    +
  • logout
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- WaitingViewModel + + + + + + + + +## Constructors + +[WaitingViewModel](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/WaitingViewModel.md) () + + + + +## Properties + +##### [currentUser](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/currentUser.md) ↔ [User](../models_user_user_info/User-class.md) + + + + +_read / write_ + + + +##### [greeting](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/greeting.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [pendingRequestOrg](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/pendingRequestOrg.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [initialise](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/initialise.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) void + + + + + + + + +##### [joinOrg](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/joinOrg.md)() void + + + + + + + + +##### [logout](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/logout.md)() void + + + +This function ends the session for the user or logout the user from the application. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/WaitingViewModel.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/WaitingViewModel.md new file mode 100644 index 000000000..127dbe8ba --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/WaitingViewModel.md @@ -0,0 +1,24 @@ + + + +# WaitingViewModel constructor + + + + + + + +WaitingViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/currentUser.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/currentUser.md new file mode 100644 index 000000000..e955d4062 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/currentUser.md @@ -0,0 +1,32 @@ + + + +# currentUser property + + + + + + + +[User](../../models_user_user_info/User-class.md) currentUser + +_read / write_ + + + + + + +## Implementation + +```dart +late User currentUser; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/greeting.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/greeting.md new file mode 100644 index 000000000..de486919b --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/greeting.md @@ -0,0 +1,32 @@ + + + +# greeting property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> greeting + +_read / write_ + + + + + + +## Implementation + +```dart +late List> greeting; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/initialise.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/initialise.md new file mode 100644 index 000000000..7dce45b34 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/initialise.md @@ -0,0 +1,53 @@ + + + +# initialise method + + + + + + + + +void initialise +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + + + + +## Implementation + +```dart +void initialise(BuildContext context) { + currentUser = userConfig.currentUser; + pendingRequestOrg = currentUser.membershipRequests!; + // greetings + greeting = [ + { + 'text': "Please wait", + 'textStyle': Theme.of(context).textTheme.headlineSmall + }, + { + 'text': " ${currentUser.firstName} ", + 'textStyle': + Theme.of(context).textTheme.titleLarge!.copyWith(fontSize: 24) + }, + { + 'text': "for organisation(s) to accept your invitation.", + 'textStyle': Theme.of(context).textTheme.headlineSmall + }, + ]; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/joinOrg.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/joinOrg.md new file mode 100644 index 000000000..428ddfc29 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/joinOrg.md @@ -0,0 +1,36 @@ + + + +# joinOrg method + + + + + + + + +void joinOrg +() + + + + + + + + +## Implementation + +```dart +void joinOrg() { + navigationService.pushScreen(Routes.joinOrg, arguments: '-1'); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/logout.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/logout.md new file mode 100644 index 000000000..278a53c3e --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/logout.md @@ -0,0 +1,45 @@ + + + +# logout method + + + + + + + + +void logout +() + + + + + +

This function ends the session for the user or logout the user from the application.

+ + + +## Implementation + +```dart +void logout() { + final user = Hive.box('currentUser'); + final url = Hive.box('url'); + user.clear(); + url.clear(); + navigationService.removeAllAndPush( + Routes.languageSelectionRoute, + Routes.splashScreen, + arguments: '0', + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/pendingRequestOrg.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/pendingRequestOrg.md new file mode 100644 index 000000000..9ca3922f2 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel/pendingRequestOrg.md @@ -0,0 +1,32 @@ + + + +# pendingRequestOrg property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> pendingRequestOrg + +_read / write_ + + + + + + +## Implementation + +```dart +late List pendingRequestOrg; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/view_model_pre_auth_view_models_waiting_view_model-library.md b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/view_model_pre_auth_view_models_waiting_view_model-library.md new file mode 100644 index 000000000..9a3ae1c44 --- /dev/null +++ b/talawa-mobile-docs/view_model_pre_auth_view_models_waiting_view_model/view_model_pre_auth_view_models_waiting_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# waiting_view_model library + + + + + + + + + + + +## Classes + +##### [WaitingViewModel](../view_model_pre_auth_view_models_waiting_view_model/WaitingViewModel-class.md) + + + +WaitingViewModel class helps to interact with model to serve data +and react to user's input for Waiting section. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_theme_view_model/AppTheme-class.md b/talawa-mobile-docs/view_model_theme_view_model/AppTheme-class.md new file mode 100644 index 000000000..237c0f90f --- /dev/null +++ b/talawa-mobile-docs/view_model_theme_view_model/AppTheme-class.md @@ -0,0 +1,220 @@ + + + +# AppTheme class + + + + + + + + + +

AppTheme class is a type of View Model to serve data from modal to views in the context of App Themes.

+

Methods include:

+
    +
  • switchTheme
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- AppTheme + + + + + + + + +## Constructors + +[AppTheme](../view_model_theme_view_model/AppTheme/AppTheme.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [isdarkTheme](../view_model_theme_view_model/AppTheme/isdarkTheme.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-only_ + + + +##### [key](../view_model_theme_view_model/AppTheme/key.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [initialize](../view_model_theme_view_model/AppTheme/initialize.md)() void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [switchTheme](../view_model_theme_view_model/AppTheme/switchTheme.md)({required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isOn}) void + + + +This function switches the app theme. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_theme_view_model/AppTheme/AppTheme.md b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/AppTheme.md new file mode 100644 index 000000000..4e8b04727 --- /dev/null +++ b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/AppTheme.md @@ -0,0 +1,24 @@ + + + +# AppTheme constructor + + + + + + + +AppTheme() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_theme_view_model/AppTheme/initialize.md b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/initialize.md new file mode 100644 index 000000000..da8232bbd --- /dev/null +++ b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/initialize.md @@ -0,0 +1,37 @@ + + + +# initialize method + + + + + + + + +void initialize +() + + + + + + + + +## Implementation + +```dart +void initialize() { + _isDarkMode = true; + _loadFromPrefs(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_theme_view_model/AppTheme/isdarkTheme.md b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/isdarkTheme.md new file mode 100644 index 000000000..4c2bac3ff --- /dev/null +++ b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/isdarkTheme.md @@ -0,0 +1,35 @@ + + + +# isdarkTheme property + + + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isdarkTheme + + + + + + + + +## Implementation + +```dart +bool get isdarkTheme => _isDarkMode; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_theme_view_model/AppTheme/key.md b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/key.md new file mode 100644 index 000000000..ca4316782 --- /dev/null +++ b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/key.md @@ -0,0 +1,32 @@ + + + +# key property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) key + +_final_ + + + + + + +## Implementation + +```dart +final String key = "DynamicTheme"; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_theme_view_model/AppTheme/switchTheme.md b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/switchTheme.md new file mode 100644 index 000000000..25663ba89 --- /dev/null +++ b/talawa-mobile-docs/view_model_theme_view_model/AppTheme/switchTheme.md @@ -0,0 +1,43 @@ + + + +# switchTheme method + + + + + + + + +void switchTheme +({required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isOn}) + + + + + +

This function switches the app theme.

+
    +
  • Dart -> Light
  • +
  • Light -> Dark
  • +
+ + + +## Implementation + +```dart +void switchTheme({required bool isOn}) { + _isDarkMode = isOn; + _saveToPrefs(); + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_theme_view_model/view_model_theme_view_model-library.md b/talawa-mobile-docs/view_model_theme_view_model/view_model_theme_view_model-library.md new file mode 100644 index 000000000..46949516e --- /dev/null +++ b/talawa-mobile-docs/view_model_theme_view_model/view_model_theme_view_model-library.md @@ -0,0 +1,38 @@ + + + + +# theme_view_model library + + + + + + + + + + + +## Classes + +##### [AppTheme](../view_model_theme_view_model/AppTheme-class.md) + + + +AppTheme class is a type of View Model to serve data from modal to views in the context of App Themes. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md new file mode 100644 index 000000000..4e83dc409 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md @@ -0,0 +1,242 @@ + + + +# CommentsViewModel class + + + + + + + + + +

CommentsViewModel class helps to serve the data from model +and to react to user's input for Comment Widget.

+

Methods include:

+
    +
  • getComments : to get all comments on the post.
  • +
  • createComment : to add comment on the post.
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- CommentsViewModel + + + + + + + + +## Constructors + +[CommentsViewModel](../view_model_widgets_view_models_comments_view_model/CommentsViewModel/CommentsViewModel.md) () + + + + +## Properties + +##### [commentList](../view_model_widgets_view_models_comments_view_model/CommentsViewModel/commentList.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comment](../models_comment_comment_model/Comment-class.md)> + + + + +_read-only_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [postId](../view_model_widgets_view_models_comments_view_model/CommentsViewModel/postId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_read-only_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addCommentLocally](../view_model_widgets_view_models_comments_view_model/CommentsViewModel/addCommentLocally.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) msg) void + + + + + + + + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [createComment](../view_model_widgets_view_models_comments_view_model/CommentsViewModel/createComment.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) msg) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This function add comment on the post. +The function uses createComments method provided by Comment Service. + + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [getComments](../view_model_widgets_view_models_comments_view_model/CommentsViewModel/getComments.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + +This methods fetch all comments on the post. +The function uses getCommentsForPost method by Comment Service. + + + + +##### [initialise](../view_model_widgets_view_models_comments_view_model/CommentsViewModel/initialise.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/CommentsViewModel.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/CommentsViewModel.md new file mode 100644 index 000000000..6be109507 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/CommentsViewModel.md @@ -0,0 +1,24 @@ + + + +# CommentsViewModel constructor + + + + + + + +CommentsViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/addCommentLocally.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/addCommentLocally.md new file mode 100644 index 000000000..093423e4e --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/addCommentLocally.md @@ -0,0 +1,44 @@ + + + +# addCommentLocally method + + + + + + + + +void addCommentLocally +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) msg) + + + + + + + + +## Implementation + +```dart +void addCommentLocally(String msg) { + _postService.addCommentLocally(_postID); + final creator = _userConfig.currentUser; + final Comment localComment = Comment( + text: msg, + createdAt: DateTime.now().toString(), + creator: creator, + ); + _commentlist.insert(0, localComment); + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/commentList.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/commentList.md new file mode 100644 index 000000000..520c4d731 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/commentList.md @@ -0,0 +1,35 @@ + + + +# commentList property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comment](../../models_comment_comment_model/Comment-class.md)> commentList + + + + + + + + +## Implementation + +```dart +List get commentList => _commentlist; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/createComment.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/createComment.md new file mode 100644 index 000000000..28f2ea742 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/createComment.md @@ -0,0 +1,44 @@ + + + +# createComment method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) createComment +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) msg) + + + + + +

This function add comment on the post. +The function uses createComments method provided by Comment Service.

+

params:

+
    +
  • msg : text of the comment to add.
  • +
+ + + +## Implementation + +```dart +Future createComment(String msg) async { + print("comment viewModel called"); + await _commentService.createComments(_postID, msg); + addCommentLocally(msg); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/getComments.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/getComments.md new file mode 100644 index 000000000..8969fdda4 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/getComments.md @@ -0,0 +1,45 @@ + + + +# getComments method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) getComments +() + + + + + +

This methods fetch all comments on the post. +The function uses getCommentsForPost method by Comment Service.

+ + + +## Implementation + +```dart +Future getComments() async { + setState(ViewState.busy); + final List commentsJSON = + await _commentService.getCommentsForPost(_postID) as List; + print(commentsJSON); + commentsJSON.forEach((commentJson) { + _commentlist.add(Comment.fromJson(commentJson as Map)); + }); + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/initialise.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/initialise.md new file mode 100644 index 000000000..7515645c5 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/initialise.md @@ -0,0 +1,42 @@ + + + +# initialise method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html) initialise +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) + + + + + + + + +## Implementation + +```dart +Future initialise(String postID) async { + _commentlist = []; + _postID = postID; + _commentService = locator(); + _userConfig = locator(); + _postService = locator(); + notifyListeners(); + await getComments(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/postId.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/postId.md new file mode 100644 index 000000000..fe08747d2 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/CommentsViewModel/postId.md @@ -0,0 +1,35 @@ + + + +# postId property + + + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) postId + + + + + + + + +## Implementation + +```dart +String get postId => _postID; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/view_model_widgets_view_models_comments_view_model-library.md b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/view_model_widgets_view_models_comments_view_model-library.md new file mode 100644 index 000000000..05ca1b659 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_comments_view_model/view_model_widgets_view_models_comments_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# comments_view_model library + + + + + + + + + + + +## Classes + +##### [CommentsViewModel](../view_model_widgets_view_models_comments_view_model/CommentsViewModel-class.md) + + + +CommentsViewModel class helps to serve the data from model +and to react to user's input for Comment Widget. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md new file mode 100644 index 000000000..5379596e0 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md @@ -0,0 +1,269 @@ + + + +# CustomDrawerViewModel class + + + + + + + + + +

CustomDrawerViewModel class helps to serve the data and +to react to user's input for Custom Dialog Widget.

+

Functions include:

+
    +
  • switchOrg
  • +
  • isPresentinSwitchableOrg
  • +
  • setSelectedOrganizationName
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- CustomDrawerViewModel + + + + + + + + +## Constructors + +[CustomDrawerViewModel](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/CustomDrawerViewModel.md) () + + + + +## Properties + +##### [controller](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/controller.md) → [ScrollController](https://api.flutter.dev/flutter/widgets/ScrollController-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [selectedOrg](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/selectedOrg.md) → [OrgInfo](../models_organization_org_info/OrgInfo-class.md)? + + + + +_read-only_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + +##### [switchAbleOrg](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchAbleOrg.md) ↔ [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../models_organization_org_info/OrgInfo-class.md)> + + + + +_read / write_ + + + +##### [targets](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/targets.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html)> + + + + +_final_ + + + +##### [tutorialCoachMark](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/tutorialCoachMark.md) ↔ [TutorialCoachMark](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TutorialCoachMark-class.html) + + + + +_read / write_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/dispose.md)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_override_ + + + +##### [initialize](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/initialize.md)([MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md) homeModel, [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) void + + + + + + + + +##### [isPresentinSwitchableOrg](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/isPresentinSwitchableOrg.md)([OrgInfo](../models_organization_org_info/OrgInfo-class.md) switchToOrg) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +This function checks switchOrg is present in the switchAbleOrg. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/notifyListeners.md)() void + + + +Call all the registered listeners. +_override_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setSelectedOrganizationName](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/setSelectedOrganizationName.md)([OrgInfo](../models_organization_org_info/OrgInfo-class.md) updatedOrganization) void + + + +This function switches the current organization to new organization. + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [switchOrg](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchOrg.md)([OrgInfo](../models_organization_org_info/OrgInfo-class.md) switchToOrg) void + + + +This function switch the current organization to another organization, +if the organization(want switch to) is present. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/CustomDrawerViewModel.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/CustomDrawerViewModel.md new file mode 100644 index 000000000..c3636dcc0 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/CustomDrawerViewModel.md @@ -0,0 +1,24 @@ + + + +# CustomDrawerViewModel constructor + + + + + + + +CustomDrawerViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/controller.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/controller.md new file mode 100644 index 000000000..00b8f4d3b --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/controller.md @@ -0,0 +1,32 @@ + + + +# controller property + + + + + + + +[ScrollController](https://api.flutter.dev/flutter/widgets/ScrollController-class.html) controller + +_final_ + + + + + + +## Implementation + +```dart +final ScrollController controller = ScrollController(); +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/dispose.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/dispose.md new file mode 100644 index 000000000..b73e68485 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/dispose.md @@ -0,0 +1,47 @@ + + + +# dispose method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void dispose +() + +_override_ + + + +

Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed).

+

This method should only be called by the object's owner.

+

This method does not notify listeners, and clears the listener list once +it is called. Consumers of this class must decide on whether to notify +listeners or not immediately before disposal.

+ + + +## Implementation + +```dart +@override +void dispose() { + _disposed = true; + _currentOrganizationStreamSubscription?.cancel(); + super.dispose(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/initialize.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/initialize.md new file mode 100644 index 000000000..8d3d536fe --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/initialize.md @@ -0,0 +1,44 @@ + + + +# initialize method + + + + + + + + +void initialize +([MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md) homeModel, [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + + + + +## Implementation + +```dart +void initialize(MainScreenViewModel homeModel, BuildContext context) { + _currentOrganizationStreamSubscription = + userConfig.currentOrgInfoStream.listen( + (updatedOrganization) { + setSelectedOrganizationName(updatedOrganization); + }, + ); + _currentUser = userConfig.currentUser; + _selectedOrg = userConfig.currentOrg; + _switchAbleOrg = _currentUser.joinedOrganizations!; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/isPresentinSwitchableOrg.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/isPresentinSwitchableOrg.md new file mode 100644 index 000000000..ccf6f13c7 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/isPresentinSwitchableOrg.md @@ -0,0 +1,47 @@ + + + +# isPresentinSwitchableOrg method + + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isPresentinSwitchableOrg +([OrgInfo](../../models_organization_org_info/OrgInfo-class.md) switchToOrg) + + + + + +

This function checks switchOrg is present in the switchAbleOrg.

+

params:

+
    +
  • switchToOrg : OrgInfo type of organization want to switch into.
  • +
+ + + +## Implementation + +```dart +bool isPresentinSwitchableOrg(OrgInfo switchToOrg) { + var isPresent = false; + for (final OrgInfo orgs in switchAbleOrg) { + if (orgs.id == switchToOrg.id) { + isPresent = true; + } + } + return isPresent; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/notifyListeners.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/notifyListeners.md new file mode 100644 index 000000000..1256555b5 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/notifyListeners.md @@ -0,0 +1,51 @@ + + + +# notifyListeners method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void notifyListeners +() + +_override_ + + + +

Call all the registered listeners.

+

Call this method whenever the object changes, to notify any clients the +object may have changed. Listeners that are added during this iteration +will not be visited. Listeners that are removed during this iteration will +not be visited after they are removed.

+

Exceptions thrown by listeners will be caught and reported using +FlutterError.reportError.

+

This method must not be called after dispose has been called.

+

Surprising behavior can result when reentrantly removing a listener (e.g. +in response to a notification) that has been registered multiple times. +See the discussion at removeListener.

+ + + +## Implementation + +```dart +@override +void notifyListeners() { + if (!_disposed) { + super.notifyListeners(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/selectedOrg.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/selectedOrg.md new file mode 100644 index 000000000..55ad05093 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/selectedOrg.md @@ -0,0 +1,35 @@ + + + +# selectedOrg property + + + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)? selectedOrg + + + + + + + + +## Implementation + +```dart +OrgInfo? get selectedOrg => _selectedOrg; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/setSelectedOrganizationName.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/setSelectedOrganizationName.md new file mode 100644 index 000000000..ebc514a5e --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/setSelectedOrganizationName.md @@ -0,0 +1,47 @@ + + + +# setSelectedOrganizationName method + + + + + + + + +void setSelectedOrganizationName +([OrgInfo](../../models_organization_org_info/OrgInfo-class.md) updatedOrganization) + + + + + +

This function switches the current organization to new organization.

+

params:

+
    +
  • updatedOrganization : OrgInfo type, new organization.
  • +
+ + + +## Implementation + +```dart +void setSelectedOrganizationName(OrgInfo updatedOrganization) { + // if current and updated organization are not same. + if (_selectedOrg != updatedOrganization) { + _selectedOrg = updatedOrganization; + // update in `UserConfig` variable. + userConfig.currentOrgInfoController.add(_selectedOrg!); + notifyListeners(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchAbleOrg.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchAbleOrg.md new file mode 100644 index 000000000..604cd6181 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchAbleOrg.md @@ -0,0 +1,54 @@ + + + +# switchAbleOrg property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> switchAbleOrg + + + + + + + + +## Implementation + +```dart +List get switchAbleOrg => _switchAbleOrg; +``` + + + + + +switchAbleOrg= +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)> switchableOrg) + + + + + + + +## Implementation + +```dart +set switchAbleOrg(List switchableOrg) => + _switchAbleOrg = switchableOrg; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchOrg.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchOrg.md new file mode 100644 index 000000000..2cccdb4b7 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/switchOrg.md @@ -0,0 +1,53 @@ + + + +# switchOrg method + + + + + + + + +void switchOrg +([OrgInfo](../../models_organization_org_info/OrgInfo-class.md) switchToOrg) + + + + + +

This function switch the current organization to another organization, +if the organization(want switch to) is present.

+ + + +## Implementation + +```dart +void switchOrg(OrgInfo switchToOrg) { + // if `selectedOrg` is equal to `switchOrg` and `switchToOrg` present or not. + if (selectedOrg == switchToOrg && isPresentinSwitchableOrg(switchToOrg)) { + // _navigationService.pop(); + navigationService.showTalawaErrorSnackBar( + '${switchToOrg.name} already selected', + MessageType.warning, + ); + } else { + userConfig.saveCurrentOrgInHive(switchToOrg); + setSelectedOrganizationName(switchToOrg); + navigationService.showTalawaErrorSnackBar( + 'Switched to ${switchToOrg.name}', + MessageType.info, + ); + } + navigationService.pop(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/targets.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/targets.md new file mode 100644 index 000000000..730ed6ecb --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/targets.md @@ -0,0 +1,32 @@ + + + +# targets property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[TargetFocus](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TargetFocus-class.html)> targets + +_final_ + + + + + + +## Implementation + +```dart +final List targets = []; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/tutorialCoachMark.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/tutorialCoachMark.md new file mode 100644 index 000000000..8267cc6f1 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel/tutorialCoachMark.md @@ -0,0 +1,32 @@ + + + +# tutorialCoachMark property + + + + + + + +[TutorialCoachMark](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/TutorialCoachMark-class.html) tutorialCoachMark + +_read / write_ + + + + + + +## Implementation + +```dart +late TutorialCoachMark tutorialCoachMark; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/view_model_widgets_view_models_custom_drawer_view_model-library.md b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/view_model_widgets_view_models_custom_drawer_view_model-library.md new file mode 100644 index 000000000..f9c890977 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_custom_drawer_view_model/view_model_widgets_view_models_custom_drawer_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# custom_drawer_view_model library + + + + + + + + + + + +## Classes + +##### [CustomDrawerViewModel](../view_model_widgets_view_models_custom_drawer_view_model/CustomDrawerViewModel-class.md) + + + +CustomDrawerViewModel class helps to serve the data and +to react to user's input for Custom Dialog Widget. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_event_card_view_model/view_model_widgets_view_models_event_card_view_model-library.md b/talawa-mobile-docs/view_model_widgets_view_models_event_card_view_model/view_model_widgets_view_models_event_card_view_model-library.md new file mode 100644 index 000000000..40e6bafb6 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_event_card_view_model/view_model_widgets_view_models_event_card_view_model-library.md @@ -0,0 +1,29 @@ + + + + +# event_card_view_model library + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md new file mode 100644 index 000000000..f31499362 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md @@ -0,0 +1,260 @@ + + + +# LikeButtonViewModel class + + + + + + + + + +

LikeButtonViewModel class helps to serve the data and +to react to user's input for Like Button Widget.

+

Methods include:

+
    +
  • toggleIsLiked
  • +
  • setIsLiked
  • +
  • updatePost
  • +
+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- LikeButtonViewModel + + + + + + + + +## Constructors + +[LikeButtonViewModel](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/LikeButtonViewModel.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [isLiked](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/isLiked.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-only_ + + + +##### [likedBy](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likedBy.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../models_post_post_model/LikedBy-class.md)> + + + + +_read-only_ + + + +##### [likesCount](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likesCount.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + + +_read-only_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [checkAndSetTheIsLiked](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/checkAndSetTheIsLiked.md)() void + + + + + + + + +##### [dispose](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/dispose.md)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_override_ + + + +##### [initialize](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/initialize.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../models_post_post_model/LikedBy-class.md)> likedBy, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setIsLiked](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/setIsLiked.md)({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) val = true}) void + + + +This function set _isLike to true. + + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toggleIsLiked](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/toggleIsLiked.md)() void + + + +This function add like to the post if not liked and +remove the like from the post if liked. + + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [updatePost](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/updatePost.md)([Post](../models_post_post_model/Post-class.md) post) void + + + +This function updates the Post. + + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/LikeButtonViewModel.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/LikeButtonViewModel.md new file mode 100644 index 000000000..c6399f1d3 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/LikeButtonViewModel.md @@ -0,0 +1,24 @@ + + + +# LikeButtonViewModel constructor + + + + + + + +LikeButtonViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/checkAndSetTheIsLiked.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/checkAndSetTheIsLiked.md new file mode 100644 index 000000000..067e2a13c --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/checkAndSetTheIsLiked.md @@ -0,0 +1,41 @@ + + + +# checkAndSetTheIsLiked method + + + + + + + + +void checkAndSetTheIsLiked +() + + + + + + + + +## Implementation + +```dart +void checkAndSetTheIsLiked() { + setIsLiked(val: false); + for (var i = 0; i < _likedBy.length; i++) { + if (_likedBy[i].sId == _user.id) { + setIsLiked(); + } + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/dispose.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/dispose.md new file mode 100644 index 000000000..f93ec9beb --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/dispose.md @@ -0,0 +1,46 @@ + + + +# dispose method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void dispose +() + +_override_ + + + +

Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed).

+

This method should only be called by the object's owner.

+

This method does not notify listeners, and clears the listener list once +it is called. Consumers of this class must decide on whether to notify +listeners or not immediately before disposal.

+ + + +## Implementation + +```dart +@override +// ignore: must_call_super +void dispose() { + _updatePostSubscription.cancel(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/initialize.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/initialize.md new file mode 100644 index 000000000..24b3ef3a8 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/initialize.md @@ -0,0 +1,42 @@ + + + +# initialize method + + + + + + + + +void initialize +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../../models_post_post_model/LikedBy-class.md)> likedBy, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID) + + + + + + + + +## Implementation + +```dart +void initialize(List likedBy, String postID) { + _postID = postID; + _user = _userConfig.currentUser; + _likedBy = likedBy; + notifyListeners(); + checkAndSetTheIsLiked(); + _updatePostSubscription = + _postService.updatedPostStream.listen((post) => updatePost(post)); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/isLiked.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/isLiked.md new file mode 100644 index 000000000..e1e07b47d --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/isLiked.md @@ -0,0 +1,35 @@ + + + +# isLiked property + + + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isLiked + + + + + + + + +## Implementation + +```dart +bool get isLiked => _isLiked; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likedBy.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likedBy.md new file mode 100644 index 000000000..d35d176b5 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likedBy.md @@ -0,0 +1,35 @@ + + + +# likedBy property + + + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../../models_post_post_model/LikedBy-class.md)> likedBy + + + + + + + + +## Implementation + +```dart +List get likedBy => _likedBy; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likesCount.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likesCount.md new file mode 100644 index 000000000..8766c21d5 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/likesCount.md @@ -0,0 +1,35 @@ + + + +# likesCount property + + + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) likesCount + + + + + + + + +## Implementation + +```dart +int get likesCount => _likedBy.length; +``` + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/setIsLiked.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/setIsLiked.md new file mode 100644 index 000000000..0f471fd16 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/setIsLiked.md @@ -0,0 +1,38 @@ + + + +# setIsLiked method + + + + + + + + +void setIsLiked +({[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) val = true}) + + + + + +

This function set _isLike to true.

+ + + +## Implementation + +```dart +void setIsLiked({bool val = true}) { + _isLiked = val; + notifyListeners(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/toggleIsLiked.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/toggleIsLiked.md new file mode 100644 index 000000000..02c2ab66e --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/toggleIsLiked.md @@ -0,0 +1,42 @@ + + + +# toggleIsLiked method + + + + + + + + +void toggleIsLiked +() + + + + + +

This function add like to the post if not liked and +remove the like from the post if liked.

+ + + +## Implementation + +```dart +void toggleIsLiked() { + if (!_isLiked) { + _postService.addLike(_postID); + } else { + _postService.removeLike(_postID); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/updatePost.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/updatePost.md new file mode 100644 index 000000000..4076fffea --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel/updatePost.md @@ -0,0 +1,42 @@ + + + +# updatePost method + + + + + + + + +void updatePost +([Post](../../models_post_post_model/Post-class.md) post) + + + + + +

This function updates the Post.

+

params: +post : Post type, the post that need to be updated.

+ + + +## Implementation + +```dart +void updatePost(Post post) { + if (_postID == post.sId) { + _likedBy = post.likedBy!; + checkAndSetTheIsLiked(); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/view_model_widgets_view_models_like_button_view_model-library.md b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/view_model_widgets_view_models_like_button_view_model-library.md new file mode 100644 index 000000000..d178be920 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_like_button_view_model/view_model_widgets_view_models_like_button_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# like_button_view_model library + + + + + + + + + + + +## Classes + +##### [LikeButtonViewModel](../view_model_widgets_view_models_like_button_view_model/LikeButtonViewModel-class.md) + + + +LikeButtonViewModel class helps to serve the data and +to react to user's input for Like Button Widget. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md new file mode 100644 index 000000000..1fb945caa --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md @@ -0,0 +1,208 @@ + + + +# ProgressDialogViewModel class + + + + + + + + + +

ProgressDialogViewModel class helps to serve the data and +to react to user's input for Progress Dialog Widget.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html) +- [BaseModel](../view_model_base_view_model/BaseModel-class.md) +- ProgressDialogViewModel + + + + + + + + +## Constructors + +[ProgressDialogViewModel](../view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/ProgressDialogViewModel.md) () + + + + +## Properties + +##### [connectivityPresent](../view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityPresent.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [connectivityResult](../view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityResult.md) ↔ [ConnectivityResult](https://pub.dev/documentation/connectivity_plus_platform_interface/1.2.4/connectivity_plus_platform_interface/ConnectivityResult.html) + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [hasListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/hasListeners.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether any listeners are currently registered. +_read-onlyinherited_ + + + +##### [isBusy](../view_model_base_view_model/BaseModel/isBusy.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [state](../view_model_base_view_model/BaseModel/state.md) → [ViewState](../enums_enums/ViewState.md) + + + + +_read-onlyinherited_ + + + + + +## Methods + +##### [addListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/addListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Register a closure to be called when the object changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/foundation/ChangeNotifier/dispose.html)() void + + + +Discards any resources used by the object. After this is called, the +object is not in a usable state and should be discarded (calls to +addListener will throw after the object is disposed). +_inherited_ + + + +##### [initialise](../view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/initialise.md)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [notifyListeners](https://api.flutter.dev/flutter/foundation/ChangeNotifier/notifyListeners.html)() void + + + +Call all the registered listeners. +_inherited_ + + + +##### [removeListener](https://api.flutter.dev/flutter/foundation/ChangeNotifier/removeListener.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) listener) void + + + +Remove a previously registered closure from the list of closures that are +notified when the object changes. +_inherited_ + + + +##### [setState](../view_model_base_view_model/BaseModel/setState.md)([ViewState](../enums_enums/ViewState.md) viewState) void + + + + +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/ProgressDialogViewModel.md b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/ProgressDialogViewModel.md new file mode 100644 index 000000000..f59d835a4 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/ProgressDialogViewModel.md @@ -0,0 +1,24 @@ + + + +# ProgressDialogViewModel constructor + + + + + + + +ProgressDialogViewModel() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityPresent.md b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityPresent.md new file mode 100644 index 000000000..db77d704c --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityPresent.md @@ -0,0 +1,32 @@ + + + +# connectivityPresent property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) connectivityPresent + +_read / write_ + + + + + + +## Implementation + +```dart +bool connectivityPresent = false; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityResult.md b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityResult.md new file mode 100644 index 000000000..f3c500a12 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/connectivityResult.md @@ -0,0 +1,32 @@ + + + +# connectivityResult property + + + + + + + +[ConnectivityResult](https://pub.dev/documentation/connectivity_plus_platform_interface/1.2.4/connectivity_plus_platform_interface/ConnectivityResult.html) connectivityResult + +_read / write_ + + + + + + +## Implementation + +```dart +late ConnectivityResult connectivityResult; +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/initialise.md b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/initialise.md new file mode 100644 index 000000000..7389c3d92 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel/initialise.md @@ -0,0 +1,45 @@ + + + +# initialise method + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<void> initialise +() + + + + + + + + +## Implementation + +```dart +Future initialise() async { + setState(ViewState.busy); + connectivityResult = await connectivity.checkConnectivity(); + if (connectivityResult == ConnectivityResult.none) { + connectivityPresent = false; + Future.delayed(const Duration(seconds: 2)) + .then((value) => navigationService.pop()); + } else { + connectivityPresent = true; + } + setState(ViewState.idle); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/view_model_widgets_view_models_progress_dialog_view_model-library.md b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/view_model_widgets_view_models_progress_dialog_view_model-library.md new file mode 100644 index 000000000..51f0ddc22 --- /dev/null +++ b/talawa-mobile-docs/view_model_widgets_view_models_progress_dialog_view_model/view_model_widgets_view_models_progress_dialog_view_model-library.md @@ -0,0 +1,39 @@ + + + + +# progress_dialog_view_model library + + + + + + + + + + + +## Classes + +##### [ProgressDialogViewModel](../view_model_widgets_view_models_progress_dialog_view_model/ProgressDialogViewModel-class.md) + + + +ProgressDialogViewModel class helps to serve the data and +to react to user's input for Progress Dialog Widget. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost-class.md b/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost-class.md new file mode 100644 index 000000000..f61800c2d --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost-class.md @@ -0,0 +1,198 @@ + + + +# AddPost class + + + + + + + + + +

AddPost returns a widget to add(upload) the post.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- AddPost + + + + + + + + +## Constructors + +[AddPost](../views_after_auth_screens_add_post_page/AddPost/AddPost.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[ScaffoldState](https://api.flutter.dev/flutter/material/ScaffoldState-class.html)>? drawerKey}) + + _const_ + + +## Properties + +##### [drawerKey](../views_after_auth_screens_add_post_page/AddPost/drawerKey.md) → [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[ScaffoldState](https://api.flutter.dev/flutter/material/ScaffoldState-class.html)>? + + + +DrawerKey. +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_add_post_page/AddPost/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/AddPost.md b/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/AddPost.md new file mode 100644 index 000000000..a98f0d2a1 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/AddPost.md @@ -0,0 +1,29 @@ + + + +# AddPost constructor + + + + + + +const +AddPost({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, [GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[ScaffoldState](https://api.flutter.dev/flutter/material/ScaffoldState-class.html)>? drawerKey}) + + + + + +## Implementation + +```dart +const AddPost({Key? key, this.drawerKey}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/build.md b/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/build.md new file mode 100644 index 000000000..dc744fe0a --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/build.md @@ -0,0 +1,229 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + // header for the widget + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.9, + centerTitle: true, + // header title + title: Text( + AppLocalizations.of(context)!.strictTranslate('Share News'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + leading: IconButton( + //TODO: showing the null pointer exception + key: const Key('add_post_icon_button1'), + color: Theme.of(context).iconTheme.color, + icon: const Icon(Icons.menu), + onPressed: () => drawerKey!.currentState!.openDrawer(), + ), + // button to upload the post. + actions: [ + TextButton( + key: const Key('add_post_text_btn1'), + onPressed: () => model.uploadPost(), + child: Text( + AppLocalizations.of(context)!.strictTranslate("Post"), + style: Theme.of(context).textTheme.headlineSmall!.copyWith( + fontWeight: FontWeight.w600, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ), + ], + ), + body: BaseView( + onModelReady: (m) { + m.initialise(); + model = m; + }, + builder: (context, model, child) => SingleChildScrollView( + child: Column( + children: [ + ListTile( + leading: const CircleAvatar(radius: 25), + title: Text(model.userName), + subtitle: Text( + AppLocalizations.of(context)!.strictTranslate(model.orgName), + ), + ), + // renders icon button to upload post files. + Row( + children: [ + // button to select the photo from gallery. + IconButton( + key: const Key('add_post_icon_button2'), + onPressed: () => model.getImageFromGallery(), + icon: const Icon(Icons.photo), + ), + // button to capture the image. + IconButton( + key: const Key('add_post_icon_button3'), + onPressed: () => model.getImageFromGallery(camera: true), + icon: const Icon(Icons.camera_alt), + ), + // button to select file + IconButton( + key: const Key('add_post_icon_button4'), + onPressed: () {}, + icon: const Icon(Icons.file_upload), + ), + // button to add hastags to the post. + TextButton( + key: const Key('add_post_text_btn2'), + onPressed: () {}, + child: Text( + '# ${AppLocalizations.of(context)!.strictTranslate("Add hashtag")}', + style: Theme.of(context).textTheme.titleLarge, + ), + ), + ], + ), + const Divider(), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: TextField( + controller: model.titleController, + // input field to write the description of the post. + decoration: InputDecoration( + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + hintText: AppLocalizations.of(context)!.strictTranslate( + "Enter the title of your post", + ), + label: Text( + AppLocalizations.of(context)!.strictTranslate( + "Title", + ), + ), + ), + ), + ), + const Divider(), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: TextField( + controller: model.controller, + maxLines: null, + // input field to write the description of the post. + decoration: InputDecoration( + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + hintText: AppLocalizations.of(context)!.strictTranslate( + "Write here what do you want to share", + ), + ), + ), + ), + // if the image for the post is added then render button to remove it. + model.imageFile != null + // ignore: sized_box_for_whitespace + ? Container( + height: 230, + padding: const EdgeInsets.all(8.0), + child: Stack( + children: [ + Image.file( + model.imageFile!, + fit: BoxFit.cover, + width: MediaQuery.of(context).size.width, + ), + Positioned( + right: 5, + top: 5, + child: IconButton( + onPressed: () => model.removeImage(), + icon: const Icon( + Icons.cancel, + color: Colors.black, + ), + ), + ) + ], + ), + ) + : Container(), + ], + ), + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/drawerKey.md b/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/drawerKey.md new file mode 100644 index 000000000..e50f7f58b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_add_post_page/AddPost/drawerKey.md @@ -0,0 +1,33 @@ + + + +# drawerKey property + + + + + + + +[GlobalKey](https://api.flutter.dev/flutter/widgets/GlobalKey-class.html)<[ScaffoldState](https://api.flutter.dev/flutter/material/ScaffoldState-class.html)>? drawerKey + +_final_ + + + +

DrawerKey.

+ + + +## Implementation + +```dart +final GlobalKey? drawerKey; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_add_post_page/model.md b/talawa-mobile-docs/views_after_auth_screens_add_post_page/model.md new file mode 100644 index 000000000..b885e4796 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_add_post_page/model.md @@ -0,0 +1,36 @@ + + + +# model top-level property + + + + + + + + + +[AddPostViewModel](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md) model + +_read / write_ + + + +

Add Post View Model.

+ + + +## Implementation + +```dart +late AddPostViewModel model; +``` + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_add_post_page/views_after_auth_screens_add_post_page-library.md b/talawa-mobile-docs/views_after_auth_screens_add_post_page/views_after_auth_screens_add_post_page-library.md new file mode 100644 index 000000000..1283c8ee0 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_add_post_page/views_after_auth_screens_add_post_page-library.md @@ -0,0 +1,49 @@ + + + + +# add_post_page library + + + + + + + + + + + +## Classes + +##### [AddPost](../views_after_auth_screens_add_post_page/AddPost-class.md) + + + +AddPost returns a widget to add(upload) the post. + + + + + + +## Properties + +##### [model](../views_after_auth_screens_add_post_page/model.md) ↔ [AddPostViewModel](../view_model_after_auth_view_models_add_post_view_models_add_post_view_model/AddPostViewModel-class.md) + + + +Add Post View Model. +_read / write_ + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage-class.md b/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage-class.md new file mode 100644 index 000000000..b86bb1fbd --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage-class.md @@ -0,0 +1,189 @@ + + + +# AppSettingsPage class + + + + + + + + + +

AppSettingsPage is a widget that has mutable state _AppSettingsPageState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- AppSettingsPage + + + + + + + + +## Constructors + +[AppSettingsPage](../views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/AppSettingsPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/createState.md)() _AppSettingsPageState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/AppSettingsPage.md b/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/AppSettingsPage.md new file mode 100644 index 000000000..cef89c44b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/AppSettingsPage.md @@ -0,0 +1,29 @@ + + + +# AppSettingsPage constructor + + + + + + +const +AppSettingsPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const AppSettingsPage({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/createState.md b/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/createState.md new file mode 100644 index 000000000..f6f01c5f1 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_AppSettingsPageState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_AppSettingsPageState createState() => _AppSettingsPageState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/views_after_auth_screens_app_settings_app_settings_page-library.md b/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/views_after_auth_screens_app_settings_app_settings_page-library.md new file mode 100644 index 000000000..b5eed9934 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_app_settings_app_settings_page/views_after_auth_screens_app_settings_app_settings_page-library.md @@ -0,0 +1,38 @@ + + + + +# app_settings_page library + + + + + + + + + + + +## Classes + +##### [AppSettingsPage](../views_after_auth_screens_app_settings_app_settings_page/AppSettingsPage-class.md) + + + +AppSettingsPage is a widget that has mutable state _AppSettingsPageState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage-class.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage-class.md new file mode 100644 index 000000000..d85f9dd3e --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage-class.md @@ -0,0 +1,190 @@ + + + +# ChatPage class + + + + + + + + + +

ChatPage returns a stateless widget for current user Chat Page which renders +the list of all the users that the current user has chat with.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- ChatPage + + + + + + + + +## Constructors + +[ChatPage](../views_after_auth_screens_chat_chat_list_screen/ChatPage/ChatPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_chat_chat_list_screen/ChatPage/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage/ChatPage.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage/ChatPage.md new file mode 100644 index 000000000..c9653c01c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage/ChatPage.md @@ -0,0 +1,29 @@ + + + +# ChatPage constructor + + + + + + +const +ChatPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const ChatPage({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage/build.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage/build.md new file mode 100644 index 000000000..11b31fb2a --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/ChatPage/build.md @@ -0,0 +1,114 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return DefaultTabController( + length: 2, + child: Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.0, + centerTitle: true, + title: Text( + "Chats", + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + bottom: const TabBar( + tabs: [ + Tab( + text: "Direct", + ), + Tab( + text: "Events", + ), + ], + ), + ), + // returns a tabs on the top for current user to switch between DirectChats and EventChats. + body: const TabBarView( + children: [ + DirectChats(), + EventChats(), + ], + ), + floatingActionButton: FloatingActionButton( + // onPressed to FloatingActionButton renders SelectContact Widget to chat with other users in the connection. + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const SelectContact()), + ); + }, + child: const Icon(Icons.add), + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/views_after_auth_screens_chat_chat_list_screen-library.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/views_after_auth_screens_chat_chat_list_screen-library.md new file mode 100644 index 000000000..fe58d6952 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_list_screen/views_after_auth_screens_chat_chat_list_screen-library.md @@ -0,0 +1,39 @@ + + + + +# chat_list_screen library + + + + + + + + + + + +## Classes + +##### [ChatPage](../views_after_auth_screens_chat_chat_list_screen/ChatPage-class.md) + + + +ChatPage returns a stateless widget for current user Chat Page which renders +the list of all the users that the current user has chat with. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md new file mode 100644 index 000000000..131bed196 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md @@ -0,0 +1,207 @@ + + + +# ChatMessageScreen class + + + + + + + + + +

ChatMessageScreen returns a StatelessWidget for showing the chat message screen.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- ChatMessageScreen + + + + + + + + +## Constructors + +[ChatMessageScreen](../views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/ChatMessageScreen.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId, required [DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model}) + + _const_ + + +## Properties + +##### [chatId](../views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/chatId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [model](../views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/model.md) → [DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/ChatMessageScreen.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/ChatMessageScreen.md new file mode 100644 index 000000000..f6d0c8a5e --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/ChatMessageScreen.md @@ -0,0 +1,30 @@ + + + +# ChatMessageScreen constructor + + + + + + +const +ChatMessageScreen({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId, required [DirectChatViewModel](../../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model}) + + + + + +## Implementation + +```dart +const ChatMessageScreen({Key? key, required this.chatId, required this.model}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/build.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/build.md new file mode 100644 index 000000000..0ba68ed58 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/build.md @@ -0,0 +1,122 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + model.getChatMessages(chatId); + model.chatName(chatId); + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + title: Row( + children: [ + IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () => Navigator.pop(context), + ), + SizedBox(width: SizeConfig.safeBlockHorizontal! * 3), + CircleAvatar( + backgroundColor: Colors.white, + radius: SizeConfig.blockSizeVertical! * 2.3, + ), + SizedBox(width: SizeConfig.safeBlockHorizontal! * 3), + Text('${model.name}'), + ], + ), + ), + body: BaseView( + onModelReady: (model) => model.getChatMessages(chatId), + builder: (context, model, child) => + (Provider.of(context).chatState == + ChatState.complete) + ? Column( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.safeBlockHorizontal! * 3, + ), + child: ListView.builder( + itemCount: model.chatMessagesByUser[chatId]!.length, + itemBuilder: (context, index) { + return Message( + message: + model.chatMessagesByUser[chatId]![index], + ); + }, + ), + ), + ), + ChatInputField(chatId: chatId, model: model), + ], + ) + : const Center( + child: CircularProgressIndicator(), + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/chatId.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/chatId.md new file mode 100644 index 000000000..2dc5c3bec --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/chatId.md @@ -0,0 +1,32 @@ + + + +# chatId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId + +_final_ + + + + + + +## Implementation + +```dart +final String chatId; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/model.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/model.md new file mode 100644 index 000000000..45becc144 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen/model.md @@ -0,0 +1,32 @@ + + + +# model property + + + + + + + +[DirectChatViewModel](../../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model + +_final_ + + + + + + +## Implementation + +```dart +final DirectChatViewModel model; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/views_after_auth_screens_chat_chat_message_screen-library.md b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/views_after_auth_screens_chat_chat_message_screen-library.md new file mode 100644 index 000000000..7ee3f7021 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_chat_message_screen/views_after_auth_screens_chat_chat_message_screen-library.md @@ -0,0 +1,38 @@ + + + + +# chat_message_screen library + + + + + + + + + + + +## Classes + +##### [ChatMessageScreen](../views_after_auth_screens_chat_chat_message_screen/ChatMessageScreen-class.md) + + + +ChatMessageScreen returns a StatelessWidget for showing the chat message screen. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile-class.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile-class.md new file mode 100644 index 000000000..aa7aa3b89 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile-class.md @@ -0,0 +1,207 @@ + + + +# ChatTile class + + + + + + + + + +

ChatTile return a widget for a tile in the list of Direct Chats in the Chat List Screen.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- ChatTile + + + + + + + + +## Constructors + +[ChatTile](../views_after_auth_screens_chat_direct_chats/ChatTile/ChatTile.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [ChatListTileDataModel](../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md) chat, required [DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model}) + + _const_ + + +## Properties + +##### [chat](../views_after_auth_screens_chat_direct_chats/ChatTile/chat.md) → [ChatListTileDataModel](../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [model](../views_after_auth_screens_chat_direct_chats/ChatTile/model.md) → [DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_chat_direct_chats/ChatTile/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/ChatTile.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/ChatTile.md new file mode 100644 index 000000000..d57031896 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/ChatTile.md @@ -0,0 +1,30 @@ + + + +# ChatTile constructor + + + + + + +const +ChatTile({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [ChatListTileDataModel](../../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md) chat, required [DirectChatViewModel](../../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model}) + + + + + +## Implementation + +```dart +const ChatTile({Key? key, required this.chat, required this.model}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/build.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/build.md new file mode 100644 index 000000000..b568e64b0 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/build.md @@ -0,0 +1,78 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return ListTile( + onTap: () => navigationService + .pushScreen(Routes.chatMessageScreen, arguments: [chat.id, model]), + leading: const CircleAvatar( + radius: 20, + ), + title: Text(chat.users![0].firstName!), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/chat.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/chat.md new file mode 100644 index 000000000..f685bdc76 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/chat.md @@ -0,0 +1,32 @@ + + + +# chat property + + + + + + + +[ChatListTileDataModel](../../models_chats_chat_list_tile_data_model/ChatListTileDataModel-class.md) chat + +_final_ + + + + + + +## Implementation + +```dart +final ChatListTileDataModel chat; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/model.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/model.md new file mode 100644 index 000000000..45becc144 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/ChatTile/model.md @@ -0,0 +1,32 @@ + + + +# model property + + + + + + + +[DirectChatViewModel](../../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model + +_final_ + + + + + + +## Implementation + +```dart +final DirectChatViewModel model; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats-class.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats-class.md new file mode 100644 index 000000000..2db88e0c7 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats-class.md @@ -0,0 +1,190 @@ + + + +# DirectChats class + + + + + + + + + +

DirectChats return a statelessWidget for rendering all the directs +chats of the current user in the Chat List Screen

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- DirectChats + + + + + + + + +## Constructors + +[DirectChats](../views_after_auth_screens_chat_direct_chats/DirectChats/DirectChats.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_chat_direct_chats/DirectChats/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats/DirectChats.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats/DirectChats.md new file mode 100644 index 000000000..bacac35ba --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats/DirectChats.md @@ -0,0 +1,29 @@ + + + +# DirectChats constructor + + + + + + +const +DirectChats({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const DirectChats({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats/build.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats/build.md new file mode 100644 index 000000000..13c976ecb --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/DirectChats/build.md @@ -0,0 +1,85 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(), + builder: (context, model, child) { + return ListView.builder( + // key: model.listKey, + itemCount: model.chats.length, + itemBuilder: (context, index) { + return ChatTile( + chat: model.chats[index], + model: model, + ); + }, + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/views_after_auth_screens_chat_direct_chats-library.md b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/views_after_auth_screens_chat_direct_chats-library.md new file mode 100644 index 000000000..f52c976e0 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_direct_chats/views_after_auth_screens_chat_direct_chats-library.md @@ -0,0 +1,46 @@ + + + + +# direct_chats library + + + + + + + + + + + +## Classes + +##### [ChatTile](../views_after_auth_screens_chat_direct_chats/ChatTile-class.md) + + + +ChatTile return a widget for a tile in the list of Direct Chats in the Chat List Screen. + + +##### [DirectChats](../views_after_auth_screens_chat_direct_chats/DirectChats-class.md) + + + +DirectChats return a statelessWidget for rendering all the directs +chats of the current user in the Chat List Screen + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats-class.md b/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats-class.md new file mode 100644 index 000000000..afab3cf58 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats-class.md @@ -0,0 +1,190 @@ + + + +# EventChats class + + + + + + + + + +

EventChats return a statelessWidget for rendering all the events +chats of the current user in the Chat List Screen

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- EventChats + + + + + + + + +## Constructors + +[EventChats](../views_after_auth_screens_chat_event_chats/EventChats/EventChats.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_chat_event_chats/EventChats/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats/EventChats.md b/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats/EventChats.md new file mode 100644 index 000000000..5186b0822 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats/EventChats.md @@ -0,0 +1,29 @@ + + + +# EventChats constructor + + + + + + +const +EventChats({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const EventChats({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats/build.md b/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats/build.md new file mode 100644 index 000000000..0552bb07a --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/EventChats/build.md @@ -0,0 +1,73 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Container( + child: null, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/views_after_auth_screens_chat_event_chats-library.md b/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/views_after_auth_screens_chat_event_chats-library.md new file mode 100644 index 000000000..692360af1 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_event_chats/views_after_auth_screens_chat_event_chats-library.md @@ -0,0 +1,39 @@ + + + + +# event_chats library + + + + + + + + + + + +## Classes + +##### [EventChats](../views_after_auth_screens_chat_event_chats/EventChats-class.md) + + + +EventChats return a statelessWidget for rendering all the events +chats of the current user in the Chat List Screen + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact-class.md b/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact-class.md new file mode 100644 index 000000000..790f504b5 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact-class.md @@ -0,0 +1,189 @@ + + + +# SelectContact class + + + + + + + + + +

SelectContact returns a widget that has mutable state _SelectContactState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- SelectContact + + + + + + + + +## Constructors + +[SelectContact](../views_after_auth_screens_chat_select_contact/SelectContact/SelectContact.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_chat_select_contact/SelectContact/createState.md)() _SelectContactState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact/SelectContact.md b/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact/SelectContact.md new file mode 100644 index 000000000..d896d61fd --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact/SelectContact.md @@ -0,0 +1,29 @@ + + + +# SelectContact constructor + + + + + + +const +SelectContact({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const SelectContact({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact/createState.md b/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact/createState.md new file mode 100644 index 000000000..34529da24 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/SelectContact/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_SelectContactState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_SelectContactState createState() => _SelectContactState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/views_after_auth_screens_chat_select_contact-library.md b/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/views_after_auth_screens_chat_select_contact-library.md new file mode 100644 index 000000000..f924dee20 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_select_contact/views_after_auth_screens_chat_select_contact-library.md @@ -0,0 +1,38 @@ + + + + +# select_contact library + + + + + + + + + + + +## Classes + +##### [SelectContact](../views_after_auth_screens_chat_select_contact/SelectContact-class.md) + + + +SelectContact returns a widget that has mutable state _SelectContactState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md new file mode 100644 index 000000000..8eb646085 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md @@ -0,0 +1,207 @@ + + + +# ChatInputField class + + + + + + + + + +

ChatInputField returns a widget that has mutable state _ChatInputFieldState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- ChatInputField + + + + + + + + +## Constructors + +[ChatInputField](../views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/ChatInputField.md) ({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId, required [DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [chatId](../views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/chatId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +ChatId. +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [model](../views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/model.md) → [DirectChatViewModel](../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) + + + +DirectChatViewModel instance. +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/createState.md)() [State](https://api.flutter.dev/flutter/widgets/State-class.html)<[ChatInputField](../views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md)> + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/ChatInputField.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/ChatInputField.md new file mode 100644 index 000000000..9521860d9 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/ChatInputField.md @@ -0,0 +1,33 @@ + + + +# ChatInputField constructor + + + + + + +const +ChatInputField({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId, required [DirectChatViewModel](../../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const ChatInputField({ + required this.chatId, + required this.model, + Key? key, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/chatId.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/chatId.md new file mode 100644 index 000000000..e2b3e1207 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/chatId.md @@ -0,0 +1,33 @@ + + + +# chatId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) chatId + +_final_ + + + +

ChatId.

+ + + +## Implementation + +```dart +final String chatId; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/createState.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/createState.md new file mode 100644 index 000000000..1d7afc59b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[ChatInputField](../../views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md)> createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +State createState() => _ChatInputFieldState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/model.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/model.md new file mode 100644 index 000000000..3abb558cf --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField/model.md @@ -0,0 +1,33 @@ + + + +# model property + + + + + + + +[DirectChatViewModel](../../view_model_after_auth_view_models_chat_view_models_direct_chat_view_model/DirectChatViewModel-class.md) model + +_final_ + + + +

DirectChatViewModel instance.

+ + + +## Implementation + +```dart +final DirectChatViewModel model; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/views_after_auth_screens_chat_widgets_chat_input_field-library.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/views_after_auth_screens_chat_widgets_chat_input_field-library.md new file mode 100644 index 000000000..bb61c05cc --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_input_field/views_after_auth_screens_chat_widgets_chat_input_field-library.md @@ -0,0 +1,38 @@ + + + + +# chat_input_field library + + + + + + + + + + + +## Classes + +##### [ChatInputField](../views_after_auth_screens_chat_widgets_chat_input_field/ChatInputField-class.md) + + + +ChatInputField returns a widget that has mutable state _ChatInputFieldState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message-class.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message-class.md new file mode 100644 index 000000000..7bb1eb076 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message-class.md @@ -0,0 +1,189 @@ + + + +# Message class + + + + + + + + + +

Message returns a widget for chat message in the bubble form.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- Message + + + + + + + + +## Constructors + +[Message](../views_after_auth_screens_chat_widgets_chat_message_bubble/Message/Message.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [ChatMessage](../models_chats_chat_message/ChatMessage-class.md) message}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_chat_widgets_chat_message_bubble/Message/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message/Message.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message/Message.md new file mode 100644 index 000000000..6f392e748 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message/Message.md @@ -0,0 +1,29 @@ + + + +# Message constructor + + + + + + +const +Message({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [ChatMessage](../../models_chats_chat_message/ChatMessage-class.md) message}) + + + + + +## Implementation + +```dart +const Message({Key? key, required this.message}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message/build.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message/build.md new file mode 100644 index 000000000..824759c16 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/Message/build.md @@ -0,0 +1,117 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + // styling + return Padding( + padding: EdgeInsets.only(top: SizeConfig.safeBlockVertical! * 2), + child: Row( + mainAxisAlignment: + message.sender!.firstName == userConfig.currentUser.firstName + ? MainAxisAlignment.end + : MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.safeBlockHorizontal! * 2, + vertical: SizeConfig.blockSizeVertical! * 1.2, + ), + decoration: BoxDecoration( + // if the message is sent by current user, then the background color will be white else green + color: + message.sender!.firstName == userConfig.currentUser.firstName + ? Colors.white + : Colors.green, + borderRadius: + message.sender!.firstName == userConfig.currentUser.firstName + ? const BorderRadius.only( + bottomRight: Radius.circular(15), + topLeft: Radius.circular(15), + bottomLeft: Radius.circular(15), + ) + : const BorderRadius.only( + bottomRight: Radius.circular(15), + topRight: Radius.circular(15), + bottomLeft: Radius.circular(15), + ), + ), + child: Text( + message.messageContent!, + // if the message is sent by current user, then the text color will be black else theme bodyText color + style: TextStyle( + color: message.sender!.firstName == + userConfig.currentUser.firstName + ? Colors.black + : Theme.of(context).textTheme.bodyLarge!.color, + ), + ), + ), + ], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/views_after_auth_screens_chat_widgets_chat_message_bubble-library.md b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/views_after_auth_screens_chat_widgets_chat_message_bubble-library.md new file mode 100644 index 000000000..7a6b4a4f5 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_chat_widgets_chat_message_bubble/views_after_auth_screens_chat_widgets_chat_message_bubble-library.md @@ -0,0 +1,38 @@ + + + + +# chat_message_bubble library + + + + + + + + + + + +## Classes + +##### [Message](../views_after_auth_screens_chat_widgets_chat_message_bubble/Message-class.md) + + + +Message returns a widget for chat message in the bubble form. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm-class.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm-class.md new file mode 100644 index 000000000..6899a021e --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm-class.md @@ -0,0 +1,199 @@ + + + +# CreateEventForm class + + + + + + + + + +

CreateEventForm returns a widget of a Form for creating events in the organization. +This widget is used in CreateEventPage widget.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CreateEventForm + + + + + + + + +## Constructors + +[CreateEventForm](../views_after_auth_screens_events_create_event_form/CreateEventForm/CreateEventForm.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [CreateEventViewModel](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md) model}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [model](../views_after_auth_screens_events_create_event_form/CreateEventForm/model.md) → [CreateEventViewModel](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_events_create_event_form/CreateEventForm/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/CreateEventForm.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/CreateEventForm.md new file mode 100644 index 000000000..bc499612c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/CreateEventForm.md @@ -0,0 +1,29 @@ + + + +# CreateEventForm constructor + + + + + + +const +CreateEventForm({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [CreateEventViewModel](../../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md) model}) + + + + + +## Implementation + +```dart +const CreateEventForm({Key? key, required this.model}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/build.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/build.md new file mode 100644 index 000000000..4f52a40cc --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/build.md @@ -0,0 +1,194 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + // Form class is a container for grouping together multiple form field widgets. + return Form( + key: model.formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Text field for event title. + TextFormField( + key: const Key('create_event_form_tff1'), + textInputAction: TextInputAction.next, + controller: model.eventTitleTextController, + keyboardType: TextInputType.name, + maxLength: 20, + focusNode: model.titleFocus, + validator: (value) => Validator.validateEventForm(value!, 'Title'), + decoration: InputDecoration( + // placeholder of the text field + labelText: 'Add Event Title', + isDense: true, + labelStyle: Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + counterText: "", + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.title, + size: 25, + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // Text field for the location. + TextFormField( + key: const Key('create_event_form_tff2'), + textInputAction: TextInputAction.next, + keyboardType: TextInputType.streetAddress, + controller: model.eventLocationTextController, + focusNode: model.locationFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Location'), + decoration: InputDecoration( + hintText: 'Where is the event?', + labelText: 'Add Location', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + suffix: GestureDetector( + key: const Key('gesture_cef_test'), + onTap: () => navigationService.pushScreen( + Routes.mapScreen, + arguments: { + 'model': model, + // initalize the map screen with a marker at this location + 'latitude': 37.42796133580664, + 'longitude': -122.085749655962, + }, + ), + child: Text( + AppLocalizations.of(context)! + .strictTranslate('Choose on map'), + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith(fontSize: 16), + ), + ), + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.place, + size: 25, + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // Text field for event description. + TextFormField( + key: const Key('create_event_form_tff3'), + keyboardType: TextInputType.multiline, + controller: model.eventDescriptionTextController, + focusNode: model.descriptionFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Description'), + maxLines: 10, + minLines: 1, + decoration: InputDecoration( + hintText: 'Describe the event', + labelText: 'Add Description', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.view_headline, + size: 25, + ), + ), + ), + ), + ], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/model.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/model.md new file mode 100644 index 000000000..bbf439e81 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/CreateEventForm/model.md @@ -0,0 +1,32 @@ + + + +# model property + + + + + + + +[CreateEventViewModel](../../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md) model + +_final_ + + + + + + +## Implementation + +```dart +final CreateEventViewModel model; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/views_after_auth_screens_events_create_event_form-library.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/views_after_auth_screens_events_create_event_form-library.md new file mode 100644 index 000000000..b2576e320 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_form/views_after_auth_screens_events_create_event_form-library.md @@ -0,0 +1,39 @@ + + + + +# create_event_form library + + + + + + + + + + + +## Classes + +##### [CreateEventForm](../views_after_auth_screens_events_create_event_form/CreateEventForm-class.md) + + + +CreateEventForm returns a widget of a Form for creating events in the organization. +This widget is used in CreateEventPage widget. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage-class.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage-class.md new file mode 100644 index 000000000..eae27c46b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage-class.md @@ -0,0 +1,189 @@ + + + +# CreateEventPage class + + + + + + + + + +

CreateEventPage returns a widget that has mutable state _CreateEventPageState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- CreateEventPage + + + + + + + + +## Constructors + +[CreateEventPage](../views_after_auth_screens_events_create_event_page/CreateEventPage/CreateEventPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_events_create_event_page/CreateEventPage/createState.md)() _CreateEventPageState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage/CreateEventPage.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage/CreateEventPage.md new file mode 100644 index 000000000..3692c4ee9 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage/CreateEventPage.md @@ -0,0 +1,29 @@ + + + +# CreateEventPage constructor + + + + + + +const +CreateEventPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const CreateEventPage({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage/createState.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage/createState.md new file mode 100644 index 000000000..2b79419a3 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/CreateEventPage/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_CreateEventPageState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_CreateEventPageState createState() => _CreateEventPageState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/views_after_auth_screens_events_create_event_page-library.md b/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/views_after_auth_screens_events_create_event_page-library.md new file mode 100644 index 000000000..19a719544 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_create_event_page/views_after_auth_screens_events_create_event_page-library.md @@ -0,0 +1,38 @@ + + + + +# create_event_page library + + + + + + + + + + + +## Classes + +##### [CreateEventPage](../views_after_auth_screens_events_create_event_page/CreateEventPage-class.md) + + + +CreateEventPage returns a widget that has mutable state _CreateEventPageState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage-class.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage-class.md new file mode 100644 index 000000000..612885d7f --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage-class.md @@ -0,0 +1,198 @@ + + + +# EditEventPage class + + + + + + + + + +

EditEventPage returns a widget that has mutable state _EditEventPageState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- EditEventPage + + + + + + + + +## Constructors + +[EditEventPage](../views_after_auth_screens_events_edit_event_page/EditEventPage/EditEventPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Event](../models_events_event_model/Event-class.md) event}) + + _const_ + + +## Properties + +##### [event](../views_after_auth_screens_events_edit_event_page/EditEventPage/event.md) → [Event](../models_events_event_model/Event-class.md) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_events_edit_event_page/EditEventPage/createState.md)() _EditEventPageState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/EditEventPage.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/EditEventPage.md new file mode 100644 index 000000000..101f34c3d --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/EditEventPage.md @@ -0,0 +1,29 @@ + + + +# EditEventPage constructor + + + + + + +const +EditEventPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Event](../../models_events_event_model/Event-class.md) event}) + + + + + +## Implementation + +```dart +const EditEventPage({Key? key, required this.event}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/createState.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/createState.md new file mode 100644 index 000000000..f095ce13c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_EditEventPageState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_EditEventPageState createState() => _EditEventPageState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/event.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/event.md new file mode 100644 index 000000000..9714bc41a --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/EditEventPage/event.md @@ -0,0 +1,32 @@ + + + +# event property + + + + + + + +[Event](../../models_events_event_model/Event-class.md) event + +_final_ + + + + + + +## Implementation + +```dart +final Event event; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/views_after_auth_screens_events_edit_event_page-library.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/views_after_auth_screens_events_edit_event_page-library.md new file mode 100644 index 000000000..03f6aafa3 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_event_page/views_after_auth_screens_events_edit_event_page-library.md @@ -0,0 +1,38 @@ + + + + +# edit_event_page library + + + + + + + + + + + +## Classes + +##### [EditEventPage](../views_after_auth_screens_events_edit_event_page/EditEventPage-class.md) + + + +EditEventPage returns a widget that has mutable state _EditEventPageState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm-class.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm-class.md new file mode 100644 index 000000000..4b944f021 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm-class.md @@ -0,0 +1,199 @@ + + + +# EditEventForm class + + + + + + + + + +

EditEventForm returns a widget of a Form for editing an event. +This widget is used in EditEventPage widget.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- EditEventForm + + + + + + + + +## Constructors + +[EditEventForm](../views_after_auth_screens_events_edit_events_form/EditEventForm/EditEventForm.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [EditEventViewModel](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md) model}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [model](../views_after_auth_screens_events_edit_events_form/EditEventForm/model.md) → [EditEventViewModel](../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_events_edit_events_form/EditEventForm/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/EditEventForm.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/EditEventForm.md new file mode 100644 index 000000000..355dbe36f --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/EditEventForm.md @@ -0,0 +1,29 @@ + + + +# EditEventForm constructor + + + + + + +const +EditEventForm({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [EditEventViewModel](../../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md) model}) + + + + + +## Implementation + +```dart +const EditEventForm({Key? key, required this.model}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/build.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/build.md new file mode 100644 index 000000000..586d7aeea --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/build.md @@ -0,0 +1,188 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + // Form class is a container for grouping together multiple form field widgets. + return Form( + key: model.formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Text field for event title. + TextFormField( + textInputAction: TextInputAction.next, + controller: model.eventTitleTextController, + keyboardType: TextInputType.name, + maxLength: 20, + focusNode: model.titleFocus, + validator: (value) => Validator.validateEventForm(value!, 'Title'), + decoration: InputDecoration( + labelText: 'Add Event Title', + isDense: true, + labelStyle: Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + counterText: "", + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.title, + size: 25, + ), + ), + suffixIcon: IconButton( + onPressed: () { + FocusScope.of(context).requestFocus(model.titleFocus); + }, + icon: const Icon(Icons.edit), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // Text field for the location. + TextFormField( + textInputAction: TextInputAction.next, + keyboardType: TextInputType.streetAddress, + controller: model.eventLocationTextController, + focusNode: model.locationFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Location'), + decoration: InputDecoration( + hintText: 'Where is the event?', + labelText: 'Add Location', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.place, + size: 25, + ), + ), + suffixIcon: IconButton( + onPressed: () { + FocusScope.of(context).requestFocus(model.locationFocus); + }, + icon: const Icon(Icons.edit), + ), + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + // Text field for event description. + TextFormField( + keyboardType: TextInputType.multiline, + controller: model.eventDescriptionTextController, + focusNode: model.descriptionFocus, + validator: (value) => + Validator.validateEventForm(value!, 'Description'), + maxLines: 10, + minLines: 1, + decoration: InputDecoration( + hintText: 'Describe the event', + labelText: 'Add Description', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.view_headline, + size: 25, + ), + ), + suffixIcon: IconButton( + onPressed: () { + FocusScope.of(context).requestFocus(model.descriptionFocus); + }, + icon: const Icon(Icons.edit), + ), + ), + ), + ], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/model.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/model.md new file mode 100644 index 000000000..9cf984beb --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/EditEventForm/model.md @@ -0,0 +1,32 @@ + + + +# model property + + + + + + + +[EditEventViewModel](../../view_model_after_auth_view_models_event_view_models_edit_event_view_model/EditEventViewModel-class.md) model + +_final_ + + + + + + +## Implementation + +```dart +final EditEventViewModel model; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/views_after_auth_screens_events_edit_events_form-library.md b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/views_after_auth_screens_events_edit_events_form-library.md new file mode 100644 index 000000000..a2c383396 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_edit_events_form/views_after_auth_screens_events_edit_events_form-library.md @@ -0,0 +1,39 @@ + + + + +# edit_events_form library + + + + + + + + + + + +## Classes + +##### [EditEventForm](../views_after_auth_screens_events_edit_events_form/EditEventForm-class.md) + + + +EditEventForm returns a widget of a Form for editing an event. +This widget is used in EditEventPage widget. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar-class.md b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar-class.md new file mode 100644 index 000000000..5d56cb4be --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar-class.md @@ -0,0 +1,198 @@ + + + +# EventCalendar class + + + + + + + + + +

EventCalendar returns a widget that has mutable state _EventCalendarState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- EventCalendar + + + + + + + + +## Constructors + +[EventCalendar](../views_after_auth_screens_events_event_calendar/EventCalendar/EventCalendar.md) ([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../models_events_event_model/Event-class.md)> eventList, {[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [eventList](../views_after_auth_screens_events_event_calendar/EventCalendar/eventList.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../models_events_event_model/Event-class.md)> + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_events_event_calendar/EventCalendar/createState.md)() [State](https://api.flutter.dev/flutter/widgets/State-class.html)<[EventCalendar](../views_after_auth_screens_events_event_calendar/EventCalendar-class.md)> + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/EventCalendar.md b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/EventCalendar.md new file mode 100644 index 000000000..65f8fdce0 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/EventCalendar.md @@ -0,0 +1,29 @@ + + + +# EventCalendar constructor + + + + + + +const +EventCalendar([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../../models_events_event_model/Event-class.md)> eventList, {[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const EventCalendar(this.eventList, {Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/createState.md b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/createState.md new file mode 100644 index 000000000..f0a5f419f --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[EventCalendar](../../views_after_auth_screens_events_event_calendar/EventCalendar-class.md)> createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +State createState() => _EventCalendarState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/eventList.md b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/eventList.md new file mode 100644 index 000000000..9fb10e4c0 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/EventCalendar/eventList.md @@ -0,0 +1,32 @@ + + + +# eventList property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../../models_events_event_model/Event-class.md)> eventList + +_final_ + + + + + + +## Implementation + +```dart +final List eventList; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/views_after_auth_screens_events_event_calendar-library.md b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/views_after_auth_screens_events_event_calendar-library.md new file mode 100644 index 000000000..d2022d1c0 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_calendar/views_after_auth_screens_events_event_calendar-library.md @@ -0,0 +1,38 @@ + + + + +# event_calendar library + + + + + + + + + + + +## Classes + +##### [EventCalendar](../views_after_auth_screens_events_event_calendar/EventCalendar-class.md) + + + +EventCalendar returns a widget that has mutable state _EventCalendarState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody-class.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody-class.md new file mode 100644 index 000000000..17d306b07 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody-class.md @@ -0,0 +1,189 @@ + + + +# EventInfoBody class + + + + + + + + + +

EventInfoBody returns a stateless widget which describes the body of a particular event.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- EventInfoBody + + + + + + + + +## Constructors + +[EventInfoBody](../views_after_auth_screens_events_event_info_body/EventInfoBody/EventInfoBody.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_events_event_info_body/EventInfoBody/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody/EventInfoBody.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody/EventInfoBody.md new file mode 100644 index 000000000..f2834782c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody/EventInfoBody.md @@ -0,0 +1,29 @@ + + + +# EventInfoBody constructor + + + + + + +const +EventInfoBody({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const EventInfoBody({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody/build.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody/build.md new file mode 100644 index 000000000..5800dc423 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/EventInfoBody/build.md @@ -0,0 +1,332 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + // fetching the event data from model + final model = Provider.of(context); + final event = model.event; + // Slivers are special-purpose widgets that can be combined using a + //CustomScrollView to create custom scroll effects. A SliverToBoxAdapter + //is a basic sliver that creates a bridge back to one of the usual box-based widgets. + return SliverToBoxAdapter( + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Container( + padding: EdgeInsets.only( + right: SizeConfig.safeBlockHorizontal! * 15, + ), + child: Row( + children: [ + Flexible( + child: Text( + // event title + event.title!, + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith(fontSize: 26), + ), + ), + ], + ), + ), + Positioned( + right: SizeConfig.screenWidth! * 0.002, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + (model.event.creator!.id == userConfig.currentUser.id) + ? IconButton( + onPressed: () => navigationService.pushScreen( + "/editEventPage", + arguments: model.event, + ), + icon: const Icon(Icons.edit), + ) + : Container(), + const Icon(Icons.chat_bubble_outline), + ], + ), + ), + ], + ), + Text( + // Display event creator full name. + "${AppLocalizations.of(context)!.strictTranslate("Created by")}: ${event.creator!.firstName} ${event.creator!.lastName}", + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(fontWeight: FontWeight.w600), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.011, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon( + Icons.calendar_today, + size: 13, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.027, + ), + Text( + // Display start and end date of the Event. + "${event.startDate!} - ${event.endDate!}", + style: Theme.of(context).textTheme.bodySmall, + ), + const Spacer(), + // If event type is public then renders lock_open icon else renders lock icon. + event.isPublic! + ? Icon( + Icons.lock_open, + size: 13, + color: Theme.of(context).colorScheme.secondary, + ) + : Icon( + Icons.lock, + size: 13, + color: Theme.of(context).colorScheme.primary, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.027, + ), + // If event type is public then renders 'public' + // else renders 'private' text translated into the app language. + event.isPublic! + ? Text( + AppLocalizations.of(context)!.strictTranslate('public'), + style: Theme.of(context).textTheme.bodySmall, + ) + : Text( + AppLocalizations.of(context)! + .strictTranslate('private'), + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.011, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // display schedule icon with the start and end date of the time. + const Icon( + Icons.schedule, + size: 12, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.025, + ), + Text( + "${event.startTime!} - ${event.endTime!}", + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.011, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon( + Icons.place, + size: 12, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.027, + ), + Text( + event.location!, + style: Theme.of(context).textTheme.bodySmall, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + maxLines: 3, + ), + const Spacer(), + // If the event location is not null then display the location + //on the map with the reference of latitude and longitude provided for the event. + if (event.latitude != null && event.longitude != null) + GestureDetector( + onTap: () => navigationService.pushScreen( + Routes.mapScreen, + arguments: { + "latitude": event.latitude, + "longitude": event.longitude, + }, + ), + child: Text( + 'View on map', + style: Theme.of(context).textTheme.bodySmall!.copyWith( + color: Theme.of(context).colorScheme.secondary, + ), + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + maxLines: 3, + ), + ), + ], + ), + const Divider(), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + Text( + AppLocalizations.of(context)!.strictTranslate("Description"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 16), + ), + SizedBox(width: SizeConfig.screenWidth! * 0.013), + Text( + // Display the Description of the event if not null. + event.description!, + style: Theme.of(context).textTheme.bodySmall, + ), + SizedBox(height: SizeConfig.screenHeight! * 0.013), + Text( + AppLocalizations.of(context)!.strictTranslate("Admins"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 16), + ), + Divider( + color: Theme.of(context).colorScheme.onBackground, + thickness: 2, + ), + ListView.builder( + padding: EdgeInsets.zero, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: event.admins!.length, + itemBuilder: (BuildContext context, int index) { + return CustomListTile( + key: Key( + '${AppLocalizations.of(context)!.strictTranslate("Admins")}$index', + ), + index: index, + type: TileType.user, + userInfo: event.admins![index], + onTapUserInfo: () {}, + ); + }, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + Text( + AppLocalizations.of(context)!.strictTranslate("Attendees"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 16), + ), + Divider( + color: Theme.of(context).colorScheme.onBackground, + thickness: 2, + ), + if (model.isBusy) + // if the model is still fetching the attendees details then display Circular Progress Indicator Icon. + const Padding( + padding: EdgeInsets.only(top: 12.0), + child: Center(child: CircularProgressIndicator()), + ) + else + // else if the model fetched the attendees details successfully + //then renders all the attendees in ListView. + ListView.builder( + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: model.registrants.length, + itemBuilder: (BuildContext context, int index) { + return CustomListTile( + key: Key( + '${AppLocalizations.of(context)!.strictTranslate("Attendee")}$index', + ), + index: index, + type: TileType.user, + userInfo: model.registrants[index], + onTapUserInfo: () {}, + ); + }, + ) + ], + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/views_after_auth_screens_events_event_info_body-library.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/views_after_auth_screens_events_event_info_body-library.md new file mode 100644 index 000000000..2035b82bd --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_body/views_after_auth_screens_events_event_info_body-library.md @@ -0,0 +1,38 @@ + + + + +# event_info_body library + + + + + + + + + + + +## Classes + +##### [EventInfoBody](../views_after_auth_screens_events_event_info_body/EventInfoBody-class.md) + + + +EventInfoBody returns a stateless widget which describes the body of a particular event. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage-class.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage-class.md new file mode 100644 index 000000000..10ec2c8e7 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage-class.md @@ -0,0 +1,198 @@ + + + +# EventInfoPage class + + + + + + + + + +

EventInfoPage returns a widget that has mutable state _EventInfoPageState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- EventInfoPage + + + + + + + + +## Constructors + +[EventInfoPage](../views_after_auth_screens_events_event_info_page/EventInfoPage/EventInfoPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> args}) + + _const_ + + +## Properties + +##### [args](../views_after_auth_screens_events_event_info_page/EventInfoPage/args.md) → [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_events_event_info_page/EventInfoPage/createState.md)() _EventInfoPageState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/EventInfoPage.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/EventInfoPage.md new file mode 100644 index 000000000..f56297666 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/EventInfoPage.md @@ -0,0 +1,29 @@ + + + +# EventInfoPage constructor + + + + + + +const +EventInfoPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> args}) + + + + + +## Implementation + +```dart +const EventInfoPage({Key? key, required this.args}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/args.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/args.md new file mode 100644 index 000000000..bc15ede0a --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/args.md @@ -0,0 +1,32 @@ + + + +# args property + + + + + + + +[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> args + +_final_ + + + + + + +## Implementation + +```dart +final Map args; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/createState.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/createState.md new file mode 100644 index 000000000..40792cb7f --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/EventInfoPage/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_EventInfoPageState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_EventInfoPageState createState() => _EventInfoPageState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/views_after_auth_screens_events_event_info_page-library.md b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/views_after_auth_screens_events_event_info_page-library.md new file mode 100644 index 000000000..143f14484 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_event_info_page/views_after_auth_screens_events_event_info_page-library.md @@ -0,0 +1,38 @@ + + + + +# event_info_page library + + + + + + + + + + + +## Classes + +##### [EventInfoPage](../views_after_auth_screens_events_event_info_page/EventInfoPage-class.md) + + + +EventInfoPage returns a widget that has mutable state _EventInfoPageState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog-class.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog-class.md new file mode 100644 index 000000000..fd5c8bca4 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog-class.md @@ -0,0 +1,189 @@ + + + +# ExploreEventDialog class + + + + + + + + + +

ExploreEventDialog returns a widget that has mutable state _ExploreEventDialogState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- ExploreEventDialog + + + + + + + + +## Constructors + +[ExploreEventDialog](../views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/ExploreEventDialog.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/createState.md)() _ExploreEventDialogState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/ExploreEventDialog.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/ExploreEventDialog.md new file mode 100644 index 000000000..a932b4294 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/ExploreEventDialog.md @@ -0,0 +1,29 @@ + + + +# ExploreEventDialog constructor + + + + + + +const +ExploreEventDialog({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + + + + +## Implementation + +```dart +const ExploreEventDialog({required Key key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/createState.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/createState.md new file mode 100644 index 000000000..f864e77ec --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_ExploreEventDialogState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_ExploreEventDialogState createState() => _ExploreEventDialogState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/views_after_auth_screens_events_explore_event_dialogue-library.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/views_after_auth_screens_events_explore_event_dialogue-library.md new file mode 100644 index 000000000..d97223d2e --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_event_dialogue/views_after_auth_screens_events_explore_event_dialogue-library.md @@ -0,0 +1,38 @@ + + + + +# explore_event_dialogue library + + + + + + + + + + + +## Classes + +##### [ExploreEventDialog](../views_after_auth_screens_events_explore_event_dialogue/ExploreEventDialog-class.md) + + + +ExploreEventDialog returns a widget that has mutable state _ExploreEventDialogState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents-class.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents-class.md new file mode 100644 index 000000000..31f1fd129 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents-class.md @@ -0,0 +1,207 @@ + + + +# ExploreEvents class + + + + + + + + + +

Shows the list of events with options to categorize them.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- ExploreEvents + + + + + + + + +## Constructors + +[ExploreEvents](../views_after_auth_screens_events_explore_events/ExploreEvents/ExploreEvents.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [homeModel](../views_after_auth_screens_events_explore_events/ExploreEvents/homeModel.md) → [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md)? + + + +homeModal is a type of MainScreenViewModel which provides methods to handle the data for this component. +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_events_explore_events/ExploreEvents/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [dropDownList](../views_after_auth_screens_events_explore_events/ExploreEvents/dropDownList.md)([ExploreEventsViewModel](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) model, [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Shows a list of dropdown taken from model and context. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/ExploreEvents.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/ExploreEvents.md new file mode 100644 index 000000000..8329f47a9 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/ExploreEvents.md @@ -0,0 +1,32 @@ + + + +# ExploreEvents constructor + + + + + + +const +ExploreEvents({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, [MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel}) + + + + + +## Implementation + +```dart +const ExploreEvents({ + required Key key, + this.homeModel, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/build.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/build.md new file mode 100644 index 000000000..fc8416b51 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/build.md @@ -0,0 +1,291 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(), + builder: (context, model, child) { + return Scaffold( + appBar: AppBar( + // AppBar returns widget for the header. + backgroundColor: Theme.of(context).primaryColor, + key: const Key("ExploreEventsAppBar"), + elevation: 0.0, + automaticallyImplyLeading: false, + centerTitle: true, + title: Text( + AppLocalizations.of(context)!.strictTranslate('Explore Events'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + leading: IconButton( + // returns a button of menu icon to redirect to home. + color: Theme.of(context).iconTheme.color, + icon: const Icon(Icons.menu), + onPressed: () => + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(), + ), + actions: [ + Padding( + padding: EdgeInsets.only( + right: SizeConfig.screenWidth! * 0.027, + ), + // if the events is not empty then renders button for searching the events else renders just a box. + child: model.events.isNotEmpty + ? IconButton( + onPressed: () { + showSearch( + context: context, + delegate: EventSearch( + eventList: model.events, + exploreEventsViewModel: model, + ), + ); + }, + icon: const Icon(Icons.search, size: 20), + ) + : const SizedBox(), + ) + ], + ), + // 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()) + : RefreshIndicator( + onRefresh: () async => model.refreshEvents(), + child: Stack( + children: [ + SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.010, + ), + child: Column( + children: [ + Row( + mainAxisAlignment: + 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), + ), + ), + ), + ), + Expanded( + flex: 2, + child: GestureDetector( + onTap: () { + showDialog( + // on tap open the Explore Event Dialog. + context: context, + builder: (_) { + return const ExploreEventDialog( + key: Key('ExploreEvents'), + ); + }, + ); + }, + child: Card( + key: homeModel?.keySEDateFilter, + color: Theme.of(context) + .colorScheme + .onPrimary, + child: Container( + padding: const EdgeInsets.symmetric( + vertical: 12, + ), + // width: SizeConfig.screenWidth! * 0.30, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + const Icon( + Icons.calendar_today, + color: Color(0xff524F4F), + ), + const SizedBox( + width: 8, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate( + "Add Date", + ), + ), + ], + ), + ), + ), + ), + ), + Expanded( + flex: 1, + child: Card( + color: Theme.of(context) + .colorScheme + .onPrimary, + child: IconButton( + onPressed: () { + navigationService.pushScreen( + Routes.calendar, + arguments: model.events, + ); + }, + icon: const Icon( + Icons.calendar_month, + ), + ), + ), + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.027, + ), + // if the events model is empty then renders a box with text as "Empty List" + // else renders lists of the all event tile. + model.events.isEmpty + ? SizedBox( + height: SizeConfig.screenHeight! * 0.5, + child: Center( + child: Text(model.emptyListMessage), + ), + ) + : ListView.builder( + physics: + const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: model.events.length, + itemBuilder: + (BuildContext context, int index) { + return GestureDetector( + onTap: () { + navigationService.pushScreen( + "/eventInfo", + arguments: { + "event": model.events[index], + "exploreEventViewModel": model + }, + ); + }, + child: EventCard( + event: model.events[index], + isSearchItem: false, + ), + ); + }, + ), + ], + ), + ), + ), + ], + ), + ), + floatingActionButton: FloatingActionButton.extended( + key: homeModel?.keySEAdd, + heroTag: "AddEventFab", + backgroundColor: Theme.of(context).colorScheme.background, + onPressed: () { + navigationService.pushScreen( + "/createEventPage", + ); + }, + icon: Icon( + Icons.add, + color: Theme.of(context).colorScheme.secondary, + ), + label: Text( + AppLocalizations.of(context)!.strictTranslate("Event"), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(color: Theme.of(context).colorScheme.secondary), + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/dropDownList.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/dropDownList.md new file mode 100644 index 000000000..ab1c95642 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/dropDownList.md @@ -0,0 +1,71 @@ + + + +# dropDownList method + + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) dropDownList +([ExploreEventsViewModel](../../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) model, [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + +

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
  • +
+ + + +## Implementation + +```dart +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/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/homeModel.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/homeModel.md new file mode 100644 index 000000000..57574b782 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/ExploreEvents/homeModel.md @@ -0,0 +1,33 @@ + + + +# homeModel property + + + + + + + +[MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel + +_final_ + + + +

homeModal is a type of MainScreenViewModel which provides methods to handle the data for this component.

+ + + +## Implementation + +```dart +final MainScreenViewModel? homeModel; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_events_explore_events/views_after_auth_screens_events_explore_events-library.md b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/views_after_auth_screens_events_explore_events-library.md new file mode 100644 index 000000000..0e0ef06ba --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_events_explore_events/views_after_auth_screens_events_explore_events-library.md @@ -0,0 +1,38 @@ + + + + +# explore_events library + + + + + + + + + + + +## Classes + +##### [ExploreEvents](../views_after_auth_screens_events_explore_events/ExploreEvents-class.md) + + + +Shows the list of events with options to categorize them. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate-class.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate-class.md new file mode 100644 index 000000000..fb53308d8 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate-class.md @@ -0,0 +1,198 @@ + + + +# CommentTemplate class + + + + + + + + + +

CommentTemplate returns a widget of the individual user commented on the post.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CommentTemplate + + + + + + + + +## Constructors + +[CommentTemplate](../views_after_auth_screens_feed_individual_post/CommentTemplate/CommentTemplate.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Comment](../models_comment_comment_model/Comment-class.md) comment}) + + _const_ + + +## Properties + +##### [comment](../views_after_auth_screens_feed_individual_post/CommentTemplate/comment.md) → [Comment](../models_comment_comment_model/Comment-class.md) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_feed_individual_post/CommentTemplate/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/CommentTemplate.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/CommentTemplate.md new file mode 100644 index 000000000..03d248913 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/CommentTemplate.md @@ -0,0 +1,32 @@ + + + +# CommentTemplate constructor + + + + + + +const +CommentTemplate({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Comment](../../models_comment_comment_model/Comment-class.md) comment}) + + + + + +## Implementation + +```dart +const CommentTemplate({ + Key? key, + required this.comment, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/build.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/build.md new file mode 100644 index 000000000..06c25c934 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/build.md @@ -0,0 +1,105 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const CircleAvatar(), + Expanded( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).iconTheme.color!.withOpacity(0.2), + borderRadius: const BorderRadius.all(Radius.circular(8)), + ), + padding: const EdgeInsets.all(16.0), + margin: const EdgeInsets.only(left: 8.0, bottom: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 8.0), + child: Text( + "${comment.creator!.firstName!} ${comment.creator!.lastName!}", + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + Text( + comment.text!, + style: Theme.of(context) + .textTheme + .bodyLarge! + .copyWith(fontSize: 16.0), + ), + ], + ), + ), + ) + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/comment.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/comment.md new file mode 100644 index 000000000..c6fe7ea8c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/CommentTemplate/comment.md @@ -0,0 +1,32 @@ + + + +# comment property + + + + + + + +[Comment](../../models_comment_comment_model/Comment-class.md) comment + +_final_ + + + + + + +## Implementation + +```dart +final Comment comment; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection-class.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection-class.md new file mode 100644 index 000000000..9a1ff325d --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection-class.md @@ -0,0 +1,198 @@ + + + +# IndividualPageLikeSection class + + + + + + + + + +

IndividualPageLikeSection returns a widget that show the list of all the users liked the post.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- IndividualPageLikeSection + + + + + + + + +## Constructors + +[IndividualPageLikeSection](../views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/IndividualPageLikeSection.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../models_post_post_model/LikedBy-class.md)> usersLiked}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [usersLiked](../views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/usersLiked.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../models_post_post_model/LikedBy-class.md)> + + + + +_final_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/IndividualPageLikeSection.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/IndividualPageLikeSection.md new file mode 100644 index 000000000..277f839a8 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/IndividualPageLikeSection.md @@ -0,0 +1,32 @@ + + + +# IndividualPageLikeSection constructor + + + + + + +const +IndividualPageLikeSection({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../../models_post_post_model/LikedBy-class.md)> usersLiked}) + + + + + +## Implementation + +```dart +const IndividualPageLikeSection({ + Key? key, + required this.usersLiked, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/build.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/build.md new file mode 100644 index 000000000..3f7bb9e2c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/build.md @@ -0,0 +1,84 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildPadding(context, "Liked by"), + Row( + children: [ + // Looping through the usersLiked list, + for (int i = 0; i < usersLiked.length; i++) + // renders the custom widget for invidual user. + likedUserCircleAvatar(usersLiked[i]) + ], + ), + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/usersLiked.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/usersLiked.md new file mode 100644 index 000000000..6a93bef90 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPageLikeSection/usersLiked.md @@ -0,0 +1,32 @@ + + + +# usersLiked property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[LikedBy](../../models_post_post_model/LikedBy-class.md)> usersLiked + +_final_ + + + + + + +## Implementation + +```dart +final List usersLiked; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md new file mode 100644 index 000000000..ee38a46c9 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md @@ -0,0 +1,207 @@ + + + +# IndividualPostCommentSection class + + + + + + + + + +

IndividualPostCommentSection returns a widget that show the list of all the users commented on the post.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- IndividualPostCommentSection + + + + + + + + +## Constructors + +[IndividualPostCommentSection](../views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/IndividualPostCommentSection.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comments](../models_post_post_model/Comments-class.md)> comments, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID}) + + _const_ + + +## Properties + +##### [comments](../views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/comments.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comments](../models_post_post_model/Comments-class.md)> + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [postID](../views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/postID.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/IndividualPostCommentSection.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/IndividualPostCommentSection.md new file mode 100644 index 000000000..211002b58 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/IndividualPostCommentSection.md @@ -0,0 +1,33 @@ + + + +# IndividualPostCommentSection constructor + + + + + + +const +IndividualPostCommentSection({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comments](../../models_post_post_model/Comments-class.md)> comments, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID}) + + + + + +## Implementation + +```dart +const IndividualPostCommentSection({ + Key? key, + required this.comments, + required this.postID, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/build.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/build.md new file mode 100644 index 000000000..09d6c82d3 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/build.md @@ -0,0 +1,87 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + await model.initialise(postID); + // print(model.commentList.first.creator); + _commentViewModel = model; + }, + builder: (context, model, child) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildPadding(context, "Comments"), + // Looping through the commentList list, + for (int i = 0; i < model.commentList.length; i++) + // renders the custom widget for invidual user. + CommentTemplate(comment: model.commentList[i]) + ], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/comments.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/comments.md new file mode 100644 index 000000000..0276c53d6 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/comments.md @@ -0,0 +1,32 @@ + + + +# comments property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Comments](../../models_post_post_model/Comments-class.md)> comments + +_final_ + + + + + + +## Implementation + +```dart +final List comments; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/postID.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/postID.md new file mode 100644 index 000000000..9e5c5243b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostCommentSection/postID.md @@ -0,0 +1,32 @@ + + + +# postID property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) postID + +_final_ + + + + + + +## Implementation + +```dart +final String postID; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView-class.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView-class.md new file mode 100644 index 000000000..453fc8cf2 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView-class.md @@ -0,0 +1,198 @@ + + + +# IndividualPostView class + + + + + + + + + +

IndividualPostView returns a widget that has mutable state _IndividualPostViewState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- IndividualPostView + + + + + + + + +## Constructors + +[IndividualPostView](../views_after_auth_screens_feed_individual_post/IndividualPostView/IndividualPostView.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Post](../models_post_post_model/Post-class.md) post}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [post](../views_after_auth_screens_feed_individual_post/IndividualPostView/post.md) → [Post](../models_post_post_model/Post-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_feed_individual_post/IndividualPostView/createState.md)() _IndividualPostViewState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/IndividualPostView.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/IndividualPostView.md new file mode 100644 index 000000000..46d963572 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/IndividualPostView.md @@ -0,0 +1,29 @@ + + + +# IndividualPostView constructor + + + + + + +const +IndividualPostView({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Post](../../models_post_post_model/Post-class.md) post}) + + + + + +## Implementation + +```dart +const IndividualPostView({Key? key, required this.post}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/createState.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/createState.md new file mode 100644 index 000000000..dfbb3d183 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_IndividualPostViewState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_IndividualPostViewState createState() => _IndividualPostViewState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/post.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/post.md new file mode 100644 index 000000000..e986becbc --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/IndividualPostView/post.md @@ -0,0 +1,32 @@ + + + +# post property + + + + + + + +[Post](../../models_post_post_model/Post-class.md) post + +_final_ + + + + + + +## Implementation + +```dart +final Post post; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/buildPadding.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/buildPadding.md new file mode 100644 index 000000000..a98749bed --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/buildPadding.md @@ -0,0 +1,44 @@ + + + +# buildPadding function + + + + + + + + + + +[Padding](https://api.flutter.dev/flutter/widgets/Padding-class.html) buildPadding +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) text) + + + + + + + + +## Implementation + +```dart +Padding buildPadding(BuildContext context, String text) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + AppLocalizations.of(context)!.strictTranslate(text), + style: Theme.of(context).textTheme.titleLarge, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/likedUserCircleAvatar.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/likedUserCircleAvatar.md new file mode 100644 index 000000000..fb2e6b9a9 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/likedUserCircleAvatar.md @@ -0,0 +1,62 @@ + + + +# likedUserCircleAvatar function + + + + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) likedUserCircleAvatar +([LikedBy](../models_post_post_model/LikedBy-class.md) user) + + + + + +

likedUserCircleAvatar returns a widget of the individual user liked the post.

+ + + +## Implementation + +```dart +Widget likedUserCircleAvatar(LikedBy user) { + return Padding( + padding: const EdgeInsets.only(right: 10.0, bottom: 16.0), + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.center, + children: [ + const CircleAvatar( + backgroundColor: Color(0xfff2f2f2), + radius: 20, + ), + const Positioned( + top: 30, + right: 0, + bottom: 20, + left: 20, + child: Icon( + Icons.thumb_up, + color: Colors.blue, + size: 20, + ), + ), + ], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md new file mode 100644 index 000000000..1f2f4b615 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_individual_post/views_after_auth_screens_feed_individual_post-library.md @@ -0,0 +1,79 @@ + + + + +# individual_post library + + + + + + + + + + + +## Classes + +##### [CommentTemplate](../views_after_auth_screens_feed_individual_post/CommentTemplate-class.md) + + + +CommentTemplate returns a widget of the individual user commented on the post. + + +##### [IndividualPageLikeSection](../views_after_auth_screens_feed_individual_post/IndividualPageLikeSection-class.md) + + + +IndividualPageLikeSection returns a widget that show the list of all the users liked the post. + + +##### [IndividualPostCommentSection](../views_after_auth_screens_feed_individual_post/IndividualPostCommentSection-class.md) + + + +IndividualPostCommentSection returns a widget that show the list of all the users commented on the post. + + +##### [IndividualPostView](../views_after_auth_screens_feed_individual_post/IndividualPostView-class.md) + + + +IndividualPostView returns a widget that has mutable state _IndividualPostViewState. + + + + + + + +## Functions + +##### [buildPadding](../views_after_auth_screens_feed_individual_post/buildPadding.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) text) [Padding](https://api.flutter.dev/flutter/widgets/Padding-class.html) + + + + + + + + +##### [likedUserCircleAvatar](../views_after_auth_screens_feed_individual_post/likedUserCircleAvatar.md)([LikedBy](../models_post_post_model/LikedBy-class.md) user) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +likedUserCircleAvatar returns a widget of the individual user liked the post. + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md new file mode 100644 index 000000000..8c5de718c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md @@ -0,0 +1,207 @@ + + + +# OrganizationFeed class + + + + + + + + + +

OrganizationFeed returns a widget that shows the feed of the organization.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- OrganizationFeed + + + + + + + + +## Constructors + +[OrganizationFeed](../views_after_auth_screens_feed_organization_feed/OrganizationFeed/OrganizationFeed.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) forTest = false}) + + _const_ + + +## Properties + +##### [forTest](../views_after_auth_screens_feed_organization_feed/OrganizationFeed/forTest.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [homeModel](../views_after_auth_screens_feed_organization_feed/OrganizationFeed/homeModel.md) → [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md)? + + + + +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_feed_organization_feed/OrganizationFeed/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/OrganizationFeed.md b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/OrganizationFeed.md new file mode 100644 index 000000000..553285ef8 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/OrganizationFeed.md @@ -0,0 +1,33 @@ + + + +# OrganizationFeed constructor + + + + + + +const +OrganizationFeed({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, [MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) forTest = false}) + + + + + +## Implementation + +```dart +const OrganizationFeed({ + required Key key, + this.homeModel, + this.forTest = false, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/build.md b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/build.md new file mode 100644 index 000000000..271b6e9d5 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/build.md @@ -0,0 +1,130 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(isTest: forTest), + builder: (context, model, child) { + return Scaffold( + appBar: AppBar( + // AppBar returns a widget for the header of the page. + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.0, + centerTitle: true, + title: Text( + model.currentOrgName, + key: homeModel?.keySHOrgName, + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + leading: IconButton( + key: homeModel?.keySHMenuIcon, + icon: Icon( + Icons.menu, + color: Theme.of(context).iconTheme.color, + ), + onPressed: () => + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(), + ), + ), + // if the model is fetching the data then renders Circular Progress Indicator else renders the result. + body: model.isBusy + ? const CircularProgressIndicator() + : RefreshIndicator( + onRefresh: () async => model.fetchNewPosts(), + child: ListView( + shrinkWrap: true, + children: [ + // If the organization has pinned posts then renders PinnedPostCarousel widget else Container. + model.pinnedPosts.isNotEmpty + ? PinnedPostCarousel( + key: homeModel?.keySHPinnedPost, + pinnedPosts: model.pinnedPosts, + navigateToPinnedPostPage: + model.navigateToPinnedPostPage, + navigateToIndividualPostPage: + model.navigateToIndividualPage, + ) + : Container(), + // If the organization has posts then renders PostListWidget widget else Container. + model.posts.isNotEmpty + ? PostListWidget( + key: homeModel?.keySHPost, + posts: model.posts, + function: model.navigateToIndividualPage, + ) + : Container(), + ], + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/forTest.md b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/forTest.md new file mode 100644 index 000000000..6505e3f01 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/forTest.md @@ -0,0 +1,32 @@ + + + +# forTest property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) forTest + +_final_ + + + + + + +## Implementation + +```dart +final bool forTest; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/homeModel.md b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/homeModel.md new file mode 100644 index 000000000..d7359e061 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/OrganizationFeed/homeModel.md @@ -0,0 +1,32 @@ + + + +# homeModel property + + + + + + + +[MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel + +_final_ + + + + + + +## Implementation + +```dart +final MainScreenViewModel? homeModel; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/views_after_auth_screens_feed_organization_feed-library.md b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/views_after_auth_screens_feed_organization_feed-library.md new file mode 100644 index 000000000..b349ef21b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_organization_feed/views_after_auth_screens_feed_organization_feed-library.md @@ -0,0 +1,38 @@ + + + + +# organization_feed library + + + + + + + + + + + +## Classes + +##### [OrganizationFeed](../views_after_auth_screens_feed_organization_feed/OrganizationFeed-class.md) + + + +OrganizationFeed returns a widget that shows the feed of the organization. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage-class.md b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage-class.md new file mode 100644 index 000000000..03e0b0a90 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage-class.md @@ -0,0 +1,198 @@ + + + +# PinnedPostPage class + + + + + + + + + +

PinnedPostPage returns a widget that shows the list of all the pinned post.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- PinnedPostPage + + + + + + + + +## Constructors + +[PinnedPostPage](../views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/PinnedPostPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> pinnedPosts}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [pinnedPosts](../views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/pinnedPosts.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/PinnedPostPage.md b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/PinnedPostPage.md new file mode 100644 index 000000000..e0f59c0c6 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/PinnedPostPage.md @@ -0,0 +1,29 @@ + + + +# PinnedPostPage constructor + + + + + + +const +PinnedPostPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> pinnedPosts}) + + + + + +## Implementation + +```dart +const PinnedPostPage({Key? key, required this.pinnedPosts}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/build.md b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/build.md new file mode 100644 index 000000000..17efc1768 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/build.md @@ -0,0 +1,87 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + iconTheme: Theme.of(context).iconTheme, + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.0, + title: Text( + AppLocalizations.of(context)!.strictTranslate('Pinned Posts'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + ), + body: ListView( + children: [PostListWidget(posts: pinnedPosts)], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/pinnedPosts.md b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/pinnedPosts.md new file mode 100644 index 000000000..4071846ea --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/PinnedPostPage/pinnedPosts.md @@ -0,0 +1,32 @@ + + + +# pinnedPosts property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> pinnedPosts + +_final_ + + + + + + +## Implementation + +```dart +final List pinnedPosts; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/views_after_auth_screens_feed_pinned_post_page-library.md b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/views_after_auth_screens_feed_pinned_post_page-library.md new file mode 100644 index 000000000..b53b74bc3 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_feed_pinned_post_page/views_after_auth_screens_feed_pinned_post_page-library.md @@ -0,0 +1,38 @@ + + + + +# pinned_post_page library + + + + + + + + + + + +## Classes + +##### [PinnedPostPage](../views_after_auth_screens_feed_pinned_post_page/PinnedPostPage-class.md) + + + +PinnedPostPage returns a widget that shows the list of all the pinned post. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest-class.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest-class.md new file mode 100644 index 000000000..c490c40bc --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest-class.md @@ -0,0 +1,198 @@ + + + +# SendAccessRequest class + + + + + + + + + +

requestAccess

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- SendAccessRequest + + + + + + + + +## Constructors + +[SendAccessRequest](../views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/SendAccessRequest.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [OrgInfo](../models_organization_org_info/OrgInfo-class.md) org}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [org](../views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/org.md) → [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/SendAccessRequest.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/SendAccessRequest.md new file mode 100644 index 000000000..40408e8de --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/SendAccessRequest.md @@ -0,0 +1,33 @@ + + + +# SendAccessRequest constructor + + + + + + +const +SendAccessRequest({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [OrgInfo](../../models_organization_org_info/OrgInfo-class.md) org}) + + + + + +## Implementation + +```dart +const SendAccessRequest({ + Key? key, + required this.org, + // required this.model +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/build.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/build.md new file mode 100644 index 000000000..64d8efdde --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/build.md @@ -0,0 +1,152 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(org), + builder: (context, model, child) { + return SafeArea( + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.transparent, + ), + resizeToAvoidBottomInset: false, + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset('assets/images/Group 8948.png'), + Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "You need access", + style: AppTheme.title.copyWith(color: AppTheme.white), + ), + const SizedBox( + height: 5, + ), + const Text( + "Request access, or switch to an account with access", + ), + const SizedBox( + height: 20, + ), + Container( + child: TextField( + style: const TextStyle(color: AppTheme.blackPrimary), + minLines: 15, + maxLines: 20, + decoration: InputDecoration( + constraints: const BoxConstraints( + maxWidth: 400, + minWidth: 100, + ), + enabledBorder: UnderlineInputBorder( + borderRadius: BorderRadius.circular(20.0), + borderSide: const BorderSide( + width: 3, + color: Colors.white, + ), + ), + hintText: "Message (optional)", + hintStyle: const TextStyle( + color: AppTheme.blackSecondary, + ), + filled: true, + fillColor: AppTheme.white, + ), + ), + ), + ], + ), + ), + Center( + child: TextButton( + onPressed: () { + model.sendMembershipRequest(); + }, + style: + TextButton.styleFrom(backgroundColor: AppTheme.green), + child: const Text( + "Request Access", + style: TextStyle( + color: AppTheme.white, + ), + ), + ), + ) + ], + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/org.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/org.md new file mode 100644 index 000000000..5aa35421b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest/org.md @@ -0,0 +1,32 @@ + + + +# org property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md) org + +_final_ + + + + + + +## Implementation + +```dart +final OrgInfo org; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/views_after_auth_screens_join_org_after_auth_access_request_screen-library.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/views_after_auth_screens_join_org_after_auth_access_request_screen-library.md new file mode 100644 index 000000000..b615cea0e --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_access_request_screen/views_after_auth_screens_join_org_after_auth_access_request_screen-library.md @@ -0,0 +1,38 @@ + + + + +# access_request_screen library + + + + + + + + + + + +## Classes + +##### [SendAccessRequest](../views_after_auth_screens_join_org_after_auth_access_request_screen/SendAccessRequest-class.md) + + + +requestAccess + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md new file mode 100644 index 000000000..dfd63ddc7 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md @@ -0,0 +1,207 @@ + + + +# JoinOrganisationAfterAuth class + + + + + + + + + +

JoinOrganisationAfterAuth returns a widget for page to join the organization just after user authentication.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- JoinOrganisationAfterAuth + + + + + + + + +## Constructors + +[JoinOrganisationAfterAuth](../views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/JoinOrganisationAfterAuth.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [orgId](../views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/orgId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [scanQR](../views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/scanQR.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [SelectOrganizationViewModel](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) model) void + + + +scanQR returns a widget that is use in joining the organization via the QR code. + + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/JoinOrganisationAfterAuth.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/JoinOrganisationAfterAuth.md new file mode 100644 index 000000000..1b9db464b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/JoinOrganisationAfterAuth.md @@ -0,0 +1,30 @@ + + + +# JoinOrganisationAfterAuth constructor + + + + + + +const +JoinOrganisationAfterAuth({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId}) + + + + + +## Implementation + +```dart +const JoinOrganisationAfterAuth({Key? key, required this.orgId}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/build.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/build.md new file mode 100644 index 000000000..b5cbaa0c5 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/build.md @@ -0,0 +1,123 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(orgId), + builder: (context, model, child) { + return Scaffold( + key: const Key('JoinOrgScreen'), + // header for the widget + appBar: AppBar( + centerTitle: true, + // title of the header. + title: Text( + AppLocalizations.of(context)! + .strictTranslate('Join Organisation'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + // action button for the option to join the organization using QR code. + actions: [ + IconButton( + icon: const Icon( + Icons.qr_code_scanner, + size: 30, + semanticLabel: 'Join Organisation with QR', + ), + onPressed: () => scanQR(context, model), + ), + ], + ), + body: Column( + children: [ + const Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0), + child: Divider( + color: Colors.grey, + thickness: 2.0, + ), + ), + Expanded( + // if model searching is under process then renders OrganizationSearchList widget + // else renders OrganizationList widget. + child: model.searching + ? OrganizationSearchList(model: model) + : OrganizationList(model: model), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + ], + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/orgId.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/orgId.md new file mode 100644 index 000000000..317117668 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/orgId.md @@ -0,0 +1,32 @@ + + + +# orgId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) orgId + +_final_ + + + + + + +## Implementation + +```dart +final String orgId; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/scanQR.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/scanQR.md new file mode 100644 index 000000000..f660938f2 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth/scanQR.md @@ -0,0 +1,89 @@ + + + +# scanQR method + + + + + + + + +void scanQR +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [SelectOrganizationViewModel](../../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) model) + + + + + +

scanQR returns a widget that is use in joining the organization via the QR code.

+ + + +## Implementation + +```dart +void scanQR(BuildContext context, SelectOrganizationViewModel model) { + showModalBottomSheet( + context: context, + barrierColor: Colors.transparent, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + builder: (BuildContext context) { + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: Container( + height: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondary, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 250, + width: 250, + child: QRView( + key: model.qrKey, + onQRViewCreated: (controller) => + _onQRViewCreated(controller, model), + overlay: QrScannerOverlayShape( + overlayColor: Theme.of(context).colorScheme.secondary, + borderRadius: 10, + borderLength: 20, + borderWidth: 10, + cutOutSize: 250, + ), + /*overlayMargin: EdgeInsets.all(50)*/ + ), + ), + SizedBox( + height: SizeConfig.safeBlockVertical! * 4, + ), + const Text('Scan QR'), + SizedBox( + height: SizeConfig.safeBlockVertical! * 4, + ) + ], + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth-library.md b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth-library.md new file mode 100644 index 000000000..d7987c80f --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/views_after_auth_screens_join_org_after_auth_join_organisation_after_auth-library.md @@ -0,0 +1,38 @@ + + + + +# join_organisation_after_auth library + + + + + + + + + + + +## Classes + +##### [JoinOrganisationAfterAuth](../views_after_auth_screens_join_org_after_auth_join_organisation_after_auth/JoinOrganisationAfterAuth-class.md) + + + +JoinOrganisationAfterAuth returns a widget for page to join the organization just after user authentication. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage-class.md b/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage-class.md new file mode 100644 index 000000000..62aad1769 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage-class.md @@ -0,0 +1,189 @@ + + + +# EditProfilePage class + + + + + + + + + +

EditProfilePage returns a widget that has mutable state _EditProfilePageState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- EditProfilePage + + + + + + + + +## Constructors + +[EditProfilePage](../views_after_auth_screens_profile_edit_profile_page/EditProfilePage/EditProfilePage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_profile_edit_profile_page/EditProfilePage/createState.md)() _EditProfilePageState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage/EditProfilePage.md b/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage/EditProfilePage.md new file mode 100644 index 000000000..54f963a39 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage/EditProfilePage.md @@ -0,0 +1,29 @@ + + + +# EditProfilePage constructor + + + + + + +const +EditProfilePage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const EditProfilePage({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage/createState.md b/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage/createState.md new file mode 100644 index 000000000..cb46e96d3 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/EditProfilePage/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_EditProfilePageState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_EditProfilePageState createState() => _EditProfilePageState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/views_after_auth_screens_profile_edit_profile_page-library.md b/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/views_after_auth_screens_profile_edit_profile_page-library.md new file mode 100644 index 000000000..84dd71907 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_edit_profile_page/views_after_auth_screens_profile_edit_profile_page-library.md @@ -0,0 +1,38 @@ + + + + +# edit_profile_page library + + + + + + + + + + + +## Classes + +##### [EditProfilePage](../views_after_auth_screens_profile_edit_profile_page/EditProfilePage-class.md) + + + +EditProfilePage returns a widget that has mutable state _EditProfilePageState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage-class.md b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage-class.md new file mode 100644 index 000000000..83715717f --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage-class.md @@ -0,0 +1,207 @@ + + + +# ProfilePage class + + + + + + + + + +

ProfilePage returns a widget that renders a page of user's profile.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- ProfilePage + + + + + + + + +## Constructors + +[ProfilePage](../views_after_auth_screens_profile_profile_page/ProfilePage/ProfilePage.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [homeModel](../views_after_auth_screens_profile_profile_page/ProfilePage/homeModel.md) → [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md)? + + + + +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_profile_profile_page/ProfilePage/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [donate](../views_after_auth_screens_profile_profile_page/ProfilePage/donate.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [ProfilePageViewModel](../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md) model) void + + + + + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/ProfilePage.md b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/ProfilePage.md new file mode 100644 index 000000000..200752360 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/ProfilePage.md @@ -0,0 +1,32 @@ + + + +# ProfilePage constructor + + + + + + +const +ProfilePage({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, [MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel}) + + + + + +## Implementation + +```dart +const ProfilePage({ + required Key key, + this.homeModel, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/build.md b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/build.md new file mode 100644 index 000000000..b4a084ed5 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/build.md @@ -0,0 +1,322 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return Scaffold( + key: model.scaffoldKey, + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + elevation: 0.0, + centerTitle: true, + leading: IconButton( + color: Theme.of(context).iconTheme.color, + icon: const Icon(Icons.menu), + onPressed: () => + MainScreenViewModel.scaffoldKey.currentState!.openDrawer(), + ), + key: const Key("ProfilePageAppBar"), + title: Text( + AppLocalizations.of(context)!.strictTranslate('Profile'), + style: Theme.of(context).textTheme.titleLarge!.copyWith( + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + ), + // if data fetching is under process then renders Circular Progress Icon + // else renders the widget. + body: model.isBusy + ? const CircularProgressIndicator() + : SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: SizeConfig.screenHeight! * 0.01, + ), + CustomListTile( + key: const Key('OptionEditProfile'), + index: 0, + type: TileType.option, + option: Options( + // Avatar + icon: CustomAvatar( + isImageNull: model.currentUser.image == null, + firstAlphabet: + model.currentUser.firstName!.substring(0, 1), + imageUrl: model.currentUser.image, + fontSize: Theme.of(context) + .textTheme + .titleLarge! + .fontSize, + ), + // display first and last name. + title: + '${model.currentUser.firstName!} ${model.currentUser.lastName!}', + // display email address + subtitle: model.currentUser.email!, + // button to edit the profile which redirects to edit profile page. + trailingIconButton: IconButton( + icon: Icon( + Icons.drive_file_rename_outline, + color: Theme.of(context).colorScheme.secondary, + ), + onPressed: () { + navigationService.pushScreen("/editProfilePage"); + }, + ), + ), + onTapOption: () {}, + ), + const Divider( + thickness: 1, // thickness of the line + indent: + 20, // empty space to the leading edge of divider. + endIndent: + 20, // empty space to the trailing edge of the divider. + color: Colors + .black26, // The color to use when painting the line. + height: 20, // + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.67, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: SizeConfig.screenHeight! * 0.01, + ), + CustomListTile( + key: homeModel!.keySPAppSetting, + index: 0, + type: TileType.option, + option: Options( + icon: Icon( + Icons.phonelink_setup, + color: + Theme.of(context).colorScheme.secondary, + size: 30, + ), + // title for App Settings. + title: AppLocalizations.of(context)! + .strictTranslate('App Settings'), + // display language of the app. + subtitle: + '${AppLocalizations.of(context)!.strictTranslate("Language")}, ${AppLocalizations.of(context)!.strictTranslate("dark mode")}, ${AppLocalizations.of(context)!.strictTranslate("font size")}', + ), + // button for the app setting which redirects to app setting page. + onTapOption: () { + navigationService + .pushScreen("/appSettingsPage"); + }, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + CustomListTile( + key: const Key('TasksByUser'), + index: 1, + type: TileType.option, + option: Options( + icon: Icon( + Icons.task_outlined, + color: + Theme.of(context).colorScheme.secondary, + size: 30, + ), + // title for My Tasks tile + title: AppLocalizations.of(context)! + .strictTranslate('My Tasks'), + // display subtitle + subtitle: AppLocalizations.of(context)! + .strictTranslate( + "View and edit all tasks created by you", + ), + ), + // on tag redirects to the user Tasks page. + onTapOption: () { + navigationService.pushScreen(Routes.userTasks); + }, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + // // Will be added later when we add the Help Section in Documentation. + // CustomListTile( + // key: homeModel!.keySPHelp, + // index: 1, + // type: TileType.option, + // option: Options( + // icon: const Icon( + // Icons.help_outline, + // size: 30, + // ), + // title: AppLocalizations.of(context)! + // .strictTranslate('Help'), + // subtitle: AppLocalizations.of(context)! + // .strictTranslate( + // 'Reach out to us for help', + // ), + // ), + // onTapOption: () {}, + // ), + /// `Donation` acts as plugin. If visible is true the it will be always visible. + /// even if it's uninstalled by the admin (for development purposes) + TalawaPluginProvider( + pluginName: "Donation", + visible: true, + child: Column( + children: [ + CustomListTile( + key: homeModel!.keySPDonateUs, + index: 2, + type: TileType.option, + option: Options( + icon: Icon( + Icons.monetization_on, + color: Theme.of(context) + .colorScheme + .secondary, + size: 30, + ), + title: AppLocalizations.of(context)! + .strictTranslate('Donate Us'), + subtitle: AppLocalizations.of(context)! + .strictTranslate( + 'Help us to develop for you', + ), + ), + onTapOption: () => donate(context, model), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + ], + ), + ), + // custom tile for Invitation. + CustomListTile( + key: homeModel!.keySPInvite, + index: 3, + type: TileType.option, + option: Options( + icon: Icon( + Icons.share, + color: + Theme.of(context).colorScheme.secondary, + size: 30, + ), + // title + title: AppLocalizations.of(context)! + .strictTranslate('Invite'), + // subtitle + subtitle: AppLocalizations.of(context)! + .strictTranslate('Invite to org'), + ), + // on tap call the invite function + onTapOption: () => model.invite(context), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + // Custom tile for Logout option. + CustomListTile( + key: homeModel!.keySPLogout, + index: 3, + type: TileType.option, + option: Options( + icon: Icon( + Icons.logout, + color: + Theme.of(context).colorScheme.secondary, + size: 30, + ), + title: AppLocalizations.of(context)! + .strictTranslate('Log out'), + subtitle: AppLocalizations.of(context)! + .strictTranslate('Log out from Talawa'), + ), + // on tap calls the logout function + onTapOption: () => model.logout(context), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.05, + ), + FromPalisadoes(key: homeModel!.keySPPalisadoes), + ], + ), + ) + ], + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/donate.md b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/donate.md new file mode 100644 index 000000000..32bb9a58e --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/donate.md @@ -0,0 +1,302 @@ + + + +# donate method + + + + + + + + +void donate +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [ProfilePageViewModel](../../view_model_after_auth_view_models_profile_view_models_profile_page_view_model/ProfilePageViewModel-class.md) model) + + + + + + + + +## Implementation + +```dart +void donate(BuildContext context, ProfilePageViewModel model) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + builder: (BuildContext context) { + return StatefulBuilder( + builder: (context, setState) { + model.attachListener(setState); + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: SizedBox( + height: model.bottomSheetHeight, + child: Scaffold( + // background color set to Primary + backgroundColor: + Theme.of(context).colorScheme.primaryContainer, + // header + appBar: AppBar( + centerTitle: true, + automaticallyImplyLeading: false, + backgroundColor: Colors.transparent, + elevation: 0.0, + toolbarHeight: SizeConfig.screenHeight! * 0.15, + title: Padding( + padding: const EdgeInsets.only(top: 8.0), + // display title + child: Text( + 'Donating to \n${model.currentOrg.name}', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith(fontSize: 24), + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + ), + actions: [ + Padding( + padding: EdgeInsets.only( + right: 8.0, + top: SizeConfig.screenHeight! * 0.01, + ), + child: IconButton( + icon: Icon( + Icons.cancel, + color: Theme.of(context).colorScheme.primary, + ), + onPressed: model.popBottomSheet, + ), + ) + ], + ), + body: SingleChildScrollView( + // SingleChildScrollView is a box in which a single widget can be scrolled. + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + Text( + 'Please Select and amount', + style: Theme.of(context).textTheme.headlineSmall, + ), + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // looping through and renders button for donation amounts. + children: List.generate( + 3, + (index) => model.dominationButton( + model.denomination[index], + context, + setState, + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + Text( + 'Or', + style: Theme.of(context).textTheme.headlineSmall, + ), + Text( + 'Input custom amount', + style: Theme.of(context).textTheme.headlineSmall, + ), + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + // containers for custom amount + Container( + padding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.05, + ), + child: TextField( + controller: model.donationAmount, + focusNode: model.donationField, + textInputAction: TextInputAction.next, + keyboardType: TextInputType.number, + autofillHints: const [AutofillHints.email], + enableSuggestions: true, + style: Theme.of(context).textTheme.titleLarge, + onChanged: (text) { + setState(() {}); + }, + decoration: InputDecoration( + hintText: AppLocalizations.of(context)! + .translate("Enter donation amount"), + labelText: AppLocalizations.of(context)! + .translate("Enter custom donation amount"), + labelStyle: + Theme.of(context).textTheme.titleMedium, + prefixIcon: GestureDetector( + onTap: () { + model.changeCurrency(context, setState); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 15.0, + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + model.donationCurrency, + textAlign: TextAlign.center, + style: Theme.of(context) + .textTheme + .headlineSmall, + ), + const Icon( + Icons.arrow_drop_down_circle_outlined, + ) + ], + ), + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: const BorderRadius.all( + Radius.circular(12.0), + ), + borderSide: BorderSide( + color: + Theme.of(context).colorScheme.secondary, + width: 2, + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: const BorderRadius.all( + Radius.circular(10.0), + ), + borderSide: BorderSide( + color: + Theme.of(context).colorScheme.secondary, + ), + ), + ), + ), + ), + SizedBox( + height: SizeConfig.screenWidth! * 0.05, + ), + ElevatedButton( + onPressed: () async { + ///required fields for donation transaction + late final String userId; + late final String orgId; + late final String nameOfOrg; + late final String nameOfUser; + late final String payPalId; + late final double amount; + orgId = model.currentOrg.id!; + userId = model.currentUser.id!; + nameOfUser = + "${model.currentUser.firstName!} ${model.currentUser.lastName!}"; + nameOfOrg = model.currentOrg.name!; + + amount = double.parse(model.donationAmount.text); + final request = BraintreeDropInRequest( + tokenizationKey: + '', + collectDeviceData: true, + paypalRequest: BraintreePayPalRequest( + amount: model.donationAmount.text, + displayName: "Talawa", + ), + cardEnabled: true, + ); + + final BraintreeDropInResult? result = + await BraintreeDropIn.start(request); + if (result != null) { + ///saving the donation in server + late final GraphQLClient client = + graphqlConfig.clientToQuery(); + + ///getting transaction id from `brainTree` API + payPalId = result.paymentMethodNonce.nonce; + + final QueryResult donationResult = + await client.mutate( + MutationOptions( + document: gql( + queries.createDonation( + userId, + orgId, + nameOfOrg, + nameOfUser, + payPalId, + amount, + ), + ), + ), + ); + if (donationResult.hasException) { + model.showSnackBar( + "Error occurred while making a donation", + ); + } + + /// hiding the donation UI once it is successful + model.popBottomSheet(); + model.showSnackBar( + 'Donation Successful,Thanks for the support !', + ); + } + }, + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + // if the donation amount entered or selected is empty then renders grey color + // else render primary color + model.donationAmount.text.isEmpty + ? Colors.grey + : Theme.of(context).colorScheme.primary, + ), + ), + child: Text( + 'DONATE', + style: Theme.of(context).textTheme.labelLarge, + ), + ) + ], + ), + ), + ), + ), + ); + }, + ); + }, + ).then((value) => model.updateSheetHeight()); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/homeModel.md b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/homeModel.md new file mode 100644 index 000000000..d7359e061 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/ProfilePage/homeModel.md @@ -0,0 +1,32 @@ + + + +# homeModel property + + + + + + + +[MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md)? homeModel + +_final_ + + + + + + +## Implementation + +```dart +final MainScreenViewModel? homeModel; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/views_after_auth_screens_profile_profile_page-library.md b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/views_after_auth_screens_profile_profile_page-library.md new file mode 100644 index 000000000..7d8218ef7 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_profile_profile_page/views_after_auth_screens_profile_profile_page-library.md @@ -0,0 +1,38 @@ + + + + +# profile_page library + + + + + + + + + + + +## Classes + +##### [ProfilePage](../views_after_auth_screens_profile_profile_page/ProfilePage-class.md) + + + +ProfilePage returns a widget that renders a page of user's profile. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage-class.md b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage-class.md new file mode 100644 index 000000000..c14032295 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage-class.md @@ -0,0 +1,198 @@ + + + +# CreateTaskPage class + + + + + + + + + +

CreateTaskPage returns a widget for page to create task for the user.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CreateTaskPage + + + + + + + + +## Constructors + +[CreateTaskPage](../views_after_auth_screens_tasks_create_task_page/CreateTaskPage/CreateTaskPage.md) ({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [eventId](../views_after_auth_screens_tasks_create_task_page/CreateTaskPage/eventId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_tasks_create_task_page/CreateTaskPage/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/CreateTaskPage.md b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/CreateTaskPage.md new file mode 100644 index 000000000..67c1b703b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/CreateTaskPage.md @@ -0,0 +1,29 @@ + + + +# CreateTaskPage constructor + + + + + + +const +CreateTaskPage({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const CreateTaskPage({required this.eventId, Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/build.md b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/build.md new file mode 100644 index 000000000..b173c4741 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/build.md @@ -0,0 +1,80 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + builder: (context, model, _) { + // renders custom widget TaskForm, you can explore TaskForm widget [here](/widgets/task_form.dart). + return TaskForm( + onSave: () => model.createTask(eventId), + title: 'Create Task', + actionText: 'Add', + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/eventId.md b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/eventId.md new file mode 100644 index 000000000..4ca1b3890 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/CreateTaskPage/eventId.md @@ -0,0 +1,32 @@ + + + +# eventId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId + +_final_ + + + + + + +## Implementation + +```dart +final String eventId; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/views_after_auth_screens_tasks_create_task_page-library.md b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/views_after_auth_screens_tasks_create_task_page-library.md new file mode 100644 index 000000000..e30821a17 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_create_task_page/views_after_auth_screens_tasks_create_task_page-library.md @@ -0,0 +1,38 @@ + + + + +# create_task_page library + + + + + + + + + + + +## Classes + +##### [CreateTaskPage](../views_after_auth_screens_tasks_create_task_page/CreateTaskPage-class.md) + + + +CreateTaskPage returns a widget for page to create task for the user. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage-class.md b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage-class.md new file mode 100644 index 000000000..8a8ff4c7f --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage-class.md @@ -0,0 +1,198 @@ + + + +# EditTaskPage class + + + + + + + + + +

EditTaskPage returns a widget for page to edit the task for the user.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- EditTaskPage + + + + + + + + +## Constructors + +[EditTaskPage](../views_after_auth_screens_tasks_edit_task_page/EditTaskPage/EditTaskPage.md) ({required [Task](../models_task_task_model/Task-class.md) task, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [task](../views_after_auth_screens_tasks_edit_task_page/EditTaskPage/task.md) → [Task](../models_task_task_model/Task-class.md) + + + + +_final_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_tasks_edit_task_page/EditTaskPage/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/EditTaskPage.md b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/EditTaskPage.md new file mode 100644 index 000000000..204de2133 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/EditTaskPage.md @@ -0,0 +1,29 @@ + + + +# EditTaskPage constructor + + + + + + +const +EditTaskPage({required [Task](../../models_task_task_model/Task-class.md) task, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const EditTaskPage({required this.task, Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/build.md b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/build.md new file mode 100644 index 000000000..35493bb5b --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/build.md @@ -0,0 +1,81 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.fillTask(task), + builder: (context, model, _) { + // renders custom widget TaskForm, you can explore TaskForm widget [here](/widgets/task_form.dart). + return TaskForm( + onSave: () => model.editTask(task.id), + title: 'Edit Task', + actionText: 'Update', + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/task.md b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/task.md new file mode 100644 index 000000000..3cf99076f --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/EditTaskPage/task.md @@ -0,0 +1,32 @@ + + + +# task property + + + + + + + +[Task](../../models_task_task_model/Task-class.md) task + +_final_ + + + + + + +## Implementation + +```dart +final Task task; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/views_after_auth_screens_tasks_edit_task_page-library.md b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/views_after_auth_screens_tasks_edit_task_page-library.md new file mode 100644 index 000000000..58b4e96c1 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_edit_task_page/views_after_auth_screens_tasks_edit_task_page-library.md @@ -0,0 +1,38 @@ + + + + +# edit_task_page library + + + + + + + + + + + +## Classes + +##### [EditTaskPage](../views_after_auth_screens_tasks_edit_task_page/EditTaskPage-class.md) + + + +EditTaskPage returns a widget for page to edit the task for the user. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage-class.md b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage-class.md new file mode 100644 index 000000000..25f2d41a0 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage-class.md @@ -0,0 +1,198 @@ + + + +# EventTasksPage class + + + + + + + + + +

EventTasksPage return a widget for Event Task Page that is created by event creator.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- EventTasksPage + + + + + + + + +## Constructors + +[EventTasksPage](../views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/EventTasksPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId}) + + _const_ + + +## Properties + +##### [eventId](../views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/eventId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/EventTasksPage.md b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/EventTasksPage.md new file mode 100644 index 000000000..fcfe45d50 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/EventTasksPage.md @@ -0,0 +1,29 @@ + + + +# EventTasksPage constructor + + + + + + +const +EventTasksPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId}) + + + + + +## Implementation + +```dart +const EventTasksPage({Key? key, required this.eventId}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/build.md b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/build.md new file mode 100644 index 000000000..a5fc7f839 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/build.md @@ -0,0 +1,95 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.fetchTasks(eventId), + builder: (_, model, __) { + final tasks = model.tasks; + return RefreshIndicator( + onRefresh: () => model.fetchTasks(eventId), + child: Scaffold( + appBar: AppBar( + title: const Text('Event Tasks'), + ), + // TaskSchedule is custom widget. + body: TaskSchedule(tasks: tasks), + floatingActionButton: FloatingActionButton( + onPressed: () async { + await navigationService.pushScreen( + Routes.addTask, + arguments: eventId, + ); + }, + child: const Icon(Icons.add), + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/eventId.md b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/eventId.md new file mode 100644 index 000000000..4ca1b3890 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/EventTasksPage/eventId.md @@ -0,0 +1,32 @@ + + + +# eventId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) eventId + +_final_ + + + + + + +## Implementation + +```dart +final String eventId; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/views_after_auth_screens_tasks_event_tasks_page-library.md b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/views_after_auth_screens_tasks_event_tasks_page-library.md new file mode 100644 index 000000000..47d26bcc2 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_event_tasks_page/views_after_auth_screens_tasks_event_tasks_page-library.md @@ -0,0 +1,38 @@ + + + + +# event_tasks_page library + + + + + + + + + + + +## Classes + +##### [EventTasksPage](../views_after_auth_screens_tasks_event_tasks_page/EventTasksPage-class.md) + + + +EventTasksPage return a widget for Event Task Page that is created by event creator. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage-class.md b/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage-class.md new file mode 100644 index 000000000..ca207fe6d --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage-class.md @@ -0,0 +1,189 @@ + + + +# UserTasksPage class + + + + + + + + + +

UserTasksPage returns a widget for page of User Tasks.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- UserTasksPage + + + + + + + + +## Constructors + +[UserTasksPage](../views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/UserTasksPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/UserTasksPage.md b/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/UserTasksPage.md new file mode 100644 index 000000000..2263a899c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/UserTasksPage.md @@ -0,0 +1,29 @@ + + + +# UserTasksPage constructor + + + + + + +const +UserTasksPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const UserTasksPage({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/build.md b/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/build.md new file mode 100644 index 000000000..2a4d3e2cc --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/UserTasksPage/build.md @@ -0,0 +1,86 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.fetchTasksByUser(), + builder: (_, model, __) { + final tasks = model.tasks; + return RefreshIndicator( + onRefresh: () => model.fetchTasksByUser(), + child: Scaffold( + appBar: AppBar( + title: const Text('User Tasks'), + ), + // TaskSchedule is custom widget. + body: TaskSchedule(tasks: tasks, showMoreOptions: true), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/views_after_auth_screens_tasks_user_tasks_page-library.md b/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/views_after_auth_screens_tasks_user_tasks_page-library.md new file mode 100644 index 000000000..8e4e1e055 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_tasks_user_tasks_page/views_after_auth_screens_tasks_user_tasks_page-library.md @@ -0,0 +1,38 @@ + + + + +# user_tasks_page library + + + + + + + + + + + +## Classes + +##### [UserTasksPage](../views_after_auth_screens_tasks_user_tasks_page/UserTasksPage-class.md) + + + +UserTasksPage returns a widget for page of User Tasks. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen-class.md b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen-class.md new file mode 100644 index 000000000..c5eaefb15 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen-class.md @@ -0,0 +1,216 @@ + + + +# MapScreen class + + + + + + + + + +

MapScreen returns a widget that has mutable state _MapScreenState.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- MapScreen + + + + + + + + +## Constructors + +[MapScreen](../views_after_auth_screens_venue_map_screen/MapScreen/MapScreen.md) ([CreateEventViewModel](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md)? model, [double](https://api.flutter.dev/flutter/dart-core/double-class.html) latitude, [double](https://api.flutter.dev/flutter/dart-core/double-class.html) longitude, {[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [latitude](../views_after_auth_screens_venue_map_screen/MapScreen/latitude.md) → [double](https://api.flutter.dev/flutter/dart-core/double-class.html) + + + + +_final_ + + + +##### [longitude](../views_after_auth_screens_venue_map_screen/MapScreen/longitude.md) → [double](https://api.flutter.dev/flutter/dart-core/double-class.html) + + + + +_final_ + + + +##### [model](../views_after_auth_screens_venue_map_screen/MapScreen/model.md) → [CreateEventViewModel](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md)? + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_after_auth_screens_venue_map_screen/MapScreen/createState.md)() _MapScreenState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/MapScreen.md b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/MapScreen.md new file mode 100644 index 000000000..c16e8d0be --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/MapScreen.md @@ -0,0 +1,30 @@ + + + +# MapScreen constructor + + + + + + +const +MapScreen([CreateEventViewModel](../../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md)? model, [double](https://api.flutter.dev/flutter/dart-core/double-class.html) latitude, [double](https://api.flutter.dev/flutter/dart-core/double-class.html) longitude, {[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const MapScreen(this.model, this.latitude, this.longitude, {Key? key}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/createState.md b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/createState.md new file mode 100644 index 000000000..713d88f2a --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_MapScreenState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_MapScreenState createState() => _MapScreenState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/latitude.md b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/latitude.md new file mode 100644 index 000000000..6af59a4a5 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/latitude.md @@ -0,0 +1,32 @@ + + + +# latitude property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html) latitude + +_final_ + + + + + + +## Implementation + +```dart +final double latitude; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/longitude.md b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/longitude.md new file mode 100644 index 000000000..7879ff570 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/longitude.md @@ -0,0 +1,32 @@ + + + +# longitude property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html) longitude + +_final_ + + + + + + +## Implementation + +```dart +final double longitude; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/model.md b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/model.md new file mode 100644 index 000000000..697bf3c0c --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/MapScreen/model.md @@ -0,0 +1,32 @@ + + + +# model property + + + + + + + +[CreateEventViewModel](../../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md)? model + +_final_ + + + + + + +## Implementation + +```dart +final CreateEventViewModel? model; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/views_after_auth_screens_venue_map_screen-library.md b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/views_after_auth_screens_venue_map_screen-library.md new file mode 100644 index 000000000..6fc918ae7 --- /dev/null +++ b/talawa-mobile-docs/views_after_auth_screens_venue_map_screen/views_after_auth_screens_venue_map_screen-library.md @@ -0,0 +1,38 @@ + + + + +# map_screen library + + + + + + + + + + + +## Classes + +##### [MapScreen](../views_after_auth_screens_venue_map_screen/MapScreen-class.md) + + + +MapScreen returns a widget that has mutable state _MapScreenState. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_base_view/BaseView-class.md b/talawa-mobile-docs/views_base_view/BaseView-class.md new file mode 100644 index 000000000..8946f6bb4 --- /dev/null +++ b/talawa-mobile-docs/views_base_view/BaseView-class.md @@ -0,0 +1,206 @@ + + + +# BaseView<T extends ChangeNotifier> class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- BaseView + + + + + + + + +## Constructors + +[BaseView](../views_base_view/BaseView/BaseView.md) ({required [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) builder([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html), T, [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)?), dynamic onModelReady(T)?}) + + _const_ + + +## Properties + +##### [builder](../views_base_view/BaseView/builder.md) → [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) Function([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html), T, [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)?) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [onModelReady](../views_base_view/BaseView/onModelReady.md) → (dynamic Function(T)?) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_base_view/BaseView/createState.md)() _BaseViewState<T> + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_base_view/BaseView/BaseView.md b/talawa-mobile-docs/views_base_view/BaseView/BaseView.md new file mode 100644 index 000000000..b2b14d9c9 --- /dev/null +++ b/talawa-mobile-docs/views_base_view/BaseView/BaseView.md @@ -0,0 +1,32 @@ + + + +# BaseView<T extends ChangeNotifier> constructor + + + + + + +const +BaseView<T extends ChangeNotifier>({required [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) builder([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html), T, [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)?), dynamic onModelReady(T)?}) + + + + + +## Implementation + +```dart +const BaseView({ + required this.builder, + this.onModelReady, +}); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_base_view/BaseView/builder.md b/talawa-mobile-docs/views_base_view/BaseView/builder.md new file mode 100644 index 000000000..e30644f09 --- /dev/null +++ b/talawa-mobile-docs/views_base_view/BaseView/builder.md @@ -0,0 +1,32 @@ + + + +# builder property + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) Function([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html), T, [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)?) builder + +_final_ + + + + + + +## Implementation + +```dart +final Widget Function(BuildContext, T, Widget?) builder; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_base_view/BaseView/createState.md b/talawa-mobile-docs/views_base_view/BaseView/createState.md new file mode 100644 index 000000000..e14ec4540 --- /dev/null +++ b/talawa-mobile-docs/views_base_view/BaseView/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_BaseViewState<T> createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_BaseViewState createState() => _BaseViewState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_base_view/BaseView/onModelReady.md b/talawa-mobile-docs/views_base_view/BaseView/onModelReady.md new file mode 100644 index 000000000..2ac8d9e41 --- /dev/null +++ b/talawa-mobile-docs/views_base_view/BaseView/onModelReady.md @@ -0,0 +1,32 @@ + + + +# onModelReady property + + + + + + + +(dynamic Function(T)?) onModelReady + +_final_ + + + + + + +## Implementation + +```dart +final Function(T)? onModelReady; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_base_view/views_base_view-library.md b/talawa-mobile-docs/views_base_view/views_base_view-library.md new file mode 100644 index 000000000..c235dde85 --- /dev/null +++ b/talawa-mobile-docs/views_base_view/views_base_view-library.md @@ -0,0 +1,38 @@ + + + + +# base_view library + + + + + + + + + + + +## Classes + +##### [BaseView](../views_base_view/BaseView-class.md)<T extends [ChangeNotifier](https://api.flutter.dev/flutter/foundation/ChangeNotifier-class.html)> + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_main_screen/MainScreen-class.md b/talawa-mobile-docs/views_main_screen/MainScreen-class.md new file mode 100644 index 000000000..27015e107 --- /dev/null +++ b/talawa-mobile-docs/views_main_screen/MainScreen-class.md @@ -0,0 +1,197 @@ + + + +# MainScreen class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- MainScreen + + + + + + + + +## Constructors + +[MainScreen](../views_main_screen/MainScreen/MainScreen.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [MainScreenArgs](../models_mainscreen_navigation_args/MainScreenArgs-class.md) mainScreenArgs}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [mainScreenArgs](../views_main_screen/MainScreen/mainScreenArgs.md) → [MainScreenArgs](../models_mainscreen_navigation_args/MainScreenArgs-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_main_screen/MainScreen/createState.md)() [State](https://api.flutter.dev/flutter/widgets/State-class.html)<[MainScreen](../views_main_screen/MainScreen-class.md)> + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_main_screen/MainScreen/MainScreen.md b/talawa-mobile-docs/views_main_screen/MainScreen/MainScreen.md new file mode 100644 index 000000000..bdcd9e82e --- /dev/null +++ b/talawa-mobile-docs/views_main_screen/MainScreen/MainScreen.md @@ -0,0 +1,29 @@ + + + +# MainScreen constructor + + + + + + +const +MainScreen({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [MainScreenArgs](../../models_mainscreen_navigation_args/MainScreenArgs-class.md) mainScreenArgs}) + + + + + +## Implementation + +```dart +const MainScreen({Key? key, required this.mainScreenArgs}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_main_screen/MainScreen/createState.md b/talawa-mobile-docs/views_main_screen/MainScreen/createState.md new file mode 100644 index 000000000..6553b2090 --- /dev/null +++ b/talawa-mobile-docs/views_main_screen/MainScreen/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[MainScreen](../../views_main_screen/MainScreen-class.md)> createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +State createState() => _MainScreenState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_main_screen/MainScreen/mainScreenArgs.md b/talawa-mobile-docs/views_main_screen/MainScreen/mainScreenArgs.md new file mode 100644 index 000000000..5ca52b985 --- /dev/null +++ b/talawa-mobile-docs/views_main_screen/MainScreen/mainScreenArgs.md @@ -0,0 +1,32 @@ + + + +# mainScreenArgs property + + + + + + + +[MainScreenArgs](../../models_mainscreen_navigation_args/MainScreenArgs-class.md) mainScreenArgs + +_final_ + + + + + + +## Implementation + +```dart +final MainScreenArgs mainScreenArgs; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_main_screen/views_main_screen-library.md b/talawa-mobile-docs/views_main_screen/views_main_screen-library.md new file mode 100644 index 000000000..f880632ed --- /dev/null +++ b/talawa-mobile-docs/views_main_screen/views_main_screen-library.md @@ -0,0 +1,38 @@ + + + + +# main_screen library + + + + + + + + + + + +## Classes + +##### [MainScreen](../views_main_screen/MainScreen-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass-class.md b/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass-class.md new file mode 100644 index 000000000..731c511f0 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass-class.md @@ -0,0 +1,192 @@ + + + +# ChangePass class + + + + + + + + + +

This widget lets the user change his/her password. +There are two input fields. The first one is for entering the new password, and the +second one is for re-entering the password for verification. +There is a raised button which finally updates the password when pressed.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- ChangePass + + + + + + + + +## Constructors + +[ChangePass](../views_pre_auth_screens_change_password/ChangePass/ChangePass.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_pre_auth_screens_change_password/ChangePass/createState.md)() _ChangePassState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass/ChangePass.md b/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass/ChangePass.md new file mode 100644 index 000000000..1cd9383e7 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass/ChangePass.md @@ -0,0 +1,29 @@ + + + +# ChangePass constructor + + + + + + +const +ChangePass({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + + + + +## Implementation + +```dart +const ChangePass({required Key key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass/createState.md b/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass/createState.md new file mode 100644 index 000000000..895a6ff7f --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_change_password/ChangePass/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_ChangePassState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_ChangePassState createState() => _ChangePassState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_change_password/views_pre_auth_screens_change_password-library.md b/talawa-mobile-docs/views_pre_auth_screens_change_password/views_pre_auth_screens_change_password-library.md new file mode 100644 index 000000000..23eb04bfc --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_change_password/views_pre_auth_screens_change_password-library.md @@ -0,0 +1,41 @@ + + + + +# change_password library + + + + + + + + + + + +## Classes + +##### [ChangePass](../views_pre_auth_screens_change_password/ChangePass-class.md) + + + +This widget lets the user change his/her password. +There are two input fields. The first one is for entering the new password, and the +second one is for re-entering the password for verification. +There is a raised button which finally updates the password when pressed. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_login/Login-class.md b/talawa-mobile-docs/views_pre_auth_screens_login/Login-class.md new file mode 100644 index 000000000..70fae78e2 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_login/Login-class.md @@ -0,0 +1,194 @@ + + + +# Login class + + + + + + + + + +

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 +the "recover password" screen when pressed. +At the bottom, there is a login button to initiate the login.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- Login + + + + + + + + +## Constructors + +[Login](../views_pre_auth_screens_login/Login/Login.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_pre_auth_screens_login/Login/createState.md)() _LoginState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_login/Login/Login.md b/talawa-mobile-docs/views_pre_auth_screens_login/Login/Login.md new file mode 100644 index 000000000..286bc4a1e --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_login/Login/Login.md @@ -0,0 +1,29 @@ + + + +# Login constructor + + + + + + +const +Login({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + + + + +## Implementation + +```dart +const Login({required Key key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_login/Login/createState.md b/talawa-mobile-docs/views_pre_auth_screens_login/Login/createState.md new file mode 100644 index 000000000..15962de2e --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_login/Login/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_LoginState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_LoginState createState() => _LoginState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_login/views_pre_auth_screens_login-library.md b/talawa-mobile-docs/views_pre_auth_screens_login/views_pre_auth_screens_login-library.md new file mode 100644 index 000000000..ce705ea1d --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_login/views_pre_auth_screens_login-library.md @@ -0,0 +1,43 @@ + + + + +# login library + + + + + + + + + + + +## Classes + +##### [Login](../views_pre_auth_screens_login/Login-class.md) + + + +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 +the "recover password" screen when pressed. +At the bottom, there is a login button to initiate the login. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_recover/Recover-class.md b/talawa-mobile-docs/views_pre_auth_screens_recover/Recover-class.md new file mode 100644 index 000000000..729d6af96 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_recover/Recover-class.md @@ -0,0 +1,190 @@ + + + +# Recover class + + + + + + + + + +

This class recovers the users password. +The users needs to enter his/her email and press on the button at the bottom to recover his/her password.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- Recover + + + + + + + + +## Constructors + +[Recover](../views_pre_auth_screens_recover/Recover/Recover.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_pre_auth_screens_recover/Recover/createState.md)() _RecoverState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_recover/Recover/Recover.md b/talawa-mobile-docs/views_pre_auth_screens_recover/Recover/Recover.md new file mode 100644 index 000000000..62e8bdcc4 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_recover/Recover/Recover.md @@ -0,0 +1,29 @@ + + + +# Recover constructor + + + + + + +const +Recover({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + + + + +## Implementation + +```dart +const Recover({required Key key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_recover/Recover/createState.md b/talawa-mobile-docs/views_pre_auth_screens_recover/Recover/createState.md new file mode 100644 index 000000000..2ba2ecaf8 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_recover/Recover/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_RecoverState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_RecoverState createState() => _RecoverState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_recover/views_pre_auth_screens_recover-library.md b/talawa-mobile-docs/views_pre_auth_screens_recover/views_pre_auth_screens_recover-library.md new file mode 100644 index 000000000..4847fa5eb --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_recover/views_pre_auth_screens_recover-library.md @@ -0,0 +1,39 @@ + + + + +# recover library + + + + + + + + + + + +## Classes + +##### [Recover](../views_pre_auth_screens_recover/Recover-class.md) + + + +This class recovers the users password. +The users needs to enter his/her email and press on the button at the bottom to recover his/her password. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage-class.md b/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage-class.md new file mode 100644 index 000000000..ebdca5873 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage-class.md @@ -0,0 +1,192 @@ + + + +# SelectLanguage class + + + + + + + + + +

This widget enables us to select a different language. +The default language is English. We can choose among the options to switch the language. +There is a text button at the right bottom of the screen which changes the language when tapped. +The user finally gets redirected to the previous screen.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- SelectLanguage + + + + + + + + +## Constructors + +[SelectLanguage](../views_pre_auth_screens_select_language/SelectLanguage/SelectLanguage.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_pre_auth_screens_select_language/SelectLanguage/createState.md)() _SelectLanguageState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage/SelectLanguage.md b/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage/SelectLanguage.md new file mode 100644 index 000000000..e41052761 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage/SelectLanguage.md @@ -0,0 +1,29 @@ + + + +# SelectLanguage constructor + + + + + + +const +SelectLanguage({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + + + + +## Implementation + +```dart +const SelectLanguage({required Key key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage/createState.md b/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage/createState.md new file mode 100644 index 000000000..2428e069e --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_language/SelectLanguage/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_SelectLanguageState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_SelectLanguageState createState() => _SelectLanguageState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_language/views_pre_auth_screens_select_language-library.md b/talawa-mobile-docs/views_pre_auth_screens_select_language/views_pre_auth_screens_select_language-library.md new file mode 100644 index 000000000..d177a30d0 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_language/views_pre_auth_screens_select_language-library.md @@ -0,0 +1,41 @@ + + + + +# select_language library + + + + + + + + + + + +## Classes + +##### [SelectLanguage](../views_pre_auth_screens_select_language/SelectLanguage-class.md) + + + +This widget enables us to select a different language. +The default language is English. We can choose among the options to switch the language. +There is a text button at the right bottom of the screen which changes the language when tapped. +The user finally gets redirected to the previous screen. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization-class.md b/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization-class.md new file mode 100644 index 000000000..971cf7ddf --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization-class.md @@ -0,0 +1,200 @@ + + + +# SelectOrganization class + + + + + + + + + +

This widget lets the user select new organizations.

+

There is a list tile which displays the organization selected by the user. +He/she needs to press the "continue" button to proceed.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- SelectOrganization + + + + + + + + +## Constructors + +[SelectOrganization](../views_pre_auth_screens_select_organization/SelectOrganization/SelectOrganization.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) selectedOrgId}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [selectedOrgId](../views_pre_auth_screens_select_organization/SelectOrganization/selectedOrgId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Contains Integer value for selected org id. +_final_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_pre_auth_screens_select_organization/SelectOrganization/createState.md)() _SelectOrganizationState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/SelectOrganization.md b/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/SelectOrganization.md new file mode 100644 index 000000000..e50889bab --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/SelectOrganization.md @@ -0,0 +1,30 @@ + + + +# SelectOrganization constructor + + + + + + +const +SelectOrganization({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) selectedOrgId}) + + + + + +## Implementation + +```dart +const SelectOrganization({required Key key, required this.selectedOrgId}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/createState.md b/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/createState.md new file mode 100644 index 000000000..f79eaff9e --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_SelectOrganizationState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_SelectOrganizationState createState() => _SelectOrganizationState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/selectedOrgId.md b/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/selectedOrgId.md new file mode 100644 index 000000000..c195ff636 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_organization/SelectOrganization/selectedOrgId.md @@ -0,0 +1,33 @@ + + + +# selectedOrgId property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) selectedOrgId + +_final_ + + + +

Contains Integer value for selected org id.

+ + + +## Implementation + +```dart +final String selectedOrgId; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_select_organization/views_pre_auth_screens_select_organization-library.md b/talawa-mobile-docs/views_pre_auth_screens_select_organization/views_pre_auth_screens_select_organization-library.md new file mode 100644 index 000000000..af27a16c9 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_select_organization/views_pre_auth_screens_select_organization-library.md @@ -0,0 +1,38 @@ + + + + +# select_organization library + + + + + + + + + + + +## Classes + +##### [SelectOrganization](../views_pre_auth_screens_select_organization/SelectOrganization-class.md) + + + +This widget lets the user select new organizations. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl-class.md b/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl-class.md new file mode 100644 index 000000000..a79b2add3 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl-class.md @@ -0,0 +1,203 @@ + + + +# SetUrl class + + + + + + + + + +

This widget lets a user sign in/up with the organization url.

+

The user can enter an organization through the QR code scanner, +or enter the organization URL and then login. +There is also a signup option which navigates to a screen for the user +to select an organization. +At the bottom, there is also a gesture detector for changing the language.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- SetUrl + + + + + + + + +## Constructors + +[SetUrl](../views_pre_auth_screens_set_url/SetUrl/SetUrl.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) uri}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [uri](../views_pre_auth_screens_set_url/SetUrl/uri.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Variable. +_final_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_pre_auth_screens_set_url/SetUrl/createState.md)() _SetUrlState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/SetUrl.md b/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/SetUrl.md new file mode 100644 index 000000000..aac3a1fad --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/SetUrl.md @@ -0,0 +1,29 @@ + + + +# SetUrl constructor + + + + + + +const +SetUrl({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) uri}) + + + + + +## Implementation + +```dart +const SetUrl({required Key key, required this.uri}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/createState.md b/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/createState.md new file mode 100644 index 000000000..90d6901db --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_SetUrlState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_SetUrlState createState() => _SetUrlState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/uri.md b/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/uri.md new file mode 100644 index 000000000..4eb44bdd7 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_set_url/SetUrl/uri.md @@ -0,0 +1,33 @@ + + + +# uri property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) uri + +_final_ + + + +

Variable.

+ + + +## Implementation + +```dart +final String uri; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_set_url/views_pre_auth_screens_set_url-library.md b/talawa-mobile-docs/views_pre_auth_screens_set_url/views_pre_auth_screens_set_url-library.md new file mode 100644 index 000000000..3947441b1 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_set_url/views_pre_auth_screens_set_url-library.md @@ -0,0 +1,38 @@ + + + + +# set_url library + + + + + + + + + + + +## Classes + +##### [SetUrl](../views_pre_auth_screens_set_url/SetUrl-class.md) + + + +This widget lets a user sign in/up with the organization url. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails-class.md b/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails-class.md new file mode 100644 index 000000000..dc5cf6e2a --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails-class.md @@ -0,0 +1,198 @@ + + + +# SignUpDetails class + + + + + + + + + +

This widget takes the user details for signup. The form includes first name, last name, email, password, and password confirmation inputs.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- SignUpDetails + + + + + + + + +## Constructors + +[SignUpDetails](../views_pre_auth_screens_signup_details/SignUpDetails/SignUpDetails.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [OrgInfo](../models_organization_org_info/OrgInfo-class.md) selectedOrg}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [selectedOrg](../views_pre_auth_screens_signup_details/SignUpDetails/selectedOrg.md) → [OrgInfo](../models_organization_org_info/OrgInfo-class.md) + + + + +_final_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../views_pre_auth_screens_signup_details/SignUpDetails/createState.md)() _SignUpDetailsState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/SignUpDetails.md b/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/SignUpDetails.md new file mode 100644 index 000000000..730d0de63 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/SignUpDetails.md @@ -0,0 +1,30 @@ + + + +# SignUpDetails constructor + + + + + + +const +SignUpDetails({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [OrgInfo](../../models_organization_org_info/OrgInfo-class.md) selectedOrg}) + + + + + +## Implementation + +```dart +const SignUpDetails({required Key key, required this.selectedOrg}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/createState.md b/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/createState.md new file mode 100644 index 000000000..d63614dd6 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_SignUpDetailsState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_SignUpDetailsState createState() => _SignUpDetailsState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/selectedOrg.md b/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/selectedOrg.md new file mode 100644 index 000000000..93ed4601a --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_signup_details/SignUpDetails/selectedOrg.md @@ -0,0 +1,32 @@ + + + +# selectedOrg property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md) selectedOrg + +_final_ + + + + + + +## Implementation + +```dart +final OrgInfo selectedOrg; +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_signup_details/views_pre_auth_screens_signup_details-library.md b/talawa-mobile-docs/views_pre_auth_screens_signup_details/views_pre_auth_screens_signup_details-library.md new file mode 100644 index 000000000..4198a4f70 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_signup_details/views_pre_auth_screens_signup_details-library.md @@ -0,0 +1,38 @@ + + + + +# signup_details library + + + + + + + + + + + +## Classes + +##### [SignUpDetails](../views_pre_auth_screens_signup_details/SignUpDetails-class.md) + + + +This widget takes the user details for signup. The form includes first name, last name, email, password, and password confirmation inputs. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage-class.md b/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage-class.md new file mode 100644 index 000000000..bb3e35ccf --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage-class.md @@ -0,0 +1,189 @@ + + + +# WaitingPage class + + + + + + + + + +

This class returns a widget which shows the request sent by the user to join a private organization.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- WaitingPage + + + + + + + + +## Constructors + +[WaitingPage](../views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/WaitingPage.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/WaitingPage.md b/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/WaitingPage.md new file mode 100644 index 000000000..e02f65209 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/WaitingPage.md @@ -0,0 +1,29 @@ + + + +# WaitingPage constructor + + + + + + +const +WaitingPage({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const WaitingPage({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/build.md b/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/build.md new file mode 100644 index 000000000..853022b40 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/WaitingPage/build.md @@ -0,0 +1,179 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(context), + builder: (context, model, child) { + return Scaffold( + key: const Key('WaitingPageScaffold'), + extendBodyBehindAppBar: true, + appBar: AppBar( + elevation: 0.0, + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + ), + body: Container( + padding: EdgeInsets.only(top: SizeConfig.safeBlockVertical! * 6), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SignupProgressIndicator( + key: const Key('Waiting'), + currentPageIndex: 2, + ), + Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.screenHeight! * 0.01, + SizeConfig.screenWidth! * 0.06, + SizeConfig.screenHeight! * 0.01, + ), + width: SizeConfig.screenWidth, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //Greeting text + CustomRichText( + key: const Key('WaitingPageText'), + words: model.greeting, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.03, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Request Sent to'), + style: Theme.of(context).textTheme.titleLarge, + ), + ], + ), + ), + //Information of the organization to which the request is sent. + Expanded( + child: ListView.builder( + key: const Key('PendingRequestList'), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemCount: model.pendingRequestOrg.length, + itemBuilder: (BuildContext context, int index) { + return CustomListTile( + key: const Key('WaitingJoin'), + index: index, + type: TileType.org, + orgInfo: model.pendingRequestOrg[index], + onTapOrgInfo: (item) {}, + ); + }, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + //Join organization button + RaisedRoundedButton( + key: const Key('JoinOrg'), + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Join Organisation'), + onTap: model.joinOrg, + showArrow: true, + textColor: Theme.of(context).colorScheme.secondaryContainer, + backgroundColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + //Logout button + RaisedRoundedButton( + key: const Key('Logout'), + buttonLabel: + AppLocalizations.of(context)!.strictTranslate('Log out'), + onTap: model.logout, + textColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + backgroundColor: + Theme.of(context).colorScheme.secondaryContainer, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + ], + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/views_pre_auth_screens_waiting_to_join_private_org-library.md b/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/views_pre_auth_screens_waiting_to_join_private_org-library.md new file mode 100644 index 000000000..baca98c97 --- /dev/null +++ b/talawa-mobile-docs/views_pre_auth_screens_waiting_to_join_private_org/views_pre_auth_screens_waiting_to_join_private_org-library.md @@ -0,0 +1,38 @@ + + + + +# waiting_to_join_private_org library + + + + + + + + + + + +## Classes + +##### [WaitingPage](../views_pre_auth_screens_waiting_to_join_private_org/WaitingPage-class.md) + + + +This class returns a widget which shows the request sent by the user to join a private organization. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet-class.md b/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet-class.md new file mode 100644 index 000000000..fd1368ae6 --- /dev/null +++ b/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet-class.md @@ -0,0 +1,101 @@ + + + +# EventBottomSheet class + + + + + + + + + +

Adds members to an event.

+ + + + +## Constructors + +[EventBottomSheet](../widgets_add_members_bottom_sheet/EventBottomSheet/EventBottomSheet.md) () + + + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [addUserBottomSheet](../widgets_add_members_bottom_sheet/EventBottomSheet/addUserBottomSheet.md)({required [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, required [CreateEventViewModel](../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md) model}) void + + + +This function creates a modal material design bottom sheet. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet/EventBottomSheet.md b/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet/EventBottomSheet.md new file mode 100644 index 000000000..588e22a0a --- /dev/null +++ b/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet/EventBottomSheet.md @@ -0,0 +1,24 @@ + + + +# EventBottomSheet constructor + + + + + + + +EventBottomSheet() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet/addUserBottomSheet.md b/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet/addUserBottomSheet.md new file mode 100644 index 000000000..c3727ed08 --- /dev/null +++ b/talawa-mobile-docs/widgets_add_members_bottom_sheet/EventBottomSheet/addUserBottomSheet.md @@ -0,0 +1,148 @@ + + + +# addUserBottomSheet method + + + + + + + + +void addUserBottomSheet +({required [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, required [CreateEventViewModel](../../view_model_after_auth_view_models_event_view_models_create_event_view_model/CreateEventViewModel-class.md) model}) + + + + + +

This function creates a modal material design bottom sheet.

+

to let the user add admin or members to an organization. +params:

+
    +
  • context: BuildContext
  • +
  • model: CreateEventViewModel
  • +
+

returns: + None

+ + + +## Implementation + +```dart +void addUserBottomSheet({ + required BuildContext context, + required CreateEventViewModel model, +}) { + // Returns a Future that resolves to the value ("context") passed + // to Navigator.pop + showModalBottomSheet( + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + isScrollControlled: true, + builder: (BuildContext context) { + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return ClipRRect( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: Container( + height: MediaQuery.of(context).size.height * 0.8, + decoration: BoxDecoration( + color: Theme.of(context).scaffoldBackgroundColor, + ), + child: Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + const Text( + "Add Members", + style: TextStyle(fontSize: 16), + ), + TextButton( + key: const Key('text_btn_ambs1'), + onPressed: () { + model.buildUserList(); + Navigator.pop(context); + }, + child: const Text("Done"), + ), + const Divider(), + FutureBuilder( + // an admin can access the list of the members in an organization + future: model.getCurrentOrgUsersList(), + builder: ( + BuildContext context, + AsyncSnapshot> snapshot, + ) { + if (snapshot.data == null) { + return const Center( + child: CircularProgressIndicator(), + ); + } else { + return snapshot.data!.isEmpty + ? const Center( + child: Text( + "There aren't any members in this organization.", + ), + ) + // Displaying the list of the members + : Flexible( + child: ListView.builder( + shrinkWrap: true, + itemCount: snapshot.data!.length, + itemBuilder: (context, index) { + return CheckboxListTile( + checkColor: Theme.of(context) + .colorScheme + .background, + activeColor: Theme.of(context) + .colorScheme + .primary, + title: Text( + "${snapshot.data![index].firstName!} ${snapshot.data![index].lastName!}", + ), + value: model.memberCheckedMap[ + snapshot.data![index].id], + onChanged: (val) { + setState( + () { + model.memberCheckedMap[snapshot + .data![index].id!] = val!; + }, + ); + }, + ); + }, + ), + ); + } + }, + ) + ], + ), + ), + ), + ); + }, + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_add_members_bottom_sheet/widgets_add_members_bottom_sheet-library.md b/talawa-mobile-docs/widgets_add_members_bottom_sheet/widgets_add_members_bottom_sheet-library.md new file mode 100644 index 000000000..852972d89 --- /dev/null +++ b/talawa-mobile-docs/widgets_add_members_bottom_sheet/widgets_add_members_bottom_sheet-library.md @@ -0,0 +1,38 @@ + + + + +# add_members_bottom_sheet library + + + + + + + + + + + +## Classes + +##### [EventBottomSheet](../widgets_add_members_bottom_sheet/EventBottomSheet-class.md) + + + +Adds members to an event. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog-class.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog-class.md new file mode 100644 index 000000000..7cdcf62e3 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog-class.md @@ -0,0 +1,255 @@ + + + +# CustomAlertDialog class + + + + + + + + + +

This Class returns CustomAlertDialog widget. Custom Alert Dialog is a popup +that appeared in the screen showing Alert message along with the event buttons. +This extends stateless widget that means it cannot change its state during the +runtime of a application.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CustomAlertDialog + + + + + + + + +## Constructors + +[CustomAlertDialog](../widgets_custom_alert_dialog/CustomAlertDialog/CustomAlertDialog.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? successText, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? dialogTitle, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) reverse = false, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) secondaryButtonText = 'Close', [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? secondaryButtonTap, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) success, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) dialogSubTitle}) + + _const_ + + +## Properties + +##### [dialogSubTitle](../widgets_custom_alert_dialog/CustomAlertDialog/dialogSubTitle.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [dialogTitle](../widgets_custom_alert_dialog/CustomAlertDialog/dialogTitle.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [reverse](../widgets_custom_alert_dialog/CustomAlertDialog/reverse.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [secondaryButtonTap](../widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonTap.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? + + + + +_final_ + + + +##### [secondaryButtonText](../widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonText.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [success](../widgets_custom_alert_dialog/CustomAlertDialog/success.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) + + + + +_final_ + + + +##### [successText](../widgets_custom_alert_dialog/CustomAlertDialog/successText.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + + + +## Methods + +##### [build](../widgets_custom_alert_dialog/CustomAlertDialog/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/CustomAlertDialog.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/CustomAlertDialog.md new file mode 100644 index 000000000..8eaaa8ad1 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/CustomAlertDialog.md @@ -0,0 +1,38 @@ + + + +# CustomAlertDialog constructor + + + + + + +const +CustomAlertDialog({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? successText, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? dialogTitle, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) reverse = false, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) secondaryButtonText = 'Close', [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? secondaryButtonTap, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) success, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) dialogSubTitle}) + + + + + +## Implementation + +```dart +const CustomAlertDialog({ + Key? key, + this.successText, + this.dialogTitle, + this.reverse = false, + this.secondaryButtonText = 'Close', + this.secondaryButtonTap, + required this.success, + required this.dialogSubTitle, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/build.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/build.md new file mode 100644 index 000000000..1e9548007 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/build.md @@ -0,0 +1,108 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + final List actions = [ + RaisedRoundedButton( + key: const Key('Close'), + onTap: () => secondaryButtonTap ?? navigationService.pop(), + buttonLabel: + AppLocalizations.of(context)!.strictTranslate(secondaryButtonText), + textColor: Colors.white, + backgroundColor: const Color(0xFF008A37), + width: SizeConfig.screenWidth! * 0.2, + height: SizeConfig.screenHeight! * 0.06, + ), + RaisedRoundedButton( + key: Key(successText ?? 'Confirm'), + onTap: () => success(), + buttonLabel: successText ?? + AppLocalizations.of(context)!.strictTranslate('Confirm'), + textColor: const Color(0xFF008A37), + backgroundColor: Colors.white, + width: SizeConfig.screenWidth! * 0.2, + height: SizeConfig.screenHeight! * 0.06, + ) + ]; + return AlertDialog( + title: Text( + dialogTitle ?? + AppLocalizations.of(context)!.strictTranslate('Confirmation'), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontWeight: FontWeight.w800), + ), + content: Text(dialogSubTitle), + buttonPadding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.05, + vertical: SizeConfig.screenHeight! * 0.05, + ), + actions: reverse ? actions.reversed.toList() : actions, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/dialogSubTitle.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/dialogSubTitle.md new file mode 100644 index 000000000..289f53404 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/dialogSubTitle.md @@ -0,0 +1,32 @@ + + + +# dialogSubTitle property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) dialogSubTitle + +_final_ + + + + + + +## Implementation + +```dart +final String dialogSubTitle; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/dialogTitle.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/dialogTitle.md new file mode 100644 index 000000000..e9b1201be --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/dialogTitle.md @@ -0,0 +1,32 @@ + + + +# dialogTitle property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? dialogTitle + +_final_ + + + + + + +## Implementation + +```dart +final String? dialogTitle; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/reverse.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/reverse.md new file mode 100644 index 000000000..1a6ef66a4 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/reverse.md @@ -0,0 +1,32 @@ + + + +# reverse property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) reverse + +_final_ + + + + + + +## Implementation + +```dart +final bool reverse; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonTap.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonTap.md new file mode 100644 index 000000000..69581557b --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonTap.md @@ -0,0 +1,32 @@ + + + +# secondaryButtonTap property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? secondaryButtonTap + +_final_ + + + + + + +## Implementation + +```dart +final Function? secondaryButtonTap; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonText.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonText.md new file mode 100644 index 000000000..d56250bfc --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/secondaryButtonText.md @@ -0,0 +1,32 @@ + + + +# secondaryButtonText property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) secondaryButtonText + +_final_ + + + + + + +## Implementation + +```dart +final String secondaryButtonText; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/success.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/success.md new file mode 100644 index 000000000..5a38d9633 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/success.md @@ -0,0 +1,32 @@ + + + +# success property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) success + +_final_ + + + + + + +## Implementation + +```dart +final Function success; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/successText.md b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/successText.md new file mode 100644 index 000000000..bae6cfb7b --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/CustomAlertDialog/successText.md @@ -0,0 +1,32 @@ + + + +# successText property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? successText + +_final_ + + + + + + +## Implementation + +```dart +final String? successText; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_alert_dialog/widgets_custom_alert_dialog-library.md b/talawa-mobile-docs/widgets_custom_alert_dialog/widgets_custom_alert_dialog-library.md new file mode 100644 index 000000000..04914c600 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_alert_dialog/widgets_custom_alert_dialog-library.md @@ -0,0 +1,41 @@ + + + + +# custom_alert_dialog library + + + + + + + + + + + +## Classes + +##### [CustomAlertDialog](../widgets_custom_alert_dialog/CustomAlertDialog-class.md) + + + +This Class returns CustomAlertDialog widget. Custom Alert Dialog is a popup +that appeared in the screen showing Alert message along with the event buttons. +This extends stateless widget that means it cannot change its state during the +runtime of a application. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar-class.md b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar-class.md new file mode 100644 index 000000000..b17358fba --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar-class.md @@ -0,0 +1,236 @@ + + + +# CustomAvatar class + + + + + + + + + +

Creates a custom avatar. +The avatar is created using the image provided, +or the first alphabet with a standard background color.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CustomAvatar + + + + + + + + +## Constructors + +[CustomAvatar](../widgets_custom_avatar/CustomAvatar/CustomAvatar.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isImageNull, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstAlphabet, [BaseCacheManager](https://pub.dev/documentation/flutter_cache_manager/3.3.1/flutter_cache_manager/BaseCacheManager-class.html)? cacheManager, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? imageUrl, [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? fontSize = 40}) + + _const_ + + +## Properties + +##### [cacheManager](../widgets_custom_avatar/CustomAvatar/cacheManager.md) → [BaseCacheManager](https://pub.dev/documentation/flutter_cache_manager/3.3.1/flutter_cache_manager/BaseCacheManager-class.html)? + + + + +_final_ + + + +##### [firstAlphabet](../widgets_custom_avatar/CustomAvatar/firstAlphabet.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + +##### [fontSize](../widgets_custom_avatar/CustomAvatar/fontSize.md) → [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [imageUrl](../widgets_custom_avatar/CustomAvatar/imageUrl.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + +##### [isImageNull](../widgets_custom_avatar/CustomAvatar/isImageNull.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_custom_avatar/CustomAvatar/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/CustomAvatar.md b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/CustomAvatar.md new file mode 100644 index 000000000..6889bbd2e --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/CustomAvatar.md @@ -0,0 +1,36 @@ + + + +# CustomAvatar constructor + + + + + + +const +CustomAvatar({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isImageNull, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstAlphabet, [BaseCacheManager](https://pub.dev/documentation/flutter_cache_manager/3.3.1/flutter_cache_manager/BaseCacheManager-class.html)? cacheManager, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? imageUrl, [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? fontSize = 40}) + + + + + +## Implementation + +```dart +const CustomAvatar({ + Key? key, + required this.isImageNull, + this.firstAlphabet, + this.cacheManager, + this.imageUrl, + this.fontSize = 40, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/build.md b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/build.md new file mode 100644 index 000000000..94273da49 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/build.md @@ -0,0 +1,106 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return isImageNull + //creating the avatar with the icon-theme color when the image is null + ? CircleAvatar( + backgroundColor: + Theme.of(context).iconTheme.color!.withOpacity(0.2), + child: Center( + child: Text( + firstAlphabet!, + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(fontSize: fontSize), + ), + ), + ) + //creating the avatar with the provided image + : CachedNetworkImage( + cacheManager: cacheManager, + imageBuilder: (context, imageProvider) { + return CircleAvatar( + backgroundColor: + Theme.of(context).iconTheme.color!.withOpacity(0.2), + backgroundImage: imageProvider, + ); + }, + imageUrl: imageUrl!, + placeholder: (context, url) => CircleAvatar( + child: Shimmer.fromColors( + baseColor: Colors.transparent, + highlightColor: Colors.white30, + child: const CircleAvatar(), + ), + ), + errorWidget: (context, url, error) => + const CircleAvatar(child: Icon(Icons.error)), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/cacheManager.md b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/cacheManager.md new file mode 100644 index 000000000..64667e800 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/cacheManager.md @@ -0,0 +1,32 @@ + + + +# cacheManager property + + + + + + + +[BaseCacheManager](https://pub.dev/documentation/flutter_cache_manager/3.3.1/flutter_cache_manager/BaseCacheManager-class.html)? cacheManager + +_final_ + + + + + + +## Implementation + +```dart +final BaseCacheManager? cacheManager; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/firstAlphabet.md b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/firstAlphabet.md new file mode 100644 index 000000000..ae1ab0c5f --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/firstAlphabet.md @@ -0,0 +1,32 @@ + + + +# firstAlphabet property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? firstAlphabet + +_final_ + + + + + + +## Implementation + +```dart +final String? firstAlphabet; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/fontSize.md b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/fontSize.md new file mode 100644 index 000000000..67ce19850 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/fontSize.md @@ -0,0 +1,32 @@ + + + +# fontSize property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? fontSize + +_final_ + + + + + + +## Implementation + +```dart +final double? fontSize; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/imageUrl.md b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/imageUrl.md new file mode 100644 index 000000000..c1aab3120 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/imageUrl.md @@ -0,0 +1,32 @@ + + + +# imageUrl property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? imageUrl + +_final_ + + + + + + +## Implementation + +```dart +final String? imageUrl; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/isImageNull.md b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/isImageNull.md new file mode 100644 index 000000000..2485f03e9 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/CustomAvatar/isImageNull.md @@ -0,0 +1,32 @@ + + + +# isImageNull property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isImageNull + +_final_ + + + + + + +## Implementation + +```dart +final bool isImageNull; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_avatar/widgets_custom_avatar-library.md b/talawa-mobile-docs/widgets_custom_avatar/widgets_custom_avatar-library.md new file mode 100644 index 000000000..b11199567 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_avatar/widgets_custom_avatar-library.md @@ -0,0 +1,40 @@ + + + + +# custom_avatar library + + + + + + + + + + + +## Classes + +##### [CustomAvatar](../widgets_custom_avatar/CustomAvatar-class.md) + + + +Creates a custom avatar. +The avatar is created using the image provided, +or the first alphabet with a standard background color. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer-class.md b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer-class.md new file mode 100644 index 000000000..d50b757b4 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer-class.md @@ -0,0 +1,208 @@ + + + +# CustomDrawer class + + + + + + + + + +

Creates a custom drawer for switching organizations.

+

joining new organizations, or leaving an organization.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CustomDrawer + + + + + + + + +## Constructors + +[CustomDrawer](../widgets_custom_drawer/CustomDrawer/CustomDrawer.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md) homeModel}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [homeModel](../widgets_custom_drawer/CustomDrawer/homeModel.md) → [MainScreenViewModel](../view_model_main_screen_view_model/MainScreenViewModel-class.md) + + + +home model. +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_custom_drawer/CustomDrawer/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [exitButton](../widgets_custom_drawer/CustomDrawer/exitButton.md)() void + + + +Button to exit the organization. + + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/CustomDrawer.md b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/CustomDrawer.md new file mode 100644 index 000000000..1a91c48a2 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/CustomDrawer.md @@ -0,0 +1,32 @@ + + + +# CustomDrawer constructor + + + + + + +const +CustomDrawer({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md) homeModel}) + + + + + +## Implementation + +```dart +const CustomDrawer({ + Key? key, + required this.homeModel, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/build.md b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/build.md new file mode 100644 index 000000000..179b7931f --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/build.md @@ -0,0 +1,198 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialize(homeModel, context), + builder: (context, model, child) { + return Container( + width: SizeConfig.screenWidth! * 0.6, + alignment: Alignment.centerLeft, + child: Drawer( + key: const Key("Drawer"), + child: ListView( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //A material design Drawer header that identifies the app's user. + UserAccountsDrawerHeader( + currentAccountPicture: CustomAvatar( + isImageNull: model.selectedOrg?.image == null, + imageUrl: model.selectedOrg?.image, + firstAlphabet: model.selectedOrg?.name!.substring(0, 1), + ), + accountName: Column( + key: MainScreenViewModel.keyDrawerCurOrg, + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.selectedOrg?.name! ?? "NULL", + ), + Text( + AppLocalizations.of(context)! + .strictTranslate("Selected Organization"), + ) + ], + ), + accountEmail: const SizedBox(), + ), + //Tile to Switch organizations + Column( + key: MainScreenViewModel.keyDrawerSwitchableOrg, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 5, + horizontal: 8.0, + ), + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Switch Organization"), + style: Theme.of(context).textTheme.titleLarge, + ), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.41, + child: Scrollbar( + controller: model.controller, + thumbVisibility: true, + child: ListView.builder( + key: const Key("Switching Org"), + controller: model.controller, + padding: EdgeInsets.zero, + itemCount: model.switchAbleOrg.length, + // itemCount: 3, + itemBuilder: (BuildContext context, int index) { + return ListTile( + key: const Key("Org"), + onTap: () => model + .switchOrg(model.switchAbleOrg[index]), + leading: CustomAvatar( + isImageNull: + model.switchAbleOrg[index].image == + null, + imageUrl: model.switchAbleOrg[index].image, + firstAlphabet: model + .switchAbleOrg[index].name! + .substring(0, 1), + fontSize: 18, + ), + title: Text( + model.switchAbleOrg[index].name!, + ), + ); + }, + ), + ), + ), + ], + ), + const Divider(), + // A Tile to join a new organization + ListTile( + key: MainScreenViewModel.keyDrawerJoinOrg, + onTap: () => navigationService + .popAndPushScreen(Routes.joinOrg, arguments: '-1'), + leading: const Icon( + Icons.add, + size: 30, + ), + title: Text( + AppLocalizations.of(context)! + .strictTranslate("Join new Organization"), + ), + ), + ListTile( + key: MainScreenViewModel.keyDrawerLeaveCurrentOrg, + onTap: () => exitButton(), + leading: const Icon(Icons.logout, size: 30), + title: Text( + AppLocalizations.of(context)! + .strictTranslate("Leave Current Organization"), + ), + ), + SizedBox( + key: const Key("Sized Box Drawer"), + height: SizeConfig.screenHeight! * 0.03, + ), + const FromPalisadoes(key: Key("From Palisadoes")), + SizedBox( + key: const Key("Sized BottomBox Drawer"), + height: SizeConfig.screenHeight! * 0.03, + ) + ], + ), + ], + ), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/exitButton.md b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/exitButton.md new file mode 100644 index 000000000..2d4c0b640 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/exitButton.md @@ -0,0 +1,51 @@ + + + +# exitButton method + + + + + + + + +void exitButton +() + + + + + +

Button to exit the organization.

+

params: + None

+

returns: + None

+ + + +## Implementation + +```dart +void exitButton() { + return navigationService.pushDialog( + CustomAlertDialog( + key: const Key("Exit?"), + reverse: true, + dialogSubTitle: 'Are you sure you want to exit this organization?', + successText: 'Exit', + success: () { + //Exit org + }, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/homeModel.md b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/homeModel.md new file mode 100644 index 000000000..310768eb9 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_drawer/CustomDrawer/homeModel.md @@ -0,0 +1,33 @@ + + + +# homeModel property + + + + + + + +[MainScreenViewModel](../../view_model_main_screen_view_model/MainScreenViewModel-class.md) homeModel + +_final_ + + + +

home model.

+ + + +## Implementation + +```dart +final MainScreenViewModel homeModel; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_drawer/widgets_custom_drawer-library.md b/talawa-mobile-docs/widgets_custom_drawer/widgets_custom_drawer-library.md new file mode 100644 index 000000000..8ae003a91 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_drawer/widgets_custom_drawer-library.md @@ -0,0 +1,38 @@ + + + + +# custom_drawer library + + + + + + + + + + + +## Classes + +##### [CustomDrawer](../widgets_custom_drawer/CustomDrawer-class.md) + + + +Creates a custom drawer for switching organizations. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile-class.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile-class.md new file mode 100644 index 000000000..1bffb888c --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile-class.md @@ -0,0 +1,271 @@ + + + +# CustomListTile class + + + + + + + + + +

Returns a widget for rendering Customized tiles. +A Tile shows the org info, user info, options that on tap user & org info.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CustomListTile + + + + + + + + +## Constructors + +[CustomListTile](../widgets_custom_list_tile/CustomListTile/CustomListTile.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [int](https://api.flutter.dev/flutter/dart-core/int-class.html) index, required [TileType](../enums_enums/TileType.md) type, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showIcon = false, [OrgInfo](../models_organization_org_info/OrgInfo-class.md)? orgInfo, dynamic onTapOrgInfo([OrgInfo](../models_organization_org_info/OrgInfo-class.md))?, [User](../models_user_user_info/User-class.md)? userInfo, dynamic onTapUserInfo()?, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? onTapOption, [Options](../models_options_options/Options-class.md)? option}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [index](../widgets_custom_list_tile/CustomListTile/index.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + + +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [onTapOption](../widgets_custom_list_tile/CustomListTile/onTapOption.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? + + + + +_final_ + + + +##### [onTapOrgInfo](../widgets_custom_list_tile/CustomListTile/onTapOrgInfo.md) → (dynamic Function([OrgInfo](../models_organization_org_info/OrgInfo-class.md))?) + + + + +_final_ + + + +##### [onTapUserInfo](../widgets_custom_list_tile/CustomListTile/onTapUserInfo.md) → (dynamic Function()?) + + + + +_final_ + + + +##### [option](../widgets_custom_list_tile/CustomListTile/option.md) → [Options](../models_options_options/Options-class.md)? + + + + +_final_ + + + +##### [orgInfo](../widgets_custom_list_tile/CustomListTile/orgInfo.md) → [OrgInfo](../models_organization_org_info/OrgInfo-class.md)? + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [showIcon](../widgets_custom_list_tile/CustomListTile/showIcon.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [type](../widgets_custom_list_tile/CustomListTile/type.md) → [TileType](../enums_enums/TileType.md) + + + + +_final_ + + + +##### [userInfo](../widgets_custom_list_tile/CustomListTile/userInfo.md) → [User](../models_user_user_info/User-class.md)? + + + + +_final_ + + + + + +## Methods + +##### [build](../widgets_custom_list_tile/CustomListTile/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/CustomListTile.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/CustomListTile.md new file mode 100644 index 000000000..3eeda234d --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/CustomListTile.md @@ -0,0 +1,40 @@ + + + +# CustomListTile constructor + + + + + + +const +CustomListTile({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [int](https://api.flutter.dev/flutter/dart-core/int-class.html) index, required [TileType](../../enums_enums/TileType.md) type, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showIcon = false, [OrgInfo](../../models_organization_org_info/OrgInfo-class.md)? orgInfo, dynamic onTapOrgInfo([OrgInfo](../../models_organization_org_info/OrgInfo-class.md))?, [User](../../models_user_user_info/User-class.md)? userInfo, dynamic onTapUserInfo()?, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? onTapOption, [Options](../../models_options_options/Options-class.md)? option}) + + + + + +## Implementation + +```dart +const CustomListTile({ + required Key key, + required this.index, + required this.type, + this.showIcon = false, + this.orgInfo, + this.onTapOrgInfo, + this.userInfo, + this.onTapUserInfo, + this.onTapOption, + this.option, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/build.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/build.md new file mode 100644 index 000000000..7f8f54cc0 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/build.md @@ -0,0 +1,143 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return InkWell( + // checking wheather the tapped tile is of user or org. + onTap: () => type == TileType.org + ? onTapOrgInfo!(orgInfo!) + : type == TileType.user + ? onTapUserInfo!() + // ignore: avoid_dynamic_calls + : onTapOption!(), + child: Padding( + padding: const EdgeInsets.all(18.0), + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + height: 70, + child: Row( + children: [ + Expanded( + flex: 3, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 25, + ), + child: Text( + type == TileType.org + ? orgInfo!.name! + : type == TileType.user + ? '${userInfo!.firstName!} ${userInfo!.lastName!}' + : option!.title, + style: type == TileType.org + ? Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(fontSize: 18, color: Colors.black) + : type == TileType.user + ? Theme.of(context) + .textTheme + .titleLarge! + .copyWith(fontSize: 18, color: Colors.black) + : option!.trailingIconButton == null + ? Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(fontSize: 18, color: Colors.black) + : Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + fontSize: 18, + color: Colors.black, + ), + ), + ), + ), + Expanded( + flex: 1, + child: type != TileType.user + ? type == TileType.org + ? Icon( + orgInfo!.isPublic! ? Icons.lock_open : Icons.lock, + color: orgInfo!.isPublic! + ? const Color(0xFF34AD64) + : const Color(0xffFABC57), + ) + : option!.trailingIconButton ?? const SizedBox() + : const SizedBox(), + ), + ], + ), + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/index.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/index.md new file mode 100644 index 000000000..8d38fdfe8 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/index.md @@ -0,0 +1,32 @@ + + + +# index property + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) index + +_final_ + + + + + + +## Implementation + +```dart +final int index; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapOption.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapOption.md new file mode 100644 index 000000000..1a38e0522 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapOption.md @@ -0,0 +1,32 @@ + + + +# onTapOption property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html)? onTapOption + +_final_ + + + + + + +## Implementation + +```dart +final Function? onTapOption; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapOrgInfo.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapOrgInfo.md new file mode 100644 index 000000000..c835fb4c1 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapOrgInfo.md @@ -0,0 +1,32 @@ + + + +# onTapOrgInfo property + + + + + + + +(dynamic Function([OrgInfo](../../models_organization_org_info/OrgInfo-class.md))?) onTapOrgInfo + +_final_ + + + + + + +## Implementation + +```dart +final Function(OrgInfo)? onTapOrgInfo; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapUserInfo.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapUserInfo.md new file mode 100644 index 000000000..7aed949ac --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/onTapUserInfo.md @@ -0,0 +1,32 @@ + + + +# onTapUserInfo property + + + + + + + +(dynamic Function()?) onTapUserInfo + +_final_ + + + + + + +## Implementation + +```dart +final Function()? onTapUserInfo; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/option.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/option.md new file mode 100644 index 000000000..5ea411944 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/option.md @@ -0,0 +1,32 @@ + + + +# option property + + + + + + + +[Options](../../models_options_options/Options-class.md)? option + +_final_ + + + + + + +## Implementation + +```dart +final Options? option; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/orgInfo.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/orgInfo.md new file mode 100644 index 000000000..22dfb8f00 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/orgInfo.md @@ -0,0 +1,32 @@ + + + +# orgInfo property + + + + + + + +[OrgInfo](../../models_organization_org_info/OrgInfo-class.md)? orgInfo + +_final_ + + + + + + +## Implementation + +```dart +final OrgInfo? orgInfo; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/showIcon.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/showIcon.md new file mode 100644 index 000000000..fff3c932a --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/showIcon.md @@ -0,0 +1,32 @@ + + + +# showIcon property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showIcon + +_final_ + + + + + + +## Implementation + +```dart +final bool showIcon; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/type.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/type.md new file mode 100644 index 000000000..1b487d771 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/type.md @@ -0,0 +1,32 @@ + + + +# type property + + + + + + + +[TileType](../../enums_enums/TileType.md) type + +_final_ + + + + + + +## Implementation + +```dart +final TileType type; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/userInfo.md b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/userInfo.md new file mode 100644 index 000000000..04e9dd974 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/CustomListTile/userInfo.md @@ -0,0 +1,32 @@ + + + +# userInfo property + + + + + + + +[User](../../models_user_user_info/User-class.md)? userInfo + +_final_ + + + + + + +## Implementation + +```dart +final User? userInfo; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_list_tile/widgets_custom_list_tile-library.md b/talawa-mobile-docs/widgets_custom_list_tile/widgets_custom_list_tile-library.md new file mode 100644 index 000000000..20f3bdfd3 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_list_tile/widgets_custom_list_tile-library.md @@ -0,0 +1,39 @@ + + + + +# custom_list_tile library + + + + + + + + + + + +## Classes + +##### [CustomListTile](../widgets_custom_list_tile/CustomListTile-class.md) + + + +Returns a widget for rendering Customized tiles. +A Tile shows the org info, user info, options that on tap user & org info. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog-class.md b/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog-class.md new file mode 100644 index 000000000..6f3003ddc --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog-class.md @@ -0,0 +1,191 @@ + + + +# CustomProgressDialog class + + + + + + + + + +

A progress dialogue which shows an activity indicator +spinning clockwise if there is internet connectivity. +Otherwise, it shows no-internet image and text.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CustomProgressDialog + + + + + + + + +## Constructors + +[CustomProgressDialog](../widgets_custom_progress_dialog/CustomProgressDialog/CustomProgressDialog.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_custom_progress_dialog/CustomProgressDialog/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog/CustomProgressDialog.md b/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog/CustomProgressDialog.md new file mode 100644 index 000000000..3dbcc9b6f --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog/CustomProgressDialog.md @@ -0,0 +1,29 @@ + + + +# CustomProgressDialog constructor + + + + + + +const +CustomProgressDialog({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key}) + + + + + +## Implementation + +```dart +const CustomProgressDialog({required Key key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog/build.md b/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog/build.md new file mode 100644 index 000000000..543386b09 --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_progress_dialog/CustomProgressDialog/build.md @@ -0,0 +1,114 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.initialise(), + builder: (context, model, child) { + return Container( + margin: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.25, + vertical: SizeConfig.screenHeight! * 0.35, + ), + decoration: BoxDecoration( + color: Theme.of(context).textTheme.titleLarge!.color, + borderRadius: BorderRadius.circular(15), + ), + child: model.connectivityPresent + ? Center( + //An iOS-style activity indicator that spins clockwise. + + child: CupertinoActivityIndicator( + radius: SizeConfig.screenWidth! * 0.065, + ), + ) + // Shows no-internet image and text on no connectivity + : Column( + children: [ + Container( + alignment: Alignment.bottomCenter, + height: SizeConfig.screenWidth! * 0.4, + width: SizeConfig.screenWidth! * 0.4, + padding: const EdgeInsets.only(bottom: 10), + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/no_internet.png'), + fit: BoxFit.scaleDown, + ), + ), + ), + Text( + '${AppLocalizations.of(context)!.strictTranslate("No Internet")}!', + style: Theme.of(context).textTheme.headlineSmall, + ), + ], + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_custom_progress_dialog/widgets_custom_progress_dialog-library.md b/talawa-mobile-docs/widgets_custom_progress_dialog/widgets_custom_progress_dialog-library.md new file mode 100644 index 000000000..6c67685cc --- /dev/null +++ b/talawa-mobile-docs/widgets_custom_progress_dialog/widgets_custom_progress_dialog-library.md @@ -0,0 +1,40 @@ + + + + +# custom_progress_dialog library + + + + + + + + + + + +## Classes + +##### [CustomProgressDialog](../widgets_custom_progress_dialog/CustomProgressDialog-class.md) + + + +A progress dialogue which shows an activity indicator +spinning clockwise if there is internet connectivity. +Otherwise, it shows no-internet image and text. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_date_time_picker/customDatePicker.md b/talawa-mobile-docs/widgets_date_time_picker/customDatePicker.md new file mode 100644 index 000000000..be6e41a57 --- /dev/null +++ b/talawa-mobile-docs/widgets_date_time_picker/customDatePicker.md @@ -0,0 +1,51 @@ + + + +# customDatePicker function + + + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)> customDatePicker +({required [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) initialDate}) + + + + + +

Shows a dialog containing a Material Design date picker.

+

The returned Future resolves to the date selected by the user when the user confirms the dialog. +If the user cancels the dialog, null is returned.

+ + + +## Implementation + +```dart +Future customDatePicker({required DateTime initialDate}) async { + // showDatePicker which shows a material design date range picker used to select a range of dates. + final DateTime? picked = await showDatePicker( + context: navigationService.navigatorKey.currentContext!, + initialDate: initialDate, + firstDate: DateTime(2015, 8), + lastDate: DateTime(2101), + ); + if (picked != null && picked != initialDate) { + return picked; + } + return initialDate; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_date_time_picker/customTimePicker.md b/talawa-mobile-docs/widgets_date_time_picker/customTimePicker.md new file mode 100644 index 000000000..dbef8ac94 --- /dev/null +++ b/talawa-mobile-docs/widgets_date_time_picker/customTimePicker.md @@ -0,0 +1,51 @@ + + + +# customTimePicker function + + + + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html)> customTimePicker +({required [TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) initialTime}) + + + + + +

Shows a dialog containing a material design time picker.

+

The returned Future resolves to the time selected by the user when the user closes the dialog. +If the user cancels the dialog, null is returned.

+ + + +## Implementation + +```dart +Future customTimePicker({required TimeOfDay initialTime}) async { + // showTimePicker which shows a material design time range picker used to select a range of times. + // Click ![here](https://api.flutter.dev/flutter/material/showTimePicker.html) to know more. + final TimeOfDay? pickedTime = await showTimePicker( + context: navigationService.navigatorKey.currentContext!, + initialTime: initialTime, + ); + + if (pickedTime != null && pickedTime != initialTime) { + return pickedTime; + } + return initialTime; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_date_time_picker/widgets_date_time_picker-library.md b/talawa-mobile-docs/widgets_date_time_picker/widgets_date_time_picker-library.md new file mode 100644 index 000000000..2a02458bf --- /dev/null +++ b/talawa-mobile-docs/widgets_date_time_picker/widgets_date_time_picker-library.md @@ -0,0 +1,49 @@ + + + + +# date_time_picker library + + + + + + + + + + + + + + + + +## Functions + +##### [customDatePicker](../widgets_date_time_picker/customDatePicker.md)({required [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) initialDate}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)> + + + +Shows a dialog containing a Material Design date picker. + + + + +##### [customTimePicker](../widgets_date_time_picker/customTimePicker.md)({required [TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html) initialTime}) [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[TimeOfDay](https://api.flutter.dev/flutter/material/TimeOfDay-class.html)> + + + +Shows a dialog containing a material design time picker. + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_card/EventCard-class.md b/talawa-mobile-docs/widgets_event_card/EventCard-class.md new file mode 100644 index 000000000..a823fc9c5 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_card/EventCard-class.md @@ -0,0 +1,225 @@ + + + +# EventCard class + + + + + + + + + +

This class returns the EventCard widget.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- EventCard + + + + + + + + +## Constructors + +[EventCard](../widgets_event_card/EventCard/EventCard.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Event](../models_events_event_model/Event-class.md) event, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? eventTitleHighlightedText, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? eventTitleNormalText, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isSearchItem}) + + _const_ + + +## Properties + +##### [event](../widgets_event_card/EventCard/event.md) → [Event](../models_events_event_model/Event-class.md) + + + + +_final_ + + + +##### [eventTitleHighlightedText](../widgets_event_card/EventCard/eventTitleHighlightedText.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + +##### [eventTitleNormalText](../widgets_event_card/EventCard/eventTitleNormalText.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [isSearchItem](../widgets_event_card/EventCard/isSearchItem.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_event_card/EventCard/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_card/EventCard/EventCard.md b/talawa-mobile-docs/widgets_event_card/EventCard/EventCard.md new file mode 100644 index 000000000..f6421729a --- /dev/null +++ b/talawa-mobile-docs/widgets_event_card/EventCard/EventCard.md @@ -0,0 +1,35 @@ + + + +# EventCard constructor + + + + + + +const +EventCard({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Event](../../models_events_event_model/Event-class.md) event, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? eventTitleHighlightedText, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? eventTitleNormalText, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isSearchItem}) + + + + + +## Implementation + +```dart +const EventCard({ + Key? key, + required this.event, + this.eventTitleHighlightedText, + this.eventTitleNormalText, + required this.isSearchItem, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_card/EventCard/build.md b/talawa-mobile-docs/widgets_event_card/EventCard/build.md new file mode 100644 index 000000000..feddc8335 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_card/EventCard/build.md @@ -0,0 +1,336 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + final bool isRegistered = event.isRegistered ?? false; + return Padding( + padding: const EdgeInsets.only(bottom: 10), + child: Stack( + children: [ + Card( + shape: RoundedRectangleBorder( + side: + isRegistered && userConfig.currentUser.id != event.creator!.id + ? BorderSide( + color: Theme.of(context).colorScheme.secondary, + width: SizeConfig.screenWidth! * 0.008, + ) + : BorderSide.none, + ), + elevation: 3, + color: Theme.of(context).primaryColor, + child: Column( + children: [ + AspectRatio( + aspectRatio: 2.5, + child: Container( + height: SizeConfig.screenHeight! * 0.11, + width: double.infinity, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(0.3), + image: const DecorationImage( + fit: BoxFit.fitWidth, + alignment: FractionalOffset.topCenter, + image: NetworkImage( + 'https://picsum.photos/id/1022/200/300', + ), + ), + ), + child: ClipRRect( + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), + child: Container( + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.0), + ), + ), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Row( + children: [ + SizedBox( + width: SizeConfig.screenWidth! * 0.48, + child: isSearchItem + ? RichText( + text: TextSpan( + text: eventTitleHighlightedText, + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + fontWeight: FontWeight.bold, + ), + children: [ + TextSpan( + text: eventTitleNormalText, + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + color: Colors.grey, + ), + ) + ], + ), + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + ) + : Text( + event.title!, + style: Theme.of(context) + .textTheme + .headlineSmall, + ), + ), + const Spacer(), + const Icon( + Icons.calendar_today, + size: 13, + ), + const Spacer(), + Text( + "${event.startDate!} - ${event.endDate!}", + style: Theme.of(context).textTheme.bodySmall, + ) + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.006, + ), + Row( + children: [ + const Icon( + Icons.schedule, + size: 12, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.015, + ), + Text( + "${event.startTime!} - ${event.endTime!}", + style: Theme.of(context).textTheme.bodySmall, + ), + const Spacer(), + const Icon( + Icons.place, + size: 12, + ), + SizedBox( + child: Text( + event.location!.substring( + 0, + min(event.location!.length, 20), + ), + style: Theme.of(context).textTheme.bodySmall, + ), + ) + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.013, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: SizeConfig.screenWidth! * 0.55, + child: Text( + event.description!, + style: Theme.of(context).textTheme.bodySmall, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.left, + maxLines: 3, + ), + ), + const Icon( + Icons.chevron_right, + ), + ], + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.007, + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + userConfig.currentUser.id == event.creator!.id + ? Row( + children: [ + Icon( + Icons.verified, + size: 13, + color: Theme.of(context) + .colorScheme + .secondary, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.013, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Created'), + style: + Theme.of(context).textTheme.bodySmall, + ), + ], + ) + : const SizedBox(), + const Spacer(), + event.isPublic! + ? Icon( + Icons.lock_open, + size: 13, + color: Theme.of(context).colorScheme.primary, + ) + : Icon( + Icons.lock, + size: 13, + color: Theme.of(context).colorScheme.primary, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.013, + ), + event.isPublic! + ? Text( + AppLocalizations.of(context)! + .strictTranslate('public'), + style: Theme.of(context).textTheme.bodySmall, + ) + : Text( + AppLocalizations.of(context)! + .strictTranslate('private'), + style: Theme.of(context).textTheme.bodySmall, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.027, + ), + const Icon( + Icons.people_outline, + size: 13, + color: Color(0xff4285F4), + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.013, + ), + event.attendees != null + ? Text( + event.attendees!, + style: Theme.of(context).textTheme.bodySmall, + ) + : Text( + (event.registrants?.length ?? 0).toString(), + style: Theme.of(context).textTheme.bodySmall, + ) + ], + ), + ], + ), + ) + ], + ), + ), + Positioned( + top: SizeConfig.screenHeight! * 0.007, + right: SizeConfig.screenWidth! * 0.013, + child: isRegistered && + userConfig.currentUser.id != event.creator!.id + ? DecoratedBox( + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondary, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Registered"), + style: + Theme.of(context).textTheme.titleLarge!.copyWith( + color: Colors.white, + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ) + : const SizedBox(), + ) + ], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_card/EventCard/event.md b/talawa-mobile-docs/widgets_event_card/EventCard/event.md new file mode 100644 index 000000000..9714bc41a --- /dev/null +++ b/talawa-mobile-docs/widgets_event_card/EventCard/event.md @@ -0,0 +1,32 @@ + + + +# event property + + + + + + + +[Event](../../models_events_event_model/Event-class.md) event + +_final_ + + + + + + +## Implementation + +```dart +final Event event; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_card/EventCard/eventTitleHighlightedText.md b/talawa-mobile-docs/widgets_event_card/EventCard/eventTitleHighlightedText.md new file mode 100644 index 000000000..237bbbb81 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_card/EventCard/eventTitleHighlightedText.md @@ -0,0 +1,32 @@ + + + +# eventTitleHighlightedText property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? eventTitleHighlightedText + +_final_ + + + + + + +## Implementation + +```dart +final String? eventTitleHighlightedText; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_card/EventCard/eventTitleNormalText.md b/talawa-mobile-docs/widgets_event_card/EventCard/eventTitleNormalText.md new file mode 100644 index 000000000..bbc1edc6c --- /dev/null +++ b/talawa-mobile-docs/widgets_event_card/EventCard/eventTitleNormalText.md @@ -0,0 +1,32 @@ + + + +# eventTitleNormalText property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? eventTitleNormalText + +_final_ + + + + + + +## Implementation + +```dart +final String? eventTitleNormalText; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_card/EventCard/isSearchItem.md b/talawa-mobile-docs/widgets_event_card/EventCard/isSearchItem.md new file mode 100644 index 000000000..463d3fb1e --- /dev/null +++ b/talawa-mobile-docs/widgets_event_card/EventCard/isSearchItem.md @@ -0,0 +1,32 @@ + + + +# isSearchItem property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isSearchItem + +_final_ + + + + + + +## Implementation + +```dart +final bool isSearchItem; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_card/widgets_event_card-library.md b/talawa-mobile-docs/widgets_event_card/widgets_event_card-library.md new file mode 100644 index 000000000..36714b8fc --- /dev/null +++ b/talawa-mobile-docs/widgets_event_card/widgets_event_card-library.md @@ -0,0 +1,38 @@ + + + + +# event_card library + + + + + + + + + + + +## Classes + +##### [EventCard](../widgets_event_card/EventCard-class.md) + + + +This class returns the EventCard widget. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile-class.md b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile-class.md new file mode 100644 index 000000000..4e7838b6e --- /dev/null +++ b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile-class.md @@ -0,0 +1,225 @@ + + + +# DateTimeTile class + + + + + + + + + +

Returns a widget tile(item) for displaying date and time.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- DateTimeTile + + + + + + + + +## Constructors + +[DateTimeTile](../widgets_event_date_time_tile/DateTimeTile/DateTimeTile.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) date, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) time, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setDate, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setTime}) + + _const_ + + +## Properties + +##### [date](../widgets_event_date_time_tile/DateTimeTile/date.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [setDate](../widgets_event_date_time_tile/DateTimeTile/setDate.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) + + + + +_final_ + + + +##### [setTime](../widgets_event_date_time_tile/DateTimeTile/setTime.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) + + + + +_final_ + + + +##### [time](../widgets_event_date_time_tile/DateTimeTile/time.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + + + +## Methods + +##### [build](../widgets_event_date_time_tile/DateTimeTile/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/DateTimeTile.md b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/DateTimeTile.md new file mode 100644 index 000000000..9a1255317 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/DateTimeTile.md @@ -0,0 +1,35 @@ + + + +# DateTimeTile constructor + + + + + + +const +DateTimeTile({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) date, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) time, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setDate, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setTime}) + + + + + +## Implementation + +```dart +const DateTimeTile({ + Key? key, + required this.date, + required this.time, + required this.setDate, + required this.setTime, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/build.md b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/build.md new file mode 100644 index 000000000..ab4c1078f --- /dev/null +++ b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/build.md @@ -0,0 +1,120 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Container( + color: Theme.of(context).colorScheme.primaryContainer, + height: SizeConfig.screenHeight! * 0.068, + width: double.infinity, + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: SizeConfig.screenWidth! * 0.083), + child: Row( + children: [ + const Icon( + Icons.calendar_today, + color: Color(0xff524F4F), + size: 19, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.045, + ), + InkWell( + key: const Key('EventDateTimeTileDate'), + onTap: () async { + setDate(); + }, + child: Text( + date, + style: const TextStyle(fontSize: 16), + ), + ), + const Spacer(), + const Icon( + Icons.schedule, + color: Color(0xff524F4F), + size: 19, + ), + SizedBox( + width: SizeConfig.screenWidth! * 0.045, + ), + InkWell( + key: const Key('EventDateTimeTileTime'), + onTap: () async { + setTime(); + }, + child: Text( + time, + style: const TextStyle(fontSize: 16), + ), + ), + ], + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/date.md b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/date.md new file mode 100644 index 000000000..5c32ea33f --- /dev/null +++ b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/date.md @@ -0,0 +1,32 @@ + + + +# date property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) date + +_final_ + + + + + + +## Implementation + +```dart +final String date; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/setDate.md b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/setDate.md new file mode 100644 index 000000000..b07f5810d --- /dev/null +++ b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/setDate.md @@ -0,0 +1,32 @@ + + + +# setDate property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setDate + +_final_ + + + + + + +## Implementation + +```dart +final Function setDate; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/setTime.md b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/setTime.md new file mode 100644 index 000000000..8ede21b12 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/setTime.md @@ -0,0 +1,32 @@ + + + +# setTime property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) setTime + +_final_ + + + + + + +## Implementation + +```dart +final Function setTime; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/time.md b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/time.md new file mode 100644 index 000000000..ebc301185 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_date_time_tile/DateTimeTile/time.md @@ -0,0 +1,32 @@ + + + +# time property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) time + +_final_ + + + + + + +## Implementation + +```dart +final String time; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_date_time_tile/widgets_event_date_time_tile-library.md b/talawa-mobile-docs/widgets_event_date_time_tile/widgets_event_date_time_tile-library.md new file mode 100644 index 000000000..c425fb7a5 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_date_time_tile/widgets_event_date_time_tile-library.md @@ -0,0 +1,38 @@ + + + + +# event_date_time_tile library + + + + + + + + + + + +## Classes + +##### [DateTimeTile](../widgets_event_date_time_tile/DateTimeTile-class.md) + + + +Returns a widget tile(item) for displaying date and time. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch-class.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch-class.md new file mode 100644 index 000000000..1b25b05d5 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch-class.md @@ -0,0 +1,279 @@ + + + +# EventSearch class + + + + + + + + + +

This class returns a list of the events which match the search query.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [SearchDelegate](https://api.flutter.dev/flutter/material/SearchDelegate-class.html)<[Event](../models_events_event_model/Event-class.md)> +- EventSearch + + + + + + + + +## Constructors + +[EventSearch](../widgets_event_search_delegate/EventSearch/EventSearch.md) ({required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../models_events_event_model/Event-class.md)> eventList, required [ExploreEventsViewModel](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) exploreEventsViewModel}) + + + + +## Properties + +##### [eventList](../widgets_event_search_delegate/EventSearch/eventList.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../models_events_event_model/Event-class.md)> + + + + +_final_ + + + +##### [exploreEventsViewModel](../widgets_event_search_delegate/EventSearch/exploreEventsViewModel.md) ↔ [ExploreEventsViewModel](../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) + + + + +_read / write_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [keyboardType](https://api.flutter.dev/flutter/material/SearchDelegate/keyboardType.html) → [TextInputType](https://api.flutter.dev/flutter/services/TextInputType-class.html)? + + + +The type of action button to use for the keyboard. +_finalinherited_ + + + +##### [query](https://api.flutter.dev/flutter/material/SearchDelegate/query.html) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +The current query string shown in the AppBar. +_read / writeinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [searchFieldDecorationTheme](https://api.flutter.dev/flutter/material/SearchDelegate/searchFieldDecorationTheme.html) → [InputDecorationTheme](https://api.flutter.dev/flutter/material/InputDecorationTheme-class.html)? + + + +The InputDecorationTheme used to configure the search field's visuals. +_finalinherited_ + + + +##### [searchFieldLabel](https://api.flutter.dev/flutter/material/SearchDelegate/searchFieldLabel.html) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + +The hint text that is shown in the search field when it is empty. +_finalinherited_ + + + +##### [searchFieldStyle](https://api.flutter.dev/flutter/material/SearchDelegate/searchFieldStyle.html) → [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html)? + + + +The style of the searchFieldLabel. +_finalinherited_ + + + +##### [textInputAction](https://api.flutter.dev/flutter/material/SearchDelegate/textInputAction.html) → [TextInputAction](https://api.flutter.dev/flutter/services/TextInputAction.html) + + + +The text input action configuring the soft keyboard to a particular action +button. +_finalinherited_ + + + +##### [transitionAnimation](https://api.flutter.dev/flutter/material/SearchDelegate/transitionAnimation.html) → [Animation](https://api.flutter.dev/flutter/animation/Animation-class.html)<[double](https://api.flutter.dev/flutter/dart-core/double-class.html)> + + + +Animation triggered when the search pages fades in or out. +_read-onlyinherited_ + + + + + +## Methods + +##### [appBarTheme](https://api.flutter.dev/flutter/material/SearchDelegate/appBarTheme.html)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [ThemeData](https://api.flutter.dev/flutter/material/ThemeData-class.html) + + + +The theme used to configure the search page. +_inherited_ + + + +##### [buildActions](../widgets_event_search_delegate/EventSearch/buildActions.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)> + + + +Widgets to display after the search query in the AppBar. +_override_ + + + +##### [buildBottom](https://api.flutter.dev/flutter/material/SearchDelegate/buildBottom.html)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [PreferredSizeWidget](https://api.flutter.dev/flutter/widgets/PreferredSizeWidget-class.html)? + + + +Widget to display across the bottom of the AppBar. +_inherited_ + + + +##### [buildLeading](../widgets_event_search_delegate/EventSearch/buildLeading.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +A widget to display before the current query in the AppBar. +_override_ + + + +##### [buildResults](../widgets_event_search_delegate/EventSearch/buildResults.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +The results shown after the user submits a search from the search page. +_override_ + + + +##### [buildSuggestions](../widgets_event_search_delegate/EventSearch/buildSuggestions.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Suggestions shown in the body of the search page while the user types a +query into the search field. +_override_ + + + +##### [buildSuggestionsSucess](../widgets_event_search_delegate/EventSearch/buildSuggestionsSucess.md)([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../models_events_event_model/Event-class.md)> suggestions) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + + + + + + +##### [close](https://api.flutter.dev/flutter/material/SearchDelegate/close.html)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context, [Event](../models_events_event_model/Event-class.md) result) void + + + +Closes the search page and returns to the underlying route. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [showResults](https://api.flutter.dev/flutter/material/SearchDelegate/showResults.html)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) void + + + +Transition from the suggestions returned by buildSuggestions to the +query results returned by buildResults. +_inherited_ + + + +##### [showSuggestions](https://api.flutter.dev/flutter/material/SearchDelegate/showSuggestions.html)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) void + + + +Transition from showing the results returned by buildResults to showing +the suggestions returned by buildSuggestions. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/EventSearch.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/EventSearch.md new file mode 100644 index 000000000..63dfbfee0 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/EventSearch.md @@ -0,0 +1,29 @@ + + + +# EventSearch constructor + + + + + + + +EventSearch({required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../../models_events_event_model/Event-class.md)> eventList, required [ExploreEventsViewModel](../../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) exploreEventsViewModel}) + + + + + +## Implementation + +```dart +EventSearch({required this.eventList, required this.exploreEventsViewModel}); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildActions.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildActions.md new file mode 100644 index 000000000..955593cee --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildActions.md @@ -0,0 +1,57 @@ + + + +# buildActions method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html)> buildActions +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Widgets to display after the search query in the AppBar.

+

If the query is not empty, this should typically contain a button to +clear the query and show the suggestions again (via showSuggestions) if +the results are currently shown.

+

Returns null if no widget should be shown.

+

See also:

+
    +
  • AppBar.actions, the intended use for the return value of this method.
  • +
+ + + +## Implementation + +```dart +@override +List buildActions(BuildContext context) { + /// Returns an icon button which closes the search page and returns + /// to the underlying route if the query is empty. Otherwise it sets the + /// query empty. + return [ + IconButton( + onPressed: () { + query.isNotEmpty ? query = '' : close(context, eventList.first); + }, + icon: const Icon(Icons.clear), + ) + ]; +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildLeading.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildLeading.md new file mode 100644 index 000000000..932c3165c --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildLeading.md @@ -0,0 +1,55 @@ + + + +# buildLeading method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) buildLeading +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

A widget to display before the current query in the AppBar.

+

Typically an IconButton configured with a BackButtonIcon that exits +the search with close. One can also use an AnimatedIcon driven by +transitionAnimation, which animates from e.g. a hamburger menu to the +back button as the search overlay fades in.

+

Returns null if no widget should be shown.

+

See also:

+
    +
  • AppBar.leading, the intended use for the return value of this method.
  • +
+ + + +## Implementation + +```dart +@override +Widget buildLeading(BuildContext context) { + /// Returns an icon button which closes the search page and returns + /// to the underlying route + return IconButton( + onPressed: () { + close(context, eventList.first); + }, + icon: const Icon(Icons.arrow_back), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildResults.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildResults.md new file mode 100644 index 000000000..f2746447d --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildResults.md @@ -0,0 +1,48 @@ + + + +# buildResults method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) buildResults +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

The results shown after the user submits a search from the search page.

+

The current value of query can be used to determine what the user +searched for.

+

This method might be applied more than once to the same query. +If your buildResults method is computationally expensive, you may want +to cache the search results for one or more queries.

+

Typically, this method returns a ListView with the search results. +When the user taps on a particular search result, close should be called +with the selected result as argument. This will close the search page and +communicate the result back to the initial caller of showSearch.

+ + + +## Implementation + +```dart +@override +Widget buildResults(BuildContext context) { + return Container(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildSuggestions.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildSuggestions.md new file mode 100644 index 000000000..214844f00 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildSuggestions.md @@ -0,0 +1,57 @@ + + + +# buildSuggestions method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) buildSuggestions +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Suggestions shown in the body of the search page while the user types a +query into the search field.

+

The delegate method is called whenever the content of query changes. +The suggestions should be based on the current query string. If the query +string is empty, it is good practice to show suggested queries based on +past queries or the current context.

+

Usually, this method will return a ListView with one ListTile per +suggestion. When ListTile.onTap is called, query should be updated +with the corresponding suggestion and the results page should be shown +by calling showResults.

+ + + +## Implementation + +```dart +@override +Widget buildSuggestions(BuildContext context) { + /// Returns a scrollable list through "buildSuggestionsSuccess" function. + /// where() method Returns a new lazy Iterable with all elements that satisfy the predicate test. + /// toList( ) method is used to convert an Iterable to a List. + /// toLowerCase() converts all characters in a string to lower case. + final suggestions = eventList.where((event) { + final eventLowerCase = event.title!.toLowerCase(); + final queryLowerCase = query.toLowerCase(); + return eventLowerCase.startsWith(queryLowerCase); + }).toList(); + return buildSuggestionsSucess(suggestions); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildSuggestionsSucess.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildSuggestionsSucess.md new file mode 100644 index 000000000..f4ebd1ef3 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/buildSuggestionsSucess.md @@ -0,0 +1,71 @@ + + + +# buildSuggestionsSucess method + + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) buildSuggestionsSucess +([List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../../models_events_event_model/Event-class.md)> suggestions) + + + + + + + + +## Implementation + +```dart +Widget buildSuggestionsSucess(List suggestions) { + /// Takes a List of Events as parameter which is passed by the "buildSuggestions" function. + /// Returns a SingleChildScrollView of the events from the list. + /// SingleChildScrollView is box in which a single widget can be scrolled. + return SingleChildScrollView( + child: ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: suggestions.length, + itemBuilder: (BuildContext context, int index) { + final highlightedText = + suggestions[index].title!.substring(0, query.length); + final normalText = suggestions[index].title!.substring(query.length); + + /// Returns a widget that detects gestures. + /// Defers to its child for its sizing behavior. + /// Navigates to the screen with the event information. + return GestureDetector( + onTap: () { + navigationService.pushScreen( + "/eventInfo", + arguments: { + "event": suggestions[index], + "exploreEventViewModel": exploreEventsViewModel + }, + ); + }, + child: EventCard( + event: suggestions[index], + isSearchItem: true, + eventTitleHighlightedText: highlightedText, + eventTitleNormalText: normalText, + ), + ); + }, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/eventList.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/eventList.md new file mode 100644 index 000000000..9fb10e4c0 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/eventList.md @@ -0,0 +1,32 @@ + + + +# eventList property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Event](../../models_events_event_model/Event-class.md)> eventList + +_final_ + + + + + + +## Implementation + +```dart +final List eventList; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/exploreEventsViewModel.md b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/exploreEventsViewModel.md new file mode 100644 index 000000000..3ca7e2f79 --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/EventSearch/exploreEventsViewModel.md @@ -0,0 +1,32 @@ + + + +# exploreEventsViewModel property + + + + + + + +[ExploreEventsViewModel](../../view_model_after_auth_view_models_event_view_models_explore_events_view_model/ExploreEventsViewModel-class.md) exploreEventsViewModel + +_read / write_ + + + + + + +## Implementation + +```dart +ExploreEventsViewModel exploreEventsViewModel; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_event_search_delegate/widgets_event_search_delegate-library.md b/talawa-mobile-docs/widgets_event_search_delegate/widgets_event_search_delegate-library.md new file mode 100644 index 000000000..100e00d1b --- /dev/null +++ b/talawa-mobile-docs/widgets_event_search_delegate/widgets_event_search_delegate-library.md @@ -0,0 +1,38 @@ + + + + +# event_search_delegate library + + + + + + + + + + + +## Classes + +##### [EventSearch](../widgets_event_search_delegate/EventSearch-class.md) + + + +This class returns a list of the events which match the search query. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes-class.md b/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes-class.md new file mode 100644 index 000000000..29596a85e --- /dev/null +++ b/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes-class.md @@ -0,0 +1,189 @@ + + + +# FromPalisadoes class + + + + + + + + + +

This class generates the text "From Palisadoes" in a custom way.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- FromPalisadoes + + + + + + + + +## Constructors + +[FromPalisadoes](../widgets_from_palisadoes/FromPalisadoes/FromPalisadoes.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_from_palisadoes/FromPalisadoes/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes/FromPalisadoes.md b/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes/FromPalisadoes.md new file mode 100644 index 000000000..2932b6ed5 --- /dev/null +++ b/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes/FromPalisadoes.md @@ -0,0 +1,29 @@ + + + +# FromPalisadoes constructor + + + + + + +const +FromPalisadoes({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const FromPalisadoes({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes/build.md b/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes/build.md new file mode 100644 index 000000000..e4b6eb4cf --- /dev/null +++ b/talawa-mobile-docs/widgets_from_palisadoes/FromPalisadoes/build.md @@ -0,0 +1,106 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Column( + children: [ + // Customizing the word "from". + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + // This method is called for localized text. + AppLocalizations.of(context)!.strictTranslate('from'), + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + SizedBox( + height: SizeConfig.blockSizeHorizontal, + ), + // Customizing the word "Palisadoes". + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'PALISADOES', + style: Theme.of(context) + .textTheme + .titleSmall! + .copyWith(fontWeight: FontWeight.w700), + ), + ], + ), + SizedBox( + height: SizeConfig.blockSizeHorizontal! * 5, + ), + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_from_palisadoes/widgets_from_palisadoes-library.md b/talawa-mobile-docs/widgets_from_palisadoes/widgets_from_palisadoes-library.md new file mode 100644 index 000000000..f0fec4648 --- /dev/null +++ b/talawa-mobile-docs/widgets_from_palisadoes/widgets_from_palisadoes-library.md @@ -0,0 +1,38 @@ + + + + +# from_palisadoes library + + + + + + + + + + + +## Classes + +##### [FromPalisadoes](../widgets_from_palisadoes/FromPalisadoes-class.md) + + + +This class generates the text "From Palisadoes" in a custom way. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_invite_child/iconButton.md b/talawa-mobile-docs/widgets_invite_child/iconButton.md new file mode 100644 index 000000000..69577b9a8 --- /dev/null +++ b/talawa-mobile-docs/widgets_invite_child/iconButton.md @@ -0,0 +1,51 @@ + + + +# iconButton function + + + + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) iconButton +([String](https://api.flutter.dev/flutter/dart-core/String-class.html) key, [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) icon, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) onTap) + + + + + +

This function is for debugging purposes. +It prints "tapped" in the console for the developer to know that the button was tapped.

+ + + +## Implementation + +```dart +Widget iconButton(String key, Widget icon, Function onTap) { + return Stack( + children: [ + IconButton( + key: Key(key), + onPressed: () { + print('tapped'); + onTap(); + }, + icon: icon, + ), + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_invite_child/invite.md b/talawa-mobile-docs/widgets_invite_child/invite.md new file mode 100644 index 000000000..2b55a998b --- /dev/null +++ b/talawa-mobile-docs/widgets_invite_child/invite.md @@ -0,0 +1,122 @@ + + + +# invite function + + + + + + + + + + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) invite +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + + + + + +

This widget gives us various options to invite someone to an organization. +We can use QR code scanner, social media platforms like twitter, whatsapp, telegram and many more.

+ + + +## Implementation + +```dart +Widget invite(BuildContext context) { + _appLanguageService.initialize(); + + final String url = + 'https://cyberwake.github.io/applink/invite?selectLang=${_appLanguageService.appLocal.languageCode}&setUrl=${GraphqlConfig.orgURI}&selectOrg=${userConfig.currentOrg.id!}'; + final String qrData = + '${GraphqlConfig.orgURI}?orgid=${userConfig.currentOrg.id!}'; + + // print(url); + // print(qrData); + + return Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + //Scan the below given QR code to join the organization. + QrImage( + key: const Key("QRcode"), + data: qrData, + version: QrVersions.auto, + size: 200.0, + foregroundColor: Colors.black, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.08, + ), + Text( + 'Scan the QR to join ${userConfig.currentOrg.name}', + style: const TextStyle(color: Colors.black), + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.02, + ), + //Tap on the Twitter icon to join the organization through Twitter. + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.min, + children: [ + iconButton( + "Twitter", + const FaIcon( + FontAwesomeIcons.twitter, + size: 35, + color: Color(0xFF1DA1F2), + ), + () async => SocialShare.shareTwitter('Join us', url: url), + ), + //Tap on the Whatsapp icon to join the organization through Whatsapp. + iconButton( + "WhatsApp", + CustomPaint( + size: const Size( + 50, + 50 * 1.004, + ), //You can Replace [WIDTH] with your desired width for Custom Paint and height will be calculated automatically + painter: WhatsappLogo(), + ), + () async => SocialShare.shareWhatsapp(url), + ), + iconButton( + "Telegram", + CustomPaint( + size: Size( + 45, + (45 * 1).toDouble(), + ), //You can Replace [WIDTH] with your desired width for Custom Paint and height will be calculated automatically + painter: TelegramLogo(), + ), + () async => SocialShare.shareTelegram(url), + ), + iconButton( + "Alt", + const FaIcon( + FontAwesomeIcons.shareNodes, + size: 30, + color: Color(0xff40c351), + ), + () async => SocialShare.shareOptions(url), + ), + ], + ) + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_invite_child/widgets_invite_child-library.md b/talawa-mobile-docs/widgets_invite_child/widgets_invite_child-library.md new file mode 100644 index 000000000..dfc730d90 --- /dev/null +++ b/talawa-mobile-docs/widgets_invite_child/widgets_invite_child-library.md @@ -0,0 +1,51 @@ + + + + +# invite_child library + + + + + + + + + + + + + + + + +## Functions + +##### [iconButton](../widgets_invite_child/iconButton.md)([String](https://api.flutter.dev/flutter/dart-core/String-class.html) key, [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) icon, [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) onTap) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +This function is for debugging purposes. +It prints "tapped" in the console for the developer to know that the button was tapped. + + + + +##### [invite](../widgets_invite_child/invite.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +This widget gives us various options to invite someone to an organization. +We can use QR code scanner, social media platforms like twitter, whatsapp, telegram and many more. + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_lang_switch/LanguageTile-class.md b/talawa-mobile-docs/widgets_lang_switch/LanguageTile-class.md new file mode 100644 index 000000000..436640611 --- /dev/null +++ b/talawa-mobile-docs/widgets_lang_switch/LanguageTile-class.md @@ -0,0 +1,189 @@ + + + +# LanguageTile class + + + + + + + + + +

This widget enables language switch for "internationalizing our app".

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- LanguageTile + + + + + + + + +## Constructors + +[LanguageTile](../widgets_lang_switch/LanguageTile/LanguageTile.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_lang_switch/LanguageTile/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_lang_switch/LanguageTile/LanguageTile.md b/talawa-mobile-docs/widgets_lang_switch/LanguageTile/LanguageTile.md new file mode 100644 index 000000000..34f40dc1f --- /dev/null +++ b/talawa-mobile-docs/widgets_lang_switch/LanguageTile/LanguageTile.md @@ -0,0 +1,29 @@ + + + +# LanguageTile constructor + + + + + + +const +LanguageTile({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const LanguageTile({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_lang_switch/LanguageTile/build.md b/talawa-mobile-docs/widgets_lang_switch/LanguageTile/build.md new file mode 100644 index 000000000..71ec7fde9 --- /dev/null +++ b/talawa-mobile-docs/widgets_lang_switch/LanguageTile/build.md @@ -0,0 +1,97 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + //AppLanguage enables to set up localized values for each locale that our app supports. + //A locale is an identifier used to select a user's language and formatting preferences. + //This represents a Unicode Language Identifier (i.e. without Locale extensions), + //except variants are not supported. + return Consumer( + builder: (context, appLang, _) { + final Language userLanguage = languages.firstWhere( + (element) => element.langCode == appLang.appLocal.languageCode, + ); + return ListTile( + key: const Key('LanguageTile'), + contentPadding: EdgeInsets.zero, + title: + Text(AppLocalizations.of(context)!.strictTranslate("Language")), + trailing: TextButton( + key: const Key('LanguageSelector'), + onPressed: () { + navigationService.pushReplacementScreen( + '/selectLang', + arguments: '0', + ); + }, + child: Text(userLanguage.langName), + ), + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_lang_switch/widgets_lang_switch-library.md b/talawa-mobile-docs/widgets_lang_switch/widgets_lang_switch-library.md new file mode 100644 index 000000000..d09274809 --- /dev/null +++ b/talawa-mobile-docs/widgets_lang_switch/widgets_lang_switch-library.md @@ -0,0 +1,38 @@ + + + + +# lang_switch library + + + + + + + + + + + +## Classes + +##### [LanguageTile](../widgets_lang_switch/LanguageTile-class.md) + + + +This widget enables language switch for "internationalizing our app". + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile-class.md b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile-class.md new file mode 100644 index 000000000..10202832b --- /dev/null +++ b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile-class.md @@ -0,0 +1,219 @@ + + + +# MemberNameTile class + + + + + + + + + +

This widget returns a tile containing the name of the member. +Along with the name, there is a circle avatar which either contains +the image uploaded by the user or the first character of his/her name in +uppercase.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- MemberNameTile + + + + + + + + +## Constructors + +[MemberNameTile](../widgets_member_name_tile/MemberNameTile/MemberNameTile.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) userName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? userImage, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) onDelete}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [onDelete](../widgets_member_name_tile/MemberNameTile/onDelete.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [userImage](../widgets_member_name_tile/MemberNameTile/userImage.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? + + + + +_final_ + + + +##### [userName](../widgets_member_name_tile/MemberNameTile/userName.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + + + +## Methods + +##### [build](../widgets_member_name_tile/MemberNameTile/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/MemberNameTile.md b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/MemberNameTile.md new file mode 100644 index 000000000..a2ae5471c --- /dev/null +++ b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/MemberNameTile.md @@ -0,0 +1,34 @@ + + + +# MemberNameTile constructor + + + + + + +const +MemberNameTile({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) userName, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? userImage, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) onDelete}) + + + + + +## Implementation + +```dart +const MemberNameTile({ + Key? key, + required this.userName, + this.userImage, + required this.onDelete, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/build.md b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/build.md new file mode 100644 index 000000000..2a1b65b43 --- /dev/null +++ b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/build.md @@ -0,0 +1,119 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 10, right: 5), + child: Container( + width: SizeConfig.screenWidth! * (0.3 + userName.length / 50), + height: SizeConfig.screenHeight! * 0.04, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(SizeConfig.screenHeight! * 0.02), + color: Theme.of(context).colorScheme.primaryContainer, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Background is set with the image uploaded by the user. + userImage != null + ? CircleAvatar( + radius: SizeConfig.screenHeight! * 0.0201, + backgroundImage: NetworkImage(userImage!), + ) + // If the user has not uploaded his/her image, then a circle avatar is created. + // It has the first character of the user's name in uppercase and the default background color. + : CircleAvatar( + radius: SizeConfig.screenHeight! * 0.0201, + backgroundColor: Theme.of(context).colorScheme.secondary, + child: Text( + userName.substring(0, 1).toUpperCase(), + style: const TextStyle(color: Colors.white), + ), + ), + // The name of the member in text form. + Padding( + padding: const EdgeInsets.only(left: 5), + child: Text( + userName, + ), + ), + IconButton( + padding: EdgeInsets.zero, + onPressed: () => onDelete(), + icon: const Icon( + Icons.cancel_rounded, + color: Color(0xff524F4F), + size: 19, + ), + ) + ], + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/onDelete.md b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/onDelete.md new file mode 100644 index 000000000..043ff31fe --- /dev/null +++ b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/onDelete.md @@ -0,0 +1,32 @@ + + + +# onDelete property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) onDelete + +_final_ + + + + + + +## Implementation + +```dart +final Function onDelete; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/userImage.md b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/userImage.md new file mode 100644 index 000000000..a26568fc3 --- /dev/null +++ b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/userImage.md @@ -0,0 +1,32 @@ + + + +# userImage property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? userImage + +_final_ + + + + + + +## Implementation + +```dart +final String? userImage; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/userName.md b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/userName.md new file mode 100644 index 000000000..196794fd6 --- /dev/null +++ b/talawa-mobile-docs/widgets_member_name_tile/MemberNameTile/userName.md @@ -0,0 +1,32 @@ + + + +# userName property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) userName + +_final_ + + + + + + +## Implementation + +```dart +final String userName; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_member_name_tile/widgets_member_name_tile-library.md b/talawa-mobile-docs/widgets_member_name_tile/widgets_member_name_tile-library.md new file mode 100644 index 000000000..a2d0955cb --- /dev/null +++ b/talawa-mobile-docs/widgets_member_name_tile/widgets_member_name_tile-library.md @@ -0,0 +1,41 @@ + + + + +# member_name_tile library + + + + + + + + + + + +## Classes + +##### [MemberNameTile](../widgets_member_name_tile/MemberNameTile-class.md) + + + +This widget returns a tile containing the name of the member. +Along with the name, there is a circle avatar which either contains +the image uploaded by the user or the first character of his/her name in +uppercase. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_list/OrganizationList-class.md b/talawa-mobile-docs/widgets_organization_list/OrganizationList-class.md new file mode 100644 index 000000000..11404fa29 --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_list/OrganizationList-class.md @@ -0,0 +1,200 @@ + + + +# OrganizationList class + + + + + + + + + +

This class returns the OrganizationList widget.

+

which shows the list of all organizations exists in the URL. +This widget is used after the authentication.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- OrganizationList + + + + + + + + +## Constructors + +[OrganizationList](../widgets_organization_list/OrganizationList/OrganizationList.md) ({required [SelectOrganizationViewModel](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) model, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [model](../widgets_organization_list/OrganizationList/model.md) → [SelectOrganizationViewModel](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) + + + +model is a type of SelectOrganizationViewModel which provides methods to handle the data for this component. +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_organization_list/OrganizationList/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_list/OrganizationList/OrganizationList.md b/talawa-mobile-docs/widgets_organization_list/OrganizationList/OrganizationList.md new file mode 100644 index 000000000..d697ef284 --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_list/OrganizationList/OrganizationList.md @@ -0,0 +1,29 @@ + + + +# OrganizationList constructor + + + + + + +const +OrganizationList({required [SelectOrganizationViewModel](../../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) model, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const OrganizationList({required this.model, Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_list/OrganizationList/build.md b/talawa-mobile-docs/widgets_organization_list/OrganizationList/build.md new file mode 100644 index 000000000..b4c96e963 --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_list/OrganizationList/build.md @@ -0,0 +1,185 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + final navigationServiceLocal = locator(); + model.organizations = []; + int noOfRefetch = 0; + return GraphQLProvider( + client: ValueNotifier(graphqlConfig.clientToQuery()), + child: Query( + options: QueryOptions( + document: gql(queries.fetchJoinInOrg), + variables: { + // fetch 15 items only, will fetch more when scrolling index is at the 3rd last item! + 'first': 15, + 'skip': 0, + }, + ), + builder: ( + QueryResult result, { + Future Function(FetchMoreOptions)? fetchMore, + Future Function()? refetch, + }) { + // checking for any errors, if true fetch again! + if (result.hasException) { + final isException = databaseFunctions.encounteredExceptionOrError( + result.exception!, + showSnackBar: noOfRefetch == 0, + ); + if (isException != null) { + if (isException) { + refetch!(); + noOfRefetch++; + } else { + refetch!(); + noOfRefetch++; + } + } + } else { + // If the result is still loading! + if (!result.isLoading) { + model.organizations = OrgInfo().fromJsonToList( + result.data!['organizationsConnection'] as List, + ); + } + + Timer(const Duration(seconds: TimeOuts.small), () { + if (model.organizations.isEmpty) { + navigationServiceLocal.showTalawaErrorDialog( + "No organizations found Please contact your admin", + MessageType.error, + ); + } + }); + return Scrollbar( + thumbVisibility: true, + interactive: true, + controller: model.allOrgController, + // Listview is a scrollable list of widgets arranged linearly. + child: ListView.separated( + controller: model.allOrgController, + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: result.isLoading + ? model.organizations.length + 1 + : model.organizations.length, + itemBuilder: (BuildContext context, int index) { + // If the index is at the end of the list! + if (index == model.organizations.length) { + // return the ListTile showing the loading icon! + return ListTile( + title: Center( + child: CupertinoActivityIndicator( + radius: SizeConfig.screenWidth! * 0.065, + ), + ), + ); + } + // If the index is at the 3rd last item in the organization list. + if (index == model.organizations.length - 3) { + // return VisibilityDetector and fetch more items in the list to show up! + return VisibilityDetector( + key: const Key('OrgSelItem'), + onVisibilityChanged: (VisibilityInfo info) { + if (info.visibleFraction > 0) { + model.fetchMoreHelper( + fetchMore!, + model.organizations, + ); + } + }, + child: CustomListTile( + index: index, + type: TileType.org, + orgInfo: model.organizations[index], + onTapOrgInfo: (item) => model.selectOrg(item), + key: Key('OrgSelItem$index'), + ), + ); + } + // return CustomeTile that shows a particular item in the list! + return CustomListTile( + index: index, + type: TileType.org, + orgInfo: model.organizations[index], + onTapOrgInfo: (item) => model.selectOrg(item), + key: Key('OrgSelItem$index'), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Container(); + }, + ), + ); + } + return Container(); + }, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_list/OrganizationList/model.md b/talawa-mobile-docs/widgets_organization_list/OrganizationList/model.md new file mode 100644 index 000000000..d08ac7e69 --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_list/OrganizationList/model.md @@ -0,0 +1,33 @@ + + + +# model property + + + + + + + +[SelectOrganizationViewModel](../../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) model + +_final_ + + + +

model is a type of SelectOrganizationViewModel which provides methods to handle the data for this component.

+ + + +## Implementation + +```dart +final SelectOrganizationViewModel model; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_list/widgets_organization_list-library.md b/talawa-mobile-docs/widgets_organization_list/widgets_organization_list-library.md new file mode 100644 index 000000000..dfd618cfd --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_list/widgets_organization_list-library.md @@ -0,0 +1,38 @@ + + + + +# organization_list library + + + + + + + + + + + +## Classes + +##### [OrganizationList](../widgets_organization_list/OrganizationList-class.md) + + + +This class returns the OrganizationList widget. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList-class.md b/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList-class.md new file mode 100644 index 000000000..c7def0d5c --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList-class.md @@ -0,0 +1,199 @@ + + + +# OrganizationSearchList class + + + + + + + + + +

OrganizationSearchList class return a widget that shows all +the matching organizations searched on the search bar.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- OrganizationSearchList + + + + + + + + +## Constructors + +[OrganizationSearchList](../widgets_organization_search_list/OrganizationSearchList/OrganizationSearchList.md) ({required [SelectOrganizationViewModel](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) model, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [model](../widgets_organization_search_list/OrganizationSearchList/model.md) → [SelectOrganizationViewModel](../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_organization_search_list/OrganizationSearchList/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/OrganizationSearchList.md b/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/OrganizationSearchList.md new file mode 100644 index 000000000..96e9f385d --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/OrganizationSearchList.md @@ -0,0 +1,30 @@ + + + +# OrganizationSearchList constructor + + + + + + +const +OrganizationSearchList({required [SelectOrganizationViewModel](../../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) model, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const OrganizationSearchList({required this.model, Key? key}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/build.md b/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/build.md new file mode 100644 index 000000000..9ce460535 --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/build.md @@ -0,0 +1,182 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return GraphQLProvider( + client: ValueNotifier(graphqlConfig.authClient()), + child: Query( + options: QueryOptions( + document: gql(Queries().fetchJoinInOrgByName), + variables: { + 'nameStartsWith': model.searchController.text, + // fetch 30 items only, will fetch more when scrolling index is at the 3rd last item! + 'first': 30, + 'skip': 0, + }, + ), + builder: ( + QueryResult result, { + Future Function(FetchMoreOptions)? fetchMore, + Future Function()? refetch, + }) { + // checking for any errors, if true fetch again! + if (result.hasException) { + final isException = databaseFunctions.encounteredExceptionOrError( + result.exception!, + showSnackBar: false, + ); + if (isException!) { + refetch!(); + } else { + refetch!(); + } + } else { + // If the result is still loading! + if (!result.isLoading) { + model.organizations = OrgInfo().fromJsonToList( + result.data!['organizationsConnection'] as List, + ); + } + // return the Scroll bar widget for scrolling down the organizations. + return Scrollbar( + thumbVisibility: true, + interactive: true, + controller: model.controller, + // Listview is a scrollable list of widgets arranged linearly. + child: ListView.separated( + controller: model.controller, + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: result.isLoading + ? model.organizations.length + 1 + : model.organizations.length, + itemBuilder: (BuildContext context, int index) { + // If the index is at the end of the list! + if (index == model.organizations.length) { + // return the ListTile showing the loading icon! + return ListTile( + title: Center( + child: CupertinoActivityIndicator( + radius: SizeConfig.screenWidth! * 0.065, + ), + ), + ); + } + // If the index is at the 3rd last item in the organization list. + if (index == model.organizations.length - 3) { + // return VisibilityDetector and fetch more items in the list to show up! + return VisibilityDetector( + key: const Key('OrgSelItem'), + onVisibilityChanged: (VisibilityInfo info) { + if (info.visibleFraction > 0) { + print(model.organizations.length); + model.fetchMoreHelper( + fetchMore!, + model.organizations, + ); + print(model.organizations.length); + } + }, + child: CustomListTile( + index: index, + type: TileType.org, + orgInfo: model.organizations[index], + onTapOrgInfo: (item) => model.selectOrg(item), + key: Key('OrgSelItem$index'), + ), + ); + } + // return CustomeTile that shows a particular item in the list! + return CustomListTile( + index: index, + type: TileType.org, + orgInfo: model.organizations[index], + onTapOrgInfo: (item) => model.selectOrg(item), + key: Key('OrgSelItem$index'), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.only( + left: SizeConfig.screenWidth! * 0.2, + right: 12, + ), + child: const Divider( + color: Color(0xFFE5E5E5), + thickness: 0.5, + ), + ); + }, + ), + ); + } + return Container(); + }, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/model.md b/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/model.md new file mode 100644 index 000000000..5906910b4 --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_search_list/OrganizationSearchList/model.md @@ -0,0 +1,32 @@ + + + +# model property + + + + + + + +[SelectOrganizationViewModel](../../view_model_pre_auth_view_models_select_organization_view_model/SelectOrganizationViewModel-class.md) model + +_final_ + + + + + + +## Implementation + +```dart +final SelectOrganizationViewModel model; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_organization_search_list/widgets_organization_search_list-library.md b/talawa-mobile-docs/widgets_organization_search_list/widgets_organization_search_list-library.md new file mode 100644 index 000000000..bfd5d1159 --- /dev/null +++ b/talawa-mobile-docs/widgets_organization_search_list/widgets_organization_search_list-library.md @@ -0,0 +1,39 @@ + + + + +# organization_search_list library + + + + + + + + + + + +## Classes + +##### [OrganizationSearchList](../widgets_organization_search_list/OrganizationSearchList-class.md) + + + +OrganizationSearchList class return a widget that shows all +the matching organizations searched on the search bar. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller-class.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller-class.md new file mode 100644 index 000000000..cf25bd381 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller-class.md @@ -0,0 +1,209 @@ + + + +# CustomCarouselScroller class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- CustomCarouselScroller + + + + + + +**Annotations** + +- @[visibleForTesting](https://pub.dev/documentation/meta/1.8.0/meta/visibleForTesting-constant.html) + + +## Constructors + +[CustomCarouselScroller](../widgets_pinned_carousel_widget/CustomCarouselScroller/CustomCarouselScroller.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> pinnedPosts, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToIndividualPostPage}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [navigateToIndividualPostPage](../widgets_pinned_carousel_widget/CustomCarouselScroller/navigateToIndividualPostPage.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) + + + + +_final_ + + + +##### [pinnedPosts](../widgets_pinned_carousel_widget/CustomCarouselScroller/pinnedPosts.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../widgets_pinned_carousel_widget/CustomCarouselScroller/createState.md)() [CustomCarouselScrollerState](../widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md) + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/CustomCarouselScroller.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/CustomCarouselScroller.md new file mode 100644 index 000000000..5cb9c6ebd --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/CustomCarouselScroller.md @@ -0,0 +1,33 @@ + + + +# CustomCarouselScroller constructor + + + + + + +const +CustomCarouselScroller({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> pinnedPosts, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToIndividualPostPage}) + + + + + +## Implementation + +```dart +const CustomCarouselScroller({ + Key? key, + required this.pinnedPosts, + required this.navigateToIndividualPostPage, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/createState.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/createState.md new file mode 100644 index 000000000..581e73be4 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[CustomCarouselScrollerState](../../widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md) createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +CustomCarouselScrollerState createState() => CustomCarouselScrollerState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/navigateToIndividualPostPage.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/navigateToIndividualPostPage.md new file mode 100644 index 000000000..362a98fd3 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/navigateToIndividualPostPage.md @@ -0,0 +1,32 @@ + + + +# navigateToIndividualPostPage property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToIndividualPostPage + +_final_ + + + + + + +## Implementation + +```dart +final Function navigateToIndividualPostPage; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/pinnedPosts.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/pinnedPosts.md new file mode 100644 index 000000000..4071846ea --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScroller/pinnedPosts.md @@ -0,0 +1,32 @@ + + + +# pinnedPosts property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> pinnedPosts + +_final_ + + + + + + +## Implementation + +```dart +final List pinnedPosts; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md new file mode 100644 index 000000000..3af904b51 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md @@ -0,0 +1,268 @@ + + + +# CustomCarouselScrollerState class + + + + + + + + + +

CustomCarouselScrollerState class return a widget that is +used to generate slider for pinned post on the top of the Home Screen.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [State](https://api.flutter.dev/flutter/widgets/State-class.html)<[CustomCarouselScroller](../widgets_pinned_carousel_widget/CustomCarouselScroller-class.md)> +- CustomCarouselScrollerState + + + + +**Available Extensions** + +- [StateExt](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/StateExt.html) + + +**Annotations** + +- @[visibleForTesting](https://pub.dev/documentation/meta/1.8.0/meta/visibleForTesting-constant.html) + + +## Constructors + +[CustomCarouselScrollerState](../widgets_pinned_carousel_widget/CustomCarouselScrollerState/CustomCarouselScrollerState.md) () + + + + +## Properties + +##### [context](https://api.flutter.dev/flutter/widgets/State/context.html) → [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) + + + +The location in the tree where this widget builds. +_read-onlyinherited_ + + + +##### [controller](../widgets_pinned_carousel_widget/CustomCarouselScrollerState/controller.md) → [PageController](https://api.flutter.dev/flutter/widgets/PageController-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [mounted](https://api.flutter.dev/flutter/widgets/State/mounted.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether this State object is currently in a tree. +_read-onlyinherited_ + + + +##### [pindex](../widgets_pinned_carousel_widget/CustomCarouselScrollerState/pindex.md) ↔ [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [widget](https://api.flutter.dev/flutter/widgets/State/widget.html) → [CustomCarouselScroller](../widgets_pinned_carousel_widget/CustomCarouselScroller-class.md) + + + +The current configuration. +_read-onlyinherited_ + + + + + +## Methods + +##### [activate](https://api.flutter.dev/flutter/widgets/State/activate.html)() void + + + +Called when this object is reinserted into the tree after having been +removed via deactivate. +_inherited_ + + + +##### [build](../widgets_pinned_carousel_widget/CustomCarouselScrollerState/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [deactivate](https://api.flutter.dev/flutter/widgets/State/deactivate.html)() void + + + +Called when this object is removed from the tree. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/State/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [didChangeDependencies](https://api.flutter.dev/flutter/widgets/State/didChangeDependencies.html)() void + + + +Called when a dependency of this State object changes. +_inherited_ + + + +##### [didUpdateWidget](https://api.flutter.dev/flutter/widgets/State/didUpdateWidget.html)(covariant [CustomCarouselScroller](../widgets_pinned_carousel_widget/CustomCarouselScroller-class.md) oldWidget) void + + + +Called whenever the widget configuration changes. +_inherited_ + + + +##### [dispose](https://api.flutter.dev/flutter/widgets/State/dispose.html)() void + + + +Called when this object is removed from the tree permanently. +_inherited_ + + + +##### [initState](https://api.flutter.dev/flutter/widgets/State/initState.html)() void + + + +Called when this object is inserted into the tree. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [reassemble](https://api.flutter.dev/flutter/widgets/State/reassemble.html)() void + + + +Called whenever the application is reassembled during debugging, for +example during hot reload. +_inherited_ + + + +##### [setState](https://api.flutter.dev/flutter/widgets/State/setState.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) fn) void + + + +Notify the framework that the internal state of this object has changed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/Diagnosticable/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/foundation/Diagnosticable/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A brief description of this object, usually just the runtimeType and the +hashCode. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/CustomCarouselScrollerState.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/CustomCarouselScrollerState.md new file mode 100644 index 000000000..c6b1a3deb --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/CustomCarouselScrollerState.md @@ -0,0 +1,24 @@ + + + +# CustomCarouselScrollerState constructor + + + + + + + +CustomCarouselScrollerState() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/controller.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/controller.md new file mode 100644 index 000000000..1ba09ce41 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/controller.md @@ -0,0 +1,32 @@ + + + +# controller property + + + + + + + +[PageController](https://api.flutter.dev/flutter/widgets/PageController-class.html) controller + +_final_ + + + + + + +## Implementation + +```dart +final PageController controller = PageController(initialPage: 0); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/pindex.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/pindex.md new file mode 100644 index 000000000..e609f0c28 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/pindex.md @@ -0,0 +1,32 @@ + + + +# pindex property + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) pindex + +_read / write_ + + + + + + +## Implementation + +```dart +int pindex = 0; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel-class.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel-class.md new file mode 100644 index 000000000..fc37c1891 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel-class.md @@ -0,0 +1,218 @@ + + + +# PinnedPostCarousel class + + + + + + + + + +

PinnedPostCarousel class returns a widget for pinned posts in +the slider/carousel on the top of the Home Screen. +Tapping on a post will redirect you to the respective post screen.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- PinnedPostCarousel + + + + + + + + +## Constructors + +[PinnedPostCarousel](../widgets_pinned_carousel_widget/PinnedPostCarousel/PinnedPostCarousel.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> pinnedPosts, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToPinnedPostPage, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToIndividualPostPage}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [navigateToIndividualPostPage](../widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToIndividualPostPage.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) + + + + +_final_ + + + +##### [navigateToPinnedPostPage](../widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToPinnedPostPage.md) → [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) + + + + +_final_ + + + +##### [pinnedPosts](../widgets_pinned_carousel_widget/PinnedPostCarousel/pinnedPosts.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_pinned_carousel_widget/PinnedPostCarousel/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/PinnedPostCarousel.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/PinnedPostCarousel.md new file mode 100644 index 000000000..f2cc5392f --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/PinnedPostCarousel.md @@ -0,0 +1,34 @@ + + + +# PinnedPostCarousel constructor + + + + + + +const +PinnedPostCarousel({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> pinnedPosts, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToPinnedPostPage, required [Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToIndividualPostPage}) + + + + + +## Implementation + +```dart +const PinnedPostCarousel({ + Key? key, + required this.pinnedPosts, + required this.navigateToPinnedPostPage, + required this.navigateToIndividualPostPage, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/build.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/build.md new file mode 100644 index 000000000..8010d7a73 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/build.md @@ -0,0 +1,119 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Column( + children: [ + Container( + height: 220, + color: + Theme.of(context).colorScheme.primaryContainer.withOpacity(0.5), + child: CustomCarouselScroller( + pinnedPosts: pinnedPosts, + key: const Key('Carousel'), + navigateToIndividualPostPage: navigateToIndividualPostPage, + ), + ), + // Gesture Detector in Flutter is used to detect the user's gestures on the application. + // It is a non-visual widget. Inside the gesture detector, another widget is placed and + // the gesture detector will capture all these events (gestures) and execute the tasks accordingly. + GestureDetector( + onTap: () => navigateToPinnedPostPage(), + child: Container( + height: 50, + width: SizeConfig.screenWidth, + padding: const EdgeInsets.symmetric(horizontal: 16.0), + color: Theme.of(context).colorScheme.primaryContainer, + child: Row( + children: [ + Expanded( + flex: 1, + child: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon( + Icons.article, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ), + Expanded( + flex: 8, + child: Text( + AppLocalizations.of(context)! + .strictTranslate("See all Pinned news"), + style: Theme.of(context).textTheme.titleLarge, + ), + ), + const Expanded(flex: 1, child: Icon(Icons.arrow_forward_ios)) + ], + ), + ), + ) + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToIndividualPostPage.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToIndividualPostPage.md new file mode 100644 index 000000000..362a98fd3 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToIndividualPostPage.md @@ -0,0 +1,32 @@ + + + +# navigateToIndividualPostPage property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToIndividualPostPage + +_final_ + + + + + + +## Implementation + +```dart +final Function navigateToIndividualPostPage; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToPinnedPostPage.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToPinnedPostPage.md new file mode 100644 index 000000000..9fbe8e275 --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/navigateToPinnedPostPage.md @@ -0,0 +1,32 @@ + + + +# navigateToPinnedPostPage property + + + + + + + +[Function](https://api.flutter.dev/flutter/dart-core/Function-class.html) navigateToPinnedPostPage + +_final_ + + + + + + +## Implementation + +```dart +final Function navigateToPinnedPostPage; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/pinnedPosts.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/pinnedPosts.md new file mode 100644 index 000000000..4071846ea --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/PinnedPostCarousel/pinnedPosts.md @@ -0,0 +1,32 @@ + + + +# pinnedPosts property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> pinnedPosts + +_final_ + + + + + + +## Implementation + +```dart +final List pinnedPosts; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_pinned_carousel_widget/widgets_pinned_carousel_widget-library.md b/talawa-mobile-docs/widgets_pinned_carousel_widget/widgets_pinned_carousel_widget-library.md new file mode 100644 index 000000000..a40cca69e --- /dev/null +++ b/talawa-mobile-docs/widgets_pinned_carousel_widget/widgets_pinned_carousel_widget-library.md @@ -0,0 +1,55 @@ + + + + +# pinned_carousel_widget library + + + + + + + + + + + +## Classes + +##### [CustomCarouselScroller](../widgets_pinned_carousel_widget/CustomCarouselScroller-class.md) + + + + + + +##### [CustomCarouselScrollerState](../widgets_pinned_carousel_widget/CustomCarouselScrollerState-class.md) + + + +CustomCarouselScrollerState class return a widget that is +used to generate slider for pinned post on the top of the Home Screen. + + +##### [PinnedPostCarousel](../widgets_pinned_carousel_widget/PinnedPostCarousel-class.md) + + + +PinnedPostCarousel class returns a widget for pinned posts in +the slider/carousel on the top of the Home Screen. +Tapping on a post will redirect you to the respective post screen. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget-class.md b/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget-class.md new file mode 100644 index 000000000..270bf50da --- /dev/null +++ b/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget-class.md @@ -0,0 +1,201 @@ + + + +# DescriptionTextWidget class + + + + + + + + + +

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).

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- DescriptionTextWidget + + + + + + + + +## Constructors + +[DescriptionTextWidget](../widgets_post_detailed_page/DescriptionTextWidget/DescriptionTextWidget.md) ({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) text}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [text](../widgets_post_detailed_page/DescriptionTextWidget/text.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../widgets_post_detailed_page/DescriptionTextWidget/createState.md)() _DescriptionTextWidgetState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/DescriptionTextWidget.md b/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/DescriptionTextWidget.md new file mode 100644 index 000000000..9e9f4749e --- /dev/null +++ b/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/DescriptionTextWidget.md @@ -0,0 +1,29 @@ + + + +# DescriptionTextWidget constructor + + + + + + +const +DescriptionTextWidget({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) text}) + + + + + +## Implementation + +```dart +const DescriptionTextWidget({required this.text}); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/createState.md b/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/createState.md new file mode 100644 index 000000000..334915de6 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_DescriptionTextWidgetState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_DescriptionTextWidgetState createState() => _DescriptionTextWidgetState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/text.md b/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/text.md new file mode 100644 index 000000000..a7f6f7d63 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_detailed_page/DescriptionTextWidget/text.md @@ -0,0 +1,32 @@ + + + +# text property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) text + +_final_ + + + + + + +## Implementation + +```dart +final String text; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_detailed_page/widgets_post_detailed_page-library.md b/talawa-mobile-docs/widgets_post_detailed_page/widgets_post_detailed_page-library.md new file mode 100644 index 000000000..62d50933d --- /dev/null +++ b/talawa-mobile-docs/widgets_post_detailed_page/widgets_post_detailed_page-library.md @@ -0,0 +1,41 @@ + + + + +# post_detailed_page library + + + + + + + + + + + +## Classes + +##### [DescriptionTextWidget](../widgets_post_detailed_page/DescriptionTextWidget-class.md) + + + +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). + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_list_widget/PostListWidget-class.md b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget-class.md new file mode 100644 index 000000000..45a69dc1c --- /dev/null +++ b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget-class.md @@ -0,0 +1,207 @@ + + + +# PostListWidget class + + + + + + + + + +

This class receives a List of all the Post widgets and returns a ListView.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- PostListWidget + + + + + + + + +## Constructors + +[PostListWidget](../widgets_post_list_widget/PostListWidget/PostListWidget.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> posts, dynamic function([Post](../models_post_post_model/Post-class.md))?}) + + _const_ + + +## Properties + +##### [function](../widgets_post_list_widget/PostListWidget/function.md) → (dynamic Function([Post](../models_post_post_model/Post-class.md))?) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [posts](../widgets_post_list_widget/PostListWidget/posts.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../models_post_post_model/Post-class.md)> + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_post_list_widget/PostListWidget/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/PostListWidget.md b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/PostListWidget.md new file mode 100644 index 000000000..de0623977 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/PostListWidget.md @@ -0,0 +1,33 @@ + + + +# PostListWidget constructor + + + + + + +const +PostListWidget({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> posts, dynamic function([Post](../../models_post_post_model/Post-class.md))?}) + + + + + +## Implementation + +```dart +const PostListWidget({ + Key? key, + required this.posts, + this.function, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/build.md b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/build.md new file mode 100644 index 000000000..9bc187f9a --- /dev/null +++ b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/build.md @@ -0,0 +1,93 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return ListView.builder( + scrollDirection: Axis.vertical, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: posts.length, + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + NewsPost( + post: posts[index], + function: function, + ), + const Padding( + padding: EdgeInsets.symmetric(vertical: 10.0), + child: Divider( + height: 8, + thickness: 8, + ), + ) + ], + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/function.md b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/function.md new file mode 100644 index 000000000..4e87ea5a3 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/function.md @@ -0,0 +1,32 @@ + + + +# function property + + + + + + + +(dynamic Function([Post](../../models_post_post_model/Post-class.md))?) function + +_final_ + + + + + + +## Implementation + +```dart +final Function(Post)? function; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/posts.md b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/posts.md new file mode 100644 index 000000000..9a3b8ad65 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_list_widget/PostListWidget/posts.md @@ -0,0 +1,32 @@ + + + +# posts property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Post](../../models_post_post_model/Post-class.md)> posts + +_final_ + + + + + + +## Implementation + +```dart +final List posts; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_list_widget/widgets_post_list_widget-library.md b/talawa-mobile-docs/widgets_post_list_widget/widgets_post_list_widget-library.md new file mode 100644 index 000000000..4a511f63b --- /dev/null +++ b/talawa-mobile-docs/widgets_post_list_widget/widgets_post_list_widget-library.md @@ -0,0 +1,38 @@ + + + + +# post_list_widget library + + + + + + + + + + + +## Classes + +##### [PostListWidget](../widgets_post_list_widget/PostListWidget-class.md) + + + +This class receives a List of all the Post widgets and returns a ListView. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/NewsPost-class.md b/talawa-mobile-docs/widgets_post_widget/NewsPost-class.md new file mode 100644 index 000000000..181f9935b --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/NewsPost-class.md @@ -0,0 +1,206 @@ + + + +# NewsPost class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- NewsPost + + + + + + + + +## Constructors + +[NewsPost](../widgets_post_widget/NewsPost/NewsPost.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Post](../models_post_post_model/Post-class.md) post, dynamic function([Post](../models_post_post_model/Post-class.md))?}) + + _const_ + + +## Properties + +##### [function](../widgets_post_widget/NewsPost/function.md) → (dynamic Function([Post](../models_post_post_model/Post-class.md))?) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [post](../widgets_post_widget/NewsPost/post.md) → [Post](../models_post_post_model/Post-class.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_post_widget/NewsPost/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/NewsPost/NewsPost.md b/talawa-mobile-docs/widgets_post_widget/NewsPost/NewsPost.md new file mode 100644 index 000000000..4f831c08b --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/NewsPost/NewsPost.md @@ -0,0 +1,33 @@ + + + +# NewsPost constructor + + + + + + +const +NewsPost({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Post](../../models_post_post_model/Post-class.md) post, dynamic function([Post](../../models_post_post_model/Post-class.md))?}) + + + + + +## Implementation + +```dart +const NewsPost({ + Key? key, + required this.post, + this.function, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/NewsPost/build.md b/talawa-mobile-docs/widgets_post_widget/NewsPost/build.md new file mode 100644 index 000000000..3e6ebf469 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/NewsPost/build.md @@ -0,0 +1,164 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // const PinnedPostCarousel(), + ListTile( + leading: CustomAvatar( + isImageNull: post.creator!.image == null, + firstAlphabet: + post.creator!.firstName!.substring(0, 1).toUpperCase(), + imageUrl: post.creator!.image, + fontSize: 24, + ), + title: Text( + "${post.creator!.firstName} ${post.creator!.lastName}", + style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w400), + ), + subtitle: Text(post.getPostCreatedDuration()), + ), + DescriptionTextWidget(text: post.description!), + Container( + height: 400, + color: + Theme.of(context).colorScheme.primaryContainer.withOpacity(0.5), + child: PostContainer(id: post.sId), + ), + BaseView( + onModelReady: (model) { + model.initialize(post.likedBy ?? [], post.sId); + }, + builder: (context, model, child) => Column( + children: [ + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () => function != null ? function!(post) : {}, + child: Text( + "${model.likedBy.length} ${AppLocalizations.of(context)!.strictTranslate("Likes")}", + style: const TextStyle( + fontFamily: 'open-sans', + fontWeight: FontWeight.w800, + ), + ), + ), + GestureDetector( + onTap: () => function != null ? function!(post) : {}, + child: Text( + "${post.comments!.length} ${AppLocalizations.of(context)!.strictTranslate("comments")}", + ), + ) + ], + ), + ), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), + child: Divider(), + ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 5), + child: Row( + children: [ + GestureDetector( + onTap: () { + model.toggleIsLiked(); + }, + child: Icon( + Icons.thumb_up, + color: model.isLiked + ? Theme.of(context).colorScheme.secondary + : const Color(0xff737373), + ), + ), + GestureDetector( + onTap: () => function != null ? function!(post) : {}, + child: const Padding( + padding: EdgeInsets.only(left: 18.0), + child: Icon( + Icons.comment, + color: Color(0xff737373), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/NewsPost/function.md b/talawa-mobile-docs/widgets_post_widget/NewsPost/function.md new file mode 100644 index 000000000..4e87ea5a3 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/NewsPost/function.md @@ -0,0 +1,32 @@ + + + +# function property + + + + + + + +(dynamic Function([Post](../../models_post_post_model/Post-class.md))?) function + +_final_ + + + + + + +## Implementation + +```dart +final Function(Post)? function; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/NewsPost/post.md b/talawa-mobile-docs/widgets_post_widget/NewsPost/post.md new file mode 100644 index 000000000..e986becbc --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/NewsPost/post.md @@ -0,0 +1,32 @@ + + + +# post property + + + + + + + +[Post](../../models_post_post_model/Post-class.md) post + +_final_ + + + + + + +## Implementation + +```dart +final Post post; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainer-class.md b/talawa-mobile-docs/widgets_post_widget/PostContainer-class.md new file mode 100644 index 000000000..5ae9ca9e6 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainer-class.md @@ -0,0 +1,197 @@ + + + +# PostContainer class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- PostContainer + + + + + + + + +## Constructors + +[PostContainer](../widgets_post_widget/PostContainer/PostContainer.md) ({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) id, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [id](../widgets_post_widget/PostContainer/id.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../widgets_post_widget/PostContainer/createState.md)() [PostContainerState](../widgets_post_widget/PostContainerState-class.md) + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainer/PostContainer.md b/talawa-mobile-docs/widgets_post_widget/PostContainer/PostContainer.md new file mode 100644 index 000000000..dc9ee62f1 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainer/PostContainer.md @@ -0,0 +1,32 @@ + + + +# PostContainer constructor + + + + + + +const +PostContainer({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) id, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const PostContainer({ + required this.id, + Key? key, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainer/createState.md b/talawa-mobile-docs/widgets_post_widget/PostContainer/createState.md new file mode 100644 index 000000000..85cd7e218 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainer/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[PostContainerState](../../widgets_post_widget/PostContainerState-class.md) createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +PostContainerState createState() => PostContainerState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainer/id.md b/talawa-mobile-docs/widgets_post_widget/PostContainer/id.md new file mode 100644 index 000000000..672a052c2 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainer/id.md @@ -0,0 +1,32 @@ + + + +# id property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) id + +_final_ + + + + + + +## Implementation + +```dart +final String id; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainerState-class.md b/talawa-mobile-docs/widgets_post_widget/PostContainerState-class.md new file mode 100644 index 000000000..e8506d7a1 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainerState-class.md @@ -0,0 +1,281 @@ + + + +# PostContainerState class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [State](https://api.flutter.dev/flutter/widgets/State-class.html)<[PostContainer](../widgets_post_widget/PostContainer-class.md)> +- PostContainerState + + + + +**Available Extensions** + +- [StateExt](https://pub.dev/documentation/tutorial_coach_mark/1.2.9/tutorial_coach_mark/StateExt.html) + + + + +## Constructors + +[PostContainerState](../widgets_post_widget/PostContainerState/PostContainerState.md) () + + + + +## Properties + +##### [context](https://api.flutter.dev/flutter/widgets/State/context.html) → [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) + + + +The location in the tree where this widget builds. +_read-onlyinherited_ + + + +##### [controller](../widgets_post_widget/PostContainerState/controller.md) → [PageController](https://api.flutter.dev/flutter/widgets/PageController-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [inView](../widgets_post_widget/PostContainerState/inView.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [mounted](https://api.flutter.dev/flutter/widgets/State/mounted.html) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +Whether this State object is currently in a tree. +_read-onlyinherited_ + + + +##### [pindex](../widgets_post_widget/PostContainerState/pindex.md) ↔ [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + + +_read / write_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [startedPlaying](../widgets_post_widget/PostContainerState/startedPlaying.md) ↔ [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_read / write_ + + + +##### [widget](https://api.flutter.dev/flutter/widgets/State/widget.html) → [PostContainer](../widgets_post_widget/PostContainer-class.md) + + + +The current configuration. +_read-onlyinherited_ + + + + + +## Methods + +##### [activate](https://api.flutter.dev/flutter/widgets/State/activate.html)() void + + + +Called when this object is reinserted into the tree after having been +removed via deactivate. +_inherited_ + + + +##### [build](../widgets_post_widget/PostContainerState/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [deactivate](https://api.flutter.dev/flutter/widgets/State/deactivate.html)() void + + + +Called when this object is removed from the tree. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/State/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [didChangeDependencies](https://api.flutter.dev/flutter/widgets/State/didChangeDependencies.html)() void + + + +Called when a dependency of this State object changes. +_inherited_ + + + +##### [didUpdateWidget](https://api.flutter.dev/flutter/widgets/State/didUpdateWidget.html)(covariant [PostContainer](../widgets_post_widget/PostContainer-class.md) oldWidget) void + + + +Called whenever the widget configuration changes. +_inherited_ + + + +##### [dispose](../widgets_post_widget/PostContainerState/dispose.md)() void + + + +Called when this object is removed from the tree permanently. +_override_ + + + +##### [initState](../widgets_post_widget/PostContainerState/initState.md)() void + + + +Called when this object is inserted into the tree. +_override_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [reassemble](https://api.flutter.dev/flutter/widgets/State/reassemble.html)() void + + + +Called whenever the application is reassembled during debugging, for +example during hot reload. +_inherited_ + + + +##### [setState](https://api.flutter.dev/flutter/widgets/State/setState.html)([VoidCallback](https://api.flutter.dev/flutter/dart-ui/VoidCallback.html) fn) void + + + +Notify the framework that the internal state of this object has changed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/Diagnosticable/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/foundation/Diagnosticable/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A brief description of this object, usually just the runtimeType and the +hashCode. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainerState/PostContainerState.md b/talawa-mobile-docs/widgets_post_widget/PostContainerState/PostContainerState.md new file mode 100644 index 000000000..14ae45f06 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainerState/PostContainerState.md @@ -0,0 +1,24 @@ + + + +# PostContainerState constructor + + + + + + + +PostContainerState() + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainerState/controller.md b/talawa-mobile-docs/widgets_post_widget/PostContainerState/controller.md new file mode 100644 index 000000000..1ba09ce41 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainerState/controller.md @@ -0,0 +1,32 @@ + + + +# controller property + + + + + + + +[PageController](https://api.flutter.dev/flutter/widgets/PageController-class.html) controller + +_final_ + + + + + + +## Implementation + +```dart +final PageController controller = PageController(initialPage: 0); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainerState/dispose.md b/talawa-mobile-docs/widgets_post_widget/PostContainerState/dispose.md new file mode 100644 index 000000000..74c5469f9 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainerState/dispose.md @@ -0,0 +1,65 @@ + + + +# dispose method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void dispose +() + +_override_ + + + +

Called when this object is removed from the tree permanently.

+

The framework calls this method when this State object will never +build again. After the framework calls dispose, the State object is +considered unmounted and the mounted property is false. It is an error +to call setState at this point. This stage of the lifecycle is terminal: +there is no way to remount a State object that has been disposed.

+

Subclasses should override this method to release any resources retained +by this object (e.g., stop any active animations).

+

If a State's build method depends on an object that can itself +change state, for example a ChangeNotifier or Stream, or some +other object to which one can subscribe to receive notifications, then +be sure to subscribe and unsubscribe properly in initState, +didUpdateWidget, and dispose:

+
    +
  • In initState, subscribe to the object.
  • +
  • In didUpdateWidget unsubscribe from the old object and subscribe +to the new one if the updated widget configuration requires +replacing the object.
  • +
  • In dispose, unsubscribe from the object.
  • +
+

Implementations of this method should end with a call to the inherited +method, as in super.dispose().

+

See also:

+ + + + +## Implementation + +```dart +@override +void dispose() { + controller.dispose(); + super.dispose(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainerState/inView.md b/talawa-mobile-docs/widgets_post_widget/PostContainerState/inView.md new file mode 100644 index 000000000..92c14bb97 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainerState/inView.md @@ -0,0 +1,32 @@ + + + +# inView property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) inView + +_read / write_ + + + + + + +## Implementation + +```dart +bool inView = true; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainerState/initState.md b/talawa-mobile-docs/widgets_post_widget/PostContainerState/initState.md new file mode 100644 index 000000000..7e0019516 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainerState/initState.md @@ -0,0 +1,62 @@ + + + +# initState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +void initState +() + +_override_ + + + +

Called when this object is inserted into the tree.

+

The framework will call this method exactly once for each State object +it creates.

+

Override this method to perform initialization that depends on the +location at which this object was inserted into the tree (i.e., context) +or on the widget used to configure this object (i.e., widget).

+

If a State's build method depends on an object that can itself +change state, for example a ChangeNotifier or Stream, or some +other object to which one can subscribe to receive notifications, then +be sure to subscribe and unsubscribe properly in initState, +didUpdateWidget, and dispose:

+
    +
  • In initState, subscribe to the object.
  • +
  • In didUpdateWidget unsubscribe from the old object and subscribe +to the new one if the updated widget configuration requires +replacing the object.
  • +
  • In dispose, unsubscribe from the object.
  • +
+

You cannot use BuildContext.dependOnInheritedWidgetOfExactType from this +method. However, didChangeDependencies will be called immediately +following this method, and BuildContext.dependOnInheritedWidgetOfExactType can +be used there.

+

Implementations of this method should start with a call to the inherited +method, as in super.initState().

+ + + +## Implementation + +```dart +@override +void initState() { + super.initState(); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainerState/pindex.md b/talawa-mobile-docs/widgets_post_widget/PostContainerState/pindex.md new file mode 100644 index 000000000..e609f0c28 --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainerState/pindex.md @@ -0,0 +1,32 @@ + + + +# pindex property + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) pindex + +_read / write_ + + + + + + +## Implementation + +```dart +int pindex = 0; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/PostContainerState/startedPlaying.md b/talawa-mobile-docs/widgets_post_widget/PostContainerState/startedPlaying.md new file mode 100644 index 000000000..765d3d6af --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/PostContainerState/startedPlaying.md @@ -0,0 +1,32 @@ + + + +# startedPlaying property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) startedPlaying + +_read / write_ + + + + + + +## Implementation + +```dart +bool startedPlaying = false; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_post_widget/widgets_post_widget-library.md b/talawa-mobile-docs/widgets_post_widget/widgets_post_widget-library.md new file mode 100644 index 000000000..88746391b --- /dev/null +++ b/talawa-mobile-docs/widgets_post_widget/widgets_post_widget-library.md @@ -0,0 +1,52 @@ + + + + +# post_widget library + + + + + + + + + + + +## Classes + +##### [NewsPost](../widgets_post_widget/NewsPost-class.md) + + + + + + +##### [PostContainer](../widgets_post_widget/PostContainer-class.md) + + + + + + +##### [PostContainerState](../widgets_post_widget/PostContainerState-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton-class.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton-class.md new file mode 100644 index 000000000..f4dd829d2 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton-class.md @@ -0,0 +1,253 @@ + + + +# RaisedRoundedButton class + + + + + + + + + +

This class returns a widget for a raised rounded button, +for example: login button in login screen.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- RaisedRoundedButton + + + + + + + + +## Constructors + +[RaisedRoundedButton](../widgets_raised_round_edge_button/RaisedRoundedButton/RaisedRoundedButton.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) buttonLabel, required [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) backgroundColor, required [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) textColor, required dynamic onTap(), [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? height, [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? width, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showArrow = false}) + + _const_ + + +## Properties + +##### [backgroundColor](../widgets_raised_round_edge_button/RaisedRoundedButton/backgroundColor.md) → [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + +_final_ + + + +##### [buttonLabel](../widgets_raised_round_edge_button/RaisedRoundedButton/buttonLabel.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [height](../widgets_raised_round_edge_button/RaisedRoundedButton/height.md) → [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_final_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [onTap](../widgets_raised_round_edge_button/RaisedRoundedButton/onTap.md) → dynamic Function() + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [showArrow](../widgets_raised_round_edge_button/RaisedRoundedButton/showArrow.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [textColor](../widgets_raised_round_edge_button/RaisedRoundedButton/textColor.md) → [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) + + + + +_final_ + + + +##### [width](../widgets_raised_round_edge_button/RaisedRoundedButton/width.md) → [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? + + + + +_final_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../widgets_raised_round_edge_button/RaisedRoundedButton/createState.md)() _RaisedRoundedButtonState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/RaisedRoundedButton.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/RaisedRoundedButton.md new file mode 100644 index 000000000..99d95d5c8 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/RaisedRoundedButton.md @@ -0,0 +1,38 @@ + + + +# RaisedRoundedButton constructor + + + + + + +const +RaisedRoundedButton({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) buttonLabel, required [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) backgroundColor, required [Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) textColor, required dynamic onTap(), [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? height, [double](https://api.flutter.dev/flutter/dart-core/double-class.html)? width, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showArrow = false}) + + + + + +## Implementation + +```dart +const RaisedRoundedButton({ + required Key key, + required this.buttonLabel, + required this.backgroundColor, + required this.textColor, + required this.onTap, + this.height, + this.width, + this.showArrow = false, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/backgroundColor.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/backgroundColor.md new file mode 100644 index 000000000..07df8f904 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/backgroundColor.md @@ -0,0 +1,32 @@ + + + +# backgroundColor property + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) backgroundColor + +_final_ + + + + + + +## Implementation + +```dart +final Color backgroundColor; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/buttonLabel.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/buttonLabel.md new file mode 100644 index 000000000..9dad55b19 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/buttonLabel.md @@ -0,0 +1,32 @@ + + + +# buttonLabel property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) buttonLabel + +_final_ + + + + + + +## Implementation + +```dart +final String buttonLabel; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/createState.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/createState.md new file mode 100644 index 000000000..153347625 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_RaisedRoundedButtonState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_RaisedRoundedButtonState createState() => _RaisedRoundedButtonState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/height.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/height.md new file mode 100644 index 000000000..3db9a95b5 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/height.md @@ -0,0 +1,32 @@ + + + +# height property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? height + +_final_ + + + + + + +## Implementation + +```dart +final double? height; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/onTap.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/onTap.md new file mode 100644 index 000000000..71f15a9ad --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/onTap.md @@ -0,0 +1,32 @@ + + + +# onTap property + + + + + + + +dynamic Function() onTap + +_final_ + + + + + + +## Implementation + +```dart +final Function() onTap; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/showArrow.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/showArrow.md new file mode 100644 index 000000000..989fd8683 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/showArrow.md @@ -0,0 +1,32 @@ + + + +# showArrow property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showArrow + +_final_ + + + + + + +## Implementation + +```dart +final bool showArrow; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/textColor.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/textColor.md new file mode 100644 index 000000000..7c04e7051 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/textColor.md @@ -0,0 +1,32 @@ + + + +# textColor property + + + + + + + +[Color](https://api.flutter.dev/flutter/dart-ui/Color-class.html) textColor + +_final_ + + + + + + +## Implementation + +```dart +final Color textColor; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/width.md b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/width.md new file mode 100644 index 000000000..e35287c28 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/RaisedRoundedButton/width.md @@ -0,0 +1,32 @@ + + + +# width property + + + + + + + +[double](https://api.flutter.dev/flutter/dart-core/double-class.html)? width + +_final_ + + + + + + +## Implementation + +```dart +final double? width; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_raised_round_edge_button/widgets_raised_round_edge_button-library.md b/talawa-mobile-docs/widgets_raised_round_edge_button/widgets_raised_round_edge_button-library.md new file mode 100644 index 000000000..e0cb23ea2 --- /dev/null +++ b/talawa-mobile-docs/widgets_raised_round_edge_button/widgets_raised_round_edge_button-library.md @@ -0,0 +1,39 @@ + + + + +# raised_round_edge_button library + + + + + + + + + + + +## Classes + +##### [RaisedRoundedButton](../widgets_raised_round_edge_button/RaisedRoundedButton-class.md) + + + +This class returns a widget for a raised rounded button, +for example: login button in login screen. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_rich_text/CustomRichText-class.md b/talawa-mobile-docs/widgets_rich_text/CustomRichText-class.md new file mode 100644 index 000000000..c57b561fd --- /dev/null +++ b/talawa-mobile-docs/widgets_rich_text/CustomRichText-class.md @@ -0,0 +1,199 @@ + + + +# CustomRichText class + + + + + + + + + +

CustomRichText class returns a widget for customized rich/bold text. +These rich text are being used in form for changing the password.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- CustomRichText + + + + + + + + +## Constructors + +[CustomRichText](../widgets_rich_text/CustomRichText/CustomRichText.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> words}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [words](../widgets_rich_text/CustomRichText/words.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> + + + + +_final_ + + + + + +## Methods + +##### [build](../widgets_rich_text/CustomRichText/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_rich_text/CustomRichText/CustomRichText.md b/talawa-mobile-docs/widgets_rich_text/CustomRichText/CustomRichText.md new file mode 100644 index 000000000..a8ef77480 --- /dev/null +++ b/talawa-mobile-docs/widgets_rich_text/CustomRichText/CustomRichText.md @@ -0,0 +1,30 @@ + + + +# CustomRichText constructor + + + + + + +const +CustomRichText({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> words}) + + + + + +## Implementation + +```dart +const CustomRichText({required Key key, required this.words}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_rich_text/CustomRichText/build.md b/talawa-mobile-docs/widgets_rich_text/CustomRichText/build.md new file mode 100644 index 000000000..47b346239 --- /dev/null +++ b/talawa-mobile-docs/widgets_rich_text/CustomRichText/build.md @@ -0,0 +1,86 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return RichText( + textAlign: TextAlign.start, + text: TextSpan( + text: + "${AppLocalizations.of(context)!.strictTranslate(words[0]['text'].toString().trim())} ", + style: words[0]['textStyle'] as TextStyle, + children: List.generate( + words.length - 1, + (index) => TextSpan( + text: + "${AppLocalizations.of(context)!.strictTranslate(words[index + 1]['text'].toString().trim())} ", + style: words[index + 1]['textStyle'] as TextStyle, + ), + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_rich_text/CustomRichText/words.md b/talawa-mobile-docs/widgets_rich_text/CustomRichText/words.md new file mode 100644 index 000000000..6f9a30900 --- /dev/null +++ b/talawa-mobile-docs/widgets_rich_text/CustomRichText/words.md @@ -0,0 +1,32 @@ + + + +# words property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>> words + +_final_ + + + + + + +## Implementation + +```dart +final List> words; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_rich_text/widgets_rich_text-library.md b/talawa-mobile-docs/widgets_rich_text/widgets_rich_text-library.md new file mode 100644 index 000000000..40221a34b --- /dev/null +++ b/talawa-mobile-docs/widgets_rich_text/widgets_rich_text-library.md @@ -0,0 +1,39 @@ + + + + +# rich_text library + + + + + + + + + + + +## Classes + +##### [CustomRichText](../widgets_rich_text/CustomRichText-class.md) + + + +CustomRichText class returns a widget for customized rich/bold text. +These rich text are being used in form for changing the password. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator-class.md b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator-class.md new file mode 100644 index 000000000..55f30f008 --- /dev/null +++ b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator-class.md @@ -0,0 +1,208 @@ + + + +# SignupProgressIndicator class + + + + + + + + + +

This class returns a widget for showing the +progress indicator/flow while Signing Up/ Registration.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- SignupProgressIndicator + + + + + + + + +## Constructors + +[SignupProgressIndicator](../widgets_signup_progress_indicator/SignupProgressIndicator/SignupProgressIndicator.md) ({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [int](https://api.flutter.dev/flutter/dart-core/int-class.html) currentPageIndex}) + + + + +## Properties + +##### [currentPageIndex](../widgets_signup_progress_indicator/SignupProgressIndicator/currentPageIndex.md) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [progressLabel](../widgets_signup_progress_indicator/SignupProgressIndicator/progressLabel.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_signup_progress_indicator/SignupProgressIndicator/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/SignupProgressIndicator.md b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/SignupProgressIndicator.md new file mode 100644 index 000000000..a3b52a67b --- /dev/null +++ b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/SignupProgressIndicator.md @@ -0,0 +1,30 @@ + + + +# SignupProgressIndicator constructor + + + + + + + +SignupProgressIndicator({required [Key](https://api.flutter.dev/flutter/foundation/Key-class.html) key, required [int](https://api.flutter.dev/flutter/dart-core/int-class.html) currentPageIndex}) + + + + + +## Implementation + +```dart +SignupProgressIndicator({required Key key, required this.currentPageIndex}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/build.md b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/build.md new file mode 100644 index 000000000..7ed129c74 --- /dev/null +++ b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/build.md @@ -0,0 +1,119 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Container( + alignment: Alignment.center, + height: SizeConfig.screenHeight! * 0.15, + child: Timeline.tileBuilder( + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + builder: TimelineTileBuilder.connected( + contentsBuilder: (_, index) => Text( + AppLocalizations.of(context)!.strictTranslate(progressLabel[index]), + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + // If the flow index is greater than currentPageIndex then + // show green(visited) color else show fade(not visited) color. + color: index <= currentPageIndex + ? const Color(0xFF008A37) + : const Color(0xFF737373), + ), + textAlign: TextAlign.center, + ), + connectorBuilder: (_, index, __) { + return SolidLineConnector( + space: 30, + // If the flow index is greater than currentPageIndex then + // show green(visited) color else show fade(not visited) color. + color: index < currentPageIndex + ? const Color(0xFF008A37) + : const Color(0xFF737373), + ); + }, + indicatorBuilder: (_, index) { + return DotIndicator( + size: 25, + color: index <= currentPageIndex + ? const Color(0xFF008A37) + : const Color(0xFF737373), + child: index < currentPageIndex + ? const Icon( + Icons.done, + color: Colors.white, + size: 20, + ) + : const SizedBox(), + ); + }, + itemExtentBuilder: (_, __) => MediaQuery.of(context).size.width / 3, + itemCount: 3, + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/currentPageIndex.md b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/currentPageIndex.md new file mode 100644 index 000000000..f5f2af3ea --- /dev/null +++ b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/currentPageIndex.md @@ -0,0 +1,32 @@ + + + +# currentPageIndex property + + + + + + + +[int](https://api.flutter.dev/flutter/dart-core/int-class.html) currentPageIndex + +_final_ + + + + + + +## Implementation + +```dart +final int currentPageIndex; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/progressLabel.md b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/progressLabel.md new file mode 100644 index 000000000..7bb05930d --- /dev/null +++ b/talawa-mobile-docs/widgets_signup_progress_indicator/SignupProgressIndicator/progressLabel.md @@ -0,0 +1,36 @@ + + + +# progressLabel property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> progressLabel + +_final_ + + + + + + +## Implementation + +```dart +final List progressLabel = [ + 'Select\nOrganization', + 'Enter Details', + 'Final', +]; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_signup_progress_indicator/widgets_signup_progress_indicator-library.md b/talawa-mobile-docs/widgets_signup_progress_indicator/widgets_signup_progress_indicator-library.md new file mode 100644 index 000000000..4986b8387 --- /dev/null +++ b/talawa-mobile-docs/widgets_signup_progress_indicator/widgets_signup_progress_indicator-library.md @@ -0,0 +1,39 @@ + + + + +# signup_progress_indicator library + + + + + + + + + + + +## Classes + +##### [SignupProgressIndicator](../widgets_signup_progress_indicator/SignupProgressIndicator-class.md) + + + +This class returns a widget for showing the +progress indicator/flow while Signing Up/ Registration. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog-class.md b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog-class.md new file mode 100644 index 000000000..3718686e1 --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog-class.md @@ -0,0 +1,206 @@ + + + +# TalawaErrorDialog class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- TalawaErrorDialog + + + + + + + + +## Constructors + +[TalawaErrorDialog](../widgets_talawa_error_dialog/TalawaErrorDialog/TalawaErrorDialog.md) ([String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage, {[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [MessageType](../enums_enums/MessageType.md) messageType}) + + _const_ + + +## Properties + +##### [errorMessage](../widgets_talawa_error_dialog/TalawaErrorDialog/errorMessage.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [messageType](../widgets_talawa_error_dialog/TalawaErrorDialog/messageType.md) → [MessageType](../enums_enums/MessageType.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_talawa_error_dialog/TalawaErrorDialog/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/TalawaErrorDialog.md b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/TalawaErrorDialog.md new file mode 100644 index 000000000..7ae8a4bd2 --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/TalawaErrorDialog.md @@ -0,0 +1,33 @@ + + + +# TalawaErrorDialog constructor + + + + + + +const +TalawaErrorDialog([String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage, {[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [MessageType](../../enums_enums/MessageType.md) messageType}) + + + + + +## Implementation + +```dart +const TalawaErrorDialog( + this.errorMessage, { + Key? key, + required this.messageType, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/build.md b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/build.md new file mode 100644 index 000000000..a8c9273fa --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/build.md @@ -0,0 +1,168 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return SizedBox( + child: AlertDialog( + content: SizedBox( + width: 200, + height: 135, + child: Column( + children: [ + SvgPicture.asset( + messageType == MessageType.error + ? 'assets/images/Vector.svg' + : messageType == MessageType.warning + ? 'assets/images/Vector.svg' + : messageType == MessageType.info + ? 'assets/icons/Info.svg' + : 'assets/images/Vector.svg', + colorFilter: ColorFilter.mode( + messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.yellow + : messageType == MessageType.info + ? Colors.green + : Colors.red, + BlendMode.srcIn, + ), + ), + const SizedBox( + height: 5, + ), + Text( + messageType == MessageType.error + ? AppLocalizations.of(context)!.strictTranslate('Error') + : messageType == MessageType.warning + ? AppLocalizations.of(context)! + .strictTranslate('Warning') + : messageType == MessageType.info + ? AppLocalizations.of(context)! + .strictTranslate('Information') + : AppLocalizations.of(context)! + .strictTranslate('Error'), + style: TextStyle( + color: messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.yellow + : messageType == MessageType.info + ? Colors.green + : Colors.red, + fontSize: 20, + ), + textAlign: TextAlign.center, + ), + const SizedBox( + height: 5, + ), + AutoSizeText( + AppLocalizations.of(context)!.strictTranslate(errorMessage), + style: const TextStyle(fontSize: 16), + maxLines: 3, + ), + const SizedBox( + height: 19, + ), + ], + ), + ), + actions: [ + // Expanded( + // child: + TextButton( + style: TextButton.styleFrom( + backgroundColor: messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.red + : messageType == MessageType.info + ? Colors.black26 + : Colors.red, + foregroundColor: Colors.red, + ), + child: Text( + messageType == MessageType.error + ? 'Dismiss' + : messageType == MessageType.warning + ? 'Dismiss' + : messageType == MessageType.info + ? 'Close' + : 'Dismiss', + style: const TextStyle(color: Color.fromRGBO(202, 202, 202, 1)), + ), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + // ), + ], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/errorMessage.md b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/errorMessage.md new file mode 100644 index 000000000..b9844493a --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/errorMessage.md @@ -0,0 +1,32 @@ + + + +# errorMessage property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage + +_final_ + + + + + + +## Implementation + +```dart +final String errorMessage; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/messageType.md b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/messageType.md new file mode 100644 index 000000000..62809db57 --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_dialog/TalawaErrorDialog/messageType.md @@ -0,0 +1,32 @@ + + + +# messageType property + + + + + + + +[MessageType](../../enums_enums/MessageType.md) messageType + +_final_ + + + + + + +## Implementation + +```dart +final MessageType messageType; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_dialog/widgets_talawa_error_dialog-library.md b/talawa-mobile-docs/widgets_talawa_error_dialog/widgets_talawa_error_dialog-library.md new file mode 100644 index 000000000..c5a3d6a1a --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_dialog/widgets_talawa_error_dialog-library.md @@ -0,0 +1,38 @@ + + + + +# talawa_error_dialog library + + + + + + + + + + + +## Classes + +##### [TalawaErrorDialog](../widgets_talawa_error_dialog/TalawaErrorDialog-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md new file mode 100644 index 000000000..8d8412b33 --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md @@ -0,0 +1,206 @@ + + + +# TalawaErrorSnackBar class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- TalawaErrorSnackBar + + + + + + + + +## Constructors + +[TalawaErrorSnackBar](../widgets_talawa_error_snackbar/TalawaErrorSnackBar/TalawaErrorSnackBar.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage, required [MessageType](../enums_enums/MessageType.md) messageType}) + + _const_ + + +## Properties + +##### [errorMessage](../widgets_talawa_error_snackbar/TalawaErrorSnackBar/errorMessage.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [messageType](../widgets_talawa_error_snackbar/TalawaErrorSnackBar/messageType.md) → [MessageType](../enums_enums/MessageType.md) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_talawa_error_snackbar/TalawaErrorSnackBar/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/TalawaErrorSnackBar.md b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/TalawaErrorSnackBar.md new file mode 100644 index 000000000..c8d6fa0af --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/TalawaErrorSnackBar.md @@ -0,0 +1,33 @@ + + + +# TalawaErrorSnackBar constructor + + + + + + +const +TalawaErrorSnackBar({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage, required [MessageType](../../enums_enums/MessageType.md) messageType}) + + + + + +## Implementation + +```dart +const TalawaErrorSnackBar({ + Key? key, + required this.errorMessage, + required this.messageType, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/build.md b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/build.md new file mode 100644 index 000000000..34867b9c1 --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/build.md @@ -0,0 +1,121 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Row( + children: [ + Container( + width: 20, + height: 80, + decoration: BoxDecoration( + color: messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.yellow + : messageType == MessageType.info + ? Colors.green + : Colors.red, + ), + ), + const SizedBox( + width: 10, + ), + Icon( + messageType == MessageType.error + ? Icons.error + : messageType == MessageType.warning + ? Icons.error + : messageType == MessageType.info + ? Icons.info_outline + : Icons.error, + // Icons.error, + color: messageType == MessageType.error + ? Colors.red + : messageType == MessageType.warning + ? Colors.yellow + : messageType == MessageType.info + ? Colors.green + : Colors.red, + size: 35, + ), + const SizedBox( + width: 10, + ), + Expanded( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Text( + AppLocalizations.of(context)!.strictTranslate(errorMessage), + style: const TextStyle(color: Colors.white), + ), + ), + ) + ], + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/errorMessage.md b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/errorMessage.md new file mode 100644 index 000000000..b9844493a --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/errorMessage.md @@ -0,0 +1,32 @@ + + + +# errorMessage property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) errorMessage + +_final_ + + + + + + +## Implementation + +```dart +final String errorMessage; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/messageType.md b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/messageType.md new file mode 100644 index 000000000..62809db57 --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_snackbar/TalawaErrorSnackBar/messageType.md @@ -0,0 +1,32 @@ + + + +# messageType property + + + + + + + +[MessageType](../../enums_enums/MessageType.md) messageType + +_final_ + + + + + + +## Implementation + +```dart +final MessageType messageType; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_talawa_error_snackbar/widgets_talawa_error_snackbar-library.md b/talawa-mobile-docs/widgets_talawa_error_snackbar/widgets_talawa_error_snackbar-library.md new file mode 100644 index 000000000..cf70f2bf6 --- /dev/null +++ b/talawa-mobile-docs/widgets_talawa_error_snackbar/widgets_talawa_error_snackbar-library.md @@ -0,0 +1,38 @@ + + + + +# talawa_error_snackbar library + + + + + + + + + + + +## Classes + +##### [TalawaErrorSnackBar](../widgets_talawa_error_snackbar/TalawaErrorSnackBar-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/DescriptionField-class.md b/talawa-mobile-docs/widgets_task_form/DescriptionField-class.md new file mode 100644 index 000000000..f6fad42ea --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/DescriptionField-class.md @@ -0,0 +1,188 @@ + + + +# DescriptionField class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- DescriptionField + + + + + + + + +## Constructors + +[DescriptionField](../widgets_task_form/DescriptionField/DescriptionField.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_task_form/DescriptionField/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/DescriptionField/DescriptionField.md b/talawa-mobile-docs/widgets_task_form/DescriptionField/DescriptionField.md new file mode 100644 index 000000000..cc0418776 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/DescriptionField/DescriptionField.md @@ -0,0 +1,29 @@ + + + +# DescriptionField constructor + + + + + + +const +DescriptionField({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const DescriptionField({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/DescriptionField/build.md b/talawa-mobile-docs/widgets_task_form/DescriptionField/build.md new file mode 100644 index 000000000..27bb4f287 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/DescriptionField/build.md @@ -0,0 +1,100 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + final taskDescriptionTextController = context.select( + (CreateTaskViewModel model) => model.taskDescriptionTextController, + ); + + return TextFormField( + keyboardType: TextInputType.multiline, + controller: taskDescriptionTextController, + validator: (value) => Validator.validateEventForm(value!, 'Description'), + maxLines: 10, + minLines: 1, + decoration: InputDecoration( + hintText: 'Describe the task', + labelText: 'Add Description', + labelStyle: Theme.of(context).textTheme.titleMedium, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.view_headline, + size: 25, + ), + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TaskForm-class.md b/talawa-mobile-docs/widgets_task_form/TaskForm-class.md new file mode 100644 index 000000000..6f56ca2b4 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TaskForm-class.md @@ -0,0 +1,215 @@ + + + +# TaskForm class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- TaskForm + + + + + + + + +## Constructors + +[TaskForm](../widgets_task_form/TaskForm/TaskForm.md) ({required [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> onSave(), required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) actionText, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [actionText](../widgets_task_form/TaskForm/actionText.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [onSave](../widgets_task_form/TaskForm/onSave.md) → [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> Function() + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [title](../widgets_task_form/TaskForm/title.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../widgets_task_form/TaskForm/createState.md)() [State](https://api.flutter.dev/flutter/widgets/State-class.html)<[TaskForm](../widgets_task_form/TaskForm-class.md)> + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TaskForm/TaskForm.md b/talawa-mobile-docs/widgets_task_form/TaskForm/TaskForm.md new file mode 100644 index 000000000..4270294a8 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TaskForm/TaskForm.md @@ -0,0 +1,34 @@ + + + +# TaskForm constructor + + + + + + +const +TaskForm({required [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> onSave(), required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) title, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) actionText, [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const TaskForm({ + required this.onSave, + required this.title, + required this.actionText, + Key? key, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TaskForm/actionText.md b/talawa-mobile-docs/widgets_task_form/TaskForm/actionText.md new file mode 100644 index 000000000..ca533420f --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TaskForm/actionText.md @@ -0,0 +1,32 @@ + + + +# actionText property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) actionText + +_final_ + + + + + + +## Implementation + +```dart +final String actionText; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TaskForm/createState.md b/talawa-mobile-docs/widgets_task_form/TaskForm/createState.md new file mode 100644 index 000000000..f74687116 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TaskForm/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[State](https://api.flutter.dev/flutter/widgets/State-class.html)<[TaskForm](../../widgets_task_form/TaskForm-class.md)> createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +State createState() => _TaskFormState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TaskForm/onSave.md b/talawa-mobile-docs/widgets_task_form/TaskForm/onSave.md new file mode 100644 index 000000000..3a1d1a70c --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TaskForm/onSave.md @@ -0,0 +1,32 @@ + + + +# onSave property + + + + + + + +[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)> Function() onSave + +_final_ + + + + + + +## Implementation + +```dart +final Future Function() onSave; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TaskForm/title.md b/talawa-mobile-docs/widgets_task_form/TaskForm/title.md new file mode 100644 index 000000000..7c14a3864 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TaskForm/title.md @@ -0,0 +1,32 @@ + + + +# title property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) title + +_final_ + + + + + + +## Implementation + +```dart +final String title; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TitleField-class.md b/talawa-mobile-docs/widgets_task_form/TitleField-class.md new file mode 100644 index 000000000..3a1b005b5 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TitleField-class.md @@ -0,0 +1,188 @@ + + + +# TitleField class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- TitleField + + + + + + + + +## Constructors + +[TitleField](../widgets_task_form/TitleField/TitleField.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_task_form/TitleField/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TitleField/TitleField.md b/talawa-mobile-docs/widgets_task_form/TitleField/TitleField.md new file mode 100644 index 000000000..4ceaed2f9 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TitleField/TitleField.md @@ -0,0 +1,29 @@ + + + +# TitleField constructor + + + + + + +const +TitleField({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const TitleField({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/TitleField/build.md b/talawa-mobile-docs/widgets_task_form/TitleField/build.md new file mode 100644 index 000000000..8efb4db8d --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/TitleField/build.md @@ -0,0 +1,98 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + final taskTitleTextController = context + .select((CreateTaskViewModel model) => model.taskTitleTextController); + return TextFormField( + textInputAction: TextInputAction.next, + controller: taskTitleTextController, + keyboardType: TextInputType.name, + maxLength: 100, + validator: (value) => Validator.validateEventForm(value!, 'Title'), + decoration: InputDecoration( + labelText: 'Add Task Title', + isDense: true, + labelStyle: Theme.of(context).textTheme.titleMedium, + focusedBorder: InputBorder.none, + counterText: "", + enabledBorder: InputBorder.none, + prefixIcon: Container( + transform: Matrix4.translationValues( + -SizeConfig.screenWidth! * 0.027, + 0.0, + 0.0, + ), + child: const Icon( + Icons.title, + size: 25, + ), + ), + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_form/widgets_task_form-library.md b/talawa-mobile-docs/widgets_task_form/widgets_task_form-library.md new file mode 100644 index 000000000..a1a5faa5d --- /dev/null +++ b/talawa-mobile-docs/widgets_task_form/widgets_task_form-library.md @@ -0,0 +1,52 @@ + + + + +# task_form library + + + + + + + + + + + +## Classes + +##### [DescriptionField](../widgets_task_form/DescriptionField-class.md) + + + + + + +##### [TaskForm](../widgets_task_form/TaskForm-class.md) + + + + + + +##### [TitleField](../widgets_task_form/TitleField-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskCard-class.md b/talawa-mobile-docs/widgets_task_schedule/TaskCard-class.md new file mode 100644 index 000000000..75f697cb2 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskCard-class.md @@ -0,0 +1,215 @@ + + + +# TaskCard class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- TaskCard + + + + + + + + +## Constructors + +[TaskCard](../widgets_task_schedule/TaskCard/TaskCard.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Appointment](https://pub.dev/documentation/syncfusion_flutter_calendar/20.4.54/calendar/Appointment-class.html) appointment, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showMoreOptions, required [Task](../models_task_task_model/Task-class.md) task}) + + _const_ + + +## Properties + +##### [appointment](../widgets_task_schedule/TaskCard/appointment.md) → [Appointment](https://pub.dev/documentation/syncfusion_flutter_calendar/20.4.54/calendar/Appointment-class.html) + + + + +_final_ + + + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [showMoreOptions](../widgets_task_schedule/TaskCard/showMoreOptions.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [task](../widgets_task_schedule/TaskCard/task.md) → [Task](../models_task_task_model/Task-class.md) + + + + +_final_ + + + + + +## Methods + +##### [build](../widgets_task_schedule/TaskCard/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskCard/TaskCard.md b/talawa-mobile-docs/widgets_task_schedule/TaskCard/TaskCard.md new file mode 100644 index 000000000..1f611b973 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskCard/TaskCard.md @@ -0,0 +1,34 @@ + + + +# TaskCard constructor + + + + + + +const +TaskCard({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [Appointment](https://pub.dev/documentation/syncfusion_flutter_calendar/20.4.54/calendar/Appointment-class.html) appointment, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showMoreOptions, required [Task](../../models_task_task_model/Task-class.md) task}) + + + + + +## Implementation + +```dart +const TaskCard({ + Key? key, + required this.appointment, + required this.showMoreOptions, + required this.task, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskCard/appointment.md b/talawa-mobile-docs/widgets_task_schedule/TaskCard/appointment.md new file mode 100644 index 000000000..7c06657a2 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskCard/appointment.md @@ -0,0 +1,32 @@ + + + +# appointment property + + + + + + + +[Appointment](https://pub.dev/documentation/syncfusion_flutter_calendar/20.4.54/calendar/Appointment-class.html) appointment + +_final_ + + + + + + +## Implementation + +```dart +final Appointment appointment; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskCard/build.md b/talawa-mobile-docs/widgets_task_schedule/TaskCard/build.md new file mode 100644 index 000000000..3ff8b0121 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskCard/build.md @@ -0,0 +1,153 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: appointment.color, + borderRadius: const BorderRadius.all( + Radius.circular(4), + ), + ), + padding: const EdgeInsets.only(left: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + ' ${appointment.subject}', + style: const TextStyle( + fontWeight: FontWeight.w500, + fontSize: 18, + ), + ), + const SizedBox(height: 8), + Row( + children: [ + const Icon( + Icons.access_time_filled, + size: 16, + ), + const SizedBox(width: 4), + Text( + DateFormat('hh:mm a').format(appointment.endTime), + ), + ], + ), + ], + ), + showMoreOptions + ? IconButton( + onPressed: () { + navigationService.pushDialog( + AlertDialog( + title: Text( + 'User Actions', + style: TextStyle( + color: Theme.of(context).primaryColorLight, + ), + ), + actions: [ + TextButton( + child: const Text('Delete'), + onPressed: () { + context.read().deleteTask( + task.id, + task.creator.id!, + ); + navigationService.pop(); + }, + ), + TextButton( + child: const Text('Edit'), + onPressed: () { + navigationService.pop(); + navigationService.pushScreen( + Routes.editTask, + arguments: task, + ); + }, + ), + TextButton( + child: const Text('Cancel'), + onPressed: () => navigationService.pop(), + ), + ], + ), + ); + }, + icon: const Icon(Icons.more_vert), + ) + : Container(), + ], + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskCard/showMoreOptions.md b/talawa-mobile-docs/widgets_task_schedule/TaskCard/showMoreOptions.md new file mode 100644 index 000000000..8ea655614 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskCard/showMoreOptions.md @@ -0,0 +1,32 @@ + + + +# showMoreOptions property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showMoreOptions + +_final_ + + + + + + +## Implementation + +```dart +final bool showMoreOptions; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskCard/task.md b/talawa-mobile-docs/widgets_task_schedule/TaskCard/task.md new file mode 100644 index 000000000..3cf99076f --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskCard/task.md @@ -0,0 +1,32 @@ + + + +# task property + + + + + + + +[Task](../../models_task_task_model/Task-class.md) task + +_final_ + + + + + + +## Implementation + +```dart +final Task task; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskSchedule-class.md b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule-class.md new file mode 100644 index 000000000..26e9e352d --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule-class.md @@ -0,0 +1,215 @@ + + + +# TaskSchedule class + + + + + + + + + + + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- TaskSchedule + + + + + + + + +## Constructors + +[TaskSchedule](../widgets_task_schedule/TaskSchedule/TaskSchedule.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Task](../models_task_task_model/Task-class.md)> tasks, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showMoreOptions = false}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [showMoreOptions](../widgets_task_schedule/TaskSchedule/showMoreOptions.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [tasks](../widgets_task_schedule/TaskSchedule/tasks.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Task](../models_task_task_model/Task-class.md)> + + + + +_final_ + + + + + +## Methods + +##### [build](../widgets_task_schedule/TaskSchedule/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [calendarTapped](../widgets_task_schedule/TaskSchedule/calendarTapped.md)([CalendarTapDetails](https://pub.dev/documentation/syncfusion_flutter_calendar/20.4.54/calendar/CalendarTapDetails-class.html) details) void + + + + + + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/TaskSchedule.md b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/TaskSchedule.md new file mode 100644 index 000000000..06e9a9ce6 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/TaskSchedule.md @@ -0,0 +1,33 @@ + + + +# TaskSchedule constructor + + + + + + +const +TaskSchedule({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Task](../../models_task_task_model/Task-class.md)> tasks, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showMoreOptions = false}) + + + + + +## Implementation + +```dart +const TaskSchedule({ + Key? key, + required this.tasks, + this.showMoreOptions = false, +}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/build.md b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/build.md new file mode 100644 index 000000000..88667691a --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/build.md @@ -0,0 +1,91 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + return SfCalendar( + view: CalendarView.schedule, + dataSource: _getCalendarDataSource(tasks), + scheduleViewSettings: const ScheduleViewSettings( + hideEmptyScheduleWeek: true, + appointmentItemHeight: 70, + monthHeaderSettings: MonthHeaderSettings( + height: 0, + ), + ), + onTap: calendarTapped, + appointmentBuilder: (context, appointments) { + final appointment = appointments.appointments.first as Appointment; + final task = tasks.firstWhere((task) => task.id == appointment.id); + return TaskCard( + appointment: appointment, + showMoreOptions: showMoreOptions, + task: task, + ); + }, + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/calendarTapped.md b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/calendarTapped.md new file mode 100644 index 000000000..8f719be54 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/calendarTapped.md @@ -0,0 +1,75 @@ + + + +# calendarTapped method + + + + + + + + +void calendarTapped +([CalendarTapDetails](https://pub.dev/documentation/syncfusion_flutter_calendar/20.4.54/calendar/CalendarTapDetails-class.html) details) + + + + + + + + +## Implementation + +```dart +void calendarTapped(CalendarTapDetails details) { + if (details.targetElement == CalendarElement.appointment || + details.targetElement == CalendarElement.agenda) { + final Appointment appointmentDetails = + details.appointments![0] as Appointment; + final subjectText = appointmentDetails.subject; + final dateText = + DateFormat('MMMM dd, yyyy').format(appointmentDetails.startTime); + final endTimeText = + DateFormat('hh:mm a').format(appointmentDetails.endTime); + final timeDetails = endTimeText; + + navigationService.pushDialog( + AlertDialog( + title: Text( + subjectText, + style: TextStyle( + color: Theme.of(navigationService.navigatorKey.currentContext!) + .primaryColorLight, + fontWeight: FontWeight.w500, + fontSize: 22, + ), + ), + content: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text(appointmentDetails.notes!), + const SizedBox(height: 10), + Text('$dateText $timeDetails') + ], + ), + actions: [ + TextButton( + onPressed: () => navigationService.pop(), + child: const Text('Close'), + ) + ], + ), + ); + } +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/showMoreOptions.md b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/showMoreOptions.md new file mode 100644 index 000000000..8ea655614 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/showMoreOptions.md @@ -0,0 +1,32 @@ + + + +# showMoreOptions property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) showMoreOptions + +_final_ + + + + + + +## Implementation + +```dart +final bool showMoreOptions; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/tasks.md b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/tasks.md new file mode 100644 index 000000000..d003e0b0e --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/TaskSchedule/tasks.md @@ -0,0 +1,32 @@ + + + +# tasks property + + + + + + + +[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Task](../../models_task_task_model/Task-class.md)> tasks + +_final_ + + + + + + +## Implementation + +```dart +final List tasks; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_task_schedule/widgets_task_schedule-library.md b/talawa-mobile-docs/widgets_task_schedule/widgets_task_schedule-library.md new file mode 100644 index 000000000..2510a7b76 --- /dev/null +++ b/talawa-mobile-docs/widgets_task_schedule/widgets_task_schedule-library.md @@ -0,0 +1,45 @@ + + + + +# task_schedule library + + + + + + + + + + + +## Classes + +##### [TaskCard](../widgets_task_schedule/TaskCard-class.md) + + + + + + +##### [TaskSchedule](../widgets_task_schedule/TaskSchedule-class.md) + + + + + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile-class.md b/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile-class.md new file mode 100644 index 000000000..3a74a348c --- /dev/null +++ b/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile-class.md @@ -0,0 +1,190 @@ + + + +# ChangeThemeTile class + + + + + + + + + +

This class enables theme switch. +It returns a ListTile which contains a Toggle button to switch between Dark and Light Themes.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatelessWidget](https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html) +- ChangeThemeTile + + + + + + + + +## Constructors + +[ChangeThemeTile](../widgets_theme_switch/ChangeThemeTile/ChangeThemeTile.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + + + +## Methods + +##### [build](../widgets_theme_switch/ChangeThemeTile/build.md)([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) + + + +Describes the part of the user interface represented by this widget. +_override_ + + + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatelessWidget/createElement.html)() [StatelessElement](https://api.flutter.dev/flutter/widgets/StatelessElement-class.html) + + + +Creates a StatelessElement to manage this widget's location in the tree. +_inherited_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile/ChangeThemeTile.md b/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile/ChangeThemeTile.md new file mode 100644 index 000000000..88b586d9d --- /dev/null +++ b/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile/ChangeThemeTile.md @@ -0,0 +1,29 @@ + + + +# ChangeThemeTile constructor + + + + + + +const +ChangeThemeTile({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key}) + + + + + +## Implementation + +```dart +const ChangeThemeTile({Key? key}) : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile/build.md b/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile/build.md new file mode 100644 index 000000000..bc0b2b30f --- /dev/null +++ b/talawa-mobile-docs/widgets_theme_switch/ChangeThemeTile/build.md @@ -0,0 +1,86 @@ + + + +# build method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) build +([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) + +_override_ + + + +

Describes the part of the user interface represented by this widget.

+

The framework calls this method when this widget is inserted into the tree +in a given BuildContext and when the dependencies of this widget change +(e.g., an InheritedWidget referenced by this widget changes). This +method can potentially be called in every frame and should not have any side +effects beyond building a widget.

+

The framework replaces the subtree below this widget with the widget +returned by this method, either by updating the existing subtree or by +removing the subtree and inflating a new subtree, depending on whether the +widget returned by this method can update the root of the existing +subtree, as determined by calling Widget.canUpdate.

+

Typically implementations return a newly created constellation of widgets +that are configured with information from this widget's constructor and +from the given BuildContext.

+

The given BuildContext contains information about the location in the +tree at which this widget is being built. For example, the context +provides the set of inherited widgets for this location in the tree. A +given widget might be built with multiple different BuildContext +arguments over time if the widget is moved around the tree or if the +widget is inserted into the tree in multiple places at once.

+

The implementation of this method must only depend on:

+ +

If a widget's build method is to depend on anything else, use a +StatefulWidget instead.

+

See also:

+
    +
  • StatelessWidget, which contains the discussion on performance considerations.
  • +
+ + + +## Implementation + +```dart +@override +Widget build(BuildContext context) { + final themeProvider = Provider.of(context); + return ListTile( + key: const Key('ThemeSwitch'), + contentPadding: EdgeInsets.zero, + title: Text(AppLocalizations.of(context)!.strictTranslate("Dark Theme")), + trailing: Switch( + key: const Key('ToggleTheme'), + autofocus: true, + activeColor: Theme.of(context).colorScheme.primary, + value: themeProvider.isdarkTheme, + onChanged: (value) { + final provider = Provider.of(context, listen: false); + provider.switchTheme(isOn: value); + }, + ), + ); +} +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_theme_switch/widgets_theme_switch-library.md b/talawa-mobile-docs/widgets_theme_switch/widgets_theme_switch-library.md new file mode 100644 index 000000000..7eadafcb6 --- /dev/null +++ b/talawa-mobile-docs/widgets_theme_switch/widgets_theme_switch-library.md @@ -0,0 +1,39 @@ + + + + +# theme_switch library + + + + + + + + + + + +## Classes + +##### [ChangeThemeTile](../widgets_theme_switch/ChangeThemeTile-class.md) + + + +This class enables theme switch. +It returns a ListTile which contains a Toggle button to switch between Dark and Light Themes. + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_video_widget/VideoWidget-class.md b/talawa-mobile-docs/widgets_video_widget/VideoWidget-class.md new file mode 100644 index 000000000..162c160f8 --- /dev/null +++ b/talawa-mobile-docs/widgets_video_widget/VideoWidget-class.md @@ -0,0 +1,207 @@ + + + +# VideoWidget class + + + + + + + + + +

This class creates a video widget.

+ + + +**Inheritance** + +- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) +- [DiagnosticableTree](https://api.flutter.dev/flutter/foundation/DiagnosticableTree-class.html) +- [Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) +- [StatefulWidget](https://api.flutter.dev/flutter/widgets/StatefulWidget-class.html) +- VideoWidget + + + + + + + + +## Constructors + +[VideoWidget](../widgets_video_widget/VideoWidget/VideoWidget.md) ({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) url, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) play}) + + _const_ + + +## Properties + +##### [hashCode](https://api.flutter.dev/flutter/widgets/Widget/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html) + + + +The hash code for this object. +_read-onlyinherited_ + + + +##### [key](https://api.flutter.dev/flutter/widgets/Widget/key.html) → [Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? + + + +Controls how one widget replaces another widget in the tree. +_finalinherited_ + + + +##### [play](../widgets_video_widget/VideoWidget/play.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + + +_final_ + + + +##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html) + + + +A representation of the runtime type of the object. +_read-onlyinherited_ + + + +##### [url](../widgets_video_widget/VideoWidget/url.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + + +_final_ + + + + + +## Methods + +##### [createElement](https://api.flutter.dev/flutter/widgets/StatefulWidget/createElement.html)() [StatefulElement](https://api.flutter.dev/flutter/widgets/StatefulElement-class.html) + + + +Creates a StatefulElement to manage this widget's location in the tree. +_inherited_ + + + +##### [createState](../widgets_video_widget/VideoWidget/createState.md)() _VideoWidgetState + + + +Creates the mutable state for this widget at a given location in the tree. +_override_ + + + +##### [debugDescribeChildren](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/debugDescribeChildren.html)() [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html)> + + + +Returns a list of DiagnosticsNode objects describing this node's +children. +_inherited_ + + + +##### [debugFillProperties](https://api.flutter.dev/flutter/widgets/Widget/debugFillProperties.html)([DiagnosticPropertiesBuilder](https://api.flutter.dev/flutter/foundation/DiagnosticPropertiesBuilder-class.html) properties) void + + + +Add additional properties associated with the node. +_inherited_ + + + +##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic + + + +Invoked when a non-existent method or property is accessed. +_inherited_ + + + +##### [toDiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toDiagnosticsNode.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? name, [DiagnosticsTreeStyle](https://api.flutter.dev/flutter/foundation/DiagnosticsTreeStyle.html)? style}) [DiagnosticsNode](https://api.flutter.dev/flutter/foundation/DiagnosticsNode-class.html) + + + +Returns a debug representation of the object that is used by debugging +tools and by DiagnosticsNode.toStringDeep. +_inherited_ + + + +##### [toString](https://api.flutter.dev/flutter/foundation/Diagnosticable/toString.html)({[DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.info}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A string representation of this object. +_inherited_ + + + +##### [toStringDeep](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringDeep.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) prefixLineOne = '', [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? prefixOtherLines, [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a string representation of this node and its descendants. +_inherited_ + + + +##### [toStringShallow](https://api.flutter.dev/flutter/foundation/DiagnosticableTree/toStringShallow.html)({[String](https://api.flutter.dev/flutter/dart-core/String-class.html) joiner = ', ', [DiagnosticLevel](https://api.flutter.dev/flutter/foundation/DiagnosticLevel.html) minLevel = DiagnosticLevel.debug}) [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +Returns a one-line detailed description of the object. +_inherited_ + + + +##### [toStringShort](https://api.flutter.dev/flutter/widgets/Widget/toStringShort.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html) + + + +A short, textual description of this widget. +_inherited_ + + + + + +## Operators + +##### [operator ==](https://api.flutter.dev/flutter/widgets/Widget/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) + + + +The equality operator. +_inherited_ + + + + + + + + + + + + + + + diff --git a/talawa-mobile-docs/widgets_video_widget/VideoWidget/VideoWidget.md b/talawa-mobile-docs/widgets_video_widget/VideoWidget/VideoWidget.md new file mode 100644 index 000000000..6e7a0763b --- /dev/null +++ b/talawa-mobile-docs/widgets_video_widget/VideoWidget/VideoWidget.md @@ -0,0 +1,30 @@ + + + +# VideoWidget constructor + + + + + + +const +VideoWidget({[Key](https://api.flutter.dev/flutter/foundation/Key-class.html)? key, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) url, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) play}) + + + + + +## Implementation + +```dart +const VideoWidget({Key? key, required this.url, required this.play}) + : super(key: key); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_video_widget/VideoWidget/createState.md b/talawa-mobile-docs/widgets_video_widget/VideoWidget/createState.md new file mode 100644 index 000000000..723fd8374 --- /dev/null +++ b/talawa-mobile-docs/widgets_video_widget/VideoWidget/createState.md @@ -0,0 +1,49 @@ + + + +# createState method + + + + + + + +- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html) + +_VideoWidgetState createState +() + +_override_ + + + +

Creates the mutable state for this widget at a given location in the tree.

+

Subclasses should override this method to return a newly created +instance of their associated State subclass:

+
@override
+State<SomeWidget> createState() => _SomeWidgetState();
+
+

The framework can call this method multiple times over the lifetime of +a StatefulWidget. For example, if the widget is inserted into the tree +in multiple locations, the framework will create a separate State object +for each location. Similarly, if the widget is removed from the tree and +later inserted into the tree again, the framework will call createState +again to create a fresh State object, simplifying the lifecycle of +State objects.

+ + + +## Implementation + +```dart +@override +_VideoWidgetState createState() => _VideoWidgetState(); +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_video_widget/VideoWidget/play.md b/talawa-mobile-docs/widgets_video_widget/VideoWidget/play.md new file mode 100644 index 000000000..6a981df47 --- /dev/null +++ b/talawa-mobile-docs/widgets_video_widget/VideoWidget/play.md @@ -0,0 +1,32 @@ + + + +# play property + + + + + + + +[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) play + +_final_ + + + + + + +## Implementation + +```dart +final bool play; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_video_widget/VideoWidget/url.md b/talawa-mobile-docs/widgets_video_widget/VideoWidget/url.md new file mode 100644 index 000000000..872efdaa1 --- /dev/null +++ b/talawa-mobile-docs/widgets_video_widget/VideoWidget/url.md @@ -0,0 +1,32 @@ + + + +# url property + + + + + + + +[String](https://api.flutter.dev/flutter/dart-core/String-class.html) url + +_final_ + + + + + + +## Implementation + +```dart +final String url; +``` + + + + + + + diff --git a/talawa-mobile-docs/widgets_video_widget/widgets_video_widget-library.md b/talawa-mobile-docs/widgets_video_widget/widgets_video_widget-library.md new file mode 100644 index 000000000..bd07455d2 --- /dev/null +++ b/talawa-mobile-docs/widgets_video_widget/widgets_video_widget-library.md @@ -0,0 +1,38 @@ + + + + +# video_widget library + + + + + + + + + + + +## Classes + +##### [VideoWidget](../widgets_video_widget/VideoWidget-class.md) + + + +This class creates a video widget. + + + + + + + + + + + + + + + diff --git a/talawa_lint/bin/talawa_lint.dart b/talawa_lint/bin/talawa_lint.dart new file mode 100644 index 000000000..84578608c --- /dev/null +++ b/talawa_lint/bin/talawa_lint.dart @@ -0,0 +1,55 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +// ignore_for_file: depend_on_referenced_packages + +import 'dart:async'; +import 'dart:io'; + +import 'package:args/args.dart'; +import 'package:custom_lint/custom_lint.dart'; + +Future entrypoint([List args = const []]) async { + final parser = ArgParser() + ..addFlag( + 'watch', + help: "Watches plugins' sources and perform a hot-reload on change", + negatable: false, + ) + ..addFlag( + 'help', + abbr: 'h', + negatable: false, + help: 'Prints command usage', + ) + ..addMultiOption( + 'files', + abbr: 'f', + help: 'Takes a list of files as argument', + ); + final result = parser.parse(args); + + final help = result['help'] as bool; + if (help) { + stdout.writeln('Usage: custom_lint [--watch]'); + stdout.writeln(parser.usage); + return; + } + + final fileList = result['files'] as List; + + if (fileList.isNotEmpty) { + stdout.writeln("file mode"); + stdout.writeln(fileList[0]); + return; + } + + final watchMode = result['watch'] as bool; + + await customLint(workingDirectory: Directory.current, watchMode: watchMode); +} + +void main([List args = const []]) async { + await entrypoint(args); + // TODO figure out why this exit is necessary + exit(exitCode); +} diff --git a/talawa_lint/lib/helpers.dart b/talawa_lint/lib/helpers.dart new file mode 100644 index 000000000..601623065 --- /dev/null +++ b/talawa_lint/lib/helpers.dart @@ -0,0 +1,170 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +// ignore_for_file: depend_on_referenced_packages + +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/syntactic_entity.dart'; +import 'package:analyzer/dart/ast/token.dart'; +import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/type.dart'; +import 'package:analyzer/error/listener.dart'; +import 'package:custom_lint_builder/custom_lint_builder.dart'; + +SyntacticEntity? _getNodeToAnnotate(Declaration node) { + if (node is MethodDeclaration) { + return node.name; + } + if (node is ConstructorDeclaration) { + return node.name; + } + if (node is FieldDeclaration) { + return node.fields; + } + if (node is ClassTypeAlias) { + return node.name; + } + if (node is FunctionTypeAlias) { + return node.name; + } + if (node is ClassDeclaration) { + return node.name; + } + if (node is EnumDeclaration) { + return node.name; + } + if (node is ExtensionDeclaration) { + return node.name; + } + if (node is FunctionDeclaration) { + return node.name; + } + if (node is TopLevelVariableDeclaration) { + return node.variables; + } + if (node is EnumConstantDeclaration) { + return node.name; + } + if (node is TypeParameter) { + return node.name; + } + if (node is VariableDeclaration) { + return node.name; + } + return null; +} + +/// Returns the most specific AST node appropriate for associating errors. +SyntacticEntity getNodeToAnnotate(Declaration node) { + final mostSpecific = _getNodeToAnnotate(node); + return mostSpecific ?? node; +} + +Element? getOverriddenMember(Element? member) { + if (member == null) { + return null; + } + + return member.hasOverride ? member : null; + // final interfaceElement = member.thisOrAncestorOfType(); + // if (interfaceElement == null) { + // return null; + // } + // final name = member.name; + // if (name == null) { + // return null; + // } + + // final libraryUri = interfaceElement.library.source.uri; + // return context.inheritanceManager.getInherited( + // interfaceElement.thisType, + // Name(libraryUri, name), + // ); +} + +bool isOverridingMember(Declaration node) => + getOverriddenMember(node.declaredElement) != null; + +void checkMethods( + bool Function(Declaration) check, + List members, + ErrorReporter reporter, + LintRule rule, +) { + // Check methods + + final getters = {}; + final setters = []; + + // Non-getters/setters. + final methods = []; + + // Identify getter/setter pairs. + for (final member in members) { + // if (member is MethodDeclaration && !isPrivate(member.name)) { + if (member is MethodDeclaration) { + // print(member.parameters); + if (member.isGetter) { + getters[member.name.lexeme] = member; + } else if (member.isSetter) { + setters.add(member); + } else { + methods.add(member); + } + } + } + + // Check all getters, and collect offenders along the way. + final missingDocs = {}; + for (final getter in getters.values) { + if (check(getter)) { + missingDocs.add(getter); + } + } + + // But only setters whose getter is missing a doc. + for (final setter in setters) { + final getter = getters[setter.name.lexeme]; + if (getter != null && missingDocs.contains(getter)) { + check(setter); + } + } + + // Check remaining methods. + methods.forEach(check); +} + +/// Returns `true` if the given [id] is a Dart keyword. +bool isKeyWord(String id) => Keyword.keywords.containsKey(id); + +/// Returns `true` if the given [ClassMember] is a method. +bool isMethod(ClassMember m) => m is MethodDeclaration; + +/// Check if the given identifier has a private name. +bool isPrivate(Token? name) => + // ignore: avoid_bool_literals_in_conditional_expressions + name != null ? Identifier.isPrivateName(name.lexeme) : false; + +class TalawaLintHelpers { + static bool isVoid(Declaration node) { + return returnType(node) is VoidType || + returnType(node)?.getDisplayString( + withNullability: true, + ) == + "Future"; + } + + static bool isImplicitReturn(Declaration node) { + return ((node is FunctionDeclaration) + ? node.declaredElement?.hasImplicitReturnType + : (node as MethodDeclaration) + .declaredElement + ?.hasImplicitReturnType) ?? + false; + } + + static DartType? returnType(Declaration node) { + return (node is FunctionDeclaration) + ? node.returnType?.type + : (node as MethodDeclaration).returnType?.type; + } +} diff --git a/talawa_lint/lib/talawa_api_doc/talawa_api_doc.dart b/talawa_lint/lib/talawa_api_doc/talawa_api_doc.dart new file mode 100644 index 000000000..392b7c806 --- /dev/null +++ b/talawa_lint/lib/talawa_api_doc/talawa_api_doc.dart @@ -0,0 +1,89 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +// ignore_for_file: depend_on_referenced_packages + +import 'package:analyzer/error/error.dart'; +import 'package:analyzer/error/listener.dart'; +import 'package:custom_lint_builder/custom_lint_builder.dart'; +import 'package:talawa_lint/talawa_api_doc/talawa_api_doc_fixer.dart'; +import 'package:talawa_lint/talawa_api_doc/talawa_api_doc_visitor.dart'; + +class TalawaApiDocLintRule extends DartLintRule { + const TalawaApiDocLintRule() : super(code: _code); + + /// Metadata about the warning that will show-up in the IDE. + /// This is used for `// ignore: code` and enabling/disabling the lint + static const _code = LintCode( + name: 'talawa_api_doc', + problemMessage: 'No documentation found for this field.', + correctionMessage: "Add a valid documentation describing usecase.", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + @override + void run( + CustomLintResolver resolver, + ErrorReporter reporter, + CustomLintContext context, + ) { + final visitor = TalawaApiDocVisitor( + this, + context, + reporter, + ); + + if (reporter.source.fullName.contains(RegExp('.*/test/.*/.*test.dart')) || + reporter.source.fullName.contains(RegExp('.*/.*g.dart'))) { + return; + } + + context.registry.addClassDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addClassTypeAlias( + (node) => node.visitChildren(visitor), + ); + context.registry.addCompilationUnit( + (node) => node.visitChildren(visitor), + ); + context.registry.addConstructorDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addEnumConstantDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addEnumDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addExtensionDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addFieldDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addFunctionDeclaration( + (node) => visitor.check(node), + ); + context.registry.addFunctionTypeAlias( + (node) => node.visitChildren(visitor), + ); + context.registry.addGenericTypeAlias( + (node) => node.visitChildren(visitor), + ); + context.registry.addMixinDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addVariableDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addTopLevelVariableDeclaration( + (node) => node.visitChildren(visitor), + ); + } + + @override + List getFixes() => [ + TalawaAPIDocFixer(), + ]; +} diff --git a/talawa_lint/lib/talawa_api_doc/talawa_api_doc_fixer.dart b/talawa_lint/lib/talawa_api_doc/talawa_api_doc_fixer.dart new file mode 100644 index 000000000..09f18c32e --- /dev/null +++ b/talawa_lint/lib/talawa_api_doc/talawa_api_doc_fixer.dart @@ -0,0 +1,189 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +// ignore_for_file: depend_on_referenced_packages + +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/error/error.dart'; +import 'package:analyzer/source/source_range.dart'; +import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart'; +import 'package:custom_lint_builder/custom_lint_builder.dart'; +import 'package:talawa_lint/helpers.dart'; + +class TalawaAPIDocFixer extends DartFix { + @override + void run( + CustomLintResolver resolver, + ChangeReporter reporter, + CustomLintContext context, + AnalysisError analysisError, + List others, + ) { + context.registry.addVariableDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addClassDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addClassTypeAlias( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addConstructorDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addEnumConstantDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addEnumDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addExtensionDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addFieldDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addFunctionDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addMethodDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addFunctionTypeAlias( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addGenericTypeAlias( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addMixinDeclaration( + (node) => fix(node, reporter, analysisError), + ); + context.registry.addTopLevelVariableDeclaration( + (node) => fix(node, reporter, analysisError), + ); + } + + void fix( + Declaration node, + ChangeReporter reporter, + AnalysisError analysisError, + ) { + // Verifying that the node and error offset match (collide) + + if (!analysisError.sourceRange.intersects(node.sourceRange)) return; + + // The [SourceRange] of the ClassDeclaration spans to the whole class + // and will intersect with everything inside it. This is a problem, as the + // error for it's fields will match to itself, and the fixes will be applied + // to the wrong place. + + if (node is ClassDeclaration && + !analysisError.sourceRange.intersects( + SourceRange( + node.offset, + node.leftBracket.offset - node.offset, + ), + )) return; + + // The same issue exists for Functions and Methods. We can define functions + // inside functions, and the same overlap of [SourceRange] occurs due to that + + if (node is FunctionDeclaration && + !analysisError.sourceRange.intersects( + SourceRange( + node.offset, + (node.functionExpression.parameters?.end ?? + node.name.length + node.name.offset) - + node.offset, + ), + )) return; + + if (node is MethodDeclaration && + !analysisError.sourceRange.intersects( + SourceRange( + node.offset, + (node.parameters?.offset ?? node.name.length + node.name.offset) - + node.offset, + ), + )) return; + + final changeBuilder = reporter.createChangeBuilder( + message: 'Insert Doc skeleton', + priority: 3, + ); + + changeBuilder.addDartFileEdit((builder) { + builder.addInsertion(node.offset, (builder) { + builder.write( + "/// a_line_ending_with_end_punctuation.\n" + "/// \n" + "/// more_info_if_required\n", + ); + + if (node is FunctionDeclaration || node is MethodDeclaration) { + fixFun( + node, + builder, + ); + } + }); + }); + } + + void fixFun( + Declaration node, + DartEditBuilder builder, + ) { + // Putting in these obvious checks because in the edge case when someone + // mistakenly calls this function on non-function type entities, the linter + // will simply crash without any plausible explanation. + + if (!(node is FunctionDeclaration || node is MethodDeclaration)) { + return; + } + + if (node is MethodDeclaration && (node.isGetter || node.isSetter)) { + return; + } + + final fnInfo = StringBuffer(); + + fnInfo.write( + "/// \n" + "/// **params**:\n", + ); + + final paramList = (node is FunctionDeclaration) + ? node.functionExpression.parameters?.parameters + : (node as MethodDeclaration).parameters?.parameters; + + if (paramList == null || paramList.isEmpty) { + fnInfo.write("/// None\n"); + } else { + for (final param in paramList) { + fnInfo.write("/// * `${param.name}`: define_the_param\n"); + } + } + + fnInfo.write( + "/// \n" + "/// **returns**:\n", + ); + + final isImplicitReturn = TalawaLintHelpers.isImplicitReturn(node); + final isVoid = TalawaLintHelpers.isVoid(node); + + final returnType = (node is FunctionDeclaration) + ? node.returnType + : (node as MethodDeclaration).returnType; + + if (isImplicitReturn || returnType == null) { + fnInfo.write("/// * `undef`: type_the_return\n"); + } else if (isVoid) { + fnInfo.write("/// None\n"); + } else { + fnInfo.write("/// * `$returnType`: define_the_return\n"); + } + + builder.write(fnInfo.toString()); + } +} diff --git a/talawa_lint/lib/talawa_api_doc/talawa_api_doc_visitor.dart b/talawa_lint/lib/talawa_api_doc/talawa_api_doc_visitor.dart new file mode 100644 index 000000000..ddb37b51f --- /dev/null +++ b/talawa_lint/lib/talawa_api_doc/talawa_api_doc_visitor.dart @@ -0,0 +1,172 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +// ignore_for_file: depend_on_referenced_packages + +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/token.dart'; +import 'package:analyzer/dart/ast/visitor.dart'; +import 'package:analyzer/error/listener.dart'; +import 'package:custom_lint_builder/custom_lint_builder.dart'; +import 'package:talawa_lint/helpers.dart'; + +class TalawaApiDocVisitor extends SimpleAstVisitor { + TalawaApiDocVisitor( + this.rule, + this.context, + this.reporter, + ); + + final LintRule rule; + final CustomLintContext context; + final ErrorReporter reporter; + + bool check(Declaration node) { + // if (node.documentationComment == null && !isOverridingMember(node)) { + // If the class extends [State], we don't want documentation + // for it + final extendsState = (node is ClassDeclaration) && + node.extendsClause?.superclass.element?.name == "State"; + final isMain = + (node is FunctionDeclaration) && node.declaredElement?.name == "main"; + + if (node.documentationComment == null && + !isOverridingMember(node) && + !extendsState && + !isMain) { + final errorNode = getNodeToAnnotate(node); + + reporter.reportErrorForOffset( + rule.code, + errorNode.offset, + errorNode.length, + ); + + return true; + } + + return false; + } + + @override + void visitClassDeclaration(ClassDeclaration node) { + _visitMembers(node, node.name, node.members); + } + + @override + void visitClassTypeAlias(ClassTypeAlias node) { + check(node); + } + + @override + void visitCompilationUnit(CompilationUnit node) { + final getters = {}; + final setters = []; + + // Check functions. + + // Non-getters/setters. + final functions = []; + + // Identify getter/setter pairs. + for (final member in node.declarations) { + if (member is FunctionDeclaration) { + final name = member.name; + if (!isPrivate(name) && name.lexeme != 'main') { + if (member.isGetter) { + getters[member.name.lexeme] = member; + } else if (member.isSetter) { + setters.add(member); + } else { + functions.add(member); + } + } + } + } + + // Check all getters, and collect offenders along the way. + final missingDocs = {}; + for (final getter in getters.values) { + if (check(getter)) { + missingDocs.add(getter); + } + } + + // But only setters whose getter is missing a doc. + for (final setter in setters) { + final getter = getters[setter.name.lexeme]; + if (getter != null && missingDocs.contains(getter)) { + check(setter); + } + } + + // Check remaining functions. + functions.forEach(check); + + super.visitCompilationUnit(node); + } + + @override + void visitConstructorDeclaration(ConstructorDeclaration node) { + // if (!inPrivateMember(node) && !isPrivate(node.name)) { + // check(node); + // } + } + + @override + void visitEnumConstantDeclaration(EnumConstantDeclaration node) { + check(node); + } + + @override + void visitEnumDeclaration(EnumDeclaration node) { + check(node); + checkMethods(check, node.members, reporter, rule); + } + + @override + void visitExtensionDeclaration(ExtensionDeclaration node) { + // if (node.name == null || isPrivate(node.name)) { + if (node.name == null) { + return; + } + + check(node); + checkMethods(check, node.members, reporter, rule); + } + + @override + void visitFieldDeclaration(FieldDeclaration node) { + for (final field in node.fields.variables) { + if (!isPrivate(field.name)) { + check(field); + } + } + } + + @override + void visitFunctionTypeAlias(FunctionTypeAlias node) { + check(node); + } + + @override + void visitGenericTypeAlias(GenericTypeAlias node) { + check(node); + } + + @override + void visitMixinDeclaration(MixinDeclaration node) { + _visitMembers(node, node.name, node.members); + } + + @override + void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { + for (final decl in node.variables.variables) { + check(decl); + } + } + + void _visitMembers(Declaration node, Token name, List members) { + check(node); + checkMethods(check, members, reporter, rule); + } +} diff --git a/talawa_lint/lib/talawa_good_doc/talawa_good_doc.dart b/talawa_lint/lib/talawa_good_doc/talawa_good_doc.dart new file mode 100644 index 000000000..7b29918ab --- /dev/null +++ b/talawa_lint/lib/talawa_good_doc/talawa_good_doc.dart @@ -0,0 +1,84 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +// ignore_for_file: depend_on_referenced_packages + +import 'package:analyzer/error/error.dart'; +import 'package:analyzer/error/listener.dart'; +import 'package:custom_lint_builder/custom_lint_builder.dart'; +import 'package:talawa_lint/talawa_good_doc/talawa_good_doc_visitor.dart'; + +class TalawaGoodDocComments extends DartLintRule { + const TalawaGoodDocComments() : super(code: _code); + + /// Metadata about the warning that will show-up in the IDE. + /// This is used for `// ignore: code` and enabling/disabling the lint + static const _code = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Wrong comment format.', + correctionMessage: + 'Use "/// ..." for public api and "// ..." for other cases.', + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + @override + void run( + CustomLintResolver resolver, + ErrorReporter reporter, + CustomLintContext context, + ) { + final visitor = TalawaGoodDocVisitor( + this, + context, + reporter, + ); + + if (reporter.source.fullName.contains(RegExp('.*/test/.*/.*test.dart')) || + reporter.source.fullName.contains(RegExp('.*/.*g.dart'))) { + return; + } + + context.registry.addClassDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addClassTypeAlias( + (node) => node.visitChildren(visitor), + ); + context.registry.addCompilationUnit( + (node) => node.visitChildren(visitor), + ); + context.registry.addConstructorDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addEnumConstantDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addEnumDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addExtensionDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addFieldDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addFunctionDeclaration( + visitor.check, + ); + context.registry.addFunctionTypeAlias( + (node) => node.visitChildren(visitor), + ); + context.registry.addGenericTypeAlias( + (node) => node.visitChildren(visitor), + ); + context.registry.addMixinDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addTopLevelVariableDeclaration( + (node) => node.visitChildren(visitor), + ); + context.registry.addComment( + (node) => node.visitChildren(visitor), + ); + } +} diff --git a/talawa_lint/lib/talawa_good_doc/talawa_good_doc_visitor.dart b/talawa_lint/lib/talawa_good_doc/talawa_good_doc_visitor.dart new file mode 100644 index 000000000..5e13151ab --- /dev/null +++ b/talawa_lint/lib/talawa_good_doc/talawa_good_doc_visitor.dart @@ -0,0 +1,415 @@ +// ignore_for_file: implementation_imports, depend_on_referenced_packages +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:_fe_analyzer_shared/src/scanner/token.dart'; +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/visitor.dart'; +import 'package:analyzer/error/listener.dart'; +import 'package:custom_lint_builder/custom_lint_builder.dart'; +import 'package:talawa_lint/helpers.dart'; +import 'package:talawa_lint/talawa_lint_rules.dart'; + +class TalawaGoodDocVisitor extends SimpleAstVisitor { + TalawaGoodDocVisitor( + this.rule, + this.context, + this.reporter, + ); + + final LintRule rule; + final CustomLintContext context; + final ErrorReporter reporter; + + @override + void visitClassDeclaration(ClassDeclaration node) { + _visitMembers(node, node.name, node.members); + } + + @override + void visitClassTypeAlias(ClassTypeAlias node) { + check(node); + } + + @override + void visitCompilationUnit(CompilationUnit node) { + final getters = {}; + final setters = []; + + // Non-getters/setters. + final functions = []; + + // Identify getter/setter pairs. + for (final member in node.declarations) { + if (member is FunctionDeclaration) { + final name = member.name; + if (!isPrivate(name) && name.lexeme != 'main') { + if (member.isGetter) { + getters[member.name.lexeme] = member; + } else if (member.isSetter) { + setters.add(member); + } else { + functions.add(member); + } + } + } + } + + // Check all getters, and collect offenders along the way. + final missingDocs = {}; + for (final getter in getters.values) { + if (check(getter)) { + missingDocs.add(getter); + } + } + + // But only setters whose getter is missing a doc. + for (final setter in setters) { + final getter = getters[setter.name.lexeme]; + if (getter != null && missingDocs.contains(getter)) { + check(setter); + } + } + + // Check remaining functions. + functions.forEach(check); + + super.visitCompilationUnit(node); + } + + @override + void visitConstructorDeclaration(ConstructorDeclaration node) { + check(node); + } + + @override + void visitEnumConstantDeclaration(EnumConstantDeclaration node) { + check(node); + } + + @override + void visitEnumDeclaration(EnumDeclaration node) { + check(node); + checkMethods(check, node.members, reporter, rule); + } + + @override + void visitExtensionDeclaration(ExtensionDeclaration node) { + if (node.name == null) { + return; + } + + check(node); + checkMethods(check, node.members, reporter, rule); + } + + @override + void visitFieldDeclaration(FieldDeclaration node) { + for (final field in node.fields.variables) { + if (!isPrivate(field.name)) { + check(field); + } + } + } + + @override + void visitFunctionTypeAlias(FunctionTypeAlias node) { + check(node); + } + + @override + void visitGenericTypeAlias(GenericTypeAlias node) { + check(node); + } + + @override + void visitMixinDeclaration(MixinDeclaration node) { + _visitMembers(node, node.name, node.members); + } + + @override + void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { + for (final decl in node.variables.variables) { + check(decl); + } + } + + bool check(Declaration node) { + if (node.documentationComment == null) { + return false; + } + + final doc = node.documentationComment!.tokens; + if (!doc[0].lexeme.endsWith('.')) { + reporter.reportErrorForToken( + TalawaGoodDocLintRules.firstLineEndCode, + doc[0], + ); + } + + // Don't check for [setters] and [getters] + // TODO: Fix this completely + if (node is MethodDeclaration && (node.isGetter || node.isSetter)) { + return true; + } + + if (doc.length == 1) { + if (node is FunctionDeclaration || node is MethodDeclaration) { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.includeParamsKeywordCode, + node.documentationComment!, + ); + + return false; + } else { + return true; + } + } + + // NOTE: The reason why we are checking for both '///' and '///' + // is because - + // + // 1. The extra space is automatically inserted whenever + // you hit 'enter' when on a line in documentation. + // 2. Flutter will automatically format and remove the extra + // space at the end when formatted + + if (doc[1].lexeme.trim() != '///') { + reporter.reportErrorForToken( + TalawaGoodDocLintRules.secondLineEmptyCode, + doc[1], + ); + } + + if (node is FunctionDeclaration || node is MethodDeclaration) { + if (checkContainsParams(doc, node)) { + checkContainsReturn(doc, node); + } + } + + return true; + } + + bool checkContainsParams(List doc, Declaration rawNode) { + final node = + rawNode is FunctionDeclaration ? rawNode : rawNode as MethodDeclaration; + + final params = rawNode is FunctionDeclaration + ? (node as FunctionDeclaration).functionExpression.parameters + : (node as MethodDeclaration).parameters; + + // If params is null or it is just '()' + // if (params == null || params.length == 2) { + // return; + // } + + bool containsParamsKeyword = false; + + // The line in the doc we are currently parsing + int currentDocLine = 0; + + for (; currentDocLine < doc.length; currentDocLine++) { + final line = doc[currentDocLine]; + if (line.lexeme == '/// **params**:') { + containsParamsKeyword = true; + currentDocLine++; + break; + } + } + + if (!containsParamsKeyword) { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.includeParamsKeywordCode, + node.documentationComment!, + ); + + return false; + } + + final paramList = params?.parameterElements ?? []; + + if (paramList.isEmpty) { + if (currentDocLine == doc.length) { + return false; + } else if (doc[currentDocLine].lexeme != "/// None") { + reporter.reportErrorForToken( + TalawaGoodDocLintRules.noParamNone, + doc[currentDocLine], + ); + return false; + } + + return true; + } + + // The currentParam we are checking for + int currentParam = 0; + + for (; currentDocLine < doc.length; currentDocLine++) { + final line = doc[currentDocLine]; + + // If the line starts with '/// *', it must contain a param + if (line.length > 4 && line.lexeme[4] == '*') { + final paramRegex = RegExp( + '/// * `${paramList[currentParam]?.name}`:', + ); + + // TODO: RegExp.hasMatch() doesn't work for some reason. + if (!line.lexeme.startsWith(paramRegex.pattern)) { + if (line.lexeme.trim() == '/// **returns**:') { + reporter.reportErrorForToken( + TalawaGoodDocLintRules.allParamsNotDocumented, + line, + ); + + return false; + } + + reporter.reportErrorForToken( + TalawaGoodDocLintRules.startShouldFollowParam, + line, + ); + + return false; + } else { + if (line.lexeme.trim() == paramRegex.pattern) { + reporter.reportErrorForToken( + TalawaGoodDocLintRules.emptyParamDoc, + line, + ); + + return false; + } else { + currentParam++; + } + } + } + + if (currentParam == paramList.length) break; + } + + if (currentParam != paramList.length) { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.allParamsNotDocumented, + node, + ); + + return false; + } + + return true; + } + + void checkContainsReturn( + List doc, + Declaration rawNode, + ) { + // Let the implicit_return_type warning be fixed first + + if (TalawaLintHelpers.isImplicitReturn(rawNode)) return; + + int currentDocLine = 0; + bool containsReturn = false; + + final node = + rawNode is FunctionDeclaration ? rawNode : rawNode as MethodDeclaration; + + for (; currentDocLine < doc.length; currentDocLine++) { + if (doc[currentDocLine].lexeme.trim() == '/// **returns**:') { + containsReturn = true; + break; + } + } + + final isVoid = TalawaLintHelpers.isVoid(node); + + if (!containsReturn) { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.doesNotContainReturn, + node.documentationComment!, + ); + + return; + } + + // Check if there is atleast one blank line above + + if (doc[currentDocLine - 1].lexeme.trim() != '///') { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.noBlankLineBWParamAndReturn, + node.documentationComment!, + ); + + return; + } + + // Uncomment below line if returns block is made optional for + // void types someday :) + + // if (isVoid && currentDocLine == doc.length) return; + + if (doc[currentDocLine].lexeme.trim() != '/// **returns**:') { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.wrongReturnsDoc, + node.documentationComment!, + ); + + return; + } + + // Moving onto next lines and checking if documentation about + // the return type is found. + currentDocLine++; + + if (currentDocLine == doc.length) { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.noReturnDoc, + node.documentationComment!, + ); + + return; + } + + // Moving ahead to find a line that contains information about the + // return type + currentDocLine++; + + // If return type is [void] and doc doesn't end with [None] or + // there are more lines to the doc + if (isVoid && + (doc[currentDocLine - 1].lexeme != '/// None' || + currentDocLine != doc.length)) { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.noEndWithNoneForVoid, + node.documentationComment!, + ); + + return; + } + + final returnType = TalawaLintHelpers.returnType(node); + + // If return type is not [void] and doc doesn't end with [return_type] or + // there are more lines to the doc + final returnTypeDocPattern = RegExp( + '/// * `$returnType`:', + ); + + if (!isVoid && + !doc[currentDocLine - 1].lexeme.startsWith( + returnTypeDocPattern.pattern, + )) { + reporter.reportErrorForNode( + TalawaGoodDocLintRules.wrongReturnsDoc, + node.documentationComment!, + ); + + return; + } + } + + void _visitMembers(Declaration node, Token name, List members) { + check(node); + checkMethods(check, members, reporter, rule); + } +} diff --git a/talawa_lint/lib/talawa_lint.dart b/talawa_lint/lib/talawa_lint.dart new file mode 100644 index 000000000..827d6bba5 --- /dev/null +++ b/talawa_lint/lib/talawa_lint.dart @@ -0,0 +1,20 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +// ignore_for_file: depend_on_referenced_packages + +// This is the entrypoint of our custom linter +import 'package:custom_lint_builder/custom_lint_builder.dart'; +import 'package:talawa_lint/talawa_api_doc/talawa_api_doc.dart'; +import 'package:talawa_lint/talawa_good_doc/talawa_good_doc.dart'; + +PluginBase createPlugin() => _ExampleLinter(); + +/// A plugin class is used to list all the assists/lints defined by a plugin. +class _ExampleLinter extends PluginBase { + /// We list all the custom warnings/infos/errors + @override + List getLintRules(CustomLintConfigs configs) => [ + const TalawaApiDocLintRule(), + const TalawaGoodDocComments(), + ]; +} diff --git a/talawa_lint/lib/talawa_lint_rules.dart b/talawa_lint/lib/talawa_lint_rules.dart new file mode 100644 index 000000000..48c60be39 --- /dev/null +++ b/talawa_lint/lib/talawa_lint_rules.dart @@ -0,0 +1,124 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +// ignore_for_file: depend_on_referenced_packages + +import 'package:analyzer/error/error.dart'; +import 'package:custom_lint_builder/custom_lint_builder.dart'; + +class TalawaAPIDocLintRules {} + +class TalawaGoodDocLintRules { + static const firstLineEndCode = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: + "First line of the documentation doesn't end with end punctuation.", + correctionMessage: "End first line of documentation with '.', '!' etc", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const secondLineEmptyCode = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Second line of the doc is not empty.', + correctionMessage: + "Second line should be left empty to improve readability", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const includeParamsKeywordCode = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'params block not found in the documentation.', + correctionMessage: "Include `**params**:` keyword in function/method doc", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const noParamNone = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Wrong doc format.', + correctionMessage: "Empty param list should be documented as `/// None`", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const startShouldFollowParam = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: '* should follow a param name', + correctionMessage: "Make sure you have added a param name after *, and it\n" + "is in the same order as it appears in the function", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const emptyParamDoc = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'No documentation is written for this parameter', + correctionMessage: "Param name should follow its documentation", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const allParamsNotDocumented = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Some parameters are missing documentation', + correctionMessage: "Please make sure that you have documented all\n" + "of the parameters in the same order as they appear in the function.", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const noBlankLineBWParamAndReturn = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Wrong doc format.', + correctionMessage: "Add a blank line between the end of 'params:' block\n" + "and start of 'returns:' block.", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const doesNotContainReturn = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Wrong doc format.', + correctionMessage: + "Documentation does not contain information about the return type.\n" + "Add '**returns**:' block followed by the return doc.", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const wrongReturnsDoc = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Wrong doc format.', + correctionMessage: + "Documentation format of return type is in wrong format.\n" + "For void type - \n" + "/// **returns**: \n/// None\n" + "For other types - \n" + "/// **returns**: \n" + "/// * `return_type`: documentation of the return type.", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const noReturnDoc = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Wrong doc format.', + correctionMessage: + "'**returns**:' should immediately be followed by documentation about\n" + "the return type", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); + + static const noEndWithNoneForVoid = LintCode( + name: 'talawa_good_doc_comments', + problemMessage: 'Wrong doc format.', + correctionMessage: + "A function/method with [void] return type must end with\n" + "`/// None`\n" + "without extra lines.", + url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", + errorSeverity: ErrorSeverity.WARNING, + ); +} diff --git a/talawa_lint/pubspec.lock b/talawa_lint/pubspec.lock new file mode 100644 index 000000000..9469794a9 --- /dev/null +++ b/talawa_lint/pubspec.lock @@ -0,0 +1,357 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" + url: "https://pub.dev" + source: hosted + version: "65.0.0" + analyzer: + dependency: "direct main" + description: + name: analyzer + sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 + url: "https://pub.dev" + source: hosted + version: "6.3.0" + analyzer_plugin: + dependency: "direct main" + description: + name: analyzer_plugin + sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" + url: "https://pub.dev" + source: hosted + version: "0.11.3" + args: + dependency: "direct main" + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + ci: + dependency: transitive + description: + name: ci + sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 + url: "https://pub.dev" + source: hosted + version: "0.4.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + custom_lint: + dependency: "direct main" + description: + name: custom_lint + sha256: dfb893ff17c83cf08676c6b64df11d3e53d80590978d7c1fb242afff3ba6dedb + url: "https://pub.dev" + source: hosted + version: "0.5.8" + custom_lint_builder: + dependency: "direct main" + description: + name: custom_lint_builder + sha256: "8df6634b38a36a6c6cb74a9c0eb02e9ba0b0ab89b29e38e6daa86e8ed2c6288d" + url: "https://pub.dev" + source: hosted + version: "0.5.8" + custom_lint_core: + dependency: transitive + description: + name: custom_lint_core + sha256: "2b235be098d157e244f18ea905a15a18c16a205e30553888fac6544bbf52f03f" + url: "https://pub.dev" + source: hosted + version: "0.5.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" + url: "https://pub.dev" + source: hosted + version: "2.3.4" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + url: "https://pub.dev" + source: hosted + version: "2.4.1" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + hotreloader: + dependency: transitive + description: + name: hotreloader + sha256: "94ee21a60ea2836500799f3af035dc3212b1562027f1e0031c14e087f0231449" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + lint: + dependency: "direct dev" + description: + name: lint + sha256: d758a5211fce7fd3f5e316f804daefecdc34c7e53559716125e6da7388ae8565 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + meta: + dependency: transitive + description: + name: meta + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" + source: hosted + version: "0.27.7" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" + source: hosted + version: "0.7.0" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 + url: "https://pub.dev" + source: hosted + version: "4.3.3" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.2.0 <4.0.0" diff --git a/talawa_lint/pubspec.yaml b/talawa_lint/pubspec.yaml new file mode 100644 index 000000000..e662f71c0 --- /dev/null +++ b/talawa_lint/pubspec.yaml @@ -0,0 +1,21 @@ +# pubspec.yaml +name: talawa_lint +environment: + sdk: ">=2.12.0 <4.0.0" + +dev_dependencies: + lint: ^2.3.0 + +dependencies: + # we will use analyzer for inspecting Dart files + # _fe_analyzer_shared: ^61.0.0 + analyzer: ">=5.12.0 <7.0.0" + analyzer_plugin: ^0.11.0 + # args: + + # custom_lint_builder will give us tools for writing lints + args: ^2.4.2 + custom_lint: 0.5.8 + custom_lint_builder: ^0.5.8 + # watcher: ^1.1.0 + diff --git a/test/constants/quick_actions_test.dart b/test/constants/quick_actions_test.dart new file mode 100644 index 000000000..44e69b3a2 --- /dev/null +++ b/test/constants/quick_actions_test.dart @@ -0,0 +1,32 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:quick_actions/quick_actions.dart'; +import 'package:talawa/constants/quick_actions.dart'; + +void main() { + const eventAction = ShortcutItem( + type: "events_action", + localizedTitle: "Events", + icon: "event_icon", + ); + + const feedAction = ShortcutItem( + type: "feed_action", + localizedTitle: "NewsFeed", + icon: "newsfeed_icon", + ); + + const chatAction = ShortcutItem( + type: "chat_action", + localizedTitle: "Messages", + icon: "chat_icon", + ); + + final desiredActions = [ + eventAction, + feedAction, + chatAction, + ]; + test('ShortcutMenu', () { + expect(ShortCutMenu.quickActionsList, desiredActions); + }); +} diff --git a/test/exceptions/graphql_exception_resolver_test.dart b/test/exceptions/graphql_exception_resolver_test.dart new file mode 100644 index 000000000..56bfdda3a --- /dev/null +++ b/test/exceptions/graphql_exception_resolver_test.dart @@ -0,0 +1,213 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/exceptions/critical_action_exception.dart'; +import 'package:talawa/exceptions/graphql_exception_resolver.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../helpers/test_helpers.dart'; + +Widget buildBaseScreen({required Function() onClick}) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + onPressed: () { + print('hhhhhhhhhhhhhhhhh'); + onClick.call(); + }, + child: const Text('click me'), + ), + ), + navigatorKey: navigationService.navigatorKey, + ); + }, + ); +} + +void main() async { + TestWidgetsFlutterBinding.ensureInitialized(); + setUpAll(() { + setupLocator(); + sizeConfig.test(); + graphqlConfig.test(); + getAndRegisterDatabaseMutationFunctions(); + }); + + group('Test GraphQl Exception resolver', () { + testWidgets('test critical action exception', (tester) async { + final CriticalActionException criticalActionException = + CriticalActionException('Test Error'); + late final bool? result; + await tester.pumpWidget( + buildBaseScreen( + onClick: () async { + result = GraphqlExceptionResolver.encounteredExceptionOrError( + criticalActionException, + showSnackBar: true, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('click me')); + await tester.pumpAndSettle(); + expect(result, false); + }); + testWidgets('userNotFound', (tester) async { + final OperationException operationException = OperationException(); + operationException.graphqlErrors + .add(GraphqlExceptionResolver.userNotFound); + late final bool? result; + await tester.pumpWidget( + buildBaseScreen( + onClick: () async { + result = GraphqlExceptionResolver.encounteredExceptionOrError( + operationException, + showSnackBar: true, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('click me')); + await tester.pumpAndSettle(); + expect(result, false); + }); + + testWidgets('refreshAccessTokenExpiredException', (tester) async { + const refreshToken = 'refreshToken'; + userConfig.currentUser = User(refreshToken: refreshToken); + when( + databaseFunctions.refreshAccessToken(refreshToken), + ).thenAnswer((_) async => true); + + final OperationException operationException = OperationException(); + operationException.graphqlErrors + .add(GraphqlExceptionResolver.refreshAccessTokenExpiredException); + late final bool? result; + await tester.pumpWidget( + buildBaseScreen( + onClick: () async { + result = GraphqlExceptionResolver.encounteredExceptionOrError( + operationException, + showSnackBar: true, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('click me')); + await tester.pumpAndSettle(); + expect(result, true); + }); + + testWidgets('memberRequestExist', (tester) async { + final OperationException operationException = OperationException(); + + operationException.graphqlErrors + .add(GraphqlExceptionResolver.memberRequestExist); + + late final bool? result; + await tester.pumpWidget( + buildBaseScreen( + onClick: () async { + result = GraphqlExceptionResolver.encounteredExceptionOrError( + operationException, + showSnackBar: true, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('click me')); + await tester.pumpAndSettle(); + expect(result, false); + }); + + testWidgets('wrongCredentials', (tester) async { + final OperationException operationException = OperationException(); + + operationException.graphqlErrors + .add(GraphqlExceptionResolver.wrongCredentials); + + late final bool? result; + await tester.pumpWidget( + buildBaseScreen( + onClick: () async { + result = GraphqlExceptionResolver.encounteredExceptionOrError( + operationException, + showSnackBar: true, + ); + }, + ), + ); + + print(GraphqlExceptionResolver.notifFeatureNotInstalled); + await tester.pumpAndSettle(); + await tester.tap(find.text('click me')); + await tester.pumpAndSettle(); + expect(result, false); + }); + + testWidgets('organizationNotFound', (tester) async { + final OperationException operationException = OperationException(); + + operationException.graphqlErrors + .add(GraphqlExceptionResolver.organizationNotFound); + + late final bool? result; + await tester.pumpWidget( + buildBaseScreen( + onClick: () async { + result = GraphqlExceptionResolver.encounteredExceptionOrError( + operationException, + showSnackBar: true, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('click me')); + await tester.pumpAndSettle(); + expect(result, false); + }); + + testWidgets('emailAccountPresent', (tester) async { + final OperationException operationException = OperationException(); + + operationException.graphqlErrors + .add(GraphqlExceptionResolver.emailAccountPresent); + + late final bool? result; + await tester.pumpWidget( + buildBaseScreen( + onClick: () async { + result = GraphqlExceptionResolver.encounteredExceptionOrError( + operationException, + showSnackBar: true, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('click me')); + await tester.pumpAndSettle(); + expect(result, false); + }); + }); +} diff --git a/docs/README.md b/test/fixtures/core3/offline_action_queue.hive similarity index 100% rename from docs/README.md rename to test/fixtures/core3/offline_action_queue.hive diff --git a/test/fixtures/core3/offline_action_queue.lock b/test/fixtures/core3/offline_action_queue.lock new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/core4/currentorg.hive b/test/fixtures/core4/currentorg.hive new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/core4/currentorg.lock b/test/fixtures/core4/currentorg.lock new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/core4/currentuser.hive b/test/fixtures/core4/currentuser.hive new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/core4/currentuser.lock b/test/fixtures/core4/currentuser.lock new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/core4/offline_action_queue.hive b/test/fixtures/core4/offline_action_queue.hive new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/core4/offline_action_queue.lock b/test/fixtures/core4/offline_action_queue.lock new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/coree/offline_action_queue.hive b/test/fixtures/coree/offline_action_queue.hive new file mode 100644 index 000000000..e69de29bb diff --git a/test/flutter_test_config.dart b/test/flutter_test_config.dart new file mode 100644 index 000000000..ddaa52a01 --- /dev/null +++ b/test/flutter_test_config.dart @@ -0,0 +1,16 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/hive_manager.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +Future testExecutable(FutureOr Function() testMain) async { + WidgetController.hitTestWarningShouldBeFatal = true; + final Directory dir = await Directory.systemTemp.createTemp('talawa_test'); + // Hive.init(dir.path); + await HiveManager.initializeHive(dir: dir); + AppConnectivity.isOnline = true; + // await setUpHive(); + await testMain(); +} diff --git a/test/helper.dart b/test/helper.dart deleted file mode 100644 index 2ab4bdf19..000000000 --- a/test/helper.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:flutter/material.dart'; - -// Function for ignoring overflow errors. -// ignore: prefer_function_declarations_over_variables -void Function(FlutterErrorDetails) onErrorIgnoreOverflowErrors = ( - FlutterErrorDetails details, { - bool forceReport = false, -}) { - assert(details != null); - assert(details.exception != null); - - bool ifIsOverflowError = false; - - // Detect overflow error. - final exception = details.exception; - if (exception is FlutterError) { - ifIsOverflowError = !exception.diagnostics.any( - (e) => e.value.toString().startsWith( - "A RenderFlex overflowed by", - ), - ); - } - - // Ignore if is overflow error. - if (ifIsOverflowError) { - print("Over flow error"); - } - - // Throw other errors. - else { - FlutterError.dumpErrorToConsole( - details, - forceReport: forceReport, - ); - } -}; diff --git a/test/helpers/setup_firebase_mocks.dart b/test/helpers/setup_firebase_mocks.dart new file mode 100644 index 000000000..227194228 --- /dev/null +++ b/test/helpers/setup_firebase_mocks.dart @@ -0,0 +1,208 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +// ignore_for_file: return_of_invalid_type + +// import 'package:firebase_core/firebase_core.dart'; +// import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'; +// import 'package:flutter/services.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockito/mockito.dart'; +// import 'package:plugin_platform_interface/plugin_platform_interface.dart'; + +// final kMockMessagingPlatform = MockFirebaseMessaging(); + +// Future neverEndingFuture() async { +// // ignore: literal_only_boolean_expressions +// while (true) { +// await Future.delayed(const Duration(minutes: 5)); +// } +// } + +// void setupFirebaseMocks() { +// TestWidgetsFlutterBinding.ensureInitialized(); + +// const firebaseChannel = MethodChannel( +// 'plugins.flutter.io/firebase_core', +// ); + +// // ignore: deprecated_member_use +// firebaseChannel.setMockMethodCallHandler((call) async { +// if (call.method == 'Firebase#initializeCore') { +// return [ +// { +// 'name': defaultFirebaseAppName, +// 'options': { +// 'apiKey': '123', +// 'appId': '123', +// 'messagingSenderId': '123', +// 'projectId': '123', +// }, +// 'pluginConstants': {}, +// } +// ]; +// } + +// if (call.method == 'Firebase#initializeApp') { +// final callArguments = call.arguments as Map; +// return { +// 'name': callArguments['appName'], +// 'options': callArguments['options'], +// 'pluginConstants': {}, +// }; +// } + +// return null; +// }); + +// when(kMockMessagingPlatform.delegateFor(app: anyNamed('app'))) +// .thenReturn(kMockMessagingPlatform); +// when( +// kMockMessagingPlatform.setInitialValues( +// isAutoInitEnabled: anyNamed('isAutoInitEnabled'), +// ), +// ).thenReturn(kMockMessagingPlatform); +// } + +// class MockFirebaseMessaging extends Mock +// with MockPlatformInterfaceMixin +// implements FirebaseMessagingPlatform { +// MockFirebaseMessaging() { +// TestFirebaseMessagingPlatform(); +// } + +// @override +// bool get isAutoInitEnabled { +// return super.noSuchMethod( +// Invocation.getter(#isAutoInitEnabled), +// returnValue: true, +// returnValueForMissingStub: true, +// ); +// } + +// @override +// FirebaseMessagingPlatform delegateFor({FirebaseApp? app}) { +// return super.noSuchMethod( +// Invocation.method(#delegateFor, [], {#app: app}), +// returnValue: TestFirebaseMessagingPlatform(), +// returnValueForMissingStub: TestFirebaseMessagingPlatform(), +// ); +// } + +// @override +// FirebaseMessagingPlatform setInitialValues({bool? isAutoInitEnabled}) { +// return super.noSuchMethod( +// Invocation.method( +// #setInitialValues, +// [], +// {#isAutoInitEnabled: isAutoInitEnabled}, +// ), +// returnValue: TestFirebaseMessagingPlatform(), +// returnValueForMissingStub: TestFirebaseMessagingPlatform(), +// ); +// } + +// @override +// Future getInitialMessage() { +// return super.noSuchMethod( +// Invocation.method(#getInitialMessage, []), +// returnValue: neverEndingFuture(), +// returnValueForMissingStub: neverEndingFuture(), +// ); +// } + +// @override +// Future deleteToken() { +// return super.noSuchMethod( +// Invocation.method(#deleteToken, []), +// returnValue: Future.value(), +// returnValueForMissingStub: Future.value(), +// ); +// } + +// @override +// Future getAPNSToken() { +// return super.noSuchMethod( +// Invocation.method(#getAPNSToken, []), +// returnValue: Future.value(''), +// returnValueForMissingStub: Future.value(''), +// ); +// } + +// @override +// Future getToken({String? vapidKey}) { +// return super.noSuchMethod( +// Invocation.method(#getToken, [], {#vapidKey: vapidKey}), +// returnValue: Future.value(''), +// returnValueForMissingStub: Future.value(''), +// ); +// } + +// @override +// Future setAutoInitEnabled(bool? enabled) { +// return super.noSuchMethod( +// Invocation.method(#setAutoInitEnabled, [enabled]), +// returnValue: Future.value(), +// returnValueForMissingStub: Future.value(), +// ); +// } + +// @override +// Stream get onTokenRefresh { +// return super.noSuchMethod( +// Invocation.getter(#onTokenRefresh), +// returnValue: const Stream.empty(), +// returnValueForMissingStub: const Stream.empty(), +// ); +// } + +// Comment out the notification logic for the MVP +// TODO: Re-enable notifications when needed for the final release. + +// @override +// Future requestPermission({ +// bool? alert = true, +// bool? announcement = false, +// bool? badge = true, +// bool? carPlay = false, +// bool? criticalAlert = false, +// bool? provisional = false, +// bool? sound = true, +// }) { +// return super.noSuchMethod( +// Invocation.method(#requestPermission, [], { +// #alert: alert, +// #announcement: announcement, +// #badge: badge, +// #carPlay: carPlay, +// #criticalAlert: criticalAlert, +// #provisional: provisional, +// #sound: sound, +// }), +// returnValue: neverEndingFuture(), +// returnValueForMissingStub: neverEndingFuture(), +// ); +// } + +// @override +// Future subscribeToTopic(String? topic) { +// return super.noSuchMethod( +// Invocation.method(#subscribeToTopic, [topic]), +// returnValue: Future.value(), +// returnValueForMissingStub: Future.value(), +// ); +// } + +// @override +// Future unsubscribeFromTopic(String? topic) { +// return super.noSuchMethod( +// Invocation.method(#unsubscribeFromTopic, [topic]), +// returnValue: Future.value(), +// returnValueForMissingStub: Future.value(), +// ); +// } +// } + +// class TestFirebaseMessagingPlatform extends FirebaseMessagingPlatform { +// TestFirebaseMessagingPlatform() : super(); +// } diff --git a/test/helpers/setup_hive.dart b/test/helpers/setup_hive.dart new file mode 100644 index 000000000..55cc63be5 --- /dev/null +++ b/test/helpers/setup_hive.dart @@ -0,0 +1,44 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:hive/hive.dart'; +import 'package:mockito/annotations.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; + +@GenerateMocks( + [ + HiveInterface, + Box, + ], + customMocks: [ + MockSpec( + as: Symbol('MockHiveBox'), + onMissingStub: OnMissingStub.returnDefault, + ), + ], +) +Future setUpUserInfoHive() async { + Hive + ..init("./temporaryPath") + ..registerAdapter(UserAdapter()) + ..registerAdapter(OrgInfoAdapter()); + + final userBox = await Hive.openBox('userInfo'); + return userBox; +} + +Future setUpURLHive() async { + Hive.init('test/fixtures/core'); + final urlBox = await Hive.openBox('url'); + return urlBox; +} + +Future setUpCurrentUserHive() async { + Hive + ..init('test/fixtures/core') + ..registerAdapter(UserAdapter()) + ..registerAdapter(OrgInfoAdapter()); + final user = await Hive.openBox('currentUser'); + return user; +} diff --git a/test/helpers/setup_hive.mocks.dart b/test/helpers/setup_hive.mocks.dart new file mode 100644 index 000000000..8b4dfda4a --- /dev/null +++ b/test/helpers/setup_hive.mocks.dart @@ -0,0 +1,837 @@ +// Mocks generated by Mockito 5.4.4 from annotations +// in talawa/test/helpers/setup_hive.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i3; +import 'dart:typed_data' as _i6; + +import 'package:hive/hive.dart' as _i2; +import 'package:hive/src/box/default_compaction_strategy.dart' as _i5; +import 'package:hive/src/box/default_key_comparator.dart' as _i4; +import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i7; + +// 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 _FakeBox_0 extends _i1.SmartFake implements _i2.Box { + _FakeBox_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeLazyBox_1 extends _i1.SmartFake implements _i2.LazyBox { + _FakeLazyBox_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [HiveInterface]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockHiveInterface extends _i1.Mock implements _i2.HiveInterface { + MockHiveInterface() { + _i1.throwOnMissingStub(this); + } + + @override + void init( + String? path, { + _i2.HiveStorageBackendPreference? backendPreference = + _i2.HiveStorageBackendPreference.native, + }) => + super.noSuchMethod( + Invocation.method( + #init, + [path], + {#backendPreference: backendPreference}, + ), + returnValueForMissingStub: null, + ); + + @override + _i3.Future<_i2.Box> openBox( + String? name, { + _i2.HiveCipher? encryptionCipher, + _i2.KeyComparator? keyComparator = _i4.defaultKeyComparator, + _i2.CompactionStrategy? compactionStrategy = _i5.defaultCompactionStrategy, + bool? crashRecovery = true, + String? path, + _i6.Uint8List? bytes, + String? collection, + List? encryptionKey, + }) => + (super.noSuchMethod( + Invocation.method( + #openBox, + [name], + { + #encryptionCipher: encryptionCipher, + #keyComparator: keyComparator, + #compactionStrategy: compactionStrategy, + #crashRecovery: crashRecovery, + #path: path, + #bytes: bytes, + #collection: collection, + #encryptionKey: encryptionKey, + }, + ), + returnValue: _i3.Future<_i2.Box>.value(_FakeBox_0( + this, + Invocation.method( + #openBox, + [name], + { + #encryptionCipher: encryptionCipher, + #keyComparator: keyComparator, + #compactionStrategy: compactionStrategy, + #crashRecovery: crashRecovery, + #path: path, + #bytes: bytes, + #collection: collection, + #encryptionKey: encryptionKey, + }, + ), + )), + ) as _i3.Future<_i2.Box>); + + @override + _i3.Future<_i2.LazyBox> openLazyBox( + String? name, { + _i2.HiveCipher? encryptionCipher, + _i2.KeyComparator? keyComparator = _i4.defaultKeyComparator, + _i2.CompactionStrategy? compactionStrategy = _i5.defaultCompactionStrategy, + bool? crashRecovery = true, + String? path, + String? collection, + List? encryptionKey, + }) => + (super.noSuchMethod( + Invocation.method( + #openLazyBox, + [name], + { + #encryptionCipher: encryptionCipher, + #keyComparator: keyComparator, + #compactionStrategy: compactionStrategy, + #crashRecovery: crashRecovery, + #path: path, + #collection: collection, + #encryptionKey: encryptionKey, + }, + ), + returnValue: _i3.Future<_i2.LazyBox>.value(_FakeLazyBox_1( + this, + Invocation.method( + #openLazyBox, + [name], + { + #encryptionCipher: encryptionCipher, + #keyComparator: keyComparator, + #compactionStrategy: compactionStrategy, + #crashRecovery: crashRecovery, + #path: path, + #collection: collection, + #encryptionKey: encryptionKey, + }, + ), + )), + ) as _i3.Future<_i2.LazyBox>); + + @override + _i2.Box box(String? name) => (super.noSuchMethod( + Invocation.method( + #box, + [name], + ), + returnValue: _FakeBox_0( + this, + Invocation.method( + #box, + [name], + ), + ), + ) as _i2.Box); + + @override + _i2.LazyBox lazyBox(String? name) => (super.noSuchMethod( + Invocation.method( + #lazyBox, + [name], + ), + returnValue: _FakeLazyBox_1( + this, + Invocation.method( + #lazyBox, + [name], + ), + ), + ) as _i2.LazyBox); + + @override + bool isBoxOpen(String? name) => (super.noSuchMethod( + Invocation.method( + #isBoxOpen, + [name], + ), + returnValue: false, + ) as bool); + + @override + _i3.Future close() => (super.noSuchMethod( + Invocation.method( + #close, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future deleteBoxFromDisk( + String? name, { + String? path, + }) => + (super.noSuchMethod( + Invocation.method( + #deleteBoxFromDisk, + [name], + {#path: path}, + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future deleteFromDisk() => (super.noSuchMethod( + Invocation.method( + #deleteFromDisk, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + List generateSecureKey() => (super.noSuchMethod( + Invocation.method( + #generateSecureKey, + [], + ), + returnValue: [], + ) as List); + + @override + _i3.Future boxExists( + String? name, { + String? path, + }) => + (super.noSuchMethod( + Invocation.method( + #boxExists, + [name], + {#path: path}, + ), + returnValue: _i3.Future.value(false), + ) as _i3.Future); + + @override + void resetAdapters() => super.noSuchMethod( + Invocation.method( + #resetAdapters, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void registerAdapter( + _i2.TypeAdapter? adapter, { + bool? internal = false, + bool? override = false, + }) => + super.noSuchMethod( + Invocation.method( + #registerAdapter, + [adapter], + { + #internal: internal, + #override: override, + }, + ), + returnValueForMissingStub: null, + ); + + @override + bool isAdapterRegistered(int? typeId) => (super.noSuchMethod( + Invocation.method( + #isAdapterRegistered, + [typeId], + ), + returnValue: false, + ) as bool); + + @override + void ignoreTypeId(int? typeId) => super.noSuchMethod( + Invocation.method( + #ignoreTypeId, + [typeId], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [Box]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockBox extends _i1.Mock implements _i2.Box { + MockBox() { + _i1.throwOnMissingStub(this); + } + + @override + Iterable get values => (super.noSuchMethod( + Invocation.getter(#values), + returnValue: [], + ) as Iterable); + + @override + String get name => (super.noSuchMethod( + Invocation.getter(#name), + returnValue: _i7.dummyValue( + this, + Invocation.getter(#name), + ), + ) as String); + + @override + bool get isOpen => (super.noSuchMethod( + Invocation.getter(#isOpen), + returnValue: false, + ) as bool); + + @override + bool get lazy => (super.noSuchMethod( + Invocation.getter(#lazy), + returnValue: false, + ) as bool); + + @override + Iterable get keys => (super.noSuchMethod( + Invocation.getter(#keys), + returnValue: [], + ) as Iterable); + + @override + int get length => (super.noSuchMethod( + Invocation.getter(#length), + returnValue: 0, + ) as int); + + @override + bool get isEmpty => (super.noSuchMethod( + Invocation.getter(#isEmpty), + returnValue: false, + ) as bool); + + @override + bool get isNotEmpty => (super.noSuchMethod( + Invocation.getter(#isNotEmpty), + returnValue: false, + ) as bool); + + @override + Iterable valuesBetween({ + dynamic startKey, + dynamic endKey, + }) => + (super.noSuchMethod( + Invocation.method( + #valuesBetween, + [], + { + #startKey: startKey, + #endKey: endKey, + }, + ), + returnValue: [], + ) as Iterable); + + @override + E? getAt(int? index) => (super.noSuchMethod(Invocation.method( + #getAt, + [index], + )) as E?); + + @override + Map toMap() => (super.noSuchMethod( + Invocation.method( + #toMap, + [], + ), + returnValue: {}, + ) as Map); + + @override + dynamic keyAt(int? index) => super.noSuchMethod(Invocation.method( + #keyAt, + [index], + )); + + @override + _i3.Stream<_i2.BoxEvent> watch({dynamic key}) => (super.noSuchMethod( + Invocation.method( + #watch, + [], + {#key: key}, + ), + returnValue: _i3.Stream<_i2.BoxEvent>.empty(), + ) as _i3.Stream<_i2.BoxEvent>); + + @override + bool containsKey(dynamic key) => (super.noSuchMethod( + Invocation.method( + #containsKey, + [key], + ), + returnValue: false, + ) as bool); + + @override + _i3.Future put( + dynamic key, + E? value, + ) => + (super.noSuchMethod( + Invocation.method( + #put, + [ + key, + value, + ], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future putAt( + int? index, + E? value, + ) => + (super.noSuchMethod( + Invocation.method( + #putAt, + [ + index, + value, + ], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future putAll(Map? entries) => (super.noSuchMethod( + Invocation.method( + #putAll, + [entries], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future add(E? value) => (super.noSuchMethod( + Invocation.method( + #add, + [value], + ), + returnValue: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i3.Future> addAll(Iterable? values) => (super.noSuchMethod( + Invocation.method( + #addAll, + [values], + ), + returnValue: _i3.Future>.value([]), + ) as _i3.Future>); + + @override + _i3.Future delete(dynamic key) => (super.noSuchMethod( + Invocation.method( + #delete, + [key], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future deleteAt(int? index) => (super.noSuchMethod( + Invocation.method( + #deleteAt, + [index], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future deleteAll(Iterable? keys) => (super.noSuchMethod( + Invocation.method( + #deleteAll, + [keys], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future compact() => (super.noSuchMethod( + Invocation.method( + #compact, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future clear() => (super.noSuchMethod( + Invocation.method( + #clear, + [], + ), + returnValue: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i3.Future close() => (super.noSuchMethod( + Invocation.method( + #close, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future deleteFromDisk() => (super.noSuchMethod( + Invocation.method( + #deleteFromDisk, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future flush() => (super.noSuchMethod( + Invocation.method( + #flush, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); +} + +/// A class which mocks [Box]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockHiveBox extends _i1.Mock implements _i2.Box { + @override + Iterable get values => (super.noSuchMethod( + Invocation.getter(#values), + returnValue: [], + returnValueForMissingStub: [], + ) as Iterable); + + @override + String get name => (super.noSuchMethod( + Invocation.getter(#name), + returnValue: _i7.dummyValue( + this, + Invocation.getter(#name), + ), + returnValueForMissingStub: _i7.dummyValue( + this, + Invocation.getter(#name), + ), + ) as String); + + @override + bool get isOpen => (super.noSuchMethod( + Invocation.getter(#isOpen), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get lazy => (super.noSuchMethod( + Invocation.getter(#lazy), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + Iterable get keys => (super.noSuchMethod( + Invocation.getter(#keys), + returnValue: [], + returnValueForMissingStub: [], + ) as Iterable); + + @override + int get length => (super.noSuchMethod( + Invocation.getter(#length), + returnValue: 0, + returnValueForMissingStub: 0, + ) as int); + + @override + bool get isEmpty => (super.noSuchMethod( + Invocation.getter(#isEmpty), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get isNotEmpty => (super.noSuchMethod( + Invocation.getter(#isNotEmpty), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + Iterable valuesBetween({ + dynamic startKey, + dynamic endKey, + }) => + (super.noSuchMethod( + Invocation.method( + #valuesBetween, + [], + { + #startKey: startKey, + #endKey: endKey, + }, + ), + returnValue: [], + returnValueForMissingStub: [], + ) as Iterable); + + @override + E? getAt(int? index) => (super.noSuchMethod( + Invocation.method( + #getAt, + [index], + ), + returnValueForMissingStub: null, + ) as E?); + + @override + Map toMap() => (super.noSuchMethod( + Invocation.method( + #toMap, + [], + ), + returnValue: {}, + returnValueForMissingStub: {}, + ) as Map); + + @override + dynamic keyAt(int? index) => super.noSuchMethod( + Invocation.method( + #keyAt, + [index], + ), + returnValueForMissingStub: null, + ); + + @override + _i3.Stream<_i2.BoxEvent> watch({dynamic key}) => (super.noSuchMethod( + Invocation.method( + #watch, + [], + {#key: key}, + ), + returnValue: _i3.Stream<_i2.BoxEvent>.empty(), + returnValueForMissingStub: _i3.Stream<_i2.BoxEvent>.empty(), + ) as _i3.Stream<_i2.BoxEvent>); + + @override + bool containsKey(dynamic key) => (super.noSuchMethod( + Invocation.method( + #containsKey, + [key], + ), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + _i3.Future put( + dynamic key, + E? value, + ) => + (super.noSuchMethod( + Invocation.method( + #put, + [ + key, + value, + ], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future putAt( + int? index, + E? value, + ) => + (super.noSuchMethod( + Invocation.method( + #putAt, + [ + index, + value, + ], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future putAll(Map? entries) => (super.noSuchMethod( + Invocation.method( + #putAll, + [entries], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future add(E? value) => (super.noSuchMethod( + Invocation.method( + #add, + [value], + ), + returnValue: _i3.Future.value(0), + returnValueForMissingStub: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i3.Future> addAll(Iterable? values) => (super.noSuchMethod( + Invocation.method( + #addAll, + [values], + ), + returnValue: _i3.Future>.value([]), + returnValueForMissingStub: _i3.Future>.value([]), + ) as _i3.Future>); + + @override + _i3.Future delete(dynamic key) => (super.noSuchMethod( + Invocation.method( + #delete, + [key], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future deleteAt(int? index) => (super.noSuchMethod( + Invocation.method( + #deleteAt, + [index], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future deleteAll(Iterable? keys) => (super.noSuchMethod( + Invocation.method( + #deleteAll, + [keys], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future compact() => (super.noSuchMethod( + Invocation.method( + #compact, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future clear() => (super.noSuchMethod( + Invocation.method( + #clear, + [], + ), + returnValue: _i3.Future.value(0), + returnValueForMissingStub: _i3.Future.value(0), + ) as _i3.Future); + + @override + _i3.Future close() => (super.noSuchMethod( + Invocation.method( + #close, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future deleteFromDisk() => (super.noSuchMethod( + Invocation.method( + #deleteFromDisk, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future flush() => (super.noSuchMethod( + Invocation.method( + #flush, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); +} diff --git a/test/helpers/talawa_plugin_provider_test.dart b/test/helpers/talawa_plugin_provider_test.dart new file mode 100644 index 000000000..38c3c524f --- /dev/null +++ b/test/helpers/talawa_plugin_provider_test.dart @@ -0,0 +1,18 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/cupertino.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/plugins/talawa_plugin_provider.dart'; + +void main() { + test('TalwaPluginProvider Test', () async { + const talwaPluginProvider = TalawaPluginProvider( + pluginName: "sample", + visible: false, + child: Text("hi"), + ); + expect(talwaPluginProvider.visible, false); + expect(talwaPluginProvider.pluginName, "sample"); + }); +} diff --git a/test/helpers/test_helpers.dart b/test/helpers/test_helpers.dart new file mode 100644 index 000000000..f8e453385 --- /dev/null +++ b/test/helpers/test_helpers.dart @@ -0,0 +1,967 @@ +import 'dart:async'; +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:image_cropper/image_cropper.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/chats/chat_list_tile_data_model.dart'; +import 'package:talawa/models/chats/chat_message.dart'; +import 'package:talawa/models/chats/chat_user.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/chat_service.dart'; +import 'package:talawa/services/comment_service.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/image_service.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/org_service.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/session_manager.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/third_party_service/connectivity_service.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/utils/validators.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/chat_view_models/select_contact_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/signup_details_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/waiting_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/progress_dialog_view_model.dart'; + +import '../service_tests/image_service_test.dart'; +import '../service_tests/third_party_service_test.dart/connectivity_service_test.dart'; +import '../service_tests/user_config_test.dart'; +import '../views/main_screen_test.dart'; +import 'test_helpers.mocks.dart'; + +@GenerateMocks( + [], + customMocks: [ + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec( + onMissingStub: OnMissingStub.returnDefault, + ), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec( + onMissingStub: OnMissingStub.returnDefault, + ), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec( + onMissingStub: OnMissingStub.returnDefault, + ), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec( + onMissingStub: OnMissingStub.returnDefault, + ), + MockSpec( + onMissingStub: OnMissingStub.returnDefault, + ), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + ], +) + +/// member1 represents a member of the organization. +final User member1 = User(id: "testMem1"); + +/// member2 represents a member of the organization. +final User member2 = User(id: "testMem2"); + +/// admin1 represents an admin of the organization. +final User admin1 = User(id: "testAdmin1"); + +/// admin2 represents an admin of the organization. +final User admin2 = User(id: "testAdmin2"); + +/// members represents a list of members of the organization. +final List members = [member1, member2]; + +/// admins represents a list of admins of the organization. +final List admins = [admin1, admin2]; + +/// fakeOrgInfo represents a mock organization. +final fakeOrgInfo = OrgInfo( + id: "XYZ", + name: "Organization Name", + members: members, + admins: admins, + creatorInfo: User( + firstName: "ravidi", + lastName: "shaikh", + ), + userRegistrationRequired: true, +); + +/// `removeRegistrationIfExists` removes the registration of a service if it is already registered. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void _removeRegistrationIfExists() { + if (locator.isRegistered()) { + locator.unregister(); + } +} + +/// `getAndRegisterNavigationService` returns a mock instance of the `NavigationService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `NavigationService`: A mock instance of the `NavigationService` class. +NavigationService getAndRegisterNavigationService() { + _removeRegistrationIfExists(); + final service = MockNavigationService(); + when(service.navigatorKey).thenReturn(GlobalKey()); + when(service.removeAllAndPush(any, any, arguments: anyNamed('arguments'))) + .thenAnswer((_) async {}); + when(service.pushScreen(any, arguments: anyNamed('arguments'))) + .thenAnswer((_) async {}); + when(service.popAndPushScreen(any, arguments: '-1')).thenAnswer((_) async {}); + when(service.pushDialog(any)).thenAnswer((_) async {}); + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterOrganizationService` returns a mock instance of the `OrganizationService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `OrganizationService`: A mock instance of the `OrganizationService` class. +OrganizationService getAndRegisterOrganizationService() { + _removeRegistrationIfExists(); + final service = MockOrganizationService(); + locator.registerSingleton(service); + + final User user1 = User( + id: "fakeUser1", + firstName: 'ayush', + lastName: 'chaudhary', + image: 'www.image.com', + ); + final User user2 = User( + id: "fakeUser2", + firstName: 'ayush', + lastName: 'chaudhary', + image: 'www.image.com', + ); + final List users = [user1, user2]; + when(service.getOrgMembersList('XYZ')).thenAnswer((realInvocation) async { + return users; + }); + return service; +} + +/// `getAndRegisterAppTheme` returns a mock instance of the `AppTheme` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `AppTheme`: A mock instance of the `AppTheme` class. +AppTheme getAndRegisterAppTheme() { + _removeRegistrationIfExists(); + final service = MockAppTheme(); + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterCommentService` returns a mock instance of the `CommentService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `CommentService`: A mock instance of the `CommentService` class. +CommentService getAndRegisterCommentService() { + _removeRegistrationIfExists(); + final service = MockCommentService(); + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterSessionManager` returns a mock instance of the `SessionManager` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `SessionManager`: A mock instance of the `SessionManager` class. +SessionManager getAndRegisterSessionManager() { + _removeRegistrationIfExists(); + final service = MockSessionManger(); + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterChatService` returns a mock instance of the `ChatService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `ChatService`: A mock instance of the `ChatService` class. +ChatService getAndRegisterChatService() { + _removeRegistrationIfExists(); + final service = MockChatService(); + final StreamController streamController = + StreamController(); + final Stream stream = + streamController.stream.asBroadcastStream(); + + final StreamController chatMessageController = + StreamController(); + final Stream messagestream = + chatMessageController.stream.asBroadcastStream(); + + when(service.chatListStream).thenAnswer((invocation) => stream); + when(service.chatMessagesStream).thenAnswer((invocation) => messagestream); + when(service.getDirectChatsByUserId()).thenAnswer( + (invocation) async => streamController.add( + ChatListTileDataModel( + [ + ChatUser( + firstName: 'test', + id: '1', + image: 'fakeHttp', + ), + ], + '1', + ), + ), + ); + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterAppLanguage` returns a mock instance of the `AppLanguage` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `AppLanguage`: A mock instance of the `AppLanguage` class. +AppLanguage getAndRegisterAppLanguage() { + _removeRegistrationIfExists(); + final service = MockAppLanguage(); + + when(service.appLocal).thenReturn(const Locale('en')); + + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterGraphqlConfig` returns a mock instance of the `GraphqlConfig` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `GraphqlConfig`: A mock instance of the `GraphqlConfig` class. +GraphqlConfig getAndRegisterGraphqlConfig() { + _removeRegistrationIfExists(); + final service = MockGraphqlConfig(); + + when(service.httpLink).thenReturn( + HttpLink( + 'https://talawa-graphql-api.herokuapp.com/graphql', + httpClient: MockHttpClient(), + ), + ); + + when(service.clientToQuery()).thenAnswer((realInvocation) { + // return GraphQLClient( + // cache: GraphQLCache(partialDataPolicy: PartialDataCachePolicy.accept), + // link: service.httpLink, + // ); + + return locator(); + }); + + when(service.authClient()).thenAnswer((realInvocation) { + // final AuthLink authLink = + // AuthLink(getToken: () async => 'Bearer ${GraphqlConfig.token}'); + // final Link finalAuthLink = authLink.concat(service.httpLink); + // return GraphQLClient( + // cache: GraphQLCache(partialDataPolicy: PartialDataCachePolicy.accept), + // link: finalAuthLink, + // ); + return locator(); + }); + + when(service.getToken()).thenAnswer((_) async => "sample_token"); + + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterGraphQLClient` returns a mock instance of the `GraphQLClient` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `GraphQLClient`: A mock instance of the `GraphQLClient` class. +GraphQLClient getAndRegisterGraphQLClient() { + _removeRegistrationIfExists(); + + final service = MockGraphQLClient(); + + // Either fill this with mock data or override this stub + // and return null + + when(service.query(any)).thenAnswer( + (realInvocation) async { + if (locator.isRegistered()) { + return Future.value( + QueryResult>( + source: QueryResultSource.network, + data: { + "getPlugins": null, + }, + options: QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ); + } else { + return Future.value( + QueryResult>( + source: QueryResultSource.network, + data: null, + options: QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ); + } + }, + ); + + when(service.defaultPolicies).thenAnswer( + (realInvocation) => DefaultPolicies(), + ); + when(service.queryManager).thenAnswer( + (realInvocation) => QueryManager( + link: HttpLink("testurl"), + cache: GraphQLCache(), + ), + ); + + locator.registerSingleton(service); + + return service; +} + +/// `getAndRegisterDatabaseMutationFunctions` returns a mock instance of the `DataBaseMutationFunctions` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `DataBaseMutationFunctions`: A mock instance of the `DataBaseMutationFunctions` class. +DataBaseMutationFunctions getAndRegisterDatabaseMutationFunctions() { + _removeRegistrationIfExists(); + final service = MockDataBaseMutationFunctions(); + when(service.refreshAccessToken('testtoken')).thenAnswer((_) async { + return true; + }); + when(service.fetchOrgById('fake_id')).thenAnswer((_) async { + return fakeOrgInfo; + }); + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterUserConfig` returns a mock instance of the `UserConfig` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `UserConfig`: A mock instance of the `UserConfig` class. +UserConfig getAndRegisterUserConfig() { + _removeRegistrationIfExists(); + final service = MockUserConfig(); + + when(service.userLoggedIn()).thenAnswer( + (realInvocation) => Future.value(false), + ); + + when(service.currentUser).thenReturn( + User( + id: 'id', + firstName: 'john', + lastName: 'snow', + ), + ); + + //Mock Data for current organizaiton. + when(service.currentOrg).thenReturn( + OrgInfo( + id: "XYZ", + name: "Organization Name", + members: members, + admins: admins, + ), + ); + + //Mock Stream for currentOrgStream + final StreamController streamController = StreamController(); + final Stream stream = streamController.stream.asBroadcastStream(); + when(service.currentOrgInfoController) + .thenAnswer((invocation) => streamController); + when(service.currentOrgInfoStream).thenAnswer((invocation) => stream); + + //Mkock current user + when(service.currentUser).thenReturn( + User( + id: "xzy1", + firstName: "Test", + lastName: "User", + email: "testuser@gmail.com", + refreshToken: "testtoken", + authToken: 'testtoken', + adminFor: [], + joinedOrganizations: [ + OrgInfo( + id: '3', + name: 'test org 3', + userRegistrationRequired: false, + creatorInfo: User(firstName: 'test', lastName: '1'), + ), + OrgInfo( + id: '4', + name: 'test org 4', + userRegistrationRequired: true, + creatorInfo: User(firstName: 'test', lastName: '2'), + ), + OrgInfo( + id: "XYZ", + name: "Organization Name", + ), + ], + membershipRequests: [ + OrgInfo( + id: '1', + name: 'test org', + userRegistrationRequired: true, + creatorInfo: User(firstName: 'test', lastName: 'test'), + ), + OrgInfo( + id: '2', + name: 'test org', + userRegistrationRequired: true, + creatorInfo: User(firstName: 'test', lastName: 'test'), + ), + ], + ), + ); + + locator.registerSingleton(service); + + return service; +} + +/// `getAndRegisterPostService` returns a mock instance of the `PostService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `PostService`: A mock instance of the `PostService` class. +PostService getAndRegisterPostService() { + _removeRegistrationIfExists(); + final service = MockPostService(); + + //Mock Stream for currentOrgStream + final StreamController> streamController = StreamController(); + final Stream> stream = streamController.stream.asBroadcastStream(); + // _streamController.add(posts); + when(service.postStream).thenAnswer((invocation) => stream); + + final StreamController updateStreamController = StreamController(); + final Stream updateStream = + updateStreamController.stream.asBroadcastStream(); + when(service.updatedPostStream).thenAnswer((invocation) => updateStream); + + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterMultiMediaPickerService` returns a mock instance of the `MultiMediaPickerService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `MultiMediaPickerService`: A mock instance of the `MultiMediaPickerService` class. +MultiMediaPickerService getAndRegisterMultiMediaPickerService() { + _removeRegistrationIfExists(); + final service = MockMultiMediaPickerService(); + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterImageCropper` returns a mock instance of the `ImageCropper` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `ImageCropper`: A mock instance of the `ImageCropper` class. +ImageCropper getAndRegisterImageCropper() { + _removeRegistrationIfExists(); + final service = MockImageCropper(); + locator.registerLazySingleton(() => service); + return service; +} + +/// `getAndRegisterImageService` returns a mock instance of the `ImageService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `ImageService`: A mock instance of the `ImageService` class. +ImageService getAndRegisterImageService() { + _removeRegistrationIfExists(); + final service = MockImageService(); + locator.registerLazySingleton(() => service); + return service; +} + +/// `getAndRegisterImagePicker` returns a mock instance of the `ImagePicker` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `ImagePicker`: A mock instance of the `ImagePicker` class. +ImagePicker getAndRegisterImagePicker() { + _removeRegistrationIfExists(); + final service = MockImagePicker(); + locator.registerLazySingleton(() => service); + return service; +} + +/// `getAndRegisterEventService` returns a mock instance of the `EventService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `EventService`: A mock instance of the `EventService` class. +EventService getAndRegisterEventService() { + _removeRegistrationIfExists(); + final service = MockEventService(); + + //Mock Stream for currentOrgStream + final StreamController> streamController = StreamController(); + final Stream> stream = + streamController.stream.asBroadcastStream(); + when(service.eventStream).thenAnswer((invocation) => stream); + when(service.getEvents()).thenAnswer( + (invocation) async => streamController.add([ + Event( + id: '1', + title: 'test', + startTime: '10000', + endTime: '20000', + location: 'ABC', + description: 'test', + creator: User( + id: "xzy1", + firstName: "Test", + lastName: "User", + email: "testuser@gmail.com", + refreshToken: "testtoken", + authToken: 'testtoken', + ), + admins: [ + User( + id: "xzy1", + firstName: "Test", + lastName: "User", + ), + ], + isPublic: true, + organization: OrgInfo(id: 'XYZ'), + ), + ]), + ); + const data = { + 'getEventAttendeesByEventId': [ + { + 'userId': 'xzy1', + } + ], + }; + when(service.fetchAttendeesByEvent('1')).thenAnswer( + (realInvocation) async => QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions( + document: gql( + EventQueries().attendeesByEvent('1'), + ), + ), + ), + ); + + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterConnectivity` returns a mock instance of the `Connectivity` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `Connectivity`: A mock instance of the `Connectivity` class. +Connectivity getAndRegisterConnectivity() { + _removeRegistrationIfExists(); + final service = MockConnectivity(); + locator.registerSingleton(service); + return service; +} + +/// `getAndRegisterConnectivityService` returns a mock instance of the `ConnectivityService` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `ConnectivityService`: A mock instance of the `ConnectivityService` class. +ConnectivityService getAndRegisterConnectivityService() { + _removeRegistrationIfExists(); + final service = MockConnectivityService(); + locator.registerSingleton(service); + // when(service.) + return service; +} + +/// `getPostMockModel` returns a mock instance of the `Post` class. +/// +/// **params**: +/// * `sId`: represent the post id. +/// * `description`: represent the post description. +/// * `duration`: represent the post duration. +/// +/// **returns**: +/// * `Post`: A mock instance of the `Post` class. +Post getPostMockModel({ + String sId = "PostID", + String description = "TestDescription", + String duration = "2 Months Ago", +}) { + final postMock = MockPost(); + when(postMock.sId).thenReturn(sId); + when(postMock.creator).thenReturn( + User( + firstName: "TestName", + ), + ); + when(postMock.description).thenReturn(description); + when(postMock.comments).thenReturn([]); + when(postMock.getPostCreatedDuration()).thenReturn(duration); + return postMock; +} + +/// `getAndRegisterCreateEventModel` returns a mock instance of the `CreateEventViewModel` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `CreateEventViewModel`: A mock instance of the `CreateEventViewModel` class. +CreateEventViewModel getAndRegisterCreateEventModel() { + _removeRegistrationIfExists(); + final cachedViewModel = MockCreateEventViewModel(); + + final formKey = GlobalKey(); + final textEditingController = TextEditingController(); + final focusNode = FocusNode(); + + when(cachedViewModel.formKey).thenReturn(formKey); + when(cachedViewModel.titleFocus).thenReturn(focusNode); + when(cachedViewModel.locationFocus).thenReturn(focusNode); + when(cachedViewModel.descriptionFocus).thenReturn(focusNode); + when(cachedViewModel.eventLocationTextController) + .thenReturn(textEditingController); + when(cachedViewModel.eventTitleTextController) + .thenReturn(textEditingController); + when(cachedViewModel.eventDescriptionTextController) + .thenReturn(textEditingController); + when(cachedViewModel.eventStartDate).thenReturn(DateTime.now()); + when(cachedViewModel.eventEndDate).thenReturn(DateTime.now()); + when(cachedViewModel.eventStartTime).thenReturn(TimeOfDay.now()); + when(cachedViewModel.eventEndTime).thenReturn(TimeOfDay.now()); + when(cachedViewModel.isPublicSwitch).thenReturn(true); + when(cachedViewModel.isRegisterableSwitch).thenReturn(true); + + final User user1 = User( + id: "fakeUser1", + firstName: 'r', + lastName: 'p', + ); + + final mapType = {user1.id!: true}; + + when(cachedViewModel.getCurrentOrgUsersList()) + .thenAnswer((realInvocation) async { + return [user1]; + }); + + when(cachedViewModel.selectedMembers).thenReturn([user1]); + when(cachedViewModel.orgMembersList).thenReturn([user1]); + when(cachedViewModel.memberCheckedMap).thenReturn(mapType); + when(cachedViewModel.isAllDay).thenReturn(true); + when(cachedViewModel.eventStartTime).thenReturn(TimeOfDay.now()); + + when(cachedViewModel.eventEndTime).thenReturn( + TimeOfDay.now().replacing( + hour: + (TimeOfDay.now().hour + (TimeOfDay.now().minute >= 30 ? 1 : 0)) % 24, + minute: (TimeOfDay.now().minute + 30) % 60, + ), + ); + + when(cachedViewModel.removeUserFromList(userId: "fakeUser1")) + .thenAnswer((realInvocation) async { + when(cachedViewModel.selectedMembers).thenReturn([]); + }); + + when(cachedViewModel.createEvent()).thenAnswer((realInvocation) async { + print('called'); + }); + + locator.registerSingleton(cachedViewModel); + return cachedViewModel; +} + +/// `getAndRegisterDirectChatViewModel` returns a mock instance of the `DirectChatViewModel` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `DirectChatViewModel`: A mock instance of the `DirectChatViewModel` class. +DirectChatViewModel getAndRegisterDirectChatViewModel() { + _removeRegistrationIfExists(); + final cachedViewModel = MockDirectChatViewModel(); + final formKey = GlobalKey(); + final ChatUser chatUser1 = + ChatUser(firstName: "XYZ", id: "XYZ", image: "XYZ"); + final ChatUser chatUser2 = + ChatUser(firstName: "ABC", id: "ABC", image: "ABC"); + final ChatMessage chatMessage1 = + ChatMessage("XYZ", chatUser1, "XYZ", chatUser2); + final ChatMessage chatMessage2 = + ChatMessage("XYZ", chatUser1, "Something", chatUser2); + final Map> messages = { + "XYZ": [chatMessage1], + }; + final ChatListTileDataModel chatListTileDataModel1 = + ChatListTileDataModel([chatUser1, chatUser2], "XYZ"); + + when(cachedViewModel.listKey).thenReturn(formKey); + // Default is the loaded state + when(cachedViewModel.chatState).thenReturn(ChatState.complete); + when(cachedViewModel.name).thenReturn("XYZ"); + when(cachedViewModel.chats).thenReturn([chatListTileDataModel1]); + when(cachedViewModel.chatMessagesByUser).thenReturn(messages); + when(cachedViewModel.initialise()).thenAnswer((realInvocation) async {}); + when(cachedViewModel.sendMessageToDirectChat("XYZ", "Something")) + .thenAnswer((realInvocation) async { + messages['XYZ']?.add(chatMessage2); + }); + when(cachedViewModel.getChatMessages("XYZ")) + .thenAnswer((realInvocation) async {}); + when(cachedViewModel.chatName("XYZ")).thenAnswer((realInvocation) {}); + + locator.registerSingleton(cachedViewModel); + return cachedViewModel; +} + +/// `getAndRegisterExploreEventsViewModel` returns a mock instance of the `ExploreEventsViewModel` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `ExploreEventsViewModel`: A mock instance of the `ExploreEventsViewModel` class. +ExploreEventsViewModel getAndRegisterExploreEventsViewModel() { + _removeRegistrationIfExists(); + final cachedViewModel = MockExploreEventsViewModel(); + + const String chosenValue = 'All Events'; + const String emptyListMessage = "Looks like there aren't any events."; + + final EventService mockEventService = EventService(); + + when(cachedViewModel.eventService).thenReturn(mockEventService); + when(cachedViewModel.chosenValue).thenReturn(chosenValue); + when(cachedViewModel.emptyListMessage).thenReturn(emptyListMessage); + + locator.registerSingleton(cachedViewModel); + return cachedViewModel; +} + +/// `getAndRegisterMainViewModel` returns a mock instance of the `MainScreenViewModel` class. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `MainScreenViewModel`: A mock instance of the `MainScreenViewModel` class. +MainScreenViewModel getAndRegisterMainViewModel() { + _removeRegistrationIfExists(); + final cachedViewModel = MockMainScreenViewModel(); + + locator.registerSingleton(cachedViewModel); + return cachedViewModel; +} + +/// `registerServices` registers all the services required for the test. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void registerServices() { + getAndRegisterNavigationService(); + getAndRegisterAppLanguage(); + getAndRegisterGraphQLClient(); + getAndRegisterGraphqlConfig(); + getAndRegisterUserConfig(); + getAndRegisterPostService(); + getAndRegisterEventService(); + getAndRegisterMultiMediaPickerService(); + getAndRegisterConnectivity(); + getAndRegisterConnectivityService(); + getAndRegisterDatabaseMutationFunctions(); + getAndRegisterOrganizationService(); + getAndRegisterCommentService(); + getAndRegisterChatService(); + getAndRegisterImageCropper(); + getAndRegisterImagePicker(); +} + +/// `unregisterServices` unregisters all the services required for the test. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void unregisterServices() { + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); +} + +/// registerViewModels registers all the view models required for the test. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void registerViewModels() { + locator.registerFactory(() => MainScreenViewModel()); + locator.registerFactory(() => OrganizationFeedViewModel()); + locator.registerFactory(() => ExploreEventsViewModel()); + locator + .registerFactory(() => MockCreateEventViewModel()); + locator.registerFactory(() => AddPostViewModel()); + locator.registerFactory(() => ProfilePageViewModel()); + locator.registerFactory(() => LikeButtonViewModel()); + locator.registerFactory(() => SizeConfig()); + locator.registerFactory(() => DirectChatViewModel()); + locator.registerFactory(() => WaitingViewModel()); + locator.registerFactory(() => EditAgendaItemViewModel()); + locator.registerFactory(() => EventInfoViewModel()); + locator.registerFactory(() => ProgressDialogViewModel()); + locator.registerFactory(() => SelectOrganizationViewModel()); + locator.registerFactory(() => CustomDrawerViewModel()); + locator.registerFactory(() => SelectContactViewModel()); +} + +/// `unregisterViewModels` unregisters all the view models required for the test. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void unregisterViewModels() { + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); + locator.unregister(); +} diff --git a/test/helpers/test_helpers.mocks.dart b/test/helpers/test_helpers.mocks.dart new file mode 100644 index 000000000..417efbb51 --- /dev/null +++ b/test/helpers/test_helpers.mocks.dart @@ -0,0 +1,4726 @@ +// Mocks generated by Mockito 5.4.4 from annotations +// in talawa/test/helpers/test_helpers.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i5; +import 'dart:io' as _i20; +import 'dart:ui' as _i10; + +import 'package:flutter/material.dart' as _i1; +import 'package:graphql_flutter/graphql_flutter.dart' as _i3; +import 'package:image_cropper/src/cropper.dart' as _i41; +import 'package:image_cropper_platform_interface/image_cropper_platform_interface.dart' + as _i42; +import 'package:image_picker/image_picker.dart' as _i13; +import 'package:mockito/mockito.dart' as _i2; +import 'package:mockito/src/dummies.dart' as _i18; +import 'package:qr_code_scanner/src/qr_code_scanner.dart' as _i33; +import 'package:qr_code_scanner/src/types/barcode.dart' as _i34; +import 'package:qr_code_scanner/src/types/camera.dart' as _i35; +import 'package:qr_code_scanner/src/types/features.dart' as _i12; +import 'package:talawa/enums/enums.dart' as _i14; +import 'package:talawa/models/chats/chat_list_tile_data_model.dart' as _i24; +import 'package:talawa/models/chats/chat_message.dart' as _i25; +import 'package:talawa/models/events/event_model.dart' as _i21; +import 'package:talawa/models/events/event_venue.dart' as _i39; +import 'package:talawa/models/events/event_volunteer_group.dart' as _i22; +import 'package:talawa/models/organization/org_info.dart' as _i6; +import 'package:talawa/models/post/post_model.dart' as _i17; +import 'package:talawa/models/user/user_info.dart' as _i7; +import 'package:talawa/services/chat_service.dart' as _i23; +import 'package:talawa/services/comment_service.dart' as _i36; +import 'package:talawa/services/database_mutation_functions.dart' as _i9; +import 'package:talawa/services/event_service.dart' as _i11; +import 'package:talawa/services/graphql_config.dart' as _i15; +import 'package:talawa/services/navigation_service.dart' as _i8; +import 'package:talawa/services/org_service.dart' as _i29; +import 'package:talawa/services/post_service.dart' as _i16; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart' + as _i19; +import 'package:talawa/services/user_config.dart' as _i26; +import 'package:talawa/utils/validators.dart' as _i32; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart' + as _i40; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart' + as _i38; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart' + as _i30; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart' + as _i31; +import 'package:talawa/view_model/lang_view_model.dart' as _i27; +import 'package:talawa/view_model/pre_auth_view_models/signup_details_view_model.dart' + as _i28; +import 'package:talawa/view_model/theme_view_model.dart' as _i37; +import 'package:talawa/widgets/custom_alert_dialog.dart' as _i4; + +// 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 _FakeGlobalKey_0> + extends _i2.SmartFake implements _i1.GlobalKey { + _FakeGlobalKey_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeHttpLink_1 extends _i2.SmartFake implements _i3.HttpLink { + _FakeHttpLink_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeWebSocketLink_2 extends _i2.SmartFake implements _i3.WebSocketLink { + _FakeWebSocketLink_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeGraphQLClient_3 extends _i2.SmartFake implements _i3.GraphQLClient { + _FakeGraphQLClient_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeDefaultPolicies_4 extends _i2.SmartFake + implements _i3.DefaultPolicies { + _FakeDefaultPolicies_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeLink_5 extends _i2.SmartFake implements _i3.Link { + _FakeLink_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeGraphQLCache_6 extends _i2.SmartFake implements _i3.GraphQLCache { + _FakeGraphQLCache_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeQueryManager_7 extends _i2.SmartFake implements _i3.QueryManager { + _FakeQueryManager_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeObservableQuery_8 extends _i2.SmartFake + implements _i3.ObservableQuery { + _FakeObservableQuery_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeQueryResult_9 extends _i2.SmartFake + implements _i3.QueryResult { + _FakeQueryResult_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeCustomAlertDialog_10 extends _i2.SmartFake + implements _i4.CustomAlertDialog { + _FakeCustomAlertDialog_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); + + @override + String toString({_i1.DiagnosticLevel? minLevel = _i1.DiagnosticLevel.info}) => + super.toString(); +} + +class _FakeStreamController_11 extends _i2.SmartFake + implements _i5.StreamController { + _FakeStreamController_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeOrgInfo_12 extends _i2.SmartFake implements _i6.OrgInfo { + _FakeOrgInfo_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeUser_13 extends _i2.SmartFake implements _i7.User { + _FakeUser_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeNavigationService_14 extends _i2.SmartFake + implements _i8.NavigationService { + _FakeNavigationService_14( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeDataBaseMutationFunctions_15 extends _i2.SmartFake + implements _i9.DataBaseMutationFunctions { + _FakeDataBaseMutationFunctions_15( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeLocale_16 extends _i2.SmartFake implements _i10.Locale { + _FakeLocale_16( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeTextEditingController_17 extends _i2.SmartFake + implements _i1.TextEditingController { + _FakeTextEditingController_17( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeFocusNode_18 extends _i2.SmartFake implements _i1.FocusNode { + _FakeFocusNode_18( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); + + @override + String toString({_i1.DiagnosticLevel? minLevel = _i1.DiagnosticLevel.info}) => + super.toString(); +} + +class _FakeEventService_19 extends _i2.SmartFake implements _i11.EventService { + _FakeEventService_19( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSystemFeatures_20 extends _i2.SmartFake + implements _i12.SystemFeatures { + _FakeSystemFeatures_20( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeThemeData_21 extends _i2.SmartFake implements _i1.ThemeData { + _FakeThemeData_21( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); + + @override + String toString({_i1.DiagnosticLevel? minLevel = _i1.DiagnosticLevel.info}) => + super.toString(); +} + +class _FakeTimeOfDay_22 extends _i2.SmartFake implements _i1.TimeOfDay { + _FakeTimeOfDay_22( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeDateTime_23 extends _i2.SmartFake implements DateTime { + _FakeDateTime_23( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeLostDataResponse_24 extends _i2.SmartFake + implements _i13.LostDataResponse { + _FakeLostDataResponse_24( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [NavigationService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockNavigationService extends _i2.Mock implements _i8.NavigationService { + @override + _i1.GlobalKey<_i1.NavigatorState> get navigatorKey => (super.noSuchMethod( + Invocation.getter(#navigatorKey), + returnValue: _FakeGlobalKey_0<_i1.NavigatorState>( + this, + Invocation.getter(#navigatorKey), + ), + returnValueForMissingStub: _FakeGlobalKey_0<_i1.NavigatorState>( + this, + Invocation.getter(#navigatorKey), + ), + ) as _i1.GlobalKey<_i1.NavigatorState>); + + @override + set navigatorKey(_i1.GlobalKey<_i1.NavigatorState>? _navigatorKey) => + super.noSuchMethod( + Invocation.setter( + #navigatorKey, + _navigatorKey, + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future pushScreen( + String? routeName, { + dynamic arguments, + }) => + (super.noSuchMethod( + Invocation.method( + #pushScreen, + [routeName], + {#arguments: arguments}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future popAndPushScreen( + String? routeName, { + dynamic arguments, + }) => + (super.noSuchMethod( + Invocation.method( + #popAndPushScreen, + [routeName], + {#arguments: arguments}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future pushReplacementScreen( + String? routeName, { + dynamic arguments, + }) => + (super.noSuchMethod( + Invocation.method( + #pushReplacementScreen, + [routeName], + {#arguments: arguments}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future removeAllAndPush( + String? routeName, + String? tillRoute, { + dynamic arguments, + }) => + (super.noSuchMethod( + Invocation.method( + #removeAllAndPush, + [ + routeName, + tillRoute, + ], + {#arguments: arguments}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void pushDialog(_i1.Widget? dialog) => super.noSuchMethod( + Invocation.method( + #pushDialog, + [dialog], + ), + returnValueForMissingStub: null, + ); + + @override + void showSnackBar( + String? message, { + Duration? duration = const Duration(seconds: 2), + }) => + super.noSuchMethod( + Invocation.method( + #showSnackBar, + [message], + {#duration: duration}, + ), + returnValueForMissingStub: null, + ); + + @override + void showTalawaErrorSnackBar( + String? errorMessage, + _i14.MessageType? messageType, + ) => + super.noSuchMethod( + Invocation.method( + #showTalawaErrorSnackBar, + [ + errorMessage, + messageType, + ], + ), + returnValueForMissingStub: null, + ); + + @override + void showTalawaErrorDialog( + String? errorMessage, + _i14.MessageType? messageType, + ) => + super.noSuchMethod( + Invocation.method( + #showTalawaErrorDialog, + [ + errorMessage, + messageType, + ], + ), + returnValueForMissingStub: null, + ); + + @override + void showCustomToast(String? msg) => super.noSuchMethod( + Invocation.method( + #showCustomToast, + [msg], + ), + returnValueForMissingStub: null, + ); + + @override + void pop() => super.noSuchMethod( + Invocation.method( + #pop, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void printNavigatorState() => super.noSuchMethod( + Invocation.method( + #printNavigatorState, + [], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [GraphqlConfig]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockGraphqlConfig extends _i2.Mock implements _i15.GraphqlConfig { + @override + _i3.HttpLink get httpLink => (super.noSuchMethod( + Invocation.getter(#httpLink), + returnValue: _FakeHttpLink_1( + this, + Invocation.getter(#httpLink), + ), + returnValueForMissingStub: _FakeHttpLink_1( + this, + Invocation.getter(#httpLink), + ), + ) as _i3.HttpLink); + + @override + set httpLink(_i3.HttpLink? _httpLink) => super.noSuchMethod( + Invocation.setter( + #httpLink, + _httpLink, + ), + returnValueForMissingStub: null, + ); + + @override + _i3.WebSocketLink get webSocketLink => (super.noSuchMethod( + Invocation.getter(#webSocketLink), + returnValue: _FakeWebSocketLink_2( + this, + Invocation.getter(#webSocketLink), + ), + returnValueForMissingStub: _FakeWebSocketLink_2( + this, + Invocation.getter(#webSocketLink), + ), + ) as _i3.WebSocketLink); + + @override + set webSocketLink(_i3.WebSocketLink? _webSocketLink) => super.noSuchMethod( + Invocation.setter( + #webSocketLink, + _webSocketLink, + ), + returnValueForMissingStub: null, + ); + + @override + set displayImgRoute(String? _displayImgRoute) => super.noSuchMethod( + Invocation.setter( + #displayImgRoute, + _displayImgRoute, + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future getToken() => (super.noSuchMethod( + Invocation.method( + #getToken, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void getOrgUrl() => super.noSuchMethod( + Invocation.method( + #getOrgUrl, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i3.GraphQLClient clientToQuery() => (super.noSuchMethod( + Invocation.method( + #clientToQuery, + [], + ), + returnValue: _FakeGraphQLClient_3( + this, + Invocation.method( + #clientToQuery, + [], + ), + ), + returnValueForMissingStub: _FakeGraphQLClient_3( + this, + Invocation.method( + #clientToQuery, + [], + ), + ), + ) as _i3.GraphQLClient); + + @override + _i3.GraphQLClient authClient() => (super.noSuchMethod( + Invocation.method( + #authClient, + [], + ), + returnValue: _FakeGraphQLClient_3( + this, + Invocation.method( + #authClient, + [], + ), + ), + returnValueForMissingStub: _FakeGraphQLClient_3( + this, + Invocation.method( + #authClient, + [], + ), + ), + ) as _i3.GraphQLClient); + + @override + void test() => super.noSuchMethod( + Invocation.method( + #test, + [], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [GraphQLClient]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockGraphQLClient extends _i2.Mock implements _i3.GraphQLClient { + @override + _i3.DefaultPolicies get defaultPolicies => (super.noSuchMethod( + Invocation.getter(#defaultPolicies), + returnValue: _FakeDefaultPolicies_4( + this, + Invocation.getter(#defaultPolicies), + ), + returnValueForMissingStub: _FakeDefaultPolicies_4( + this, + Invocation.getter(#defaultPolicies), + ), + ) as _i3.DefaultPolicies); + + @override + set defaultPolicies(_i3.DefaultPolicies? _defaultPolicies) => + super.noSuchMethod( + Invocation.setter( + #defaultPolicies, + _defaultPolicies, + ), + returnValueForMissingStub: null, + ); + + @override + _i3.Link get link => (super.noSuchMethod( + Invocation.getter(#link), + returnValue: _FakeLink_5( + this, + Invocation.getter(#link), + ), + returnValueForMissingStub: _FakeLink_5( + this, + Invocation.getter(#link), + ), + ) as _i3.Link); + + @override + _i3.GraphQLCache get cache => (super.noSuchMethod( + Invocation.getter(#cache), + returnValue: _FakeGraphQLCache_6( + this, + Invocation.getter(#cache), + ), + returnValueForMissingStub: _FakeGraphQLCache_6( + this, + Invocation.getter(#cache), + ), + ) as _i3.GraphQLCache); + + @override + _i3.QueryManager get queryManager => (super.noSuchMethod( + Invocation.getter(#queryManager), + returnValue: _FakeQueryManager_7( + this, + Invocation.getter(#queryManager), + ), + returnValueForMissingStub: _FakeQueryManager_7( + this, + Invocation.getter(#queryManager), + ), + ) as _i3.QueryManager); + + @override + set queryManager(_i3.QueryManager? _queryManager) => super.noSuchMethod( + Invocation.setter( + #queryManager, + _queryManager, + ), + returnValueForMissingStub: null, + ); + + @override + _i3.GraphQLClient copyWith({ + _i3.Link? link, + _i3.GraphQLCache? cache, + _i3.DefaultPolicies? defaultPolicies, + bool? alwaysRebroadcast, + }) => + (super.noSuchMethod( + Invocation.method( + #copyWith, + [], + { + #link: link, + #cache: cache, + #defaultPolicies: defaultPolicies, + #alwaysRebroadcast: alwaysRebroadcast, + }, + ), + returnValue: _FakeGraphQLClient_3( + this, + Invocation.method( + #copyWith, + [], + { + #link: link, + #cache: cache, + #defaultPolicies: defaultPolicies, + #alwaysRebroadcast: alwaysRebroadcast, + }, + ), + ), + returnValueForMissingStub: _FakeGraphQLClient_3( + this, + Invocation.method( + #copyWith, + [], + { + #link: link, + #cache: cache, + #defaultPolicies: defaultPolicies, + #alwaysRebroadcast: alwaysRebroadcast, + }, + ), + ), + ) as _i3.GraphQLClient); + + @override + _i3.ObservableQuery watchQuery( + _i3.WatchQueryOptions? options) => + (super.noSuchMethod( + Invocation.method( + #watchQuery, + [options], + ), + returnValue: _FakeObservableQuery_8( + this, + Invocation.method( + #watchQuery, + [options], + ), + ), + returnValueForMissingStub: _FakeObservableQuery_8( + this, + Invocation.method( + #watchQuery, + [options], + ), + ), + ) as _i3.ObservableQuery); + + @override + _i3.ObservableQuery watchMutation( + _i3.WatchQueryOptions? options) => + (super.noSuchMethod( + Invocation.method( + #watchMutation, + [options], + ), + returnValue: _FakeObservableQuery_8( + this, + Invocation.method( + #watchMutation, + [options], + ), + ), + returnValueForMissingStub: _FakeObservableQuery_8( + this, + Invocation.method( + #watchMutation, + [options], + ), + ), + ) as _i3.ObservableQuery); + + @override + _i5.Future<_i3.QueryResult> query( + _i3.QueryOptions? options) => + (super.noSuchMethod( + Invocation.method( + #query, + [options], + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #query, + [options], + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #query, + [options], + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future<_i3.QueryResult> mutate( + _i3.MutationOptions? options) => + (super.noSuchMethod( + Invocation.method( + #mutate, + [options], + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #mutate, + [options], + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #mutate, + [options], + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Stream<_i3.QueryResult> subscribe( + _i3.SubscriptionOptions? options) => + (super.noSuchMethod( + Invocation.method( + #subscribe, + [options], + ), + returnValue: _i5.Stream<_i3.QueryResult>.empty(), + returnValueForMissingStub: _i5.Stream<_i3.QueryResult>.empty(), + ) as _i5.Stream<_i3.QueryResult>); + + @override + _i5.Future<_i3.QueryResult> fetchMore( + _i3.FetchMoreOptions? fetchMoreOptions, { + required _i3.QueryOptions? originalOptions, + required _i3.QueryResult? previousResult, + }) => + (super.noSuchMethod( + Invocation.method( + #fetchMore, + [fetchMoreOptions], + { + #originalOptions: originalOptions, + #previousResult: previousResult, + }, + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #fetchMore, + [fetchMoreOptions], + { + #originalOptions: originalOptions, + #previousResult: previousResult, + }, + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #fetchMore, + [fetchMoreOptions], + { + #originalOptions: originalOptions, + #previousResult: previousResult, + }, + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + Map? readQuery( + _i3.Request? request, { + bool? optimistic = true, + }) => + (super.noSuchMethod( + Invocation.method( + #readQuery, + [request], + {#optimistic: optimistic}, + ), + returnValueForMissingStub: null, + ) as Map?); + + @override + Map? readFragment( + _i3.FragmentRequest? fragmentRequest, { + bool? optimistic = true, + }) => + (super.noSuchMethod( + Invocation.method( + #readFragment, + [fragmentRequest], + {#optimistic: optimistic}, + ), + returnValueForMissingStub: null, + ) as Map?); + + @override + void writeQuery( + _i3.Request? request, { + required Map? data, + bool? broadcast = true, + }) => + super.noSuchMethod( + Invocation.method( + #writeQuery, + [request], + { + #data: data, + #broadcast: broadcast, + }, + ), + returnValueForMissingStub: null, + ); + + @override + void writeFragment( + _i3.FragmentRequest? fragmentRequest, { + bool? broadcast = true, + required Map? data, + }) => + super.noSuchMethod( + Invocation.method( + #writeFragment, + [fragmentRequest], + { + #broadcast: broadcast, + #data: data, + }, + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future?>>? resetStore( + {bool? refetchQueries = true}) => + (super.noSuchMethod( + Invocation.method( + #resetStore, + [], + {#refetchQueries: refetchQueries}, + ), + returnValueForMissingStub: null, + ) as _i5.Future?>>?); +} + +/// A class which mocks [PostService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockPostService extends _i2.Mock implements _i16.PostService { + @override + set postInfo(Map? _postInfo) => super.noSuchMethod( + Invocation.setter( + #postInfo, + _postInfo, + ), + returnValueForMissingStub: null, + ); + + @override + set after(String? _after) => super.noSuchMethod( + Invocation.setter( + #after, + _after, + ), + returnValueForMissingStub: null, + ); + + @override + set before(String? _before) => super.noSuchMethod( + Invocation.setter( + #before, + _before, + ), + returnValueForMissingStub: null, + ); + + @override + set first(int? _first) => super.noSuchMethod( + Invocation.setter( + #first, + _first, + ), + returnValueForMissingStub: null, + ); + + @override + set last(int? _last) => super.noSuchMethod( + Invocation.setter( + #last, + _last, + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Stream> get postStream => (super.noSuchMethod( + Invocation.getter(#postStream), + returnValue: _i5.Stream>.empty(), + returnValueForMissingStub: _i5.Stream>.empty(), + ) as _i5.Stream>); + + @override + _i5.Stream<_i17.Post> get updatedPostStream => (super.noSuchMethod( + Invocation.getter(#updatedPostStream), + returnValue: _i5.Stream<_i17.Post>.empty(), + returnValueForMissingStub: _i5.Stream<_i17.Post>.empty(), + ) as _i5.Stream<_i17.Post>); + + @override + String get cacheKey => (super.noSuchMethod( + Invocation.getter(#cacheKey), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#cacheKey), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#cacheKey), + ), + ) as String); + + @override + _i5.Future> fetchDataFromApi() => (super.noSuchMethod( + Invocation.method( + #fetchDataFromApi, + [], + ), + returnValue: _i5.Future>.value(<_i17.Post>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i17.Post>[]), + ) as _i5.Future>); + + @override + void setOrgStreamSubscription() => super.noSuchMethod( + Invocation.method( + #setOrgStreamSubscription, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future fetchPostsInitial() => (super.noSuchMethod( + Invocation.method( + #fetchPostsInitial, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future getPosts() => (super.noSuchMethod( + Invocation.method( + #getPosts, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future refreshFeed() => (super.noSuchMethod( + Invocation.method( + #refreshFeed, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void addNewpost(_i17.Post? newPost) => super.noSuchMethod( + Invocation.method( + #addNewpost, + [newPost], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future<_i3.QueryResult> deletePost(_i17.Post? post) => + (super.noSuchMethod( + Invocation.method( + #deletePost, + [post], + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #deletePost, + [post], + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #deletePost, + [post], + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future addLike(String? postID) => (super.noSuchMethod( + Invocation.method( + #addLike, + [postID], + ), + returnValue: _i5.Future.value(false), + returnValueForMissingStub: _i5.Future.value(false), + ) as _i5.Future); + + @override + _i5.Future removeLike(String? postID) => (super.noSuchMethod( + Invocation.method( + #removeLike, + [postID], + ), + returnValue: _i5.Future.value(false), + returnValueForMissingStub: _i5.Future.value(false), + ) as _i5.Future); + + @override + void addCommentLocally(String? postID) => super.noSuchMethod( + Invocation.method( + #addCommentLocally, + [postID], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future nextPage() => (super.noSuchMethod( + Invocation.method( + #nextPage, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future previousPage() => (super.noSuchMethod( + Invocation.method( + #previousPage, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future> loadCachedData() => (super.noSuchMethod( + Invocation.method( + #loadCachedData, + [], + ), + returnValue: _i5.Future>.value(<_i17.Post>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i17.Post>[]), + ) as _i5.Future>); + + @override + _i5.Future saveDataToCache(List<_i17.Post>? data) => + (super.noSuchMethod( + Invocation.method( + #saveDataToCache, + [data], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future> getNewFeedAndRefreshCache() => + (super.noSuchMethod( + Invocation.method( + #getNewFeedAndRefreshCache, + [], + ), + returnValue: _i5.Future>.value(<_i17.Post>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i17.Post>[]), + ) as _i5.Future>); +} + +/// A class which mocks [MultiMediaPickerService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockMultiMediaPickerService extends _i2.Mock + implements _i19.MultiMediaPickerService { + @override + _i5.Stream get fileStream => (super.noSuchMethod( + Invocation.getter(#fileStream), + returnValue: _i5.Stream.empty(), + returnValueForMissingStub: _i5.Stream.empty(), + ) as _i5.Stream); + + @override + _i5.Future<_i20.File?> getPhotoFromGallery({bool? camera = false}) => + (super.noSuchMethod( + Invocation.method( + #getPhotoFromGallery, + [], + {#camera: camera}, + ), + returnValue: _i5.Future<_i20.File?>.value(), + returnValueForMissingStub: _i5.Future<_i20.File?>.value(), + ) as _i5.Future<_i20.File?>); + + @override + _i4.CustomAlertDialog permissionDeniedDialog() => (super.noSuchMethod( + Invocation.method( + #permissionDeniedDialog, + [], + ), + returnValue: _FakeCustomAlertDialog_10( + this, + Invocation.method( + #permissionDeniedDialog, + [], + ), + ), + returnValueForMissingStub: _FakeCustomAlertDialog_10( + this, + Invocation.method( + #permissionDeniedDialog, + [], + ), + ), + ) as _i4.CustomAlertDialog); +} + +/// A class which mocks [EventService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockEventService extends _i2.Mock implements _i11.EventService { + @override + _i5.Stream> get eventStream => (super.noSuchMethod( + Invocation.getter(#eventStream), + returnValue: _i5.Stream>.empty(), + returnValueForMissingStub: _i5.Stream>.empty(), + ) as _i5.Stream>); + + @override + String get cacheKey => (super.noSuchMethod( + Invocation.getter(#cacheKey), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#cacheKey), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#cacheKey), + ), + ) as String); + + @override + _i5.Future> fetchDataFromApi() => (super.noSuchMethod( + Invocation.method( + #fetchDataFromApi, + [], + ), + returnValue: _i5.Future>.value(<_i21.Event>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i21.Event>[]), + ) as _i5.Future>); + + @override + _i5.Future fetchEventsInitial() => (super.noSuchMethod( + Invocation.method( + #fetchEventsInitial, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future refreshFeed() => (super.noSuchMethod( + Invocation.method( + #refreshFeed, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void setOrgStreamSubscription() => super.noSuchMethod( + Invocation.method( + #setOrgStreamSubscription, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future<_i3.QueryResult> createEvent( + {required Map? variables}) => + (super.noSuchMethod( + Invocation.method( + #createEvent, + [], + {#variables: variables}, + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #createEvent, + [], + {#variables: variables}, + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #createEvent, + [], + {#variables: variables}, + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future getEvents() => (super.noSuchMethod( + Invocation.method( + #getEvents, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future fetchAttendeesByEvent(String? eventId) => + (super.noSuchMethod( + Invocation.method( + #fetchAttendeesByEvent, + [eventId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future registerForAnEvent(String? eventId) => + (super.noSuchMethod( + Invocation.method( + #registerForAnEvent, + [eventId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future<_i3.QueryResult> deleteEvent(String? eventId) => + (super.noSuchMethod( + Invocation.method( + #deleteEvent, + [eventId], + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #deleteEvent, + [eventId], + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #deleteEvent, + [eventId], + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future<_i3.QueryResult> editEvent({ + required String? eventId, + required Map? variables, + }) => + (super.noSuchMethod( + Invocation.method( + #editEvent, + [], + { + #eventId: eventId, + #variables: variables, + }, + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #editEvent, + [], + { + #eventId: eventId, + #variables: variables, + }, + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #editEvent, + [], + { + #eventId: eventId, + #variables: variables, + }, + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future createVolunteerGroup(Map? variables) => + (super.noSuchMethod( + Invocation.method( + #createVolunteerGroup, + [variables], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future removeVolunteerGroup(Map? variables) => + (super.noSuchMethod( + Invocation.method( + #removeVolunteerGroup, + [variables], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future addVolunteerToGroup(Map? variables) => + (super.noSuchMethod( + Invocation.method( + #addVolunteerToGroup, + [variables], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future removeVolunteerFromGroup( + Map? variables) => + (super.noSuchMethod( + Invocation.method( + #removeVolunteerFromGroup, + [variables], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future updateVolunteerGroup(Map? variables) => + (super.noSuchMethod( + Invocation.method( + #updateVolunteerGroup, + [variables], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future> fetchVolunteerGroupsByEvent( + String? eventId) => + (super.noSuchMethod( + Invocation.method( + #fetchVolunteerGroupsByEvent, + [eventId], + ), + returnValue: _i5.Future>.value( + <_i22.EventVolunteerGroup>[]), + returnValueForMissingStub: + _i5.Future>.value( + <_i22.EventVolunteerGroup>[]), + ) as _i5.Future>); + + @override + _i5.Future fetchAgendaCategories(String? orgId) => + (super.noSuchMethod( + Invocation.method( + #fetchAgendaCategories, + [orgId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future createAgendaItem(Map? variables) => + (super.noSuchMethod( + Invocation.method( + #createAgendaItem, + [variables], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future deleteAgendaItem(Map? variables) => + (super.noSuchMethod( + Invocation.method( + #deleteAgendaItem, + [variables], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future updateAgendaItem( + String? itemId, + Map? variables, + ) => + (super.noSuchMethod( + Invocation.method( + #updateAgendaItem, + [ + itemId, + variables, + ], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future fetchAgendaItems(String? eventId) => (super.noSuchMethod( + Invocation.method( + #fetchAgendaItems, + [eventId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future> loadCachedData() => (super.noSuchMethod( + Invocation.method( + #loadCachedData, + [], + ), + returnValue: _i5.Future>.value(<_i21.Event>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i21.Event>[]), + ) as _i5.Future>); + + @override + _i5.Future saveDataToCache(List<_i21.Event>? data) => + (super.noSuchMethod( + Invocation.method( + #saveDataToCache, + [data], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future> getNewFeedAndRefreshCache() => + (super.noSuchMethod( + Invocation.method( + #getNewFeedAndRefreshCache, + [], + ), + returnValue: _i5.Future>.value(<_i21.Event>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i21.Event>[]), + ) as _i5.Future>); +} + +/// A class which mocks [ChatService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockChatService extends _i2.Mock implements _i23.ChatService { + @override + _i5.Stream<_i3.QueryResult> get chatStream => (super.noSuchMethod( + Invocation.getter(#chatStream), + returnValue: _i5.Stream<_i3.QueryResult>.empty(), + returnValueForMissingStub: _i5.Stream<_i3.QueryResult>.empty(), + ) as _i5.Stream<_i3.QueryResult>); + + @override + set chatStream(_i5.Stream<_i3.QueryResult>? _chatStream) => + super.noSuchMethod( + Invocation.setter( + #chatStream, + _chatStream, + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Stream<_i24.ChatListTileDataModel> get chatListStream => + (super.noSuchMethod( + Invocation.getter(#chatListStream), + returnValue: _i5.Stream<_i24.ChatListTileDataModel>.empty(), + returnValueForMissingStub: + _i5.Stream<_i24.ChatListTileDataModel>.empty(), + ) as _i5.Stream<_i24.ChatListTileDataModel>); + + @override + _i5.Stream<_i25.ChatMessage> get chatMessagesStream => (super.noSuchMethod( + Invocation.getter(#chatMessagesStream), + returnValue: _i5.Stream<_i25.ChatMessage>.empty(), + returnValueForMissingStub: _i5.Stream<_i25.ChatMessage>.empty(), + ) as _i5.Stream<_i25.ChatMessage>); + + @override + _i5.Future sendMessageToDirectChat( + String? chatId, + String? messageContent, + ) => + (super.noSuchMethod( + Invocation.method( + #sendMessageToDirectChat, + [ + chatId, + messageContent, + ], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future getDirectChatsByUserId() => (super.noSuchMethod( + Invocation.method( + #getDirectChatsByUserId, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future getDirectChatMessagesByChatId(dynamic chatId) => + (super.noSuchMethod( + Invocation.method( + #getDirectChatMessagesByChatId, + [chatId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [UserConfig]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockUserConfig extends _i2.Mock implements _i26.UserConfig { + @override + _i5.Stream<_i6.OrgInfo> get currentOrgInfoStream => (super.noSuchMethod( + Invocation.getter(#currentOrgInfoStream), + returnValue: _i5.Stream<_i6.OrgInfo>.empty(), + returnValueForMissingStub: _i5.Stream<_i6.OrgInfo>.empty(), + ) as _i5.Stream<_i6.OrgInfo>); + + @override + _i5.StreamController<_i6.OrgInfo> get currentOrgInfoController => + (super.noSuchMethod( + Invocation.getter(#currentOrgInfoController), + returnValue: _FakeStreamController_11<_i6.OrgInfo>( + this, + Invocation.getter(#currentOrgInfoController), + ), + returnValueForMissingStub: _FakeStreamController_11<_i6.OrgInfo>( + this, + Invocation.getter(#currentOrgInfoController), + ), + ) as _i5.StreamController<_i6.OrgInfo>); + + @override + _i6.OrgInfo get currentOrg => (super.noSuchMethod( + Invocation.getter(#currentOrg), + returnValue: _FakeOrgInfo_12( + this, + Invocation.getter(#currentOrg), + ), + returnValueForMissingStub: _FakeOrgInfo_12( + this, + Invocation.getter(#currentOrg), + ), + ) as _i6.OrgInfo); + + @override + String get currentOrgName => (super.noSuchMethod( + Invocation.getter(#currentOrgName), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#currentOrgName), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#currentOrgName), + ), + ) as String); + + @override + bool get loggedIn => (super.noSuchMethod( + Invocation.getter(#loggedIn), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set currentOrg(_i6.OrgInfo? org) => super.noSuchMethod( + Invocation.setter( + #currentOrg, + org, + ), + returnValueForMissingStub: null, + ); + + @override + _i7.User get currentUser => (super.noSuchMethod( + Invocation.getter(#currentUser), + returnValue: _FakeUser_13( + this, + Invocation.getter(#currentUser), + ), + returnValueForMissingStub: _FakeUser_13( + this, + Invocation.getter(#currentUser), + ), + ) as _i7.User); + + @override + set currentUser(_i7.User? user) => super.noSuchMethod( + Invocation.setter( + #currentUser, + user, + ), + returnValueForMissingStub: null, + ); + + @override + void initialiseStream() => super.noSuchMethod( + Invocation.method( + #initialiseStream, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future userLoggedIn() => (super.noSuchMethod( + Invocation.method( + #userLoggedIn, + [], + ), + returnValue: _i5.Future.value(false), + returnValueForMissingStub: _i5.Future.value(false), + ) as _i5.Future); + + @override + _i5.Future userLogOut() => (super.noSuchMethod( + Invocation.method( + #userLogOut, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future updateUserJoinedOrg(List<_i6.OrgInfo>? orgDetails) => + (super.noSuchMethod( + Invocation.method( + #updateUserJoinedOrg, + [orgDetails], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future updateUserCreatedOrg(List<_i6.OrgInfo>? orgDetails) => + (super.noSuchMethod( + Invocation.method( + #updateUserCreatedOrg, + [orgDetails], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future updateUserMemberRequestOrg(List<_i6.OrgInfo>? orgDetails) => + (super.noSuchMethod( + Invocation.method( + #updateUserMemberRequestOrg, + [orgDetails], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future updateUserAdminOrg(List<_i6.OrgInfo>? orgDetails) => + (super.noSuchMethod( + Invocation.method( + #updateUserAdminOrg, + [orgDetails], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future updateAccessToken({ + required String? accessToken, + required String? refreshToken, + }) => + (super.noSuchMethod( + Invocation.method( + #updateAccessToken, + [], + { + #accessToken: accessToken, + #refreshToken: refreshToken, + }, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future updateUser(_i7.User? updatedUserDetails) => + (super.noSuchMethod( + Invocation.method( + #updateUser, + [updatedUserDetails], + ), + returnValue: _i5.Future.value(false), + returnValueForMissingStub: _i5.Future.value(false), + ) as _i5.Future); + + @override + void saveUserInHive() => super.noSuchMethod( + Invocation.method( + #saveUserInHive, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void saveCurrentOrgInHive(_i6.OrgInfo? saveOrgAsCurrent) => + super.noSuchMethod( + Invocation.method( + #saveCurrentOrgInHive, + [saveOrgAsCurrent], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [AppLanguage]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockAppLanguage extends _i2.Mock implements _i27.AppLanguage { + @override + bool get isTest => (super.noSuchMethod( + Invocation.getter(#isTest), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + _i8.NavigationService get navigationService => (super.noSuchMethod( + Invocation.getter(#navigationService), + returnValue: _FakeNavigationService_14( + this, + Invocation.getter(#navigationService), + ), + returnValueForMissingStub: _FakeNavigationService_14( + this, + Invocation.getter(#navigationService), + ), + ) as _i8.NavigationService); + + @override + _i9.DataBaseMutationFunctions get databaseFunctions => (super.noSuchMethod( + Invocation.getter(#databaseFunctions), + returnValue: _FakeDataBaseMutationFunctions_15( + this, + Invocation.getter(#databaseFunctions), + ), + returnValueForMissingStub: _FakeDataBaseMutationFunctions_15( + this, + Invocation.getter(#databaseFunctions), + ), + ) as _i9.DataBaseMutationFunctions); + + @override + _i10.Locale get appLocal => (super.noSuchMethod( + Invocation.getter(#appLocal), + returnValue: _FakeLocale_16( + this, + Invocation.getter(#appLocal), + ), + returnValueForMissingStub: _FakeLocale_16( + this, + Invocation.getter(#appLocal), + ), + ) as _i10.Locale); + + @override + _i14.ViewState get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _i14.ViewState.idle, + returnValueForMissingStub: _i14.ViewState.idle, + ) as _i14.ViewState); + + @override + bool get isBusy => (super.noSuchMethod( + Invocation.getter(#isBusy), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + _i5.Future initialize() => (super.noSuchMethod( + Invocation.method( + #initialize, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future fetchLocale() => (super.noSuchMethod( + Invocation.method( + #fetchLocale, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i10.Locale localeResoultion( + _i10.Locale? locale, + Iterable<_i10.Locale>? supportedLocales, + ) => + (super.noSuchMethod( + Invocation.method( + #localeResoultion, + [ + locale, + supportedLocales, + ], + ), + returnValue: _FakeLocale_16( + this, + Invocation.method( + #localeResoultion, + [ + locale, + supportedLocales, + ], + ), + ), + returnValueForMissingStub: _FakeLocale_16( + this, + Invocation.method( + #localeResoultion, + [ + locale, + supportedLocales, + ], + ), + ), + ) as _i10.Locale); + + @override + _i5.Future changeLanguage(_i10.Locale? type) => (super.noSuchMethod( + Invocation.method( + #changeLanguage, + [type], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future selectLanguagePress() => (super.noSuchMethod( + Invocation.method( + #selectLanguagePress, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future dbLanguageUpdate() => (super.noSuchMethod( + Invocation.method( + #dbLanguageUpdate, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future appLanguageQuery() => (super.noSuchMethod( + Invocation.method( + #appLanguageQuery, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future userLanguageQuery(String? userId) => (super.noSuchMethod( + Invocation.method( + #userLanguageQuery, + [userId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void setState(_i14.ViewState? viewState) => super.noSuchMethod( + Invocation.method( + #setState, + [viewState], + ), + returnValueForMissingStub: null, + ); + + @override + void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i10.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 [SignupDetailsViewModel]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockSignupDetailsViewModel extends _i2.Mock + implements _i28.SignupDetailsViewModel { + @override + _i1.GlobalKey<_i1.FormState> get formKey => (super.noSuchMethod( + Invocation.getter(#formKey), + returnValue: _FakeGlobalKey_0<_i1.FormState>( + this, + Invocation.getter(#formKey), + ), + returnValueForMissingStub: _FakeGlobalKey_0<_i1.FormState>( + this, + Invocation.getter(#formKey), + ), + ) as _i1.GlobalKey<_i1.FormState>); + + @override + List> get greeting => (super.noSuchMethod( + Invocation.getter(#greeting), + returnValue: >[], + returnValueForMissingStub: >[], + ) as List>); + + @override + set greeting(List>? _greeting) => super.noSuchMethod( + Invocation.setter( + #greeting, + _greeting, + ), + returnValueForMissingStub: null, + ); + + @override + _i6.OrgInfo get selectedOrganization => (super.noSuchMethod( + Invocation.getter(#selectedOrganization), + returnValue: _FakeOrgInfo_12( + this, + Invocation.getter(#selectedOrganization), + ), + returnValueForMissingStub: _FakeOrgInfo_12( + this, + Invocation.getter(#selectedOrganization), + ), + ) as _i6.OrgInfo); + + @override + set selectedOrganization(_i6.OrgInfo? _selectedOrganization) => + super.noSuchMethod( + Invocation.setter( + #selectedOrganization, + _selectedOrganization, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get confirmPassword => (super.noSuchMethod( + Invocation.getter(#confirmPassword), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#confirmPassword), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#confirmPassword), + ), + ) as _i1.TextEditingController); + + @override + set confirmPassword(_i1.TextEditingController? _confirmPassword) => + super.noSuchMethod( + Invocation.setter( + #confirmPassword, + _confirmPassword, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get firstName => (super.noSuchMethod( + Invocation.getter(#firstName), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#firstName), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#firstName), + ), + ) as _i1.TextEditingController); + + @override + set firstName(_i1.TextEditingController? _firstName) => super.noSuchMethod( + Invocation.setter( + #firstName, + _firstName, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get lastName => (super.noSuchMethod( + Invocation.getter(#lastName), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#lastName), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#lastName), + ), + ) as _i1.TextEditingController); + + @override + set lastName(_i1.TextEditingController? _lastName) => super.noSuchMethod( + Invocation.setter( + #lastName, + _lastName, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get password => (super.noSuchMethod( + Invocation.getter(#password), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#password), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#password), + ), + ) as _i1.TextEditingController); + + @override + set password(_i1.TextEditingController? _password) => super.noSuchMethod( + Invocation.setter( + #password, + _password, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get email => (super.noSuchMethod( + Invocation.getter(#email), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#email), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#email), + ), + ) as _i1.TextEditingController); + + @override + set email(_i1.TextEditingController? _email) => super.noSuchMethod( + Invocation.setter( + #email, + _email, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.AutovalidateMode get validate => (super.noSuchMethod( + Invocation.getter(#validate), + returnValue: _i1.AutovalidateMode.disabled, + returnValueForMissingStub: _i1.AutovalidateMode.disabled, + ) as _i1.AutovalidateMode); + + @override + set validate(_i1.AutovalidateMode? _validate) => super.noSuchMethod( + Invocation.setter( + #validate, + _validate, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.FocusNode get confirmFocus => (super.noSuchMethod( + Invocation.getter(#confirmFocus), + returnValue: _FakeFocusNode_18( + this, + Invocation.getter(#confirmFocus), + ), + returnValueForMissingStub: _FakeFocusNode_18( + this, + Invocation.getter(#confirmFocus), + ), + ) as _i1.FocusNode); + + @override + set confirmFocus(_i1.FocusNode? _confirmFocus) => super.noSuchMethod( + Invocation.setter( + #confirmFocus, + _confirmFocus, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hidePassword => (super.noSuchMethod( + Invocation.getter(#hidePassword), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set hidePassword(bool? _hidePassword) => super.noSuchMethod( + Invocation.setter( + #hidePassword, + _hidePassword, + ), + returnValueForMissingStub: null, + ); + + @override + _i14.ViewState get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _i14.ViewState.idle, + returnValueForMissingStub: _i14.ViewState.idle, + ) as _i14.ViewState); + + @override + bool get isBusy => (super.noSuchMethod( + Invocation.getter(#isBusy), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + void initialise(_i6.OrgInfo? org) => super.noSuchMethod( + Invocation.method( + #initialise, + [org], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future signUp() => (super.noSuchMethod( + Invocation.method( + #signUp, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void setState(_i14.ViewState? viewState) => super.noSuchMethod( + Invocation.method( + #setState, + [viewState], + ), + returnValueForMissingStub: null, + ); + + @override + void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i10.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 [Post]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockPost extends _i2.Mock implements _i17.Post { + @override + String get sId => (super.noSuchMethod( + Invocation.getter(#sId), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#sId), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#sId), + ), + ) as String); + + @override + set sId(String? _sId) => super.noSuchMethod( + Invocation.setter( + #sId, + _sId, + ), + returnValueForMissingStub: null, + ); + + @override + set description(String? _description) => super.noSuchMethod( + Invocation.setter( + #description, + _description, + ), + returnValueForMissingStub: null, + ); + + @override + set createdAt(DateTime? _createdAt) => super.noSuchMethod( + Invocation.setter( + #createdAt, + _createdAt, + ), + returnValueForMissingStub: null, + ); + + @override + set imageUrl(String? _imageUrl) => super.noSuchMethod( + Invocation.setter( + #imageUrl, + _imageUrl, + ), + returnValueForMissingStub: null, + ); + + @override + set base64String(String? _base64String) => super.noSuchMethod( + Invocation.setter( + #base64String, + _base64String, + ), + returnValueForMissingStub: null, + ); + + @override + set videoUrl(String? _videoUrl) => super.noSuchMethod( + Invocation.setter( + #videoUrl, + _videoUrl, + ), + returnValueForMissingStub: null, + ); + + @override + set creator(_i7.User? _creator) => super.noSuchMethod( + Invocation.setter( + #creator, + _creator, + ), + returnValueForMissingStub: null, + ); + + @override + set organization(_i6.OrgInfo? _organization) => super.noSuchMethod( + Invocation.setter( + #organization, + _organization, + ), + returnValueForMissingStub: null, + ); + + @override + set likedBy(List<_i17.LikedBy>? _likedBy) => super.noSuchMethod( + Invocation.setter( + #likedBy, + _likedBy, + ), + returnValueForMissingStub: null, + ); + + @override + set comments(List<_i17.Comments>? _comments) => super.noSuchMethod( + Invocation.setter( + #comments, + _comments, + ), + returnValueForMissingStub: null, + ); + + @override + String getPostCreatedDuration() => (super.noSuchMethod( + Invocation.method( + #getPostCreatedDuration, + [], + ), + returnValue: _i18.dummyValue( + this, + Invocation.method( + #getPostCreatedDuration, + [], + ), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.method( + #getPostCreatedDuration, + [], + ), + ), + ) as String); +} + +/// A class which mocks [DataBaseMutationFunctions]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockDataBaseMutationFunctions extends _i2.Mock + implements _i9.DataBaseMutationFunctions { + @override + _i3.GraphQLClient get clientNonAuth => (super.noSuchMethod( + Invocation.getter(#clientNonAuth), + returnValue: _FakeGraphQLClient_3( + this, + Invocation.getter(#clientNonAuth), + ), + returnValueForMissingStub: _FakeGraphQLClient_3( + this, + Invocation.getter(#clientNonAuth), + ), + ) as _i3.GraphQLClient); + + @override + set clientNonAuth(_i3.GraphQLClient? _clientNonAuth) => super.noSuchMethod( + Invocation.setter( + #clientNonAuth, + _clientNonAuth, + ), + returnValueForMissingStub: null, + ); + + @override + _i3.GraphQLClient get clientAuth => (super.noSuchMethod( + Invocation.getter(#clientAuth), + returnValue: _FakeGraphQLClient_3( + this, + Invocation.getter(#clientAuth), + ), + returnValueForMissingStub: _FakeGraphQLClient_3( + this, + Invocation.getter(#clientAuth), + ), + ) as _i3.GraphQLClient); + + @override + set clientAuth(_i3.GraphQLClient? _clientAuth) => super.noSuchMethod( + Invocation.setter( + #clientAuth, + _clientAuth, + ), + returnValueForMissingStub: null, + ); + + @override + _i3.QueryResult get noData => (super.noSuchMethod( + Invocation.getter(#noData), + returnValue: _FakeQueryResult_9( + this, + Invocation.getter(#noData), + ), + returnValueForMissingStub: _FakeQueryResult_9( + this, + Invocation.getter(#noData), + ), + ) as _i3.QueryResult); + + @override + set noData(_i3.QueryResult? _noData) => super.noSuchMethod( + Invocation.setter( + #noData, + _noData, + ), + returnValueForMissingStub: null, + ); + + @override + void init() => super.noSuchMethod( + Invocation.method( + #init, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void initClientNonAuth() => super.noSuchMethod( + Invocation.method( + #initClientNonAuth, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future<_i3.QueryResult> gqlAuthQuery( + String? query, { + Map? variables, + }) => + (super.noSuchMethod( + Invocation.method( + #gqlAuthQuery, + [query], + {#variables: variables}, + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #gqlAuthQuery, + [query], + {#variables: variables}, + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #gqlAuthQuery, + [query], + {#variables: variables}, + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future<_i3.QueryResult> gqlAuthMutation( + String? mutation, { + Map? variables, + }) => + (super.noSuchMethod( + Invocation.method( + #gqlAuthMutation, + [mutation], + {#variables: variables}, + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #gqlAuthMutation, + [mutation], + {#variables: variables}, + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #gqlAuthMutation, + [mutation], + {#variables: variables}, + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future<_i3.QueryResult> gqlNonAuthMutation( + String? mutation, { + Map? variables, + bool? reCall = true, + }) => + (super.noSuchMethod( + Invocation.method( + #gqlNonAuthMutation, + [mutation], + { + #variables: variables, + #reCall: reCall, + }, + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #gqlNonAuthMutation, + [mutation], + { + #variables: variables, + #reCall: reCall, + }, + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #gqlNonAuthMutation, + [mutation], + { + #variables: variables, + #reCall: reCall, + }, + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future<_i3.QueryResult> gqlNonAuthQuery( + String? query, { + Map? variables, + }) => + (super.noSuchMethod( + Invocation.method( + #gqlNonAuthQuery, + [query], + {#variables: variables}, + ), + returnValue: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #gqlNonAuthQuery, + [query], + {#variables: variables}, + ), + )), + returnValueForMissingStub: _i5.Future<_i3.QueryResult>.value( + _FakeQueryResult_9( + this, + Invocation.method( + #gqlNonAuthQuery, + [query], + {#variables: variables}, + ), + )), + ) as _i5.Future<_i3.QueryResult>); + + @override + _i5.Future refreshAccessToken(String? refreshToken) => + (super.noSuchMethod( + Invocation.method( + #refreshAccessToken, + [refreshToken], + ), + returnValue: _i5.Future.value(false), + returnValueForMissingStub: _i5.Future.value(false), + ) as _i5.Future); + + @override + _i5.Future fetchOrgById(String? id) => (super.noSuchMethod( + Invocation.method( + #fetchOrgById, + [id], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [OrganizationService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockOrganizationService extends _i2.Mock + implements _i29.OrganizationService { + @override + _i5.Future> getOrgMembersList(String? orgId) => + (super.noSuchMethod( + Invocation.method( + #getOrgMembersList, + [orgId], + ), + returnValue: _i5.Future>.value(<_i7.User>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i7.User>[]), + ) as _i5.Future>); +} + +/// A class which mocks [ExploreEventsViewModel]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockExploreEventsViewModel extends _i2.Mock + implements _i30.ExploreEventsViewModel { + @override + bool get demoMode => (super.noSuchMethod( + Invocation.getter(#demoMode), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set demoMode(bool? _demoMode) => super.noSuchMethod( + Invocation.setter( + #demoMode, + _demoMode, + ), + returnValueForMissingStub: null, + ); + + @override + List<_i21.Event> get events => (super.noSuchMethod( + Invocation.getter(#events), + returnValue: <_i21.Event>[], + returnValueForMissingStub: <_i21.Event>[], + ) as List<_i21.Event>); + + @override + List<_i21.Event> get userEvents => (super.noSuchMethod( + Invocation.getter(#userEvents), + returnValue: <_i21.Event>[], + returnValueForMissingStub: <_i21.Event>[], + ) as List<_i21.Event>); + + @override + _i11.EventService get eventService => (super.noSuchMethod( + Invocation.getter(#eventService), + returnValue: _FakeEventService_19( + this, + Invocation.getter(#eventService), + ), + returnValueForMissingStub: _FakeEventService_19( + this, + Invocation.getter(#eventService), + ), + ) as _i11.EventService); + + @override + String get emptyListMessage => (super.noSuchMethod( + Invocation.getter(#emptyListMessage), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#emptyListMessage), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#emptyListMessage), + ), + ) as String); + + @override + String get chosenValue => (super.noSuchMethod( + Invocation.getter(#chosenValue), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#chosenValue), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#chosenValue), + ), + ) as String); + + @override + _i14.ViewState get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _i14.ViewState.idle, + returnValueForMissingStub: _i14.ViewState.idle, + ) as _i14.ViewState); + + @override + bool get isBusy => (super.noSuchMethod( + Invocation.getter(#isBusy), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + _i5.Future fetchNewEvents() => (super.noSuchMethod( + Invocation.method( + #fetchNewEvents, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future refreshEvents() => (super.noSuchMethod( + Invocation.method( + #refreshEvents, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future initialise() => (super.noSuchMethod( + Invocation.method( + #initialise, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future checkIfExistsAndAddNewEvents(List<_i21.Event>? newEvents) => + (super.noSuchMethod( + Invocation.method( + #checkIfExistsAndAddNewEvents, + [newEvents], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future deleteEvent({required String? eventId}) => + (super.noSuchMethod( + Invocation.method( + #deleteEvent, + [], + {#eventId: eventId}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future choseValueFromDropdown(String? value) => (super.noSuchMethod( + Invocation.method( + #choseValueFromDropdown, + [value], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void setState(_i14.ViewState? viewState) => super.noSuchMethod( + Invocation.method( + #setState, + [viewState], + ), + returnValueForMissingStub: null, + ); + + @override + void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #removeListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void notifyListeners() => super.noSuchMethod( + Invocation.method( + #notifyListeners, + [], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [OrganizationFeedViewModel]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockOrganizationFeedViewModel extends _i2.Mock + implements _i31.OrganizationFeedViewModel { + @override + bool get istest => (super.noSuchMethod( + Invocation.getter(#istest), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set istest(bool? _istest) => super.noSuchMethod( + Invocation.setter( + #istest, + _istest, + ), + returnValueForMissingStub: null, + ); + + @override + List<_i17.Post> get posts => (super.noSuchMethod( + Invocation.getter(#posts), + returnValue: <_i17.Post>[], + returnValueForMissingStub: <_i17.Post>[], + ) as List<_i17.Post>); + + @override + List<_i17.Post> get userPosts => (super.noSuchMethod( + Invocation.getter(#userPosts), + returnValue: <_i17.Post>[], + returnValueForMissingStub: <_i17.Post>[], + ) as List<_i17.Post>); + + @override + List<_i17.Post> get pinnedPosts => (super.noSuchMethod( + Invocation.getter(#pinnedPosts), + returnValue: <_i17.Post>[], + returnValueForMissingStub: <_i17.Post>[], + ) as List<_i17.Post>); + + @override + String get currentOrgName => (super.noSuchMethod( + Invocation.getter(#currentOrgName), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#currentOrgName), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#currentOrgName), + ), + ) as String); + + @override + bool get isFetchingPosts => (super.noSuchMethod( + Invocation.getter(#isFetchingPosts), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + _i14.ViewState get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _i14.ViewState.idle, + returnValueForMissingStub: _i14.ViewState.idle, + ) as _i14.ViewState); + + @override + bool get isBusy => (super.noSuchMethod( + Invocation.getter(#isBusy), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + void setCurrentOrganizationName(String? updatedOrganization) => + super.noSuchMethod( + Invocation.method( + #setCurrentOrganizationName, + [updatedOrganization], + ), + returnValueForMissingStub: null, + ); + + @override + void fetchNewPosts() => super.noSuchMethod( + Invocation.method( + #fetchNewPosts, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void initialise({bool? isTest = false}) => super.noSuchMethod( + Invocation.method( + #initialise, + [], + {#isTest: isTest}, + ), + returnValueForMissingStub: null, + ); + + @override + void buildNewPosts(List<_i17.Post>? newPosts) => super.noSuchMethod( + Invocation.method( + #buildNewPosts, + [newPosts], + ), + returnValueForMissingStub: null, + ); + + @override + void navigateToIndividualPage(_i17.Post? post) => super.noSuchMethod( + Invocation.method( + #navigateToIndividualPage, + [post], + ), + returnValueForMissingStub: null, + ); + + @override + void navigateToPinnedPostPage() => super.noSuchMethod( + Invocation.method( + #navigateToPinnedPostPage, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void addNewPost(_i17.Post? newPost) => super.noSuchMethod( + Invocation.method( + #addNewPost, + [newPost], + ), + returnValueForMissingStub: null, + ); + + @override + void updatedPost(_i17.Post? post) => super.noSuchMethod( + Invocation.method( + #updatedPost, + [post], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future removePost(_i17.Post? post) => (super.noSuchMethod( + Invocation.method( + #removePost, + [post], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void nextPage() => super.noSuchMethod( + Invocation.method( + #nextPage, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void previousPage() => super.noSuchMethod( + Invocation.method( + #previousPage, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void setState(_i14.ViewState? viewState) => super.noSuchMethod( + Invocation.method( + #setState, + [viewState], + ), + returnValueForMissingStub: null, + ); + + @override + void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #removeListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void notifyListeners() => super.noSuchMethod( + Invocation.method( + #notifyListeners, + [], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [Validator]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockValidator extends _i2.Mock implements _i32.Validator { + @override + _i5.Future validateUrlExistence(String? url) => (super.noSuchMethod( + Invocation.method( + #validateUrlExistence, + [url], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [QRViewController]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockQRViewController extends _i2.Mock implements _i33.QRViewController { + @override + _i5.Stream<_i34.Barcode> get scannedDataStream => (super.noSuchMethod( + Invocation.getter(#scannedDataStream), + returnValue: _i5.Stream<_i34.Barcode>.empty(), + returnValueForMissingStub: _i5.Stream<_i34.Barcode>.empty(), + ) as _i5.Stream<_i34.Barcode>); + + @override + bool get hasPermissions => (super.noSuchMethod( + Invocation.getter(#hasPermissions), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + _i5.Future<_i35.CameraFacing> getCameraInfo() => (super.noSuchMethod( + Invocation.method( + #getCameraInfo, + [], + ), + returnValue: + _i5.Future<_i35.CameraFacing>.value(_i35.CameraFacing.back), + returnValueForMissingStub: + _i5.Future<_i35.CameraFacing>.value(_i35.CameraFacing.back), + ) as _i5.Future<_i35.CameraFacing>); + + @override + _i5.Future<_i35.CameraFacing> flipCamera() => (super.noSuchMethod( + Invocation.method( + #flipCamera, + [], + ), + returnValue: + _i5.Future<_i35.CameraFacing>.value(_i35.CameraFacing.back), + returnValueForMissingStub: + _i5.Future<_i35.CameraFacing>.value(_i35.CameraFacing.back), + ) as _i5.Future<_i35.CameraFacing>); + + @override + _i5.Future getFlashStatus() => (super.noSuchMethod( + Invocation.method( + #getFlashStatus, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future toggleFlash() => (super.noSuchMethod( + Invocation.method( + #toggleFlash, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future pauseCamera() => (super.noSuchMethod( + Invocation.method( + #pauseCamera, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future stopCamera() => (super.noSuchMethod( + Invocation.method( + #stopCamera, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future resumeCamera() => (super.noSuchMethod( + Invocation.method( + #resumeCamera, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future<_i12.SystemFeatures> getSystemFeatures() => (super.noSuchMethod( + Invocation.method( + #getSystemFeatures, + [], + ), + returnValue: + _i5.Future<_i12.SystemFeatures>.value(_FakeSystemFeatures_20( + this, + Invocation.method( + #getSystemFeatures, + [], + ), + )), + returnValueForMissingStub: + _i5.Future<_i12.SystemFeatures>.value(_FakeSystemFeatures_20( + this, + Invocation.method( + #getSystemFeatures, + [], + ), + )), + ) as _i5.Future<_i12.SystemFeatures>); + + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future scanInvert(bool? isScanInvert) => (super.noSuchMethod( + Invocation.method( + #scanInvert, + [isScanInvert], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [CommentService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCommentService extends _i2.Mock implements _i36.CommentService { + @override + _i5.Future createComments( + String? postId, + String? text, + ) => + (super.noSuchMethod( + Invocation.method( + #createComments, + [ + postId, + text, + ], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future> getCommentsForPost(String? postId) => + (super.noSuchMethod( + Invocation.method( + #getCommentsForPost, + [postId], + ), + returnValue: _i5.Future>.value([]), + returnValueForMissingStub: _i5.Future>.value([]), + ) as _i5.Future>); +} + +/// A class which mocks [AppTheme]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockAppTheme extends _i2.Mock implements _i37.AppTheme { + @override + String get key => (super.noSuchMethod( + Invocation.getter(#key), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#key), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#key), + ), + ) as String); + + @override + bool get isdarkTheme => (super.noSuchMethod( + Invocation.getter(#isdarkTheme), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + _i1.ThemeData get theme => (super.noSuchMethod( + Invocation.getter(#theme), + returnValue: _FakeThemeData_21( + this, + Invocation.getter(#theme), + ), + returnValueForMissingStub: _FakeThemeData_21( + this, + Invocation.getter(#theme), + ), + ) as _i1.ThemeData); + + @override + _i14.ViewState get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _i14.ViewState.idle, + returnValueForMissingStub: _i14.ViewState.idle, + ) as _i14.ViewState); + + @override + bool get isBusy => (super.noSuchMethod( + Invocation.getter(#isBusy), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + void initialize() => super.noSuchMethod( + Invocation.method( + #initialize, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void switchTheme({required bool? isOn}) => super.noSuchMethod( + Invocation.method( + #switchTheme, + [], + {#isOn: isOn}, + ), + returnValueForMissingStub: null, + ); + + @override + void setState(_i14.ViewState? viewState) => super.noSuchMethod( + Invocation.method( + #setState, + [viewState], + ), + returnValueForMissingStub: null, + ); + + @override + void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i10.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 [CreateEventViewModel]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCreateEventViewModel extends _i2.Mock + implements _i38.CreateEventViewModel { + @override + _i1.TextEditingController get eventTitleTextController => (super.noSuchMethod( + Invocation.getter(#eventTitleTextController), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#eventTitleTextController), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#eventTitleTextController), + ), + ) as _i1.TextEditingController); + + @override + set eventTitleTextController( + _i1.TextEditingController? _eventTitleTextController) => + super.noSuchMethod( + Invocation.setter( + #eventTitleTextController, + _eventTitleTextController, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get eventLocationTextController => + (super.noSuchMethod( + Invocation.getter(#eventLocationTextController), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#eventLocationTextController), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#eventLocationTextController), + ), + ) as _i1.TextEditingController); + + @override + set eventLocationTextController( + _i1.TextEditingController? _eventLocationTextController) => + super.noSuchMethod( + Invocation.setter( + #eventLocationTextController, + _eventLocationTextController, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get eventDescriptionTextController => + (super.noSuchMethod( + Invocation.getter(#eventDescriptionTextController), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#eventDescriptionTextController), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#eventDescriptionTextController), + ), + ) as _i1.TextEditingController); + + @override + set eventDescriptionTextController( + _i1.TextEditingController? _eventDescriptionTextController) => + super.noSuchMethod( + Invocation.setter( + #eventDescriptionTextController, + _eventDescriptionTextController, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get repeatsEveryCountController => + (super.noSuchMethod( + Invocation.getter(#repeatsEveryCountController), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#repeatsEveryCountController), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#repeatsEveryCountController), + ), + ) as _i1.TextEditingController); + + @override + set repeatsEveryCountController( + _i1.TextEditingController? _repeatsEveryCountController) => + super.noSuchMethod( + Invocation.setter( + #repeatsEveryCountController, + _repeatsEveryCountController, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TextEditingController get endOccurenceController => (super.noSuchMethod( + Invocation.getter(#endOccurenceController), + returnValue: _FakeTextEditingController_17( + this, + Invocation.getter(#endOccurenceController), + ), + returnValueForMissingStub: _FakeTextEditingController_17( + this, + Invocation.getter(#endOccurenceController), + ), + ) as _i1.TextEditingController); + + @override + set endOccurenceController( + _i1.TextEditingController? _endOccurenceController) => + super.noSuchMethod( + Invocation.setter( + #endOccurenceController, + _endOccurenceController, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TimeOfDay get eventStartTime => (super.noSuchMethod( + Invocation.getter(#eventStartTime), + returnValue: _FakeTimeOfDay_22( + this, + Invocation.getter(#eventStartTime), + ), + returnValueForMissingStub: _FakeTimeOfDay_22( + this, + Invocation.getter(#eventStartTime), + ), + ) as _i1.TimeOfDay); + + @override + set eventStartTime(_i1.TimeOfDay? _eventStartTime) => super.noSuchMethod( + Invocation.setter( + #eventStartTime, + _eventStartTime, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.TimeOfDay get eventEndTime => (super.noSuchMethod( + Invocation.getter(#eventEndTime), + returnValue: _FakeTimeOfDay_22( + this, + Invocation.getter(#eventEndTime), + ), + returnValueForMissingStub: _FakeTimeOfDay_22( + this, + Invocation.getter(#eventEndTime), + ), + ) as _i1.TimeOfDay); + + @override + set eventEndTime(_i1.TimeOfDay? _eventEndTime) => super.noSuchMethod( + Invocation.setter( + #eventEndTime, + _eventEndTime, + ), + returnValueForMissingStub: null, + ); + + @override + DateTime get eventStartDate => (super.noSuchMethod( + Invocation.getter(#eventStartDate), + returnValue: _FakeDateTime_23( + this, + Invocation.getter(#eventStartDate), + ), + returnValueForMissingStub: _FakeDateTime_23( + this, + Invocation.getter(#eventStartDate), + ), + ) as DateTime); + + @override + set eventStartDate(DateTime? _eventStartDate) => super.noSuchMethod( + Invocation.setter( + #eventStartDate, + _eventStartDate, + ), + returnValueForMissingStub: null, + ); + + @override + DateTime get eventEndDate => (super.noSuchMethod( + Invocation.getter(#eventEndDate), + returnValue: _FakeDateTime_23( + this, + Invocation.getter(#eventEndDate), + ), + returnValueForMissingStub: _FakeDateTime_23( + this, + Invocation.getter(#eventEndDate), + ), + ) as DateTime); + + @override + set eventEndDate(DateTime? _eventEndDate) => super.noSuchMethod( + Invocation.setter( + #eventEndDate, + _eventEndDate, + ), + returnValueForMissingStub: null, + ); + + @override + DateTime get recurrenceStartDate => (super.noSuchMethod( + Invocation.getter(#recurrenceStartDate), + returnValue: _FakeDateTime_23( + this, + Invocation.getter(#recurrenceStartDate), + ), + returnValueForMissingStub: _FakeDateTime_23( + this, + Invocation.getter(#recurrenceStartDate), + ), + ) as DateTime); + + @override + set recurrenceStartDate(DateTime? _recurrenceStartDate) => super.noSuchMethod( + Invocation.setter( + #recurrenceStartDate, + _recurrenceStartDate, + ), + returnValueForMissingStub: null, + ); + + @override + set recurrenceEndDate(DateTime? _recurrenceEndDate) => super.noSuchMethod( + Invocation.setter( + #recurrenceEndDate, + _recurrenceEndDate, + ), + returnValueForMissingStub: null, + ); + + @override + bool get isPublicSwitch => (super.noSuchMethod( + Invocation.getter(#isPublicSwitch), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set isPublicSwitch(bool? _isPublicSwitch) => super.noSuchMethod( + Invocation.setter( + #isPublicSwitch, + _isPublicSwitch, + ), + returnValueForMissingStub: null, + ); + + @override + bool get isRegisterableSwitch => (super.noSuchMethod( + Invocation.getter(#isRegisterableSwitch), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set isRegisterableSwitch(bool? _isRegisterableSwitch) => super.noSuchMethod( + Invocation.setter( + #isRegisterableSwitch, + _isRegisterableSwitch, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.FocusNode get titleFocus => (super.noSuchMethod( + Invocation.getter(#titleFocus), + returnValue: _FakeFocusNode_18( + this, + Invocation.getter(#titleFocus), + ), + returnValueForMissingStub: _FakeFocusNode_18( + this, + Invocation.getter(#titleFocus), + ), + ) as _i1.FocusNode); + + @override + set titleFocus(_i1.FocusNode? _titleFocus) => super.noSuchMethod( + Invocation.setter( + #titleFocus, + _titleFocus, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.FocusNode get locationFocus => (super.noSuchMethod( + Invocation.getter(#locationFocus), + returnValue: _FakeFocusNode_18( + this, + Invocation.getter(#locationFocus), + ), + returnValueForMissingStub: _FakeFocusNode_18( + this, + Invocation.getter(#locationFocus), + ), + ) as _i1.FocusNode); + + @override + set locationFocus(_i1.FocusNode? _locationFocus) => super.noSuchMethod( + Invocation.setter( + #locationFocus, + _locationFocus, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.FocusNode get descriptionFocus => (super.noSuchMethod( + Invocation.getter(#descriptionFocus), + returnValue: _FakeFocusNode_18( + this, + Invocation.getter(#descriptionFocus), + ), + returnValueForMissingStub: _FakeFocusNode_18( + this, + Invocation.getter(#descriptionFocus), + ), + ) as _i1.FocusNode); + + @override + set descriptionFocus(_i1.FocusNode? _descriptionFocus) => super.noSuchMethod( + Invocation.setter( + #descriptionFocus, + _descriptionFocus, + ), + returnValueForMissingStub: null, + ); + + @override + bool get isAllDay => (super.noSuchMethod( + Invocation.getter(#isAllDay), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set isAllDay(bool? _isAllDay) => super.noSuchMethod( + Invocation.setter( + #isAllDay, + _isAllDay, + ), + returnValueForMissingStub: null, + ); + + @override + bool get isRecurring => (super.noSuchMethod( + Invocation.getter(#isRecurring), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set isRecurring(bool? _isRecurring) => super.noSuchMethod( + Invocation.setter( + #isRecurring, + _isRecurring, + ), + returnValueForMissingStub: null, + ); + + @override + String get recurrenceInterval => (super.noSuchMethod( + Invocation.getter(#recurrenceInterval), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#recurrenceInterval), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#recurrenceInterval), + ), + ) as String); + + @override + set recurrenceInterval(String? _recurrenceInterval) => super.noSuchMethod( + Invocation.setter( + #recurrenceInterval, + _recurrenceInterval, + ), + returnValueForMissingStub: null, + ); + + @override + String get eventEndType => (super.noSuchMethod( + Invocation.getter(#eventEndType), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#eventEndType), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#eventEndType), + ), + ) as String); + + @override + set eventEndType(String? _eventEndType) => super.noSuchMethod( + Invocation.setter( + #eventEndType, + _eventEndType, + ), + returnValueForMissingStub: null, + ); + + @override + String get frequency => (super.noSuchMethod( + Invocation.getter(#frequency), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#frequency), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#frequency), + ), + ) as String); + + @override + set frequency(String? _frequency) => super.noSuchMethod( + Invocation.setter( + #frequency, + _frequency, + ), + returnValueForMissingStub: null, + ); + + @override + Set get weekDays => (super.noSuchMethod( + Invocation.getter(#weekDays), + returnValue: {}, + returnValueForMissingStub: {}, + ) as Set); + + @override + set weekDays(Set? _weekDays) => super.noSuchMethod( + Invocation.setter( + #weekDays, + _weekDays, + ), + returnValueForMissingStub: null, + ); + + @override + int get interval => (super.noSuchMethod( + Invocation.getter(#interval), + returnValue: 0, + returnValueForMissingStub: 0, + ) as int); + + @override + set interval(int? _interval) => super.noSuchMethod( + Invocation.setter( + #interval, + _interval, + ), + returnValueForMissingStub: null, + ); + + @override + set count(int? _count) => super.noSuchMethod( + Invocation.setter( + #count, + _count, + ), + returnValueForMissingStub: null, + ); + + @override + set weekDayOccurenceInMonth(int? _weekDayOccurenceInMonth) => + super.noSuchMethod( + Invocation.setter( + #weekDayOccurenceInMonth, + _weekDayOccurenceInMonth, + ), + returnValueForMissingStub: null, + ); + + @override + String get recurrenceLabel => (super.noSuchMethod( + Invocation.getter(#recurrenceLabel), + returnValue: _i18.dummyValue( + this, + Invocation.getter(#recurrenceLabel), + ), + returnValueForMissingStub: _i18.dummyValue( + this, + Invocation.getter(#recurrenceLabel), + ), + ) as String); + + @override + set recurrenceLabel(String? _recurrenceLabel) => super.noSuchMethod( + Invocation.setter( + #recurrenceLabel, + _recurrenceLabel, + ), + returnValueForMissingStub: null, + ); + + @override + List<_i7.User> get orgMembersList => (super.noSuchMethod( + Invocation.getter(#orgMembersList), + returnValue: <_i7.User>[], + returnValueForMissingStub: <_i7.User>[], + ) as List<_i7.User>); + + @override + set orgMembersList(List<_i7.User>? _orgMembersList) => super.noSuchMethod( + Invocation.setter( + #orgMembersList, + _orgMembersList, + ), + returnValueForMissingStub: null, + ); + + @override + _i1.GlobalKey<_i1.FormState> get formKey => (super.noSuchMethod( + Invocation.getter(#formKey), + returnValue: _FakeGlobalKey_0<_i1.FormState>( + this, + Invocation.getter(#formKey), + ), + returnValueForMissingStub: _FakeGlobalKey_0<_i1.FormState>( + this, + Invocation.getter(#formKey), + ), + ) as _i1.GlobalKey<_i1.FormState>); + + @override + _i1.AutovalidateMode get validate => (super.noSuchMethod( + Invocation.getter(#validate), + returnValue: _i1.AutovalidateMode.disabled, + returnValueForMissingStub: _i1.AutovalidateMode.disabled, + ) as _i1.AutovalidateMode); + + @override + set validate(_i1.AutovalidateMode? _validate) => super.noSuchMethod( + Invocation.setter( + #validate, + _validate, + ), + returnValueForMissingStub: null, + ); + + @override + List<_i7.User> get selectedMembers => (super.noSuchMethod( + Invocation.getter(#selectedMembers), + returnValue: <_i7.User>[], + returnValueForMissingStub: <_i7.User>[], + ) as List<_i7.User>); + + @override + Map get memberCheckedMap => (super.noSuchMethod( + Invocation.getter(#memberCheckedMap), + returnValue: {}, + returnValueForMissingStub: {}, + ) as Map); + + @override + _i14.ViewState get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _i14.ViewState.idle, + returnValueForMissingStub: _i14.ViewState.idle, + ) as _i14.ViewState); + + @override + bool get isBusy => (super.noSuchMethod( + Invocation.getter(#isBusy), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + void initialize() => super.noSuchMethod( + Invocation.method( + #initialize, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future createEvent() => (super.noSuchMethod( + Invocation.method( + #createEvent, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future getImageFromGallery({bool? camera = false}) => + (super.noSuchMethod( + Invocation.method( + #getImageFromGallery, + [], + {#camera: camera}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void removeImage() => super.noSuchMethod( + Invocation.method( + #removeImage, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future> getCurrentOrgUsersList() => (super.noSuchMethod( + Invocation.method( + #getCurrentOrgUsersList, + [], + ), + returnValue: _i5.Future>.value(<_i7.User>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i7.User>[]), + ) as _i5.Future>); + + @override + void buildUserList() => super.noSuchMethod( + Invocation.method( + #buildUserList, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void removeUserFromList({required String? userId}) => super.noSuchMethod( + Invocation.method( + #removeUserFromList, + [], + {#userId: userId}, + ), + returnValueForMissingStub: null, + ); + + @override + void setEventEndDate(DateTime? selectedEndDate) => super.noSuchMethod( + Invocation.method( + #setEventEndDate, + [selectedEndDate], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future> fetchVenues() => (super.noSuchMethod( + Invocation.method( + #fetchVenues, + [], + ), + returnValue: _i5.Future>.value(<_i39.Venue>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i39.Venue>[]), + ) as _i5.Future>); + + @override + void setState(_i14.ViewState? viewState) => super.noSuchMethod( + Invocation.method( + #setState, + [viewState], + ), + returnValueForMissingStub: null, + ); + + @override + void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i10.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 [DirectChatViewModel]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockDirectChatViewModel extends _i2.Mock + implements _i40.DirectChatViewModel { + @override + _i1.GlobalKey<_i1.AnimatedListState> get listKey => (super.noSuchMethod( + Invocation.getter(#listKey), + returnValue: _FakeGlobalKey_0<_i1.AnimatedListState>( + this, + Invocation.getter(#listKey), + ), + returnValueForMissingStub: _FakeGlobalKey_0<_i1.AnimatedListState>( + this, + Invocation.getter(#listKey), + ), + ) as _i1.GlobalKey<_i1.AnimatedListState>); + + @override + _i14.ChatState get chatState => (super.noSuchMethod( + Invocation.getter(#chatState), + returnValue: _i14.ChatState.initial, + returnValueForMissingStub: _i14.ChatState.initial, + ) as _i14.ChatState); + + @override + set chatState(_i14.ChatState? _chatState) => super.noSuchMethod( + Invocation.setter( + #chatState, + _chatState, + ), + returnValueForMissingStub: null, + ); + + @override + set name(String? _name) => super.noSuchMethod( + Invocation.setter( + #name, + _name, + ), + returnValueForMissingStub: null, + ); + + @override + List<_i24.ChatListTileDataModel> get chats => (super.noSuchMethod( + Invocation.getter(#chats), + returnValue: <_i24.ChatListTileDataModel>[], + returnValueForMissingStub: <_i24.ChatListTileDataModel>[], + ) as List<_i24.ChatListTileDataModel>); + + @override + Map> get chatMessagesByUser => + (super.noSuchMethod( + Invocation.getter(#chatMessagesByUser), + returnValue: >{}, + returnValueForMissingStub: >{}, + ) as Map>); + + @override + _i14.ViewState get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _i14.ViewState.idle, + returnValueForMissingStub: _i14.ViewState.idle, + ) as _i14.ViewState); + + @override + bool get isBusy => (super.noSuchMethod( + Invocation.getter(#isBusy), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + void refreshChats() => super.noSuchMethod( + Invocation.method( + #refreshChats, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future initialise() => (super.noSuchMethod( + Invocation.method( + #initialise, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future getChatMessages(String? chatId) => (super.noSuchMethod( + Invocation.method( + #getChatMessages, + [chatId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future sendMessageToDirectChat( + String? chatId, + String? messageContent, + ) => + (super.noSuchMethod( + Invocation.method( + #sendMessageToDirectChat, + [ + chatId, + messageContent, + ], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void chatName(dynamic chatId) => super.noSuchMethod( + Invocation.method( + #chatName, + [chatId], + ), + returnValueForMissingStub: null, + ); + + @override + void setState(_i14.ViewState? viewState) => super.noSuchMethod( + Invocation.method( + #setState, + [viewState], + ), + returnValueForMissingStub: null, + ); + + @override + void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #removeListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void notifyListeners() => super.noSuchMethod( + Invocation.method( + #notifyListeners, + [], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [ImageCropper]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockImageCropper extends _i2.Mock implements _i41.ImageCropper { + @override + _i5.Future<_i42.CroppedFile?> cropImage({ + required String? sourcePath, + int? maxWidth, + int? maxHeight, + _i42.CropAspectRatio? aspectRatio, + List<_i42.CropAspectRatioPreset>? aspectRatioPresets = const [ + _i42.CropAspectRatioPreset.original, + _i42.CropAspectRatioPreset.square, + _i42.CropAspectRatioPreset.ratio3x2, + _i42.CropAspectRatioPreset.ratio4x3, + _i42.CropAspectRatioPreset.ratio16x9, + ], + _i42.CropStyle? cropStyle = _i42.CropStyle.rectangle, + _i42.ImageCompressFormat? compressFormat = _i42.ImageCompressFormat.jpg, + int? compressQuality = 90, + List<_i42.PlatformUiSettings>? uiSettings, + }) => + (super.noSuchMethod( + Invocation.method( + #cropImage, + [], + { + #sourcePath: sourcePath, + #maxWidth: maxWidth, + #maxHeight: maxHeight, + #aspectRatio: aspectRatio, + #aspectRatioPresets: aspectRatioPresets, + #cropStyle: cropStyle, + #compressFormat: compressFormat, + #compressQuality: compressQuality, + #uiSettings: uiSettings, + }, + ), + returnValue: _i5.Future<_i42.CroppedFile?>.value(), + returnValueForMissingStub: _i5.Future<_i42.CroppedFile?>.value(), + ) as _i5.Future<_i42.CroppedFile?>); + + @override + _i5.Future<_i42.CroppedFile?> recoverImage() => (super.noSuchMethod( + Invocation.method( + #recoverImage, + [], + ), + returnValue: _i5.Future<_i42.CroppedFile?>.value(), + returnValueForMissingStub: _i5.Future<_i42.CroppedFile?>.value(), + ) as _i5.Future<_i42.CroppedFile?>); +} + +/// A class which mocks [ImagePicker]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockImagePicker extends _i2.Mock implements _i13.ImagePicker { + @override + _i5.Future<_i13.XFile?> pickImage({ + required _i13.ImageSource? source, + double? maxWidth, + double? maxHeight, + int? imageQuality, + _i13.CameraDevice? preferredCameraDevice = _i13.CameraDevice.rear, + bool? requestFullMetadata = true, + }) => + (super.noSuchMethod( + Invocation.method( + #pickImage, + [], + { + #source: source, + #maxWidth: maxWidth, + #maxHeight: maxHeight, + #imageQuality: imageQuality, + #preferredCameraDevice: preferredCameraDevice, + #requestFullMetadata: requestFullMetadata, + }, + ), + returnValue: _i5.Future<_i13.XFile?>.value(), + returnValueForMissingStub: _i5.Future<_i13.XFile?>.value(), + ) as _i5.Future<_i13.XFile?>); + + @override + _i5.Future> pickMultiImage({ + double? maxWidth, + double? maxHeight, + int? imageQuality, + int? limit, + bool? requestFullMetadata = true, + }) => + (super.noSuchMethod( + Invocation.method( + #pickMultiImage, + [], + { + #maxWidth: maxWidth, + #maxHeight: maxHeight, + #imageQuality: imageQuality, + #limit: limit, + #requestFullMetadata: requestFullMetadata, + }, + ), + returnValue: _i5.Future>.value(<_i13.XFile>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i13.XFile>[]), + ) as _i5.Future>); + + @override + _i5.Future<_i13.XFile?> pickMedia({ + double? maxWidth, + double? maxHeight, + int? imageQuality, + bool? requestFullMetadata = true, + }) => + (super.noSuchMethod( + Invocation.method( + #pickMedia, + [], + { + #maxWidth: maxWidth, + #maxHeight: maxHeight, + #imageQuality: imageQuality, + #requestFullMetadata: requestFullMetadata, + }, + ), + returnValue: _i5.Future<_i13.XFile?>.value(), + returnValueForMissingStub: _i5.Future<_i13.XFile?>.value(), + ) as _i5.Future<_i13.XFile?>); + + @override + _i5.Future> pickMultipleMedia({ + double? maxWidth, + double? maxHeight, + int? imageQuality, + int? limit, + bool? requestFullMetadata = true, + }) => + (super.noSuchMethod( + Invocation.method( + #pickMultipleMedia, + [], + { + #maxWidth: maxWidth, + #maxHeight: maxHeight, + #imageQuality: imageQuality, + #limit: limit, + #requestFullMetadata: requestFullMetadata, + }, + ), + returnValue: _i5.Future>.value(<_i13.XFile>[]), + returnValueForMissingStub: + _i5.Future>.value(<_i13.XFile>[]), + ) as _i5.Future>); + + @override + _i5.Future<_i13.XFile?> pickVideo({ + required _i13.ImageSource? source, + _i13.CameraDevice? preferredCameraDevice = _i13.CameraDevice.rear, + Duration? maxDuration, + }) => + (super.noSuchMethod( + Invocation.method( + #pickVideo, + [], + { + #source: source, + #preferredCameraDevice: preferredCameraDevice, + #maxDuration: maxDuration, + }, + ), + returnValue: _i5.Future<_i13.XFile?>.value(), + returnValueForMissingStub: _i5.Future<_i13.XFile?>.value(), + ) as _i5.Future<_i13.XFile?>); + + @override + _i5.Future<_i13.LostDataResponse> retrieveLostData() => (super.noSuchMethod( + Invocation.method( + #retrieveLostData, + [], + ), + returnValue: + _i5.Future<_i13.LostDataResponse>.value(_FakeLostDataResponse_24( + this, + Invocation.method( + #retrieveLostData, + [], + ), + )), + returnValueForMissingStub: + _i5.Future<_i13.LostDataResponse>.value(_FakeLostDataResponse_24( + this, + Invocation.method( + #retrieveLostData, + [], + ), + )), + ) as _i5.Future<_i13.LostDataResponse>); + + @override + bool supportsImageSource(_i13.ImageSource? source) => (super.noSuchMethod( + Invocation.method( + #supportsImageSource, + [source], + ), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); +} diff --git a/test/helpers/test_locator.dart b/test/helpers/test_locator.dart new file mode 100644 index 000000000..5d0b80a7f --- /dev/null +++ b/test/helpers/test_locator.dart @@ -0,0 +1,152 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:get_it/get_it.dart'; +import 'package:image_cropper/image_cropper.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:talawa/main.dart'; +import 'package:talawa/services/caching/cache_service.dart'; +import 'package:talawa/services/comment_service.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/image_service.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/org_service.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/session_manager.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/third_party_service/connectivity_service.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/services/user_action_handler.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/services/user_profile_service.dart'; +import 'package:talawa/utils/queries.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/chat_view_models/select_contact_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/settings_view_models/app_setting_view_model.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/login_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/set_url_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/signup_details_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/waiting_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/comments_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/progress_dialog_view_model.dart'; + +GetIt locator = GetIt.instance; +final userConfig = locator(); +final navigationService = locator(); +final databaseFunctions = locator(); +final graphqlConfig = locator(); +final sizeConfig = locator(); +final queries = locator(); +final appLanguageService = locator(); +final multimediaPickerService = locator(); +final organizationService = locator(); +final eventService = locator(); +final commentsService = locator(); +final connectivity = locator(); +final connectivityService = locator(); +final cacheService = locator(); +final postService = locator(); +final mainScreenViewModel = locator(); +final imageService = locator(); +final imagePicker = locator(); +final imageCropper = locator(); +final sessionManager = locator(); +final actionHandlerService = locator(); + +void testSetupLocator() { + locator.registerSingleton(CacheService()); + + locator.registerSingleton(DataBaseMutationFunctions()); + + locator.registerSingleton(GraphqlConfig()); + + //services + locator.registerSingleton(NavigationService()); + + //sizeConfig + locator.registerSingleton(SizeConfig()); + + //userConfig + locator.registerSingleton(UserConfig()); + + locator.registerSingleton(SessionManager()); + + //Services + locator.registerLazySingleton(() => OrganizationService()); + locator.registerLazySingleton(() => PostService()); + locator.registerLazySingleton(() => EventService()); + locator.registerLazySingleton(() => CommentService()); + locator.registerLazySingleton(() => Connectivity()); + locator.registerLazySingleton(() => MultiMediaPickerService()); + locator.registerLazySingleton(() => ImageService()); + locator.registerLazySingleton(() => ImagePicker()); + locator.registerLazySingleton(() => ImageCropper()); + locator.registerSingleton(() => OrganizationService()); + + //graphql + + //databaseMutationFunction + + locator.registerSingleton(ConnectivityService()); + + //queries + locator.registerSingleton(Queries()); + + locator.registerSingleton(ActionHandlerService()); + + locator.registerFactory(() => AppConnectivity()); + + //Page viewModels + locator.registerFactory(() => DemoViewModel()); + // locator.registerFactory(() => OrganizationFeedViewModel()); + locator.registerFactory(() => OrganizationFeedViewModel()); + locator.registerFactory(() => SetUrlViewModel()); + locator.registerFactory(() => LoginViewModel()); + locator.registerFactory(() => ManageVolunteerGroupViewModel()); + locator.registerFactory(() => EditAgendaItemViewModel()); + locator.registerFactory(() => SelectOrganizationViewModel()); + locator.registerFactory(() => AccessScreenViewModel()); + locator.registerFactory(() => SignupDetailsViewModel()); + locator.registerFactory(() => WaitingViewModel()); + locator.registerFactory(() => ExploreEventsViewModel()); + locator.registerFactory(() => MainScreenViewModel()); + locator.registerFactory(() => ProfilePageViewModel()); + locator.registerFactory(() => EditProfilePageViewModel()); + locator.registerFactory(() => CreateEventViewModel()); + locator.registerFactory(() => EditEventViewModel()); + locator.registerFactory(() => AddPostViewModel()); + locator.registerFactory(() => EventInfoViewModel()); + locator.registerFactory(() => AppSettingViewModel()); + + //Widgets viewModels + locator.registerFactory(() => ProgressDialogViewModel()); + locator.registerFactory(() => CustomDrawerViewModel()); + locator.registerFactory(() => LikeButtonViewModel()); + locator.registerFactory(() => AppLanguage(isTest: true)); + locator.registerFactory(() => CommentsViewModel()); + locator.registerFactory(() => AppTheme()); + locator.registerFactory(() => DirectChatViewModel()); + locator.registerFactory(() => SelectContactViewModel()); + locator.registerFactory(() => UserProfileService()); +} diff --git a/test/model_tests/app_tour_test.dart b/test/model_tests/app_tour_test.dart new file mode 100644 index 000000000..f9985ee97 --- /dev/null +++ b/test/model_tests/app_tour_test.dart @@ -0,0 +1,256 @@ +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:talawa/locator.dart'; +import 'package:talawa/models/app_tour.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +class CustomTutorialController extends TutorialCoachMarkController { + @override + void next() {} + + @override + void previous() {} + + @override + void skip() {} +} + +class MockTutorialCoachMark extends Mock implements TutorialCoachMark { + @override + void next() {} +} + +class MockAppTour extends Mock implements AppTour { + MockAppTour({ + required this.model, + }); + + @override + TutorialCoachMark get tutorialCoachMark => MockTutorialCoachMark(); + + @override + void showTutorial({ + required Function(TargetFocus p1) onClickTarget, + required Function() onFinish, + required List targets, + }) { + onFinish(); + onClickTarget( + TargetFocus( + identify: MainScreenViewModel.keyDrawerCurOrg, + keyTarget: model.keyBNChat, + ), + ); + } + + @override + MainScreenViewModel model; +} + +/// Creates a MaterialApp widget with the given home widget and common localizations. +/// +/// **params**: +/// * `home`: The home widget of the MaterialApp. +/// +/// **returns**: +/// * `MaterialApp`: The MaterialApp widget. +/// +MaterialApp createMaterialApp({required Widget home}) { + return MaterialApp( + home: home, + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + supportedLocales: const [ + Locale('en', ''), + ], + ); +} + +void main() { + setUpAll(() { + setupLocator(); + sizeConfig.test(); + }); + + group('Tests for FocusTarget', () { + testWidgets('Test for first TargetContent builder in FocusTarget model.', + (tester) async { + AppTour? mockAppTour; + FocusTarget? mockFocusTarget; + BuildContext? capturedContext; + final app = BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: BaseView( + onModelReady: (model2) => model2.initialise( + context, + fromSignUp: false, + mainScreenIndex: 0, + demoMode: true, + testMode: true, + ), + builder: (context, model2, child) { + capturedContext = context; + mockAppTour = AppTour(model: model2); + mockFocusTarget = FocusTarget( + key: MainScreenViewModel.keyDrawerLeaveCurrentOrg, + keyName: 'keyDrawerLeaveCurrentOrg', + description: 'description', + next: () {}, + appTour: mockAppTour!, + ); + // SizeConfig().init(context); + model2.context = context; + return Scaffold( + drawer: const Drawer(), + key: MainScreenViewModel.scaffoldKey, + body: TextButton( + key: MainScreenViewModel.keyDrawerLeaveCurrentOrg, + child: const Text('tutorial'), + onPressed: () { + MainScreenViewModel.scaffoldKey.currentState! + .openDrawer(); + mockAppTour!.showTutorial( + onClickTarget: (x) {}, + onFinish: () {}, + targets: [ + mockFocusTarget!, + ], + ); + }, + ), + ); + }, + ), + navigatorKey: navigationService.navigatorKey, + // onGenerateRoute: router.generateRoute, + ); + }, + ); + + await tester.pumpWidget(app); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + final tutorialBtn = + find.byKey(MainScreenViewModel.keyDrawerLeaveCurrentOrg); + + expect(tutorialBtn, findsOneWidget); + + (tester.widget(tutorialBtn) as TextButton).onPressed!(); + await tester.pumpAndSettle(); + + expect( + mockFocusTarget!.focusWidget.contents![0].builder!( + capturedContext!, + CustomTutorialController(), + ) as Container, + isA(), + ); + }); + + testWidgets('Test for showTutorial method.', (tester) async { + AppTour? mockAppTour; + FocusTarget? mockFocusTarget; + BuildContext? capturedContext; + final app = BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: BaseView( + onModelReady: (model2) => model2.initialise( + context, + fromSignUp: false, + mainScreenIndex: 0, + demoMode: true, + testMode: true, + ), + builder: (context, model2, child) { + capturedContext = context; + mockAppTour = AppTour(model: model2); + mockFocusTarget = FocusTarget( + key: MainScreenViewModel.keyDrawerLeaveCurrentOrg, + keyName: 'keyDrawerLeaveCurrentOrg', + description: 'description', + next: () {}, + appTour: mockAppTour!, + ); + // SizeConfig().init(context); + model2.context = context; + return Scaffold( + drawer: const Drawer(), + key: MainScreenViewModel.scaffoldKey, + body: TextButton( + key: MainScreenViewModel.keyDrawerLeaveCurrentOrg, + child: const Text('tutorial'), + onPressed: () { + MainScreenViewModel.scaffoldKey.currentState! + .openDrawer(); + mockAppTour!.showTutorial( + onClickTarget: (x) {}, + onFinish: () {}, + targets: [ + mockFocusTarget!, + ], + ); + }, + ), + ); + }, + ), + navigatorKey: navigationService.navigatorKey, + // onGenerateRoute: router.generateRoute, + ); + }, + ); + + await tester.pumpWidget(app); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + final tutorialBtn = + find.byKey(MainScreenViewModel.keyDrawerLeaveCurrentOrg); + + expect(tutorialBtn, findsOneWidget); + + (tester.widget(tutorialBtn) as TextButton).onPressed!(); + await tester.pumpAndSettle(); + + mockAppTour!.tutorialCoachMark.onSkip!(); + mockAppTour!.tutorialCoachMark.onClickOverlay!( + TargetFocus( + identify: MainScreenViewModel.keyDrawerCurOrg, + keyTarget: MainScreenViewModel.keyDrawerCurOrg, + ), + ); + + (mockFocusTarget!.focusWidget.contents![1].builder!( + capturedContext!, + CustomTutorialController(), + ) as GestureDetector) + .onTap!(); + }); + }); +} diff --git a/test/model_tests/caching/cached_user_action_test.dart b/test/model_tests/caching/cached_user_action_test.dart new file mode 100644 index 000000000..b15c4113d --- /dev/null +++ b/test/model_tests/caching/cached_user_action_test.dart @@ -0,0 +1,244 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; + +import 'package:mockito/mockito.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/caching/cached_user_action.dart'; +import 'package:talawa/services/caching/offline_action_queue.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +class MockBinaryReader extends Mock implements BinaryReader {} + +void main() { + late final Box cacheBox; + setUpAll(() async { + testSetupLocator(); + getAndRegisterDatabaseMutationFunctions(); + cacheBox = Hive.box(OfflineActionQueue.boxName); + }); + + group('CachedUserAction', () { + test('should create an instance of CachedUserAction', () { + final action = CachedUserAction( + id: '123', + operation: 'testOperation', + timeStamp: DateTime.parse('2024-07-12T12:34:56Z'), + expiry: DateTime.parse('2024-07-13T12:34:56Z'), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlAuthQuery, + ); + + expect(action.id, '123'); + expect(action.operation, 'testOperation'); + expect(action.timeStamp, DateTime.parse('2024-07-12T12:34:56Z')); + expect(action.expiry, DateTime.parse('2024-07-13T12:34:56Z')); + expect(action.status, CachedUserActionStatus.pending); + expect(action.operationType, CachedOperationType.gqlAuthQuery); + }); + + test('should execute gqlAuthQuery operation', () { + final action = CachedUserAction( + id: '123', + operation: 'testQuery', + timeStamp: DateTime.now(), + expiry: DateTime.now().add(const Duration(days: 1)), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlAuthQuery, + ); + + action.execute(); + + verify(databaseFunctions.gqlAuthQuery('testQuery', variables: null)) + .called(1); + }); + + test('should execute gqlAuthMutation operation', () { + final action = CachedUserAction( + id: '123', + operation: 'testMutation', + timeStamp: DateTime.now(), + expiry: DateTime.now().add(const Duration(days: 1)), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlAuthMutation, + ); + + action.execute(); + + verify(databaseFunctions.gqlAuthMutation('testMutation', variables: null)) + .called(1); + }); + + test('should execute gqlNonAuthQuery operation', () { + final action = CachedUserAction( + id: '123', + operation: 'testQuery', + timeStamp: DateTime.now(), + expiry: DateTime.now().add(const Duration(days: 1)), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlNonAuthQuery, + ); + + action.execute(); + + verify(databaseFunctions.gqlNonAuthQuery('testQuery', variables: null)) + .called(1); + }); + + test('should execute gqlNonAuthMutation operation', () { + final action = CachedUserAction( + id: '123', + operation: 'testMutation', + timeStamp: DateTime.now(), + expiry: DateTime.now().add(const Duration(days: 1)), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlNonAuthMutation, + ); + + action.execute(); + + verify( + databaseFunctions.gqlNonAuthMutation( + 'testMutation', + variables: null, + ), + ).called(1); + }); + + test('should handle unsupported operation type in execute', () { + final action = CachedUserAction( + id: '123', + operation: 'testOperation', + timeStamp: DateTime.now(), + expiry: DateTime.now().add(const Duration(days: 1)), + status: CachedUserActionStatus.pending, + operationType: + CachedOperationType.gqlAuthQuery, // Unsupported operation type + ); + + expect(() => action.execute(), returnsNormally); + }); + + test('should provide correct string representation', () { + final action = CachedUserAction( + id: '123', + operation: 'testOperation', + timeStamp: DateTime.parse('2024-07-12T12:34:56Z'), + expiry: DateTime.parse('2024-07-13T12:34:56Z'), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlAuthQuery, + variables: {'key': 'value'}, + metaData: {'info': 'metadata'}, + ); + + final json = action.toJson(); + CachedUserAction.fromJson(json); + + final stringRepresentation = action.toString(); + + expect(stringRepresentation, ''' + CachedUserAction( + id: 123, + operation: testOperation, + variables: {key: value}, + timeStamp: 2024-07-12 12:34:56.000Z, + expiry: 2024-07-13 12:34:56.000Z, + status: CachedUserActionStatus.pending, + metaData: {info: metadata}, + operationType: CachedOperationType.gqlAuthQuery, + ) + '''); + }); + + group('Enums test', () { + test('CachedUserAction Status', () async { + CachedUserAction resultAction; + + final action = CachedUserAction( + id: '123', + operation: 'testOperation', + timeStamp: DateTime.parse('2024-07-12T12:34:56Z'), + expiry: DateTime.parse('2024-07-13T12:34:56Z'), + status: CachedUserActionStatus.completed, + operationType: CachedOperationType.gqlAuthQuery, + variables: {'key': 'value'}, + metaData: {'info': 'metadata'}, + ); + await cacheBox.put(action.id, action); + resultAction = cacheBox.get(action.id)!; + resultAction.execute(); + }); + + test('CachedUserAction Operation Type', () async { + CachedUserAction resultAction; + final action1 = CachedUserAction( + id: '124', + operation: 'testOperation', + timeStamp: DateTime.parse('2024-07-12T12:34:56Z'), + expiry: DateTime.parse('2024-07-13T12:34:56Z'), + status: CachedUserActionStatus.completed, + operationType: CachedOperationType.gqlAuthMutation, + variables: {'key': 'value'}, + metaData: {'info': 'metadata'}, + ); + await cacheBox.put(action1.id, action1); + resultAction = cacheBox.get(action1.id)!; + + final action2 = CachedUserAction( + id: '125', + operation: 'testOperation', + timeStamp: DateTime.parse('2024-07-12T12:34:56Z'), + expiry: DateTime.parse('2024-07-13T12:34:56Z'), + status: CachedUserActionStatus.completed, + operationType: CachedOperationType.gqlNonAuthQuery, + variables: {'key': 'value'}, + metaData: {'info': 'metadata'}, + ); + await cacheBox.put(action2.id, action2); + resultAction = cacheBox.get(action2.id)!; + + final action3 = CachedUserAction( + id: '126', + operation: 'testOperation', + timeStamp: DateTime.parse('2024-07-12T12:34:56Z'), + expiry: DateTime.parse('2024-07-13T12:34:56Z'), + status: CachedUserActionStatus.completed, + operationType: CachedOperationType.gqlNonAuthMutation, + variables: {'key': 'value'}, + metaData: {'info': 'metadata'}, + ); + await cacheBox.put(action3.id, action3); + resultAction = cacheBox.get(action3.id)!; + print(resultAction); + resultAction.execute(); + }); + }); + + group('Test Adapters', () { + test('equality works correctly CachedUserActionStatusAdapter', () { + final adapter1 = CachedUserActionStatusAdapter(); + final adapter2 = CachedUserActionStatusAdapter(); + + expect(adapter1, equals(adapter2)); + expect(adapter1.hashCode, equals(adapter2.hashCode)); + }); + + test('equality works correctly CachedOperationTypeAdapter', () { + final adapter1 = CachedOperationTypeAdapter(); + final adapter2 = CachedOperationTypeAdapter(); + + expect(adapter1, equals(adapter2)); + expect(adapter1.hashCode, equals(adapter2.hashCode)); + }); + + test('equality works correctly CachedUserActionAdapter', () { + final adapter1 = CachedUserActionAdapter(); + final adapter2 = CachedUserActionAdapter(); + + expect(adapter1, equals(adapter2)); + expect(adapter1.hashCode, equals(adapter2.hashCode)); + }); + }); + }); +} diff --git a/test/model_tests/chat/chat_list_tile_data_model_test.dart b/test/model_tests/chat/chat_list_tile_data_model_test.dart new file mode 100644 index 000000000..5571f7aec --- /dev/null +++ b/test/model_tests/chat/chat_list_tile_data_model_test.dart @@ -0,0 +1,77 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/chats/chat_list_tile_data_model.dart'; +import 'package:talawa/models/chats/chat_user.dart'; + +/// function to check if the users are equal or not. +/// +/// **params**: +/// * `users1`: list of ChatUser +/// * `users2`: list of ChatUser +/// +/// **returns**: +/// None +void checkUsers(List? users1, List? users2) { + if (users1 == null || users2 == null) { + expect(users1, users2); + return; + } + + for (int index = 0; index < users1.length; index++) { + expect(users1[index].id, users2[index].id); + expect(users1[index].firstName, users2[index].firstName); + expect(users1[index].image, users2[index].image); + } +} + +void main() { + group('Test ChatListTileDataModel', () { + const int listLength = 4; + + final List users = List.generate(listLength, (index) { + return ChatUser( + id: '$index', + firstName: 'First$index', + image: 'Image$index', + ); + }); + + final ChatListTileDataModel chatListTileDataModel = ChatListTileDataModel( + users, + '123', + ); + + final Map json = { + 'id': '123', + 'users': List.generate(listLength, (index) { + return { + 'id': '$index', + 'firstName': 'First$index', + 'image': 'Image$index', + }; + }), + }; + + test('Test constructor', () { + expect(chatListTileDataModel.id, '123'); + checkUsers(chatListTileDataModel.users, users); + }); + + test('Test ChatListTileDataModel.fromJson', () { + final ChatListTileDataModel chatListTileDataModelFromJson = + ChatListTileDataModel.fromJson(json); + + expect(chatListTileDataModel.id, chatListTileDataModelFromJson.id); + checkUsers( + chatListTileDataModel.users, + chatListTileDataModelFromJson.users, + ); + }); + + test('Test toJson', () { + final Map json = chatListTileDataModel.toJson(); + + expect(json['id'], chatListTileDataModel.id); + checkUsers(json['users'] as List, chatListTileDataModel.users); + }); + }); +} diff --git a/test/model_tests/chat/chat_message_test.dart b/test/model_tests/chat/chat_message_test.dart new file mode 100644 index 000000000..972a9231a --- /dev/null +++ b/test/model_tests/chat/chat_message_test.dart @@ -0,0 +1,28 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/chats/chat_message.dart'; +import 'package:talawa/models/chats/chat_user.dart'; + +final chatUserOne = + ChatUser(firstName: 'Ravidi', id: '1', image: "https://testimg.com"); +final chatUserTwo = + ChatUser(firstName: 'Sheikh', id: '2', image: "https://testimg.com"); +void main() { + group("Tests for ChatMessage.dart", () { + test('check if ChatMessage JSON serialization works', () { + final message = + ChatMessage('1', chatUserOne, 'Hello, how are you?', chatUserTwo); + + final messageJson = message.toJson(); + + final messageFromJson = ChatMessage.fromJson(messageJson); + + expect(messageFromJson.id, message.id); + expect(messageFromJson.sender!.firstName, message.sender!.firstName); + expect(messageFromJson.receiver!.id, message.receiver!.id); + expect(messageFromJson.messageContent, message.messageContent); + }); + }); +} diff --git a/test/model_tests/chat/chat_user_test.dart b/test/model_tests/chat/chat_user_test.dart new file mode 100644 index 000000000..50430f830 --- /dev/null +++ b/test/model_tests/chat/chat_user_test.dart @@ -0,0 +1,27 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/chats/chat_user.dart'; + +void main() { + group('Test chat_user model', () { + final chatUser = ChatUser( + firstName: 'Ayush', + id: null, + image: 'random image url', + ); + final chatUserJson = { + 'firstName': 'Ayush', + 'id': null, + 'image': 'random image url', + }; + test('Test json to model', () { + final chatUserFromJson = ChatUser.fromJson(chatUserJson); + expect(chatUser.firstName, chatUserFromJson.firstName); + expect(chatUser.id, chatUserFromJson.id); + expect(chatUser.image, chatUserFromJson.image); + }); + test('Test model to json', () { + final json = chatUser.toJson(); + expect(json, chatUserJson); + }); + }); +} diff --git a/test/model_tests/chats/chat_message_test.dart b/test/model_tests/chats/chat_message_test.dart new file mode 100644 index 000000000..972a9231a --- /dev/null +++ b/test/model_tests/chats/chat_message_test.dart @@ -0,0 +1,28 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/chats/chat_message.dart'; +import 'package:talawa/models/chats/chat_user.dart'; + +final chatUserOne = + ChatUser(firstName: 'Ravidi', id: '1', image: "https://testimg.com"); +final chatUserTwo = + ChatUser(firstName: 'Sheikh', id: '2', image: "https://testimg.com"); +void main() { + group("Tests for ChatMessage.dart", () { + test('check if ChatMessage JSON serialization works', () { + final message = + ChatMessage('1', chatUserOne, 'Hello, how are you?', chatUserTwo); + + final messageJson = message.toJson(); + + final messageFromJson = ChatMessage.fromJson(messageJson); + + expect(messageFromJson.id, message.id); + expect(messageFromJson.sender!.firstName, message.sender!.firstName); + expect(messageFromJson.receiver!.id, message.receiver!.id); + expect(messageFromJson.messageContent, message.messageContent); + }); + }); +} diff --git a/test/model_tests/comment/comment_model_test.dart b/test/model_tests/comment/comment_model_test.dart new file mode 100644 index 000000000..40c95c0b7 --- /dev/null +++ b/test/model_tests/comment/comment_model_test.dart @@ -0,0 +1,79 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/models/comment/comment_model.dart'; +import 'package:talawa/models/user/user_info.dart'; + +void main() { + final comment = Comment( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + createdAt: '123456', + text: 'test text', + post: 'test post', + likeCount: 'test count', + ); + + final commentJson = { + 'creator': { + '_id': '123', + 'firstName': 'John', + 'lastName': 'Doe', + 'email': 'test@test.com', + }, + 'createdAt': '123456', + 'text': 'test text', + 'post': 'test post', + 'likeCount': 'test count', + }; + group('Test Comment model', () { + test('Test task json', () { + final commentFromJson = Comment.fromJson(commentJson); + expect(comment.creator?.id, commentFromJson.creator?.id); + expect(comment.creator?.firstName, commentFromJson.creator?.firstName); + expect(comment.creator?.lastName, commentFromJson.creator?.lastName); + expect(comment.creator?.email, commentFromJson.creator?.email); + expect(comment.createdAt, commentFromJson.createdAt); + expect(comment.text, commentFromJson.text); + expect(comment.post, commentFromJson.post); + expect(comment.likeCount, commentFromJson.likeCount); + }); + }); + + group('Test caching part of comment', () { + late final Box commentBox; + setUpAll(() async { + commentBox = await Hive.openBox('comment_box'); + }); + tearDownAll(() async { + await commentBox.close(); + }); + test('put and get', () async { + commentBox.put('key', comment); + final Comment fetchedComment = commentBox.get('key')!; + expect( + fetchedComment, + isNotNull, + ); // Check that the fetched comment is not null + expect(fetchedComment.text, comment.text); + expect(fetchedComment.createdAt, comment.createdAt); + expect(fetchedComment.post, comment.post); + expect(fetchedComment.likeCount, comment.likeCount); + }); + + test('adapter equality', () { + final adapter1 = CommentAdapter(); + final adapter2 = CommentAdapter(); + + expect(adapter2.hashCode, isA()); + + expect(adapter2 == adapter1, true); + }); + }); +} diff --git a/test/model_tests/events/event_agenda_category_test.dart b/test/model_tests/events/event_agenda_category_test.dart new file mode 100644 index 000000000..df5df9c15 --- /dev/null +++ b/test/model_tests/events/event_agenda_category_test.dart @@ -0,0 +1,44 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; + +void main() { + group('Test AgendaCategory Model', () { + test('Test AgendaCategory fromJson', () { + final agendaCategory = AgendaCategory( + id: 'category1', + name: 'Discussion', + description: 'A general discussion session', + ); + + final agendaCategoryJson = { + '_id': 'category1', + 'name': 'Discussion', + 'description': 'A general discussion session', + }; + + final agendaCategoryFromJson = + AgendaCategory.fromJson(agendaCategoryJson); + + // Verifying that all fields were correctly deserialized + expect(agendaCategory.id, agendaCategoryFromJson.id); + expect(agendaCategory.name, agendaCategoryFromJson.name); + expect(agendaCategory.description, agendaCategoryFromJson.description); + }); + + test('Test AgendaCategory fromJson with null values', () { + final agendaCategoryJson = { + '_id': null, + 'name': null, + 'description': null, + }; + + final agendaCategoryFromJson = + AgendaCategory.fromJson(agendaCategoryJson); + + // Verifying that null values are handled correctly + expect(agendaCategoryFromJson.id, isNull); + expect(agendaCategoryFromJson.name, isNull); + expect(agendaCategoryFromJson.description, isNull); + }); + }); +} diff --git a/test/model_tests/events/event_agenda_item_test.dart b/test/model_tests/events/event_agenda_item_test.dart new file mode 100644 index 000000000..020ee0df6 --- /dev/null +++ b/test/model_tests/events/event_agenda_item_test.dart @@ -0,0 +1,87 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; + +void main() { + group('Test EventAgendaItem Model', () { + test('Test EventAgendaItem fromJson', () { + final eventAgendaItemJson = { + '_id': 'item1', + 'title': 'Opening Remarks', + 'description': 'Welcome speech and event overview', + 'duration': '00:30', + 'attachments': ['https://example.com/attachment1.pdf'], + 'createdBy': { + '_id': 'user1', + 'firstName': 'John', + 'lastName': 'Doe', + }, + 'urls': ['https://example.com/agenda'], + 'relatedEvent': { + '_id': 'event1', + 'title': 'Annual Conference', + }, + 'categories': [ + { + '_id': 'category1', + 'name': 'Introduction', + } + ], + 'sequence': 1, + 'organization': { + '_id': 'org1', + 'name': 'Tech Conference Org', + }, + }; + + final eventAgendaItem = EventAgendaItem.fromJson(eventAgendaItemJson); + + // Verifying that all fields were correctly deserialized + expect(eventAgendaItem.id, 'item1'); + expect(eventAgendaItem.title, 'Opening Remarks'); + expect(eventAgendaItem.description, 'Welcome speech and event overview'); + expect(eventAgendaItem.duration, '00:30'); + expect( + eventAgendaItem.attachments, + ['https://example.com/attachment1.pdf'], + ); + expect(eventAgendaItem.createdBy?.id, 'user1'); + expect(eventAgendaItem.urls, ['https://example.com/agenda']); + expect(eventAgendaItem.relatedEvent?.id, 'event1'); + expect(eventAgendaItem.categories?.length, 1); + expect(eventAgendaItem.categories?[0].id, 'category1'); + expect(eventAgendaItem.sequence, 1); + expect(eventAgendaItem.organization?.id, 'org1'); + }); + + test('Test EventAgendaItem fromJson with null values', () { + final eventAgendaItemJson = { + '_id': null, + 'title': null, + 'description': null, + 'duration': null, + 'attachments': null, + 'createdBy': null, + 'urls': null, + 'relatedEvent': null, + 'categories': null, + 'sequence': null, + 'organization': null, + }; + + final eventAgendaItem = EventAgendaItem.fromJson(eventAgendaItemJson); + + // Verifying that null values are handled correctly + expect(eventAgendaItem.id, isNull); + expect(eventAgendaItem.title, isNull); + expect(eventAgendaItem.description, isNull); + expect(eventAgendaItem.duration, isNull); + expect(eventAgendaItem.attachments, isNull); + expect(eventAgendaItem.createdBy, isNull); + expect(eventAgendaItem.urls, isNull); + expect(eventAgendaItem.relatedEvent, isNull); + expect(eventAgendaItem.categories, isNull); + expect(eventAgendaItem.sequence, isNull); + expect(eventAgendaItem.organization, isNull); + }); + }); +} diff --git a/test/model_tests/events/event_model_test.dart b/test/model_tests/events/event_model_test.dart new file mode 100644 index 000000000..21ea85f39 --- /dev/null +++ b/test/model_tests/events/event_model_test.dart @@ -0,0 +1,179 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; + +final User user1 = User(id: "fakeUser1"); +final User user2 = User(id: "fakeUser2"); +final List users = [user1, user2]; + +final event = Event( + creator: User( + id: '123', + firstName: 'Ayush', + lastName: 'Chaudhary', + email: 'test@test.com', + ), + id: '12', + title: 'for test only', + description: 'for test only', + location: 'for test only', + recurring: false, + allDay: false, + startDate: 'for test only', + endDate: 'for test only', + startTime: 'for test only', + endTime: 'for test only', + isPublic: true, + isRegistered: true, + isRegisterable: true, + organization: OrgInfo(admins: users), + admins: users, + attendees: [ + Attendee( + id: "attendee1", + firstName: "firstName1", + lastName: "lastName1", + image: null, + ), + ], +); + +final eventJson = { + 'creator': { + '_id': '123', + 'firstName': 'Ayush', + 'lastName': 'Chaudhary', + 'email': 'test@test.com', + }, + '_id': '12', + 'title': 'for test only', + 'description': 'for test only', + 'location': 'for test only', + 'recurring': false, + 'allDay': false, + 'startDate': 'for test only', + 'endDate': 'for test only', + 'startTime': 'for test only', + 'endTime': 'for test only', + 'isPublic': true, + 'isRegistered': true, + 'isRegisterable': true, + 'organization': { + 'admin': { + 'id': '123', + 'firstName': 'Ayush', + 'lastName': 'Chaudhary', + 'email': 'test@test.com', + }, + }, + 'admins': [ + { + 'id': '123', + 'firstName': 'Ayush', + 'lastName': 'Chaudhary', + 'email': 'test@test.com', + }, + { + 'id': '123', + 'firstName': 'Aykkush', + 'lastName': 'Chaudhary', + 'email': 'test@test.com', + }, + ], + 'attendees': [ + Attendee( + id: "attendee1", + firstName: "firstName1", + lastName: "lastName1", + image: null, + ).toJson(), + ], +}; + +void main() { + group('Test Event Model', () { + test('Test Event ', () { + final eventFromJson = Event.fromJson(eventJson); + + expect(event.creator?.id, eventFromJson.creator?.id); + expect(event.creator?.firstName, eventFromJson.creator?.firstName); + expect(event.creator?.lastName, eventFromJson.creator?.lastName); + expect(event.creator?.email, eventFromJson.creator?.email); + expect(event.title, eventFromJson.title); + expect(event.id, eventFromJson.id); + expect(event.description, eventFromJson.description); + expect(event.attendees?[0].id, eventFromJson.attendees?[0].id); + expect( + event.attendees?[0].firstName, + eventFromJson.attendees?[0].firstName, + ); + expect( + event.attendees?[0].lastName, + eventFromJson.attendees?[0].lastName, + ); + expect(event.attendees?[0].image, eventFromJson.attendees?[0].image); + expect(event.location, eventFromJson.location); + expect(event.recurring, eventFromJson.recurring); + expect(event.allDay, eventFromJson.allDay); + expect(event.startDate, eventFromJson.startDate); + expect(event.startTime, eventFromJson.startTime); + expect(event.endTime, eventFromJson.endTime); + expect(event.isPublic, eventFromJson.isPublic); + expect(event.isRegistered, eventFromJson.isRegistered); + expect(event.isRegisterable, eventFromJson.isRegisterable); + }); + }); + + group('Test Caching part', () { + late final Box eventBox; + setUpAll(() async { + try { + eventBox = await Hive.openBox('event_box'); + } catch (e) { + fail('Failed to open Hive box: $e'); + } + }); + test('get and put', () async { + try { + await eventBox.put('key', event); + final Event fetchedEvent = eventBox.get('key')!; + + expect( + fetchedEvent, + isNotNull, + ); // Check that the fetched event is not null + expect(fetchedEvent.id, event.id); + expect(fetchedEvent.title, event.title); + expect(fetchedEvent.description, event.description); + expect(fetchedEvent.location, event.location); + expect(fetchedEvent.recurring, event.recurring); + expect(fetchedEvent.allDay, event.allDay); + expect(fetchedEvent.startDate, event.startDate); + expect(fetchedEvent.endDate, event.endDate); + expect(fetchedEvent.startTime, event.startTime); + expect(fetchedEvent.endTime, event.endTime); + expect(fetchedEvent.isPublic, event.isPublic); + expect(fetchedEvent.isRegistered, event.isRegistered); + expect(fetchedEvent.isRegisterable, event.isRegisterable); + } catch (e) { + fail('Failed to perform get or put operation: $e'); + } + }); + + test('test adapter', () { + final EventAdapter adapter1 = EventAdapter(); + final EventAdapter adpater2 = EventAdapter(); + + expect(adpater2.hashCode, isA()); + expect(adpater2 == adapter1, true); + + final AttendeeAdapter adapter3 = AttendeeAdapter(); + final AttendeeAdapter adapter4 = AttendeeAdapter(); + + expect(adapter3.hashCode, isA()); + expect(adapter3 == adapter4, true); + }); + }); +} diff --git a/test/model_tests/events/event_venue_test.dart b/test/model_tests/events/event_venue_test.dart new file mode 100644 index 000000000..b4803465b --- /dev/null +++ b/test/model_tests/events/event_venue_test.dart @@ -0,0 +1,35 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/events/event_venue.dart'; + +void main() { + group('Test Venue Model', () { + test('Test Venue fromJson and toJson', () { + final venue = Venue( + id: '1', + capacity: 100, + description: 'A nice place', + imageUrl: 'http://example.com/image.jpg', + name: 'Main Hall', + organizationId: 'org1', + ); + + final venueJson = { + '_id': '1', + 'capacity': 100, + 'description': 'A nice place', + 'imageUrl': 'http://example.com/image.jpg', + 'name': 'Main Hall', + 'organization': {'_id': 'org1'}, + }; + + final venueFromJson = Venue.fromJson(venueJson); + + expect(venue.id, venueFromJson.id); + expect(venue.capacity, venueFromJson.capacity); + expect(venue.description, venueFromJson.description); + expect(venue.imageUrl, venueFromJson.imageUrl); + expect(venue.name, venueFromJson.name); + expect(venue.organizationId, venueFromJson.organizationId); + }); + }); +} diff --git a/test/model_tests/events/event_volunteer_group_test.dart b/test/model_tests/events/event_volunteer_group_test.dart new file mode 100644 index 000000000..48f88076b --- /dev/null +++ b/test/model_tests/events/event_volunteer_group_test.dart @@ -0,0 +1,116 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/user/user_info.dart'; + +void main() { + group('Test EventVolunteerGroup Model', () { + test('Test EventVolunteerGroup fromJson', () { + final User creator = User(id: "fakeCreatorId"); + final User leader = User(id: "fakeLeaderId"); + final List volunteers = [ + EventVolunteer(id: "volunteer1"), + EventVolunteer(id: "volunteer2"), + ]; + + final event = Event( + id: 'fakeEventId', + title: 'Sample Event', + description: 'Sample Description', + location: 'Sample Location', + startDate: '2024-08-11', + endDate: '2024-08-12', + startTime: '10:00 AM', + endTime: '12:00 PM', + ); + + final eventVolunteerGroup = EventVolunteerGroup( + id: 'group1', + createdAt: '2024-08-01', + creator: creator, + event: event, + leader: leader, + name: 'Group Name', + updatedAt: '2024-08-05', + volunteers: volunteers, + volunteersRequired: 5, + ); + + final eventVolunteerGroupJson = { + '_id': 'group1', + 'createdAt': '2024-08-01', + 'creator': { + '_id': 'fakeCreatorId', + }, + 'event': { + '_id': 'fakeEventId', + 'title': 'Sample Event', + 'description': 'Sample Description', + 'location': 'Sample Location', + 'startDate': '2024-08-11', + 'endDate': '2024-08-12', + 'startTime': '10:00 AM', + 'endTime': '12:00 PM', + }, + 'leader': { + '_id': 'fakeLeaderId', + }, + 'name': 'Group Name', + 'updatedAt': '2024-08-05', + 'volunteers': [ + {'_id': 'volunteer1'}, + {'_id': 'volunteer2'}, + ], + 'volunteersRequired': 5, + }; + + final eventVolunteerGroupFromJson = + EventVolunteerGroup.fromJson(eventVolunteerGroupJson); + + expect(eventVolunteerGroup.id, eventVolunteerGroupFromJson.id); + + expect( + eventVolunteerGroup.createdAt, + eventVolunteerGroupFromJson.createdAt, + ); + + expect( + eventVolunteerGroup.creator?.id, + eventVolunteerGroupFromJson.creator?.id, + ); + + expect( + eventVolunteerGroup.event?.id, + eventVolunteerGroupFromJson.event?.id, + ); + + expect( + eventVolunteerGroup.leader?.id, + eventVolunteerGroupFromJson.leader?.id, + ); + + expect(eventVolunteerGroup.name, eventVolunteerGroupFromJson.name); + + expect( + eventVolunteerGroup.updatedAt, + eventVolunteerGroupFromJson.updatedAt, + ); + + expect( + eventVolunteerGroup.volunteersRequired, + eventVolunteerGroupFromJson.volunteersRequired, + ); + + expect( + eventVolunteerGroup.volunteers?.length, + eventVolunteerGroupFromJson.volunteers?.length, + ); + + expect( + eventVolunteerGroup.volunteers?[0].id, + eventVolunteerGroupFromJson.volunteers?[0].id, + ); + }); + }); +} diff --git a/test/model_tests/events/event_volunteer_test.dart b/test/model_tests/events/event_volunteer_test.dart new file mode 100644 index 000000000..e232e2dd8 --- /dev/null +++ b/test/model_tests/events/event_volunteer_test.dart @@ -0,0 +1,78 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/user/user_info.dart'; + +void main() { + group('Test EventVolunteer Model', () { + test('Test EventVolunteer fromJson', () { + final User creator = User(id: "fakeCreatorId"); + final Event event = Event( + id: 'fakeEventId', + title: 'Sample Event', + description: 'Sample Description', + location: 'Sample Location', + startDate: '2024-08-11', + endDate: '2024-08-12', + startTime: '10:00 AM', + endTime: '12:00 PM', + ); + final EventVolunteerGroup group = EventVolunteerGroup( + id: 'group1', + name: 'Group Name', + ); + final User user = User(id: "fakeUserId"); + + final eventVolunteer = EventVolunteer( + id: 'volunteer1', + creator: creator, + event: event, + group: group, + isAssigned: true, + isInvited: false, + response: 'Accepted', + user: user, + ); + final eventVolunteerJson = { + '_id': 'volunteer1', + 'creator': { + '_id': 'fakeCreatorId', + }, + 'event': { + '_id': 'fakeEventId', + 'title': 'Sample Event', + 'description': 'Sample Description', + 'location': 'Sample Location', + 'startDate': '2024-08-11', + 'endDate': '2024-08-12', + 'startTime': '10:00 AM', + 'endTime': '12:00 PM', + }, + 'group': { + '_id': 'group1', + 'name': 'Group Name', + }, + 'isAssigned': true, + 'isInvited': false, + 'response': 'Accepted', + 'user': { + '_id': 'fakeUserId', + }, + }; + + final eventVolunteerFromJson = + EventVolunteer.fromJson(eventVolunteerJson); + + // Verifying that all fields were correctly deserialized + expect(eventVolunteer.id, eventVolunteerFromJson.id); + expect(eventVolunteer.creator?.id, eventVolunteerFromJson.creator?.id); + expect(eventVolunteer.event?.id, eventVolunteerFromJson.event?.id); + expect(eventVolunteer.group?.id, eventVolunteerFromJson.group?.id); + expect(eventVolunteer.isAssigned, eventVolunteerFromJson.isAssigned); + expect(eventVolunteer.isInvited, eventVolunteerFromJson.isInvited); + expect(eventVolunteer.response, eventVolunteerFromJson.response); + expect(eventVolunteer.user?.id, eventVolunteerFromJson.user?.id); + }); + }); +} diff --git a/test/model_tests/mainscreen_navigation_args_test.dart b/test/model_tests/mainscreen_navigation_args_test.dart new file mode 100644 index 000000000..fc25ccb78 --- /dev/null +++ b/test/model_tests/mainscreen_navigation_args_test.dart @@ -0,0 +1,33 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; + +void main() { + group('MainScreenArgs', () { + test('Equality', () { + // Test 1: Creating two equal instances of MainScreenArgs + final mainScreenArgs1 = MainScreenArgs( + fromSignUp: true, + mainScreenIndex: 1, + toggleDemoMode: false, + ); + final mainScreenArgs2 = MainScreenArgs( + fromSignUp: true, + mainScreenIndex: 1, + toggleDemoMode: false, + ); + + expect(mainScreenArgs1, equals(mainScreenArgs2)); + expect(mainScreenArgs1.hashCode, equals(mainScreenArgs2.hashCode)); + + // Test 2: Creating instances with different properties + final mainScreenArgs3 = MainScreenArgs( + fromSignUp: false, + mainScreenIndex: 2, + toggleDemoMode: true, + ); + + expect(mainScreenArgs1, isNot(equals(mainScreenArgs3))); + expect(mainScreenArgs1.hashCode, isNot(equals(mainScreenArgs3.hashCode))); + }); + }); +} diff --git a/test/model_tests/organization/org_info_address_test.dart b/test/model_tests/organization/org_info_address_test.dart new file mode 100644 index 000000000..c080b64b0 --- /dev/null +++ b/test/model_tests/organization/org_info_address_test.dart @@ -0,0 +1,31 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/organization/org_info_address.dart'; + +void main() { + group('Test OrgInfoAddress model', () { + final Map addressJson = { + "city": "Delhi", + "countryCode": "IN", + "dependentLocality": "Some Dependent Locality", + "line1": "123 Random Street", + "line2": "Apartment 456", + "postalCode": "110001", + "sortingCode": "ABC-123", + "state": "Delhi", + }; + test('Test fromJson function', () { + final Address result = Address.fromJson(addressJson); + expect(result.city, 'Delhi'); + expect(result.countryCode, 'IN'); + expect(result.dependentLocality, 'Some Dependent Locality'); + expect(result.line1, '123 Random Street'); + expect(result.line2, 'Apartment 456'); + expect(result.postalCode, '110001'); + expect(result.sortingCode, 'ABC-123'); + expect(result.state, 'Delhi'); + }); + }); +} diff --git a/test/model_tests/organization/org_info_test.dart b/test/model_tests/organization/org_info_test.dart new file mode 100644 index 000000000..9afada14a --- /dev/null +++ b/test/model_tests/organization/org_info_test.dart @@ -0,0 +1,231 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + setUpAll(() { + setupLocator(); + sizeConfig.test(); + }); + + group('Test OrgInfo model', () { + final Map userJson = { + 'accessToken': ' ', + 'refreshToken': ' ', + '_id': 'user_id', + }; + final Map json1 = { + '_id': '123', + 'image': 'image_url', + 'name': 'Name', + 'description': 'Description', + 'userRegistrationRequired': false, + 'creator': userJson, + 'members': [userJson], + 'admins': [userJson], + 'address': { + "city": "Delhi", + "countryCode": "IN", + "dependentLocality": "Some Dependent Locality", + "line1": "123 Random Street", + "line2": "Apartment 456", + "postalCode": "110001", + "sortingCode": "ABC-123", + "state": "Delhi", + }, + }; + final Map json2 = { + '_id': '321', + 'image': 'image_url', + 'name': 'Name', + 'description': 'Description', + 'userRegistrationRequired': false, + 'creator': userJson, + 'members': [userJson], + 'admins': [userJson], + 'address': { + "city": "Delhi", + "countryCode": "IN", + "dependentLocality": "Some Dependent Locality", + "line1": "123 Random Street", + "line2": "Apartment 456", + "postalCode": "110001", + "sortingCode": "ABC-123", + "state": "Delhi", + }, + }; + + test('Test fromJson function with memberRequest false', () { + final OrgInfo result = OrgInfo.fromJson(json1, memberRequest: false); + + expect(result.id, '123'); + expect(result.image, 'image_url'); + expect(result.name, 'Name'); + expect(result.description, 'Description'); + expect(result.userRegistrationRequired, false); + expect(result.creatorInfo!.authToken, ' '); + expect(result.creatorInfo!.refreshToken, ' '); + expect(result.creatorInfo!.id, 'user_id'); + expect(result.members!.length, 1); + expect(result.members![0].authToken, ' '); + expect(result.members![0].refreshToken, ' '); + expect(result.members![0].id, 'user_id'); + expect(result.admins!.length, 1); + expect(result.admins![0].authToken, ' '); + expect(result.admins![0].refreshToken, ' '); + expect(result.admins![0].id, 'user_id'); + expect(result.address!.city, 'Delhi'); + expect(result.address!.countryCode, "IN"); + expect(result.address!.state, 'Delhi'); + }); + + test('Test fromJson function with memberRequest true', () { + final Map json = { + 'organization': json1, + }; + + final OrgInfo result = OrgInfo.fromJson(json, memberRequest: true); + + expect(result.id, '123'); + expect(result.image, 'image_url'); + expect(result.name, 'Name'); + expect(result.description, 'Description'); + expect(result.userRegistrationRequired, false); + expect(result.creatorInfo!.authToken, ' '); + expect(result.creatorInfo!.refreshToken, ' '); + expect(result.creatorInfo!.id, 'user_id'); + expect(result.members!.length, 1); + expect(result.members![0].authToken, ' '); + expect(result.members![0].refreshToken, ' '); + expect(result.members![0].id, 'user_id'); + expect(result.admins!.length, 1); + expect(result.admins![0].authToken, ' '); + expect(result.admins![0].refreshToken, ' '); + expect(result.admins![0].id, 'user_id'); + expect(result.address!.city, 'Delhi'); + expect(result.address!.countryCode, "IN"); + expect(result.address!.state, 'Delhi'); + }); + + test('Test fromJsonToList', () { + final List res = OrgInfo().fromJsonToList([json1, json2]); + + expect(res.length, 2); + for (int i = 0; i < 2; i++) { + final result = res[i]; + if (i == 0) { + expect(result.id, '123'); + } else { + expect(result.id, '321'); + } + expect(result.image, 'image_url'); + expect(result.name, 'Name'); + expect(result.description, 'Description'); + expect(result.userRegistrationRequired, false); + expect(result.creatorInfo!.authToken, ' '); + expect(result.creatorInfo!.refreshToken, ' '); + expect(result.creatorInfo!.id, 'user_id'); + expect(result.members!.length, 1); + expect(result.members![0].authToken, ' '); + expect(result.members![0].refreshToken, ' '); + expect(result.members![0].id, 'user_id'); + expect(result.admins!.length, 1); + expect(result.admins![0].authToken, ' '); + expect(result.admins![0].refreshToken, ' '); + expect(result.admins![0].id, 'user_id'); + expect(result.address!.city, 'Delhi'); + expect(result.address!.countryCode, "IN"); + expect(result.address!.state, 'Delhi'); + } + }); + + test('Test fromJsonToList with nested structures', () { + final List nestedJson = [ + [json1, json2], // Nested list with org information + json1, // Single org information + ]; + + final List res = OrgInfo().fromJsonToList(nestedJson); + + expect( + res.length, + 3, + ); // There are two orgs in the nested list and one in the single org information + + expect(res[0].id, '123'); + expect(res[0].image, 'image_url'); + expect(res[0].name, 'Name'); + expect(res[0].description, 'Description'); + expect(res[0].userRegistrationRequired, false); + expect(res[0].creatorInfo!.authToken, ' '); + expect(res[0].creatorInfo!.refreshToken, ' '); + expect(res[0].creatorInfo!.id, 'user_id'); + expect(res[0].members!.length, 1); + expect(res[0].members![0].authToken, ' '); + expect(res[0].members![0].refreshToken, ' '); + expect(res[0].members![0].id, 'user_id'); + expect(res[0].admins!.length, 1); + expect(res[0].admins![0].authToken, ' '); + expect(res[0].admins![0].refreshToken, ' '); + expect(res[0].admins![0].id, 'user_id'); + + expect(res[1].id, '321'); + expect(res[1].image, 'image_url'); + expect(res[1].name, 'Name'); + expect(res[1].description, 'Description'); + expect(res[1].userRegistrationRequired, false); + expect(res[1].creatorInfo!.authToken, ' '); + expect(res[1].creatorInfo!.refreshToken, ' '); + expect(res[1].creatorInfo!.id, 'user_id'); + expect(res[1].members!.length, 1); + expect(res[1].members![0].authToken, ' '); + expect(res[1].members![0].refreshToken, ' '); + expect(res[1].members![0].id, 'user_id'); + expect(res[1].admins!.length, 1); + expect(res[1].admins![0].authToken, ' '); + expect(res[1].admins![0].refreshToken, ' '); + expect(res[1].admins![0].id, 'user_id'); + + expect(res[2].id, '123'); + expect(res[2].image, 'image_url'); + expect(res[2].name, 'Name'); + expect(res[2].description, 'Description'); + expect(res[2].userRegistrationRequired, false); + expect(res[2].creatorInfo!.authToken, ' '); + expect(res[2].creatorInfo!.refreshToken, ' '); + expect(res[2].creatorInfo!.id, 'user_id'); + expect(res[2].members!.length, 1); + expect(res[2].members![0].authToken, ' '); + expect(res[2].members![0].refreshToken, ' '); + expect(res[2].members![0].id, 'user_id'); + expect(res[2].admins!.length, 1); + expect(res[2].admins![0].authToken, ' '); + expect(res[2].admins![0].refreshToken, ' '); + expect(res[2].admins![0].id, 'user_id'); + }); + }); + + group('Hive adapter test', () { + test('OrgInfoAdapter equality operator', () { + final adapter1 = OrgInfoAdapter(); + final adapter2 = OrgInfoAdapter(); + + // Test equality + expect( + adapter1 == adapter2, + isTrue, + reason: 'Two instances of OrgInfoAdapter should be equal', + ); + expect( + adapter1.hashCode == adapter2.hashCode, + isTrue, + reason: 'Hash codes should be equal', + ); + }); + }); +} diff --git a/test/model_tests/post/post_model_test.dart b/test/model_tests/post/post_model_test.dart new file mode 100644 index 000000000..fc268fa7b --- /dev/null +++ b/test/model_tests/post/post_model_test.dart @@ -0,0 +1,331 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; + +final u1 = User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', +); +final u2 = User( + id: '123', + firstName: 'Ayush', + lastName: 'Chaudhary', + email: 'test@test.com', +); +final List users = [u1, u2]; + +final LikedBy l1 = LikedBy(sId: 'test1'); +final LikedBy l2 = LikedBy(sId: 'test2'); +final List likeby = [l1, l2]; + +final comment1 = Comments(sId: 'comment1'); +final comment2 = Comments(sId: 'comment2'); +final comment3 = Comments(sId: 'comment3'); +final List comments = [comment1, comment2, comment3]; + +final myBirthday = DateTime.utc(2004, DateTime.june, 16, 5, 30, 0, 0, 0); +final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments, +); + +void main() { + group('Test Post model', () { + test('Test Post model', () { + final myBirthday = DateTime.utc(2004, DateTime.june, 16, 5, 30, 0, 0, 0); + final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments, + ); + final postJson = { + 'creator': { + '_id': '123', + 'firstName': 'John', + 'lastName': 'Doe', + 'email': 'test@test.com', + }, + '_id': '1222', + 'createdAt': '2023-03-15T15:28:52.122Z', + 'description': 'test description', + 'imageUrl': 'https://image.com', + 'videoUrl': 'https://image.com', + 'organization': { + 'admins': [ + { + 'id': '123', + 'firstName': 'Ayush', + 'lastName': 'Chaudhary', + 'email': 'test@test.com', + }, + { + 'id': '123', + 'firstName': 'John', + 'lastName': 'Doe', + 'email': 'test@test.com', + } + ], + }, + 'likedBy': [ + {'_id': 'test1'}, + {'_id': 'test2'}, + ], + 'comments': [ + { + '_id': 'comment1', + }, + { + '_id': 'comment2', + }, + { + '_id': 'comment3', + } + ], + }; + final postFromJson = Post.fromJson(postJson); + post.getPostCreatedDuration(); + expect(post.creator?.id, postFromJson.creator?.id); + expect(post.creator?.firstName, postFromJson.creator?.firstName); + expect(post.creator?.lastName, postFromJson.creator?.lastName); + expect(post.creator?.email, postFromJson.creator?.email); + }); + // final post = Post( + // creator: User( + // id: '123', + // firstName: 'John', + // lastName: 'Doe', + // email: 'test@test.com', + // ), + // sId: "sid", + // createdAt: myBirthday, + // description: 'test description', + // imageUrl: 'https://image.com', + // videoUrl: 'https://image.com', + // organization: OrgInfo(admins: users), + // likedBy: likeby, + // comments: comments, + // ); + group('check if getPostCreatedBuration is working', () { + test('check if getPostCreatedBuration is working', () { + final myBirthday = + DateTime.utc(2004, DateTime.june, 16, 5, 30, 0, 0, 0); + final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments, + ); + post.getPostCreatedDuration(); + }); + test( + 'Check if getPostCreatedBuration work when time is less than 60 seconds', + () { + final myBirthday30 = + DateTime.now().subtract(const Duration(seconds: 30)); + final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday30, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments, + ); + post.getPostCreatedDuration(); + }); + test( + 'Check if getPostCreatedBuration work when time is less than 60 minutes', + () { + final myBirthday30 = + DateTime.now().subtract(const Duration(minutes: 30)); + final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday30, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments, + ); + post.getPostCreatedDuration(); + }); + test( + 'Check if getPostCreatedBuration work when time is less than 12 hours', + () { + final myBirthday12 = DateTime.now().subtract(const Duration(hours: 12)); + final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday12, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments, + ); + post.getPostCreatedDuration(); + }); + test( + 'Check if getPostCreatedBuration work when time is less than 15 days', + () { + final myBirthday15 = DateTime.now().subtract(const Duration(days: 15)); + final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday15, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments, + ); + post.getPostCreatedDuration(); + }); + test( + 'Check if getPostCreatedBuration work when time is less than 200 days', + () { + final myBirthday200 = + DateTime.now().subtract(const Duration(days: 200)); + final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday200, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments, + ); + post.getPostCreatedDuration(); + }); + }); + group('check if LikedBy toJson works', () { + test('LikeBy model toJson', () { + final likedBy = LikedBy(sId: "test"); + final likeByJson = { + '_id': 'test', + }; + expect(likedBy.toJson(), likeByJson); + }); + }); + group('check if Comment toJson works', () { + test('Comment model toJson', () { + final comment = Comments(sId: 'test'); + final commentJson = { + '_id': 'test', + }; + expect(comment.toJson(), commentJson); + }); + }); + + group('Test caching part', () { + late final Box postBox; + setUpAll(() async { + postBox = await Hive.openBox('post_box'); + }); + test('get and put', () { + postBox.put('key', post); + final Post fetchedPost = postBox.get('key')!; + + expect(fetchedPost.sId, post.sId); + expect(fetchedPost.createdAt, post.createdAt); + expect(fetchedPost.description, post.description); + expect(fetchedPost.imageUrl, post.imageUrl); + expect(fetchedPost.videoUrl, post.videoUrl); + + expect( + fetchedPost.organization, + post.organization, + ); // Assuming users are compared by their ids or some other unique attribute + expect( + fetchedPost.likedBy, + post.likedBy, + ); // Assuming likeby is compared by ids or some other unique attribute + expect( + fetchedPost.comments, + post.comments, + ); // Assuming comments are compared by their ids or some other unique attribute + }); + + test('adpaters', () { + final PostAdapter adapter1 = PostAdapter(); + final PostAdapter adapter2 = PostAdapter(); + + expect(adapter2.hashCode, isA()); + expect(adapter2 == adapter1, true); + }); + }); + }); +} diff --git a/test/model_tests/user/user_info_test.dart b/test/model_tests/user/user_info_test.dart new file mode 100644 index 000000000..8bb2c6f62 --- /dev/null +++ b/test/model_tests/user/user_info_test.dart @@ -0,0 +1,238 @@ +// ignore_for_file: talawa_api_doc + +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; + +/// Encoded Organization. +final encodedOrg = { + "name": 'test_org', + "image": 'https://testimg.com', + "userRegistrationRequired": true, +}; + +/// Updated Organization. +final updatedOrg = OrgInfo.fromJson({ + "name": 'test_org_updated', + "image": 'https://testimg_updated.com', + "userRegistrationRequired": false, +}); + +/// Membership Request Organization. +final membershipRequestOrg = { + "organization": encodedOrg, +}; + +/// Updated Membership Request Organization. +final updatedMembershipRequestOrg = { + "organization": updatedOrg, +}; + +/// Test Organization List. +final testOrgList = [ + encodedOrg, + encodedOrg, +]; + +/// Membership Request Organization List. +final membershipRequestOrgList = [ + membershipRequestOrg, + membershipRequestOrg, +]; + +/// Test Data From Organization. +final testDataFromOrg = { + "firstName": "ravidi", + "lastName": "sheikh", + "email": "ravidisheikh@test.com", + "image": "https://testimg.com", + "accessToken": "randomAccessToken", + "authToken": "randomAuthToken", + "refreshToken": "randomRefreshToken", + "adminFor": testOrgList, + 'createdOrganizations': testOrgList, + 'joinedOrganizations': testOrgList, + 'membershipRequests': membershipRequestOrgList, +}; + +/// Test Data Not From Organization. +final testDataNotFromOrg = { + "user": { + "id": "1234567890", + "firstName": "ravidi", + "lastName": "sheikh", + "email": "ravidisheikh@test.com", + "image": "https://testimg.com", + "accessToken": "randomAccessToken", + "authToken": "randomAuthToken", + "refreshToken": "randomRefreshToken", + 'joinedOrganizations': testOrgList, + 'membershipRequests': membershipRequestOrgList, + }, + 'appUserProfile': { + 'createdOrganizations': testOrgList, + "adminFor": testOrgList, + }, +}; + +void main() { + group("Tests for UserInfo.dart", () { + test('Check if UserInfo.fromJson works with fromOrg', () async { + final userInfo = User.fromJson(testDataFromOrg, fromOrg: true); + + expect(userInfo.firstName, "ravidi"); + expect(userInfo.lastName, "sheikh"); + expect(userInfo.email, "ravidisheikh@test.com"); + expect(userInfo.image, "https://testimg.com"); + expect(userInfo.authToken, " "); + }); + + test('Check if UserInfo.fromJson works without fromOrg', () async { + final userInfo = User.fromJson(testDataNotFromOrg); + + expect(userInfo.firstName, "ravidi"); + expect(userInfo.lastName, "sheikh"); + expect(userInfo.email, "ravidisheikh@test.com"); + expect(userInfo.image, "https://testimg.com"); + expect(userInfo.authToken, null); + }); + + test('Check if the method "update" works', () async { + final userInfo = User.fromJson(testDataFromOrg, fromOrg: true); + + expect(userInfo.firstName, "ravidi"); + expect(userInfo.lastName, "sheikh"); + expect(userInfo.email, "ravidisheikh@test.com"); + expect(userInfo.image, "https://testimg.com"); + expect(userInfo.authToken, " "); + + userInfo.update( + User( + firstName: "ravidi_updated", + lastName: "sheikh_updated", + email: "updatedemail@test.com", + image: "https://testimgupdated.com", + authToken: "randomAuthToken_updated", + ), + ); + + expect(userInfo.firstName, "ravidi_updated"); + expect(userInfo.lastName, "sheikh_updated"); + expect(userInfo.email, "updatedemail@test.com"); + expect(userInfo.image, "https://testimgupdated.com"); + expect(userInfo.authToken, "randomAuthToken_updated"); + }); + + test('Check if print method works', () async { + final userInfo = User.fromJson(testDataFromOrg, fromOrg: true); + + // No way to test this. Calling here to increase + userInfo.print(); + }); + + test('Check if the method updateJoinedOrg works', () async { + final userInfo = User.fromJson(testDataFromOrg, fromOrg: true); + + expect(userInfo.joinedOrganizations!.length, 2); + expect(userInfo.joinedOrganizations![0].name, 'test_org'); + expect(userInfo.joinedOrganizations![0].image, 'https://testimg.com'); + expect(userInfo.joinedOrganizations![0].userRegistrationRequired, true); + + userInfo.updateJoinedOrg([updatedOrg, updatedOrg, updatedOrg]); + + expect(userInfo.joinedOrganizations!.length, 3); + expect(userInfo.joinedOrganizations![0].name, 'test_org_updated'); + expect( + userInfo.joinedOrganizations![0].image, + 'https://testimg_updated.com', + ); + expect(userInfo.joinedOrganizations![0].userRegistrationRequired, false); + }); + + test('Check if the method updateCreatedOrg works', () async { + final userInfo = User.fromJson(testDataFromOrg, fromOrg: true); + + expect(userInfo.createdOrganizations!.length, 2); + expect(userInfo.createdOrganizations![0].name, 'test_org'); + expect(userInfo.createdOrganizations![0].image, 'https://testimg.com'); + expect(userInfo.createdOrganizations![0].userRegistrationRequired, true); + + userInfo.updateCreatedOrg([updatedOrg, updatedOrg, updatedOrg]); + + expect(userInfo.createdOrganizations!.length, 3); + expect(userInfo.createdOrganizations![0].name, 'test_org_updated'); + expect( + userInfo.createdOrganizations![0].image, + 'https://testimg_updated.com', + ); + expect(userInfo.createdOrganizations![0].userRegistrationRequired, false); + }); + + test('Check if the method updateMemberRequestOrg works', () async { + final userInfo = User.fromJson(testDataFromOrg, fromOrg: true); + + expect(userInfo.membershipRequests!.length, 2); + expect(userInfo.membershipRequests![0].name, 'test_org'); + expect(userInfo.membershipRequests![0].image, 'https://testimg.com'); + expect(userInfo.membershipRequests![0].userRegistrationRequired, true); + + userInfo.updateMemberRequestOrg([updatedOrg, updatedOrg, updatedOrg]); + + expect(userInfo.membershipRequests!.length, 5); + expect(userInfo.membershipRequests![3].name, 'test_org_updated'); + expect( + userInfo.membershipRequests![3].image, + 'https://testimg_updated.com', + ); + expect(userInfo.membershipRequests![3].userRegistrationRequired, false); + }); + + test('Check if the method updateAdminFor works', () async { + final userInfo = User.fromJson(testDataFromOrg, fromOrg: true); + + expect(userInfo.adminFor!.length, 2); + expect(userInfo.adminFor![0].name, 'test_org'); + expect(userInfo.adminFor![0].image, 'https://testimg.com'); + expect(userInfo.adminFor![0].userRegistrationRequired, true); + + userInfo.updateAdminFor([updatedOrg, updatedOrg, updatedOrg]); + + expect(userInfo.adminFor!.length, 3); + expect(userInfo.adminFor![0].name, 'test_org_updated'); + expect(userInfo.adminFor![0].image, 'https://testimg_updated.com'); + expect(userInfo.adminFor![0].userRegistrationRequired, false); + }); + + test('Check if Hive storage works', () async { + final userBox = await Hive.openBox('userInfo'); + expect(userBox.isOpen, true); + + final userInfo = User.fromJson(testDataFromOrg, fromOrg: true); + userBox.put('user', userInfo); + + final newUserBox = await Hive.openBox('userInfo'); + final loadedUserInfo = newUserBox.get('user') as User; + + expect(loadedUserInfo.firstName, "ravidi"); + expect(loadedUserInfo.lastName, "sheikh"); + expect(loadedUserInfo.email, "ravidisheikh@test.com"); + expect(loadedUserInfo.image, "https://testimg.com"); + expect(loadedUserInfo.authToken, " "); + }); + + test('Test hashCode', () { + final userAdapter = UserAdapter(); + + final int hashCode = userAdapter.hashCode; + expect(userAdapter.hashCode, hashCode); + }); + + test('Test ==', () { + final userAdapter1 = UserAdapter(); + final userAdapter2 = UserAdapter(); + + expect(userAdapter1 == userAdapter2, true); + }); + }); +} diff --git a/test/my_app_test.dart b/test/my_app_test.dart new file mode 100644 index 000000000..78c82ab89 --- /dev/null +++ b/test/my_app_test.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/main.dart' as realmain; + +import 'package:talawa/view_model/connectivity_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +import 'helpers/test_helpers.dart'; +import 'helpers/test_locator.dart'; + +void main() async { + setUpAll(() async { + testSetupLocator(); + }); + group('test my app', () { + testWidgets('MyApp', (tester) async { + // await realMain.main(); + getAndRegisterUserConfig(); + + when(userConfig.userLoggedIn()).thenAnswer((_) => Future.value(false)); + graphqlConfig.httpLink = HttpLink('test/link'); + + await tester.pumpWidget(realmain.MyApp()); + + final model = locator(); + + model.initialize(); + + expect(find.byType(BaseView), findsOne); + expect(find.byType(BaseView), findsOne); + expect(find.byType(BaseView), findsOne); + expect(find.byType(MaterialApp), findsOne); + + model.switchTheme(isOn: false); + + await tester.pumpAndSettle(); + + expect(model.isdarkTheme, false); + }); + }); +} diff --git a/test/plugins/fetch_plugin_list_test.dart b/test/plugins/fetch_plugin_list_test.dart new file mode 100644 index 000000000..562c1e4bd --- /dev/null +++ b/test/plugins/fetch_plugin_list_test.dart @@ -0,0 +1,80 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/plugins/fetch_plugin_list.dart'; +import 'package:talawa/services/graphql_config.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +/// Tests fetch_plugin_list.dart. +/// +/// more_info_if_required +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() async { + late FetchPluginList fetchPluginList; + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + registerServices(); + locator.allowReassignment = true; + + locator.registerLazySingleton(() => FetchPluginList()); + fetchPluginList = locator(); + }); + group('FetchPluginList', () { + test('fetchList should fetch plugins and store them in Hive', () async { + final queryResult = QueryResult( + data: { + 'getPlugins': [ + { + '_id': '1', + 'pluginName': 'Plugin 1', + 'pluginCreatedBy': 'User A', + 'pluginDesc': 'Description A', + 'pluginInstallStatus': true, + 'installedOrgs': ['Org A'], + }, + ], + }, + options: QueryOptions( + document: gql(queries.getPluginsList()), + ), + source: QueryResultSource.network, + ); + + when(locator().clientToQuery()).thenAnswer( + (_) => locator(), + ); + when( + locator().query( + QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ).thenAnswer((_) async => queryResult); + await fetchPluginList.fetchList(); + + verify(locator().clientToQuery()).called(2); + verify( + locator().query( + QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ).called(2); + + expect(fetchPluginList.box, isNotNull); + expect( + fetchPluginList.box.get('plugins'), + equals(queryResult.data!["getPlugins"]), + ); + }); + }); +} diff --git a/test/plugins/talawa_plugin_provider_test.dart b/test/plugins/talawa_plugin_provider_test.dart new file mode 100644 index 000000000..3e275b714 --- /dev/null +++ b/test/plugins/talawa_plugin_provider_test.dart @@ -0,0 +1,244 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/plugins/talawa_plugin_provider.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +/// Test for talawa_plugin_provider_test.dart. +/// +/// more_info_if_required +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + + testSetupLocator(); + }); + late Box box; + + final OrgInfo org = OrgInfo( + id: 'org1', + name: 'test org 3', + ); + + setUpAll(() { + registerServices(); + box = Hive.box('pluginBox'); + }); + + tearDownAll(() async { + Hive.box('pluginBox').clear(); + unregisterServices(); + }); + + group('TalawaPluginProvider Tests', () { + testWidgets('Widget displays child when visible and plugins are installed', + (WidgetTester tester) async { + box.put( + 'plugins', + [ + { + '_id': '1', + 'pluginName': 'Plugin 1', + 'pluginCreatedBy': 'User A', + 'pluginDesc': 'Description A', + 'pluginInstallStatus': true, + 'installedOrgs': ['org1'], + }, + ], + ); + + when(userConfig.currentOrg).thenReturn(org); + + await tester.pumpWidget( + const MaterialApp( + home: TalawaPluginProvider( + visible: true, + pluginName: 'Plugin 1', + child: Text('Test Plugin'), + ), + ), + ); + + expect(find.text('Test Plugin'), findsOneWidget); + }); + + testWidgets( + 'Widget hides child when not visible and plugins are not installed also plugin not installed in org', + (WidgetTester tester) async { + box.put( + 'plugins', + [ + { + '_id': '1', + 'pluginName': 'Plugin 1', + 'pluginCreatedBy': 'User A', + 'pluginDesc': 'Description A', + 'pluginInstallStatus': false, + 'installedOrgs': ['org2'], + }, + ], + ); + + when(userConfig.currentOrg).thenReturn(org); + await tester.pumpWidget( + const MaterialApp( + home: TalawaPluginProvider( + visible: false, + pluginName: 'Plugin 1', + child: Text('Test Plugin'), + ), + ), + ); + + expect(find.text('Test Plugin'), findsNothing); + }); + testWidgets( + 'Widget displays child when not visible and plugins are installed', + (WidgetTester tester) async { + box.put( + 'plugins', + [ + { + '_id': '1', + 'pluginName': 'Plugin 1', + 'pluginCreatedBy': 'User A', + 'pluginDesc': 'Description A', + 'pluginInstallStatus': true, + 'installedOrgs': ['org1'], + }, + ], + ); + + when(userConfig.currentOrg).thenReturn(org); + await tester.pumpWidget( + const MaterialApp( + home: TalawaPluginProvider( + visible: false, + pluginName: 'Plugin 1', + child: Text('Test Plugin'), + ), + ), + ); + + expect(find.text('Test Plugin'), findsOneWidget); + }); + testWidgets( + 'Widget displays child when not visible but plugin is already installed in that org', + (WidgetTester tester) async { + box.put( + 'plugins', + [ + { + '_id': '1', + 'pluginName': 'Plugin 1', + 'pluginCreatedBy': 'User A', + 'pluginDesc': 'Description A', + 'pluginInstallStatus': false, + 'installedOrgs': ['org1'], + }, + ], + ); + + when(userConfig.currentOrg).thenReturn(org); + await tester.pumpWidget( + const MaterialApp( + home: TalawaPluginProvider( + visible: false, + pluginName: 'Plugin 1', + child: Text('Test Plugin'), + ), + ), + ); + + expect(find.text('Test Plugin'), findsOneWidget); + }); + testWidgets( + 'Widget displays child when visible but plugins are not installed', + (WidgetTester tester) async { + box.put( + 'plugins', + [ + { + '_id': '1', + 'pluginName': 'Plugin 1', + 'pluginCreatedBy': 'User A', + 'pluginDesc': 'Description A', + 'pluginInstallStatus': false, + 'installedOrgs': ['org1'], + }, + ], + ); + + when(userConfig.currentOrg).thenReturn(org); + await tester.pumpWidget( + const MaterialApp( + home: TalawaPluginProvider( + visible: true, + pluginName: 'Plugin 1', + child: Text('Test Plugin'), + ), + ), + ); + + expect(find.text('Test Plugin'), findsOneWidget); + }); + testWidgets('Widget hides child when not visible and plugins is null', + (WidgetTester tester) async { + box.put('plugins', null); + + when(userConfig.currentOrg).thenReturn(org); + await tester.pumpWidget( + const MaterialApp( + home: TalawaPluginProvider( + visible: false, + pluginName: 'Plugin 1', + child: Text('Test Plugin'), + ), + ), + ); + + expect(find.text('Test Plugin'), findsNothing); + }); + testWidgets( + 'Widget hides child when not visible and Current Organization is Not Set ', + (WidgetTester tester) async { + box.put( + 'plugins', + [ + { + '_id': '1', + 'pluginName': 'Plugin 1', + 'pluginCreatedBy': 'User A', + 'pluginDesc': 'Description A', + 'pluginInstallStatus': false, + 'installedOrgs': [''], + }, + ], + ); + + when(userConfig.currentOrg).thenReturn(org); + await tester.pumpWidget( + const MaterialApp( + home: TalawaPluginProvider( + visible: false, + pluginName: 'Plugin 1', + child: Text('Test Plugin'), + ), + ), + ); + + expect(find.text('Test Plugin'), findsNothing); + }, + ); + }); +} diff --git a/test/router_test.dart b/test/router_test.dart new file mode 100644 index 000000000..a66257d30 --- /dev/null +++ b/test/router_test.dart @@ -0,0 +1,448 @@ +// ignore_for_file: talawa_api_doc + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/main.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart'; +import 'package:talawa/splash_screen.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'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/views/after_auth_screens/add_post_page.dart'; +import 'package:talawa/views/after_auth_screens/app_settings/app_settings_page.dart'; +import 'package:talawa/views/after_auth_screens/chat/chat_message_screen.dart'; +import 'package:talawa/views/after_auth_screens/chat/select_contact.dart'; +import 'package:talawa/views/after_auth_screens/events/create_custom_recurring_event.dart'; +import 'package:talawa/views/after_auth_screens/events/create_event_page.dart'; +import 'package:talawa/views/after_auth_screens/events/edit_event_page.dart'; +import 'package:talawa/views/after_auth_screens/events/event_calendar.dart'; +import 'package:talawa/views/after_auth_screens/events/explore_events.dart'; +import 'package:talawa/views/after_auth_screens/events/manage_volunteer_group.dart'; +import 'package:talawa/views/after_auth_screens/events/volunteer_groups_screen.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_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/org_info_screen.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/demo_screens/explore_events_demo.dart'; +import 'package:talawa/views/demo_screens/organization_feed_demo.dart'; +import 'package:talawa/views/demo_screens/profile_page_demo.dart'; +import 'package:talawa/views/main_screen.dart'; +import 'package:talawa/views/pre_auth_screens/change_password.dart'; +import 'package:talawa/views/pre_auth_screens/select_language.dart'; +import 'package:talawa/views/pre_auth_screens/select_organization.dart'; +import 'package:talawa/views/pre_auth_screens/set_url.dart'; +import 'package:talawa/views/pre_auth_screens/waiting_screen.dart'; + +import 'helpers/test_helpers.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +void main() { + setUpAll(() { + setupLocator(); + getAndRegisterConnectivity(); + }); + + group('Tests for router', () { + testWidgets('Test SplashScreen route', (WidgetTester tester) async { + final route = generateRoute( + const RouteSettings(name: Routes.splashScreen, arguments: 0), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test SelectLanguage route', (WidgetTester tester) async { + final route = generateRoute( + const RouteSettings(name: Routes.languageSelectionRoute), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test SelectOrganization route', (WidgetTester tester) async { + const orgId = 'exampleOrgId'; // Provide an example organization ID + final route = generateRoute( + const RouteSettings(name: Routes.selectOrgScreen, arguments: orgId), + ); + expect(route, isA()); + if (route is CupertinoPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + final selectOrganizationWidget = widget as SelectOrganization; + expect(selectOrganizationWidget.selectedOrgId, orgId); + } + }); + + testWidgets('Test WaitingPage route', (WidgetTester tester) async { + final route = generateRoute( + const RouteSettings(name: Routes.waitingScreen, arguments: 0), + ); + expect(route, isA()); + if (route is CupertinoPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test ChangePass route', (WidgetTester tester) async { + final route = generateRoute( + const RouteSettings(name: Routes.updateScreen, arguments: 0), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test OrganizationFeed route', (WidgetTester tester) async { + final route = generateRoute( + const RouteSettings(name: Routes.homeScreen, arguments: 0), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test MainScreen route', (WidgetTester tester) async { + final mainScreenArgs = MainScreenArgs(mainScreenIndex: 1); + + final route = generateRoute( + RouteSettings(name: Routes.mainScreen, arguments: mainScreenArgs), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test IndividualPostView route', (WidgetTester tester) async { + final post = Post(sId: "testId", creator: User()); + + final route = generateRoute( + RouteSettings(name: Routes.individualPost, arguments: post), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test PinnedPostPage route', (WidgetTester tester) async { + final List pinnedPosts = [Post(sId: "testId", creator: User())]; + + final route = generateRoute( + RouteSettings(name: Routes.pinnedPostPage, arguments: pinnedPosts), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test ExploreEvents route', (WidgetTester tester) async { + final route = + generateRoute(const RouteSettings(name: Routes.exploreEventsScreen)); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test CreateEventPage route', (WidgetTester tester) async { + final route = + generateRoute(const RouteSettings(name: Routes.createEventPage)); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test createCustomRecurringEvent route', + (WidgetTester tester) async { + final route = generateRoute( + RouteSettings( + name: Routes.customRecurrencePage, + arguments: CreateEventViewModel(), + ), + ); + expect( + route, + isA(), + ); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test ProfilePage route', (WidgetTester tester) async { + final route = + generateRoute(const RouteSettings(name: Routes.profilePage)); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test EditProfilePage route', (WidgetTester tester) async { + final route = + generateRoute(const RouteSettings(name: Routes.editProfilePage)); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test JoinOrganisationAfterAuth route', + (WidgetTester tester) async { + const orgId = 'orgId'; + final route = generateRoute( + const RouteSettings(name: Routes.joinOrg, arguments: orgId), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for requestAccess route', (WidgetTester tester) async { + final OrgInfo orgInfo = OrgInfo(); + final route = generateRoute( + RouteSettings(name: Routes.requestAccess, arguments: orgInfo), + ); + expect(route, isA()); + if (route is CupertinoPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for editEventPage route', (WidgetTester tester) async { + final Event event = Event(); + final route = generateRoute( + RouteSettings(name: Routes.editEventPage, arguments: event), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test AppSettingsPage route', (WidgetTester tester) async { + final route = generateRoute( + const RouteSettings(name: Routes.appSettings, arguments: 0), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for chatMessageScreen route', + (WidgetTester tester) async { + final List arguments = [ + 'ChatId', + DirectChatViewModel(), + ]; + final route = generateRoute( + RouteSettings(name: Routes.chatMessageScreen, arguments: arguments), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for calendar route', (WidgetTester tester) async { + final List events = [ + Event(), + ]; + final route = generateRoute( + RouteSettings(name: Routes.calendar, arguments: events), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for selectContact route', (WidgetTester tester) async { + final route = + generateRoute(const RouteSettings(name: Routes.selectContact)); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for addPostpage route', (WidgetTester tester) async { + final route = + generateRoute(const RouteSettings(name: Routes.addPostScreen)); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for setUrl route', (WidgetTester tester) async { + final route = generateRoute( + const RouteSettings(name: Routes.setUrlScreen, arguments: ''), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for demoProfilePage route', (WidgetTester tester) async { + final route = + generateRoute(const RouteSettings(name: Routes.demoProfilePage)); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for demoExploreEventsScreen route', + (WidgetTester tester) async { + final route = generateRoute( + const RouteSettings(name: Routes.demoExploreEventsScreen), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for demoHomeScreen route', (WidgetTester tester) async { + final route = + generateRoute(const RouteSettings(name: Routes.demoHomeScreen)); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for default DemoPage route', (WidgetTester tester) async { + final route = generateRoute(const RouteSettings(name: 'default')); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for default orgInfoScreen route', + (WidgetTester tester) async { + final route = generateRoute( + RouteSettings(name: Routes.orgInfoScreen, arguments: OrgInfo()), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + testWidgets('Test for default volunteer groups screen route', + (WidgetTester tester) async { + final route = generateRoute( + RouteSettings( + name: Routes.volunteerGroupScreen, + arguments: [Event(), EventInfoViewModel()], + ), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + + testWidgets('Test for default manage volunteer group screen route', + (WidgetTester tester) async { + final route = generateRoute( + RouteSettings( + name: Routes.manageVolunteerGroup, + arguments: [Event(), EventVolunteerGroup()], + ), + ); + expect(route, isA()); + if (route is MaterialPageRoute) { + final builder = route.builder; + final widget = builder(MockBuildContext()); + expect(widget, isA()); + } + }); + }); +} diff --git a/test/service_tests/caching/cache_service_test.dart b/test/service_tests/caching/cache_service_test.dart new file mode 100644 index 000000000..cd04f817f --- /dev/null +++ b/test/service_tests/caching/cache_service_test.dart @@ -0,0 +1,32 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +import '../../helpers/test_locator.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + AppConnectivity.isOnline = false; + test('executeOrCacheOperation', () async { + final query = PostQueries().addLike(); + final result = await cacheService.executeOrCacheOperation( + operation: query, + operationType: CachedOperationType.gqlAuthQuery, + whenOnline: () { + return Future.value( + QueryResult( + options: QueryOptions(document: gql(query)), + exception: OperationException( + graphqlErrors: [], + ), + source: QueryResultSource.network, + ), + ); + }, + ); + expect(result.data, {'cached': true}); + }); +} diff --git a/test/service_tests/caching/offline_action_queue_test.dart b/test/service_tests/caching/offline_action_queue_test.dart new file mode 100644 index 000000000..720b84d15 --- /dev/null +++ b/test/service_tests/caching/offline_action_queue_test.dart @@ -0,0 +1,108 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/caching/cached_user_action.dart'; +import 'package:talawa/services/caching/offline_action_queue.dart'; + +import '../../helpers/test_helpers.dart'; + +void main() async { + late OfflineActionQueue queue; + + getAndRegisterDatabaseMutationFunctions(); + + queue = OfflineActionQueue(); + group('OfflineActionQueue', () { + final CachedUserAction action = CachedUserAction( + id: '123', + operation: 'testOperation', + timeStamp: DateTime.now(), + expiry: DateTime.now().add(const Duration(days: 1)), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlAuthQuery, + ); + group('success', () { + test('addAction success', () async { + final result = await queue.addAction(action); + + expect(result, true); + }); + + test('getActions success', () { + final now = DateTime.now(); + final CachedUserAction validAction = CachedUserAction( + id: '123', + operation: 'testOperation', + timeStamp: now, + expiry: now.add(const Duration(days: 1)), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlAuthQuery, + ); + final CachedUserAction expiredAction = CachedUserAction( + id: '456', + operation: 'expiredOperation', + timeStamp: now, + expiry: now.subtract(const Duration(days: 1)), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlAuthQuery, + ); + + queue.addAction(validAction); + queue.addAction(expiredAction); + + final actions = queue.getActions(); + + expect(actions, [validAction]); + }); + + test('removeAction success', () async { + final result = await queue.removeAction('123'); + + expect(result, true); + }); + + test('clearActions success', () async { + final result = await queue.clearActions(); + + expect(result, true); + }); + + test('_removeExpiredActions success', () async { + final result = await queue.removeExpiredActions(); + + expect(result, true); + }); + }); + + group('failure', () { + setUpAll(() async { + await Hive.close(); + }); + test('addAction failure', () async { + final result = await queue.addAction(action); + + expect(result, false); + }); + test('getActions failure', () { + final actions = queue.getActions(); + + expect(actions, []); + }); + test('removeAction failure', () async { + final result = await queue.removeAction('123'); + + expect(result, false); + }); + test('clearActions failure', () async { + final result = await queue.clearActions(); + + expect(result, false); + }); + test('_removeExpiredActions failure', () async { + final result = await queue.removeExpiredActions(); + + expect(result, false); + }); + }); + }); +} diff --git a/test/service_tests/chat_service_test.dart b/test/service_tests/chat_service_test.dart new file mode 100644 index 000000000..cd6da0d8d --- /dev/null +++ b/test/service_tests/chat_service_test.dart @@ -0,0 +1,105 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/chat_service.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/utils/chat_queries.dart'; +import '../helpers/test_helpers.dart'; + +void main() { + setUp(() { + registerServices(); + }); + group('Test ChatService', () { + test('Test SendMessageToDirectChat Method', () async { + final dataBaseMutationFunctions = locator(); + const id = "1"; + const messageContent = "test"; + + final query = ChatQueries().sendMessageToDirectChat(); + when( + dataBaseMutationFunctions.gqlAuthMutation( + query, + variables: { + "chatId": id, + "messageContent": messageContent, + }, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'sendMessageToDirectChat': { + '_id': id, + 'messageContent': messageContent, + 'sender': { + 'firstName': 'Mohamed', + }, + 'receiver': { + 'firstName': 'Ali', + }, + }, + }, + source: QueryResultSource.network, + ), + ); + final service = ChatService(); + await service.sendMessageToDirectChat( + id, + messageContent, + ); + }); + test('getDirectChatsByUserId Method', () async { + final dataBaseMutationFunctions = locator(); + const userId = "xzy1"; + final query = ChatQueries().fetchDirectChatsByUserId(userId); + // when(locator()).thenAnswer((_) => UserConfig()); + when(dataBaseMutationFunctions.gqlAuthQuery(query)).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(query), + ), + data: { + 'directChatsByUserID': [ + { + 'users': [], + '_id': 'xzy1', + } + ], + }, + source: QueryResultSource.network, + ), + ); + final service = ChatService(); + await service.getDirectChatsByUserId(); + }); + test("getDirectChatMessagesByChatId Method", () async { + final dataBaseMutationFunctions = locator(); + const chatId = 'test'; + final query = ChatQueries().fetchDirectChatMessagesByChatId(chatId); + when(dataBaseMutationFunctions.gqlAuthQuery(query)).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(query), + ), + data: { + 'directChatsMessagesByChatID': [ + { + '_id': 'test', + 'messageContent': 'test', + } + ], + }, + source: QueryResultSource.network, + ), + ); + + final service = ChatService(); + await service.getDirectChatMessagesByChatId(chatId); + }); + }); +} diff --git a/test/service_tests/comment_service_test.dart b/test/service_tests/comment_service_test.dart new file mode 100644 index 000000000..201fc5d86 --- /dev/null +++ b/test/service_tests/comment_service_test.dart @@ -0,0 +1,375 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/comment_service.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/utils/comment_queries.dart'; +import '../helpers/test_helpers.dart'; + +void main() { + setUp(() { + registerServices(); + }); + group('test for comment servicce', () { + test('test for createComments', () async { + final dataBaseMutationFunctions = locator(); + + final query = CommentQueries().createComment(); + when( + dataBaseMutationFunctions.gqlAuthMutation( + query, + variables: { + 'postId': 'ayush post', //Add your variables here + 'text': 'hey Ayush here!', + }, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'text': 'hey Ayush here!', + 'postId': 'ayush post', + }, + source: QueryResultSource.network, + ), + ); + + final service = CommentService(); + + await service.createComments( + 'ayush post', + 'hey Ayush here!', + ); + }); + test('test for createComments when throws exception', () async { + final dataBaseMutationFunctions = locator(); + + final query = CommentQueries().createComment(); + when( + dataBaseMutationFunctions.gqlAuthMutation( + query, + variables: { + 'postId': 'ayush post', + 'text': 'hey Ayush here!', + }, + ), + ).thenThrow(Exception('Your error message here')); + + final service = CommentService(); + + await service.createComments( + 'ayush post', + 'hey Ayush here!', + ); + + verify( + navigationService.showTalawaErrorSnackBar( + "Something went wrong", + MessageType.error, + ), + ).called(1); + }); + test('test for getCommentsForPost', () async { + final dataBaseMutationFunctions = locator(); + final String getCommmentQuery = + CommentQueries().getPostsComments('Ayush s postid'); + + when( + dataBaseMutationFunctions.gqlAuthMutation(getCommmentQuery), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(getCommmentQuery)), + data: { + 'post': { + 'comments': [ + { + 'creator': { + '_id': '123', + 'firstName': 'John', + 'lastName': 'Doe', + 'email': 'test@test.com', + }, + 'createdAt': '123456', + 'text': 'test text', + 'post': 'test post', + 'likeCount': 'test count', + }, + { + 'creator': { + '_id': '123', + 'firstName': 'Ayush', + 'lastName': 'Doe', + 'email': 'test@test.com', + }, + 'createdAt': '123456', + 'text': 'test text', + 'post': 'test post', + 'likeCount': 'test count', + }, + { + 'creator': { + '_id': '123', + 'firstName': 'john', + 'lastName': 'chauhdary', + 'email': 'test@test.com', + }, + 'createdAt': '123456', + 'text': 'test text', + 'post': 'test post', + 'likeCount': 'test count', + } + ], + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = CommentService(); + final result = await service.getCommentsForPost('Ayush s postid'); + + if (result.toString().contains('[{creator: ' + '{' + '_id: 123, ' + 'firstName: John, ' + 'lastName: Doe, ' + 'email: test@test.com},' + ' createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: ' + '{_id: 123, ' + 'firstName: Ayush, ' + 'lastName: Doe, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: {_id: 123,' + ' firstName: john, ' + 'lastName: chauhdary, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}]')) { + } else { + fail('the result is not maatching'); + } + expect(result, isNotEmpty); + }); + test('test for getCommentsForPost for wrong post idd', () async { + final dataBaseMutationFunctions = locator(); + + final String getCommmentQuery = + CommentQueries().getPostsComments('Ayushs postid'); + when( + dataBaseMutationFunctions.gqlAuthMutation(getCommmentQuery), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(getCommmentQuery)), + data: { + 'post': { + 'comments': [], + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = CommentService(); + final result = await service.getCommentsForPost('Ayushs postid'); + + if (result.toString().contains('[{creator: ' + '{' + '_id: 123, ' + 'firstName: John, ' + 'lastName: Doe, ' + 'email: test@test.com},' + ' createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: ' + '{_id: 123, ' + 'firstName: Ayush, ' + 'lastName: Doe, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: {_id: 123,' + ' firstName: john, ' + 'lastName: chauhdary, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}]')) { + fail('the result is not maatching'); + } + expect(result, isEmpty); + }); + + test('test for zero comments on post', () async { + final dataBaseMutationFunctions = locator(); + + final String getCommmentQuery = + CommentQueries().getPostsComments('Ayushs postid'); + when( + dataBaseMutationFunctions.gqlAuthMutation(getCommmentQuery), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(getCommmentQuery)), + data: { + 'post': {'comments': []}, + }, + source: QueryResultSource.network, + ), + ); + + final service = CommentService(); + final result = await service.getCommentsForPost('Ayushs postid'); + + if (result.toString().contains('[{creator: ' + '{' + '_id: 123, ' + 'firstName: John, ' + 'lastName: Doe, ' + 'email: test@test.com},' + ' createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: ' + '{_id: 123, ' + 'firstName: Ayush, ' + 'lastName: Doe, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: {_id: 123,' + ' firstName: john, ' + 'lastName: chauhdary, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}]')) { + fail('the result is not maatching'); + } + expect(result, isEmpty); + }); + + test('test when post is null', () async { + final dataBaseMutationFunctions = locator(); + + final String getCommmentQuery = + CommentQueries().getPostsComments('Ayushs postid'); + when( + dataBaseMutationFunctions.gqlAuthMutation(getCommmentQuery), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(getCommmentQuery)), + data: { + 'post': { + 'comments': [], + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = CommentService(); + final result = await service.getCommentsForPost('Ayushs postid'); + + if (result.toString().contains('[{creator: ' + '{' + '_id: 123, ' + 'firstName: John, ' + 'lastName: Doe, ' + 'email: test@test.com},' + ' createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: ' + '{_id: 123, ' + 'firstName: Ayush, ' + 'lastName: Doe, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: {_id: 123,' + ' firstName: john, ' + 'lastName: chauhdary, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}]')) { + fail('the result is not maatching'); + } + expect(result, isEmpty); + }); + + test('test when result is null', () async { + final dataBaseMutationFunctions = locator(); + + final String getCommmentQuery = + CommentQueries().getPostsComments('Ayushs postid'); + when( + dataBaseMutationFunctions.gqlAuthMutation(getCommmentQuery), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(getCommmentQuery)), + data: null, + source: QueryResultSource.network, + ), + ); + + final service = CommentService(); + final result = await service.getCommentsForPost('Ayushs postid'); + + if (result.toString().contains('[{creator: ' + '{' + '_id: 123, ' + 'firstName: John, ' + 'lastName: Doe, ' + 'email: test@test.com},' + ' createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: ' + '{_id: 123, ' + 'firstName: Ayush, ' + 'lastName: Doe, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}, ' + '{creator: {_id: 123,' + ' firstName: john, ' + 'lastName: chauhdary, ' + 'email: test@test.com}, ' + 'createdAt: 123456, ' + 'text: test text, ' + 'post: test post, ' + 'likeCount: test count}]')) { + fail('the result is not maatching'); + } + expect(result, isEmpty); + }); + }); +} diff --git a/test/service_tests/database_mutations_function_test.dart b/test/service_tests/database_mutations_function_test.dart new file mode 100644 index 000000000..4d92040b4 --- /dev/null +++ b/test/service_tests/database_mutations_function_test.dart @@ -0,0 +1,1121 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/utils/queries.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +/// Tests database_mutations_functions.dart. +/// +/// more_info_if_required +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() async { + late DataBaseMutationFunctions functionsClass; + + const userNotAuthenticated = + GraphQLError(message: 'User is not authenticated'); + + const userNotAuthenticatedrand = + GraphQLError(message: 'User is not authenticatedrand'); + const userNotFound = GraphQLError(message: 'User not found'); + const refreshAccessTokenExpiredException = GraphQLError( + message: + 'Access Token has expired. Please refresh session.: Undefined location', + ); + + const wrongCredentials = GraphQLError(message: 'Invalid credentials'); + + const organizationNotFound = GraphQLError(message: 'Organization not found'); + + const memberRequestExist = + GraphQLError(message: 'Membership Request already exists'); + + const notifFeatureNotInstalled = GraphQLError( + message: + 'Failed to determine project ID: Error while making request: getaddrinfo ENOTFOUND metadata.google.internal. Error code: ENOTFOUND', + ); + + const emailAccountPresent = + GraphQLError(message: 'Email address already exists'); + + final testOrg = OrgInfo.fromJson({ + 'image': 'sampleimg', + 'id': 'XYZ', + 'name': 'Sample1', + 'userRegistrationRequired': false, + 'creator': {'firstName': 'Shivam', 'lastName': 'Gupta'}, + }); + + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + registerServices(); + functionsClass = DataBaseMutationFunctions(); + functionsClass.init(); + functionsClass.initClientNonAuth(); + AppConnectivity.isOnline = true; + }); + + group('Database Mutation Functions Tests', () { + testWidgets('Widget Testing 1', (tester) async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when(locator().query(QueryOptions(document: gql(query)))) + .thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + exception: OperationException( + graphqlErrors: [userNotAuthenticated], + linkException: UnknownException( + userNotAuthenticated, + StackTrace.current, + ), + ), + source: QueryResultSource.network, + ), + ); + + await functionsClass.gqlNonAuthQuery(query); + + tester.binding.addPostFrameCallback((_) { + navigationService.showTalawaErrorSnackBar( + "Server not running/wrong url", + MessageType.error, + ); + }); + + await tester.pump(); + }); + + testWidgets('Widget Testing 2', (tester) async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when(locator().query(QueryOptions(document: gql(query)))) + .thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + exception: OperationException( + graphqlErrors: [userNotAuthenticatedrand], + ), + source: QueryResultSource.network, + ), + ); + + await functionsClass.gqlNonAuthQuery(query); + + tester.binding.addPostFrameCallback((_) { + navigationService.showTalawaErrorSnackBar( + "Something went wrong!", + MessageType.error, + ); + }); + + await tester.pump(); + }); + + test('fetchOrgById test in case of successful results', () async { + when(locator().clientToQuery()).thenAnswer( + (_) => locator(), + ); + + when( + locator().mutate( + MutationOptions( + document: gql(queries.fetchOrgById('XYZ')), + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(queries.fetchOrgById('XYZ'))), + data: { + 'organizations': [ + { + 'id': 'XYZ', + 'image': 'sampleimg', + 'name': 'Sample1', + 'userRegistrationRequired': false, + 'creator': {'firstName': 'Shivam', 'lastName': 'Gupta'}, + }, + ], + }, + source: QueryResultSource.network, + ), + ); + + final org = await functionsClass.fetchOrgById('XYZ') as OrgInfo; + + expect(org.id, testOrg.id); + expect(org.name, testOrg.name); + expect(org.image, testOrg.image); + expect(org.userRegistrationRequired, testOrg.userRegistrationRequired); + expect(org.creatorInfo!.firstName, testOrg.creatorInfo!.firstName); + }); + + test('fetchOrgById test in case of exception', () async { + final String query = Queries().fetchOrgById('XYZ'); + final String query2 = Queries().refreshToken('abc'); + final String query3 = Queries().refreshToken('xyz'); + + userConfig.currentUser.refreshToken = 'abc'; + + /// Returns the exception to be thrown in case of refresh token expired + /// + /// more_info_if_required + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: Map of exception to be thrown + Map exp2() { + if (userConfig.currentUser.refreshToken == 'abc') { + userConfig.currentUser.refreshToken = 'xyz'; + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotAuthenticated], + ), + }); + } else { + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotFound], + ), + }); + } + } + + when( + locator().mutate( + MutationOptions(document: gql(query)), + ), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query)), + exception: exp2()['val'], + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query2))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query2)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query3))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query3)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.fetchOrgById('XYZ'); + expect(res, false); + }); + + test('Testing wrong credential error', () async { + when(locator().clientToQuery()).thenAnswer( + (_) => locator(), + ); + + when( + locator().mutate( + MutationOptions( + document: gql( + queries.fetchOrgById('XYZ'), + ), + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(queries.fetchOrgById('XYZ'))), + exception: OperationException(graphqlErrors: [wrongCredentials]), + source: QueryResultSource.network, + ), + ); + + final org = await functionsClass.fetchOrgById('XYZ'); + expect(org, false); + }); + + test('Testing organization not found error', () async { + when(locator().clientToQuery()).thenAnswer( + (_) => locator(), + ); + + when( + locator().mutate( + MutationOptions( + document: gql( + queries.fetchOrgById('XYZ'), + ), + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(queries.fetchOrgById('XYZ'))), + exception: OperationException(graphqlErrors: [organizationNotFound]), + source: QueryResultSource.network, + ), + ); + + final org = await functionsClass.fetchOrgById('XYZ'); + expect(org, false); + }); + + test('Testing memberRequestExist error', () async { + when(locator().clientToQuery()).thenAnswer( + (_) => locator(), + ); + + when( + locator().mutate( + MutationOptions( + document: gql(queries.fetchOrgById('XYZ')), + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(queries.fetchOrgById('XYZ'))), + exception: OperationException(graphqlErrors: [memberRequestExist]), + source: QueryResultSource.network, + ), + ); + + final org = await functionsClass.fetchOrgById('XYZ'); + expect(org, false); + }); + + test('Testing emailAccountPresent error', () async { + when(locator().clientToQuery()).thenAnswer( + (_) => locator(), + ); + + when( + locator().mutate( + MutationOptions(document: gql(queries.fetchOrgById('XYZ'))), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(queries.fetchOrgById('XYZ'))), + exception: OperationException( + graphqlErrors: [emailAccountPresent], + ), + source: QueryResultSource.network, + ), + ); + + final org = await functionsClass.fetchOrgById('XYZ'); + expect(org, false); + }); + + test('Testing notifFeatureNotInstalled error', () async { + when(locator().clientToQuery()).thenAnswer( + (_) => locator(), + ); + + when( + locator().mutate( + MutationOptions(document: gql(queries.fetchOrgById('XYZ'))), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(queries.fetchOrgById('XYZ'))), + exception: OperationException( + graphqlErrors: [notifFeatureNotInstalled], + ), + source: QueryResultSource.network, + ), + ); + + final org = await functionsClass.fetchOrgById('XYZ'); + expect(org, false); + }); + + test('Testing gqlAuthQuery function without exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when( + locator().query( + QueryOptions( + document: gql(query), + fetchPolicy: FetchPolicy.networkOnly, + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(query), + fetchPolicy: FetchPolicy.networkOnly, + ), + data: { + 'organizations': [ + { + 'id': 'XYZ', + 'image': 'sampleimg', + 'name': 'Sample1', + 'userRegistrationRequired': false, + 'creator': {'firstName': 'Shivam', 'lastName': 'Gupta'}, + }, + ], + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlAuthQuery(query); + final org = OrgInfo.fromJson( + (res.data!['organizations'] as List>)[0], + ); + + expect(org.id, testOrg.id); + expect(org.name, testOrg.name); + expect(org.image, testOrg.image); + expect(org.userRegistrationRequired, testOrg.userRegistrationRequired); + expect(org.creatorInfo!.firstName, testOrg.creatorInfo!.firstName); + }); + + test('Testing gqlAuthQuery with false exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when( + locator().query( + QueryOptions( + document: gql(query), + fetchPolicy: FetchPolicy.networkOnly, + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(query), + fetchPolicy: FetchPolicy.networkOnly, + ), + exception: OperationException(graphqlErrors: [userNotFound]), + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlAuthQuery(query); + expect(res.data, null); + }); + + test('Testing gqlAuthQuery with true exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + final String query2 = Queries().refreshToken('abc'); + final String query3 = Queries().refreshToken('xyz'); + + userConfig.currentUser.refreshToken = 'abc'; + + /// Returns the exception to be thrown in case of refresh token expired + /// + /// more_info_if_required + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: Map of exception to be thrown + Map exp2() { + if (userConfig.currentUser.refreshToken == 'abc') { + userConfig.currentUser.refreshToken = 'xyz'; + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotAuthenticated], + ), + }); + } else { + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotFound], + ), + }); + } + } + + when( + locator().query( + QueryOptions( + document: gql(query), + fetchPolicy: FetchPolicy.networkOnly, + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(query), + fetchPolicy: FetchPolicy.networkOnly, + ), + exception: exp2()['val'], + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate( + MutationOptions( + document: gql(query2), + fetchPolicy: FetchPolicy.networkOnly, + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(query2), + fetchPolicy: FetchPolicy.networkOnly, + ), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate( + MutationOptions( + document: gql(query3), + fetchPolicy: FetchPolicy.networkOnly, + ), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(query3), + fetchPolicy: FetchPolicy.networkOnly, + ), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlAuthQuery(query); + expect(res.data, null); + }); + + test('Test for gql auth mutation', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'organizations': [ + { + 'id': 'XYZ', + 'image': 'sampleimg', + 'name': 'Sample1', + 'userRegistrationRequired': false, + 'creator': {'firstName': 'Shivam', 'lastName': 'Gupta'}, + }, + ], + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlAuthMutation(query); + final org = OrgInfo.fromJson( + (res.data!['organizations'] as List>)[0], + ); + + expect(org.id, testOrg.id); + expect(org.name, testOrg.name); + expect(org.image, testOrg.image); + expect(org.userRegistrationRequired, testOrg.userRegistrationRequired); + expect(org.creatorInfo!.firstName, testOrg.creatorInfo!.firstName); + }); + + test('Test for gql auth mutation with false exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + exception: OperationException(graphqlErrors: [userNotFound]), + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlAuthMutation(query); + expect(res.data, null); + }); + + test('Test for gql auth mutation with true exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + final String query2 = Queries().refreshToken('abc'); + final String query3 = Queries().refreshToken('xyz'); + + userConfig.currentUser.refreshToken = 'abc'; + + /// Returns the exception to be thrown in case of refresh token expired + /// + /// more_info_if_required + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: Map of exception to be thrown + Map exp2() { + if (userConfig.currentUser.refreshToken == 'abc') { + userConfig.currentUser.refreshToken = 'xyz'; + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotAuthenticated], + ), + }); + } else { + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotFound], + ), + }); + } + } + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query)), + exception: exp2()['val'], + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query2))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query2)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query3))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query3)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlAuthMutation(query); + expect(res.data, null); + }); + + test('Test for gql non auth query', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when(locator().query(QueryOptions(document: gql(query)))) + .thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'organizations': [ + { + 'id': 'XYZ', + 'image': 'sampleimg', + 'name': 'Sample1', + 'userRegistrationRequired': false, + 'creator': {'firstName': 'Shivam', 'lastName': 'Gupta'}, + }, + ], + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlNonAuthQuery(query); + final org = OrgInfo.fromJson( + (res.data!['organizations'] as List>)[0], + ); + + expect(org.id, testOrg.id); + expect(org.name, testOrg.name); + expect(org.image, testOrg.image); + expect(org.userRegistrationRequired, testOrg.userRegistrationRequired); + expect(org.creatorInfo!.firstName, testOrg.creatorInfo!.firstName); + }); + + test('Test for gql non auth mutation', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'organizations': [ + { + 'id': 'XYZ', + 'image': 'sampleimg', + 'name': 'Sample1', + 'userRegistrationRequired': false, + 'creator': {'firstName': 'Shivam', 'lastName': 'Gupta'}, + }, + ], + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlNonAuthMutation(query); + final org = OrgInfo.fromJson( + (res.data!['organizations'] as List>)[0], + ); + + expect(org.id, testOrg.id); + expect(org.name, testOrg.name); + expect(org.image, testOrg.image); + expect(org.userRegistrationRequired, testOrg.userRegistrationRequired); + expect(org.creatorInfo!.firstName, testOrg.creatorInfo!.firstName); + }); + + test('Test for gql non auth mutation with false exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + exception: OperationException(graphqlErrors: [userNotFound]), + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlNonAuthMutation(query); + expect(res.data, null); + }); + + test('Test for gql non auth mutation with true exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + final String query2 = Queries().refreshToken('abc'); + final String query3 = Queries().refreshToken('xyz'); + + userConfig.currentUser.refreshToken = 'abc'; + + /// Returns the exception to be thrown in case of refresh token expired + /// + /// more_info_if_required + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: Map of exception to be thrown + Map exp2() { + if (userConfig.currentUser.refreshToken == 'abc') { + userConfig.currentUser.refreshToken = 'xyz'; + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotAuthenticated], + ), + }); + } else { + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotFound], + ), + }); + } + } + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query)), + exception: exp2()['val'], + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query2))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query2)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query3))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query3)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlNonAuthMutation(query); + expect(res.data, null); + }); + + test('Test for refresh access token', () async { + final String query = Queries().refreshToken('reftok123'); + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'refreshToken': { + 'accessToken': 'acctok123', + 'refreshToken': 'reftok123', + }, + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.refreshAccessToken('reftok123'); + verify( + userConfig.updateAccessToken( + accessToken: 'acctok123', + refreshToken: 'reftok123', + ), + ); + verify(databaseFunctions.init()); + expect(res, true); + }); + + test('Test for refresh access token with false exception', () async { + final String query = Queries().refreshToken('reftok123'); + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + exception: OperationException(graphqlErrors: [userNotFound]), + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.refreshAccessToken('reftok123'); + verify(navigationService.pop()); + expect(res, false); + }); + + test('Test for refresh access token with true exception', () async { + final String query = Queries().refreshToken('x'); + final String query2 = Queries().refreshToken('abc'); + final String query3 = Queries().refreshToken('xyz'); + + userConfig.currentUser.refreshToken = 'abc'; + + /// Returns the exception to be thrown in case of refresh token expired + /// + /// more_info_if_required + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: Map of exception to be thrown + Map exp2() { + if (userConfig.currentUser.refreshToken == 'abc') { + userConfig.currentUser.refreshToken = 'xyz'; + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotAuthenticated], + ), + }); + } else { + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotFound], + ), + }); + } + } + + when( + locator().mutate(MutationOptions(document: gql(query))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query)), + exception: exp2()['val'], + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query2))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query2)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query3))), + ).thenAnswer( + (_) async => QueryResult( + options: MutationOptions(document: gql(query3)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.refreshAccessToken('x'); + expect(res, false); + }); + + test('Test for gql non auth query with link exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + + when(locator().query(QueryOptions(document: gql(query)))) + .thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + exception: OperationException( + graphqlErrors: [userNotFound], + linkException: UnknownException( + userNotFound, + StackTrace.current, + ), + ), + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlNonAuthQuery(query); + expect(res.data, null); + }); + + test('Test for gql non auth query with true exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + final String query2 = Queries().refreshToken('abc'); + final String query3 = Queries().refreshToken('xyz'); + + userConfig.currentUser.refreshToken = 'abc'; + + /// Returns the exception to be thrown in case of refresh token expired + /// + /// more_info_if_required + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: Map of exception to be thrown + Map exp2() { + if (userConfig.currentUser.refreshToken == 'abc') { + userConfig.currentUser.refreshToken = 'xyz'; + return Map.from({ + 'val': OperationException( + graphqlErrors: [refreshAccessTokenExpiredException], + ), + }); + } else { + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotFound], + ), + }); + } + } + + when(locator().query(QueryOptions(document: gql(query)))) + .thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + exception: exp2()['val'], + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query2))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query2)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query3))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query3)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlNonAuthQuery(query); + expect(res.data, null); + }); + test('Test for gql non auth query with false exception', () async { + final String query = Queries().fetchOrgDetailsById('XYZ'); + final String query2 = Queries().refreshToken('abc'); + final String query3 = Queries().refreshToken('xyz'); + + userConfig.currentUser.refreshToken = 'abc'; + + /// Returns the exception to be thrown in case of refresh token expired + /// + /// more_info_if_required + /// + /// **params**: + /// None + /// + /// **returns**: + /// * `Map`: Map of exception to be thrown + Map exp2() { + if (userConfig.currentUser.refreshToken == 'abc') { + userConfig.currentUser.refreshToken = 'xyz'; + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotAuthenticated], + ), + }); + } else { + return Map.from({ + 'val': OperationException( + graphqlErrors: [userNotFound], + ), + }); + } + } + + when(locator().query(QueryOptions(document: gql(query)))) + .thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + exception: exp2()['val'], + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query2))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query2)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + when( + locator().mutate(MutationOptions(document: gql(query3))), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query3)), + data: { + 'refreshToken': { + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, + }, + source: QueryResultSource.network, + ), + ); + + final res = await functionsClass.gqlNonAuthQuery(query); + expect(res.data, null); + }); + }); +} diff --git a/test/service_tests/event_service_test.dart b/test/service_tests/event_service_test.dart new file mode 100644 index 000000000..053370fb7 --- /dev/null +++ b/test/service_tests/event_service_test.dart @@ -0,0 +1,613 @@ +// ignore_for_file: avoid_dynamic_calls + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; +import '../model_tests/user/user_info_test.dart'; + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + }); + + group('Test EventService', () { + test('Test editEvent method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + final Map variables = {}; + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().updateEvent(eventId: 'eventId'), + variables: variables, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'updateEvent': { + '_id': 'eventId', + 'title': 'Test task', + 'description': 'Test description', + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = EventService(); + + await service.editEvent( + eventId: 'eventId', + variables: variables, + ); + }); + + test('Test deleteEvent method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().deleteEvent('eventId'), + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'deleteEvent': { + '_id': 'eventId', + 'title': 'Test task', + 'description': 'Test description', + }, + }, + source: QueryResultSource.network, + ), + ); + final services = EventService(); + await services.deleteEvent('eventId'); + }); + + test('Test createEvent method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + final createEventViewModel = CreateEventViewModel(); + createEventViewModel + ..eventTitleTextController.text = 'title' + ..eventDescriptionTextController.text = 'description' + ..eventLocationTextController.text = 'location' + ..isPublicSwitch = true + ..isRegisterableSwitch = true + ..isRecurring = true + ..isAllDay = true + ..eventStartDate = DateTime.now() + ..eventEndDate = DateTime.now() + ..eventStartTime = TimeOfDay.now() + ..eventEndTime = TimeOfDay.now(); + + final Map variables = { + "data": { + 'title': createEventViewModel.eventTitleTextController.text, + 'description': + createEventViewModel.eventDescriptionTextController.text, + 'location': createEventViewModel.eventLocationTextController.text, + 'isPublic': createEventViewModel.isPublicSwitch, + 'isRegisterable': createEventViewModel.isRegisterableSwitch, + 'recurring': createEventViewModel.isRecurring, + 'allDay': createEventViewModel.isAllDay, + }, + }; + + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().addEvent(), + variables: variables, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'createdEvent': { + '_id': 'eventId', + 'title': 'Test task', + 'description': 'Test description', + }, + }, + source: QueryResultSource.network, + ), + ); + final services = EventService(); + await services.createEvent(variables: variables); + }); + + test('Test registerForAnEvent method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().registerForEvent(), + variables: {'eventId': 'eventId'}, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'registerForEvent': { + '_id': 'eventId', + }, + }, + source: QueryResultSource.network, + ), + ); + final services = EventService(); + await services.registerForAnEvent('eventId'); + }); + + test('Test fetchAttendeesByEvent method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + when( + dataBaseMutationFunctions.gqlAuthQuery( + EventQueries().attendeesByEvent('eventId'), + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'getEventAttendeesByEventId': {'userId': 'userId'}, + }, + source: QueryResultSource.network, + ), + ); + final services = EventService(); + services.fetchAttendeesByEvent('eventId'); + }); + + test('Test getEvents method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + userConfig.currentOrg = OrgInfo(name: 'org', id: 'id'); + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().fetchOrgEvents('XYZ'), + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'eventsByOrganizationConnection': [ + { + "_id": "1234567890", + "title": "Sample Event", + "description": "This is a sample event description.", + "location": "Sample Location", + "recurring": true, + "allDay": false, + "startDate": "2024-01-15", + "endDate": "2024-01-16", + "startTime": "10:00 AM", + "endTime": "4:00 PM", + "isPublic": true, + "isRegistered": true, + "isRegisterable": true, + "creator": { + "id": "user123", + "name": "Creator Name", + "email": "creator@example.com", + }, + "organization": { + "id": "org123", + "name": "Organization Name", + "description": "Sample organization description.", + }, + "attendees": [ + testDataNotFromOrg, + ], + } + ], + }, + source: QueryResultSource.network, + ), + ); + final services = EventService(); + services.getEvents(); + + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().fetchOrgEvents('XYZ'), + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: null, + source: QueryResultSource.network, + ), + ); + + services.getEvents(); + + AppConnectivity.isOnline = false; + + services.getEvents(); + }); + + test('Test dispose method', () { + final eventService = EventService(); + eventService.dispose(); + }); + + test('Test for getters', () { + final model = EventService(); + expect(model.eventStream, isA>>()); + }); + + test('Test createVolunteerGroup method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + final Map variables = { + 'name': 'Volunteer Group 1', + 'eventId': 'eventId1', + }; + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().createVolunteerGroup(), + variables: {'data': variables}, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'createVolunteerGroup': { + '_id': 'groupId1', + 'name': 'Volunteer Group 1', + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = EventService(); + final result = await service.createVolunteerGroup(variables); + + expect(result, isNotNull); + expect( + (result as QueryResult).data!['createVolunteerGroup']['_id'], + 'groupId1', + ); + expect( + result.data!['createVolunteerGroup']['name'], + 'Volunteer Group 1', + ); + }); + + test('Test removeVolunteerGroup method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + final variables = {'groupId': 'groupId123'}; + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().removeEventVolunteerGroup(), + variables: variables, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'removeVolunteerGroup': { + '_id': 'groupId123', + 'name': 'Volunteer Group 1', + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = EventService(); + final result = await service.removeVolunteerGroup(variables); + expect(result, isA()); + expect(result.data!['removeVolunteerGroup']['_id'], 'groupId123'); + }); + + test('Test addVolunteerToGroup method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + final variables = { + 'groupId': 'groupId123', + 'volunteerId': 'volunteerId123', + }; + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().addVolunteerToGroup(), + variables: {'data': variables}, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'addVolunteerToGroup': { + '_id': 'volunteerId123', + 'name': 'Volunteer Name', + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = EventService(); + final result = await service.addVolunteerToGroup(variables); + expect(result, isA()); + expect(result.data!['addVolunteerToGroup']['_id'], 'volunteerId123'); + }); + + test('Test removeVolunteerFromGroup method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + final variables = {'volunteerId': 'volunteerId123'}; + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().removeVolunteerMutation(), + variables: variables, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'removeVolunteer': { + '_id': 'volunteerId123', + 'name': 'Volunteer Name', + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = EventService(); + final result = await service.removeVolunteerFromGroup(variables); + expect(result, isA()); + expect(result.data!['removeVolunteer']['_id'], 'volunteerId123'); + }); + + test('Test updateVolunteerGroup method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + final variables = { + 'groupId': 'groupId123', + 'name': 'Updated Volunteer Group Name', + }; + when( + dataBaseMutationFunctions.gqlAuthMutation( + EventQueries().updateVolunteerGroupMutation(), + variables: variables, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'updateVolunteerGroup': { + '_id': 'groupId123', + 'name': 'Updated Volunteer Group Name', + }, + }, + source: QueryResultSource.network, + ), + ); + + final service = EventService(); + final result = await service.updateVolunteerGroup(variables); + expect(result, isA()); + expect(result.data!['updateVolunteerGroup']['_id'], 'groupId123'); + expect( + result.data!['updateVolunteerGroup']['name'], + 'Updated Volunteer Group Name', + ); + }); + + test('Test fetchVolunteerGroupsByEvent method', () async { + final dataBaseMutationFunctions = locator(); + const query = ''; + const eventId = 'eventId123'; + when( + dataBaseMutationFunctions.gqlAuthQuery( + EventQueries().fetchVolunteerGroups(), + variables: { + "where": {"eventId": eventId}, + }, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: { + 'getEventVolunteerGroups': [ + { + '_id': 'groupId1', + 'name': 'Volunteer Group 1', + 'eventId': eventId, + }, + { + '_id': 'groupId2', + 'name': 'Volunteer Group 2', + 'eventId': eventId, + }, + ], + }, + source: QueryResultSource.network, + ), + ); + + final service = EventService(); + final result = await service.fetchVolunteerGroupsByEvent(eventId); + + expect(result, isA>()); + expect(result.length, 2); + expect(result[0].id, 'groupId1'); + expect(result[1].id, 'groupId2'); + }); + test('fetchAgendaCategories returns correct data', () async { + const orgId = 'org123'; + final mockResult = QueryResult( + options: QueryOptions( + document: gql( + EventQueries().fetchAgendaItemCategoriesByOrganization(orgId), + ), + ), + data: { + 'fetchAgendaCategories': [ + {'_id': 'cat1', 'name': 'Category 1'}, + {'_id': 'cat2', 'name': 'Category 2'}, + ], + }, + source: QueryResultSource.network, + ); + + when( + databaseFunctions.gqlAuthMutation( + EventQueries().fetchAgendaItemCategoriesByOrganization(orgId), + ), + ).thenAnswer((_) async => mockResult); + + final service = EventService(); + final result = await service.fetchAgendaCategories(orgId); + + expect(result, equals(mockResult)); + verify( + databaseFunctions.gqlAuthMutation( + EventQueries().fetchAgendaItemCategoriesByOrganization(orgId), + ), + ).called(1); + }); + + test('createAgendaItem sends correct mutation and variables', () async { + final variables = {'title': 'New Agenda', 'description': 'Description'}; + final mockResult = QueryResult( + options: QueryOptions(document: gql('')), + data: { + 'createAgendaItem': {'_id': 'agenda1'}, + }, + source: QueryResultSource.network, + ); + + when( + databaseFunctions.gqlAuthMutation( + EventQueries().createAgendaItem(), + variables: {'input': variables}, + ), + ).thenAnswer((_) async => mockResult); + + final service = EventService(); + + final result = await service.createAgendaItem(variables); + + expect(result, equals(mockResult)); + verify( + databaseFunctions.gqlAuthMutation( + EventQueries().createAgendaItem(), + variables: {'input': variables}, + ), + ).called(1); + }); + + test('deleteAgendaItem sends correct mutation and variables', () async { + final variables = {'agendaItemId': 'agenda1'}; + final mockResult = QueryResult( + options: QueryOptions(document: gql('')), + data: { + 'deleteAgendaItem': {'_id': 'agenda1'}, + }, + source: QueryResultSource.network, + ); + + when( + databaseFunctions.gqlAuthMutation( + EventQueries().deleteAgendaItem(), + variables: variables, + ), + ).thenAnswer((_) async => mockResult); + + final result = await EventService().deleteAgendaItem(variables); + + expect(result, equals(mockResult)); + verify( + databaseFunctions.gqlAuthMutation( + EventQueries().deleteAgendaItem(), + variables: variables, + ), + ).called(1); + }); + + test('updateAgendaItem sends correct mutation and variables', () async { + const itemId = 'agenda1'; + final variables = {'title': 'Updated Agenda'}; + final mockResult = QueryResult( + options: QueryOptions(document: gql('')), + data: { + 'updateAgendaItem': {'_id': 'agenda1', 'title': 'Updated Agenda'}, + }, + source: QueryResultSource.network, + ); + + when( + databaseFunctions.gqlAuthMutation( + EventQueries().updateAgendaItem(), + variables: { + 'updateAgendaItemId': itemId, + 'input': variables, + }, + ), + ).thenAnswer((_) async => mockResult); + + final result = await EventService().updateAgendaItem(itemId, variables); + + expect(result, equals(mockResult)); + verify( + databaseFunctions.gqlAuthMutation( + EventQueries().updateAgendaItem(), + variables: { + 'updateAgendaItemId': itemId, + 'input': variables, + }, + ), + ).called(1); + }); + + test('fetchAgendaItems returns correct data', () async { + const eventId = 'event123'; + final mockResult = QueryResult( + options: QueryOptions(document: gql('')), + data: { + 'fetchAgendaItems': [ + {'_id': 'agenda1', 'title': 'Agenda Item 1'}, + {'_id': 'agenda2', 'title': 'Agenda Item 2'}, + ], + }, + source: QueryResultSource.network, + ); + + when( + databaseFunctions.gqlAuthQuery( + EventQueries().fetchAgendaItemsByEvent(eventId), + ), + ).thenAnswer((_) async => mockResult); + + final result = await EventService().fetchAgendaItems(eventId); + + expect(result, equals(mockResult)); + verify( + databaseFunctions.gqlAuthQuery( + EventQueries().fetchAgendaItemsByEvent(eventId), + ), + ).called(1); + }); + }); +} diff --git a/test/service_tests/graphql_config_test.dart b/test/service_tests/graphql_config_test.dart new file mode 100644 index 000000000..3294f3e18 --- /dev/null +++ b/test/service_tests/graphql_config_test.dart @@ -0,0 +1,34 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:talawa/services/graphql_config.dart'; +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +void main() { + setUp(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + + registerServices(); + }); + group('Testing Graphql Config', () { + test('test httpLink with MockHttpClient', () async { + final graphqlConfig = GraphqlConfig(); + final mockHttpClient = MockHttpClient(); + final mockUri = Uri.parse('https://example.com/graphql'); + + graphqlConfig.httpLink = HttpLink( + mockUri.toString(), + httpClient: mockHttpClient, + ); + + final response = await graphqlConfig + .clientToQuery() + .query(QueryOptions(document: gql('query {}'))); + expect( + response.data, + isNull, + ); + }); + }); +} diff --git a/test/service_tests/hive_manager_test.dart b/test/service_tests/hive_manager_test.dart new file mode 100644 index 000000000..89eb4e8ad --- /dev/null +++ b/test/service_tests/hive_manager_test.dart @@ -0,0 +1,38 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/hive_manager.dart'; + +void main() { + group('test HiveManager', () { + test('tearDownHive', () async { + await HiveManager.teardownHive(); + + expect(Hive.isBoxOpen(HiveKeys.userBoxKey), isFalse); + expect(Hive.isBoxOpen(HiveKeys.orgBoxKey), isFalse); + expect(Hive.isBoxOpen(HiveKeys.asymetricKeyBoxKey), isFalse); + expect(Hive.isBoxOpen(HiveKeys.pluginBoxKey), isFalse); + expect(Hive.isBoxOpen(HiveKeys.urlBoxKey), isFalse); + expect(Hive.isBoxOpen(HiveKeys.offlineActionQueueKey), isFalse); + expect(Hive.isBoxOpen(HiveKeys.postFeedKey), isFalse); + expect(Hive.isBoxOpen(HiveKeys.eventFeedKey), isFalse); + + await HiveManager.teardownHive(); + }); + + test('openBox', () async { + await HiveManager.openBox(HiveKeys.orgBoxKey); + await HiveManager.openBox(HiveKeys.orgBoxKey); + }); + + test('closeHiveBox', () async { + await HiveManager.closeBox('xyz'); + }); + + test('registerAdapter', () async { + await HiveManager.registerAdapter(UserAdapter()); + }); + }); +} diff --git a/test/service_tests/image_service_test.dart b/test/service_tests/image_service_test.dart new file mode 100644 index 000000000..399fbda7b --- /dev/null +++ b/test/service_tests/image_service_test.dart @@ -0,0 +1,103 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:image_cropper/image_cropper.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/services/image_service.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +class MockImageService extends Mock implements ImageService { + static const throwException = 'throw Exception'; + @override + Future convertToBase64(File file) async { + if (file.path == throwException) throw Exception('fake exception'); + return "base64"; + } +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + }); + + group('Tests for Crop Image', () { + test("test no image provided for the image cropper", () async { + const path = 'test'; + final file = await imageService.cropImage(imageFile: File(path)); + expect(file?.path, null); + }); + + test("crop image method", () async { + final mockImageCropper = imageCropper; + + const path = "test"; + final fakefile = File(path); + final croppedFile = CroppedFile("fakeCropped"); + + when( + mockImageCropper.cropImage( + sourcePath: "test", + aspectRatioPresets: [ + CropAspectRatioPreset.square, + CropAspectRatioPreset.original, + ], + uiSettings: anyNamed('uiSettings'), + ), + ).thenAnswer((realInvocation) async => croppedFile); + + final file = await imageService.cropImage(imageFile: fakefile); + + expect(file?.path, croppedFile.path); + }); + + test("error in crop image", () async { + final mockImageCropper = locator(); + const path = "test"; + final fakefile = File(path); + when( + mockImageCropper.cropImage( + sourcePath: "test", + aspectRatioPresets: [ + CropAspectRatioPreset.square, + CropAspectRatioPreset.original, + ], + uiSettings: anyNamed('uiSettings'), + ), + ).thenThrow(Exception()); + expect( + imageService.cropImage(imageFile: fakefile), + throwsException, + ); + }); + }); + + group('Tests for convertToBase64', () { + test('convertToBase64 converts file to base64 string', () async { + //using this asset as the test asset + final file = File('assets/images/Group 8948.png'); + final List encodedBytes = file.readAsBytesSync(); + + final fileString = await imageService.convertToBase64(file); + + final List decodedBytes = base64Decode(fileString); + + expect(decodedBytes, equals(encodedBytes)); + }); + + test( + 'Check if convertToBase64 is working even if wrong file path is provided', + () async { + final file = File('fakePath'); + final fileString = await imageService.convertToBase64(file); + expect('', fileString); + }); + }); +} diff --git a/test/service_tests/multi_media_pick_service_test.dart b/test/service_tests/multi_media_pick_service_test.dart new file mode 100644 index 000000000..10e93b76e --- /dev/null +++ b/test/service_tests/multi_media_pick_service_test.dart @@ -0,0 +1,154 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:image_cropper/image_cropper.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/services/navigation_service.dart'; +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 '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + }); + setUp(() { + registerServices(); + SizeConfig().test(); + }); + tearDown(() { + unregisterServices(); + }); + group('MultiMediaPickerService test', () { + test("test get photo from gallery method if camera option is false", + () async { + final mockImageCropper = locator(); + final mockPicker = imagePicker; + final model = MultiMediaPickerService(); + const path = 'test'; + final image = XFile(path); + when(mockPicker.pickImage(source: ImageSource.gallery)) + .thenAnswer((realInvocation) async => image); + when( + mockImageCropper.cropImage( + sourcePath: "test", + aspectRatioPresets: [ + CropAspectRatioPreset.square, + CropAspectRatioPreset.original, + ], + uiSettings: anyNamed('uiSettings'), + ), + ).thenAnswer((realInvocation) async => CroppedFile(path)); + + final result = await model.getPhotoFromGallery(camera: false); + + expect(result?.path, path); + }); + test("test get photo from gallery method if camera option is true", + () async { + final mockImageCropper = locator(); + final mockPicker = locator(); + final model = MultiMediaPickerService(); + const path = 'test'; + final image = XFile(path); + when(mockPicker.pickImage(source: ImageSource.camera)) + .thenAnswer((realInvocation) async => image); + when( + mockImageCropper.cropImage( + sourcePath: "test", + aspectRatioPresets: [ + CropAspectRatioPreset.square, + CropAspectRatioPreset.original, + ], + uiSettings: anyNamed('uiSettings'), + ), + ).thenAnswer((realInvocation) async => CroppedFile(path)); + + final result = await model.getPhotoFromGallery(camera: true); + + expect(result?.path, path); + }); + test("test no photo provided for the pick image", () async { + final model = MultiMediaPickerService(); + final file = await model.getPhotoFromGallery(camera: false); + expect(file?.path, null); + }); + test("camera access denied", () async { + final mockPicker = locator(); + final model = MultiMediaPickerService(); + final printed = []; + + final error = PlatformException(code: 'camera_access_denied'); + when(mockPicker.pickImage(source: ImageSource.camera)).thenThrow(error); + runZoned( + () async { + await model.getPhotoFromGallery(camera: true); + }, + zoneSpecification: ZoneSpecification( + print: (self, parent, zone, line) { + printed.add(line); + }, + ), + ); + expect( + printed[0], + "MultiMediaPickerService : Exception occurred while choosing photo from the gallery $error", + ); + }); + + testWidgets('Test for permission_denied_dialog success action.', + (tester) async { + final service = MultiMediaPickerService(); + + final Widget app = MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold(body: service.permissionDeniedDialog()), + ); + + await tester.pumpWidget(app); + await tester.pumpAndSettle(); + + final settingsFinder = find.textContaining('SETTINGS'); + + expect(settingsFinder, findsOneWidget); + + await tester.tap(settingsFinder); + + verify(navigationService.pop()); + }); + + test("test get fileStream", () async { + final model = MultiMediaPickerService(); + expect( + model.fileStream.toString(), + "Instance of '_AsBroadcastStream'", + ); + }); + }); +} diff --git a/test/service_tests/navigation_service_test.dart b/test/service_tests/navigation_service_test.dart new file mode 100644 index 000000000..17292254d --- /dev/null +++ b/test/service_tests/navigation_service_test.dart @@ -0,0 +1,623 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +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. +/// +/// **params**: +/// * `settings`: RouteSettings +/// +/// **returns**: +/// * `Route`: Returns Route Type +Route _onGenerateTestRoute(RouteSettings settings) { + if (settings.name == '/second-screen') { + if (settings.arguments == null) { + return MaterialPageRoute(builder: (context) => const SecondTestScreen()); + } else { + if (settings.arguments is String) { + return MaterialPageRoute( + builder: (context) => SecondTestScreen( + arguments: settings.arguments! as String, + ), + ); + } else if (settings.arguments is Function) { + return MaterialPageRoute( + builder: (context) => SecondTestScreen( + onclick: settings.arguments! as VoidCallback, + ), + ); + } else if (settings.arguments is Map) { + final map = settings.arguments! as Map; + return MaterialPageRoute( + builder: (context) => SecondTestScreen( + arguments: map['Argument'] as String, + onclick: map['Function'] as VoidCallback, + ), + ); + } + } + } + if (settings.name == '/first-screen') { + if (settings.arguments == null) { + return MaterialPageRoute( + builder: (context) => FirstTestScreen( + onClick: () {}, + ), + ); + } else { + return MaterialPageRoute( + builder: (context) => FirstTestScreen( + onClick: () {}, + arguments: settings.arguments! as String, + ), + ); + } + } + if (settings.name == '/third-screen') { + if (settings.arguments == null) { + return MaterialPageRoute(builder: (context) => const ThirdTestScreen()); + } else { + return MaterialPageRoute( + builder: (context) => ThirdTestScreen( + arguments: settings.arguments! as String, + ), + ); + } + } + return MaterialPageRoute( + builder: (context) => FirstTestScreen( + onClick: () {}, + ), + ); +} + +class HomeApp extends StatefulWidget { + const HomeApp({ + super.key, + required this.onClick, + required this.navigateorKey, + }); + final GlobalKey navigateorKey; + final VoidCallback onClick; + + @override + State createState() => _HomeAppState(); +} + +class _HomeAppState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + navigatorKey: widget.navigateorKey, + initialRoute: '/', + onGenerateRoute: _onGenerateTestRoute, + home: FirstTestScreen( + onClick: () { + widget.onClick(); + }, + ), + ); + } +} + +class HomeApp2 extends StatefulWidget { + const HomeApp2({ + super.key, + required this.onClick, + required this.navigateorKey, + }); + final GlobalKey navigateorKey; + final VoidCallback onClick; + + @override + State createState() => _HomeAppState2(); +} + +class _HomeAppState2 extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + navigatorKey: widget.navigateorKey, + initialRoute: '/', + onGenerateRoute: _onGenerateTestRoute, + home: FirstTestScreen( + onClick: () { + widget.onClick(); + }, + ), + ); + } +} + +class FirstTestScreen extends StatefulWidget { + const FirstTestScreen({super.key, required this.onClick, this.arguments}); + final VoidCallback onClick; + final String? arguments; + + @override + State createState() => _FirstScrenState(); +} + +class _FirstScrenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Column( + children: [ + Center( + child: ElevatedButton( + child: const Text('Button'), + onPressed: () { + widget.onClick(); + }, + ), + ), + const Text('First Screen'), + Center( + child: Text(widget.arguments == null ? 'null' : widget.arguments!), + ), + ], + ), + ); + } +} + +class SecondTestScreen extends StatefulWidget { + const SecondTestScreen({super.key, this.arguments, this.onclick}); + final String? arguments; + final VoidCallback? onclick; + + @override + State createState() => _SecondTestScreenState(); +} + +class _SecondTestScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Column( + children: [ + const Center(child: Text('Second Screen')), + Center( + child: Text(widget.arguments == null ? 'null' : widget.arguments!), + ), + ElevatedButton( + onPressed: () { + if (widget.onclick != null) { + widget.onclick?.call(); + } + }, + child: const Text('Button 2'), + ), + ], + ), + ); + } +} + +class ThirdTestScreen extends StatefulWidget { + const ThirdTestScreen({super.key, this.arguments}); + final String? arguments; + @override + State createState() => _ThirdTestScreenState(); +} + +class _ThirdTestScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Column( + children: [ + const Text('Third Screen'), + Center( + child: Text(widget.arguments == null ? 'null' : widget.arguments!), + ), + ], + ), + ); + } +} + +class TalawaErrorWidget extends StatelessWidget { + const TalawaErrorWidget({ + super.key, + required this.navigationService, + required this.onClick, + }); + final NavigationService navigationService; + final VoidCallback onClick; + + @override + Widget build(BuildContext context) { + return MaterialApp( + navigatorKey: navigationService.navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + onClick(); + }, + ), + ), + ); + } +} + +void main() { + SizeConfig().test(); + group('Navigation Services Tests', () { + late NavigationService navigationService; + late GlobalKey mockKey; + setUp(() { + navigationService = NavigationService(); + mockKey = navigationService.navigatorKey; + }); + testWidgets('pushScreen() test without arguments', + (WidgetTester tester) async { + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + await navigationService.pushScreen('/second-screen'); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.textContaining('Second Screen'), findsOneWidget); + expect(find.textContaining('null'), findsOneWidget); + }); + + testWidgets('showCustomToast', (WidgetTester tester) async { + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + navigationService.showCustomToast('/second-screen'); + navigationService.printNavigatorState(); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.textContaining('/second-screen'), findsOneWidget); + }); + testWidgets('pushScreen() test with arguments', (tester) async { + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + await navigationService.pushScreen( + '/second-screen', + arguments: 'Hello Talawa', + ); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.textContaining('Second Screen'), findsOneWidget); + expect(find.textContaining('Hello Talawa'), findsOneWidget); + }); + testWidgets('popAndPushScreen() test without arguments', (tester) async { + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + await mockKey.currentState!.pushNamed('/second-screen'); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + final initialPageLength = mockKey.currentState!.widget.pages.length; + navigationService.popAndPushScreen('/first-screen'); + await tester.pumpAndSettle(); + final finalPageLength = mockKey.currentState!.widget.pages.length; + expect(find.textContaining('null'), findsOneWidget); + expect(find.textContaining('First Screen'), findsOneWidget); + expect(finalPageLength, initialPageLength); + }); + testWidgets('popAndPushScreen() test with arguments', (tester) async { + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + await mockKey.currentState!.pushNamed('/second-screen'); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + final initialPageLength = mockKey.currentState!.widget.pages.length; + navigationService.popAndPushScreen( + '/first-screen', + arguments: 'Hello Talawa', + ); + await tester.pumpAndSettle(); + final finalPageLength = mockKey.currentState!.widget.pages.length; + expect(find.textContaining('Hello Talawa'), findsOneWidget); + expect(find.textContaining('First Screen'), findsOneWidget); + expect(finalPageLength, initialPageLength); + }); + testWidgets('pushReplacementScreen() test without arguments', + (tester) async { + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + await mockKey.currentState!.pushNamed( + '/second-screen', + arguments: mockKey.currentState!.pushNamed('/first-screen'), + ); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + navigationService.pushReplacementScreen('/first-screen'); + await tester.pumpAndSettle(); + expect(find.textContaining('null'), findsOneWidget); + expect(find.textContaining('First Screen'), findsOneWidget); + }); + testWidgets('pushReplacementScreen() test with arguments', (tester) async { + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + await mockKey.currentState!.pushNamed( + '/second-screen', + arguments: mockKey.currentState!.pushNamed('/first-screen'), + ); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + navigationService.pushReplacementScreen( + '/first-screen', + arguments: 'Hello Talawa', + ); + await tester.pumpAndSettle(); + expect(find.textContaining('Hello Talawa'), findsOneWidget); + expect(find.textContaining('First Screen'), findsOneWidget); + }); + testWidgets('removeAllAndPush() test without arguments', (tester) async { + void functionToTest() { + navigationService.removeAllAndPush( + '/third-screen', + '/second-screen', + ); + } + + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + await mockKey.currentState!.pushNamed( + '/second-screen', + arguments: functionToTest, + ); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.textContaining('null'), findsOneWidget); + expect(find.textContaining('Third Screen'), findsOneWidget); + expect(mockKey.currentState!.widget.pages.length, 0); + }); + testWidgets('removeAllAndPush() test with arguments', (tester) async { + void functionToTest() { + navigationService.removeAllAndPush( + '/third-screen', + '/second-screen', + arguments: 'Hello Talawa', + ); + } + + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () async { + await mockKey.currentState!.pushNamed( + '/second-screen', + arguments: functionToTest, + ); + }, + ), + ); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.textContaining('Hello Talawa'), findsOneWidget); + expect(find.textContaining('Third Screen'), findsOneWidget); + expect(mockKey.currentState!.widget.pages.length, 0); + }); + testWidgets('pushDialog() test', (tester) async { + Widget testDialog() { + return const AlertDialog( + title: Text('Test Dialog'), + content: Text('This is a test dialog.'), + ); + } + + void functionForOnClick() { + navigationService.pushDialog(testDialog()); + } + + await tester.pumpWidget( + HomeApp(navigateorKey: mockKey, onClick: functionForOnClick), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.byWidget(testDialog()), findsOneWidget); + await tester.tap(find.byType(FirstTestScreen), warnIfMissed: false); + await tester.pumpAndSettle(); + expect(find.byWidget(testDialog()), findsOneWidget); + }); + testWidgets('showSnackBar() test with default duration', (tester) async { + await tester.pumpWidget( + HomeApp2( + navigateorKey: mockKey, + onClick: () { + navigationService.showSnackBar('Hello Talawa'); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.textContaining('Hello Talawa'), findsOneWidget); + final snackBarFinder = find.byType(SnackBar); + final snackBarWidget = tester.widget(snackBarFinder); + expect(snackBarWidget.behavior, equals(SnackBarBehavior.floating)); + expect(snackBarWidget.duration, equals(const Duration(seconds: 2))); + }); + testWidgets('showSnackBar() test with custom duration', (tester) async { + await tester.pumpWidget( + HomeApp2( + navigateorKey: mockKey, + onClick: () { + navigationService.showSnackBar( + 'Hello Talawa', + duration: const Duration(seconds: 3), + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(find.textContaining('Hello Talawa'), findsOneWidget); + final snackBarFinder = find.byType(SnackBar); + final snackBarWidget = tester.widget(snackBarFinder); + expect(snackBarWidget.behavior, equals(SnackBarBehavior.floating)); + expect(snackBarWidget.duration, equals(const Duration(seconds: 3))); + }); + testWidgets('showTalawaErrorSnackBar() test with default duration', + (tester) async { + await tester.pumpWidget( + TalawaErrorWidget( + navigationService: navigationService, + onClick: () { + navigationService.showTalawaErrorSnackBar( + 'Error Message', + MessageType.error, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + final snackBarFinder = find.byType(SnackBar); + final snackBarWidget = tester.widget(snackBarFinder); + expect( + snackBarWidget.duration, + equals(const Duration(milliseconds: 1040)), + ); + expect( + snackBarWidget.backgroundColor, + const Color.fromRGBO(65, 65, 66, 1), + ); + }); + testWidgets('showTalawaErrorSnackBar() test with custom duration', + (tester) async { + await tester.pumpWidget( + TalawaErrorWidget( + navigationService: navigationService, + onClick: () { + navigationService.showTalawaErrorSnackBar( + 'Error Message', + MessageType.error, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + final snackBarFinder = find.byType(SnackBar); + final snackBarWidget = tester.widget(snackBarFinder); + expect( + snackBarWidget.duration, + equals(const Duration(milliseconds: 1040)), + ); + expect( + snackBarWidget.backgroundColor, + const Color.fromRGBO(65, 65, 66, 1), + ); + }); + testWidgets('showTalawaErrorDialog() test with custom duration', + (tester) async { + await tester.pumpWidget( + TalawaErrorWidget( + navigationService: navigationService, + onClick: () { + navigationService.showTalawaErrorDialog( + 'Hello Talawa', + MessageType.error, + ); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + expect(find.byType(TalawaErrorDialog), findsOneWidget); + await tester.tap(find.byType(TalawaErrorWidget), warnIfMissed: false); + await tester.pumpAndSettle(); + expect(find.byType(TalawaErrorDialog), findsOneWidget); + }); + testWidgets('pop() method test', (tester) async { + await tester.pumpWidget( + HomeApp( + navigateorKey: mockKey, + onClick: () { + navigationService.pop(); + }, + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byType(ElevatedButton)); + await tester.pumpAndSettle(); + expect(mockKey.currentState!.canPop(), false); + }); + }); +} diff --git a/test/service_tests/org_service_test.dart b/test/service_tests/org_service_test.dart new file mode 100644 index 000000000..736e6cd77 --- /dev/null +++ b/test/service_tests/org_service_test.dart @@ -0,0 +1,95 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/org_service.dart'; + +import '../helpers/test_helpers.dart'; + +/// Tests org_service.dart. +void main() { + registerServices(); + + group('Test OrganizationService', () { + final OrganizationService organizationService = OrganizationService(); + final dbFunctions = locator(); + + test('Test getOrgMembersList', () async { + const String orgId = '123'; + const String query = ''' + query{ + organizations(id: "$orgId"){ + image + _id + name + admins{ + _id + } + description + userRegistrationRequired + creator{ + _id + firstName + lastName + } + members{ + _id + firstName + lastName + image + } + } + } + '''; + + final List> userJsonList = [ + { + '_id': 'user_id_1', + 'accessToken': ' ', + 'refreshToken': ' ', + 'firstName': 'Some', + 'lastName': 'Name', + }, + { + '_id': 'user_id_2', + 'accessToken': ' ', + 'refreshToken': ' ', + 'firstName': 'Name', + 'lastName': 'Some', + }, + ]; + + final QueryResult queryResult = QueryResult.internal( + parserFn: (map) => '123', + source: null, + data: { + 'organizations': [ + { + 'members': userJsonList, + }, + ], + }, + ); + when(dbFunctions.gqlAuthMutation(query)) + .thenAnswer((realInvocation) async => queryResult); + + final result = await organizationService.getOrgMembersList(orgId); + + expect(result.length, 2); + for (int index = 0; index < result.length; index++) { + final User user = User.fromJson(userJsonList[index], fromOrg: true); + + expect(result[index].id, user.id); + expect(result[index].authToken, user.authToken); + expect(result[index].refreshToken, user.refreshToken); + expect(result[index].firstName, user.firstName); + expect(result[index].lastName, user.lastName); + } + }); + }); +} diff --git a/test/service_tests/post_service_test.dart b/test/service_tests/post_service_test.dart new file mode 100644 index 000000000..26da8e0bb --- /dev/null +++ b/test/service_tests/post_service_test.dart @@ -0,0 +1,689 @@ +import 'dart:async'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/user_action_handler.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; + +import '../helpers/test_helpers.dart'; + +/// Tests post_service.dart. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() { + setUp(() { + registerServices(); + locator.registerSingleton(ActionHandlerService()); + }); + tearDown(() { + locator.unregister(); + }); + final demoJson = { + '__typename': 'Query', + 'organizations': [ + { + '__typename': 'Organization', + 'posts': { + '__typename': 'PostsConnection', + 'edges': [ + { + '__typename': 'PostEdge', + 'node': { + '__typename': 'Post', + '_id': '65e1aac38836aa003e4b8318', + 'title': 'testing', + 'text': 'test post', + 'imageUrl': + 'http://10.0.2.2:4000/images/5vFxR-8xE2GD-5Tu3E1QYimage.png', + 'videoUrl': null, + 'creator': { + '__typename': 'User', + '_id': '65378abd85008f171cf2990d', + 'firstName': 'Vyvyan', + 'lastName': 'Kerry', + 'email': 'testadmin1@example.com', + }, + 'createdAt': '2024-03-01T10:15:31.168Z', + 'likeCount': 0, + 'commentCount': 0, + 'likedBy': [], + 'comments': [], + 'pinned': true, + }, + 'cursor': '65e1aac38836aa003e4b8318', + }, + { + '__typename': 'PostEdge', + 'node': { + '__typename': 'Post', + '_id': '6589bdd92caa9d8d69087515', + 'title': 'Winter Wonderland: Ice Skating Extravaganza', + 'text': + 'Gliding gracefully on frozen lakes, surrounded by enchanting winter landscape—ice skating extravaganza, a dance in a winter wonderland.', + 'imageUrl': null, + 'videoUrl': null, + 'creator': { + '__typename': 'User', + '_id': '658938ba2caa9d8d6908748a', + 'firstName': 'Peggy', + 'lastName': 'Bowers', + 'email': 'testuser11@example.com', + }, + 'createdAt': '2024-03-01T10:15:31.168Z', + 'likeCount': 0, + 'commentCount': 0, + 'likedBy': [], + 'comments': [], + }, + 'cursor': '6589bdd92caa9d8d69087515', + } + ], + 'pageInfo': { + '__typename': 'DefaultConnectionPageInfo', + 'startCursor': '65e1aac38836aa003e4b8318', + 'endCursor': '6589bd9b2caa9d8d6908750f', + 'hasNextPage': true, + 'hasPreviousPage': false, + }, + }, + } + ], + }; + final demoJsonPage2 = { + '__typename': 'Query', + 'organizations': [ + { + '__typename': 'Organization', + 'posts': { + '__typename': 'PostsConnection', + 'edges': [ + { + '__typename': 'PostEdge', + 'node': { + '__typename': 'Post', + '_id': '65e1aac38836aa003e4b8319', + 'title': 'Second Page Post 1', + 'text': 'This is the first post on the second page', + 'imageUrl': 'http://example.com/image2.jpg', + 'videoUrl': null, + 'creator': { + '__typename': 'User', + '_id': 'user_id_2', + 'firstName': 'John', + 'lastName': 'Doe', + 'email': 'john.doe@example.com', + }, + 'createdAt': '2024-03-02T10:15:31.168Z', + 'likeCount': 5, + 'commentCount': 2, + 'likedBy': [], + 'comments': [ + {'commentId': 'comment_id_1', 'text': 'Comment 1'}, + {'commentId': 'comment_id_2', 'text': 'Comment 2'}, + ], + 'pinned': false, + }, + 'cursor': '65e1aac38836aa003e4b8319', + }, + { + '__typename': 'PostEdge', + 'node': { + '__typename': 'Post', + '_id': '65e1aac38836aa003e4b8320', + 'title': 'Second Page Post 2', + 'text': 'This is the second post on the second page', + 'imageUrl': 'http://example.com/image3.jpg', + 'videoUrl': null, + 'creator': { + '__typename': 'User', + '_id': 'user_id_3', + 'firstName': 'Jane', + 'lastName': 'Doe', + 'email': 'jane.doe@example.com', + }, + 'createdAt': '2024-03-02T10:30:00.000Z', + 'likeCount': 10, + 'commentCount': 3, + 'likedBy': [], + 'comments': [ + {'commentId': 'comment_id_3', 'text': 'Comment 3'}, + {'commentId': 'comment_id_4', 'text': 'Comment 4'}, + {'commentId': 'comment_id_5', 'text': 'Comment 5'}, + ], + 'pinned': false, + }, + 'cursor': '65e1aac38836aa003e4b8320', + }, + // Add more posts as needed + ], + 'pageInfo': { + '__typename': 'DefaultConnectionPageInfo', + 'startCursor': '65e1aac38836aa003e4b8319', + 'endCursor': '65e1aac38836aa003e4b8320', + 'hasNextPage': false, + 'hasPreviousPage': true, + }, + }, + } + ], + }; + + //Fake CurrentOrgID + const currentOrgID = 'XYZ'; + //Fake PostID + const postID = '65e1aac38836aa003e4b8318'; + + group('Test PostService', () { + test('deletePost', () async { + final dataBaseMutationFunctions = locator(); + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + when( + dataBaseMutationFunctions.gqlAuthMutation( + PostQueries().removePost(), + variables: { + 'id': 'azad', + }, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(PostQueries().removePost())), + data: demoJson, + source: QueryResultSource.network, + ), + ); + final service = PostService(); + final post = Post(sId: 'id', creator: User(id: 'azad')); + service.deletePost(post); + }); + test('Test refreshFeed method', () async { + final dataBaseMutationFunctions = locator(); + + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + //Mocking GetPosts + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + final service = PostService(); + // Populating refreshing feed + await service.refreshFeed(); + verify( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).called(1); + }); + + test('Test addNewPost method', () async { + final dataBaseMutationFunctions = locator(); + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + final service = PostService(); + await service.getPosts(); + service.addNewpost(Post(sId: '1', creator: User())); + + final List posts = await service.postStream.first; + expect(posts.length, 3); + }); + test('Test getPosts Method', () async { + final dataBaseMutationFunctions = locator(); + //Setting up Demo data to be returned + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + locator.unregister(); + locator.registerSingleton(PostService()); + final service = locator(); + + final orgFeedViewModel = OrganizationFeedViewModel(); + orgFeedViewModel.initialise(isTest: true); + + // // print(service.st) + + await service.getPosts(); + // //Fetching Post Stream + // final List posts = await service.postStream.first; + // //Testing if Two Mock posts got added + // expect(posts.length, 2); + }); + + test('Test addLike Method', () async { + final dataBaseMutationFunctions = locator(); + + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + //Mocking GetPosts + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + when( + dataBaseMutationFunctions.gqlAuthMutation( + PostQueries().addLike(), + variables: {"postID": postID}, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: null, + source: QueryResultSource.network, + ), + ); + + final service = PostService(); + //Populating posts Stream + await service.getPosts(); + //Calling AddLike + await service.addLike(postID); + //Fetching Post Stream + final List posts = await service.postStream.first; + //Finding The Post which is supposed to be Liked + final Post likedPost = + posts.firstWhere((element) => element.sId == postID); + //Testing if the post got liked + expect(likedPost.likedBy!.length, 1); + }); + + test('Test removeLike Method', () async { + final dataBaseMutationFunctions = locator(); + + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + //Mocking GetPosts + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + when( + dataBaseMutationFunctions.gqlAuthMutation( + PostQueries().addLike(), + variables: {"postID": postID}, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: { + '_id': 'azad', + }, + source: QueryResultSource.network, + ), + ); + + when( + dataBaseMutationFunctions.gqlAuthMutation( + PostQueries().removeLike(), + variables: {"postID": postID}, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: { + '_id': 'azad', + }, + source: QueryResultSource.network, + ), + ); + + final service = PostService(); + //Populating posts Stream + await service.getPosts(); + //Liking Post which is to be Unliked + await service.addLike(postID); + //Unliking Post + await service.removeLike(postID); + //Fetching Post Stream + final List posts = await service.postStream.first; + //Finding The Post which is supposed to be Unliked + final Post likedPost = + posts.firstWhere((element) => element.sId == postID); + //Testing if the post got unliked + expect(likedPost.likedBy!.length, 0); + }); + + test('Test addCommentLocally Method', () async { + final dataBaseMutationFunctions = locator(); + + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + //Mocking GetPosts + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + final service = PostService(); + //Populating posts Stream + await service.getPosts(); + //Adding Comment to a Post + service.addCommentLocally(postID); + //Fetching Post Stream + final List posts = await service.postStream.first; + //Finding The Post which is supposed to be commented + final Post commentedPost = + posts.firstWhere((element) => element.sId == postID); + //Testing if the post got a comment + expect(commentedPost.comments!.length, 1); + }); + test('Test updatedPostStream Stream', () async { + final dataBaseMutationFunctions = locator(); + + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + // Mocking GetPosts + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + when( + dataBaseMutationFunctions.gqlAuthMutation( + PostQueries().addLike(), + variables: {"postID": postID}, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: null, + source: QueryResultSource.network, + ), + ); + + final service = PostService(); + // Populating posts Stream + await service.getPosts(); + + // Listen to updatedPostStream and collect emitted values + final List updatedPosts = []; + final subscription = service.updatedPostStream.listen((post) { + updatedPosts.add(post); + }); + + // Trigger an event that should update the post + await service.addLike(postID); + + // Wait for the stream to emit values + await Future.delayed( + const Duration(seconds: 1), + ); // Adjust the delay as needed + + // Verify that the correct post was emitted + expect(updatedPosts.length, 1); + expect(updatedPosts[0].sId, postID); + // Cancel the subscription to avoid memory leaks + await subscription.cancel(); + }); + test( + 'Test setOrgStreamSubscription method after the organization is updated', + () async { + final dataBaseMutationFunctions = locator(); + + final queryNewOrg = + PostQueries().getPostsById("newOrgId", null, null, 5, null); + + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + // Mocking GetPosts + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + when( + dataBaseMutationFunctions.gqlAuthQuery( + queryNewOrg, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + final service = PostService(); + // Populating posts Stream + await service.getPosts(); + + // Set up mock for currentOrgInfoStream + final mockUserConfig = locator(); + final orgInfoStreamController = StreamController(); + when(mockUserConfig.currentOrgInfoStream) + .thenAnswer((_) => orgInfoStreamController.stream); + + // Call setOrgStreamSubscription + service.setOrgStreamSubscription(); + + // Trigger an event that should update the organization + orgInfoStreamController.add(OrgInfo(id: 'newOrgId')); + + // Wait for the setOrgStreamSubscription logic to execute + await Future.delayed( + const Duration(seconds: 1), + ); // Adjust the delay as needed + + when( + dataBaseMutationFunctions.gqlAuthQuery( + queryNewOrg, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: null, + source: QueryResultSource.network, + ), + ); + + await service.getPosts(); + + // Verify that refresh token was called to check getPost method was called correctly. + verify( + dataBaseMutationFunctions.gqlAuthQuery( + queryNewOrg, + ), + ).called(2); + + // Close the stream controller to avoid memory leaks + await orgInfoStreamController.close(); + }); + test("Test the nextPage and previous page funcitonality", () async { + final dataBaseMutationFunctions = locator(); + + final query = + PostQueries().getPostsById(currentOrgID, null, null, 5, null); + // Mocking GetPosts + when( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query)), + data: demoJson, + source: QueryResultSource.network, + ), + ); + final query2 = PostQueries().getPostsById( + currentOrgID, + "6589bd9b2caa9d8d6908750f", + null, + 5, + null, + ); + when( + dataBaseMutationFunctions.gqlAuthQuery( + query2, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query2)), + data: demoJsonPage2, + source: QueryResultSource.network, + ), + ); + + final service = PostService(); + // Populating posts Stream + await service.getPosts(); + //Fetching next posts + await service.nextPage(); + expect(service.after, "6589bd9b2caa9d8d6908750f"); + expect(service.first, 5); + expect(service.before, null); + expect(service.last, null); + verify( + dataBaseMutationFunctions.gqlAuthQuery( + query, + ), + ); + + final query3 = PostQueries().getPostsById( + currentOrgID, + null, + "65e1aac38836aa003e4b8319", + null, + 5, + ); + when( + dataBaseMutationFunctions.gqlAuthQuery( + query3, + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions(document: gql(query2)), + data: demoJsonPage2, + source: QueryResultSource.network, + ), + ); + + await service.previousPage(); + expect(service.after, null); + expect(service.last, 5); + expect(service.before, "65e1aac38836aa003e4b8319"); + expect(service.first, null); + verify( + dataBaseMutationFunctions.gqlAuthQuery( + query3, + ), + ); + }); + }); +} diff --git a/test/service_tests/session_manager_test.dart b/test/service_tests/session_manager_test.dart new file mode 100644 index 000000000..f5bace7a9 --- /dev/null +++ b/test/service_tests/session_manager_test.dart @@ -0,0 +1,46 @@ +import 'package:fake_async/fake_async.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/session_manager.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + setUpAll(() { + setupLocator(); + }); + + group('Test Session Manger', () { + setUpAll(() { + getAndRegisterDatabaseMutationFunctions(); + }); + test('Test Session Manager Constructor', () { + SessionManager(); + }); + + test('initialize refresh interval', () { + userConfig.currentUser = User( + id: "99", + firstName: 'Azad', + refreshToken: 'refreshToken', + ); + fakeAsync((async) { + sessionManager.initializeSessionRefresher(); + async.elapse(const Duration(seconds: 600)); + }); + }); + + test('Refresh Interval is set.', () { + expect(sessionManager.refreshInterval, 600); + }); + + test('Refresh Token Method', () { + sessionManager.refreshSession(); + verify(databaseFunctions.refreshAccessToken("refreshToken")); + }); + }); +} diff --git a/test/service_tests/size_config_test.dart b/test/service_tests/size_config_test.dart new file mode 100644 index 000000000..c9f674ebd --- /dev/null +++ b/test/service_tests/size_config_test.dart @@ -0,0 +1,79 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/size_config.dart'; + +void main() { + late double safeAreaHorizontal; + late double safeAreaVertical; + const MediaQueryData mediaQueryData = MediaQueryData( + size: Size(360, 684), + padding: EdgeInsets.zero, + ); + + group( + 'Test SizeConfig', + () { + testWidgets('Test init method', (WidgetTester tester) async { + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: Builder( + builder: (BuildContext context) { + final config = SizeConfig(); + config.init(context); + safeAreaHorizontal = + mediaQueryData.padding.left + mediaQueryData.padding.right; + safeAreaVertical = + mediaQueryData.padding.top + mediaQueryData.padding.bottom; + expect(SizeConfig.screenWidth, mediaQueryData.size.width); + expect(SizeConfig.screenHeight, mediaQueryData.size.height); + expect( + SizeConfig.blockSizeHorizontal, + SizeConfig.screenWidth! / 100, + ); + expect( + SizeConfig.blockSizeVertical, + SizeConfig.screenHeight! / 100, + ); + expect( + SizeConfig.safeBlockHorizontal, + (SizeConfig.screenWidth! - safeAreaHorizontal) / 100, + ); + expect( + SizeConfig.safeBlockVertical, + (SizeConfig.screenHeight! - safeAreaVertical) / 100, + ); + + return const Placeholder(); + }, + ), + ), + ); + }); + + test('Test test method', () async { + final config = SizeConfig(); + config.test(); + safeAreaHorizontal = + mediaQueryData.padding.left + mediaQueryData.padding.right; + safeAreaVertical = + mediaQueryData.padding.top + mediaQueryData.padding.bottom; + expect(SizeConfig.screenWidth, mediaQueryData.size.width); + expect(SizeConfig.screenHeight, mediaQueryData.size.height); + expect(SizeConfig.blockSizeHorizontal, SizeConfig.screenWidth! / 100); + expect(SizeConfig.blockSizeVertical, SizeConfig.screenHeight! / 100); + expect( + SizeConfig.safeBlockHorizontal, + (SizeConfig.screenWidth! - safeAreaHorizontal) / 100, + ); + expect( + SizeConfig.safeBlockVertical, + (SizeConfig.screenHeight! - safeAreaVertical) / 100, + ); + }); + }, + ); +} diff --git a/test/service_tests/third_party_service_test.dart/connectivity_service_test.dart b/test/service_tests/third_party_service_test.dart/connectivity_service_test.dart new file mode 100644 index 000000000..0bca2232a --- /dev/null +++ b/test/service_tests/third_party_service_test.dart/connectivity_service_test.dart @@ -0,0 +1,133 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart' as http; +import 'package:mockito/mockito.dart'; +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/third_party_service/connectivity_service.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart' as testgetit; + +ConnectivityResult? connectivityStatus = ConnectivityResult.mobile; +bool internetAccessible = true; + +class MockConnectivityService extends Mock + with MockPlatformInterfaceMixin + implements ConnectivityService { + final controller = StreamController(); + + @override + // TODO: implement connectionStatusController + StreamController get connectionStatusController => + controller; + + @override + Future initConnectivity({required http.Client client}) { + // TODO: implement initConnectivity + return Future(() => null); + } + + @override + Stream get connectionStream => controller.stream; + + @override + Future getConnectionType() { + return Future.value(connectivityStatus); + } + + @override + Future isReachable({http.Client? client, String? uriString}) { + return Future.value(internetAccessible); + } +} + +class MockConnectivity extends Mock implements Connectivity { + final controller = StreamController(); + + StreamController get connectivityController => controller; + + @override + Stream get onConnectivityChanged => controller.stream; + + @override + Future checkConnectivity() async { + // TODO: implement checkConnectivity + if (connectivityStatus == null) { + throw const SocketException('socket exception'); + } + return connectivityStatus!; + } +} + +class MockClient extends Mock implements http.Client { + @override + Future get(Uri url, {Map? headers}) async { + if (url.toString() == 'https://timeout.com') { + throw TimeoutException('site took too long to respond'); + } + return http.Response('{}', 200); + } +} + +void main() { + late MockClient mockClient; + late ConnectivityService service; + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + mockClient = MockClient(); + getAndRegisterConnectivity(); + connectivityStatus = ConnectivityResult.mobile; + service = ConnectivityService(); + locator.registerSingleton(service); + connectivityService.initConnectivity(client: http.Client()); + }); + + group('connectivity', () { + test( + 'connectionStream getter', + () async { + expect(connectivityService, isA()); + expect( + connectivityService.connectionStream, + isA>(), + ); + }, + ); + + test('listener', () async { + final mockConnectivity = testgetit.connectivity as MockConnectivity; + mockConnectivity.connectivityController.add(ConnectivityResult.mobile); + + mockConnectivity.connectivityController + .addError(Exception("Something went wrong!")); + }); + + test('check has connection', () async { + connectivityStatus = ConnectivityResult.none; + expect(await service.hasConnection(), false); + + connectivityStatus = ConnectivityResult.mobile; + expect(await service.hasConnection(), true); + }); + + test('isReachable', () async { + final reached = + await service.isReachable(uriString: 'https://google.com'); + expect(reached, true); + }); + + test('isReachable throws TimeoutException on timeout', () async { + final isReachableResult = await service.isReachable( + client: mockClient, + uriString: 'https://timeout.com', + ); + + // Verify results (timeout should be thrown before verification) + expect(isReachableResult, false); + }); + }); +} diff --git a/test/service_tests/user_config_test.dart b/test/service_tests/user_config_test.dart new file mode 100644 index 000000000..156eae6b7 --- /dev/null +++ b/test/service_tests/user_config_test.dart @@ -0,0 +1,329 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:hive/hive.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/session_manager.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +class MockBox extends Mock implements Box {} + +// class MockUser extends Mock implements User { +// @override +// void updateJoinedOrg(List orgList) { +// // TODO: implement updateJoinedOrg +// } + +// @override +// void updateMemberRequestOrg(List orgList) { +// // TODO: implement updateMemberRequestOrg +// } +// } + +class MockSessionManger extends Mock implements SessionManager { + @override + Future refreshSession() { + // TODO: implement refreshSession + return Future.value(true); + } +} + +void main() async { + final userBox = Hive.box('currentUser'); + final urlBox = Hive.box('url'); + final orgBox = Hive.box('currentOrg'); + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + getAndRegisterSessionManager(); + registerServices(); + }); + + final mockUser = User( + adminFor: [ + OrgInfo(id: 'org1', name: 'orga'), + OrgInfo(id: 'org2', name: 'orgb'), + ], + createdOrganizations: [ + OrgInfo(id: 'org1', name: 'orga'), + OrgInfo(id: 'org2', name: 'orgb'), + ], + email: 'test@gmail.com', + firstName: 'user', + lastName: 'one', + image: 'sample.jpg', + joinedOrganizations: [ + OrgInfo(id: 'org1', name: 'orga'), + OrgInfo(id: 'org2', name: 'orgb'), + ], + authToken: 'AuthToken', + refreshToken: 'Refreshtoken', + membershipRequests: [ + OrgInfo(id: 'org1', name: 'orga'), + OrgInfo(id: 'org2', name: 'orgb'), + ], + ); + + final mockOrgDetails = [ + OrgInfo(id: 'org3', name: 'orgc'), + OrgInfo(id: 'org4', name: 'orgd'), + ]; + + group('Test UserConfig service', () { + test('Test for User log out method.', () async { + databaseFunctions.init(); + + when(databaseFunctions.gqlAuthMutation(queries.logout())) + .thenAnswer((realInvocation) async { + final data = { + 'logout': true, + }; + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.logout())), + ); + }); + + when(navigationService.pop()).thenAnswer((_) async {}); + when( + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('LogoutProgress'), + ), + ), + ).thenAnswer((realInvocation) async {}); + + await UserConfig().userLogOut(); + + expect(userBox.isEmpty, true); + expect(urlBox.isEmpty, true); + expect(orgBox.isEmpty, true); + + when(databaseFunctions.gqlAuthMutation(queries.logout())) + .thenAnswer((realInvocation) async { + throw Exception('test exception'); + }); + + UserConfig().userLogOut(); + }); + test('Test for User log out method.', () async { + databaseFunctions.init(); + + when(databaseFunctions.gqlAuthMutation(queries.logout())) + .thenAnswer((realInvocation) async { + final data = { + 'logout': true, + }; + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.logout())), + ); + }); + + when(navigationService.pop()).thenAnswer((_) async {}); + when( + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('LogoutProgress'), + ), + ), + ).thenAnswer((realInvocation) async {}); + + await UserConfig().userLogOut(); + + expect(userBox.isEmpty, true); + expect(urlBox.isEmpty, true); + expect(orgBox.isEmpty, true); + + when(databaseFunctions.gqlAuthMutation(queries.logout())) + .thenAnswer((realInvocation) async { + throw Exception('test exception'); + }); + + UserConfig().userLogOut(); + }); + test('Test for getters & setters.', () { + final model = UserConfig(); + + // model.currentOrgInfoController + expect(model.currentOrgInfoController, isA>()); + + // model.currentOrgName + expect(model.currentOrgName, isA()); + + // model.currenOrg (setter) + model.currentOrg = OrgInfo(name: 'org'); + + // print(model.currentOrgInfoController); + }); + + test('Test for userLoggedIn method.', () async { + final model = UserConfig(); + model.currentUser.id = 'fake_id'; + + userBox.put('user', User(id: 'fake', firstName: 'first')); + + final Map data = { + 'users': [ + { + "user": { + "id": "1234567890", + "firstName": "ravidi", + "lastName": "sheikh", + "email": "ravidisheikh@test.com", + "image": "https://testimg.com", + "accessToken": "randomAccessToken", + "authToken": "randomAuthToken", + "refreshToken": "randomRefreshToken", + }, + 'appUserProfile': { + 'createdOrganizations': [ + { + "name": 'test_org', + "image": 'https://testimg.com', + } + ], + "adminFor": [ + { + "name": 'test_org1', + "image": 'https://testimg.com', + } + ], + }, + } + ], + }; + + when( + databaseFunctions.gqlAuthQuery( + queries.fetchUserInfo, + variables: anyNamed('variables'), + ), + ).thenAnswer((_) async { + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.fetchUserInfo)), + ); + }); + + // if there is _currentUser. + bool loggedIn = await model.userLoggedIn(); + expect(loggedIn, true); + + userBox.delete('user'); + + // if there is no _currentUser. + loggedIn = await model.userLoggedIn(); + expect(loggedIn, false); + + // print(model.currentUser); + }); + + test('test user loggedin when result throws an exception', () async { + final model = UserConfig(); + + when( + databaseFunctions.gqlAuthQuery( + queries.fetchUserInfo, + variables: anyNamed('variables'), + ), + ).thenAnswer((_) async { + throw Exception('Simulated Exception.'); + }); + + // show couldn't update errorsnackbar. + final loggedIn = await model.userLoggedIn(); + expect(loggedIn, true); + }); + + test('Test for updateUserJoinedOrg method', () async { + final model = UserConfig(); + model.currentUser = mockUser; + + await model.updateUserJoinedOrg(mockOrgDetails); + + expect(mockUser.joinedOrganizations, mockOrgDetails); + }); + + test('Test for updateUserCreatedOrg method', () async { + final model = UserConfig(); + model.currentUser = mockUser; + + await model.updateUserCreatedOrg(mockOrgDetails); + + expect(mockUser.createdOrganizations, mockOrgDetails); + }); + + test('Test for updateUserMemberRequestOrg method', () async { + final model = UserConfig(); + model.currentUser = mockUser; + final expected = [...mockUser.membershipRequests!, ...mockOrgDetails]; + await model.updateUserMemberRequestOrg(mockOrgDetails); + + expect(mockUser.membershipRequests, expected); + }); + + test('Test for updateUserAdminOrg method', () async { + final model = UserConfig(); + model.currentUser = mockUser; + + await model.updateUserAdminOrg(mockOrgDetails); + + expect(mockUser.adminFor, mockOrgDetails); + }); + + test('Test for updateAccessToken method.', () async { + final model = UserConfig(); + model.currentUser = mockUser; + const newAuthToken = 'newAccessToken'; + const newRefreshToken = 'newRefreshToken'; + + await model.updateAccessToken( + accessToken: newAuthToken, + refreshToken: newRefreshToken, + ); + + expect(mockUser.authToken, newAuthToken); + expect(mockUser.refreshToken, newRefreshToken); + }); + + test('Test for saveCurrentOrgInHive method.', () async { + final model = UserConfig(); + model.currentUser = mockUser; + + // To test the box.get('org') != null condition. + orgBox.put('org', OrgInfo(id: 'fakeId', name: 'org')); + model.saveCurrentOrgInHive(mockOrgDetails[0]); + + // To test the box.get('org') == null condition. + orgBox.delete('org'); + model.saveCurrentOrgInHive(mockOrgDetails[0]); + }); + + test('Test for updateUser method.', () async { + final model = UserConfig(); + + when(databaseFunctions.init()).thenAnswer((_) { + throw Exception('simulated exception.'); + }); + + final updated = await model.updateUser(User(id: 'sampleId')); + + // user updation failed. + expect(!updated, true); + }); + }); +} diff --git a/test/unit_tests/comment_model_test.dart b/test/unit_tests/comment_model_test.dart deleted file mode 100644 index 4d9d0cb51..000000000 --- a/test/unit_tests/comment_model_test.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:talawa/model/comment.dart'; - -Future main() async { - group('Comment Model', () { - test('Check individual values', () async { - final CommentModel _commentModel = CommentModel("id123", "test123"); - expect(_commentModel.postId, 'id123'); - expect(_commentModel.comment.runtimeType, equals(String)); - expect(_commentModel.comment, isNotNull); - }); - }); -} diff --git a/test/unit_tests/package_info_test.dart b/test/unit_tests/package_info_test.dart deleted file mode 100644 index 794b61df4..000000000 --- a/test/unit_tests/package_info_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:package_info/package_info.dart'; - -Future main() async { - TestWidgetsFlutterBinding.ensureInitialized(); - const MethodChannel channel = - MethodChannel('plugins.flutter.io/package_info'); - - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return {'appName': 'talawa', 'version': '1.0.0', 'buildNumber': '1'}; - }); - final packageInfo = await PackageInfo.fromPlatform(); - group('Testing mocked package_info plugin', () { - test('Test for name of the App', () async { - expect(packageInfo.appName, 'talawa'); - }); - test('Test for version of App', () async { - expect(packageInfo.version, '1.0.0'); - }); - test('Test for buildNumber of App', () async { - expect(packageInfo.buildNumber, '1'); - }); - }); - - channel.setMockMethodCallHandler(null); -} diff --git a/test/unit_tests/user_tasks_tab_test.dart b/test/unit_tests/user_tasks_tab_test.dart deleted file mode 100644 index 407bbc57a..000000000 --- a/test/unit_tests/user_tasks_tab_test.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; - -Map userData = const { - "_id": "605492dbcf13b54d55284731", - "title": "Ay", - "description": "ry", - "deadline": "1616155355596", -}; -void main() { - group('Testing valid displays in task tab', () { - test('Task title should handle null values', () { - expect(userData['description'], 'ry'); - }); - test('Due Date should handle null values', () { - expect(userData['deadline'], '1616155355596'); - }); - }); -} diff --git a/test/unit_tests/validator_test.dart b/test/unit_tests/validator_test.dart deleted file mode 100644 index e03bfdd3d..000000000 --- a/test/unit_tests/validator_test.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:talawa/utils/validator.dart'; - -void main() { - group('Register/login Page test', () { - test('Firstname must not be null', () { - final result = Validator.validateFirstName(''); - expect(result, 'Firstname must not be left blank.'); - }); - - test('Firstname is not null', () { - final result = Validator.validateFirstName('example'); - expect(result, null); - }); - - test('Lastname must not be null', () { - final result = Validator.validateLastName(''); - expect(result, 'Lastname must not be left blank.'); - }); - - test('Lastname is not null', () { - final result = Validator.validateLastName('example'); - expect(result, null); - }); - - test('Shows error when email is empty', () { - // Get the result. - final result = Validator.validateEmail(''); - - // Verify that correct error is shown. - expect(result, "Email must not be left blank"); - }); - - test('Shows error when email is invalid', () { - // Get the result. - final result = Validator.validateEmail('example@com'); - - // Verify that correct error is shown. - expect(result, 'Please enter a valid Email Address'); - }); - - test('Correctly formatted email returns null', () { - final result = Validator.validateEmail('example@email.com'); - expect(result, null); - }); - - test('password less than 6 returns error string', () { - final result = Validator.validatePassword('pass'); - expect(result, 'Invalid Password'); - }); - - test('password valid', () { - final result = Validator.validatePassword('PASSWORD1@'); - expect(result, null); - }); - }); -} diff --git a/test/update_profile_test.dart b/test/update_profile_test.dart deleted file mode 100644 index 2dcdb0e83..000000000 --- a/test/update_profile_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:talawa/utils/validator.dart'; - -void main() { - test('Empty Email Test', () { - final result = Validator.validateEmail(''); - //Email should be non-empty - - expect(result, 'Email must not be left blank'); - }); - - test('Invalid Email Test', () { - final result = Validator.validateEmail('abc'); - //Email should be valid - - expect(result, 'Please enter a valid Email Address'); - }); - - test('Valid Email Test', () { - final result = Validator.validateEmail('test@test.com'); - //Valid email returns null - - expect(result, null); - }); - - test('Empty First Name Test', () { - final result = Validator.validateFirstName(''); - //First name should be non-empty - expect(result, 'Firstname must not be left blank.'); - }); - - test('Valid First Name Test', () { - final result = Validator.validateLastName('Test'); - //Valid first name returns null - - expect(result, null); - }); - - test('Empty Last Name Test', () { - final result = Validator.validateLastName(''); - //Last name should be non-empty - - expect(result, 'Lastname must not be left blank.'); - }); - - test('Valid Last Name Test', () { - final result = Validator.validateLastName('User'); - //Valid last name returns null - - expect(result, null); - }); -} diff --git a/test/utils/app_localization_test.dart b/test/utils/app_localization_test.dart new file mode 100644 index 000000000..6a49121b3 --- /dev/null +++ b/test/utils/app_localization_test.dart @@ -0,0 +1,95 @@ +// ignore_for_file: talawa_api_doc + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/app_localization.dart'; + +void main() { + group("Test for App Localization Class", () { + WidgetsFlutterBinding.ensureInitialized(); + + test("Load JSON File for localizations", () async { + final appLocalizations = AppLocalizations(const Locale('en')); + final result = await appLocalizations.load(); + expect(result, true); + }); + + test("Test mode working properly", () async { + final appLocalizations = + AppLocalizations(const Locale('hi'), isTest: true); + final result = await appLocalizations.load(); + expect(result, true); + + // expect(appLocalizations.strictTranslate("Recover"), "Recover"); + }); + + test("Translate and strict translate", () async { + final appLocalizations = AppLocalizations(const Locale('en')); + final result = await appLocalizations.load(); + expect(result, true); + + // Translate known value + const key = "Please verify URL first"; + const trueData = "Please verify URL first"; + final checkData = appLocalizations.translate(key); + expect(checkData, trueData); + + // Translate unknown value + const key2 = "Lorem ipsum"; + expect(appLocalizations.translate(key2), null); + + // Translate null value + expect(appLocalizations.translate(null), "..."); + + //Strict translate known value + expect(appLocalizations.strictTranslate("Liked by"), "Liked by"); + + // Strict translate unknown value + expect(appLocalizations.strictTranslate(key2), key2); + }); + }); + + group("Test for App Localization Delegate", () { + WidgetsFlutterBinding.ensureInitialized(); + const appLocalizationsDelgate = AppLocalizationsDelegate(); + + test("Language is supported or not", () { + // A supported language + expect(appLocalizationsDelgate.isSupported(const Locale('hi')), true); + + // An unsupported language + expect(appLocalizationsDelgate.isSupported(const Locale('or')), false); + }); + + test("Localization loaded and changed properly", () async { + var testAppLocalization = + await appLocalizationsDelgate.load(const Locale('hi')); + + // In test mode + testAppLocalization.isTest = true; + expect(testAppLocalization.strictTranslate("Recover"), "Recover"); + + // In prod mode + testAppLocalization.isTest = false; + expect(testAppLocalization.strictTranslate("Recover"), "रिकवर कर लेंगे"); + + testAppLocalization = + await appLocalizationsDelgate.load(const Locale('fr')); + + // In test mode + testAppLocalization.isTest = true; + expect(testAppLocalization.strictTranslate("Recover"), "Recover"); + + // In prod mode + testAppLocalization.isTest = false; + expect(testAppLocalization.strictTranslate("Recover"), "votre mot"); + }); + + test("App Localization Delegate should not reload", () async { + expect( + appLocalizationsDelgate.shouldReload(appLocalizationsDelgate), + false, + ); + }); + }); +} diff --git a/test/utils/comment_queries_test.dart b/test/utils/comment_queries_test.dart new file mode 100644 index 000000000..d9b34b9b7 --- /dev/null +++ b/test/utils/comment_queries_test.dart @@ -0,0 +1,43 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/comment_queries.dart'; + +void main() { + group("Tests for comment_queries.dart", () { + test("Check if getPostsComments works correctly", () { + const data = """ + query { + post(id: "abc") + { _id, + comments{ + _id, + text, + createdAt + creator{ + firstName + lastName + } + } + } + } +"""; + final fnData = CommentQueries().getPostsComments("abc"); + expect(fnData, data); + }); + + test("Check if createComment works correctly", () { + const data = """ + mutation createComment(\$postId: ID!, \$text: String!) { + createComment(postId: \$postId, + data:{ + text: \$text, + } + ){ + _id + } + } + """; + final fnData = CommentQueries().createComment(); + expect(fnData, data); + }); + }); +} diff --git a/test/utils/encryptor_test.dart b/test/utils/encryptor_test.dart new file mode 100644 index 000000000..4c311a665 --- /dev/null +++ b/test/utils/encryptor_test.dart @@ -0,0 +1,139 @@ +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:crypto/crypto.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:pointycastle/api.dart' as pointy; +import 'package:pointycastle/asymmetric/oaep.dart'; +import 'package:pointycastle/asymmetric/rsa.dart'; +import 'package:pointycastle/pointycastle.dart'; +import 'package:talawa/models/asymetric_keys/asymetric_keys.dart'; +import 'package:talawa/utils/encryptor.dart'; +import '../helpers/setup_hive.mocks.dart'; + +// This test is being written believing that in future when Encryptor class will get rid of shouldEncrypt variable then all the tests using that variable can be removed +void main() { + group('When shouldEncrypt is true', () { + test('encryptString method should return the encrypted string', () { + Encryptor.shouldEncrypt = true; + const String inputString = 'password123'; + final String outputString = + sha256.convert(utf8.encode(inputString)).toString(); + expect(Encryptor.encryptString(inputString), outputString); + }); + }); +// As the bool variable is not used anywhere except in this method so moving ahead with making this variable as false +// On getting rid of this variable the above test can be removed + group('When shouldEncrypt is false', () { + late Encryptor encryptor; + late AsymmetricKeyPair keyPair; + late pointy.PublicKey publicKey; + late MockHiveInterface mockHiveInterface; + late MockBox mockHiveBox; + setUpAll(() { + encryptor = Encryptor(); + Encryptor.shouldEncrypt = false; + keyPair = encryptor.generateRSAKeyPair(); + publicKey = keyPair.publicKey; + mockHiveInterface = MockHiveInterface(); + mockHiveBox = MockBox(); + }); + test('encryptString method should return the same string', () { + const String inputString = 'password123'; + expect(Encryptor.encryptString(inputString), inputString); + }); + test( + 'Correct security options are added while generating keys from generateRSAKeyPair method', + () { + expect(publicKey, isA()); + final RSAPublicKey key = publicKey as RSAPublicKey; + expect(key.publicExponent, BigInt.parse('65537')); + expect(key.modulus!.bitLength, 2048); + }); + test( + 'Checking whether Box Names and Key Names are appropriate for Hive or not', + () async { + when(mockHiveInterface.openBox('user_keys')) + .thenAnswer((realInvocation) async { + return mockHiveBox; + }); + await encryptor.saveKeyPair(keyPair, mockHiveInterface); + verify(mockHiveInterface.openBox('user_keys')); + verify(mockHiveBox.put('key_pair', any)); + }); + test('For loadPairKey()', () async { + when(mockHiveInterface.openBox('user_keys')) + .thenAnswer((realInvocation) async { + return mockHiveBox; + }); + when(mockHiveBox.get('key_pair')) + .thenAnswer((realInvocation) => AsymetricKeys(keyPair: keyPair)); + await encryptor.loadKeyPair(mockHiveInterface); + verify(mockHiveBox.get('key_pair')); + }); + test( + 'For checking whether the data is properly encrypted through RSA by assymetricEncryptString()', + () { + const String data = 'Hello Talawa'; + final output = encryptor.assymetricEncryptString( + data, + keyPair.publicKey as RSAPublicKey, + ); + final cipher = OAEPEncoding(RSAEngine()) + ..init(false, PrivateKeyParameter(keyPair.privateKey)); + final decryptedBytes = cipher.process(base64Decode(output)); + expect(String.fromCharCodes(decryptedBytes), data); + }); + test( + 'For checking whether the data is getting decrypted properly through assymetricDecryptString()', + () { + const String data = 'Hello Talawa'; + final cipher = OAEPEncoding(RSAEngine()) + ..init(true, PublicKeyParameter(keyPair.publicKey)); + final encryptedBytes = cipher.process(Uint8List.fromList(data.codeUnits)); + final output = encryptor.assymetricDecryptString( + base64Encode(encryptedBytes), + keyPair.privateKey as RSAPrivateKey, + ); + expect(output, data); + }); + test('Test for wrong message sent to receiveMessage()', () { + const Map message = {"message": "Hello Talawa"}; + expect( + encryptor.receiveMessage(message, mockHiveInterface), + throwsException, + ); + }); + test('Unencrypted message sent to receiveMessage()', () { + const Map message = {"encryptedMessage": "Hello Talawa"}; + when(mockHiveInterface.openBox('user_keys')) + .thenAnswer((realInvocation) async { + return mockHiveBox; + }); + when(mockHiveBox.get('key_pair')) + .thenAnswer((realInvocation) => AsymetricKeys(keyPair: keyPair)); + expect( + encryptor.receiveMessage(message, mockHiveInterface), + throwsException, + ); + }); + test('Encrypted Message sent to receiveMessage()', () { + const String data = 'Hello Talawa'; + final cipher = OAEPEncoding(RSAEngine()) + ..init(true, PublicKeyParameter(keyPair.publicKey)); + final encryptedBytes = cipher.process(Uint8List.fromList(data.codeUnits)); + final String encryptedMessge = base64Encode(encryptedBytes); + final Map message = { + "encryptedMessage": encryptedMessge, + }; + when(mockHiveInterface.openBox('user_keys')) + .thenAnswer((realInvocation) async { + return mockHiveBox; + }); + when(mockHiveBox.get('key_pair')) + .thenAnswer((realInvocation) => AsymetricKeys(keyPair: keyPair)); + expect(encryptor.receiveMessage(message, mockHiveInterface), completes); + }); + }); +} diff --git a/test/utils/event_queries_test.dart b/test/utils/event_queries_test.dart new file mode 100644 index 000000000..81572bd8e --- /dev/null +++ b/test/utils/event_queries_test.dart @@ -0,0 +1,413 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/event_queries.dart'; + +void main() { + group("Tests for event_queries.dart", () { + test("Check if fetchOrgEvents works correctly", () { + const data = """ + query { + eventsByOrganizationConnection( + where: { + organization_id: "sampleID" + } + ) { + _id + organization { + _id + image + } + title + description + isPublic + isRegisterable + recurring + startDate + endDate + allDay + startTime + endTime + location + creator { + _id + firstName + lastName + } + admins { + _id + firstName + lastName + } + attendees { + _id + firstName + lastName + image + } + } + } + """; + + final fnData = EventQueries().fetchOrgEvents("sampleID"); + expect(fnData, data); + }); + + test("Check if attendeesByEvent works correctly", () { + const data = ''' + query { + getEventAttendeesByEventId(eventId: "sampleID") { + eventId + userId + isRegistered + isInvited + isCheckedIn + isCheckedOut + } + } + '''; + + final fnData = EventQueries().attendeesByEvent("sampleID"); + expect(fnData, data); + }); + + test("Check if addEvent works correctly", () { + const data = """ + mutation Mutation(\$data: EventInput!, \$recurrenceRuleData: RecurrenceRuleInput) { + createEvent(data: \$data, recurrenceRuleData: \$recurrenceRuleData) { + _id + title + description + } + } + """; + + final fnData = EventQueries().addEvent(); + expect(fnData, data); + }); + + test("Check if registerForEvent works correctly", () { + const data = """ + mutation registerForEvent(\$eventId: ID!) { + registerForEvent(id: \$eventId) { + _id + } + } + """; + + final fnData = EventQueries().registerForEvent(); + expect(fnData, data); + }); + + test("Check if deleteEvent works correctly", () { + const data = """ + mutation { + removeEvent( + id: "sampleID", + ){ + _id + } + } + """; + + final fnData = EventQueries().deleteEvent("sampleID"); + expect(fnData, data); + }); + + test("Check if updateEvent works correctly", () { + const data = """mutation updateEvent( + \$title:String!, + \$description: String!, + \$startTime: Time, + \$endTime: Time, + \$allDay: Boolean!, + \$recurring: Boolean!, + \$isPublic: Boolean!, + \$isRegisterable: Boolean!, + \$location: String, + ) { + updateEvent( + id: "sampleID" + data:{ + title: \$title, + description: \$description, + isPublic: \$isPublic, + isRegisterable: \$isRegisterable, + recurring: \$recurring, + allDay: \$allDay, + startTime: \$startTime + endTime: \$endTime + location: \$location + } + ){ + _id + title + description + } + }"""; + + final fnData = EventQueries().updateEvent(eventId: "sampleID"); + expect(fnData, data); + }); + test("Check if createVolunteerGroup works correctly", () { + const data = ''' + mutation CreateEventVolunteerGroup(\$data: EventVolunteerGroupInput!) { + createEventVolunteerGroup(data: \$data) { + _id + name + volunteers{ + _id + } + createdAt + volunteersRequired + creator{ + _id + } + } + } + '''; + + final fnData = EventQueries().createVolunteerGroup(); + expect(fnData, data); + }); + + test("Check if removeVolunteerGroup works correctly", () { + const expected = ''' + mutation RemoveEventVolunteerGroup(\$id: ID!) { + removeEventVolunteerGroup(id: \$id) { + _id + name + } + } + '''; + + final actual = EventQueries().removeEventVolunteerGroup().trim(); + expect(actual, expected.trim()); + }); + + test("Check if addVolunteerToGroup works correctly", () { + const expected = ''' +mutation CreateEventVolunteer(\$data: EventVolunteerInput!) { + createEventVolunteer(data: \$data) { + _id + isAssigned + response + creator { + _id + } + group { + _id + name + } + isInvited + user { + _id + firstName + lastName + } + } + } + '''; + + final actual = EventQueries() + .addVolunteerToGroup() + .replaceAll(' ', '') + .replaceAll('\n', '') + .replaceAll('\t', ''); + + expect( + actual, + expected.replaceAll(' ', '').replaceAll('\n', '').replaceAll('\t', ''), + ); + }); + test("Check if removeVolunteerFromGroup works correctly", () { + const expected = ''' + mutation RemoveEventVolunteer(\$id: ID!) { + removeEventVolunteer(id: \$id) { + _id + } + } + '''; + + final actual = EventQueries().removeVolunteerMutation().trim(); + expect(actual, expected.trim()); + }); + + test("Check if updateVolunteerGroup works correctly", () { + const expected = ''' + mutation UpdateEventVolunteerGroup(\$id: ID!, \$data: UpdateEventVolunteerGroupInput!) { + updateEventVolunteerGroup(id: \$id, data: \$data) { + _id + name + volunteersRequired + } + } + '''; + + final actual = EventQueries() + .updateVolunteerGroupMutation() + .replaceAll(' ', '') + .replaceAll('\n', '') + .replaceAll('\t', ''); + expect( + actual, + expected.replaceAll(' ', '').replaceAll('\n', '').replaceAll('\t', ''), + ); + }); + + test("Check if fetchVolunteerGroupsByEvent works correctly", () { + const expected = ''' + query GetEventVolunteerGroups(\$where: EventVolunteerGroupWhereInput) { + getEventVolunteerGroups(where: \$where) { + _id + name + volunteersRequired + createdAt + volunteers { + _id + response + user { + _id + firstName + lastName + } + } + } + } + '''; + + final actual = EventQueries() + .fetchVolunteerGroups() + .replaceAll(' ', '') + .replaceAll('\n', '') + .replaceAll('\t', ''); + expect( + actual, + expected.replaceAll(' ', '').replaceAll('\n', '').replaceAll('\t', ''), + ); + }); + + test("Check if fetchAgendaItemCategoriesByOrganization works correctly", + () { + const expected = """ + query { + agendaItemCategoriesByOrganization(organizationId: "sampleOrgId") { + _id + name + description + + } + } + """; + + final actual = + EventQueries().fetchAgendaItemCategoriesByOrganization("sampleOrgId"); + expect(actual.trim(), expected.trim()); + }); + + test("Check if createAgendaItem works correctly", () { + const expected = """ + mutation CreateAgendaItem(\$input: CreateAgendaItemInput!) { + createAgendaItem(input: \$input) { + _id + title + description + duration + attachments + createdBy { + _id + firstName + lastName + } + urls + categories { + _id + name + } + sequence + } + } + """; + + final actual = EventQueries().createAgendaItem(); + expect(actual.trim(), expected.trim()); + }); + + test("Check if updateAgendaItem works correctly", () { + const expected = """ + mutation UpdateAgendaItem(\$updateAgendaItemId: ID! + \$input: UpdateAgendaItemInput! + ) { + updateAgendaItem(id: \$updateAgendaItemId, input: \$input) { + _id + title + description + duration + attachments + createdBy { + _id + firstName + lastName + } + urls + categories { + _id + name + } + sequence + } + } + """; + + final actual = EventQueries().updateAgendaItem(); + expect(actual.trim(), expected.trim()); + }); + + test("Check if deleteAgendaItem works correctly", () { + const expected = """ + mutation RemoveAgendaItem(\$removeAgendaItemId: ID!) { + removeAgendaItem(id: \$removeAgendaItemId) { + _id + } + } + """; + + final actual = EventQueries().deleteAgendaItem(); + expect(actual.trim(), expected.trim()); + }); + + test("Check if fetchAgendaItemsByEvent works correctly", () { + const expected = """ + query { + agendaItemByEvent(relatedEventId: "sampleEventId") { + _id + title + description + duration + attachments + createdBy { + _id + firstName + lastName + } + urls + categories { + _id + name + } + sequence + organization { + _id + name + } + relatedEvent { + _id + title + } + } + } + """; + + final actual = EventQueries().fetchAgendaItemsByEvent("sampleEventId"); + expect(actual.trim(), expected.trim()); + }); + }); +} diff --git a/test/utils/post_queries_test.dart b/test/utils/post_queries_test.dart new file mode 100644 index 000000000..ae4ee73bb --- /dev/null +++ b/test/utils/post_queries_test.dart @@ -0,0 +1,188 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/post_queries.dart'; + +void main() { + group("Tests for post_queries.dart", () { + test("Check if getPostsById works correctly", () { + const first = 5; + const last = 5; + const data = """ + query { + organizations(id: "sampleID") { + posts(first: $first, last:$last,after: "1", before: "2") { + edges { + node { + _id + title + text + imageUrl + videoUrl + creator { + _id + firstName + lastName + email + } + createdAt + likeCount + commentCount + likedBy{ + _id + } + comments{ + _id + } + pinned + } + cursor + } + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + totalCount + } + } + } +"""; + final fnData = PostQueries().getPostsById("sampleID", "1", "2", 5, 5); + expect(fnData, data); + }); + + test("Check if addLike works correctly", () { + const data = """ + mutation likePost(\$postID: ID!) { + likePost( id: \$postID,) + { + _id + } + } + """; + final fnData = PostQueries().addLike(); + expect(fnData, data); + }); + + test("Check if getPostById works correctly", () { + const data = """ + query { + post(id: "abc") + { + _id + text + createdAt + imageUrl + videoUrl + title + commentCount + likeCount + creator{ + _id + firstName + lastName + image + } + organization{ + _id + } + likedBy{ + _id + } + comments{ + _id, + text, + createdAt + creator{ + firstName + lastName + } + } + } + } +"""; + final fnData = PostQueries().getPostById("abc"); + expect(fnData, data); + }); + + test("Check if removeLike works correctly", () { + const data = """ + mutation unlikePost(\$postID: ID!) { + unlikePost( id: \$postID,) + { + _id + likedBy{ + _id + } + } + } + """; + final fnData = PostQueries().removeLike(); + expect(fnData, data); + }); + + test("Check if removePost works correctly", () { + const data = ''' + mutation RemovePost(\$id: ID!) { + removePost(id: \$id) { + _id + } + } + '''; + final fnData = PostQueries().removePost(); + expect(fnData, data); + }); + test("Check if uploadPost works correctly", () { + const data = ''' + mutation CreatePost( + \$text: String! + \$title: String! + \$imageUrl: URL + \$videoUrl: URL + \$organizationId: ID! + \$file: String + ) { + createPost( + data: { + text: \$text + title: \$title + imageUrl: \$imageUrl + videoUrl: \$videoUrl + organizationId: \$organizationId + } + file: \$file + ) { + _id + text + createdAt + imageUrl + videoUrl + title + commentCount + likeCount + creator{ + _id + firstName + lastName + image + } + organization{ + _id + } + likedBy{ + _id + } + comments{ + _id + } + } + } + '''; + final fnData = PostQueries().uploadPost(); + expect(fnData, data); + }); + }); +} diff --git a/test/utils_tests/chat_queries_test.dart b/test/utils_tests/chat_queries_test.dart new file mode 100644 index 000000000..0930af861 --- /dev/null +++ b/test/utils_tests/chat_queries_test.dart @@ -0,0 +1,141 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/chat_queries.dart'; + +void main() { + group("Tests for chat_queries.dart", () { + test("Check if fetchDirectChatsByUserId works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = ChatQueries().fetchDirectChatsByUserId('Ayush'); + if (fnData.contains(''' + query { + directChatsByUserID(id: "Ayush") { + _id + users{ + _id + firstName + email + } + } + } + ''')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if fetchDirectChatMessagesByChatId works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = ChatQueries().fetchDirectChatMessagesByChatId('Ayush'); + if (fnData.contains(''' + query { + directChatsMessagesByChatID(id: "Ayush") { + _id + messageContent + sender { + _id + firstName + image + } + receiver { + _id + firstName + image + } + } + } + ''')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if messageSentToDirectChatsubscription works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = ChatQueries().messageSentToDirectChatsubscription; + if (fnData.contains(''' + subscription{ + messageSentToDirectChat{ + _id + messageContent + sender { + _id + firstName + image + } + receiver { + _id + firstName + image + } + } + } + ''')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if sendMessageToDirectChat works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = ChatQueries().sendMessageToDirectChat(); + if (fnData.contains(''' + mutation sendMessageToDirectChat( + \$chatId: ID! + \$messageContent: String! + ){ + sendMessageToDirectChat( + chatId: \$chatId + messageContent: \$messageContent + ) { + messageContent + sender{ + firstName + } + receiver{ + firstName + } + } + } + ''')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if sendMessageToDirectChat works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = ChatQueries().sendMessageToDirectChat(); + if (fnData.contains(''' + mutation sendMessageToDirectChat( + \$chatId: ID! + \$messageContent: String! + ){ + sendMessageToDirectChat( + chatId: \$chatId + messageContent: \$messageContent + ) { + messageContent + sender{ + firstName + } + receiver{ + firstName + } + } + } + ''')) { + mutation = true; + } + expect(mutation, true); + }); + }); +} diff --git a/test/utils_tests/queries_test.dart b/test/utils_tests/queries_test.dart new file mode 100644 index 000000000..794891e19 --- /dev/null +++ b/test/utils_tests/queries_test.dart @@ -0,0 +1,237 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/queries.dart'; + +void main() { + group("Tests for queries.dart", () { + test("Check if registerUser works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().registerUser( + 'Ayush', + 'Chaudhary', + 'ayush@gmail.com', + 'password', + 'orgId123', + ); + if (fnData.contains('Ayush')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if loginUser works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().loginUser('ayush@gmail.com', 'password'); + if (fnData.contains('ayush@gmail.com')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if logout works correctly", () { + const mutation = false; + expect(mutation, false); + + const data = """ + mutation { + logout + } + """; + final fnData = Queries().logout(); + expect(fnData, data); + }); + test("Check if fetchJoinInOrg works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries(); + final ff = fnData.fetchJoinInOrg; + if (ff.contains('query organizationsConnection')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if newUserLanguage works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().newUserLanguage('12345'); + if (fnData.contains('12345')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if fetchJoinInOrgByName works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries(); + final ff = fnData.fetchJoinInOrgByName; + if (ff.contains('query organizationsConnection')) { + mutation = true; + } + expect(mutation, true); + }); + + test("Check if joinOrgById works correctly", () { + var mutation = false; + + expect(mutation, false); + + final fnData = Queries().joinOrgById('orgId123'); + if (fnData.contains('orgId123')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if sendMembershipRequest works correctly", () { + var mutation = false; + + expect(mutation, false); + + final fnData = Queries().sendMembershipRequest('orgId123'); + if (fnData.contains('orgId123')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if refreshToken works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().refreshToken('orgId123'); + if (fnData.contains('orgId123')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if updateLanguage works correctly", () { + var mutation = false; + + expect(mutation, false); + final fnData = Queries().updateLanguage('orgId123'); + if (fnData.contains('orgId123')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if getPluginsList works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().getPluginsList(); + if (fnData.contains('getPlugins')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if fetchOrgById works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().fetchOrgById('orgId123'); + if (fnData.contains('orgId123')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if userlanguage works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().userLanguage(); + if (fnData.contains('myLanguage')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if fetchJoinInOrgByName works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries(); + final ff = fnData.fetchJoinInOrgByName; + if (ff.contains('query organizationsConnection')) { + mutation = true; + } + expect(mutation, true); + }); + + test("Check if newUserLanguage works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().newUserLanguage('12345'); + if (fnData.contains('12345')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if fetchOrgDetailsById works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().fetchOrgDetailsById('12345'); + if (fnData.contains('12345')) { + mutation = true; + } + expect(mutation, true); + }); + + test("Check if getPluginsList works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().getPluginsList(); + if (fnData.contains('getPlugins')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if createDonation works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().createDonation( + 'userId', + 'userId', + 'userId', + 'userId', + 'userId', + 12, + ); + if (fnData.contains('userId')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if updateUserProfile works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().updateUserProfile(); + + if (fnData.contains('mutation UpdateUserProfile') && + fnData.contains('updateUserProfile')) { + mutation = true; + } + expect(mutation, true); + }); + test("Check if venueListQuery works correctly", () { + var mutation = false; + expect(mutation, false); + + final fnData = Queries().venueListQuery(); + + if (fnData.contains('GetVenueByOrgId') && + fnData.contains('GetVenueByOrgId')) { + mutation = true; + } + expect(mutation, true); + }); + }); +} diff --git a/test/utils_tests/validators_test.dart b/test/utils_tests/validators_test.dart new file mode 100644 index 000000000..679bea31a --- /dev/null +++ b/test/utils_tests/validators_test.dart @@ -0,0 +1,242 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/validators.dart'; + +void main() { + group( + 'Test Validator', + () { + group('Test validateURL', () { + test('Test validateURL when value is empty', () { + final result = Validator.validateURL(''); + + expect(result, 'Please verify URL first'); + }); + + test('Test validateURL when value is not absolute', () { + final result = Validator.validateURL('path/resource'); + + expect(result, 'Enter a valid URL'); + }); + + test('Test validateURL when value is not absolute', () { + final result = Validator.validateURL('https://domain/path/resource'); + + expect(result, null); + }); + }); + + group('Test validateFirstName', () { + test('Test validateFirstName when value is empty', () { + final result = Validator.validateFirstName(''); + + expect(result, 'Firstname must not be left blank.'); + }); + + test('Test validateFirstName when value does not match regex pattern', + () { + final result = Validator.validateFirstName('123'); + + expect(result, 'Invalid Firstname'); + }); + + test('Test validateFirstName when value match regex pattern', () { + final result = Validator.validateFirstName('Name'); + + expect(result, null); + }); + }); + + group('Test validateLastName', () { + test('Test validateLastName when value is empty', () { + final result = Validator.validateLastName(''); + + expect(result, 'Lastname must not be left blank.'); + }); + + test('Test validateLastName when value does not match regex pattern', + () { + final result = Validator.validateLastName('123'); + + expect(result, 'Invalid Lastname'); + }); + + test('Test validateLastName when value match regex pattern', () { + final result = Validator.validateLastName('Name'); + + expect(result, null); + }); + }); + + group('Test validateEmail', () { + test('Test validateEmail when value is empty', () { + final result = Validator.validateEmail(''); + + expect(result, 'Email must not be left blank'); + }); + + test('Test validateEmail when value does not match regex pattern', () { + final List invalidEmailList = [ + 'plainaddress', + '#@%^%#\$@#\$@#.com', + '@example.com', + 'Joe Smith ', + 'email.example.com', + 'email@example@example.com', + 'email@example.com (Joe Smith)', + ]; + + for (final String email in invalidEmailList) { + final result = Validator.validateEmail(email); + + expect(result, 'Please enter a valid Email Address'); + } + }); + + test('Test validateEmail when value match regex pattern', () { + final List validEmailList = [ + 'email@example.com', + 'firstname.lastname@example.com', + 'firstname+lastname@example.com', + 'email@example.name', + 'email@example.museum', + 'email@example.co.jp', + 'firstname-lastname@example.com', + ]; + + for (final String email in validEmailList) { + final result = Validator.validateEmail(email); + + expect(result, null); + } + }); + }); + + group( + 'Test validatePassword', + () { + test('Test validatePassword when value is empty', () { + final result = Validator.validatePassword(''); + + expect(result, 'Password must not be left blank'); + }); + + test('Test validatePassword when value has spaces', () { + final result = Validator.validatePassword('password with spaces'); + + expect(result, 'Password must not contain spaces'); + }); + + test('Test validatePassword when value does not match regex pattern', + () { + final List invalidPassword = [ + '12345678', + 'not8len', + 'notcapital', + 'NOSMALL', + 'nonum', + 'NoSpecialChar123', + ]; + + for (final String password in invalidPassword) { + final result = Validator.validatePassword(password); + + expect( + result, + 'Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)', + ); + } + }); + + test('Test validatePassword when value match regex pattern', () { + final result = Validator.validatePassword('ValidPassword123@'); + + expect(result, null); + }); + }, + ); + group( + 'Test validatePasswordConfirm', + () { + test( + 'Test validatePasswordConfirm when value is not matching with comparator', + () { + final result = Validator.validatePasswordConfirm( + 'Password123@', + 'Password1234@', + ); + + expect(result, 'Password does not match original'); + }); + + test( + 'Test validatePasswordConfirm when value is matching with comparator', + () { + final result = Validator.validatePasswordConfirm( + 'Password123@', + 'Password123@', + ); + + expect(result, null); + }); + }, + ); + + group( + 'Test validateUrlExistence', + () { + test('Test validateUrlExistence when url is not present', () async { + final result = await Validator().validateUrlExistence( + 'https://www.google.com', + ); + + expect(result, true); + }); + test('Test validateUrlExistence when url is not present', () async { + final result = await Validator() + .validateUrlExistence('https://nnnoootttaaasssiiittteee.com'); + + expect(result, false); + }); + }, + ); + + group( + 'Test validateEventForm', + () { + test('Test validateEventForm when value is empty', () { + final result = Validator.validateEventForm('', 'label'); + + expect(result, 'label must not be left blank.'); + }); + + test('Test validateEventForm when value does not match regex pattern', + () { + final result = Validator.validateEventForm('12345', 'label'); + + expect(result, 'Invalid label'); + }); + + test('Test validateEventForm when value match regex pattern', () { + final result = Validator.validateEventForm('12345Name', 'label'); + + expect(result, null); + }); + + test('Test validateEventTime for start time greater than end time', + () { + const startTime = TimeOfDay(hour: 14, minute: 30); + const endTime = TimeOfDay(hour: 12, minute: 30); + + final result = Validator.validateEventTime(startTime, endTime); + + expect(result, 'Start time must be before or equal to end time'); + }); + }, + ); + }, + ); +} diff --git a/test/view_model_tests/access_request_view_model_test.dart b/test/view_model_tests/access_request_view_model_test.dart new file mode 100644 index 000000000..7dfbf9fcd --- /dev/null +++ b/test/view_model_tests/access_request_view_model_test.dart @@ -0,0 +1,139 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/view_model/access_request_view_model.dart'; +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +class MockCallbackFunction extends Mock { + void call(); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + }); + + group( + "AccessScreenViewModel Test- ", + () { + test("Check if it's initialized correctly", () { + final org = userConfig.currentOrg; + final model = AccessScreenViewModel(); + expect(model.selectedOrganization.id, '-1'); + model.initialise(org); + expect(model.selectedOrganization.id, 'XYZ'); + }); + + test( + "Check if snackbar is showing in case of not empty joined organization", + () async { + final org = userConfig.currentOrg; + final model = AccessScreenViewModel(); + model.initialise(org); + + when( + databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest(org.id!), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(queries.sendMembershipRequest(org.id!)), + ), + data: { + 'sendMembershipRequest': { + 'organization': { + '_id': 'XYZ', + 'name': 'Organization Name', + 'image': null, + 'description': null, + 'userRegistrationRequired': true, + 'creator': { + 'firstName': 'ravidi', + 'lastName': 'shaikh', + 'image': null, + }, + }, + }, + }, + source: QueryResultSource.network, + ), + ); + + await model.sendMembershipRequest(); + + verify( + databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest(org.id!), + ), + ); + + verify(locator().pop()); + verify( + locator().showTalawaErrorSnackBar( + "Join in request sent to Organization Name successfully", + MessageType.info, + ), + ); + }); + + test("Removing joined organizations for testing", () async { + getAndRegisterUserConfig(); + final org = userConfig.currentOrg; + userConfig.currentUser.joinedOrganizations = []; + final model = AccessScreenViewModel(); + model.initialise(org); + + when( + databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest(org.id!), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql(queries.sendMembershipRequest(org.id!)), + ), + data: { + 'sendMembershipRequest': { + 'organization': { + '_id': 'XYZ', + 'name': 'Organization Name', + 'image': null, + 'description': null, + 'userRegistrationRequired': true, + 'creator': { + 'firstName': 'ravidi', + 'lastName': 'shaikh', + 'image': null, + }, + }, + }, + }, + source: QueryResultSource.network, + ), + ); + + await model.sendMembershipRequest(); + + verify( + databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest(org.id!), + ), + ); + + verify( + locator().removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + }); + }, + ); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/add_post_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/add_post_view_model_test.dart new file mode 100644 index 000000000..189eff7ec --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/add_post_view_model_test.dart @@ -0,0 +1,263 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:io'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +class MockCallbackFunction extends Mock { + void call(); +} + +final demoJson = { + 'createPost': { + '__typename': 'Post', + '_id': '1', + 'text': 'text #hastag', + 'createdAt': '2023-11-13T19:28:21.095Z', + 'imageUrl': 'https://imageurl', + 'videoUrl': 'https://videoUrl', + 'title': 'demo title', + 'commentCount': 0, + 'likeCount': 0, + 'creator': { + '__typename': 'User', + '_id': '1', + 'firstName': 'Ayush', + 'lastName': 'Raghuwanshi', + 'image': 'https://imageUrl', + }, + 'organization': {'__typename': 'Organization', '_id': '1'}, + 'likedBy': [], + 'comments': [], + }, +}; + +void main() { + testSetupLocator(); + setUp(() { + AppConnectivity.isOnline = true; + registerServices(); + getAndRegisterImageService(); + }); + group("AddPostViewModel Test - ", () { + test("Check if it's initialized correctly", () { + final model = AddPostViewModel(); + model.initialise(); + + expect(model.imageFile, null); + expect(model.orgName, userConfig.currentOrg.name); + expect( + model.userName, + userConfig.currentUser.firstName! + userConfig.currentUser.lastName!, + ); + }); + + test('Test for imageInBase64 getter', () async { + final model = AddPostViewModel(); + model.initialise(); + expect(model.imageInBase64, null); + }); + + test("Check if getImageFromGallery() is working fine", () async { + final model = AddPostViewModel(); + model.initialise(); + + when(locator().getPhotoFromGallery()) + .thenAnswer((_) async { + return null; + }); + + await model.getImageFromGallery(); + verify(locator().getPhotoFromGallery()); + expect(model.imageFile, null); + }); + test("Check if getImageFromGallery() is working fine (camera is true)", + () async { + final notifyListenerCallback = MockCallbackFunction(); + final model = AddPostViewModel()..addListener(notifyListenerCallback); + model.initialise(); + + final file = File('fakePath'); + when(locator().getPhotoFromGallery(camera: true)) + .thenAnswer((_) async { + return file; + }); + + await model.getImageFromGallery(camera: true); + + verify( + locator().getPhotoFromGallery(camera: true), + ); + verify( + locator().showTalawaErrorSnackBar( + "Image is added", + MessageType.info, + ), + ); + + expect(model.imageFile, file); + + verify(notifyListenerCallback()); + }); + test("Check if upload post works correctly", () async { + final dataBaseMutationFunctions = locator(); + final notifyListenerCallback = MockCallbackFunction(); + final model = AddPostViewModel()..addListener(notifyListenerCallback); + model.initialise(); + when( + dataBaseMutationFunctions.gqlAuthMutation( + PostQueries().uploadPost(), + variables: { + "text": " #", + "organizationId": 'XYZ', + "title": '', + }, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(PostQueries().uploadPost())), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + await model.uploadPost(); + verify( + locator().showTalawaErrorSnackBar( + "Post is uploaded", + MessageType.info, + ), + ); + // verify( + // locator().gqlAuthMutation( + // query, + // variables: { + // "text": "", + // "organizationId": "XYZ", + // "title": "", + // "file":"", + // }, + // ), + // ); + verify(notifyListenerCallback()); + }); + test('uploadPost with _imageFile != null and throws no exception', + () async { + final dataBaseMutationFunctions = locator(); + final viewModel = AddPostViewModel(); + viewModel.initialise(); + final mockImageFile = File( + 'path/to/mockImage.png', + ); + viewModel.setImageFile(mockImageFile); + + await viewModel.setImageInBase64(mockImageFile); + + viewModel.controller.text = "Some post content"; + viewModel.textHashTagController.text = "hashtag"; + viewModel.titleController.text = "Post Title"; + when( + dataBaseMutationFunctions.gqlAuthMutation( + PostQueries().uploadPost(), + variables: { + "text": 'Some post content #hashtag', + "organizationId": 'XYZ', + "title": 'Post Title', + "file": 'data:image/png;base64,${viewModel.imageInBase64}', + }, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(PostQueries().uploadPost())), + data: demoJson, + source: QueryResultSource.network, + ), + ); + + await viewModel.uploadPost(); + verify( + locator().showTalawaErrorSnackBar( + "Post is uploaded", + MessageType.info, + ), + ).called(1); + }); + test('uploadPost with _imageFile == null', () async { + final viewModel = AddPostViewModel(); + viewModel.initialise(); + viewModel.controller.text = "Some post content"; + viewModel.textHashTagController.text = "hashtag"; + viewModel.titleController.text = "Post Title"; + when( + locator().gqlAuthMutation( + PostQueries().uploadPost(), + variables: anyNamed('variables'), + ), + ).thenThrow(Exception("exception")); + + await viewModel.uploadPost(); + verify( + locator().showTalawaErrorSnackBar( + "Upload failed: Exception: exception", + MessageType.error, + ), + ).called(1); + }); + test('uploadPost with _imageFile != null', () async { + final viewModel = AddPostViewModel(); + viewModel.initialise(); + final mockImageFile = File( + 'path/to/mockImage.png', + ); + viewModel.setImageFile(mockImageFile); + + await viewModel.setImageInBase64(mockImageFile); + viewModel.controller.text = "Some post content"; + viewModel.textHashTagController.text = "hashtag"; + viewModel.titleController.text = "Post Title"; + when( + locator().gqlAuthMutation( + PostQueries().uploadPost(), + variables: anyNamed('variables'), + ), + ).thenThrow(Exception("exception")); + + await viewModel.uploadPost(); + verify( + locator().showTalawaErrorSnackBar( + "Upload failed: Exception: exception", + MessageType.error, + ), + ).called(1); + }); + test("Check if remove_image method works correctly", () async { + final notifyListenerCallback = MockCallbackFunction(); + final model = AddPostViewModel()..addListener(notifyListenerCallback); + + model.initialise(); + + final file = File('fakePath'); + when(locator().getPhotoFromGallery(camera: true)) + .thenAnswer((_) async { + return file; + }); + + await model.getImageFromGallery(camera: true); + model.removeImage(); + expect(model.imageFile, null); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/chat_view_models_test/direct_chat_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/chat_view_models_test/direct_chat_view_model_test.dart new file mode 100644 index 000000000..f460d80a8 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/chat_view_models_test/direct_chat_view_model_test.dart @@ -0,0 +1,149 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:async'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/chats/chat_list_tile_data_model.dart'; +import 'package:talawa/models/chats/chat_message.dart'; +import 'package:talawa/models/chats/chat_user.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/chat_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +void main() { + registerServices(); + + group('Test DirectChatViewModel', () { + final DirectChatViewModel directChatViewModel = DirectChatViewModel(); + final ChatService chatService = locator(); + final UserConfig userConfig = locator(); + + test('Test DirectChatViewModel extends BaseModel', () { + expect(directChatViewModel, isA()); + }); + + test('Test initial value of fields in DirectChatViewModel', () { + expect(directChatViewModel.listKey, isA>()); + expect(directChatViewModel.chatState, ChatState.initial); + expect(directChatViewModel.chats, []); + expect(directChatViewModel.chatMessagesByUser, {}); + }); + + test('Test refreshChats', () { + directChatViewModel.refreshChats(); + expect(directChatViewModel.chats, []); + }); + + test('Test initialise', () async { + final chats = directChatViewModel.chats; + + final future = directChatViewModel.initialise(); + + expect(directChatViewModel.chatState, ChatState.loading); + await future; + expect(directChatViewModel.chats, chats); + expect(directChatViewModel.chatState, ChatState.complete); + }); + + test('Test getChatMessages', () async { + final ChatMessage chatMessage = + ChatMessage('11', null, 'message11', null); + final StreamController chatMessageController = + StreamController(); + final Stream messagestream = + chatMessageController.stream.asBroadcastStream(); + + when(chatService.chatMessagesStream) + .thenAnswer((realInvocation) => messagestream); + when(chatService.getDirectChatMessagesByChatId('1')).thenAnswer( + (realInvocation) async => chatMessageController.add(chatMessage), + ); + + final future = directChatViewModel.getChatMessages('1'); + + expect(directChatViewModel.chatMessagesByUser, {}); + expect(directChatViewModel.chatState, ChatState.loading); + + await future; + + expect(directChatViewModel.chatMessagesByUser['1'], [chatMessage]); + expect(directChatViewModel.chatState, ChatState.complete); + }); + + test('Test sendMessageToDirectChat', () async { + final List chatMessages = [ + ChatMessage('11', null, 'message11', null), + ChatMessage('22', null, 'message22', null), + ]; + final StreamController chatMessageController = + StreamController(); + final Stream messagestream = + chatMessageController.stream.asBroadcastStream(); + + when(chatService.chatMessagesStream) + .thenAnswer((realInvocation) => messagestream); + when(chatService.getDirectChatMessagesByChatId('1')).thenAnswer( + (realInvocation) async => chatMessageController.add(chatMessages[0]), + ); + when(chatService.sendMessageToDirectChat('1', 'content')).thenAnswer( + (realInvocation) async => chatMessageController.add(chatMessages[1]), + ); + + await directChatViewModel.getChatMessages('1'); + final future = + directChatViewModel.sendMessageToDirectChat('1', 'content'); + + expect(directChatViewModel.chatState, ChatState.loading); + + await future; + + for (int index = 0; index < chatMessages.length; index++) { + final message = directChatViewModel.chatMessagesByUser['1']![index]; + expect(message.id, chatMessages[index].id); + } + + expect(directChatViewModel.chatState, ChatState.complete); + }); + + test('Test chatName', () async { + final User currentUser = User(id: '1', firstName: 'first_user'); + final ChatUser user1 = ChatUser(id: '1', firstName: 'first_user'); + final ChatUser user2 = ChatUser(id: '2', firstName: 'second_user'); + final List users = [ + user1, + user2, + ]; + final ChatListTileDataModel chatListTileDataModel = + ChatListTileDataModel(users, 'chat_id'); + final StreamController controller = + StreamController(); + final Stream stream = controller.stream; + + when(chatService.chatListStream).thenAnswer((realInvocation) { + return stream; + }); + when(chatService.getDirectChatsByUserId()).thenAnswer( + (realInvocation) async => controller.add(chatListTileDataModel), + ); + when(userConfig.currentUser).thenAnswer((realInvocation) => currentUser); + + await directChatViewModel.initialise(); + directChatViewModel.chatName('chat_id'); + + expect(directChatViewModel.name, 'second_user'); + }); + + test('Test dispose', () { + directChatViewModel.dispose(); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/chat_view_models_test/select_contact_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/chat_view_models_test/select_contact_view_model_test.dart new file mode 100644 index 000000000..74e695ed3 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/chat_view_models_test/select_contact_view_model_test.dart @@ -0,0 +1,55 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/select_contact_view_model.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + locator().test(); + }); + + setUp(() { + registerServices(); + locator().test(); + }); + + tearDown(() { + unregisterServices(); + }); + test("test initialise function of model", () async { + final model = SelectContactViewModel(); + model.initialise(); + }); + test("test to check if getOrgMembersList is working", () async { + final model = SelectContactViewModel(); + model.initialise(); + final User user1 = User(id: "fakeUser1"); + final User user2 = User(id: "fakeUser2"); + final List users = [user1, user2]; + + when(organizationService.getOrgMembersList("XYZ")) + .thenAnswer((realInvocation) async { + return users; + }); + await model.getCurrentOrgUsersList(); + bool working = true; + model.orgMembersList.forEach((user) { + if (user.id == null) { + working = false; + } + }); + + expect(working, true); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/create_event_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/create_event_view_model_test.dart new file mode 100644 index 000000000..4dfe56732 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/create_event_view_model_test.dart @@ -0,0 +1,671 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:intl/intl.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +/// `MockBuildContext` class represents mock instance of Build context. +class MockBuildContext extends Mock implements BuildContext {} + +/// Instance of callback function. +class MockCallbackFunction extends Mock { + /// Callback function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void call(); +} + +/// a_line_ending_with_end_punctuation. +/// +/// more_info_if_required +/// +/// **params**: +/// * `formKey`: define_the_param +/// * `eventTitleTextController`: define_the_param +/// * `eventLocationTextController`: define_the_param +/// * `eventDescriptionTextController`: define_the_param +/// +/// **returns**: +/// * `Widget`: define_the_return +Widget createApp( + GlobalKey formKey, + TextEditingController eventTitleTextController, + TextEditingController eventLocationTextController, + TextEditingController eventDescriptionTextController, +) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: Container( + child: Form( + key: formKey, + child: Column( + children: [ + TextFormField( + controller: eventTitleTextController, + ), + TextFormField( + controller: eventLocationTextController, + ), + TextFormField( + controller: eventDescriptionTextController, + ), + ], + ), + ), + ), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); +} + +void main() { + setUp(() { + registerServices(); + }); + tearDown(() { + unregisterServices(); + }); + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + locator().test(); + locator().test(); + getAndRegisterDatabaseMutationFunctions(); + }); + + group('Create Event Tests', () { + test('check if fetchVenues method work properly when null is thrown', () { + final model = CreateEventViewModel(); + model.initialize(); + final mockQueryResult = QueryResult( + source: QueryResultSource.network, + data: null, + options: QueryOptions(document: gql(queries.venueListQuery())), + ); + + when( + databaseFunctions.gqlAuthQuery( + queries.venueListQuery(), + variables: { + "orgId": 'XYZ', + }, + ), + ).thenAnswer((_) async => mockQueryResult); + + model.fetchVenues(); + }); + test('check if fetchVenues method work properly', () { + final model = CreateEventViewModel(); + model.initialize(); + + final mockQueryResult = QueryResult( + source: QueryResultSource.network, + data: { + 'getVenueByOrgId': [ + { + 'id': '1', + 'name': 'Mock Venue 1', + 'capacity': 100, + 'imageUrl': '', + 'description': 'aaa', + }, + { + 'id': '2', + 'name': 'Mock Venue 2', + 'capacity': 150, + 'imageUrl': '', + 'description': 'aaa', + }, + ], + }, + options: QueryOptions(document: gql(queries.venueListQuery())), + ); + + when( + databaseFunctions.gqlAuthQuery( + queries.venueListQuery(), + variables: { + "orgId": 'XYZ', + }, + ), + ).thenAnswer((_) async => mockQueryResult); + + model.fetchVenues(); + }); + test("test getCurrentOrgUsersList with isAdmin false", () async { + final model = CreateEventViewModel(); + model.initialize(); + + final User user1 = User(id: "fakeUser1"); + final User user2 = User(id: "fakeUser2"); + final List users = [user1, user2]; + + when(organizationService.getOrgMembersList("XYZ")) + .thenAnswer((realInvocation) async { + return users; + }); + + await model.getCurrentOrgUsersList(); + + bool isListCorrect = true; + + users.forEach((user) { + final bool x = model.memberCheckedMap.containsKey(user.id); + if (!x) { + isListCorrect = false; + } + }); + + expect(isListCorrect, true); + }); + + testWidgets("testing createEvent function", (tester) async { + final model = CreateEventViewModel(); + model.initialize(); + await tester.pumpWidget( + createApp( + model.formKey, + model.eventTitleTextController, + model.eventLocationTextController, + model.eventDescriptionTextController, + ), + ); + + final DateTime startMoment = DateTime( + model.eventStartDate.year, + model.eventStartDate.month, + model.eventStartDate.day, + model.eventStartTime.hour, + model.eventStartTime.minute, + ); + final DateTime endMoment = DateTime( + model.eventEndDate.year, + model.eventEndDate.month, + model.eventEndDate.day, + model.eventEndTime.hour, + model.eventEndTime.minute, + ); + + await tester.pump(); + await tester.pumpAndSettle(); + + await tester.enterText( + find.byType(TextFormField).first, + 'fakeEventTitle', + ); + await tester.enterText( + find.byType(TextFormField).last, + 'fakeEventDescription', + ); + await tester.enterText( + find.byType(TextFormField).at(1), + 'fakeEventLocation', + ); + databaseFunctions.init(); + + when(databaseFunctions.refreshAccessToken("testtoken")) + .thenAnswer((realInvocation) async { + return true; + }); + + final variables = { + 'data': { + 'title': model.eventTitleTextController.text, + 'description': model.eventDescriptionTextController.text, + 'location': model.eventLocationTextController.text, + 'isPublic': model.isPublicSwitch, + 'isRegisterable': model.isRegisterableSwitch, + 'recurring': model.isRecurring, + 'allDay': true, + 'organizationId': 'XYZ', + 'startDate': DateFormat('yyyy-MM-dd').format(startMoment), + 'endDate': DateFormat('yyyy-MM-dd').format(endMoment), + 'startTime': model.isAllDay + ? null + : '${DateFormat('HH:mm:ss').format(startMoment)}Z', + 'endTime': model.isAllDay + ? null + : '${DateFormat('HH:mm:ss').format(endMoment)}Z', + }, + if (model.isRecurring) + 'recurrenceRuleData': { + 'recurrenceStartDate': + DateFormat('yyyy-MM-dd').format(model.recurrenceStartDate), + 'recurrenceEndDate': model.recurrenceEndDate != null + ? DateFormat('yyyy-MM-dd').format(model.recurrenceEndDate!) + : null, + 'frequency': model.frequency, + 'weekDays': (model.frequency == Frequency.weekly || + (model.frequency == Frequency.monthly && + model.weekDayOccurenceInMonth != null)) + ? model.weekDays.toList() + : null, + 'interval': model.interval, + 'count': model.count, + 'weekDayOccurenceInMonth': model.weekDayOccurenceInMonth, + }, + }; + + when( + locator().createEvent(variables: variables), + ).thenAnswer((_) async { + return QueryResult( + options: QueryOptions(document: gql(EventQueries().addEvent())), + exception: OperationException( + graphqlErrors: [], + ), + data: { + 'test': 'data', + }, + source: QueryResultSource.network, + ); + }); + + await model.createEvent(); + + verify( + locator().createEvent( + variables: variables, + ), + ); + + verify(navigationService.pop()); + }); + + test("test getImageFromGallery and removeImage functions", () async { + final notifyListenerCallback = MockCallbackFunction(); + final model = CreateEventViewModel()..addListener(notifyListenerCallback); + model.initialize(); + + // testing getImageFromGallery + // with camera false + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((realInvocation) async { + return null; + }); + + await model.getImageFromGallery(); + verify(multimediaPickerService.getPhotoFromGallery(camera: false)); + expect(model.imageFile, null); + + // with camera true + final file = File('fakePath'); + when(multimediaPickerService.getPhotoFromGallery(camera: true)) + .thenAnswer((_) async { + return file; + }); + await model.getImageFromGallery(camera: true); + verify(multimediaPickerService.getPhotoFromGallery(camera: true)); + expect(model.imageFile, file); + verify(notifyListenerCallback()); + + // testing removeImage + model.removeImage(); + expect(model.imageFile, null); + verify(notifyListenerCallback()); + }); + + test('check that empty values are not accepted for required fields', () { + final String? emptyTitle = Validator.validateEventForm("", "Title"); + expect(emptyTitle, "Title must not be left blank."); + + final String? emptyLocation = Validator.validateEventForm("", "Location"); + expect(emptyLocation, "Location must not be left blank."); + + final String? emptyDescription = + Validator.validateEventForm("", "Description"); + expect(emptyDescription, "Description must not be left blank."); + }); + + test('Check validators return null for valid values', () { + final String? validTitle = + Validator.validateEventForm("Test Title", "Title"); + expect(validTitle, null); + + final String? validLocation = + Validator.validateEventForm("Test Location", "Location"); + expect(validLocation, null); + + final String? validDescription = + Validator.validateEventForm("Test Description", "Description"); + expect(validDescription, null); + }); + + test('Check addition of members', () { + final model = CreateEventViewModel(); + model.initialize(); + + final List allMembers = + userConfig.currentOrg.members! + userConfig.currentOrg.admins!; + model.orgMembersList = allMembers; + + // non admins (normal members) + final List usersInCurrentOrg = userConfig.currentOrg.members!; + model.memberCheckedMap[usersInCurrentOrg.first.id!] = true; + model.buildUserList(); + final bool isMemberFound = + model.selectedMembers.contains(usersInCurrentOrg.first); + expect(isMemberFound, true); + }); + + test('Removing of members from event', () { + final model = CreateEventViewModel(); + model.initialize(); + final List allMembers = + userConfig.currentOrg.members! + userConfig.currentOrg.admins!; + model.orgMembersList = allMembers; + + // non admins (normal members) + // to remove, first we need to add a member + final List usersInCurrentOrg = userConfig.currentOrg.members!; + model.memberCheckedMap[usersInCurrentOrg.first.id!] = true; + model.buildUserList(); + model.removeUserFromList( + userId: usersInCurrentOrg.first.id!, + ); + final bool isMemberFound = + model.selectedMembers.contains(usersInCurrentOrg.first); + expect(isMemberFound, false); + }); + + test('setEventEndDate should set the event end date and notify listeners', + () { + final model = CreateEventViewModel(); + model.initialize(); + + final newDate = DateTime.now().add(const Duration(days: 1)); + final notifyListenerCallback = MockCallbackFunction(); + model.addListener(notifyListenerCallback); + + model.setEventEndDate(newDate); + + expect(model.eventEndDate, newDate); + verify(notifyListenerCallback()).called(1); + }); + + testWidgets("testing createEvent function (Recurring)", (tester) async { + final model = CreateEventViewModel(); + model.initialize(); + await tester.pumpWidget( + createApp( + model.formKey, + model.eventTitleTextController, + model.eventLocationTextController, + model.eventDescriptionTextController, + ), + ); + + final DateTime startMoment = DateTime( + model.eventStartDate.year, + model.eventStartDate.month, + model.eventStartDate.day, + model.eventStartTime.hour, + model.eventStartTime.minute, + ); + + final DateTime endMoment = DateTime( + model.eventEndDate.year, + model.eventEndDate.month, + model.eventEndDate.day, + model.eventEndTime.hour, + model.eventEndTime.minute, + ); + + model.isRecurring = true; + + await tester.pump(); + await tester.pumpAndSettle(); + + await tester.enterText( + find.byType(TextFormField).first, + 'fakeEventTitle', + ); + await tester.enterText( + find.byType(TextFormField).last, + 'fakeEventDescription', + ); + await tester.enterText( + find.byType(TextFormField).at(1), + 'fakeEventLocation', + ); + databaseFunctions.init(); + + when(databaseFunctions.refreshAccessToken("testtoken")) + .thenAnswer((realInvocation) async { + return true; + }); + + model.weekDayOccurenceInMonth = 1; + model.recurrenceEndDate = DateTime.now(); + model.frequency = 'MONTHLY'; + + final vars = { + 'data': { + 'title': model.eventTitleTextController.text, + 'description': model.eventDescriptionTextController.text, + 'location': model.eventLocationTextController.text, + 'isPublic': model.isPublicSwitch, + 'isRegisterable': model.isRegisterableSwitch, + 'recurring': model.isRecurring, + 'allDay': true, + 'organizationId': 'XYZ', + 'startDate': DateFormat('yyyy-MM-dd').format(startMoment), + 'endDate': DateFormat('yyyy-MM-dd').format(endMoment), + 'startTime': model.isAllDay + ? null + : '${DateFormat('HH:mm:ss').format(startMoment)}Z', + 'endTime': model.isAllDay + ? null + : '${DateFormat('HH:mm:ss').format(endMoment)}Z', + }, + if (model.isRecurring) + 'recurrenceRuleData': { + 'recurrenceStartDate': + DateFormat('yyyy-MM-dd').format(model.recurrenceStartDate), + 'recurrenceEndDate': model.recurrenceEndDate != null + ? DateFormat('yyyy-MM-dd').format(model.recurrenceEndDate!) + : null, + 'frequency': model.frequency, + 'weekDays': (model.frequency == Frequency.weekly || + (model.frequency == Frequency.monthly && + model.weekDayOccurenceInMonth != null)) + ? model.weekDays.toList() + : null, + 'interval': model.interval, + 'count': model.count, + 'weekDayOccurenceInMonth': model.weekDayOccurenceInMonth, + }, + }; + + when( + locator().createEvent( + variables: vars, + ), + ).thenAnswer((_) async { + return QueryResult( + options: QueryOptions(document: gql(EventQueries().addEvent())), + exception: OperationException( + graphqlErrors: [], + ), + data: { + 'test': 'data', + }, + source: QueryResultSource.network, + ); + }); + + await model.createEvent(); + + verify( + locator().createEvent( + variables: vars, + ), + ); + + verify(navigationService.pop()); + + model.recurrenceEndDate = DateTime.now(); + model.frequency = Frequency.monthly; + model.weekDayOccurenceInMonth = 1; + + await model.createEvent(); + + verify( + locator().createEvent( + variables: vars, + ), + ); + + verify(navigationService.pop()); + + model.initialize(); + model.isAllDay = false; + + await model.createEvent(); + }); + + testWidgets("testing createEvent function (Recurring)", (tester) async { + final model = CreateEventViewModel(); + AppConnectivity.isOnline = false; + model.initialize(); + await tester.pumpWidget( + createApp( + model.formKey, + model.eventTitleTextController, + model.eventLocationTextController, + model.eventDescriptionTextController, + ), + ); + + final DateTime startMoment = DateTime( + model.eventStartDate.year, + model.eventStartDate.month, + model.eventStartDate.day, + model.eventStartTime.hour, + model.eventStartTime.minute, + ); + + final DateTime endMoment = DateTime( + model.eventEndDate.year, + model.eventEndDate.month, + model.eventEndDate.day, + model.eventEndTime.hour, + model.eventEndTime.minute, + ); + + model.isRecurring = true; + + await tester.pump(); + await tester.pumpAndSettle(); + + await tester.enterText( + find.byType(TextFormField).first, + 'fakeEventTitle', + ); + await tester.enterText( + find.byType(TextFormField).last, + 'fakeEventDescription', + ); + await tester.enterText( + find.byType(TextFormField).at(1), + 'fakeEventLocation', + ); + databaseFunctions.init(); + + when(databaseFunctions.refreshAccessToken("testtoken")) + .thenAnswer((realInvocation) async { + return true; + }); + + model.weekDayOccurenceInMonth = 1; + model.recurrenceEndDate = DateTime.now(); + model.frequency = 'MONTHLY'; + + final vars = { + 'data': { + 'title': model.eventTitleTextController.text, + 'description': model.eventDescriptionTextController.text, + 'location': model.eventLocationTextController.text, + 'isPublic': model.isPublicSwitch, + 'isRegisterable': model.isRegisterableSwitch, + 'recurring': model.isRecurring, + 'allDay': true, + 'organizationId': 'XYZ', + 'startDate': DateFormat('yyyy-MM-dd').format(startMoment), + 'endDate': DateFormat('yyyy-MM-dd').format(endMoment), + 'startTime': model.isAllDay + ? null + : '${DateFormat('HH:mm:ss').format(startMoment)}Z', + 'endTime': model.isAllDay + ? null + : '${DateFormat('HH:mm:ss').format(endMoment)}Z', + }, + if (model.isRecurring) + 'recurrenceRuleData': { + 'recurrenceStartDate': + DateFormat('yyyy-MM-dd').format(model.recurrenceStartDate), + 'recurrenceEndDate': model.recurrenceEndDate != null + ? DateFormat('yyyy-MM-dd').format(model.recurrenceEndDate!) + : null, + 'frequency': model.frequency, + 'weekDays': (model.frequency == Frequency.weekly || + (model.frequency == Frequency.monthly && + model.weekDayOccurenceInMonth != null)) + ? model.weekDays.toList() + : null, + 'interval': model.interval, + 'count': model.count, + 'weekDayOccurenceInMonth': model.weekDayOccurenceInMonth, + }, + }; + + when( + locator().createEvent( + variables: vars, + ), + ).thenAnswer((_) async { + return QueryResult( + options: QueryOptions(document: gql(EventQueries().addEvent())), + exception: OperationException( + graphqlErrors: [], + ), + data: { + 'test': 'data', + }, + source: QueryResultSource.network, + ); + }); + + await model.createEvent(); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/edit_agenda_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/edit_agenda_view_model_test.dart new file mode 100644 index 000000000..d9c27e659 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/edit_agenda_view_model_test.dart @@ -0,0 +1,118 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +void main() { + late EditAgendaItemViewModel model; + + final testAgendaItem = EventAgendaItem( + id: '1', + title: 'Test Agenda Item', + description: 'Test Description', + duration: '60', + urls: ['https://example.com'], + attachments: ['base64image1'], + categories: [AgendaCategory(id: 'cat1', name: 'Category 1')], + ); + + final testCategories = [ + AgendaCategory(id: 'cat1', name: 'Category 1'), + AgendaCategory(id: 'cat2', name: 'Category 2'), + ]; + + setUp(() { + registerServices(); + model = EditAgendaItemViewModel(); + }); + + group('EditAgendaItemViewModel Tests -', () { + test('initialize() populates the form correctly', () { + model.initialize(testAgendaItem, testCategories); + + expect(model.titleController.text, 'Test Agenda Item'); + expect(model.descriptionController.text, 'Test Description'); + expect(model.durationController.text, '60'); + expect(model.urls, ['https://example.com']); + expect(model.attachments, ['base64image1']); + expect(model.selectedCategories.length, 1); + expect(model.selectedCategories[0].id, 'cat1'); + }); + + test('setSelectedCategories() updates selected categories', () { + model.initialize(testAgendaItem, testCategories); + model.setSelectedCategories([testCategories[1]]); + + expect(model.selectedCategories.length, 1); + expect(model.selectedCategories[0].id, 'cat2'); + }); + + test('addUrl() adds a new URL', () { + model.initialize(testAgendaItem, testCategories); + model.addUrl('https://newexample.com'); + + expect(model.urls.length, 2); + expect(model.urls.contains('https://newexample.com'), true); + }); + + test('removeUrl() removes a URL', () { + model.initialize(testAgendaItem, testCategories); + model.removeUrl('https://example.com'); + + expect(model.urls.length, 0); + }); + + test('removeAttachment() removes an attachment', () { + model.initialize(testAgendaItem, testCategories); + model.removeAttachment('base64image1'); + + expect(model.attachments.length, 0); + }); + + test('checkForChanges() detects changes correctly', () { + model.initialize(testAgendaItem, testCategories); + expect(model.checkForChanges(), false); + + model.titleController.text = 'Updated Title'; + expect(model.checkForChanges(), true); + }); + + testWidgets('updateAgendaItem() calls event service with correct data', + (WidgetTester tester) async { + model.initialize(testAgendaItem, testCategories); + model.titleController.text = 'Updated Title'; + + when( + eventService.updateAgendaItem('1', { + 'title': model.titleController.text, + }), + ).thenAnswer( + (_) async => QueryResult( + source: QueryResultSource.network, + data: { + 'updateAgendaItem': {'id': '1'}, + }, + options: QueryOptions(document: gql('')), + ), + ); + + await model.updateAgendaItem(); + + verify( + eventService.updateAgendaItem('1', { + 'title': 'Updated Title', + 'description': 'Test Description', + 'duration': '60', + 'attachments': ['base64image1'], + 'urls': ['https://example.com'], + 'categories': ['cat1'], + }), + ).called(1); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/edit_event_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/edit_event_view_model_test.dart new file mode 100644 index 000000000..fef608cf7 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/edit_event_view_model_test.dart @@ -0,0 +1,172 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:intl/intl.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/user_action_handler.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/utils/queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +final testEvent = Event( + id: '1', + title: 'test', + startDate: '01/30/2022', // mm/dd/yyyy + endDate: '01/30/2022', + startTime: '06:40 PM', + endTime: '07:40 PM', + location: 'ABC', + description: 'test', + creator: User( + id: 'xzy1', + firstName: 'Test', + lastName: 'User', + email: 'testuser@gmail.com', + refreshToken: 'testtoken', + authToken: 'testtoken', + ), + isPublic: true, + isRegisterable: true, + organization: OrgInfo(id: 'XYZ'), +); + +void main() { + setUpAll(() { + locator.registerSingleton(ActionHandlerService()); + registerServices(); + locator.registerSingleton(Queries()); + }); + group('EditEventViewModel Test -', () { + test("Check if it's initialized correctly", () { + final model = EditEventViewModel(); + model.initialize(testEvent); + + expect(model.eventTitleTextController.text, 'test'); + expect(model.eventLocationTextController.text, 'ABC'); + expect(model.eventDescriptionTextController.text, 'test'); + expect(model.isPublicSwitch, true); + expect(model.isRegisterableSwitch, true); + expect(model.eventStartDate, DateFormat().add_yMd().parse('01/30/2022')); + expect(model.eventEndDate, DateFormat().add_yMd().parse('01/30/2022')); + expect( + model.eventStartTime, + TimeOfDay.fromDateTime(DateFormat('h:mm a').parse('06:40 PM')), + ); + expect( + model.eventEndTime, + TimeOfDay.fromDateTime(DateFormat('h:mm a').parse('07:40 PM')), + ); + }); + testWidgets('Check if updateEvent() is working fine', (tester) async { + final model = EditEventViewModel(); + model.initialize(testEvent); + await tester.pumpWidget( + Form( + key: model.formKey, + child: Container(), + ), + ); + + final DateTime startTime = DateTime( + model.eventStartDate.month, + model.eventStartDate.day, + model.eventStartDate.year, + model.eventStartTime.hour, + model.eventStartTime.minute, + ); + final DateTime endTime = DateTime( + model.eventEndDate.year, + model.eventEndDate.month, + model.eventEndDate.day, + model.eventEndTime.hour, + model.eventEndTime.minute, + ); + + final variables = { + 'title': model.eventTitleTextController.text, + 'description': model.eventDescriptionTextController.text, + 'location': model.eventLocationTextController.text, + 'isPublic': model.isPublicSwitch, + 'isRegisterable': model.isRegisterableSwitch, + 'recurring': false, + 'allDay': false, + 'startDate': DateFormat('yyyy-MM-dd').format(model.eventStartDate), + 'endDate': DateFormat('yyyy-MM-dd').format(model.eventEndDate), + 'startTime': '${DateFormat('HH:mm:ss').format(startTime)}Z', + 'endTime': '${DateFormat('HH:mm:ss').format(endTime)}Z', + }; + + when(eventService.editEvent(eventId: testEvent.id!, variables: variables)) + .thenAnswer((_) async { + return QueryResult( + source: QueryResultSource.network, + data: { + 'test': true, + }, + options: QueryOptions(document: gql(queries.joinOrgById('id'))), + ); + }); + + await model.updateEvent(); + + expect(model.validate, AutovalidateMode.disabled); + }); + testWidgets( + 'Check if updateEvent() is working fine when formkey.currenstate.validate is true', + (tester) async { + final model = EditEventViewModel(); + final inValidEvent = Event( + id: '', + title: '', + startDate: '01/30/2022', // mm/dd/yyyy + endDate: '01/30/2022', + startTime: '06:40 PM', + endTime: '07:40 PM', + location: 'ABC', + description: '', + creator: User( + id: 'xzy1', + firstName: 'Test', + lastName: 'User', + email: 'testuser@gmail.com', + refreshToken: 'testtoken', + authToken: 'testtoken', + ), + isPublic: true, + isRegisterable: true, + organization: OrgInfo(id: 'XYZ'), + ); + model.initialize(inValidEvent); + await tester.pumpWidget( + Form( + child: Container(), + ), + ); + + when(databaseFunctions.noData).thenReturn( + QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: null, + source: QueryResultSource.network, + ), + ); + + await model.updateEvent(); + + expect(model.validate, AutovalidateMode.always); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/event_info_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/event_info_view_model_test.dart new file mode 100644 index 000000000..9011569e9 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/event_info_view_model_test.dart @@ -0,0 +1,364 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + locator().test(); + registerServices(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('Event Info Tests', () { + final model = EventInfoViewModel(); + + test("test initialization", () { + final Event event = + Event(id: "1", isRegisterable: true, isRegistered: false); + final ExploreEventsViewModel exploreEventsViewModel = + ExploreEventsViewModel(); + model.initialize( + args: { + "event": event, + "exploreEventViewModel": exploreEventsViewModel, + }, + ); + expect(model.fabTitle, "Register"); + }); + + test("Test register for event", () async { + final Event event1 = + Event(id: "1", isRegisterable: true, isRegistered: false); + model.event = event1; + + final eventService = getAndRegisterEventService(); + when(eventService.registerForAnEvent(model.event.id!)) + .thenAnswer((realInvocation) async { + return "Event Registered"; + }); + await model.registerForEvent(); + + verify(navigationService.pop()); + + verify(eventService.registerForAnEvent(model.event.id!)); + expect(model.event.isRegistered, true); + expect(model.fabTitle, "Registered"); + + // now make the event non registrable + model.event.isRegistered = false; + model.event.isRegisterable = false; + await model.registerForEvent(); + verifyNever(eventService.registerForAnEvent(model.event.id!)); + expect(model.event.isRegistered, false); + }); + + test("Test getFabTitle function", () { + final Event event1 = Event(id: "1", isRegisterable: false); + model.event = event1; + expect(model.getFabTitle(), "Not Registrable"); + + final Event event2 = + Event(id: "2", isRegisterable: true, isRegistered: false); + model.event = event2; + expect(model.getFabTitle(), "Register"); + + final Event event3 = + Event(id: "3", isRegisterable: true, isRegistered: true); + model.event = event3; + expect(model.getFabTitle(), "Registered"); + }); + test("Test createVolunteerGroup success", () async { + final Event event1 = Event(id: "1"); + model.event = event1; + + final eventService = getAndRegisterEventService(); + final mockResult = { + 'createEventVolunteerGroup': { + '_id': 'group1', + 'name': 'Group 1', + 'volunteersRequired': 10, + 'createdAt': '2024-01-01T00:00:00Z', + 'creator': {'_id': 'creator1'}, + }, + }; + + when( + eventService.createVolunteerGroup({ + 'eventId': "1", + 'name': 'Group 1', + 'volunteersRequired': 10, + }), + ).thenAnswer( + (_) async => QueryResult( + data: mockResult, + source: QueryResultSource.network, + options: QueryOptions( + document: gql(EventQueries().createVolunteerGroup()), + ), + ), + ); + + final newGroup = await model.createVolunteerGroup(event1, 'Group 1', 10); + + expect(newGroup, isNotNull); + expect(newGroup!.name, 'Group 1'); + expect(model.volunteerGroups.length, 1); + expect(model.volunteerGroups.first.name, 'Group 1'); + }); + + test("Test createVolunteerGroup Failure", () async { + final Event event1 = Event(id: "1"); + model.event = event1; + + final eventService = getAndRegisterEventService(); + + when( + eventService.createVolunteerGroup({ + 'eventId': "1", + 'name': 'Group 1', + 'volunteersRequired': 10, + }), + ).thenThrow(Exception('Failed to create new volunteer group')); + + final newGroup = await model.createVolunteerGroup(event1, 'Group 1', 10); + + expect(newGroup, isNull); + }); + + test("Test fetchVolunteerGroups success", () async { + final Event event1 = Event(id: "1"); + model.event = event1; + + final eventService = getAndRegisterEventService(); + final mockResult = [ + EventVolunteerGroup( + id: 'group1', + name: 'Group 1', + volunteersRequired: 10, + createdAt: '2024-01-01T00:00:00Z', + ), + ]; + + when(eventService.fetchVolunteerGroupsByEvent("1")) + .thenAnswer((_) async => mockResult); + + await model.fetchVolunteerGroups('1'); + + expect(model.volunteerGroups.length, 1); + expect(model.volunteerGroups.first.name, 'Group 1'); + }); + + test("Test fetchVolunteerGroups failure", () async { + final Event event1 = Event(id: "1"); + model.event = event1; + model.volunteerGroups.clear(); + + final eventService = getAndRegisterEventService(); + when(eventService.fetchVolunteerGroupsByEvent("1")) + .thenThrow(Exception('Failed to fetch volunteer groups')); + + await model.fetchVolunteerGroups('1'); + + expect(model.volunteerGroups.length, 0); + }); + + test('createAgendaItem success', () async { + final Event event1 = Event(id: "1"); + model.event = event1; + + final eventService = getAndRegisterEventService(); + final mockResult = QueryResult( + source: QueryResultSource.network, + data: { + 'createAgendaItem': { + 'id': '1', + 'title': 'Test Agenda', + 'duration': '1h', + 'sequence': 1, + }, + }, + options: QueryOptions(document: gql(EventQueries().createAgendaItem())), + ); + + when( + eventService.createAgendaItem({ + 'title': 'Test Agenda', + 'sequence': 1, + 'description': 'desc', + 'duration': '1h', + 'organizationId': 'XYZ', + 'attachments': [], + 'relatedEventId': model.event.id, + 'urls': [], + 'categories': ['cat1'], + }), + ).thenAnswer((_) async => mockResult); + + final result = await model.createAgendaItem( + title: 'Test Agenda', + duration: '1h', + attachments: [], + categories: ['cat1'], + description: 'desc', + sequence: 1, + urls: [], + ); + + expect(result, isNotNull); + expect(result!.title, 'Test Agenda'); + expect(model.agendaItems.length, 1); + expect(model.agendaItems.first.title, 'Test Agenda'); + }); + test('deleteAgendaItem success', () async { + final Event event1 = Event(id: "1"); + model.event = event1; + + final eventService = getAndRegisterEventService(); + model.agendaItems.clear(); + model.agendaItems.addAll([ + EventAgendaItem(id: '1', title: 'Item 1'), + EventAgendaItem(id: '2', title: 'Item 2'), + ]); + + when(eventService.deleteAgendaItem({"removeAgendaItemId": '1'})) + .thenAnswer((_) async => true); + + await model.deleteAgendaItem('1'); + + expect(model.agendaItems.length, 1); + expect(model.agendaItems.first.id, '2'); + }); + + test('updateAgendaItemSequence success', () async { + final Event event1 = Event(id: "1"); + model.event = event1; + + final eventService = getAndRegisterEventService(); + final mockResult = QueryResult( + source: QueryResultSource.network, + data: { + 'updateAgendaItem': { + 'id': '1', + 'title': 'Updated Item', + 'sequence': 2, + }, + }, + options: QueryOptions(document: gql(EventQueries().updateAgendaItem())), + ); + model.agendaItems.clear(); + model.agendaItems.addAll([ + EventAgendaItem(id: '1', title: 'Item 1', sequence: 1), + EventAgendaItem(id: '2', title: 'Item 2', sequence: 2), + ]); + + when( + eventService.updateAgendaItem( + '1', + {'sequence': 2}, + ), + ).thenAnswer((_) async => mockResult); + + await model.updateAgendaItemSequence('1', 2); + + expect(model.agendaItems.first.sequence, 2); + expect(model.agendaItems.first.title, 'Updated Item'); + }); + test('fetchAgendaItems success', () async { + final Event event1 = Event(id: "1"); + model.event = event1; + + final eventService = getAndRegisterEventService(); + final mockResult = QueryResult( + source: QueryResultSource.network, + data: { + 'agendaItemByEvent': [ + { + 'id': '1', + 'title': 'Agenda 1', + 'duration': '1h', + 'sequence': 1, + }, + { + 'id': '2', + 'title': 'Agenda 2', + 'duration': '30m', + 'sequence': 2, + }, + ], + }, + options: QueryOptions( + document: gql(EventQueries().fetchAgendaItemsByEvent('1')), + ), + ); + + when(eventService.fetchAgendaItems('1')) + .thenAnswer((_) async => mockResult); + + await model.fetchAgendaItems(); + + expect(model.agendaItems.length, 2); + expect(model.agendaItems[0].title, 'Agenda 1'); + expect(model.agendaItems[1].title, 'Agenda 2'); + expect(model.agendaItems[0].sequence, 1); + expect(model.agendaItems[1].sequence, 2); + }); + + test('fetchCategories success', () async { + final Event event1 = Event(id: "1"); + model.event = event1; + + final eventService = getAndRegisterEventService(); + final mockResult = QueryResult( + source: QueryResultSource.network, + data: { + 'agendaItemCategoriesByOrganization': [ + { + 'id': '1', + 'name': 'Category 1', + }, + { + 'id': '2', + 'name': 'Category 2', + }, + ], + }, + options: QueryOptions( + document: gql( + EventQueries().fetchAgendaItemCategoriesByOrganization('XYZ'), + ), + ), + ); + + when(eventService.fetchAgendaCategories("XYZ")) + .thenAnswer((_) async => mockResult); + + await model.fetchCategories(); + + expect(model.categories.length, 2); + expect(model.categories[0].name, 'Category 1'); + expect(model.categories[1].name, 'Category 2'); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/explore_events_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/explore_events_view_model_test.dart new file mode 100644 index 000000000..1866ab8e5 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/explore_events_view_model_test.dart @@ -0,0 +1,250 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/comment_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +class MockCallbackFunction extends Mock { + void call(); +} + +class _MockStreamSubscription extends Mock + implements StreamSubscription {} + +class _MockStream extends Mock implements Stream { + @override + StreamSubscription listen( + void Function(T event)? onData, { + Function? onError, + void Function()? onDone, + bool? cancelOnError, + }) => + _MockStreamSubscription(); +} + +class _MockNavigationService extends Mock implements NavigationService { + @override + GlobalKey navigatorKey = GlobalKey(); + @override + void pushDialog(Widget dialog) { + showDialog( + context: navigatorKey.currentContext!, + barrierColor: Colors.transparent, + barrierDismissible: false, + builder: (BuildContext context) { + return dialog; + }, + ); + } +} + +void main() { + late Event newEvent; + + setUpAll(() async { + testSetupLocator(); + locator().test(); + locator().test(); + registerServices(); + await locator.unregister(); + locator.registerSingleton(_MockNavigationService()); + locator().test(); + newEvent = Event( + id: "1", + title: "fake_event_title", + description: "fake_event_desc", + attendees: [Attendee(id: 'Test Id')], + location: "fake_event_loc", + recurring: false, + startDate: '2024-01-14', + endDate: '2024-01-14', + startTime: '08:01:00.000Z', + endTime: '08:50:00.000Z', + creator: User(id: 'xzy1'), + isPublic: true, + isRegistered: true, + isRegisterable: true, + organization: OrgInfo(id: 'XYZ'), + ); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('Explore Event Tests', () { + test("Test fetchNewEvents and refreshEvents", () async { + final model = ExploreEventsViewModel(); + await model.initialise(); + when(eventService.getEvents()).thenAnswer((realInvocation) async {}); + await model.fetchNewEvents(); + verify(eventService.getEvents()); + + model.refreshEvents(); + verify(eventService.getEvents()); + }); + + test("Test checkIfExistsAndAddNewEvent function", () async { + final model = ExploreEventsViewModel(); + await model.initialise(); + await model.checkIfExistsAndAddNewEvents([newEvent]); + expect(model.events.isNotEmpty, true); + expect(model.events.first.id, newEvent.id); + }); + + test( + "Test checkIfExistsAndAddNewEvent function when start time is not parsable", + () async { + final model = ExploreEventsViewModel(); + newEvent.startTime = "09:00:00"; + newEvent.organization!.id = 'Test Id 1'; + await model.checkIfExistsAndAddNewEvents([newEvent]); + expect(model.events, isEmpty); + expect(model.events.length, 0); + // expect(model.events.first.id, '1'); + }); + + test("Test chooseValueFromDropdown function", () async { + final model = ExploreEventsViewModel(); + await model.initialise(); + + await model.choseValueFromDropdown('All Events'); + expect(model.emptyListMessage, "Looks like there aren't any events."); + + await model.choseValueFromDropdown("My Events"); + bool allCreated = true; + final userConfig = getAndRegisterUserConfig(); + for (int i = 0; i < model.events.length; i++) { + if (model.events[i].creator?.id != userConfig.currentUser.id) { + allCreated = false; + } + } + expect(allCreated, true); + expect(model.emptyListMessage, "You have not created any event."); + + await model.choseValueFromDropdown("Registered Events"); + + allCreated = true; + bool allRegistered = true; + for (int i = 0; i < model.events.length; i++) { + if (model.events[i].creator?.id != userConfig.currentUser.id) { + allCreated = false; + } + if (model.events[i].isRegistered == false) { + allRegistered = false; + } + } + expect(allCreated, true); + expect(allRegistered, true); + expect(model.emptyListMessage, "No registered events are present"); + + await model.choseValueFromDropdown('Public Events'); + bool allPublic = true; + for (int i = 0; i < model.events.length; i++) { + if (model.events[i].isPublic == false) { + allPublic = false; + } + } + expect(allPublic, true); + expect(model.emptyListMessage, "There aren't any public events."); + + await model.choseValueFromDropdown('Private Events'); + bool allPrivate = true; + for (int i = 0; i < model.events.length; i++) { + if (model.events[i].isPublic == true) { + allPrivate = false; + } + } + expect(allPrivate, true); + expect(model.emptyListMessage, "There aren't any private events."); + + //run default block + await model.choseValueFromDropdown("Events"); + }); + test("Test get event service", () async { + final model = ExploreEventsViewModel(); + expect(model.eventService, isA()); + }); + test( + "Test chooseValueFromDropdown when value is Registered Events and _bufferEvents is not empty", + () async { + final model = ExploreEventsViewModel(); + when(userConfig.currentOrg) + .thenAnswer((realInvocation) => OrgInfo(id: '1')); + when(userConfig.currentOrgInfoStream) + .thenAnswer((realInvocation) => _MockStream()); + when(eventService.eventStream) + .thenAnswer((realInvocation) => _MockStream>()); + + await model.checkIfExistsAndAddNewEvents([newEvent]); + await model.initialise(); + await model.choseValueFromDropdown('Registered Events'); + expect(model.emptyListMessage, "No registered events are present"); + }); + test( + "Test chooseValueFromDropdown when value is Registered Events and _bufferEvents is not empty", + () async { + final model = ExploreEventsViewModel(); + final List userEvents = model.userEvents; + expect(userEvents, []); + }); + testWidgets( + "Test function of CustomAlertDialog when deleteEvent function is executed", + (tester) async { + final model = ExploreEventsViewModel(); + when(model.eventService.deleteEvent(newEvent.id!)).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions( + document: gql(CommentQueries().getPostsComments('postId')), + ), + data: { + 'post': {'comments': []}, + }, + source: QueryResultSource.network, + ), + ); + + await tester.pumpWidget( + MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + navigatorKey: navigationService.navigatorKey, + home: Scaffold(body: Container()), + ), + ); + await tester.pumpAndSettle(); + await model.checkIfExistsAndAddNewEvents([newEvent]); + await model.deleteEvent(eventId: newEvent.id!); + await tester.pumpAndSettle(); + final customFinder = find.byType(CustomAlertDialog); + expect(customFinder, findsOneWidget); + + final successFinder = find.byKey(const Key('Delete')); + await tester.tap(successFinder); + await tester.pump(const Duration(seconds: 1)); + expect(find.byType(CustomProgressDialog), findsOneWidget); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/manage_volunteer_group_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/manage_volunteer_group_view_model_test.dart new file mode 100644 index 000000000..1323a96c2 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/event_view_model_tests/manage_volunteer_group_view_model_test.dart @@ -0,0 +1,159 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart'; +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('ManageVolunteerGroupViewModel Tests', () { + final model = ManageVolunteerGroupViewModel(); + + test("Test initialization", () async { + final Event event = Event(id: "1"); + final EventVolunteerGroup group = + EventVolunteerGroup(id: "group1", volunteers: []); + + await model.initialize(event, group); + + expect(model.event.id, "1"); + expect(model.volunteers, isEmpty); + }); + + test("Test getCurrentOrgUsersList success", () async { + final users = await model.getCurrentOrgUsersList(); + expect(users.length, 2); + expect(users[0].id, "fakeUser1"); + }); + + test("Test addVolunteerToGroup success", () async { + final mockEventService = locator(); + + final mockResult = { + 'createEventVolunteer': { + '_id': 'volunteer1', + }, + }; + + when( + mockEventService.addVolunteerToGroup({ + 'eventId': "1", + 'userId': "volunteer1", + 'groupId': "group1", + }), + ).thenAnswer( + (_) async => QueryResult( + data: mockResult, + source: QueryResultSource.network, + options: + QueryOptions(document: gql(EventQueries().addVolunteerToGroup())), + ), + ); + + await model.addVolunteerToGroup("volunteer1", "1", "group1"); + + expect(model.volunteers.length, 1); + expect(model.volunteers.first.id, "volunteer1"); + }); + + test("Test removeVolunteerFromGroup success", () async { + final mockEventService = locator(); + final mockResult = { + 'removeEventVolunteer': { + 'id': 'volunteer1', + }, + }; + + when( + mockEventService.removeVolunteerFromGroup({ + 'id': 'volunteer1', + }), + ).thenAnswer( + (_) async => QueryResult( + data: mockResult, + source: QueryResultSource.network, + options: QueryOptions( + document: gql(EventQueries().removeVolunteerMutation()), + ), + ), + ); + + await model.removeVolunteerFromGroup("volunteer1"); + + expect(model.volunteers.isEmpty, true); + }); + + test("Test deleteVolunteerGroup success", () async { + final mockEventService = locator(); + final mockResult = { + 'removeEventVolunteerGroup': { + 'id': 'group1', + }, + }; + + when(mockEventService.removeVolunteerGroup({"id": "group1"})).thenAnswer( + (_) async => QueryResult( + data: mockResult, + source: QueryResultSource.network, + options: QueryOptions( + document: gql(EventQueries().removeEventVolunteerGroup()), + ), + ), + ); + + await model.deleteVolunteerGroup("group1"); + + // Assuming the method should notify listeners + verify(mockEventService.removeVolunteerGroup({"id": "group1"})).called(1); + }); + + test("Test updateVolunteerGroup success", () async { + final EventVolunteerGroup group = EventVolunteerGroup(id: "group1"); + + final mockEventService = locator(); + final mockResult = { + 'updateEventVolunteerGroup': { + 'id': 'group1', + }, + }; + + when( + mockEventService.updateVolunteerGroup({ + 'id': group.id, + 'data': { + 'eventId': "1", + 'name': "Updated Group", + 'volunteersRequired': 20, + }, + }), + ).thenAnswer( + (_) async => QueryResult( + data: mockResult, + source: QueryResultSource.network, + options: QueryOptions( + document: gql(EventQueries().updateVolunteerGroupMutation()), + ), + ), + ); + + await model.updateVolunteerGroup(group, "1", "Updated Group", 20); + + expect(group.name, "Updated Group"); + expect(group.volunteersRequired, 20); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/feed_view_models_test/organization_feed_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/feed_view_models_test/organization_feed_view_model_test.dart new file mode 100644 index 000000000..e12422e02 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/feed_view_models_test/organization_feed_view_model_test.dart @@ -0,0 +1,176 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/post_service.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_helpers.mocks.dart'; +import '../../../helpers/test_locator.dart'; + +class MockCallbackFunction extends Mock { + void call(); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + AppConnectivity.isOnline = true; + }); + late OrganizationFeedViewModel model; + final notifyListenerCallback = MockCallbackFunction(); + + setUp(() { + registerServices(); + model = OrganizationFeedViewModel()..addListener(notifyListenerCallback); + }); + tearDown(() { + unregisterServices(); + }); + + group('OrganizationFeedViewModel Tests:', () { + test('Test initialise function', () { + expect(model.currentOrgName, ''); + model.initialise(isTest: true); + expect(model.currentOrgName, 'Organization Name'); + + locator() + .currentOrgInfoController + .add(OrgInfo(name: 'Updated Organization Name')); + + expect(model.posts.length, 0); + }); + + test('Test pinnedPosts getter when istest is true', () { + model.istest = true; + + final pinnedPosts = model.pinnedPosts; + + expect(pinnedPosts, isEmpty); + }); + + test('Test pinnedPosts getter when istest is false', () { + model.istest = false; + + final pinnedPosts = model.pinnedPosts; + + expect(pinnedPosts.length, 4); + + expect(pinnedPosts[0].sId, '1'); + }); + + test('Test setCurrentOrganizationName function', () { + model.setCurrentOrganizationName('Updated Organization Name'); + expect(model.posts.length, 0); + expect(model.userPosts.length, 0); + expect(model.currentOrgName, 'Updated Organization Name'); + }); + + test('Test fetchNewPosts function', () { + model.fetchNewPosts(); + verify(locator().refreshFeed()); + }); + + test('Test buildNewPosts function', () { + when(userConfig.currentUser).thenReturn(User(id: 'a')); + model.buildNewPosts([ + Post(sId: '1', creator: User(id: 'a')), + Post(sId: '2', creator: User(id: 'a')), + ]); + + expect(model.posts.length, 2); + expect(model.userPosts.length, 2); + verify(notifyListenerCallback()); + }); + + test('Test navigateToIndividualPage function', () { + final post = Post(sId: '1', creator: User()); + + model.navigateToIndividualPage(post); + + verify( + locator().pushScreen( + Routes.individualPost, + arguments: post, + ), + ); + }); + + test('Test navigateToPinnedPostPage function', () { + model.navigateToPinnedPostPage(); + + final captured = verify( + (locator() as MockNavigationService).pushScreen( + Routes.pinnedPostPage, + arguments: captureAnyNamed('arguments'), + ), + ).captured; + + expect((captured[0] as List).length, 4); + }); + + test('Test addNewPost function', () { + final post = Post(sId: '1', creator: User()); + + model.addNewPost(post); + + expect(model.posts[0], post); + verify(notifyListenerCallback()); + }); + + test('Test updatedPost function', () { + final post = Post(sId: '1', creator: User()); + model.addNewPost(post); + + final updatedPost = Post( + sId: '1', + description: 'updated', + creator: User(), + ); + model.updatedPost(updatedPost); + + expect(model.posts[0], updatedPost); + verify(notifyListenerCallback()).called(2); + }); + }); + + test('Test removePost function', () async { + final post = Post(sId: '1', creator: User()); + model.addNewPost(post); + model.initialise(); + + when(locator().deletePost(post)).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(PostQueries().removePost())), + data: { + 'test': 'data', + }, + source: QueryResultSource.network, + ), + ); + + await model.removePost(post); + + expect(model.posts.isEmpty, true); + }); + test("test nextpage", () { + model.nextPage(); + expect(model.posts.isEmpty, true); + }); + test("test previousPage", () { + model.previousPage(); + expect(model.posts.isEmpty, true); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/profile_view_model_tests/edit_profile_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/profile_view_model_tests/edit_profile_view_model_test.dart new file mode 100644 index 000000000..159f01a32 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/profile_view_model_tests/edit_profile_view_model_test.dart @@ -0,0 +1,363 @@ +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; +import '../../../service_tests/image_service_test.dart'; +import '../../../widget_tests/widgets/post_modal_test.dart'; + +/// MockCallbackFunction class is used to mock callback function. +class MockCallbackFunction extends Mock { + /// `call` function is a placeholder function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void call(); +} + +void main() { + setUpAll(() { + testSetupLocator(); + SizeConfig().test(); + registerServices(); + graphqlConfig.test(); + sizeConfig.test(); + getAndRegisterImageService(); + getAndRegisterNavigationService(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('EditProfilePageViewModel Test -', () { + test("Check if it's initialized correctly", () { + final model = EditProfilePageViewModel(); + model.initialize(); + expect(model.imageFile, null); + }); + test('Profile shoud be edited if new values are given', () async { + final model = EditProfilePageViewModel(); + model.initialize(); + final Map mockData = { + 'updateUserProfile': { + '_id': '64378abd85008f171cf2990d', + }, + }; + + final File file = File('path/to/newImage.png'); + final String a = await model.convertToBase64(file); + final Map data = { + 'users': [ + { + '__typename': 'UserData', + 'appUserProfile': { + '__typename': 'AppUserProfile', + 'adminFor': [], + 'createdOrganizations': [], + }, + 'user': { + '__typename': 'User', + '_id': '1234567890', + 'firstName': 'John', + 'lastName': 'Doe', + 'email': 'johndoe@example.com', + 'image': 'https://example.com/profile.jpg', + 'joinedOrganizations': [ + { + '__typename': 'Organization', + '_id': '6537904485008f171cf29924', + 'name': 'Unity Foundation', + 'image': null, + 'description': + 'We are aimed at improving the education spaces for the under privileged girl child.', + 'userRegistrationRequired': false, + 'creator': { + '__typename': 'User', + '_id': '64378abd85008f171cf2990d', + 'firstName': 'Wilt', + 'lastName': 'Shepherd', + 'image': null, + }, + } + ], + 'membershipRequests': [], + }, + } + ], + }; + final vars = { + 'firstName': 'NewFirstName', + 'lastName': 'NewLastName', + 'file': 'data:image/png;base64,$a', + }; + when( + databaseFunctions.gqlAuthMutation( + queries.updateUserProfile(), + variables: vars, + ), + ).thenAnswer( + (_) async => QueryResult( + data: mockData, + source: QueryResultSource.network, + options: QueryOptions(document: gql(queries.updateUserProfile())), + ), + ); + when( + databaseFunctions.gqlAuthQuery( + queries.fetchUserInfo, + variables: {'id': model.user.id}, + ), + ).thenAnswer((_) async { + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.fetchUserInfo)), + ); + }); + await model.updateUserProfile( + firstName: 'NewFirstName', + lastName: 'NewLastName', + newImage: File('path/to/newImage.png'), + ); + + verify( + databaseFunctions.gqlAuthMutation( + queries.updateUserProfile(), + variables: vars, + ), + ).called(1); + print(navigationService is MockNavigationService); + // verify( + // navigationService.showTalawaErrorSnackBar( + // "Profile updated successfully", + // MessageType.info, + // ), + // ); + }); + + test('Test UpdateUserProfile when throwing exception', () async { + final model = EditProfilePageViewModel(); + model.initialize(); + final mockedFile = File('path/to/newImage.png'); + final String b = await model.convertToBase64(mockedFile); + when( + databaseFunctions.gqlAuthMutation( + queries.updateUserProfile(), + variables: { + 'firstName': 'NewFirstName', + 'lastName': 'NewLastName', + 'newImage': 'data:image/png;base64,$b', + }, + ), + ).thenThrow(Exception()); + when( + databaseFunctions.gqlAuthQuery( + queries.fetchUserInfo, + variables: {'id': model.user.id}, + ), + ).thenThrow(Exception()); + await model.updateUserProfile( + firstName: 'NewFirstNa', + lastName: 'NewLastNa', + newImage: File('path/to/newImage.png'), + ); + }); + testWidgets('Test if SelectImage from camera method works', + (WidgetTester tester) async { + final model = EditProfilePageViewModel(); + model.initialize(); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Builder( + builder: (BuildContext context) { + return ElevatedButton( + key: const Key('btn1'), + onPressed: () => model.selectImage(camera: true), + child: const Text('listner'), + ); + }, + ), + ), + ), + ); + final file = File('fakePath'); + when(locator().getPhotoFromGallery(camera: true)) + .thenAnswer((realInvocation) async { + return file; + }); + await tester.tap(find.byKey(const Key('btn1'))); + await tester.pumpAndSettle(); + verify(multimediaPickerService.getPhotoFromGallery(camera: true)) + .called(1); + expect(model.imageFile, file); + }); + + testWidgets('Test if selectImage from gallery method works', + (WidgetTester tester) async { + final model = EditProfilePageViewModel(); + model.initialize(); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Builder( + builder: (BuildContext context) { + return ElevatedButton( + key: const Key('btn1'), + onPressed: () => model.selectImage(), + child: const Text('listner'), + ); + }, + ), + ), + ), + ); + final file = File('fakePath'); + when(locator().getPhotoFromGallery()) + .thenAnswer((realInvocation) async { + return file; + }); + await tester.tap(find.byKey(const Key('btn1'))); + await tester.pumpAndSettle(); + + expect(model.imageFile, file); + }); + testWidgets( + 'Test if SelectImage from camera method works if null is returned', + (WidgetTester tester) async { + final model = EditProfilePageViewModel(); + model.initialize(); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Builder( + builder: (BuildContext context) { + return ElevatedButton( + key: const Key('btn1'), + onPressed: () => model.selectImage(camera: true), + child: const Text('listner'), + ); + }, + ), + ), + ), + ); + when(locator().getPhotoFromGallery(camera: true)) + .thenAnswer((realInvocation) async { + return null; + }); + await tester.tap(find.byKey(const Key('btn1'))); + await tester.pumpAndSettle(); + verify(multimediaPickerService.getPhotoFromGallery(camera: true)) + .called(1); + expect(model.imageFile, null); + }); + testWidgets( + 'Test if selectImage from gallery method works when null is returned', + (WidgetTester tester) async { + final model = EditProfilePageViewModel(); + model.initialize(); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Builder( + builder: (BuildContext context) { + return ElevatedButton( + key: const Key('btn1'), + onPressed: () => model.selectImage(), + child: const Text('listner'), + ); + }, + ), + ), + ), + ); + when(locator().getPhotoFromGallery()) + .thenAnswer((realInvocation) async { + return null; + }); + await tester.tap(find.byKey(const Key('btn1'))); + await tester.pumpAndSettle(); + expect(model.imageFile, null); + }); + + test('No update performed if inputs are the same as existing data', + () async { + final model = EditProfilePageViewModel(); + model.initialize(); + await model.updateUserProfile( + firstName: model.user.firstName, + lastName: model.user.lastName, + newImage: null, + ); + verifyNever( + databaseFunctions.gqlAuthMutation( + queries.updateUserProfile(), + variables: {'id': 'xzy1'}, + ), + ); + }); + + test('No update performed if all three inputs are null', () async { + final model = EditProfilePageViewModel(); + model.initialize(); + when(databaseFunctions.noData).thenReturn( + QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: null, + source: QueryResultSource.network, + ), + ); + await model.updateUserProfile( + firstName: null, + lastName: null, + newImage: null, + ); + }); + + test('convertToBase64 converts file to base64 string', () async { + final model = EditProfilePageViewModel(); + model.initialize(); + //using this asset as the test asset + final file = File('assets/images/Group 8948.png'); + final fileString = await model.convertToBase64(file); + expect(model.base64Image, fileString); + }); + + test('convertToBase64 converts file to base64 string throws exception', + () async { + final model = EditProfilePageViewModel(); + model.initialize(); + //using this asset as the test asset + final file = File(MockImageService.throwException); + await model.convertToBase64(file); + expect(model.base64Image, null); + }); + + test('Check if removeImage() is working fine', () async { + final notifyListenerCallback = MockCallbackFunction(); + final model = EditProfilePageViewModel() + ..addListener(notifyListenerCallback); + + model.removeImage(); + + expect(model.imageFile, null); + verify(notifyListenerCallback()).called(1); + }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/profile_view_model_tests/profile_page_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/profile_view_model_tests/profile_page_view_model_test.dart new file mode 100644 index 000000000..a4f1219ab --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/profile_view_model_tests/profile_page_view_model_test.dart @@ -0,0 +1,282 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:qr_flutter/qr_flutter.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +class MockCallbackFunction extends Mock { + void call(); +} + +class MockBuildContext extends Mock implements BuildContext {} + +void verifyInteraction(dynamic x, {required String mockName}) { + // Ensures that navigation service was called + try { + verifyZeroInteractions(x); + //If 0 interactions passes that means mock was not called hence test fails + throw Exception("Expected interaction but found 0 with $mockName"); + } on TestFailure { + //If test fails then 1 or more interactions with navigation service hence test passes + expect(true, true); + } +} + +void main() async { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + }); + + group('ProfilePageViewModel Tests -', () { + setUpAll(() { + registerServices(); + graphqlConfig.test(); + sizeConfig.test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + test("Test initialization", () { + final model = ProfilePageViewModel(); + model.initialize(); + expect(model.currentOrg, userConfig.currentOrg); + expect(model.currentUser, userConfig.currentUser); + }); + testWidgets('changeCurrency test', (WidgetTester tester) async { + final model = ProfilePageViewModel(); + model.initialize(); + void mockSetter(void Function() innerFunction) { + innerFunction(); + } + + await tester.pumpWidget( + MaterialApp( + home: Builder( + builder: (context) { + return ElevatedButton( + key: const Key('btn1'), + onPressed: () { + model.changeCurrency(context, mockSetter); + }, + child: const Text('Change Currency'), + ); + }, + ), + ), + ); + + await tester.tap(find.byKey(const Key('btn1'))); + await tester.pumpAndSettle(); + await tester.tap(find.text('USD')); + expect(find.byType(BottomSheet), findsOneWidget); + }); + + test("Test showSnackBar and popBottomSheet function", () { + final model = ProfilePageViewModel(); + model.initialize(); + + model.showSnackBar("fake_message"); + verify( + navigationService.showTalawaErrorDialog( + "fake_message", + MessageType.error, + ), + ).called(1); + + model.popBottomSheet(); + verify(navigationService.pop()); + }); + + test("Test updateSheetHeight function", () { + final model = ProfilePageViewModel(); + model.initialize(); + model.updateSheetHeight(); + expect(model.bottomSheetHeight, SizeConfig.screenHeight! * 0.65); + }); + + testWidgets("Test iconButton function", (tester) async { + final model = ProfilePageViewModel(); + model.initialize(); + bool setterCalled = false; + void mockSetter() { + setterCalled = true; + } + + const Icon testIcon = Icon(Icons.cancel); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: model.iconButton(testIcon, mockSetter), + ), + ), + ); + await tester.tap(find.byKey(const Key('iconbtn1'))); + expect(setterCalled, true); + final iconButtonFinder = find.byType(IconButton); + final iconButton = tester.firstWidget(iconButtonFinder); + expect((iconButton as IconButton).icon, testIcon); + }); + + testWidgets("Test dominationButton function", (tester) async { + final mockContext = MockBuildContext(); + final model = ProfilePageViewModel(); + model.initialize(); + const String amt = "test_amt"; + model.donationAmount.text = amt; + + bool setterCalled = false; + void mockSetter(void Function() innerFunction) { + setterCalled = true; + innerFunction(); + } + + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: model.dominationButton( + amt, + mockContext, + mockSetter, + ), + ), + ), + ); + await tester.tap(find.byKey(const Key('domBtn_$amt'))); + await tester.pump(); + await tester.pumpAndSettle(); + expect(setterCalled, true); + final containerFinder = find.byType(Container); + final Container container = tester.firstWidget(containerFinder); + expect( + container.padding, + EdgeInsets.symmetric( + vertical: SizeConfig.screenHeight! * 0.02, + horizontal: SizeConfig.screenWidth! * 0.075, + ), + ); + }); + testWidgets("Test invite method", (WidgetTester tester) async { + final model = ProfilePageViewModel(); + model.initialize(); + await tester.pumpWidget( + MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: Builder( + builder: (BuildContext context) { + // Trigger the invite method on button press + return ElevatedButton( + key: const Key('inviteButton'), + onPressed: () => model.invite(context), + child: const Text('Invoke Invite'), + ); + }, + ), + ), + ), + ); + await tester.pumpAndSettle(); + + // model.invite(mockContext); + + await tester.tap(find.byKey(const Key('inviteButton'))); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('iconbtn1'))); + + expect(find.byType(Dialog), findsOneWidget); + expect(find.byType(QrImageView), findsOneWidget); + }); + + testWidgets('attachListener test', (WidgetTester tester) async { + final viewModel = ProfilePageViewModel(); + viewModel.initialize(); + double bottomSheetHeight = 0; + final FocusNode focusNode = viewModel.donationField; + const testFocus = Key('testFocus'); + const testFocus1 = Key('testFocus1'); + + void mockSetter(void Function() innerFunction) { + innerFunction(); + } + + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Builder( + builder: (BuildContext context) { + return Scaffold( + body: Container( + child: Column( + children: [ + TextField( + key: testFocus, + focusNode: focusNode, + ), + TextField( + key: testFocus1, + focusNode: FocusNode(), + ), + ], + ), + ), + ); + }, + ), + ), + ), + ); + + viewModel.attachListener(mockSetter); + await tester.enterText(find.byKey(testFocus), 'test attach listener'); + mockSetter(() { + bottomSheetHeight = SizeConfig.screenHeight! * 0.8725; + }); + await tester.pump(); + expect(bottomSheetHeight, SizeConfig.screenHeight! * 0.8725); + await tester.enterText( + find.byKey(testFocus1), + 'viewmodel.dontaionField out of focus', + ); + + await tester.pump(const Duration(milliseconds: 300)); + + mockSetter(() { + bottomSheetHeight = SizeConfig.screenHeight! * 0.68; + }); + expect(bottomSheetHeight, SizeConfig.screenHeight! * 0.68); + }); + + // test('logout success', () { + // final model = ProfilePageViewModel(); + // when(userConfig.loggedIn).thenReturn(true); + // model.logoutSuccess(); + + // // when(userConfig.loggedIn).thenReturn(false); + // // model.logoutSuccess(); + + // // verify( navigationService.removeAllAndPush( + // // '/selectLang', + // // '/', + // // arguments: '0', + // // )); + // }); + }); +} diff --git a/test/view_model_tests/after_auth_view_model_tests/settings_view_models_test/app_setting_view_model_test.dart b/test/view_model_tests/after_auth_view_model_tests/settings_view_models_test/app_setting_view_model_test.dart new file mode 100644 index 000000000..b238f31c8 --- /dev/null +++ b/test/view_model_tests/after_auth_view_model_tests/settings_view_models_test/app_setting_view_model_test.dart @@ -0,0 +1,58 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/settings_view_models/app_setting_view_model.dart'; +import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +class MockUrlLauncher extends Mock + with MockPlatformInterfaceMixin + implements UrlLauncherPlatform { + @override + Future launchUrl(String url, LaunchOptions? options) { + if (url == 'http://www.success.com') return Future.value(true); + return Future.value(false); + } +} + +void main() async { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + }); + + group('Test for appSettingviewModel', () { + setUpAll(() async { + getAndRegisterNavigationService(); + getAndRegisterUserConfig(); + final mock = MockUrlLauncher(); + UrlLauncherPlatform.instance = mock; + }); + + test('Test logout function.', () { + final model = AppSettingViewModel(); + model.logout(); + }); + + test('test for launchWebsite method', () async { + final model = AppSettingViewModel(); + const successUrl = 'http://www.success.com'; + const failUrl = 'http://www.fail.com'; + + bool opened = false; + + // if successfully launches the website. + opened = await model.launchWebsite(successUrl); + expect(opened, true); + + // if failed to launch the website. + opened = await model.launchWebsite(failUrl); + expect(opened, false); + }); + }); +} diff --git a/test/view_model_tests/base_view_model_test.dart b/test/view_model_tests/base_view_model_test.dart new file mode 100644 index 000000000..3d62f6559 --- /dev/null +++ b/test/view_model_tests/base_view_model_test.dart @@ -0,0 +1,48 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/view_model/base_view_model.dart'; + +class MockCallbackFunction extends Mock { + void call(); +} + +void main() { + BaseModel getBaseModel() { + final model = BaseModel(); + return model; + } + + group("BaseViewModel Test- ", () { + final callback = MockCallbackFunction(); + + test("When initialized viewstate should be ViewState.idle", () { + final model = getBaseModel(); + expect(model.state, ViewState.idle); + }); + test("When initialized isBusy should be false ", () { + final model = getBaseModel(); + expect(model.isBusy, false); + }); + + test( + "When setState is called the state should reflect the state passed to the setState function ", + () { + final model = getBaseModel(); + model.setState(ViewState.busy); + expect(model.state, ViewState.busy); + model.setState(ViewState.idle); + expect(model.state, ViewState.idle); + }); + + test("When setState is called, BaseModel should call notifyListners", () { + final model = getBaseModel(); + model.addListener(callback); + model.setState(ViewState.busy); + verify(callback()); + }); + }); +} diff --git a/test/view_model_tests/connectivity_view_model_test.dart b/test/view_model_tests/connectivity_view_model_test.dart new file mode 100644 index 000000000..66a25b228 --- /dev/null +++ b/test/view_model_tests/connectivity_view_model_test.dart @@ -0,0 +1,124 @@ +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart' as http; +import 'package:provider/provider.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/caching/cached_user_action.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; +import '../service_tests/third_party_service_test.dart/connectivity_service_test.dart'; + +Widget createMainScreen({bool demoMode = true, bool? isOnline}) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, themeModel, child) { + return BaseView( + onModelReady: (connectivityModel) => connectivityModel.initialise(), + builder: (context, connectivityModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + theme: Provider.of(context, listen: true).isdarkTheme + ? TalawaTheme.darkTheme + : TalawaTheme.lightTheme, + home: Scaffold( + body: TextButton( + child: const Text('click me'), + onPressed: () { + AppConnectivity.showSnackbar(isOnline: isOnline!); + }, + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); + }, + ); +} + +void main() { + late AppConnectivity model; + setUpAll(() async { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + // await cacheService.initialise(); + connectivityService.initConnectivity(client: http.Client()); + model = locator(); + model.initialise(); + }); + group('test connectivity view model', () { + test('handleConnection when demoMode', () { + MainScreenViewModel.demoMode = true; + model.handleConnection(ConnectivityResult.mobile); + }); + + test('handleConnection when offline', () { + internetAccessible = false; + model.handleConnection(ConnectivityResult.none); + }); + test('handleConnection when online', () async { + MainScreenViewModel.demoMode = false; + await cacheService.offlineActionQueue.addAction( + CachedUserAction( + id: 'test', + operation: 'test', + timeStamp: DateTime.now(), + status: CachedUserActionStatus.pending, + operationType: CachedOperationType.gqlAuthMutation, + expiry: DateTime.now().add(const Duration(hours: 6)), + ), + ); + + print(cacheService.offlineActionQueue.getActions()); + model.handleConnection(ConnectivityResult.mobile); + }); + + testWidgets('showSnackbar when online', (tester) async { + await tester.pumpWidget(createMainScreen(isOnline: true)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + await tester.tap(find.text('click me')); + }); + + testWidgets('showSnackbar when offline', (tester) async { + await tester.pumpWidget(createMainScreen(isOnline: false)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + await tester.tap(find.text('click me')); + }); + + test('check enableSubscription body', () { + connectivityService.connectionStatusController + .add(ConnectivityResult.none); + }); + + test('enableSubscirption exception', () async { + model.enableSubscription(); + }); + }); +} diff --git a/test/view_model_tests/custom_drawer_view_model_test.dart b/test/view_model_tests/custom_drawer_view_model_test.dart new file mode 100644 index 000000000..7c3ef3ce1 --- /dev/null +++ b/test/view_model_tests/custom_drawer_view_model_test.dart @@ -0,0 +1,284 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.dart'; +import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +/// Mocked context. +/// +/// more_info_if_required +class MockBuildContext extends Mock implements BuildContext {} + +/// Main. +/// +/// more_info_if_required +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + locator().test(); + locator(); + registerServices(); + locator().test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + group('CustomDrawerViewModel Tests', () { + test('switchAbleOrg should correctly get and set value', () { + final model = CustomDrawerViewModel(); + final orgList = [ + OrgInfo(name: 'Test Org 1'), + OrgInfo(name: 'Test Org 2'), + ]; + + model.switchAbleOrg = orgList; + + expect(model.switchAbleOrg, equals(orgList)); + }); + test("initialize should setup the model with user's joined organizations", + () { + final homeModel = MainScreenViewModel(); + final MockBuildContext mockContext = MockBuildContext(); + final model = CustomDrawerViewModel(); + final user = User(joinedOrganizations: [OrgInfo(name: 'Test Org')]); + + when(userConfig.currentOrgInfoStream) + .thenAnswer((_) => Stream.value(OrgInfo())); + when(userConfig.currentUser).thenReturn(user); + when(userConfig.currentOrg).thenReturn(OrgInfo()); + + model.initialize(homeModel, mockContext); + + expect(model.switchAbleOrg, equals(user.joinedOrganizations)); + }); + + test('switchOrg should show info message if different organization', () { + final model = CustomDrawerViewModel(); + final orgInfo = OrgInfo(name: 'Test Org'); + + when(userConfig.currentOrg).thenReturn(OrgInfo(name: 'Current Org')); + model.switchAbleOrg = [orgInfo]; + + model.switchOrg(orgInfo); + + verify( + navigationService.showTalawaErrorSnackBar( + 'Switched to ${orgInfo.name}', + MessageType.info, + ), + ); + }); + + test('switchOrg should pop navigation after switching or showing error', + () { + final model = CustomDrawerViewModel(); + final orgInfo = OrgInfo(name: 'Test Org'); + + when(userConfig.currentOrg).thenReturn(OrgInfo(name: 'Current Org')); + model.switchAbleOrg = [orgInfo]; + + model.switchOrg(orgInfo); + + verify(navigationService.pop()); + }); + + test('initialize should setup the model with userConfig values', () { + final homeModel = MainScreenViewModel(); + final MockBuildContext mockContext = MockBuildContext(); + final model = CustomDrawerViewModel(); + final user = User(joinedOrganizations: [OrgInfo(name: 'Test Org')]); + + when(userConfig.currentOrgInfoStream) + .thenAnswer((_) => Stream.value(OrgInfo())); + when(userConfig.currentUser).thenReturn(user); + when(userConfig.currentOrg).thenReturn(OrgInfo()); + + model.initialize(homeModel, mockContext); + + expect(model.switchAbleOrg, equals(user.joinedOrganizations)); + expect(model.selectedOrg, equals(userConfig.currentOrg)); + }); + test( + 'switchOrg should save new organization in userConfig if different organization', + () { + final model = CustomDrawerViewModel(); + final orgInfo = OrgInfo(name: 'Test Org'); + + when(userConfig.currentOrg).thenReturn(OrgInfo(name: 'Current Org')); + model.switchAbleOrg = [orgInfo]; + + model.switchOrg(orgInfo); + + verify(userConfig.saveCurrentOrgInHive(orgInfo)); + verify( + navigationService.showTalawaErrorSnackBar( + 'Switched to ${orgInfo.name}', + MessageType.info, + ), + ); + }); + + test('check if switchOrg is working with zero switchable orgs', () { + final model = CustomDrawerViewModel(); + model.setSelectedOrganizationName(userConfig.currentOrg); + + //No switchable org are present in the model + model.switchAbleOrg = []; + + //Acess mock joined Organisation for the mock user + final OrgInfo mockJoinedOrg = + userConfig.currentUser.joinedOrganizations!.first; + + //check if selected org is mocked joined org .Expectation-false. + expect(model.selectedOrg, isNot(mockJoinedOrg)); + }); + + test('check if switchOrg is working with wrong switchable org being passed', + () { + final model = CustomDrawerViewModel(); + model.setSelectedOrganizationName(userConfig.currentOrg); + + //Mock switchable org are present in the model + model.switchAbleOrg = userConfig.currentUser.joinedOrganizations!; + + //Mock fake org which is not present in the mock switchableOrg + + //Acess mock joined Organisation for the mock user + final OrgInfo fakeOrg = OrgInfo( + id: '5', + name: 'fake org 1', + userRegistrationRequired: true, + creatorInfo: User(firstName: 'fake', lastName: 'user'), + ); + //check if the mocked org is present or not + + final isPresent = model.isPresentinSwitchableOrg(fakeOrg); + + //expecting that the org is not present so will return false + expect(isPresent, false); + //check if selected org is changed or not. Expected-Not changing + expect(model.selectedOrg, isNot(fakeOrg)); + }); + + test('check if switchOrg is working with mock joined orgs', () async { + final model = CustomDrawerViewModel(); + final homeModel = MainScreenViewModel(); + final MockBuildContext mockContext = MockBuildContext(); + //Intializing a mock model with mockBuildContext + model.initialize(homeModel, mockContext); + //Storing the first switchable org in mockOrgInfo + final OrgInfo mockChangeOrgTo = model.switchAbleOrg.first; + + //Calling the switchOrg function + model.switchOrg(mockChangeOrgTo); + + //expecting the selected org will be equal to the mockChangeOrgto returns true + expect(model.selectedOrg, mockChangeOrgTo); + }); + + test('setSelectedOrganizationName should update selectedOrg if different', + () { + final model = CustomDrawerViewModel(); + final orgInfo = OrgInfo(name: 'Test Org'); + + model.setSelectedOrganizationName(orgInfo); + + expect(model.selectedOrg, equals(orgInfo)); + }); + + test('Check if OrgInfo is present in switchAbleOrg', () { + final model = CustomDrawerViewModel(); + model.switchAbleOrg = [ + OrgInfo(id: '1'), + OrgInfo(id: '2'), + OrgInfo(id: '3'), + ]; + final switchToOrg = OrgInfo(id: '2'); + + final result = model.isPresentinSwitchableOrg(switchToOrg); + + expect(result, true); + }); + + test('Check if OrgInfo is not present in switchAbleOrg', () { + final model = CustomDrawerViewModel(); + model.switchAbleOrg = [ + OrgInfo(id: '1'), + OrgInfo(id: '2'), + OrgInfo(id: '3'), + ]; + final switchToOrg = OrgInfo(id: '4'); + + final result = model.isPresentinSwitchableOrg(switchToOrg); + + expect(result, false); + }); + + test( + 'setSelectedOrganizationName should show error snackbar if org is same as selected', + () { + final homeModel = MainScreenViewModel(); + final MockBuildContext mockContext = MockBuildContext(); + final model = CustomDrawerViewModel(); + final user = + User(joinedOrganizations: [OrgInfo(id: '1', name: 'Test Org1')]); + + when(userConfig.currentOrgInfoStream) + .thenAnswer((_) => Stream.value(OrgInfo(id: '1', name: 'Test Org1'))); + when(userConfig.currentUser).thenReturn(user); + when(userConfig.currentOrg) + .thenReturn(OrgInfo(id: '1', name: 'Test Org1')); + model.initialize(homeModel, mockContext); + final switchToOrg = OrgInfo(id: '1', name: 'Test Org1'); + model.setSelectedOrganizationName(switchToOrg); + final result1 = model.isPresentinSwitchableOrg(switchToOrg); + + expect(result1, true); + // expect(model.selectedOrg, equals(userConfig.currentOrg)); + model.switchOrg(switchToOrg); + final result = model.isPresentinSwitchableOrg(switchToOrg); + + expect(result, true); + expect(model.selectedOrg, equals(switchToOrg)); + verify( + navigationService.showTalawaErrorSnackBar( + '${switchToOrg.name} already selected', + MessageType.warning, + ), + ).called(1); + }); + test('controller should return ScrollController instance', () { + final model = CustomDrawerViewModel(); + expect(model.controller, isA()); + }); + + test('targets should return List instance', () { + final model = CustomDrawerViewModel(); + expect(model.targets, isA>()); + }); + + test('selectedOrg should be initially null', () { + final model = CustomDrawerViewModel(); + expect(model.selectedOrg, isNull); + }); + }); +} diff --git a/test/view_model_tests/lang_view_model_test.dart b/test/view_model_tests/lang_view_model_test.dart new file mode 100644 index 000000000..153d6af59 --- /dev/null +++ b/test/view_model_tests/lang_view_model_test.dart @@ -0,0 +1,256 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + SharedPreferences.setMockInitialValues({}); + + testSetupLocator(); + locator().test(); + + setUp(() { + registerServices(); + }); + + tearDown(() { + unregisterServices(); + }); + + group('Language View Model Tests', () { + test("test change language", () async { + final model = AppLanguage(isTest: true); + model.initialize(); + + // check that initially the app language is set to english + final Locale locale = model.appLocal; + expect(locale, const Locale('en')); + + // test changeLanguage function with same language as before + model.changeLanguage(const Locale('en')); + expect(model.appLocal, const Locale('en')); + + // test changeLanguage function with different language + model.changeLanguage(const Locale('es')); + final Locale changedLocale = model.appLocal; + expect(changedLocale, const Locale('es')); + }); + + test('change language with isTest false', () async { + final model = AppLanguage(isTest: false); + model.initialize(); + + // check that initially the app language is set to english + final Locale locale = model.appLocal; + expect(locale, const Locale('en')); + + // test changeLanguage function with same language as before + await model.changeLanguage(const Locale('en')); + expect(model.appLocal, const Locale('en')); + + // test changeLanguage function with different languages + await model.changeLanguage(const Locale('es')); + Locale changedLocale = model.appLocal; + expect(model.appLocal, const Locale('es')); + + await model.changeLanguage(const Locale('fr')); + changedLocale = model.appLocal; + expect(changedLocale, const Locale('fr')); + + await model.changeLanguage(const Locale('hi')); + changedLocale = model.appLocal; + expect(changedLocale, const Locale('hi')); + + await model.changeLanguage(const Locale('zh')); + changedLocale = model.appLocal; + expect(changedLocale, const Locale('zh')); + + await model.changeLanguage(const Locale('de')); + changedLocale = model.appLocal; + expect(changedLocale, const Locale('de')); + + await model.changeLanguage(const Locale('ja')); + changedLocale = model.appLocal; + expect(changedLocale, const Locale('ja')); + + await model.changeLanguage(const Locale('pt')); + changedLocale = model.appLocal; + expect(changedLocale, const Locale('pt')); + + await model.changeLanguage(const Locale('en')); + changedLocale = model.appLocal; + expect(changedLocale, const Locale('en')); + }); + + test("test functions", () async { + final model = AppLanguage(isTest: true); + await model.initialize(); + + // consider if user is not logged in. + when(userConfig.currentUser).thenReturn(User(id: 'null')); + + when( + navigationService.pushScreen( + Routes.mainScreen, + arguments: MainScreenArgs( + mainScreenIndex: 0, + fromSignUp: false, + toggleDemoMode: true, + ), + ), + ).thenAnswer((_) async {}); + + await model.selectLanguagePress(); + verify( + navigationService.pushScreen( + Routes.mainScreen, + arguments: MainScreenArgs( + mainScreenIndex: 0, + fromSignUp: false, + toggleDemoMode: true, + ), + ), + ); + // consider if user is logged in. + when(userConfig.currentUser).thenReturn(User(id: 'xyz1')); + + when( + navigationService.popAndPushScreen( + '/appSettingsPage', + arguments: '', + ), + ).thenAnswer((_) async {}); + + databaseFunctions.init(); + + when( + databaseFunctions.gqlAuthMutation( + queries.updateLanguage(model.appLocal.languageCode), + ), + ).thenAnswer((_) async { + return QueryResult( + options: QueryOptions(document: gql(PostQueries().addLike())), + exception: OperationException(graphqlErrors: []), + source: QueryResultSource.network, + ); + }); + + await model.selectLanguagePress(); + + verify( + databaseFunctions.gqlAuthMutation( + queries.updateLanguage(model.appLocal.languageCode), + ), + ); + verify( + navigationService.popAndPushScreen( + '/appSettingsPage', + arguments: '', + ), + ); + + // testing userLanguageQuery function + const userId = "xyz1"; + when(databaseFunctions.gqlAuthQuery(queries.newUserLanguage(userId))) + .thenAnswer((_) async { + return QueryResult( + options: QueryOptions(document: gql(PostQueries().addLike())), + exception: OperationException(graphqlErrors: []), + source: QueryResultSource.network, + ); + }); + await model.userLanguageQuery(userId); + verify(databaseFunctions.gqlAuthQuery(queries.newUserLanguage(userId))); + + //testing appLanguageQueryFunction + when(databaseFunctions.gqlAuthQuery(queries.userLanguage())) + .thenAnswer((_) async { + return QueryResult( + options: QueryOptions(document: gql(PostQueries().addLike())), + exception: OperationException(graphqlErrors: []), + source: QueryResultSource.network, + ); + }); + await model.appLanguageQuery(); + verify(databaseFunctions.gqlAuthQuery(queries.userLanguage())); + + //testing catch block in userLanguageQuery + when(databaseFunctions.gqlAuthQuery(queries.newUserLanguage(userId))) + .thenThrow(Error()); + await model.userLanguageQuery(userId); + + //testing catch block in appLanguageQuery + when(databaseFunctions.gqlAuthQuery(queries.userLanguage())) + .thenThrow(Error()); + await model.appLanguageQuery(); + + //testing catch block in dbLanguageUpdate + when( + databaseFunctions.gqlAuthMutation( + queries.updateLanguage(model.appLocal.languageCode), + ), + ).thenThrow(Error()); + await model.dbLanguageUpdate(); + }); + }); + + group('Locale Resolution Tests', () { + final model = AppLanguage(isTest: true); + model.initialize(); + const supportedLocales = [ + Locale('en', 'US'), + Locale('es', 'ES'), + Locale('fr', 'FR'), + Locale('hi', 'IN'), + Locale('zh', 'CN'), + Locale('de', 'DE'), + Locale('ja', 'JP'), + Locale('pt', 'PT'), + ]; + + test('Returns first supported locale when locale is null', () { + final result = model.localeResoultion(null, supportedLocales); + expect(result, supportedLocales.first); + }); + + test('Returns matching language code locale', () { + const locale = Locale('es', 'MX'); + final result = model.localeResoultion(locale, supportedLocales); + expect(result, const Locale('es', 'ES')); + }); + + test('Returns matching country code locale', () { + const locale = Locale('fr', 'CA'); + final result = model.localeResoultion(locale, supportedLocales); + expect(result, const Locale('fr', 'FR')); + }); + + test('Returns first supported locale when no match is found', () { + const locale = Locale('it', 'IT'); + final result = model.localeResoultion(locale, supportedLocales); + expect(result, supportedLocales.first); + }); + + test('Returns correct locale when exact match is found', () { + const locale = Locale('en', 'US'); + final result = model.localeResoultion(locale, supportedLocales); + expect(result, locale); + }); + }); +} diff --git a/test/view_model_tests/main_screen_view_model_test.dart b/test/view_model_tests/main_screen_view_model_test.dart new file mode 100644 index 000000000..fd1ce6f85 --- /dev/null +++ b/test/view_model_tests/main_screen_view_model_test.dart @@ -0,0 +1,733 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/app_tour.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/queries.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; +import 'package:talawa/widgets/custom_drawer.dart'; +import 'package:talawa/widgets/theme_switch.dart'; +import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; + +// import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; + +import '../helpers/test_helpers.dart'; +// import '../helpers/test_helpers.mocks.dart'; +import '../helpers/test_locator.dart'; +import '../model_tests/app_tour_test.dart'; + +class MockLocalMainScreenViewModel extends MainScreenViewModel { + int stackLength = 0; + @override + void tourEventTargets() { + stackLength++; + // TODO: implement tourEventTargets + super.tourEventTargets(); + } + + @override + void tourProfile() { + stackLength++; + // TODO: implement tourProfile + super.tourProfile(); + } +} + +typedef FunctionType = void Function(MainScreenViewModel model2); + +Widget createMainScreenViewModelScreen(FunctionType onTap) { + final GlobalKey key = MainScreenViewModel.scaffoldKey; + return MaterialApp( + builder: (context, child) => BaseView( + builder: (context, model2, child) { + model2.context = context; + model2.testMode = true; + model2.appTour = MockAppTour(model: model2); + model2.currentPageIndex = 0; + return Scaffold( + key: key, + drawer: const Text('drawer123'), + body: TextButton( + onPressed: () { + onTap(model2); + }, + child: const Text('tour home'), + ), + ); + }, + ), + ); +} + +Widget createAppTourDialog({bool demoMode = true}) => BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: BaseView( + onModelReady: (model2) => model2.initialise( + context, + fromSignUp: false, + mainScreenIndex: 0, + demoMode: demoMode, + testMode: true, + ), + builder: (context, model2, child) { + model2.context = context; + model2.appTour = MockAppTour(model: model2); + model2.pluginPrototypeData.putIfAbsent( + "Plugin1", + () => { + "pluginName": "Plugin1", + "pluginInstallStatus": true, + 'icon': Icons.abc, + 'class': const ChangeThemeTile(), + }, + ); + model2.fetchAndAddPlugins(context); + return Scaffold( + drawer: CustomDrawer(homeModel: model2), + key: MainScreenViewModel.scaffoldKey, + body: model2.appTourDialog(context), + ); + }, + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +class MockCallBack extends Mock { + void call(); +} + +class MockBuildContext extends Mock implements BuildContext {} + +MainScreenViewModel getModel() { + final model = MainScreenViewModel(); + model.context = MockBuildContext(); + return model; +} + +void verifyInteraction(dynamic x, {required String mockName}) { + // Ensures that navigation service was called + try { + verifyZeroInteractions(x); + //If 0 interactions passes that means mock was not called hence test fails + throw Exception("Expected interaction but found 0 with $mockName"); + } on TestFailure { + //If test fails then 1 or more interactions with navigation service hence test passes + expect(true, true); + } +} + +void main() async { + final pluginBox = Hive.box('pluginBox'); + + final List> samplePluginData = [ + { + "pluginName": "Plugin1", + "pluginInstallStatus": true, + }, + // Add more sample plugin data as needed + ]; + + // Store the sample data in the 'plugins' key of 'pluginBox' + pluginBox.put('plugins', samplePluginData); + + // No need to change + setUpAll(() { + locator.registerFactory(() => CustomDrawerViewModel()); + locator.registerFactory(() => MainScreenViewModel()); + locator.registerFactory(() => AppTheme()); + locator.registerSingleton(SizeConfig()); + locator.registerFactory(() => Queries()); + locator().test(); + }); + + tearDownAll(() { + locator.unregister(); + }); + + group("MainScreen ViewModel Tests - ", () { + test("When initialized current index should be 0", () { + final mainTestModel = getModel(); + expect(mainTestModel.currentPageIndex, 0); + }); + }); + + // May need to change + group("onTabTapped -", () { + test("When an index is passed that, current index should equal that index", + () { + final mainTestModel = getModel(); + mainTestModel.onTabTapped(4); + expect(mainTestModel.currentPageIndex, 4); + }); + + test("When called function should notify listeners of tab change", () { + final mockcallback = MockCallBack(); + final mainTestModel = getModel(); + mainTestModel.addListener(mockcallback); + + mainTestModel.onTabTapped(0); + verify(mockcallback()).called(1); + }); + }); + + group("initialize", () { + final context = MockBuildContext(); + SizeConfig().test(); + setUp(() => registerServices()); + tearDown(() => unregisterServices()); + + void runIntialize({ + required bool fSignUp, + int mainIndex = 1, + required MainScreenViewModel model, + BuildContext? pcontext, + }) { + model.initialise( + pcontext ?? context, + fromSignUp: fSignUp, + mainScreenIndex: mainIndex, + ); + } + + test( + "MainScreenViewModel showAppTour and currentIndex should equal values passed to fromSignUp and mainScreenIndex", + () { + const bool fSignup = true; + const int mainIndex = 1; + final mainTestModel = getModel(); + runIntialize( + fSignUp: fSignup, + mainIndex: mainIndex, + model: mainTestModel, + ); + + expect(mainTestModel.showAppTour, fSignup); + expect(mainTestModel.currentPageIndex, mainIndex); + }); + + test('Test for showHome method', () { + final model = getModel(); + + model.showHome( + TargetFocus( + identify: "keyDrawerLeaveCurrentOrg", + keyTarget: MainScreenViewModel.keyDrawerLeaveCurrentOrg, + ), + ); + }); + + test( + "When fromSignUp is false tourComplete should equal true, tourSkipped and showApptour false", + () { + final mainTestModel = getModel(); + runIntialize(fSignUp: false, model: mainTestModel); + expect(mainTestModel.tourComplete, true); + expect(mainTestModel.tourSkipped, false); + expect(mainTestModel.showAppTour, false); + }); + + test("When fromSignUp is false, App Tour dialog should not be displayed", + () async { + final mocknav = getAndRegisterNavigationService(); + final mainTestModel = getModel(); + + mainTestModel.initialise( + MockBuildContext(), + fromSignUp: false, + mainScreenIndex: 0, + ); + + // Ensures that navigation service was not called + verifyZeroInteractions(mocknav); + }); + + testWidgets('Test for apptour dialog skip action.', (tester) async { + await tester.pumpWidget(createAppTourDialog()); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect(find.byType(CustomAlertDialog), findsOneWidget); + + // await tester.pumpAndSettle(); + + final skipBtn = find.textContaining('Skip'); + + expect(skipBtn, findsOneWidget); + + await tester.tap(skipBtn); + await tester.pumpAndSettle( + const Duration(seconds: 1), + ); + }); + + testWidgets('Test for apptour dialog success action.', (tester) async { + await tester.pumpWidget(createAppTourDialog()); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + final mockUserConfig = getAndRegisterUserConfig(); + when(mockUserConfig.loggedIn).thenReturn(true); + + MainScreenViewModel.scaffoldKey.currentState?.openDrawer(); + + expect(find.byType(CustomAlertDialog), findsOneWidget); + + final startBtn = find.textContaining('Start').last; + + expect(startBtn, findsOneWidget); + + await tester.tap(startBtn); + + await tester.pumpAndSettle(const Duration(seconds: 2)); + }); + + testWidgets('Test for fetchAndAddPlugins when not in demoMode', + (tester) async { + final app = createAppTourDialog(demoMode: false); + + await tester.pumpWidget(app); + await tester.pumpAndSettle(const Duration(seconds: 1)); + }); + + group('Tests for tour', () { + late UserConfig model; + late List expectedTargets; + late Map keysMap; + final GlobalKey key = MainScreenViewModel.scaffoldKey; + setUp(() { + keysMap = {}; + expectedTargets = []; + model = getAndRegisterUserConfig(); + }); + testWidgets('Test for tourhomeTargets when userconfig.loggedin is true.', + (tester) async { + const val1 = true; + when(model.loggedIn).thenAnswer((_) => val1); + await tester.pumpWidget( + createMainScreenViewModelScreen((model2) { + model2.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: model2.keySHMenuIcon, + ), + ); + model2.tourComplete = true; + model2.tourHomeTargets(); + for (int i = 0; i < model2.targets.length; i++) { + expectedTargets.add(model2.targets[i]); + } + // ignore: avoid_dynamic_calls + model2.targets[1].next!(); + // ignore: avoid_dynamic_calls + model2.targets[5].next!(); + keysMap = { + 'keySHOrgName': model2.keySHOrgName, + 'keySHMenuIcon': model2.keySHMenuIcon, + 'keyDrawerCurOrg': MainScreenViewModel.keyDrawerCurOrg, + 'keyDrawerSwitchableOrg': + MainScreenViewModel.keyDrawerSwitchableOrg, + 'keyDrawerJoinOrg': MainScreenViewModel.keyDrawerJoinOrg, + 'keyDrawerLeaveCurrentOrg': + MainScreenViewModel.keyDrawerLeaveCurrentOrg, + 'keyBNHome': model2.keyBNHome, + 'keySHPinnedPost': model2.keySHPinnedPost, + 'keySHPost': model2.keySHPost, + }; + }), + ); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect(find.textContaining('tour home'), findsOneWidget); + + await tester.tap(find.textContaining('tour home')); + + await tester.pump(); + + expect(find.text('drawer123'), findsOneWidget); + + expect(expectedTargets.length, 9); + + final List keyNames = keysMap.keys.toList(); + + for (int i = 0; i < expectedTargets.length; i++) { + expect(expectedTargets[i].keyName, keyNames[i]); + expect(expectedTargets[i].key, keysMap[keyNames[i]]); + if (i != 1 && i != 4 && i != 5) { + expect(expectedTargets[i].next, null); + } else { + expect(expectedTargets[i].next, isNotNull); + } + } + }); + testWidgets('Whether AppTour is initialized or not', (tester) async { + const val1 = false; + when(model.loggedIn).thenAnswer((_) => val1); + late AppTour appTour; + + await tester.pumpWidget( + createMainScreenViewModelScreen((model2) { + model2.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: model2.keySHMenuIcon, + ), + ); + appTour = model2.appTour; + }), + ); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect(find.textContaining('tour home'), findsOneWidget); + + await tester.tap(find.textContaining('tour home')); + + await tester.pump(); + + expect(appTour, isNotNull); + }); + + testWidgets('Test for tourhomeTargets when userconfig.loggedin is false.', + (tester) async { + const val1 = false; + when(model.loggedIn).thenAnswer((_) => val1); + + await tester.pumpWidget( + createMainScreenViewModelScreen((model2) { + model2.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: model2.keySHMenuIcon, + ), + ); + model2.tourComplete = true; + model2.tourHomeTargets(model); + for (int i = 0; i < model2.targets.length; i++) { + expectedTargets.add(model2.targets[i]); + } + // ignore: avoid_dynamic_calls + model2.targets[4].next!(); + keysMap = { + 'keySHOrgName': model2.keySHOrgName, + 'keySHMenuIcon': model2.keySHMenuIcon, + 'keyDrawerCurOrg': MainScreenViewModel.keyDrawerCurOrg, + 'keyDrawerSwitchableOrg': + MainScreenViewModel.keyDrawerSwitchableOrg, + 'keyDrawerJoinOrg': MainScreenViewModel.keyDrawerJoinOrg, + 'keyBNHome': model2.keyBNHome, + 'keySHPinnedPost': model2.keySHPinnedPost, + 'keySHPost': model2.keySHPost, + }; + }), + ); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect(find.textContaining('tour home'), findsOneWidget); + + await tester.tap(find.textContaining('tour home')); + + await tester.pump(); + + expect(expectedTargets.length, 8); + + final List keyNames = keysMap.keys.toList(); + + for (int i = 0; i < expectedTargets.length; i++) { + expect(expectedTargets[i].keyName, keyNames[i]); + expect(expectedTargets[i].key, keysMap[keyNames[i]]); + if (i != 1 && i != 4) { + expect(expectedTargets[i].next, null); + } else { + expect(expectedTargets[i].next, isNotNull); + } + } + }); + testWidgets( + 'Test for tourhomeTargets whether correct function is called when tour is not exited.', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: MaterialApp( + home: Scaffold( + key: key, + body: Container(), + ), + ), + ), + ); + final BuildContext context = tester.element(find.byType(Container)); + final MainScreenViewModel modelForKeys = MainScreenViewModel(); + final MockLocalMainScreenViewModel model = + MockLocalMainScreenViewModel(); + model.context = context; + model.testMode = true; + model.appTour = MockAppTour(model: model); + model.currentPageIndex = 0; + model.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: modelForKeys.keySHMenuIcon, + ), + ); + model.tourHomeTargets(); + expect(model.stackLength, 2); + }); + + testWidgets('Test for tourEventTargets.', (tester) async { + const val1 = false; + when(model.loggedIn).thenAnswer((_) => val1); + + await tester.pumpWidget( + createMainScreenViewModelScreen((model2) { + model2.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: model2.keySHMenuIcon, + ), + ); + model2.tourComplete = true; + model2.tourEventTargets(); + for (int i = 0; i < model2.targets.length; i++) { + expectedTargets.add(model2.targets[i]); + } + keysMap = { + 'keyBNEvents': model2.keyBNEvents, + 'keySECategoryMenu': model2.keySECategoryMenu, + 'keySEDateFilter': model2.keySEDateFilter, + 'keySECard': model2.keySECard, + 'keySEAdd': model2.keySEAdd, + }; + }), + ); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect(find.textContaining('tour home'), findsOneWidget); + + await tester.tap(find.textContaining('tour home')); + + await tester.pump(); + + expect(expectedTargets.length, 5); + + final List keyNames = keysMap.keys.toList(); + + for (int i = 0; i < expectedTargets.length; i++) { + expect(expectedTargets[i].keyName, keyNames[i]); + expect(expectedTargets[i].key, keysMap[keyNames[i]]); + expect(expectedTargets[i].next, null); + } + }); + + testWidgets('Test for tourChats.', (tester) async { + const val1 = false; + when(model.loggedIn).thenAnswer((_) => val1); + + await tester.pumpWidget( + createMainScreenViewModelScreen((model2) { + model2.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: model2.keySHMenuIcon, + ), + ); + model2.tourComplete = true; + model2.tourChat(); + for (int i = 0; i < model2.targets.length; i++) { + expectedTargets.add(model2.targets[i]); + } + // ignore: avoid_dynamic_calls + keysMap = {'keyBNChat': model2.keyBNChat}; + }), + ); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect(find.textContaining('tour home'), findsOneWidget); + + await tester.tap(find.textContaining('tour home')); + + await tester.pump(); + + expect(expectedTargets.length, 1); + + final List keyNames = keysMap.keys.toList(); + + expect(expectedTargets[0].keyName, keyNames[0]); + expect(expectedTargets[0].key, keysMap[keyNames[0]]); + expect(expectedTargets[0].next, null); + }); + testWidgets( + 'Test for tourChat whether correct function is called when tour is not exited.', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: MaterialApp( + home: Scaffold( + key: key, + body: Container(), + ), + ), + ), + ); + final BuildContext context = tester.element(find.byType(Container)); + final MainScreenViewModel modelForKeys = MainScreenViewModel(); + final MockLocalMainScreenViewModel model = + MockLocalMainScreenViewModel(); + model.context = context; + model.testMode = true; + model.appTour = MockAppTour(model: model); + model.currentPageIndex = 0; + model.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: modelForKeys.keySHMenuIcon, + ), + ); + model.tourChat(); + expect(model.stackLength, 1); + }); + + testWidgets('Test for addPost.', (tester) async { + const val1 = false; + when(model.loggedIn).thenAnswer((_) => val1); + + await tester.pumpWidget( + createMainScreenViewModelScreen((model2) { + model2.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: model2.keySHMenuIcon, + ), + ); + model2.tourComplete = true; + model2.tourAddPost(); + for (int i = 0; i < model2.targets.length; i++) { + expectedTargets.add(model2.targets[i]); + } + // ignore: avoid_dynamic_calls + keysMap = {'keyBNPost': model2.keyBNPost}; + }), + ); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect(find.textContaining('tour home'), findsOneWidget); + + await tester.tap(find.textContaining('tour home')); + + await tester.pump(); + + expect(expectedTargets.length, 1); + + final List keyNames = keysMap.keys.toList(); + + expect(expectedTargets[0].keyName, keyNames[0]); + expect(expectedTargets[0].key, keysMap[keyNames[0]]); + expect(expectedTargets[0].next, null); + }); + testWidgets( + 'Test for tourAddPost whether correct function is called when tour is not exited.', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: MaterialApp( + home: Scaffold( + key: key, + body: Container(), + ), + ), + ), + ); + final BuildContext context = tester.element(find.byType(Container)); + final MainScreenViewModel modelForKeys = MainScreenViewModel(); + final MockLocalMainScreenViewModel model = + MockLocalMainScreenViewModel(); + model.context = context; + model.testMode = true; + model.appTour = MockAppTour(model: model); + model.currentPageIndex = 0; + model.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: modelForKeys.keySHMenuIcon, + ), + ); + model.tourAddPost(); + expect(model.stackLength, 1); + }); + + testWidgets('Test for profile tour.', (tester) async { + const val1 = false; + when(model.loggedIn).thenAnswer((_) => val1); + late MainScreenViewModel mainScreenViewModel; + + await tester.pumpWidget( + createMainScreenViewModelScreen((model2) { + model2.showHome( + TargetFocus( + identify: "keySHMenuIcon", + keyTarget: model2.keySHMenuIcon, + ), + ); + model2.tourProfile(); + for (int i = 0; i < model2.targets.length; i++) { + expectedTargets.add(model2.targets[i]); + } + keysMap = { + 'keyBNProfile': model2.keyBNProfile, + 'keySPAppSetting': model2.keySPAppSetting, + 'keySPHelp': model2.keySPHelp, + 'keySPDonateUs': model2.keySPDonateUs, + 'keySPPalisadoes': model2.keySPPalisadoes, + }; + mainScreenViewModel = model2; + }), + ); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect(find.textContaining('tour home'), findsOneWidget); + + await tester.tap(find.textContaining('tour home')); + + await tester.pump(); + + expect(expectedTargets.length, 5); + + final List keyNames = keysMap.keys.toList(); + + for (int i = 0; i < expectedTargets.length; i++) { + expect(expectedTargets[i].keyName, keyNames[i]); + expect(expectedTargets[i].key, keysMap[keyNames[i]]); + expect(expectedTargets[i].next, null); + } + expect(mainScreenViewModel.currentPageIndex, 0); + expect(mainScreenViewModel.tourComplete, true); + }); + }); + }); +} diff --git a/test/view_model_tests/pre_auth_view_models/login_view_model_test.dart b/test/view_model_tests/pre_auth_view_models/login_view_model_test.dart new file mode 100644 index 000000000..b30109279 --- /dev/null +++ b/test/view_model_tests/pre_auth_view_models/login_view_model_test.dart @@ -0,0 +1,178 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +// import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +// import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/routing_constants.dart'; +// import 'package:talawa/locator.dart'; +// import 'package:talawa/constants/routing_constants.dart'; +// import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/pre_auth_view_models/login_view_model.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; +// import 'package:talawa/utils/queries.dart'; +// import 'package:talawa/view_model/pre_auth_view_models/login_view_model.dart'; + +// import '../../helpers/test_helpers.dart'; + +final data = { + 'login': { + 'user': { + '_id': 'xzy1', + 'firstName': 'Test', + 'lastName': 'User', + 'email': 'testuser@gmail.com', + }, + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, +}; + +bool empty = false; + +Future main() async { + // setupFirebaseMocks(); + // await Firebase.initializeApp(); + // FirebaseMessagingPlatform.instance = kMockMessagingPlatform; + + testSetupLocator(); + registerServices(); + + group('LoginViewModel Test -', () { + testWidgets( + 'Check if login() is working fine when organisation is not empty', + (tester) async { + getAndRegisterUserConfig(); + + final model = LoginViewModel(); + + await tester.pumpWidget( + Form( + key: model.formKey, + child: Container(), + ), + ); + + final result = QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.loginUser('', ''))), + ); + + when(databaseFunctions.gqlNonAuthMutation(queries.loginUser('', ''))) + .thenAnswer((_) async => result); + + await model.login(); + expect(model.validate, AutovalidateMode.disabled); + verify(databaseFunctions.gqlNonAuthMutation(queries.loginUser('', ''))); + }); + testWidgets('Check if login() is working fine when organisation empty', + (tester) async { + empty = true; + getAndRegisterUserConfig(); + + final model = LoginViewModel(); + + await tester.pumpWidget( + Form( + key: model.formKey, + child: Container(), + ), + ); + + final result = QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.loginUser('', ''))), + ); + + when(databaseFunctions.gqlNonAuthMutation(queries.loginUser('', ''))) + .thenAnswer((_) async => result); + + await model.login(); + expect(model.validate, AutovalidateMode.disabled); + verify(databaseFunctions.gqlNonAuthMutation(queries.loginUser('', ''))); + }); + testWidgets('Check if login() is working fine when invalid credentials', + (tester) async { + reset(navigationService); + final model = LoginViewModel(); + + await tester.pumpWidget( + Form( + key: model.formKey, + child: Container(), + ), + ); + + when(databaseFunctions.gqlNonAuthMutation(queries.loginUser('', ''))) + .thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: null, + source: QueryResultSource.network, + ), + ); + + await model.login(); + expect(model.validate, AutovalidateMode.disabled); + verify(databaseFunctions.gqlNonAuthMutation(queries.loginUser('', ''))); + verifyNever( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + }); + testWidgets('Check if login() is working fine when throws error', + (tester) async { + final model = LoginViewModel(); + + await tester.pumpWidget( + Form( + key: model.formKey, + child: Container(), + ), + ); + + when(databaseFunctions.gqlNonAuthMutation(queries.loginUser('', ''))) + .thenThrow(Exception()); + + await model.login(); + expect(model.validate, AutovalidateMode.disabled); + verify(databaseFunctions.gqlNonAuthMutation(queries.loginUser('', ''))); + }); + }); +} + +class MockUserConfig extends Mock implements UserConfig { + @override + User get currentUser => User( + joinedOrganizations: empty + ? [] + : [ + OrgInfo( + id: '3', + name: 'test org 3', + userRegistrationRequired: false, + creatorInfo: User(firstName: 'test', lastName: '1'), + ), + ], + ); + + @override + Future updateUser(User user) async => true; +} 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 new file mode 100644 index 000000000..37328de39 --- /dev/null +++ b/test/view_model_tests/pre_auth_view_models/select_organization_view_model_test.dart @@ -0,0 +1,812 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/queries.dart'; + +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; + +import '../../helpers/test_helpers.dart'; + +class SelectOrganizationViewModelWidget extends StatelessWidget { + const SelectOrganizationViewModelWidget({ + required this.qrKey, + this.child, + this.focusNode, + this.autoFocus, + super.key, + }); + final GlobalKey qrKey; + final FocusNode? focusNode; + final bool? autoFocus; + final Widget? child; + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + body: Container( + key: qrKey, + child: child ?? + TextField( + autofocus: autoFocus ?? false, + focusNode: focusNode, + ), + ), + ), + navigatorKey: navigationService.navigatorKey, + ); + } +} + +User _user = User( + joinedOrganizations: [], +); +bool _userLoggedIn = true; +const initialiseString = "Org Id"; +late OrgInfo org; + +class _MockUserConfig extends Mock implements UserConfig { + @override + Future updateUserMemberRequestOrg(List? orgDetails) async => + Future.value(1); + + @override + User get currentUser => _user; + + @override + bool get loggedIn => true; + + @override + Future userLoggedIn() async => _userLoggedIn; + + @override + Future updateUserJoinedOrg(List orgDetails) async => 1; + + @override + int saveCurrentOrgInHive(OrgInfo saveOrgAsCurrent) => 1; +} + +void main() { + SizeConfig().test(); + setUp(() async { + org = OrgInfo( + id: '3', + name: 'test org 3', + userRegistrationRequired: false, + creatorInfo: User(firstName: 'test', lastName: '1'), + ); + locator.registerSingleton(Queries()); + registerServices(); + locator.unregister(); + }); + + tearDown(() async { + await locator.unregister(); + unregisterServices(); + }); + + group('Test for select organization view model - ', () { + testWidgets('Test for search Active function when focusNode has focus', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + focusNode: selectOrganizationViewModel.searchFocus, + autoFocus: true, + ), + ); + selectOrganizationViewModel.searchFocus.requestFocus(); + expect(selectOrganizationViewModel.searchFocus.hasFocus, true); + selectOrganizationViewModel.searchActive(); + + expect(selectOrganizationViewModel.organizations, []); + expect(selectOrganizationViewModel.searching, true); + expect(selectOrganizationViewModel.isBusy, false); + }); + + testWidgets( + 'Test for search Active function when focusNode does not have focus', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + focusNode: selectOrganizationViewModel.searchFocus, + ), + ); + expect(selectOrganizationViewModel.searchFocus.hasFocus, false); + selectOrganizationViewModel.searchActive(); + + expect(selectOrganizationViewModel.organizations, []); + expect(selectOrganizationViewModel.searching, false); + expect(selectOrganizationViewModel.isBusy, false); + }); + testWidgets('Test for successful initialise function', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + _user = User(refreshToken: ''); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + when(databaseFunctions.fetchOrgById(initialiseString)) + .thenAnswer((realInvocation) async => org); + + await selectOrganizationViewModel.initialise(initialiseString); + verify( + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: org, + ), + ); + + expect(selectOrganizationViewModel.isBusy, false); + }); + testWidgets('Test for initialise function when initialise data contains -1', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await selectOrganizationViewModel.initialise('-1 $initialiseString'); + verifyNever( + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: org, + ), + ); + + expect(selectOrganizationViewModel.isBusy, false); + }); + testWidgets( + 'Test for initialise function when fetch.runtimeType is != OrgInfo', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + when(databaseFunctions.fetchOrgById(initialiseString)) + .thenAnswer((realInvocation) async => 'hey'); + + await selectOrganizationViewModel.initialise(initialiseString); + + verifyNever( + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: org, + ), + ); + + expect(selectOrganizationViewModel.isBusy, false); + }); + testWidgets('Test for initialise function when refreshToken is not empty', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + _userLoggedIn = false; + _user = User( + refreshToken: '', + joinedOrganizations: [ + OrgInfo( + id: '1', + ), + ], + membershipRequests: [ + OrgInfo( + id: '1', + ), + ], + ); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + print(initialiseString); + + when(databaseFunctions.fetchOrgById(initialiseString)) + .thenAnswer((realInvocation) async { + return org; + }); + + await selectOrganizationViewModel.initialise(initialiseString); + + verify( + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: org, + ), + ); + + expect(selectOrganizationViewModel.isBusy, false); + }); + testWidgets('Test for successful selectOrg function', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + selectOrganizationViewModel.selectedOrganization = org; + + when(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))) + .thenAnswer((realInvocation) async { + final data = { + 'joinPublicOrganization': { + 'joinedOrganizations': [], + }, + }; + + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.joinOrgById(org.id!))), + ); + }); + + _userLoggedIn = true; + _user = User( + joinedOrganizations: [ + OrgInfo( + id: '1', + ), + ], + membershipRequests: [ + OrgInfo( + id: '1', + ), + ], + ); + + await selectOrganizationViewModel.selectOrg(org); + + expect(selectOrganizationViewModel.selectedOrganization, org); + }); + testWidgets( + 'Test for successful selectOrg function when org requires userRegistration', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + org.userRegistrationRequired = true; + selectOrganizationViewModel.selectedOrganization = org; + + when(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))) + .thenAnswer((realInvocation) async { + final data = { + 'joinPublicOrganization': { + 'joinedOrganizations': [], + }, + }; + + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.joinOrgById(org.id!))), + ); + }); + + _userLoggedIn = true; + _user = User( + joinedOrganizations: [ + OrgInfo( + id: '1', + ), + ], + membershipRequests: [ + OrgInfo( + id: '1', + ), + ], + ); + + await selectOrganizationViewModel.selectOrg(org); + + expect(selectOrganizationViewModel.selectedOrganization, org); + }); + + testWidgets('Test for selectOrg function when userLoggedIn is false', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + print(locator().currentUser.joinedOrganizations); + + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + _userLoggedIn = false; + _user = User( + refreshToken: 'testtoken', + joinedOrganizations: [ + OrgInfo( + id: '1', + ), + ], + membershipRequests: [ + OrgInfo( + id: '1', + ), + ], + ); + + await selectOrganizationViewModel.selectOrg(org); + + expect(selectOrganizationViewModel.selectedOrganization, org); + }); + testWidgets( + 'Test for selectOrg function when orgAlreadyJoined is true and orgRequestAlreadyPresent is false', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + _user = User( + joinedOrganizations: [org], + membershipRequests: [ + OrgInfo( + id: '1', + ), + ], + ); + _userLoggedIn = true; + + await selectOrganizationViewModel.selectOrg(org); + + final orgTest = selectOrganizationViewModel.selectedOrganization; + expect(orgTest.id, '-1'); + verify( + navigationService.showTalawaErrorSnackBar( + 'Organisation already joined', + MessageType.warning, + ), + ); + }); + testWidgets( + 'Test for selectOrg function when orgAlreadyJoined is false and orgRequestAlreadyPresent is true', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + _userLoggedIn = true; + _user = User( + joinedOrganizations: [ + OrgInfo( + id: '1', + ), + ], + membershipRequests: [org], + ); + + await selectOrganizationViewModel.selectOrg(org); + + final orgTest = selectOrganizationViewModel.selectedOrganization; + expect(orgTest.id, '-1'); + verify( + navigationService.showTalawaErrorSnackBar( + 'Membership request already sent', + MessageType.warning, + ), + ); + }); + testWidgets('Test for successful onTapContinue function', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + selectOrganizationViewModel.selectedOrganization = org; + + selectOrganizationViewModel.onTapContinue(); + + verify( + navigationService.pushScreen( + Routes.signupDetailScreen, + arguments: org, + ), + ); + }); + testWidgets( + 'Test for successful onTapContinue function when selected organization id is -1', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + selectOrganizationViewModel.selectedOrganization = OrgInfo(id: '-1'); + + selectOrganizationViewModel.onTapContinue(); + + verify( + navigationService.showTalawaErrorSnackBar( + 'Select one organization to continue', + MessageType.warning, + ), + ); + }); + testWidgets('Test for successful onTapJoin function', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + selectOrganizationViewModel.selectedOrganization = org; + + when(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))) + .thenAnswer((realInvocation) async { + final data = { + 'joinPublicOrganization': { + 'joinedOrganizations': [], + }, + }; + + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.joinOrgById(org.id!))), + ); + }); + + _user = User( + joinedOrganizations: [org], + ); + + await selectOrganizationViewModel.onTapJoin(); + + verify(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))); + verify( + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: isA().having( + (main) => main.mainScreenIndex, + "main screen index", + 0, + ), + ), + ); + }); + + testWidgets( + 'Test for onTapJoin function when joined organization length is not 1', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + selectOrganizationViewModel.selectedOrganization = org; + + when(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))) + .thenAnswer((realInvocation) async { + final data = { + 'joinPublicOrganization': { + 'joinedOrganizations': [], + }, + }; + + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(queries.joinOrgById(org.id!))), + ); + }); + _user = User( + joinedOrganizations: [], + ); + + await selectOrganizationViewModel.onTapJoin(); + + verify(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))); + verify(navigationService.pop()); + verify( + navigationService.showTalawaErrorSnackBar( + 'Joined ${org.name} successfully', + MessageType.info, + ), + ); + }); + + /// we no longer have the tap button to join a org + // testWidgets('Test for successful onTapJoin function when userRegistrationRequired is false', + // (WidgetTester tester) async { + // locator.registerSingleton(_MockUserConfig()); + // final selectOrganizationViewModel = SelectOrganizationViewModel(); + // + // await tester.pumpWidget( + // SelectOrganizationViewModelWidget( + // qrKey: selectOrganizationViewModel.qrKey, + // ), + // ); + // + // org.userRegistrationRequired = false; + // selectOrganizationViewModel.selectedOrganization = org; + // _user = User(joinedOrganizations: []); + // + // when( + // databaseFunctions + // .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + // ).thenAnswer((realInvocation) async { + // final data = { + // 'sendMembershipRequest': { + // 'organization': {}, + // }, + // }; + // + // return QueryResult( + // source: QueryResultSource.network, + // data: data, + // options: QueryOptions(document: gql(queries.joinOrgById(org.id!))), + // ); + // }); + // + // await selectOrganizationViewModel.selectOrg(org); + // + // verify( + // databaseFunctions + // .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + // ); + // verify( + // navigationService.removeAllAndPush( + // Routes.waitingScreen, + // Routes.splashScreen, + // ), + // ); + // }); + // testWidgets( + // 'Test for successful onTapJoin function when userRegistrationRequired is false and joined orgnazation is not empty', + // (WidgetTester tester) async { + // locator.registerSingleton(_MockUserConfig()); + // final selectOrganizationViewModel = SelectOrganizationViewModel(); + // + // await tester.pumpWidget( + // SelectOrganizationViewModelWidget( + // qrKey: selectOrganizationViewModel.qrKey, + // ), + // ); + // + // org.userRegistrationRequired = false; + // selectOrganizationViewModel.selectedOrganization = org; + // _user = User(joinedOrganizations: [org]); + // + // when( + // databaseFunctions + // .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + // ).thenAnswer((realInvocation) async { + // final data = { + // 'sendMembershipRequest': { + // 'organization': {}, + // }, + // }; + // + // return QueryResult( + // source: QueryResultSource.network, + // data: data, + // options: QueryOptions(document: gql(queries.joinOrgById(org.id!))), + // ); + // }); + // + // await selectOrganizationViewModel.onTapJoin(); + // + // verify( + // databaseFunctions + // .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + // ); + // verify(navigationService.pop()); + // verify( + // navigationService.showTalawaErrorSnackBar( + // 'Join in request sent to ${org.name} successfully', + // MessageType.info, + // ), + // ); + // }); + // testWidgets( + // 'Test for successful onTapJoin function when userRegistrationRequired is false and result is null', + // (WidgetTester tester) async { + // locator.registerSingleton(_MockUserConfig()); + // final selectOrganizationViewModel = SelectOrganizationViewModel(); + // + // await tester.pumpWidget( + // SelectOrganizationViewModelWidget( + // qrKey: selectOrganizationViewModel.qrKey, + // ), + // ); + // + // org.userRegistrationRequired = false; + // selectOrganizationViewModel.selectedOrganization = org; + // + // when( + // databaseFunctions + // .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + // ).thenAnswer((realInvocation) async { + // return null; + // }); + // + // await selectOrganizationViewModel.onTapJoin(); + // + // verify( + // databaseFunctions + // .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + // ); + // verifyNever(navigationService.pop()); + // verifyNever( + // navigationService.showTalawaErrorSnackBar( + // 'Join in request sent to ${org.name} successfully', + // MessageType.info, + // ), + // ); + // verifyNever( + // navigationService.removeAllAndPush( + // Routes.waitingScreen, + // Routes.splashScreen, + // ), + // ); + // }); + testWidgets( + 'Test for successful onTapJoin function when userRegistrationRequired is false and throws exception', + (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + selectOrganizationViewModel.selectedOrganization = org; + + when(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))) + .thenThrow(Exception()); + + await selectOrganizationViewModel.onTapJoin(); + + verify( + navigationService.showTalawaErrorSnackBar( + 'Something went wrong', + MessageType.error, + ), + ); + verify(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))); + }); + // testWidgets( + // 'Test for successful onTapJoin function when userRegistrationRequired is false and throws exception', + // (WidgetTester tester) async { + // locator.registerSingleton(_MockUserConfig()); + // final selectOrganizationViewModel = SelectOrganizationViewModel(); + // + // await tester.pumpWidget( + // SelectOrganizationViewModelWidget( + // qrKey: selectOrganizationViewModel.qrKey, + // ), + // ); + // org.userRegistrationRequired = false; + // + // selectOrganizationViewModel.selectedOrganization = org; + // + // when( + // databaseFunctions + // .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + // ).thenThrow(Exception()); + // + // await selectOrganizationViewModel.onTapJoin(); + // + // verify( + // navigationService.showTalawaErrorSnackBar( + // 'SomeThing went wrong', + // MessageType.error, + // ), + // ); + // }); + testWidgets('Test for organization list', (WidgetTester tester) async { + locator.registerSingleton(_MockUserConfig()); + final selectOrganizationViewModel = SelectOrganizationViewModel(); + + await tester.pumpWidget( + SelectOrganizationViewModelWidget( + qrKey: selectOrganizationViewModel.qrKey, + ), + ); + + Map? expected; + + selectOrganizationViewModel.fetchMoreHelper( + (FetchMoreOptions options) async { + expected = options.updateQuery( + { + "organizationsConnection": [ + {"one": 1}, + {"two": 2}, + ], + }, + { + "organizationsConnection": [ + {"three": 3}, + {"four": 4}, + ], + }, + ); + return Future.value( + QueryResult( + source: QueryResultSource.network, + options: QueryOptions(document: gql(queries.fetchJoinInOrg)), + ), + ); + }, + [], + ); + + expect(expected, { + 'organizationsConnection': [ + {"one": 1}, + {"two": 2}, + {"three": 3}, + {"four": 4}, + ], + }); + }); + }); +} diff --git a/test/view_model_tests/pre_auth_view_models/set_url_view_model_test.dart b/test/view_model_tests/pre_auth_view_models/set_url_view_model_test.dart new file mode 100644 index 000000000..c7640a9fe --- /dev/null +++ b/test/view_model_tests/pre_auth_view_models/set_url_view_model_test.dart @@ -0,0 +1,358 @@ +// ignore_for_file: talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:mockito/mockito.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/router.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/services/user_action_handler.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/validators.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/pre_auth_view_models/set_url_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_helpers.mocks.dart'; + +/// This is a TestWidget class. +class TestWidget extends StatelessWidget { + const TestWidget(this.model, {super.key}); + + /// State. + final SetUrlViewModel model; + @override + Widget build(BuildContext context) { + return Scaffold( + body: FloatingActionButton( + onPressed: () => model.scanQR(context), + ), + ); + } +} + +/// This is a class for mock url for testing. +class SetUrlMock extends StatelessWidget { + const SetUrlMock({required this.formKey, super.key}); + + /// formKey. + final GlobalKey formKey; + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Form( + key: formKey, + child: Container(), + ), + navigatorKey: navigationService.navigatorKey, + ); + } +} + +/// This is a class for mock url for testing. +/// +/// **params**: +/// * `themeMode`: dark +/// +/// **returns**: +/// * `Widget`: widget + +Widget forTest({ThemeMode themeMode = ThemeMode.dark}) => BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + final model1 = SetUrlViewModel(); + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: TalawaTheme.darkTheme, + home: FloatingActionButton( + onPressed: () async { + model1.initialise(); + }, + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: generateRoute, + ); + }, + ); + +Future main() async { + SizeConfig().test(); + + late SetUrlViewModel model; + + locator.registerSingleton(ActionHandlerService()); + + setUp(() async { + registerServices(); + registerViewModels(); + model = SetUrlViewModel(); + }); + tearDown(() async { + unregisterViewModels(); + }); + + group('SetUrlViewModel Test -', () { + testWidgets( + 'Check if checkURLandNavigate() is working fine when urlPresent is true', + (tester) async { + locator.registerSingleton(Validator()); + + await tester.pumpWidget(Form(key: model.formKey, child: Container())); + + await model.checkURLandNavigate('/', 'arguments'); + + final captured = verify( + (navigationService as MockNavigationService).pushDialog(captureAny), + ).captured; + expect( + captured[0], + isA().having( + (e) => e.key, + 'key', + const Key('UrlCheckProgress'), + ), + ); + verify(navigationService.pop()); + verify(navigationService.pushScreen('/', arguments: 'arguments')); + verify(graphqlConfig.getOrgUrl()); + + final box = Hive.box('url'); + expect(box.get(SetUrlViewModel.urlKey), ''); + expect(box.get(SetUrlViewModel.imageUrlKey), '/talawa/'); + }); + testWidgets('Check if initialize is working fine ', (tester) async { + final model = SetUrlViewModel(); + + await tester.pumpWidget(SetUrlMock(formKey: model.formKey)); + + model.initialise(); + }); + testWidgets('Check if initialize is working fine when we give url', + (tester) async { + final model = SetUrlViewModel(); + + await tester.pumpWidget(SetUrlMock(formKey: model.formKey)); + + model.initialise(inviteUrl: "http://www.youtube.com"); + }); + + testWidgets( + 'Check if checkURLandNavigate() is working fine when urlPresent is false', + (tester) async { + await locator.unregister(); + final service = MockValidator(); + + locator.registerSingleton(service); + + await tester.pumpWidget(Form(key: model.formKey, child: Container())); + + when(service.validateUrlExistence('')).thenAnswer((_) async => false); + + await model.checkURLandNavigate('/', 'arguments'); + + verify( + navigationService.showTalawaErrorSnackBar( + "URL doesn't exist/no connection please check", + MessageType.error, + ), + ); + + locator.unregister(); + }); + + testWidgets( + 'Check if checkURLandShowPopUp() is working fine when urlPresent is true', + (tester) async { + locator.registerSingleton(Validator()); + + await tester.pumpWidget(Form(key: model.formKey, child: Container())); + + await model.checkURLandShowPopUp('arguments'); + + final captured = verify( + (navigationService as MockNavigationService).pushDialog(captureAny), + ).captured; + expect( + captured[0], + isA().having( + (e) => e.key, + 'key', + const Key('UrlCheckProgress'), + ), + ); + verify(navigationService.pop()); + verify(graphqlConfig.getOrgUrl()); + verify(navigationService.showSnackBar("Url is valid")); + + final box = Hive.box('url'); + expect(box.get(SetUrlViewModel.urlKey), ''); + expect(box.get(SetUrlViewModel.imageUrlKey), '/talawa/'); + }); + + testWidgets( + 'Check if checkURLandShowPopUp() is working fine when urlPresent is false', + (tester) async { + //await locator.unregister(); + final service = MockValidator(); + //locator.registerSingleton(service); + + await tester.pumpWidget(Form(key: model.formKey, child: Container())); + + when(service.validateUrlExistence('')).thenAnswer((_) async => false); + + await model.checkURLandShowPopUp('arguments'); + + verify(navigationService.pop()); + verifyNever( + navigationService.showTalawaErrorSnackBar( + "URL doesn't exist/no connection please check", + MessageType.info, + ), + ); + }); + + testWidgets('Check if scanQR() is working fine', (tester) async { + await tester.pumpWidget(MaterialApp(home: TestWidget(model))); + + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + + expect(find.byType(ClipRRect), findsOneWidget); + expect(find.byType(QRView), findsOneWidget); + }); + + testWidgets('Check if _onQRViewCreated() is working fine', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: TestWidget(model), + navigatorKey: navigationService.navigatorKey, + ), + ); + + final controller = MockQRViewController(); + when(controller.scannedDataStream).thenAnswer((_) async* { + yield Barcode('qr?orgId=1&scan', BarcodeFormat.qrcode, null); + }); + + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + + (tester.widget(find.byType(QRView)) as QRView) + .onQRViewCreated(controller); + }); + + testWidgets( + 'Check if _onQRViewCreated() is working fine when throws CameraException', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: TestWidget(model), + navigatorKey: navigationService.navigatorKey, + ), + ); + + final controller = MockQRViewController(); + when(controller.scannedDataStream).thenAnswer((_) async* { + yield Barcode('qr?orgId=1&scan', BarcodeFormat.qrcode, null); + }); + // when(controller.stopCamera()) + // .thenThrow(Exception({"errorType": "error"})); + + when(controller.stopCamera()) + .thenThrow(CameraException("200", "cameraException")); + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + + (tester.widget(find.byType(QRView)) as QRView) + .onQRViewCreated(controller); + }); + testWidgets( + 'Check if _onQRViewCreated() is working fine when throws QrEmbeddedImageException', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: TestWidget(model), + navigatorKey: navigationService.navigatorKey, + ), + ); + + final controller = MockQRViewController(); + when(controller.scannedDataStream).thenAnswer((_) async* { + yield Barcode('qr?orgId=1&scan', BarcodeFormat.qrcode, null); + }); + // when(controller.stopCamera()) + // .thenThrow(Exception({"errorType": "error"})); + + when(controller.stopCamera()) + .thenThrow(QrEmbeddedImageException("error")); + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + + (tester.widget(find.byType(QRView)) as QRView) + .onQRViewCreated(controller); + }); + testWidgets( + 'Check if _onQRViewCreated() is working fine when throws QrUnsupportedVersionException', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: TestWidget(model), + navigatorKey: navigationService.navigatorKey, + ), + ); + + final controller = MockQRViewController(); + when(controller.scannedDataStream).thenAnswer((_) async* { + yield Barcode('qr?orgId=1&scan', BarcodeFormat.qrcode, null); + }); + // when(controller.stopCamera()) + // .thenThrow(Exception({"errorType": "error"})); + + when(controller.stopCamera()).thenThrow(QrUnsupportedVersionException(0)); + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + + (tester.widget(find.byType(QRView)) as QRView) + .onQRViewCreated(controller); + }); + testWidgets( + 'Check if _onQRViewCreated() is working fine when throws Exception', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: TestWidget(model), + navigatorKey: navigationService.navigatorKey, + ), + ); + + final controller = MockQRViewController(); + when(controller.scannedDataStream).thenAnswer((_) async* { + yield Barcode('qr?orgId=1&scan', BarcodeFormat.qrcode, null); + }); + // when(controller.stopCamera()) + // .thenThrow(Exception({"errorType": "error"})); + + when(controller.stopCamera()).thenThrow(Exception(0)); + await tester.tap(find.byType(FloatingActionButton)); + await tester.pump(); + + (tester.widget(find.byType(QRView)) as QRView) + .onQRViewCreated(controller); + }); + }); +} diff --git a/test/view_model_tests/pre_auth_view_models/signup_details_view_model_test.dart b/test/view_model_tests/pre_auth_view_models/signup_details_view_model_test.dart new file mode 100644 index 000000000..e11fa88fe --- /dev/null +++ b/test/view_model_tests/pre_auth_view_models/signup_details_view_model_test.dart @@ -0,0 +1,577 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/user_config.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/utils/queries.dart'; +import 'package:talawa/view_model/pre_auth_view_models/signup_details_view_model.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +bool empty = true; +bool userSaved = true; +bool userRegistrationRequired = false; +final data = { + 'signUp': { + 'user': { + '_id': 'xzy1', + 'firstName': 'Test', + 'lastName': 'User', + 'email': 'testuser@gmail.com', + }, + 'accessToken': 'testtoken', + 'refreshToken': 'testtoken', + }, +}; + +class SignUpMock extends StatelessWidget { + const SignUpMock({required this.formKey, super.key}); + + final GlobalKey formKey; + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Form( + key: formKey, + child: Container(), + ), + navigatorKey: navigationService.navigatorKey, + ); + } +} + +OrgInfo get org => OrgInfo( + id: 'id', + name: 'test org 3', + userRegistrationRequired: userRegistrationRequired, + creatorInfo: User(firstName: 'test', lastName: '1'), + ); + +void main() { + testSetupLocator(); + setUp(() async { + registerServices(); + locator(); + userSaved = true; + empty = true; + userRegistrationRequired = false; + await locator.unregister(); + locator.registerSingleton(MockUserConfig()); + }); + // tearDown(() async { + // await locator.unregister(); + // }); + + group('SignupDetailsViewModel Test -', () { + testWidgets( + 'Check if signup() is working fine when selected organization is not empty and public', + (tester) async { + final model = SignupDetailsViewModel(); + + await tester.pumpWidget(SignUpMock(formKey: model.formKey)); + + model.initialise(org); + + final result = QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions( + document: gql(queries.registerUser('', '', '', '', '')), + ), + ); + when(graphqlConfig.getToken()).thenAnswer((_) async => true); + when( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ).thenAnswer((_) async => result); + final query = queries.joinOrgById(org.id!); + when(databaseFunctions.gqlAuthMutation(query)) + .thenAnswer((realInvocation) async { + final data = { + 'joinPublicOrganization': { + 'joinedOrganizations': [], + }, + }; + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions(document: gql(query)), + ); + }); + empty = false; + + await model.signUp(); + + expect(model.validate, AutovalidateMode.disabled); + + verify(databaseFunctions.gqlAuthMutation(query)); + verify( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ); + verify( + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: isA() + .having( + (mainScreenArgs) => mainScreenArgs.mainScreenIndex, + "main screen index", + 0, + ) + .having( + (mainScreenArgs) => mainScreenArgs.fromSignUp, + "from sign up", + true, + ), + ), + ); + }); + testWidgets( + 'Check if signup() is working fine when credentials are invalid', + (tester) async { + final model = SignupDetailsViewModel(); + model.selectedOrganization = OrgInfo(id: ""); + await tester.pumpWidget(SignUpMock(formKey: model.formKey)); + + // print(model.firstName.text = '1'); + // print(model.lastName.text = '1'); + // print(model.email.text = '1'); + // print(model.password.text = '1'); + // print(model.selectedOrganization.id = '1'); + + when( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser("", "", "", "", ""), + ), + ).thenAnswer( + (_) async => QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: null, + source: QueryResultSource.network, + ), + ); + + await model.signUp(); + + verifyNever( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: isA() + .having( + (mainScreenArgs) => mainScreenArgs.mainScreenIndex, + "main screen index", + 0, + ) + .having( + (mainScreenArgs) => mainScreenArgs.fromSignUp, + "from sign up", + true, + ), + ), + ); + }); + testWidgets( + 'Check if signup() is working fine when user is not save and/or token not refreshed', + (tester) async { + userSaved = false; + + final model = SignupDetailsViewModel(); + + await tester.pumpWidget(SignUpMock(formKey: model.formKey)); + + model.initialise(org); + + final result = QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions( + document: gql(queries.registerUser('', '', '', '', org.id)), + ), + ); + when(graphqlConfig.getToken()).thenAnswer((_) async => false); + final query = queries.registerUser( + '', + '', + '', + '', + org.id, + ); + when( + databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest(org.id!), + ), + ).thenAnswer((realInvocation) async { + final sendMemberReqData = { + "sendMembershipRequest": { + "organization": { + "id": "org123", + "name": "Tech Innovators", + "userRegistrationRequired": true, + }, + }, + }; + return QueryResult( + source: QueryResultSource.network, + data: sendMemberReqData, + options: QueryOptions(document: gql(query)), + ); + }); + when(databaseFunctions.gqlNonAuthMutation(query)) + .thenAnswer((_) async => result); + + // Test for user not saved and user token not refreshed + await model.signUp(); + verifyNever( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + + // Test for user saved and user token not refreshed + userSaved = true; + await model.signUp(); + verifyNever( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: isA() + .having( + (mainScreenArgs) => mainScreenArgs.mainScreenIndex, + "main screen index", + 0, + ) + .having( + (mainScreenArgs) => mainScreenArgs.fromSignUp, + "from sign up", + true, + ), + ), + ); + + // Test for user not saved and user token refreshed + userSaved = false; + when(graphqlConfig.getToken()).thenAnswer((_) async => true); + await model.signUp(); + verifyNever( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: isA() + .having( + (mainScreenArgs) => mainScreenArgs.mainScreenIndex, + "main screen index", + 0, + ) + .having( + (mainScreenArgs) => mainScreenArgs.fromSignUp, + "from sign up", + true, + ), + ), + ); + }); + testWidgets( + 'Check if signup() is working fine when selected organization requires userRegistration', + (tester) async { + userRegistrationRequired = true; + // locator.registerSingleton(MockUserConfig()); + + final model = SignupDetailsViewModel(); + + await tester.pumpWidget(SignUpMock(formKey: model.formKey)); + + model.initialise(org); + + final result = QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions( + document: gql(queries.registerUser('', '', '', '', org.id)), + ), + ); + when(graphqlConfig.getToken()).thenAnswer((_) async => true); + when( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ).thenAnswer((_) async => result); + when( + databaseFunctions + .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + ).thenAnswer((realInvocation) async { + final data = { + 'sendMembershipRequest': { + 'organization': {}, + }, + }; + return QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions( + document: gql(queries.sendMembershipRequest(org.id!)), + ), + ); + }); + empty = false; + + await model.signUp(); + + expect(model.validate, AutovalidateMode.disabled); + + verify( + databaseFunctions + .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + ); + verify( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ); + verify( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + }); + testWidgets( + 'Check if signup() works fine when process of register user throws exception', + (tester) async { + // locator.registerSingleton(MockUserConfig()); + + final model = SignupDetailsViewModel(); + + await tester.pumpWidget(SignUpMock(formKey: model.formKey)); + + model.initialise(org); + + when(graphqlConfig.getToken()).thenAnswer((_) async => true); + when( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ).thenThrow(Exception()); + + await model.signUp(); + + expect(model.validate, AutovalidateMode.disabled); + + verify( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: isA() + .having( + (mainScreenArgs) => mainScreenArgs.mainScreenIndex, + "main screen index", + 0, + ) + .having( + (mainScreenArgs) => mainScreenArgs.fromSignUp, + "from sign up", + true, + ), + ), + ); + }); + testWidgets( + 'Check if signup() works fine when process of user joining org throws exception', + (tester) async { + // locator.registerSingleton(MockUserConfig()); + + final model = SignupDetailsViewModel(); + + await tester.pumpWidget(SignUpMock(formKey: model.formKey)); + + model.initialise(org); + + final result = QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions( + document: gql( + queries.registerUser('', '', '', '', ''), + ), + ), + ); + when(graphqlConfig.getToken()).thenAnswer((_) async => true); + when( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ).thenAnswer((_) async => result); + when(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))) + .thenThrow(Exception()); + + await model.signUp(); + + expect(model.validate, AutovalidateMode.disabled); + + verify(databaseFunctions.gqlAuthMutation(queries.joinOrgById(org.id!))); + verify( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: isA() + .having( + (mainScreenArgs) => mainScreenArgs.mainScreenIndex, + "main screen index", + 0, + ) + .having( + (mainScreenArgs) => mainScreenArgs.fromSignUp, + "from sign up", + true, + ), + ), + ); + }); + testWidgets( + 'Check if signup() is working fine when process of send membership request throws exception', + (tester) async { + userRegistrationRequired = true; + // locator.registerSingleton(MockUserConfig()); + + final model = SignupDetailsViewModel(); + + await tester.pumpWidget(SignUpMock(formKey: model.formKey)); + + model.initialise(org); + + final result = QueryResult( + source: QueryResultSource.network, + data: data, + options: QueryOptions( + document: gql( + queries.registerUser('', '', '', '', ''), + ), + ), + ); + when(graphqlConfig.getToken()).thenAnswer((_) async => true); + when( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ).thenAnswer((_) async => result); + when( + databaseFunctions + .gqlAuthMutation(queries.sendMembershipRequest(org.id!)), + ).thenThrow(Exception()); + empty = false; + + await model.signUp(); + + expect(model.validate, AutovalidateMode.disabled); + + verify( + databaseFunctions.gqlNonAuthMutation( + queries.registerUser('', '', '', '', org.id), + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.waitingScreen, + Routes.splashScreen, + ), + ); + verifyNever( + navigationService.removeAllAndPush( + Routes.mainScreen, + Routes.splashScreen, + arguments: isA() + .having( + (mainScreenArgs) => mainScreenArgs.mainScreenIndex, + "main screen index", + 0, + ) + .having( + (mainScreenArgs) => mainScreenArgs.fromSignUp, + "from sign up", + true, + ), + ), + ); + }); + }); +} + +class MockUserConfig extends Mock implements UserConfig { + @override + User get currentUser => User( + joinedOrganizations: empty ? [] : [org], + ); + + @override + Future updateUserJoinedOrg(List orgs) { + return Future.value(2); + } + + @override + dynamic saveCurrentOrgInHive(OrgInfo org) { + return null; + } + + @override + Future updateUser(User user) async => userSaved; + + @override + Future updateUserMemberRequestOrg(List orgs) async => null; +} diff --git a/test/view_model_tests/pre_auth_view_models/waiting_view_model_test.dart b/test/view_model_tests/pre_auth_view_models/waiting_view_model_test.dart new file mode 100644 index 000000000..0b980013c --- /dev/null +++ b/test/view_model_tests/pre_auth_view_models/waiting_view_model_test.dart @@ -0,0 +1,96 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/view_model/pre_auth_view_models/waiting_view_model.dart'; + +import '../../helpers/test_helpers.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +void main() { + setUp(() { + registerServices(); + }); + group("WaitingViewModel Test - ", () { + test("Check if it's initialized correctly", () { + final model = WaitingViewModel(); + final context = MockBuildContext(); + model.initialise(context); + + expect(model.currentUser, userConfig.currentUser); + expect( + model.pendingRequestOrg, + userConfig.currentUser.membershipRequests, + ); + expect( + model.greeting, + [ + { + 'text': "Please wait", + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + { + 'text': " ${model.currentUser.firstName} ", + 'textStyle': + Theme.of(context).textTheme.titleLarge!.copyWith(fontSize: 24), + }, + { + 'text': "for organisation(s) to accept your invitation.", + 'textStyle': Theme.of(context).textTheme.headlineSmall, + }, + ], + ); + }); + test("Check if joinOrg() is pushing the joinOrg route", () { + final model = WaitingViewModel(); + final context = MockBuildContext(); + model.initialise(context); + when(navigationService.pushScreen(Routes.joinOrg, arguments: '-1')) + .thenAnswer((_) async {}); + + model.joinOrg(); + + verify(navigationService.pushScreen(Routes.joinOrg, arguments: '-1')); + }); + test("Check if logout() is working properly", () async { + final model = WaitingViewModel(); + final context = MockBuildContext(); + model.initialise(context); + + when( + navigationService.removeAllAndPush( + Routes.languageSelectionRoute, + Routes.splashScreen, + arguments: '0', + ), + ).thenAnswer((_) async {}); + + final user = Hive.box('currentUser'); + final url = Hive.box('url'); + + await user.put('test', model.currentUser); + await url.put('test', 'fakeUrl'); + + model.logout(); + + verify( + navigationService.removeAllAndPush( + Routes.languageSelectionRoute, + Routes.splashScreen, + arguments: '0', + ), + ); + + Future.delayed(Duration.zero).then((_) { + expect(user.get('test'), null); + expect(url.get('test'), null); + }); + }); + }); +} diff --git a/test/view_model_tests/progress_dialog_view_model_test.dart b/test/view_model_tests/progress_dialog_view_model_test.dart new file mode 100644 index 000000000..08d490f80 --- /dev/null +++ b/test/view_model_tests/progress_dialog_view_model_test.dart @@ -0,0 +1,27 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/view_model/connectivity_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/progress_dialog_view_model.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + group('ProgressDialogViewModelTest -', () { + group('initialise -', () { + getAndRegisterConnectivity(); + AppConnectivity.isOnline = true; + + final model = ProgressDialogViewModel(); + + test( + 'When called and connectivity is present, connectivityPresent must be set to true', + () async { + await model.initialise(); + + expect(model.connectivityPresent, true); + }); + }); + }); +} diff --git a/test/view_model_tests/signup_details_view_model_test.dart b/test/view_model_tests/signup_details_view_model_test.dart new file mode 100644 index 000000000..270e9db9d --- /dev/null +++ b/test/view_model_tests/signup_details_view_model_test.dart @@ -0,0 +1,170 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +// import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/validators.dart'; +import '../helpers/test_helpers.dart'; +// import '../helpers/test_helpers.mocks.dart'; +import '../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + locator().test(); + }); + + setUp(() { + registerServices(); + locator().test(); + }); + + tearDown(() { + unregisterServices(); + }); + + group('SignUp Tests', () { + // final model = MockSignupDetailsViewModel(); + + test('Test validation for first and last name', () { + final String? blankFirstName = Validator.validateFirstName(""); + expect(blankFirstName, "Firstname must not be left blank."); + + final String? blankLastName = Validator.validateLastName(""); + expect(blankLastName, "Lastname must not be left blank."); + + final String? validFirstName = + Validator.validateFirstName("testFirstName"); + expect(validFirstName, null); + + final String? validLastName = Validator.validateLastName("testLastName"); + expect(validLastName, null); + }); + + test('Test validation for Email', () { + final String? blankEmail = Validator.validateEmail(""); + expect(blankEmail, "Email must not be left blank"); + + final String? invalidEmail1 = Validator.validateEmail("testInvalidEmail"); + expect(invalidEmail1, "Please enter a valid Email Address"); + + final String? invalidEmail2 = Validator.validateEmail("test@.com"); + expect(invalidEmail2, "Please enter a valid Email Address"); + + final String? invalidEmail3 = Validator.validateEmail("@test.com"); + expect(invalidEmail3, "Please enter a valid Email Address"); + + final String? validEmail = + Validator.validateEmail("testName@testOrg.com"); + expect(validEmail, null); + }); + + test('Test validation for password', () { + final String? blankPassword = Validator.validatePassword(""); + expect(blankPassword, "Password must not be left blank"); + + final String? invalidPassword1 = Validator.validatePassword("test"); + expect( + invalidPassword1, + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)", + ); + + final String? invalidPassword2 = Validator.validatePassword("123"); + expect( + invalidPassword2, + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)", + ); + + final String? invalidPassword3 = Validator.validatePassword("TEST"); + expect( + invalidPassword3, + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)", + ); + + final String? invalidPassword4 = Validator.validatePassword("test123"); + expect( + invalidPassword4, + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)", + ); + + final String? invalidPassword5 = Validator.validatePassword("test123!"); + expect( + invalidPassword5, + "Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)", + ); + + final String? validPassword = Validator.validatePassword("tesT123!"); + expect(validPassword, null); + + // test for confirm password + final String? differentPassword = + Validator.validatePasswordConfirm("tesT123", "test1234"); + expect(differentPassword, "Password does not match original"); + + final String? matchingPassword = + Validator.validatePasswordConfirm("tesT123", "tesT123"); + expect(matchingPassword, null); + }); + + test('Test sign up function', () async { + // final User newUser = User(); + + // NOTE: This test is entirely WRONG. + // TODO: Fix by testing GraphQL mutations. + + // when(model.signUp()).thenAnswer((realInvocation) { + // if (newUser.id == null || newUser.id == "") { + // return "User Id can't be blank"; + // } + // if (newUser.firstName == null || newUser.firstName == "") { + // return "First Name can't be blank"; + // } + // if (newUser.lastName == null || newUser.lastName == "") { + // return "Last Name can't be blank"; + // } + // if (newUser.email == null || newUser.email == "") { + // return "Email can't be blank"; + // } + // return { + // "id": newUser.id, + // "firstName": newUser.firstName, + // "lastName": newUser.lastName, + // "email": newUser.email, + // }; + // }); + + // //checking with blank user Id + // expect(model.signUp(), "User Id can't be blank"); + + // newUser.id = "5"; + // //checking with blank first name + // expect(model.signUp(), "First Name can't be blank"); + + // newUser.firstName = "testFirstName"; + // //checking with blank last name + // expect(model.signUp(), "Last Name can't be blank"); + + // newUser.lastName = "testLastName"; + // //checking with blank email + // expect(model.signUp(), "Email can't be blank"); + + // newUser.email = "testName@testOrg.com"; + // // checking with all details + // // should give proper response + // expect(model.signUp(), { + // "id": newUser.id, + // "firstName": newUser.firstName, + // "lastName": newUser.lastName, + // "email": newUser.email, + // }); + }); + }); +} diff --git a/test/view_model_tests/theme_view_model_test.dart b/test/view_model_tests/theme_view_model_test.dart new file mode 100644 index 000000000..1b0525b85 --- /dev/null +++ b/test/view_model_tests/theme_view_model_test.dart @@ -0,0 +1,45 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + SharedPreferences.setMockInitialValues({}); + testSetupLocator(); + + setUp(() { + registerServices(); + }); + + tearDown(() { + unregisterServices(); + }); + + group('Theme View Model Tests', () { + test("test initialize function", () async { + final model = AppTheme(); + final prefs = await SharedPreferences.getInstance(); + model.initialize(); + expect(model.isdarkTheme, prefs.getBool("DynamicTheme") ?? true); + }); + + test("test switch theme function", () async { + final model = AppTheme(); + model.initialize(); + model.switchTheme(isOn: false); + expect(model.isdarkTheme, false); + + model.switchTheme(isOn: true); + expect(model.isdarkTheme, true); + }); + }); +} diff --git a/test/view_model_tests/widgets_view_model_test/comments_view_model_test.dart b/test/view_model_tests/widgets_view_model_test/comments_view_model_test.dart new file mode 100644 index 000000000..dbed958ff --- /dev/null +++ b/test/view_model_tests/widgets_view_model_test/comments_view_model_test.dart @@ -0,0 +1,111 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/comment/comment_model.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/view_model/widgets_view_models/comments_view_model.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +class MockCallbackFunction extends Mock { + void call(); +} + +void main() { + late Post mockPost; + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + registerServices(); + mockPost = Post( + sId: "1", + creator: userConfig.currentUser, + description: "mock post", + imageUrl: "mockImageUrl", + videoUrl: "mockVideoUrl", + organization: userConfig.currentOrg, + createdAt: DateTime.now(), + comments: [], + ); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('Comments View Model Tests', () { + test("Testing the functions", () async { + /// first testing initialize function + final model = CommentsViewModel(); + + when(commentsService.getCommentsForPost(mockPost.sId)) + .thenAnswer((realInvocation) async { + return []; + }); + + await model.initialise(mockPost.sId); + expect(model.commentList, []); + expect(model.postId, mockPost.sId); + + /// testing the get comments function + final commentJson1 = { + "text": "first comment", + "post": mockPost.sId, + }; + final commentJson2 = { + "text": "second comment", + "post": mockPost.sId, + }; + + final commentsJson = [commentJson1, commentJson2]; + + final comment1 = Comment( + text: "first comment", + post: mockPost.sId, + ); + final comment2 = Comment( + text: "second comment", + post: mockPost.sId, + ); + final comments = [comment1, comment2]; + when(commentsService.getCommentsForPost(mockPost.sId)) + .thenAnswer((realInvocation) async { + return commentsJson; + }); + + await model.getComments(); + + expect(model.commentList.length, comments.length); + expect(model.commentList.first.text, comment1.text); + expect(model.commentList.first.post, mockPost.sId); + expect(model.commentList.last.text, comment2.text); + expect(model.commentList.last.post, mockPost.sId); + + /// finally testing the create comment function + when(commentsService.getCommentsForPost(mockPost.sId)) + .thenAnswer((realInvocation) async { + return []; + }); + await model.initialise(mockPost.sId); + + when(commentsService.createComments(mockPost.sId, "fakeMsg")) + .thenAnswer((realInvocation) async {}); + when(postService.addCommentLocally(mockPost.sId)) + .thenAnswer((realInvocation) {}); + + await model.createComment("fakeMsg"); + + expect(model.commentList.length, 1); + expect(model.commentList.first.text, "fakeMsg"); + expect(model.commentList.first.creator!.id, "xzy1"); + }); + }); +} diff --git a/test/view_model_tests/widgets_view_model_test/like_button_view_model_test.dart b/test/view_model_tests/widgets_view_model_test/like_button_view_model_test.dart new file mode 100644 index 000000000..9ea562726 --- /dev/null +++ b/test/view_model_tests/widgets_view_model_test/like_button_view_model_test.dart @@ -0,0 +1,99 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +void main() { + registerServices(); + + final List likedBy0 = [ + LikedBy(sId: 'Test user 1'), + LikedBy(sId: 'Test user 2'), + ]; + + final post = Post( + sId: "test_post_id", + creator: userConfig.currentUser, + likedBy: likedBy0, + ); + + group("Tests for login_button_view_model", () { + test("Testing setIsLiked", () { + final model = LikeButtonViewModel(); + model.initialize(likedBy0, 'Test post_id'); + model.setIsLiked(); + expect(model.isLiked, true); + }); + test( + 'Testing checkAndSetTheIsLiked function when user is not present in likedby', + () { + final model = LikeButtonViewModel(); + model.initialize(likedBy0, 'Test post_id'); + model.checkAndSetTheIsLiked(); + expect(model.isLiked, false); + }); + + test( + 'Testing checkAndSetTheIsLiked function when user is present in likedby', + () { + final model = LikeButtonViewModel(); + likedBy0.add(LikedBy(sId: userConfig.currentUser.id)); + model.initialize(likedBy0, 'Test post_id'); + model.checkAndSetTheIsLiked(); + expect(model.isLiked, true); + likedBy0 + .removeWhere((element) => element.sId == userConfig.currentUser.id); + }); + + test("testing toggleIsLiked", () { + final model = LikeButtonViewModel(); + model.initialize(likedBy0, post.sId); + model.setIsLiked(val: false); + expect(model.isLiked, false); + final LikedBy likedBy = LikedBy( + sId: userConfig.currentUser.id, + ); + when(postService.addLike(post.sId)).thenAnswer((realInvocation) async { + model.likedBy.add(likedBy); + return true; + }); + model.toggleIsLiked(); + expect(model.likesCount, 3); + model.setIsLiked(val: true); + when(postService.removeLike(post.sId)).thenAnswer((realInvocation) async { + model.likedBy + .removeWhere((element) => element.sId == userConfig.currentUser.id); + return true; + }); + model.toggleIsLiked(); + // expect(model.likesCount, 2); + // expect(model.likedBy.contains(likedBy), false); + }); + + test("Testing updatePost", () { + final model = LikeButtonViewModel(); + model.initialize(likedBy0, post.sId); + final Post newPost = Post( + sId: "new_post_id", + creator: userConfig.currentUser, + likedBy: [], + ); + // with different post + model.updatePost(newPost); + // expect(model.likesCount, 2); + + final LikedBy likedBy3 = LikedBy(sId: "Test user 3"); + post.likedBy!.add(likedBy3); + // with same post + model.updatePost(post); + // expect(model.likesCount, 3); + // expect(model.likedBy.contains(likedBy3), true); + }); + }); +} diff --git a/test/views/after_auth_screens/add_post_page_test.dart b/test/views/after_auth_screens/add_post_page_test.dart new file mode 100644 index 000000000..cfae2177d --- /dev/null +++ b/test/views/after_auth_screens/add_post_page_test.dart @@ -0,0 +1,521 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/third_party_service/multi_media_pick_service.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/add_post_page.dart'; + +import '../../helpers/test_helpers.dart'; + +final homeModel = locator(); +bool removeImageCalled = false; + +class MockAddPostViewModel extends Mock implements AddPostViewModel { + final _textHashTagController = TextEditingController(text: ''); + final _controller = TextEditingController(text: ''); + final _titleController = TextEditingController(text: ''); + + @override + File? get imageFile { + return File('example'); + } + + @override + String get userName => 'UserName'; + + @override + String? get userPic => userConfig.currentUser.image; + + @override + String get orgName => 'orgName'; + + @override + TextEditingController get textHashTagController => _textHashTagController; + + @override + TextEditingController get controller => _controller; + + @override + TextEditingController get titleController => _titleController; + + // @override + // void removeImage() { + // removeImageCalled = true; + // } +} + +Widget createAddPostScreen({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + home: Scaffold( + /// MainScreenViewModel.scaffoldKey.currentState will return null + /// until and unless their is another widget with the same global key + key: MainScreenViewModel.scaffoldKey, + body: AddPost( + drawerKey: MainScreenViewModel.scaffoldKey, + ), + ), + ); +} + +final demoJson = { + 'createPost': { + '__typename': 'Post', + '_id': '1', + 'text': 'text #hastag', + 'createdAt': '2023-11-13T19:28:21.095Z', + 'imageUrl': 'https://imageurl', + 'videoUrl': 'https://videoUrl', + 'title': 'demo title', + 'commentCount': 0, + 'likeCount': 0, + 'creator': { + '__typename': 'User', + '_id': '1', + 'firstName': 'Ayush', + 'lastName': 'Raghuwanshi', + 'image': 'https://imageUrl', + }, + 'organization': {'__typename': 'Organization', '_id': '1'}, + 'likedBy': [], + 'comments': [], + }, +}; + +void main() { + setUpAll(() { + setupLocator(); + registerServices(); + getAndRegisterImageService(); + sizeConfig.test(); + }); + + group('createAddPostScreen Test', () { + testWidgets('check if back button in app bar works', (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + final backButtonFinder = find.byKey(const Key('add_post_icon_button1')); + expect(backButtonFinder, findsOneWidget); + await tester.tap(backButtonFinder); + await tester.pump(); + verify(navigationService.pop()).called(1); + }); + + testWidgets('check if createAddPostScreen shows up', (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + final finder = find.byType(Scaffold); + + expect(finder, findsNWidgets(2)); + }); + + group('checks if the upload post button is working properly', () { + testWidgets('checks if the upload post button is pressable', + (tester) async { + final dataBaseMutationFunctions = locator(); + when( + dataBaseMutationFunctions.gqlAuthMutation( + PostQueries().uploadPost(), + variables: { + "text": " #", + "organizationId": 'XYZ', + "title": '', + }, + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions(document: gql(PostQueries().uploadPost())), + data: demoJson, + source: QueryResultSource.network, + ), + ); + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of text button + /// because their are many text button + + final finder = find.byKey(const Key('add_post_text_btn1')); + await tester.tap(finder); + expect(finder, findsOneWidget); + await tester.pump(); + }); + testWidgets('checks if the upload post button shows correct text', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of text button + /// because their are many text button + + final finder = find.byKey(const Key('add_post_text_btn1')); + final text = find.descendant(of: finder, matching: find.text('Post')); + + expect(finder, findsOneWidget); + expect(text, findsOneWidget); + }); + }); + + group('checks if the upload photo from gallery button is working properly', + () { + testWidgets( + 'checks if the upload photo from gallery button shows correct icon', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('add_post_icon_button2')); + + final icon = + find.descendant(of: finder, matching: find.byIcon(Icons.photo)); + + expect(finder, findsOneWidget); + expect(icon, findsOneWidget); + }); + + testWidgets( + 'checks if the upload photo from gallery button ad other process are working properly', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('add_post_icon_button2')); + + expect(finder, findsOneWidget); + + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); + + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); + + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); + + /// taping the button + await tester.tap(finder); + await tester.pump(); + }); + + testWidgets( + 'checks if the uploaded photo from gallery button is presented on the screen', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('add_post_icon_button2')); + + final finder2 = find.byType(Stack); + + final finder3 = find.byType(Positioned); + + expect(finder, findsOneWidget); + + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); + + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); + + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(finder); + await tester.pump(); + + expect(finder2, findsNWidgets(3)); + + expect(finder3, findsNWidgets(1)); + }); + + testWidgets( + 'checks if the uploaded photo from gallery button is removed after pressing remove button', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('add_post_icon_button2')); + + final cancelBtn = find.byIcon(Icons.cancel); + + expect(finder, findsOneWidget); + + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); + + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); + + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(finder); + await tester.pumpAndSettle(); + + final offSet = tester.getCenter(cancelBtn); + await tester.tapAt(offSet); + await tester.pump(); + }); + }); + + group('checks if the upload photo by camera button is working properly', + () { + testWidgets( + 'checks if the upload photo by camera button shows correct icon', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('add_post_icon_button3')); + + final icon = find.descendant( + of: finder, + matching: find.byIcon(Icons.camera_alt), + ); + + expect(finder, findsOneWidget); + expect(icon, findsOneWidget); + }); + + testWidgets( + 'checks if the upload by camera one button button is pressable', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('add_post_icon_button3')); + + expect(finder, findsOneWidget); + + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); + + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); + + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: true)) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(finder); + await tester.pump(); + }); + }); + + group('checks if the upload file button is working properly', () { + // testWidgets('checks if the upload file button button is pressable', + // (tester) async { + // await tester.pumpWidget(createAddPostScreen()); + // await tester.pump(); + // + // /// using the key of icon button + // /// because their are many icon button + // + // final finder = find.byKey(const Key('add_post_icon_button4')); + // + // expect(finder, findsOneWidget); + // + // await tester.tap(finder); + // await tester.pump(); + // }); + }); + + group('checks if the add hashtag button is working properly', () { + /// TODO: Hashtags implementation removed currently + testWidgets('checks if the add hashtag button shows correct text', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of text button + /// because their are many text button + + final finder = find.byKey(const Key('add_post_text_btn2')); + + // final icon = + // find.descendant(of: finder, matching: find.text('Add tag')); + + expect(finder, findsOneWidget); + // expect(icon, findsOneWidget); + }); + + testWidgets('checks if the add hashtag button is pressable', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of text button + /// because their are many text button + + final finder = find.byKey(const Key('add_post_text_btn2')); + + expect(finder, findsOneWidget); + + await tester.tap(finder); + await tester.pump(); + }); + testWidgets('checks if the add hashtag button add is pressable', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of text button + /// because their are many text button + + final finder = find.byKey(const Key('add_post_text_btn2')); + + expect(finder, findsOneWidget); + + await tester.tap(finder); + await tester.pump(); + + final hashtag = find.byKey(const Key("add_hashtag_button")); + + expect(hashtag, findsOneWidget); + + await tester.tap(hashtag); + await tester.pump(); + }); + + testWidgets('checks if the cancel hashtag button add is pressable', + (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of text button + /// because their are many text button + + final finder = find.byKey(const Key('add_post_text_btn2')); + + expect(finder, findsOneWidget); + + await tester.tap(finder); + await tester.pump(); + + final hashtag = find.byKey(const Key("cancel_hashtag_button")); + + expect(hashtag, findsOneWidget); + + await tester.tap(hashtag); + await tester.pump(); + }); + }); + +//TODO: null + testWidgets('Check if icon button is pressable.', (tester) async { + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('add_post_icon_button1')); + + expect(finder, findsOneWidget); + + await tester.tap(finder); + await tester.pump(); + }); + + testWidgets('check if remove Image button works', (tester) async { + locator.unregister(); + final mockModel = + locator.registerSingleton(MockAddPostViewModel()); + + when(mockModel.removeImage()).thenAnswer((_) {}); + + await tester.pumpWidget(createAddPostScreen()); + await tester.pump(); + + final removeImageBtn = + tester.widget(find.byKey(const Key('remove_icon'))) as IconButton; + + removeImageBtn.onPressed!(); + + verify(mockModel.removeImage()); + }); + }); +} diff --git a/test/views/after_auth_screens/chat/chat_message_screen_test/chat_message_screen_test.dart b/test/views/after_auth_screens/chat/chat_message_screen_test/chat_message_screen_test.dart new file mode 100644 index 000000000..ea821ad87 --- /dev/null +++ b/test/views/after_auth_screens/chat/chat_message_screen_test/chat_message_screen_test.dart @@ -0,0 +1,84 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:talawa/enums/enums.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/chat/chat_message_screen.dart'; +import 'package:talawa/views/after_auth_screens/chat/widgets/chat_input_field.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../../helpers/test_helpers.dart'; +import '../../../../helpers/test_locator.dart'; + +final directChatViewModel = getAndRegisterDirectChatViewModel(); + +Widget createApp() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: ChatMessageScreen(chatId: "XYZ", model: directChatViewModel), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); +} + +Future showChatMessageScreen(WidgetTester tester) async { + await tester.pumpWidget(createApp()); + await tester.pumpAndSettle(); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + registerServices(); + }); + + testWidgets('Check if Chat Message Screen page shows up', (tester) async { + await showChatMessageScreen(tester); + expect(find.byType(Scaffold), findsOneWidget); + }); + + testWidgets('Check if Back page button is working', (tester) async { + await showChatMessageScreen(tester); + await tester.tap(find.byIcon(Icons.arrow_back)); + + expect(find.byType(Scaffold), findsOneWidget); + }); + + testWidgets('Check if the Chat Input Field is in the widget tree', + (tester) async { + await showChatMessageScreen(tester); + + expect(find.byType(ChatInputField), findsOneWidget); + }); + + testWidgets( + 'Check if the circular progress indicator shows up on the loading state', + (tester) async { + when(directChatViewModel.chatState).thenReturn(ChatState.loading); + await tester.pumpWidget(createApp()); + await tester.pump(); + + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }, + ); +} diff --git a/test/views/after_auth_screens/chat/select_contact_test.dart b/test/views/after_auth_screens/chat/select_contact_test.dart new file mode 100644 index 000000000..e581e4f52 --- /dev/null +++ b/test/views/after_auth_screens/chat/select_contact_test.dart @@ -0,0 +1,138 @@ +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:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/select_contact_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/chat/chat_list_screen.dart'; +import 'package:talawa/views/after_auth_screens/chat/select_contact.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Widget createApp() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const SelectContact(), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); +} + +Widget createChatListScreen() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const ChatPage(), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); +} + +Future showSelectContactScreen(WidgetTester tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + await tester.tap(find.textContaining('Ayush')); + await tester.pumpAndSettle(); +} + +Future showSelectContactScreenByChatPage(WidgetTester tester) async { + await tester.pumpWidget(createChatListScreen()); + await tester.pump(); + await tester.tap(find.byIcon(Icons.add)); + await tester.pumpAndSettle(); +} + +void main() { + SizeConfig().test(); + // testSetupLocator(); + registerServices(); + registerViewModels(); + final model = SelectContactViewModel(); + model.initialise(); + final User user1 = User(id: "fakeUser1", firstName: "Shivam"); + final User user2 = User(id: "fakeUser2", firstName: "Talawa"); + final List users = [user1, user2]; + + when(organizationService.getOrgMembersList("XYZ")) + .thenAnswer((realInvocation) async { + return users; + }); + + testWidgets('Check if Select Contacts page shows up', (tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + expect(find.byType(Scaffold), findsOneWidget); + + await showSelectContactScreenByChatPage(tester); + expect(find.byType(Scaffold), findsOneWidget); + }); + testWidgets('Check if Back page button is working', (tester) async { + await showSelectContactScreenByChatPage(tester); + await tester.tap(find.byIcon(Icons.arrow_back)); + + expect(find.byType(Scaffold), findsOneWidget); + }); + testWidgets( + 'Check if Select contact comes up when prompted fromm chat list screen', + (tester) async { + await showSelectContactScreenByChatPage(tester); + await tester.pump(); + + expect(find.byType(Scaffold), findsOneWidget); + }); + + testWidgets("Test if list view is visible", (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createApp()); + await tester.pump(); + await tester.pumpAndSettle(const Duration(milliseconds: 4000)); + + expect(find.byType(ListView), findsOneWidget); + expect( + find.byKey( + const ValueKey('select_contact_gesture_0'), + ), + findsNWidgets(1), + ); + expect( + find.byKey( + const ValueKey('select_contact_gesture_1'), + ), + findsNWidgets(1), + ); + final gesturedetect = find.byKey( + const ValueKey('select_contact_gesture_1'), + ); + await tester.tap(gesturedetect); + + expect(find.text('Shivam'), findsOneWidget); + expect(find.text('Talawa'), findsOneWidget); + }); + }); +} diff --git a/test/views/after_auth_screens/chat/widgets/chat_input_field_test.dart b/test/views/after_auth_screens/chat/widgets/chat_input_field_test.dart new file mode 100644 index 000000000..d6f3fe51a --- /dev/null +++ b/test/views/after_auth_screens/chat/widgets/chat_input_field_test.dart @@ -0,0 +1,95 @@ +// ignore_for_file: talawa_api_doc + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/chat/widgets/chat_input_field.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../../helpers/test_helpers.dart'; +import '../../../../helpers/test_locator.dart'; + +/// DirectChatViewModel mock. +final directChatViewModel = getAndRegisterDirectChatViewModel(); + +/// Function creates chatInputField. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `Widget`: The actual chatInputField to test +Widget createChatInputField() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + theme: TalawaTheme.darkTheme, + home: Scaffold( + body: ChatInputField( + chatId: "XYZ", + model: directChatViewModel, + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + registerServices(); + }); + testWidgets("Check if chat input field shows up", (tester) async { + await tester.pumpWidget(createChatInputField()); + await tester.pumpAndSettle(); + + expect(find.byType(ChatInputField), findsOneWidget); + expect(find.byType(TextField), findsOneWidget); + + final textFieldWidget = find.byType(TextField); + await tester.enterText(textFieldWidget, 'Something'); + + final TextField textField = tester.widget(textFieldWidget); + expect(textField.controller!.text, 'Something'); + + expect(find.text('Type a message'), findsOneWidget); + + expect(find.text('Something'), findsOneWidget); + }); + testWidgets('Check if sending messages work', (tester) async { + await tester.pumpWidget(createChatInputField()); + await tester.pumpAndSettle(); + + final textFieldWidget = find.byType(TextField); + await tester.enterText(textFieldWidget, 'Something'); + await tester.pumpAndSettle(); + expect(find.text('Something'), findsOneWidget); + await tester.pump(); + final sendMessageButton = find.byKey(const Key('InputFieldGestureKey')); + await tester.tap(sendMessageButton); + + expect(directChatViewModel.chatMessagesByUser['XYZ']?.length, 2); + + final TextField textField = tester.widget(textFieldWidget); + expect(textField.controller!.text, ''); + }); +} diff --git a/test/views/after_auth_screens/chat/widgets/chat_message_bubble.dart b/test/views/after_auth_screens/chat/widgets/chat_message_bubble.dart new file mode 100644 index 000000000..0372f9808 --- /dev/null +++ b/test/views/after_auth_screens/chat/widgets/chat_message_bubble.dart @@ -0,0 +1,152 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/chats/chat_message.dart'; +import 'package:talawa/models/chats/chat_user.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/views/after_auth_screens/chat/widgets/chat_message_bubble.dart'; + +Widget createChatMessageBubble() { + return MaterialApp( + theme: TalawaTheme.darkTheme, + home: Scaffold( + body: Message( + message: ChatMessage( + "fake_id", + ChatUser( + firstName: "ravidi", + id: "chad", + image: "amogus", + ), + "fake_chat", + ChatUser( + firstName: "sheikh", + id: "gaad", + image: "amogus", + ), + ), + ), + ), + ); +} + +const remoteMessageBorderRadius = BorderRadius.only( + bottomRight: Radius.circular(15), + topRight: Radius.circular(15), + bottomLeft: Radius.circular(15), +); + +const localMessageBorderRadius = BorderRadius.only( + bottomRight: Radius.circular(15), + topLeft: Radius.circular(15), + bottomLeft: Radius.circular(15), +); + +void main() { + SizeConfig().test(); + setupLocator(); + + group("Tests for chat_message_bubble.dart", () { + testWidgets("Check if Message shows up", (tester) async { + await tester.pumpWidget(createChatMessageBubble()); + await tester.pump(); + + expect(find.byType(Message), findsOneWidget); + }); + + testWidgets("Check if chat text renders correctly", (tester) async { + userConfig.currentUser.firstName = "undef"; + await tester.pumpWidget(createChatMessageBubble()); + await tester.pump(); + + Finder chatTextBlack = find.byWidgetPredicate( + (widget) => + widget is Text && + widget.data == "fake_chat" && + widget.style!.color == + TalawaTheme.darkTheme.textTheme.bodyLarge!.color, + description: 'Text widget with color as black', + ); + + expect(chatTextBlack, findsOneWidget); + + userConfig.currentUser.firstName = "ravidi"; + + // Now the text color should change to black + chatTextBlack = find.byWidgetPredicate( + (widget) => + widget is Text && + widget.data == "fake_chat" && + widget.style!.color == Colors.black, + description: 'Text widget with color as black', + ); + + expect(chatTextBlack, findsNothing); + }); + + testWidgets("Check if remote chat aligns correctly", (tester) async { + userConfig.currentUser.firstName = "undef"; + + await tester.pumpWidget(createChatMessageBubble()); + await tester.pump(); + + // Remote message should be on the left + final chat = find.byWidgetPredicate( + (widget) => + widget is Padding && + widget.child is Row && + (widget.child! as Row).mainAxisAlignment == MainAxisAlignment.start, + description: 'A row aligned to left (remote message)', + ); + + expect(chat, findsOneWidget); + + find.byWidgetPredicate( + (widget) { + final chatContainer = + ((widget as Padding).child! as Row).children[0] as Container; + final chatDecoration = chatContainer.decoration! as BoxDecoration; + + return chatDecoration.color == Colors.green && + chatDecoration.borderRadius == remoteMessageBorderRadius; + }, + description: "Check if chat container is properly decorated", + ); + }); + + testWidgets("Check if local chat shows correctly", (tester) async { + userConfig.currentUser.firstName = "ravidi"; + + await tester.pumpWidget(createChatMessageBubble()); + await tester.pump(); + + // Local message should be on the right + expect( + find.byWidgetPredicate( + (widget) => + widget is Padding && + widget.child is Row && + (widget.child! as Row).mainAxisAlignment == MainAxisAlignment.end, + description: 'A row aligned to right (local message)', + ), + findsOneWidget, + ); + + find.byWidgetPredicate( + (widget) { + final chatContainer = + ((widget as Padding).child! as Row).children[0] as Container; + final chatDecoration = chatContainer.decoration! as BoxDecoration; + + return chatDecoration.color == Colors.white && + chatDecoration.borderRadius == localMessageBorderRadius; + }, + description: "Check if chat container is properly decorated", + ); + }); + }); +} diff --git a/test/views/after_auth_screens/events/create_agenda_item_page_test.dart b/test/views/after_auth_screens/events/create_agenda_item_page_test.dart new file mode 100644 index 000000000..0e198474a --- /dev/null +++ b/test/views/after_auth_screens/events/create_agenda_item_page_test.dart @@ -0,0 +1,217 @@ +// ignore_for_file: talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/create_agenda_item_page.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Event getTestEvent({ + bool isPublic = false, + bool viewOnMap = true, + bool asAdmin = false, +}) { + return Event( + id: "1", + title: "test_event", + creator: User( + id: asAdmin ? "xzy1" : "acb1", + firstName: "ravidi", + lastName: "shaikh", + ), + isPublic: isPublic, + startDate: "00/00/0000", + endDate: "12/12/9999", + startTime: "00:00", + endTime: "24:00", + location: "iitbhu, varanasi", + description: "test_event_description", + admins: [ + User( + firstName: "ravidi_admin_one", + lastName: "shaikh_admin_one", + ), + User( + firstName: "ravidi_admin_two", + lastName: "shaikh_admin_two", + ), + ], + attendees: [ + Attendee( + id: "1", + firstName: "Test", + lastName: "User", + ), + ], + isRegisterable: true, + ); +} + +Widget createCreateAgendaItemScreen() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return BaseView( + onModelReady: (model) { + model.initialize( + args: { + "event": getTestEvent( + isPublic: true, + viewOnMap: false, + asAdmin: true, + ), + "exploreEventViewModel": ExploreEventsViewModel(), + }, + ); + }, + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: CreateAgendaItemPage( + model: model, + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); +} + +List testCategories = [ + AgendaCategory(id: '1', name: 'Category 1'), + AgendaCategory(id: '2', name: 'Category 2'), +]; + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + locator().test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('CreateAgendaItemPage Widget Tests', () { + testWidgets("Check if create agenda item screen shows up", (tester) async { + await tester.pumpWidget(createCreateAgendaItemScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(CreateAgendaItemPage), findsOneWidget); + }); + + testWidgets('Category selection works correctly', + (WidgetTester tester) async { + final mockResult = QueryResult( + source: QueryResultSource.network, + data: { + 'agendaItemCategoriesByOrganization': [ + { + 'id': '1', + 'name': 'Category 1', + }, + { + 'id': '2', + 'name': 'Category 2', + }, + ], + }, + options: QueryOptions( + document: gql( + EventQueries().fetchAgendaItemCategoriesByOrganization('XYZ'), + ), + ), + ); + + when(eventService.fetchAgendaCategories("XYZ")) + .thenAnswer((_) async => mockResult); + await tester.pumpWidget(createCreateAgendaItemScreen()); + await tester.pumpAndSettle(); + + await tester.tap(find.byType(DropdownButtonFormField)); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Category 1').last); + await tester.pumpAndSettle(); + + expect(find.byType(Chip), findsOneWidget); + expect(find.text('Category 1'), findsNWidgets(2)); + }); + + testWidgets('Add button works correctly', (WidgetTester tester) async { + await tester.pumpWidget(createCreateAgendaItemScreen()); + await tester.pumpAndSettle(); + + // Fill in the required fields + await tester.enterText( + find.byKey(const Key('create_event_agenda_tf1')), + 'Test Agenda Item', + ); + await tester.enterText( + find.byKey(const Key('create_event_agenda_tf2')), + 'Test Description', + ); + await tester.enterText( + find.byKey(const Key('create_event_agenda_duration')), + '00:30', + ); + + await tester.tap(find.byKey(const Key('add_agenda'))); + await tester.pumpAndSettle(); + + expect(find.byType(CreateAgendaItemPage), findsNothing); + }); + + testWidgets('Add URL works correctly', (WidgetTester tester) async { + await tester.pumpWidget(createCreateAgendaItemScreen()); + await tester.pumpAndSettle(); + + await tester.enterText( + find.byType(TextFormField).at(3), + 'https://example.com', + ); + await tester.pumpAndSettle(); + await tester.tap( + find.byKey(const Key('add_url')), + ); + await tester.pumpAndSettle(); + + expect(find.byType(Chip), findsOneWidget); + expect(find.text('https://example.com'), findsOneWidget); + }); + + testWidgets('Add Attachments button is present', + (WidgetTester tester) async { + await tester.pumpWidget(createCreateAgendaItemScreen()); + await tester.pumpAndSettle(); + + expect(find.text('Add Attachments'), findsOneWidget); + }); + }); +} diff --git a/test/views/after_auth_screens/events/create_custom_recurring_event_test.dart b/test/views/after_auth_screens/events/create_custom_recurring_event_test.dart new file mode 100644 index 000000000..fbf53eb88 --- /dev/null +++ b/test/views/after_auth_screens/events/create_custom_recurring_event_test.dart @@ -0,0 +1,528 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/router.dart' as router; +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/create_event_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/create_custom_recurring_event.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/create_recurring_event_helper_widgets.dart'; +import 'package:talawa/widgets/custom_weekday_selector.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +/// Creates a EventScreen for tests. +/// +/// **params**: +/// * `themeMode`: ThemeMode +/// * `theme`: ThemeData of App +/// * `model`: CreateEventViewModel +/// +/// **returns**: +/// * `Widget`: Event Screen Widget +Widget createCustomRecurrenceScreen({ + ThemeMode themeMode = ThemeMode.light, + required ThemeData theme, + CreateEventViewModel? model, +}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: theme, + home: Scaffold( + body: CustomRecurrencePage( + model: model ?? CreateEventViewModel(), + ), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + getAndRegisterNavigationService(); + }); + + // setUp(() { + // registerServices(); + // }); + + // tearDown(() { + // unregisterServices(); + // }); + + group("RecurrenceUtils", () { + test("getRecurrenceRuleText for Frequency Daily", () { + final ruleText = RecurrenceUtils.getRecurrenceRuleText( + Frequency.daily, + null, + 2, + null, + null, + DateTime(2024, 1, 1), + null, + ); + expect(ruleText, 'Every 2 days'); + + final ruleText2 = RecurrenceUtils.getRecurrenceRuleText( + Frequency.daily, + null, + 1, + null, + null, + DateTime(2024, 1, 1), + null, + ); + expect(ruleText2, 'Daily'); + }); + + test("getRecurrenceRuleText for Frequency Weekly", () { + final ruleText = RecurrenceUtils.getRecurrenceRuleText( + Frequency.weekly, + {'MONDAY'}, + 2, + null, + null, + DateTime(2024, 1, 1), + null, + ); + expect(ruleText, 'Every 2 weeks on Monday'); + + final ruleText2 = RecurrenceUtils.getRecurrenceRuleText( + Frequency.weekly, + {'MONDAY'}, + 1, + null, + null, + DateTime(2024, 1, 1), + null, + ); + expect(ruleText2, 'Weekly on Monday'); + }); + + test("getRecurrenceRuleText for Frequency Monthly", () { + final ruleText = RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + null, + 2, + null, + 2, + DateTime(2024, 1, 1), + null, + ); + expect(ruleText, 'Every 2 months on Second Monday'); + + final ruleText2 = RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + null, + 1, + null, + null, + DateTime(2024, 1, 1), + null, + ); + expect(ruleText2, 'Monthly on Day 1'); + }); + + test("getRecurrenceRuleText for Frequency Yearly", () { + final ruleText = RecurrenceUtils.getRecurrenceRuleText( + Frequency.yearly, + null, + 3, + null, + null, + DateTime(2024, 1, 1), + null, + ); + expect(ruleText, 'Every 3 years on January 1'); + + final ruleText2 = RecurrenceUtils.getRecurrenceRuleText( + Frequency.yearly, + null, + 1, + null, + null, + DateTime(2024, 1, 1), + null, + ); + expect(ruleText2, 'Annually on January 1'); + }); + + test('getWeekDaysString formats string correctly', () { + final weekDaysString = RecurrenceUtils.getWeekDaysString([ + WeekDays.monday, + WeekDays.tuesday, + WeekDays.wednesday, + ]); + expect(weekDaysString, 'Monday, Tuesday & Wednesday'); + }); + + test('isLastOccurenceOfWeekDay returns true for last occurrence', () { + final date = DateTime(2022, 1, 31); // Last Monday of January 2022 + final isLastOccurrence = RecurrenceUtils.isLastOccurenceOfWeekDay(date); + expect(isLastOccurrence, true); + }); + + test('isLastOccurenceOfWeekDay returns false for not last occurrence', () { + final date = DateTime(2022, 1, 24); // Not the last Monday of January 2022 + final isLastOccurrence = RecurrenceUtils.isLastOccurenceOfWeekDay(date); + expect(isLastOccurrence, false); + }); + }); + group('Test custom recurrence page.', () { + testWidgets('Appbar is being rendered as expected.', (tester) async { + await tester.pumpWidget( + createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + final appBarFinder = find.byType(AppBar); + + expect(appBarFinder, findsOne); + expect(find.text('Custom recurrence'), findsOneWidget); + expect(find.text('Done'), findsOneWidget); + }); + + testWidgets('Custom divider widget.', (tester) async { + await tester.pumpWidget( + createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + final customDividerFinder = find.byType(Divider); + expect(customDividerFinder, findsNWidgets(2)); + }); + + testWidgets('Custom inpurFieldHeading widgets.', (tester) async { + await tester.pumpWidget( + createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + + expect(find.text("Repeats every"), findsOne); + expect(find.text("Repeats on"), findsOne); + expect(find.text("Ends"), findsOne); + }); + + testWidgets('CustomRectangle & CustomTextField widgets.', (tester) async { + await tester.pumpWidget( + createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + + final customRectangleFinder = find.byType(CustomRectangle); + final customTextFieldFinder = find.byType(CustomTextField); + + expect(customRectangleFinder, findsNWidgets(2)); + expect(customTextFieldFinder, findsNWidgets(2)); + }); + + testWidgets('Check functionality of Interval Frequency', (tester) async { + final model = CreateEventViewModel(); + await tester.pumpWidget( + createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + model: model, + ), + ); + await tester.pump(); + + // Test text field. + final inputsection1TextField = + find.byKey(const Key('inputsection1TextField')); + + await tester.enterText(inputsection1TextField, "23"); + await tester.pumpAndSettle(); + + expect(find.text("23"), findsOne); + + await tester.enterText(inputsection1TextField, "235"); + await tester.pumpAndSettle(); + + // Testing the limit is set to 2. + expect(find.text("23"), findsOne); + + // Test RecurrenceFrequencyDropdown + expect(find.text("week"), findsOne); + + final popupMenuButton = find.byType(PopupMenuButton).first; + + await tester.tap(popupMenuButton); + await tester.pumpAndSettle(); + + expect(find.text("day"), findsOne); + expect(find.text("month"), findsOne); + expect(find.text("year"), findsOne); + + // check functionality of interval frequency day + await tester.tap(find.text(EventIntervals.daily)); + await tester.pumpAndSettle(); + + expect(model.frequency, Frequency.daily); + expect(model.recurrenceInterval, EventIntervals.daily); + expect(model.weekDayOccurenceInMonth, null); + expect(model.weekDays, []); + + // check functionality of interval frequency week + await tester.tap(popupMenuButton); + await tester.pumpAndSettle(); + await tester.tap(find.text(EventIntervals.weekly)); + await tester.pumpAndSettle(); + + expect(model.frequency, Frequency.weekly); + expect(model.recurrenceInterval, EventIntervals.weekly); + expect(model.weekDayOccurenceInMonth, null); + expect(model.weekDays, []); + + // check functionality of interval frequency week + await tester.tap(popupMenuButton); + await tester.pumpAndSettle(); + await tester.tap(find.text(EventIntervals.monthly)); + await tester.pumpAndSettle(); + + expect(model.frequency, Frequency.monthly); + expect(model.recurrenceInterval, EventIntervals.monthly); + expect(model.weekDayOccurenceInMonth, null); + expect(model.weekDays, []); + + // check functionality of interval frequency year + await tester.tap(popupMenuButton); + await tester.pumpAndSettle(); + await tester.tap(find.text(EventIntervals.yearly)); + await tester.pumpAndSettle(); + + expect(model.frequency, Frequency.yearly); + expect(model.recurrenceInterval, EventIntervals.yearly); + expect(model.weekDayOccurenceInMonth, null); + expect(model.weekDays, []); + }); + + testWidgets("Dropdown for Monthly frequency", (tester) async { + final model = CreateEventViewModel(); + model.recurrenceStartDate = DateTime(2023, 02, 28); + await tester.pumpWidget( + createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + model: model, + ), + ); + await tester.pump(); + + final frequencyDropdown = find.byType(PopupMenuButton).first; + await tester.tap(frequencyDropdown); + await tester.pumpAndSettle(); + + expect(find.text("day"), findsOne); + expect(find.text("month"), findsOne); + expect(find.text("year"), findsOne); + + // select interval frequency as month + await tester.tap(find.text("month")); + await tester.pumpAndSettle(); + + await tester.tap(find.byType(PopupMenuButton).last); + await tester.pumpAndSettle(); + + // check all the functionality of dropdown option shown on isLastDayOccurence is true (monthlyOption[2]) + final monthlyRecurrenceLabel1 = RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + { + RecurrenceUtils.weekDays[model.recurrenceStartDate.weekday - 1], + }, + int.parse(model.repeatsEveryCountController.text), + int.parse(model.endOccurenceController.text), + -1, + model.recurrenceStartDate, + model.recurrenceEndDate, + ); + expect( + find.text(monthlyRecurrenceLabel1), + findsOne, + ); + + await tester.tap(find.text(monthlyRecurrenceLabel1)); + await tester.pumpAndSettle(); + + expect(model.frequency, Frequency.monthly); + expect(model.recurrenceLabel, monthlyRecurrenceLabel1); + expect(model.weekDayOccurenceInMonth, -1); + expect(model.weekDays, { + RecurrenceUtils.weekDays[model.recurrenceStartDate.weekday - 1], + }); + + // check all the functionality of dropdown option shown when weekDayOccurence~=5 (monthlyOption[1]) + await tester.tap(find.byType(PopupMenuButton).last); + await tester.pumpAndSettle(); + + final monthlyRecurrenceLabel2 = RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + { + RecurrenceUtils.weekDays[model.recurrenceStartDate.weekday - 1], + }, + int.parse(model.repeatsEveryCountController.text), + int.parse(model.endOccurenceController.text), + RecurrenceUtils.getWeekDayOccurenceInMonth( + model.recurrenceStartDate, + ), + model.recurrenceStartDate, + model.recurrenceEndDate, + ); + expect( + find.text(monthlyRecurrenceLabel2), + findsOne, + ); + + await tester.tap(find.text(monthlyRecurrenceLabel2)); + await tester.pumpAndSettle(); + + expect(model.frequency, Frequency.monthly); + expect(model.recurrenceLabel, monthlyRecurrenceLabel2); + expect( + model.weekDayOccurenceInMonth, + RecurrenceUtils.getWeekDayOccurenceInMonth( + model.recurrenceStartDate, + ), + ); + expect(model.weekDays, { + RecurrenceUtils.weekDays[model.recurrenceStartDate.weekday - 1], + }); + }); + + testWidgets('CustomWeekDaySelector', (tester) async { + final widget = createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + ); + await tester.pumpWidget(widget); + await tester.pump(); + + expect(find.byType(CustomWeekDaySelector), findsOne); + + await tester.tap(find.text("M")); + await tester.pumpAndSettle(); + await tester.tap(find.text("W")); + await tester.pumpAndSettle(); + + expect(find.text("S"), findsNWidgets(2)); + expect(find.text("M"), findsNWidgets(1)); + expect(find.text("T"), findsNWidgets(2)); + expect(find.text("W"), findsNWidgets(1)); + expect(find.text("F"), findsNWidgets(1)); + }); + + testWidgets('EventEndOptions', (tester) async { + final CreateEventViewModel model = CreateEventViewModel(); + final widget = createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + model: model, + ); + await tester.pumpWidget(widget); + await tester.pump(); + + expect( + find.byKey( + const Key('neverRadioButton'), + ), + findsOne, + ); + expect( + find.byKey( + const Key('onRadioButton'), + ), + findsOne, + ); + expect(find.byKey(const Key('afterRadioButton')), findsOne); + + final afterFinder = find.byKey(const Key('afterRadioButton')); + + await tester.tap(afterFinder); + await tester.pumpAndSettle(); + + final dateSelectorCalendar = + find.byKey(const Key('dateSelectorCalendar')); + + await tester.tap(dateSelectorCalendar); + await tester.pumpAndSettle(); + + expect(find.byType(DatePickerDialog), findsOne); + + await tester.tap(find.text('15').last); + await tester.pumpAndSettle(); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + + expect(find.byType(DatePickerDialog), findsNothing); + + await tester.tap(find.text('never')); + await tester.pumpAndSettle(); + + expect(model.eventEndType, EventEndTypes.never); + expect(model.recurrenceEndDate, null); + + await tester.tap(find.text('on')); + await tester.pumpAndSettle(); + + expect(model.eventEndType, EventEndTypes.on); + }); + + testWidgets('Done button', (tester) async { + final CreateEventViewModel model = CreateEventViewModel(); + final widget = createCustomRecurrenceScreen( + theme: TalawaTheme.darkTheme, + model: model, + ); + await tester.pumpWidget(widget); + await tester.pump(); + + await tester.tap(find.text('Done')); + await tester.pumpAndSettle(); + + expect(model.recurrenceEndDate, null); + + await tester.tap(find.text('on')); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Done')); + await tester.pumpAndSettle(); + + await tester.tap(find.text('after')); + await tester.pumpAndSettle(); + + final afterTextField = find.byType(CustomTextField).last; + + await tester.tap(afterTextField); + await tester.pumpAndSettle(); + + await tester.enterText(afterTextField, '2'); + + await tester.tap(find.text('Done')); + await tester.pumpAndSettle(); + + expect(model.endOccurenceController.text, '2'); + }); + }); +} 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 new file mode 100644 index 000000000..7af45acc4 --- /dev/null +++ b/test/views/after_auth_screens/events/create_event_page_test.dart @@ -0,0 +1,824 @@ +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:intl/intl.dart'; +import 'package:mockito/mockito.dart'; +import 'package:mocktail_image_network/mocktail_image_network.dart'; +import 'package:network_image_mock/network_image_mock.dart'; +import 'package:talawa/constants/custom_theme.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/create_event_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/create_event_page.dart'; +import 'package:talawa/views/after_auth_screens/events/venue_bottom_sheet.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/recurrence_dialog.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; +import '../../../widget_tests/after_auth_screens/events/create_event_form_test.dart'; + +/// Mock class instance of CallbackFunction. +class MockCallbackFunction extends Mock { + /// Mock function call. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void call(); +} + +/// mock instance for setDateCallback. +final setDateCallback = MockCallbackFunction(); + +/// mock instance for setTimeCallback. +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, +}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: theme, + home: const Scaffold( + body: CreateEventPage( + key: Key('CreateEventScreen'), + ), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + registerServices(); + }); + + tearDownAll(() { + unregisterServices(); + }); + group('testing -> CreateEventPage', () { + testWidgets("Checking if add venue button shows up", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + expect(find.text('Add Venue'), findsOneWidget); + }); + testWidgets("Checking if bottom sheet appears if no venue is selcted", + (tester) async { + final model = CreateEventViewModel(); + model.initialize(); + final mockQueryResult = QueryResult( + source: QueryResultSource.network, + data: { + 'getVenueByOrgId': [ + { + 'id': '1', + 'name': 'Mock Venue 1', + 'capacity': 100, + 'imageUrl': 'xyz', + 'description': 'aaa', + }, + { + 'id': '2', + 'name': 'Mock Venue 2', + 'capacity': 150, + 'imageUrl': '', + 'description': 'aaa', + }, + ], + }, + options: QueryOptions(document: gql(queries.venueListQuery())), + ); + + when( + databaseFunctions.gqlAuthQuery( + queries.venueListQuery(), + variables: { + "orgId": 'XYZ', + }, + ), + ).thenAnswer((_) async => mockQueryResult); + + await mockNetworkImagesFor(() async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + expect(find.text('Add Venue'), findsOneWidget); + await tester.tap(find.text('Add Venue')); + await tester.pumpAndSettle(); + + expect(find.byType(VenueBottomSheet), findsOneWidget); + }); + }); + testWidgets("Checking if selected venue shows up", (tester) async { + final model = createEventViewModel; + model.initialize(); + final mockQueryResult = QueryResult( + source: QueryResultSource.network, + data: { + 'getVenueByOrgId': [ + { + 'id': '1', + 'name': 'Mock Venue 1', + 'capacity': 100, + 'imageUrl': '/image/test', + 'description': 'aaa', + }, + { + 'id': '2', + 'name': 'Mock Venue 2', + 'capacity': 150, + 'imageUrl': '', + 'description': 'aaa', + }, + ], + }, + options: QueryOptions(document: gql(queries.venueListQuery())), + ); + + when( + databaseFunctions.gqlAuthQuery( + queries.venueListQuery(), + variables: { + "orgId": 'XYZ', + }, + ), + ).thenAnswer((_) async => mockQueryResult); + + await mockNetworkImagesFor(() async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + expect(find.text('Add Venue'), findsOneWidget); + await tester.tap(find.text('Add Venue')); + await tester.pumpAndSettle(); + + expect(find.byType(VenueBottomSheet), findsOneWidget); + expect(find.text('Mock Venue 1'), findsOneWidget); + + await tester.tap(find.text('Mock Venue 1')); + await tester.pumpAndSettle(); + + await tester.tap(find.byIcon(Icons.check)); + await tester.pumpAndSettle(); + + expect(find.text('Mock Venue 1'), findsOneWidget); + expect(find.byIcon(Icons.edit), findsOneWidget); + + expect(find.byIcon(Icons.cancel), findsOneWidget); + await tester.tap(find.byIcon(Icons.cancel)); + await tester.pumpAndSettle(); + + expect(find.text('Mock Venue 1'), findsNothing); + }); + }); + testWidgets("Checking tap Inkwell for setDate 1 datetime", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + + await tester.pumpAndSettle(); + + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(switches, findsNWidgets(3)); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(1)); + + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(8)); + + final file = File('fakePath'); + + final multimediaPickerService = locator(); + + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(inkwellFinder.at(1)); + await tester.pump(); + }); + + testWidgets("Checking tap Inkwell for setTime 1 datetime", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(switches, findsNWidgets(3)); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(1)); + + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(8)); + + final file = File('fakePath'); + + final multimediaPickerService = locator(); + + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(inkwellFinder.at(2)); + await tester.pump(); + }); + testWidgets('Test Add Button', (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + when(userConfig.loggedIn).thenReturn(true); + + final addBtn = find.byKey(const Key('addButton')); + + await tester.tap(addBtn); + await tester.pumpAndSettle(); + + expect(createEventViewModel.validate, AutovalidateMode.disabled); + }); + + testWidgets('recurrence button', (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + const String prev = "Does not repeat"; + + expect(find.text(prev), findsAny); + await tester.ensureVisible(find.byKey(const Key("inkwell_recurrLabel"))); + await tester.tap(find.text(prev)); + await tester.pumpAndSettle(); + await tester.tap(find.text("Custom...")); + await tester.pumpAndSettle(); + + expect(find.byType(ShowRecurrenceDialog), findsNothing); + }); + + testWidgets("Checking tap Inkwell for setDate 2 datetime", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + + await tester.pumpAndSettle(); + + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(switches, findsNWidgets(3)); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(1)); + + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(8)); + + final file = File('fakePath'); + + final multimediaPickerService = locator(); + + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(inkwellFinder.at(3)); + await tester.pump(); + }); + + testWidgets("Checking tap Inkwell for set time 2 datetime", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + + await tester.pumpAndSettle(); + + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(switches, findsNWidgets(3)); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(1)); + + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(8)); + + final file = File('fakePath'); + + final multimediaPickerService = locator(); + + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(inkwellFinder.at(4)); + await tester.pump(); + }); + + testWidgets('checks if the upload photo from button shows correct icon', + (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + + final finder = find.byKey(const Key('txt_btn_cep')); + + expect(finder, findsOneWidget); + final file = File('fakePath'); + final multimediaPickerServices = locator(); + + when(multimediaPickerServices.getPhotoFromGallery()) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(finder); + await tester.pump(); + + expect(finder, findsOneWidget); + }); + + testWidgets( + 'checks if the uploaded photo from gallery button is removed after pressing remove button', + (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('txt_btn_cep')); + + final cancelBtn = find.byIcon(Icons.cancel); + + expect(finder, findsOneWidget); + + final file = File('fakePath'); + + final multimediaPickerService = locator(); + + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); + + await tester.tap(finder); + await tester.pump(); + + await tester.tap(cancelBtn); + await tester.pump(); + }); + + testWidgets("Testing All day section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final allDayText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('All day'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(allDayText, findsOneWidget); + expect(switches, findsNWidgets(3)); + expect( + (tester.widget(allDayText) as Text?)?.style!.fontSize, + 16, + ); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(0)); + await tester.pumpAndSettle(); + expect((tester.widgetList(switches).toList()[0] as Switch).value, false); + }); + + testWidgets("Testing Keep Registerable section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final keepRegisterableText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Keep Registerable'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(keepRegisterableText, findsOneWidget); + expect(switches, findsNWidgets(3)); + expect( + (tester.widget(keepRegisterableText) as Text?)?.style!.fontSize, + 16, + ); + expect((tester.widgetList(switches).toList()[1] as Switch).value, true); + await tester.ensureVisible(switches.at(1)); + await tester.tap(switches.at(1)); + await tester.pumpAndSettle(); + expect((tester.widgetList(switches).toList()[1] as Switch).value, false); + }); + + testWidgets("Testing Keep public section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final keepPublicText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Keep Public'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(keepPublicText, findsOneWidget); + expect(switches, findsNWidgets(3)); + expect( + (tester.widget(keepPublicText) as Text?)?.style!.fontSize, + 16, + ); + expect((tester.widgetList(switches).toList()[2] as Switch).value, true); + await tester.ensureVisible(switches.at(2)); + await tester.tap(switches.at(2)); + await tester.pumpAndSettle(); + expect((tester.widgetList(switches).toList()[2] as Switch).value, false); + }); + + testWidgets("Checking tap Inkwell for second add to bottom sheet", + (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + + await tester.pumpAndSettle(); + + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(switches, findsNWidgets(3)); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(1)); + + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(8)); + + await tester.ensureVisible(find.byKey(const Key('inwell_cep2'))); + await tester.pump(); + + // await tester.tap(find.byKey(const Key('text_btn_ambs'))); + await tester.tap( + find.byKey( + const Key('inwell_cep2'), + ), + ); + await tester.pump(); + + await tester.pump(); + await tester.ensureVisible(find.byKey(const Key('text_btn_ambs1'))); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('text_btn_ambs1'))); + await tester.pump(); + }); + group('setState Coverage completion', () { + testWidgets('Test end date selection', (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + + await tester.pumpAndSettle(); + + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(switches, findsNWidgets(3)); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(1)); + + await tester.pump(); + + await tester.tap(find.byKey(const Key('EventDateTimeTileDate')).last); + await tester.pump(); + + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + expect(find.text('Does not repeat'), findsOneWidget); + }); + + testWidgets('Tap on DateTimeTile date', (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + + await tester.pumpAndSettle(); + + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(switches, findsNWidgets(3)); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(1)); + + await tester.pump(); + + await tester.tap(find.byKey(const Key('EventDateTimeTileDate')).last); + await tester.pump(); + + await tester.ensureVisible(find.byKey(const Key('key for test cep'))); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + expect(find.byType(CalendarDatePicker), findsOneWidget); + + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + expect( + find.text(DateTime.now().toString().split(' ').first), + findsNWidgets(2), + ); + }); + testWidgets('Tap on DateTimeTile time', (tester) async { + final currentTime = DateTime.now(); + final futureTime = currentTime.add(const Duration(minutes: 30)); + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(switches, findsNWidgets(3)); + expect((tester.widgetList(switches).toList()[0] as Switch).value, true); + await tester.ensureVisible(switches.at(0)); + await tester.tap(switches.at(1)); + + await tester.pump(); + await tester.tap(find.byKey(const Key('EventDateTimeTileTime')).last); + await tester.pump(); + + expect(find.byType(TimePickerDialog), findsOneWidget); + + await tester.tap(find.text('OK')); + await tester.pump(); + expect( + find.text(DateFormat.jm().format(currentTime)), + findsOneWidget, + ); + + expect( + find.text(DateFormat.jm().format(futureTime)), + findsOneWidget, + ); + }); + }); + + group("Tests for integration with view model and services", () { + late final CreateEventViewModel cachedViewModel = + getAndRegisterCreateEventModel(); + + // testWidgets("setup MockCreateEventViewModel", (tester) async { + // cachedViewModel = getAndRegisterCreateEventModel(); + // }); + + testWidgets("Check if AppBar buttons work", (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + expect(find.byType(CreateEventPage), findsOneWidget); + + await tester.tap(find.text("Add")); + await tester.pumpAndSettle(); + + await tester.tap(find.byIcon(Icons.close)); + await tester.pumpAndSettle(); + + // expect(find.byType(CreateEventPage), findsNothing); + }); + }); + + testWidgets( + "Check if data coming from view model show up correctly", + (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + }); + }, + ); + + testWidgets("Check if bottom sheet unticking works", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + + await tester.ensureVisible(find.byKey(const Key('inwell_cep2'))); + await tester.pump(); + + // await tester.tap(find.byKey(const Key('text_btn_ambs'))); + await tester.tap( + find.byKey( + const Key('inwell_cep2'), + ), + ); + await tester.pump(); + + await tester.pump(); + await tester.ensureVisible(find.byKey(const Key('text_btn_ambs1'))); + await tester.pumpAndSettle(); + + await tester.tap(find.byType(CheckboxListTile).first); + expect(cachedViewModel.memberCheckedMap['fakeUser1'], true); + await tester.pumpAndSettle(); + }); + + testWidgets( + "Check if deleting members and admins works", + (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //expect(find.text("p s"), findsOneWidget); + expect(find.text("r p"), findsOneWidget); + + //await tester.ensureVisible(find.text("p s")); + // await tester.pumpAndSettle(); + // await tester.tap(find.byIcon(Icons.cancel_rounded).at(0)); + // await tester.pumpAndSettle(const Duration(seconds: 1)); + + //expect(cachedViewModel.selectedAdmins, []); + expect(find.text("r p"), findsOneWidget); + + await tester.ensureVisible(find.text("r p")); + await tester.pumpAndSettle(); + await tester.tap(find.byIcon(Icons.cancel_rounded).at(0)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + //expect(cachedViewModel.selectedAdmins, []); + expect(cachedViewModel.selectedMembers, []); + }); + }, + ); + }); + }); +} diff --git a/test/views/after_auth_screens/events/edit_agenda_item_page_test.dart b/test/views/after_auth_screens/events/edit_agenda_item_page_test.dart new file mode 100644 index 000000000..d27386233 --- /dev/null +++ b/test/views/after_auth_screens/events/edit_agenda_item_page_test.dart @@ -0,0 +1,143 @@ +// ignore_for_file: talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.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/edit_agenda_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/edit_agenda_item_page.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Widget createEditAgendaItemScreen() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return BaseView( + onModelReady: (model) { + model.initialize(testAgendaItem, testCategories); + }, + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: EditAgendaItemPage( + agendaItem: testAgendaItem, + categories: testCategories, + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); +} + +EventAgendaItem testAgendaItem = EventAgendaItem( + id: '1', + title: 'Test Agenda Item', + description: 'Test Description', + duration: '00:30', + categories: [], + attachments: [], + urls: [], +); + +List testCategories = [ + AgendaCategory(id: '1', name: 'Category 1'), + AgendaCategory(id: '2', name: 'Category 2'), +]; + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + locator().test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('EditAgendaItemPage Widget Tests', () { + testWidgets("Check if edit agenda item screen shows up", (tester) async { + await tester.pumpWidget(createEditAgendaItemScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(EditAgendaItemPage), findsOneWidget); + }); + + testWidgets('Category selection works correctly', + (WidgetTester tester) async { + await tester.pumpWidget(createEditAgendaItemScreen()); + await tester.pumpAndSettle(); + + await tester.tap(find.byType(DropdownButtonFormField)); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Category 1').last); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key('Category 1')), findsOneWidget); + }); + + testWidgets('Update button works correctly', (WidgetTester tester) async { + await tester.pumpWidget(createEditAgendaItemScreen()); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Update')); + await tester.pumpAndSettle(); + + expect(find.text("No changes made"), findsOneWidget); + + await tester.tap(find.byType(DropdownButtonFormField)); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Category 1').last); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Update')); + await tester.pumpAndSettle(); + expect(find.byType(EditAgendaItemPage), findsNothing); + }); + + testWidgets('Add URL works correctly', (WidgetTester tester) async { + await tester.pumpWidget(createEditAgendaItemScreen()); + await tester.pumpAndSettle(); + + await tester.enterText( + find.byKey(const Key('urlTextField')), + 'https://example.com', + ); + await tester.pumpAndSettle(); + await tester.tap(find.text('Add')); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key('https://example.com')), findsOneWidget); + }); + + testWidgets('Add Attachments button works correctly', + (WidgetTester tester) async { + await tester.pumpWidget(createEditAgendaItemScreen()); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Add Attachments')); + await tester.pumpAndSettle(); + }); + }); +} 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 000000000..8d80f75f5 --- /dev/null +++ b/test/views/after_auth_screens/events/event_filter_bottomsheet_test.dart @@ -0,0 +1,98 @@ +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() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + locator.unregister(); + registerServices(); + }); + tearDownAll(() { + 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/views/after_auth_screens/events/event_info_body_test.dart b/test/views/after_auth_screens/events/event_info_body_test.dart new file mode 100644 index 000000000..03d8c47af --- /dev/null +++ b/test/views/after_auth_screens/events/event_info_body_test.dart @@ -0,0 +1,243 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.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/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/event_info_body.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Event getTestEvent({ + bool isPublic = false, + bool viewOnMap = true, + bool asAdmin = false, +}) { + return Event( + id: "1", + title: "test_event", + creator: User( + id: asAdmin ? "xzy1" : "acb1", + firstName: "ravidi", + lastName: "shaikh", + ), + isPublic: isPublic, + startDate: "00/00/0000", + endDate: "12/12/9999", + startTime: "00:00", + endTime: "24:00", + location: "iitbhu, varanasi", + description: "test_event_description", + admins: [ + User( + firstName: "ravidi_admin_one", + lastName: "shaikh_admin_one", + ), + User( + firstName: "ravidi_admin_two", + lastName: "shaikh_admin_two", + ), + ], + attendees: [ + Attendee( + id: "1", + firstName: "Test", + lastName: "User", + ), + ], + isRegisterable: true, + ); +} + +final exploreEventsViewModel = ExploreEventsViewModel(); +late EventInfoViewModel _eventInfoViewModel; + +Widget createEventInfoBody({ + bool isPublic = true, + bool viewOnMap = true, + bool asAdmin = false, +}) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return BaseView( + onModelReady: (model) { + model.initialize( + args: { + "event": getTestEvent( + isPublic: isPublic, + viewOnMap: viewOnMap, + asAdmin: asAdmin, + ), + "exploreEventViewModel": exploreEventsViewModel, + }, + ); + + _eventInfoViewModel = model; + }, + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const Scaffold( + body: CustomScrollView( + slivers: [ + EventInfoBody(), + ], + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); +} + +void main() { + // locator().test(); + + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + + testSetupLocator(); + registerServices(); + locator().test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group("Widget Tests for EventInfoBody", () { + testWidgets("Check if EventInfoBody shows up", (tester) async { + await tester.pumpWidget(createEventInfoBody()); + await tester.pumpAndSettle(); + + expect(find.byType(EventInfoBody), findsOneWidget); + expect(find.byType(SliverToBoxAdapter), findsOneWidget); + }); + + testWidgets("Check if all the text shows up correctly", (tester) async { + await tester.pumpWidget(createEventInfoBody()); + await tester.pumpAndSettle(); + + expect(find.text("test_event"), findsOneWidget); + expect(find.text("Created by: ravidi shaikh"), findsOneWidget); + expect(find.text("00/00/0000 - 12/12/9999"), findsOneWidget); + expect(find.text("00:00 - 24:00"), findsOneWidget); + expect(find.text("iitbhu, varanasi"), findsOneWidget); + expect(find.text("test_event_description"), findsOneWidget); + expect(find.text("ravidi_admin_one shaikh_admin_one"), findsOneWidget); + expect(find.text("Test User"), findsOneWidget); // Registrants + }); + + testWidgets( + "Check if all the children show up correctly", + (tester) async { + await tester.pumpWidget(createEventInfoBody()); + await tester.pumpAndSettle(); + }, + ); + + testWidgets("Check if all taps work", (tester) async { + await tester.pumpWidget(createEventInfoBody()); + await tester.pumpAndSettle(); + + // No way to test for now as onTap does nothing. + // Update this test accordingly in future. + + await tester.tap(find.byKey(const Key("Attendee0"))); + await tester.tap(find.byKey(const Key("Admins0"))); + + await tester.pumpAndSettle(); + }); + + testWidgets("Check if edit button appears for creator", (tester) async { + await tester.pumpWidget(createEventInfoBody(asAdmin: true)); + await tester.pumpAndSettle(); + + expect(find.byType(IconButton), findsOneWidget); + await tester.tap(find.byType(IconButton)); + // verify(navigationService.pushScreen("/editEventPage", + // arguments: getTestEvent()),); + }); + + testWidgets("Check if edit button doesn't appear for non creator", + (tester) async { + await tester.pumpWidget(createEventInfoBody(asAdmin: false)); + await tester.pumpAndSettle(); + + expect(find.byType(IconButton), findsNothing); + // verify(navigationService.pushScreen("/editEventPage", arguments: getTestEvent())); + }); + }); + + group("Check if conditional children show up", () { + testWidgets("Private event", (tester) async { + await tester.pumpWidget(createEventInfoBody(isPublic: false)); + await tester.pumpAndSettle(); + + expect(find.text("private"), findsOneWidget); + expect(find.byIcon(Icons.lock), findsOneWidget); + }); + + testWidgets("Public event", (tester) async { + await tester.pumpWidget(createEventInfoBody(isPublic: true)); + await tester.pumpAndSettle(); + + expect(find.text("public"), findsOneWidget); + expect(find.byIcon(Icons.lock_open), findsOneWidget); + }); + + testWidgets("Loading indicator", (tester) async { + // Don't show view on map + + await tester.pumpWidget(createEventInfoBody()); + await tester.pumpAndSettle(); + + // Fully loaded + expect( + find.byWidgetPredicate( + (widget) => + widget is SliverToBoxAdapter && + widget.child is Padding && + (widget.child! as Padding).child is Column && + ((widget.child! as Padding).child! as Column).children.last + is ListView, + ), + findsOneWidget, + ); + + // Model is loading + _eventInfoViewModel.setState(ViewState.busy); + await tester.pump(); + + expect( + find.byWidgetPredicate( + (widget) => + widget is SliverToBoxAdapter && + widget.child is Padding && + (widget.child! as Padding).child is Column && + ((widget.child! as Padding).child! as Column).children.last + is Padding, + ), + findsOneWidget, + ); + }); + }); +} diff --git a/test/views/after_auth_screens/events/manage_agenda_items_screen_test.dart b/test/views/after_auth_screens/events/manage_agenda_items_screen_test.dart new file mode 100644 index 000000000..ef8d28206 --- /dev/null +++ b/test/views/after_auth_screens/events/manage_agenda_items_screen_test.dart @@ -0,0 +1,248 @@ +// ignore_for_file: talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/create_agenda_item_page.dart'; +import 'package:talawa/views/after_auth_screens/events/manage_agenda_items_screen.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/agenda_item_tile.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Event getTestEvent({ + bool isPublic = false, + bool viewOnMap = true, + bool asAdmin = false, +}) { + return Event( + id: "1", + title: "test_event", + creator: User( + id: asAdmin ? "xzy1" : "acb1", + firstName: "ravidi", + lastName: "shaikh", + ), + isPublic: isPublic, + startDate: "00/00/0000", + endDate: "12/12/9999", + startTime: "00:00", + endTime: "24:00", + location: "iitbhu, varanasi", + description: "test_event_description", + admins: [ + User( + firstName: "ravidi_admin_one", + lastName: "shaikh_admin_one", + ), + User( + firstName: "ravidi_admin_two", + lastName: "shaikh_admin_two", + ), + ], + attendees: [ + Attendee( + id: "1", + firstName: "Test", + lastName: "User", + ), + ], + isRegisterable: true, + ); +} + +Widget createManageAgendaScreen() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return BaseView( + onModelReady: (model) { + model.initialize( + args: { + "event": getTestEvent( + isPublic: true, + viewOnMap: false, + asAdmin: true, + ), + "exploreEventViewModel": ExploreEventsViewModel(), + }, + ); + }, + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const Scaffold( + body: ManageAgendaScreen(), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + locator().test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('ManageAgendaScreen Widget Tests', () { + testWidgets('Shows empty state when no agenda items', + (WidgetTester tester) async { + await tester.pumpWidget(createManageAgendaScreen()); + await tester.pumpAndSettle(); + + expect(find.text('No agenda items yet'), findsOneWidget); + expect(find.byType(ReorderableListView), findsNothing); + }); + + testWidgets('Shows list of agenda items when present', + (WidgetTester tester) async { + final mockResult = QueryResult( + source: QueryResultSource.network, + data: { + 'agendaItemByEvent': [ + { + 'id': '1', + 'title': 'Agenda 1', + 'duration': '1h', + 'sequence': 1, + }, + { + 'id': '2', + 'title': 'Agenda 2', + 'duration': '30m', + 'sequence': 2, + }, + ], + }, + options: QueryOptions( + document: gql(EventQueries().fetchAgendaItemsByEvent('1')), + ), + ); + + when(eventService.fetchAgendaItems('1')) + .thenAnswer((_) async => mockResult); + + await tester.pumpWidget(createManageAgendaScreen()); + await tester.pumpAndSettle(); + + expect(find.text('No agenda items yet'), findsNothing); + expect(find.byType(ReorderableListView), findsOneWidget); + expect(find.byType(ExpandableAgendaItemTile), findsNWidgets(2)); + }); + + testWidgets('Can reorder agenda items', (WidgetTester tester) async { + final mockResult = QueryResult( + source: QueryResultSource.network, + data: { + 'agendaItemByEvent': [ + { + '_id': '1', + 'title': 'Agenda 1', + 'duration': '1h', + 'sequence': 1, + }, + { + '_id': '2', + 'title': 'Agenda 2', + 'duration': '30m', + 'sequence': 2, + }, + ], + }, + options: QueryOptions( + document: gql(EventQueries().fetchAgendaItemsByEvent('1')), + ), + ); + + when(eventService.fetchAgendaItems('1')) + .thenAnswer((_) async => mockResult); + + await tester.pumpWidget(createManageAgendaScreen()); + await tester.pumpAndSettle(); + + final firstItemFinder = find.text('Agenda 1'); + final secondItemFinder = find.text('Agenda 2'); + + expect(firstItemFinder, findsOneWidget); + expect(secondItemFinder, findsOneWidget); + + await tester.drag( + find.byKey(const Key('reorder_icon')).first, + const Offset(0, 200), + ); + await tester.pumpAndSettle(); + }); + + testWidgets('Can delete agenda item', (WidgetTester tester) async { + final mockResult = QueryResult( + source: QueryResultSource.network, + data: { + 'agendaItemByEvent': [ + { + '_id': '1', + 'title': 'Agenda 1', + 'duration': '1h', + 'sequence': 1, + }, + { + '_id': '2', + 'title': 'Agenda 2', + 'duration': '30m', + 'sequence': 2, + }, + ], + }, + options: QueryOptions( + document: gql(EventQueries().fetchAgendaItemsByEvent('1')), + ), + ); + + when(eventService.fetchAgendaItems('1')) + .thenAnswer((_) async => mockResult); + when(eventService.deleteAgendaItem({"removeAgendaItemId": '1'})) + .thenAnswer((_) async => true); + await tester.pumpWidget(createManageAgendaScreen()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key("delete_agenda_item1"))); + await tester.pump(); + }); + + testWidgets('Can navigate to CreateAgendaItemPage', + (WidgetTester tester) async { + await tester.pumpWidget(createManageAgendaScreen()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('add_item_btn'))); + await tester.pumpAndSettle(); + + expect(find.byType(CreateAgendaItemPage), findsOneWidget); + }); + }); +} diff --git a/test/views/after_auth_screens/events/manage_volunteer_group_test.dart b/test/views/after_auth_screens/events/manage_volunteer_group_test.dart new file mode 100644 index 000000000..e17852ab4 --- /dev/null +++ b/test/views/after_auth_screens/events/manage_volunteer_group_test.dart @@ -0,0 +1,407 @@ +// ignore_for_file: talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/manage_volunteer_group.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Event getTestEvent({ + bool isPublic = true, + bool asAdmin = false, +}) { + return Event( + id: "1", + title: "test_event", + creator: User( + id: asAdmin ? "xzy1" : "acb1", + firstName: "ravidi", + lastName: "shaikh", + ), + isPublic: isPublic, + startDate: "00/00/0000", + endDate: "12/12/9999", + startTime: "00:00", + endTime: "24:00", + location: "iitbhu, varanasi", + description: "test_event_description", + admins: [ + User( + firstName: "ravidi_admin_one", + lastName: "shaikh_admin_one", + ), + User( + firstName: "ravidi_admin_two", + lastName: "shaikh_admin_two", + ), + ], + attendees: [ + Attendee( + id: "1", + firstName: "Test", + lastName: "User", + ), + ], + isRegisterable: true, + ); +} + +EventVolunteerGroup group1 = EventVolunteerGroup( + id: "volunteer_group", + event: Event(id: "1"), + creator: User(id: "creator_id"), + volunteers: [ + EventVolunteer( + id: "volunteer_id_1", + user: User( + firstName: "first1", + lastName: "last1", + ), + response: null, + ), + EventVolunteer( + id: "volunteer_id_2", + user: User( + firstName: "first2", + lastName: "last2", + ), + response: null, + ), + ], + volunteersRequired: 2, + name: "test_group", +); + +EventVolunteerGroup group2 = EventVolunteerGroup( + id: "volunteer_group2", + event: Event(id: "1"), + creator: User(id: "creator_id"), + volunteers: [], + volunteersRequired: 2, + name: "test_group", +); + +Widget createManageGroupScreen1(EventVolunteerGroup group) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return BaseView( + onModelReady: (model) { + model.initialize(getTestEvent(), group); + }, + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: ManageGroupScreen( + group: group, + event: getTestEvent(), + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + + testSetupLocator(); + registerServices(); + locator().test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group("Widget Tests for ManageGroupScreen", () { + testWidgets("Check if ManageGroupScreen shows up", (tester) async { + await tester.pumpWidget(createManageGroupScreen1(group1)); + await tester.pumpAndSettle(); + + expect(find.byType(ManageGroupScreen), findsOneWidget); + }); + + testWidgets("Check if all volunteers shows up correctly", (tester) async { + await tester.pumpWidget(createManageGroupScreen1(group1)); + await tester.pumpAndSettle(); + + expect(find.byType(ManageGroupScreen), findsOneWidget); + expect(find.text('No volunteers yet'), findsNothing); + expect(find.text("first1 last1"), findsOneWidget); + expect(find.text("first2 last2"), findsOneWidget); + expect(find.text("Add Volunteers"), findsOneWidget); + }); + + testWidgets( + "Check if edit group button work properly", + (tester) async { + final mockEventService = locator(); + final mockResult = { + 'updateEventVolunteerGroup': { + 'id': 'volunteer_group', + }, + }; + + when( + mockEventService.updateVolunteerGroup({ + 'id': group1.id, + 'data': { + 'eventId': getTestEvent().id, + 'name': "Updated Group", + 'volunteersRequired': 20, + }, + }), + ).thenAnswer( + (_) async => QueryResult( + data: mockResult, + source: QueryResultSource.network, + options: QueryOptions( + document: gql(EventQueries().updateVolunteerGroupMutation()), + ), + ), + ); + await tester.pumpWidget(createManageGroupScreen1(group1)); + await tester.pumpAndSettle(); + + expect(find.byType(ManageGroupScreen), findsOneWidget); + expect(find.text('No volunteers yet'), findsNothing); + expect(find.text("first1 last1"), findsOneWidget); + expect(find.text('Add Volunteers'), findsOneWidget); + expect(find.text("Edit Group"), findsOneWidget); + + await tester.tap(find.text("Edit Group")); + await tester.pumpAndSettle(); + + expect(find.byType(AlertDialog), findsOneWidget); + + await tester.tap(find.text("Cancel")); + await tester.pumpAndSettle(); + + expect(find.byType(AlertDialog), findsNothing); + + await tester.tap(find.text("Edit Group")); + await tester.pumpAndSettle(); + + expect(find.byType(AlertDialog), findsOneWidget); + + await tester.enterText( + find.byKey(const Key('groupNameField')), + 'Updated Group', + ); + + await tester.pumpAndSettle(); + await tester.enterText( + find.byKey(const Key('groupVolunteerRequiredField')), + '20', + ); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Save')); + await tester.pumpAndSettle(); + + expect(find.byType(AlertDialog), findsNothing); + + expect(find.text('Updated Group'), findsOneWidget); + }, + ); + + testWidgets("Check add volunteer button work properly", (tester) async { + final mockEventService = locator(); + + final mockResult1 = { + 'createEventVolunteer': { + '_id': "fakeUser1", + 'user': { + '_id': "fakeUser1", + 'firstName': 'Parag', + 'lastName': 'xoxo', + }, + 'response': null, + }, + }; + + final mockResult2 = { + 'createEventVolunteer': { + '_id': "fakeUser2", + 'user': { + '_id': "fakeUser2", + 'firstName': 'Parag1', + 'lastName': 'xoxo', + }, + 'response': null, + }, + }; + + when( + mockEventService.addVolunteerToGroup({ + 'eventId': "1", + 'userId': "fakeUser1", + 'groupId': "volunteer_group", + }), + ).thenAnswer( + (_) async => QueryResult( + data: mockResult1, + source: QueryResultSource.network, + options: + QueryOptions(document: gql(EventQueries().addVolunteerToGroup())), + ), + ); + + when( + mockEventService.addVolunteerToGroup({ + 'eventId': "1", + 'userId': "fakeUser2", + 'groupId': "volunteer_group", + }), + ).thenAnswer( + (_) async => QueryResult( + data: mockResult2, + source: QueryResultSource.network, + options: + QueryOptions(document: gql(EventQueries().addVolunteerToGroup())), + ), + ); + await tester.pumpWidget(createManageGroupScreen1(group1)); + await tester.pumpAndSettle(); + + expect(find.byType(ManageGroupScreen), findsOneWidget); + expect(find.text('No volunteers yet'), findsNothing); + expect(find.text("first1 last1"), findsOneWidget); + expect(find.text('Add Volunteers'), findsOneWidget); + expect(find.text("Edit Group"), findsOneWidget); + + await tester.tap(find.text("Add Volunteers")); + await tester.pumpAndSettle(); + + expect( + find.byKey( + const Key("bottomSheetContainer"), + ), + findsOneWidget, + ); + + expect( + find.byKey( + const Key("members_list_key"), + ), + findsOneWidget, + ); + expect( + find.byKey( + const Key("checkBox0"), + ), + findsOneWidget, + ); + + await tester.tap( + find.byKey( + const Key("checkBox0"), + ), + ); + await tester.tap( + find.byKey( + const Key("checkBox1"), + ), + ); + await tester.pumpAndSettle(); + + await tester.tap(find.text("Done")); + await tester.pumpAndSettle(); + + await tester.tap(find.text("Add Volunteers")); + await tester.pumpAndSettle(); + + expect( + find.byKey( + const Key("members_list_key"), + ), + findsNothing, + ); + }); + + testWidgets("Check if deleting volunteer work properly", (tester) async { + await tester.pumpWidget(createManageGroupScreen1(group1)); + await tester.pumpAndSettle(); + + expect(find.byType(ManageGroupScreen), findsOneWidget); + expect(find.text('No volunteers yet'), findsNothing); + expect(find.text("first1 last1"), findsOneWidget); + expect(find.text('Add Volunteers'), findsOneWidget); + expect(find.text("Edit Group"), findsOneWidget); + + expect(find.byKey(const Key("volunteers")), findsNWidgets(2)); + + await tester.tap(find.byKey(const Key("delete_volunteer0"))); + await tester.pumpAndSettle(); + }); + + testWidgets("Check if no volunteer text shows up when no volunteer", + (tester) async { + await tester.pumpWidget(createManageGroupScreen1(group2)); + await tester.pumpAndSettle(); + + expect(find.byType(ManageGroupScreen), findsOneWidget); + expect(find.text('No volunteers yet'), findsOneWidget); + expect(find.text('Add Volunteers'), findsOneWidget); + expect(find.text("Edit Group"), findsOneWidget); + }); + + testWidgets("Check if deleting volunteer group work properly", + (tester) async { + await tester.pumpWidget(createManageGroupScreen1(group1)); + await tester.pumpAndSettle(); + + expect(find.byType(ManageGroupScreen), findsOneWidget); + expect(find.text('No volunteers yet'), findsNothing); + expect(find.text("first1 last1"), findsOneWidget); + expect(find.text('Add Volunteers'), findsOneWidget); + expect(find.text("Edit Group"), findsOneWidget); + + expect(find.byKey(const Key("volunteers")), findsNWidgets(2)); + + await tester.tap(find.text('Delete Group')); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("Delete_group_dialogue")), findsOneWidget); + + await tester.tap(find.text("Cancel")); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("Delete_group_dialogue")), findsNothing); + + await tester.tap(find.text('Delete Group')); + await tester.pumpAndSettle(); + + await tester.tap(find.text("Delete")); + await tester.pumpAndSettle(); + }); + }); +} diff --git a/test/views/after_auth_screens/events/venue_bottom_sheet_test.dart b/test/views/after_auth_screens/events/venue_bottom_sheet_test.dart new file mode 100644 index 000000000..5e8faf613 --- /dev/null +++ b/test/views/after_auth_screens/events/venue_bottom_sheet_test.dart @@ -0,0 +1,159 @@ +// ignore_for_file: talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:network_image_mock/network_image_mock.dart'; +import 'package:talawa/models/events/event_venue.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/after_auth_screens/events/venue_bottom_sheet.dart'; +import 'package:talawa/widgets/venue_card.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Widget createVenueBottomSheet(List venues) { + return MaterialApp( + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: VenueBottomSheet(venues: venues), + ), + ); +} + +List venues = [ + Venue( + id: '1', + capacity: 100, + description: 'A beautiful venue for events.', + imageUrl: 'http://localhost:4000/images/venue1.jpg', + name: 'Main Hall', + organizationId: 'org1', + ), + Venue( + id: '2', + capacity: 50, + description: 'A small cozy venue.', + imageUrl: 'http://localhost:4000/images/venue2.jpg', + name: 'Conference Room', + organizationId: 'org2', + ), +]; + +void main() { + testSetupLocator(); + group('VenueBottomSheet Widget Tests', () { + setUp(() { + registerServices(); + locator().test(); + }); + + testWidgets('Displays venues correctly', (WidgetTester tester) async { + await mockNetworkImagesFor(() async { + await tester.pumpWidget(createVenueBottomSheet(venues)); + await tester.pumpAndSettle(); + + expect(find.text('Add Venue'), findsOneWidget); + expect(find.byType(VenueCard), findsNWidgets(venues.length)); + expect(find.text('Main Hall'), findsOneWidget); + expect(find.text('Conference Room'), findsOneWidget); + + expect(find.byKey(const Key('gestureDetector1')), findsOneWidget); + await tester.tap(find.byKey(const Key('gestureDetector1'))); + await tester.pumpAndSettle(); + }); + }); + + testWidgets('Searches venues correctly', (WidgetTester tester) async { + await mockNetworkImagesFor(() async { + await tester.pumpWidget(createVenueBottomSheet(venues)); + await tester.pumpAndSettle(); + + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + expect(find.byType(TextField), findsOneWidget); + + await tester.enterText(find.byType(TextField), 'Main'); + await tester.pumpAndSettle(); + + expect(find.byType(VenueCard), findsOneWidget); + expect(find.text('Main Hall'), findsOneWidget); + expect(find.text('Conference Room'), findsNothing); + + await tester.tap(find.byIcon(Icons.close)); + await tester.pumpAndSettle(); + + expect(find.byType(VenueCard), findsNWidgets(venues.length)); + }); + }); + + testWidgets('Selects a venue correctly', (WidgetTester tester) async { + await mockNetworkImagesFor(() async { + await tester.pumpWidget(createVenueBottomSheet(venues)); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Main Hall')); + await tester.pumpAndSettle(); + + expect(find.byIcon(Icons.check), findsOneWidget); + + await tester.tap(find.byIcon(Icons.check)); + await tester.pumpAndSettle(); + + expect(find.byIcon(Icons.arrow_back), findsNothing); + }); + }); + + testWidgets('Shows no venues available when list is empty', + (WidgetTester tester) async { + await mockNetworkImagesFor(() async { + await tester.pumpWidget(createVenueBottomSheet([])); + await tester.pumpAndSettle(); + + expect(find.text('No Venues added yet'), findsOneWidget); + }); + }); + testWidgets( + 'Shows no venues available when search query doesnt match with any venue', + (WidgetTester tester) async { + await mockNetworkImagesFor(() async { + await tester.pumpWidget(createVenueBottomSheet(venues)); + await tester.pumpAndSettle(); + + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + expect(find.byType(TextField), findsOneWidget); + + await tester.enterText(find.byType(TextField), 'abc'); + await tester.pumpAndSettle(); + + expect(find.byType(VenueCard), findsNothing); + expect(find.text('Main Hall'), findsNothing); + expect(find.text('Conference Room'), findsNothing); + expect(find.text('No venues available'), findsOneWidget); + + await tester.tap(find.byIcon(Icons.close)); + await tester.pumpAndSettle(); + + expect(find.byType(VenueCard), findsNWidgets(venues.length)); + }); + }); + }); +} diff --git a/test/views/after_auth_screens/events/volunteer_groups_screen_test.dart b/test/views/after_auth_screens/events/volunteer_groups_screen_test.dart new file mode 100644 index 000000000..69ca00a3f --- /dev/null +++ b/test/views/after_auth_screens/events/volunteer_groups_screen_test.dart @@ -0,0 +1,350 @@ +// ignore_for_file: talawa_api_doc, unused_element +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/events/event_volunteer_group.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/event_queries.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/volunteer_groups_screen.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Event getTestEvent({ + bool isPublic = false, + bool viewOnMap = true, + bool asAdmin = false, +}) { + return Event( + id: "1", + title: "test_event", + creator: User( + id: asAdmin ? "xzy1" : "acb1", + firstName: "ravidi", + lastName: "shaikh", + ), + isPublic: isPublic, + startDate: "00/00/0000", + endDate: "12/12/9999", + startTime: "00:00", + endTime: "24:00", + location: "iitbhu, varanasi", + description: "test_event_description", + admins: [ + User( + firstName: "ravidi_admin_one", + lastName: "shaikh_admin_one", + ), + User( + firstName: "ravidi_admin_two", + lastName: "shaikh_admin_two", + ), + ], + attendees: [ + Attendee( + id: "1", + firstName: "Test", + lastName: "User", + ), + ], + isRegisterable: true, + ); +} + +Widget volunteerGroupsScreen({ + bool isPublic = true, + bool viewOnMap = true, + bool asAdmin = true, +}) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return BaseView( + onModelReady: (model) { + model.initialize( + args: { + "event": getTestEvent(), + "exploreEventViewModel": ExploreEventsViewModel(), + }, + ); + }, + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: VolunteerGroupsScreen( + event: getTestEvent(), + model: EventInfoViewModel(), + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + + testSetupLocator(); + registerServices(); + + locator().test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group("Widget Tests for VolunteerGroupscreen", () { + testWidgets("Check if VolunteerGroupscreen shows up", (tester) async { + await tester.pumpWidget(volunteerGroupsScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + }); + + testWidgets( + "Check if no groups are displayed when there are no volunteer groups", + (tester) async { + await tester.pumpWidget(volunteerGroupsScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + expect(find.text("There aren't any volunteer groups"), findsOneWidget); + }); + testWidgets("Check if groups show up", (tester) async { + final mockEventService = locator(); + final mockGroups = [ + EventVolunteerGroup(name: "Group 1", createdAt: "2027-09-08"), + EventVolunteerGroup(name: "Group 2", createdAt: "2027-09-09"), + ]; + final mockResult2 = { + 'createEventVolunteerGroup': { + '_id': "fakeUser2", + 'name': "New Group", + 'volunteersRequired': 5, + 'volunteers': [], + }, + }; + + when(mockEventService.fetchVolunteerGroupsByEvent("1")) + .thenAnswer((_) async => mockGroups); + + when( + mockEventService.createVolunteerGroup({ + 'eventId': "1", + 'name': "New Group", + 'volunteersRequired': 5, + }), + ).thenAnswer( + (realInvocation) async => QueryResult( + data: mockResult2, + source: QueryResultSource.network, + options: QueryOptions( + document: gql(EventQueries().createVolunteerGroup()), + ), + ), + ); + + await tester.pumpWidget(volunteerGroupsScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + expect(find.text("There aren't any volunteer groups"), findsNothing); + expect(find.byKey(const Key("group_data")), findsNWidgets(2)); + + expect(find.byKey(const Key("add_group_btn")), findsOneWidget); + await tester.tap(find.byKey(const Key("add_group_btn"))); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("add_grp_dialogue")), findsOneWidget); + + await tester.enterText( + find.byKey(const Key("group_name_field")), + "New Group", + ); + await tester.enterText( + find.byKey(const Key("volunteers_required_field")), + "5", + ); + + await tester.tap(find.text('Create Group')); + await tester.pumpAndSettle(); + + expect( + find.text('Failed to create group'), + findsNothing, + ); + }); + testWidgets("Check if edit group icon show up", (tester) async { + final mockEventService = locator(); + final mockGroups = [ + EventVolunteerGroup( + name: "Group 1", + createdAt: "2027-09-08", + volunteersRequired: 5, + ), + EventVolunteerGroup( + name: "Group 2", + createdAt: "2027-09-09", + volunteersRequired: 5, + ), + ]; + + when(mockEventService.fetchVolunteerGroupsByEvent("1")) + .thenAnswer((_) async => mockGroups); + + await tester.pumpWidget(volunteerGroupsScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + expect(find.text("There aren't any volunteer groups"), findsNothing); + expect(find.byKey(const Key("group_data")), findsNWidgets(2)); + + expect(find.byIcon(Icons.edit), findsNWidgets(2)); + + await tester.tap(find.byIcon(Icons.edit).first); + await tester.pumpAndSettle(); + }); + testWidgets("Check if no groups show up", (tester) async { + final mockEventService = locator(); + + when(mockEventService.fetchVolunteerGroupsByEvent("1")) + .thenAnswer((_) async => []); + + await tester.pumpWidget(volunteerGroupsScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + expect(find.text("There aren't any volunteer groups"), findsOneWidget); + }); + testWidgets("Check if add group method throw error show up", + (tester) async { + final mockEventService = locator(); + final mockGroups = [ + EventVolunteerGroup(name: "Group 1", createdAt: "2027-09-08"), + EventVolunteerGroup(name: "Group 2", createdAt: "2027-09-09"), + ]; + + when(mockEventService.fetchVolunteerGroupsByEvent("1")) + .thenAnswer((_) async => mockGroups); + + when( + mockEventService.createVolunteerGroup({ + 'eventId': "1", + 'name': "New Group", + 'volunteersRequired': 5, + }), + ).thenThrow("exception"); + + await tester.pumpWidget(volunteerGroupsScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + expect(find.text("There aren't any volunteer groups"), findsNothing); + expect(find.byKey(const Key("group_data")), findsNWidgets(2)); + + expect(find.byKey(const Key("add_group_btn")), findsOneWidget); + await tester.tap(find.byKey(const Key("add_group_btn"))); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("add_grp_dialogue")), findsOneWidget); + expect(find.text("Cancel"), findsOneWidget); + + await tester.tap(find.text("Cancel")); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("add_grp_dialogue")), findsNothing); + await tester.tap(find.byKey(const Key("add_group_btn"))); + await tester.pumpAndSettle(); + + await tester.enterText( + find.byKey(const Key("group_name_field")), + "New Group", + ); + await tester.enterText( + find.byKey(const Key("volunteers_required_field")), + "5", + ); + + await tester.tap(find.text('Create Group')); + await tester.pumpAndSettle(); + + expect( + find.text('Failed to create group'), + findsOneWidget, + ); + }); + testWidgets("Check if add group method throw entre data show up", + (tester) async { + final mockEventService = locator(); + final mockGroups = [ + EventVolunteerGroup(name: "Group 1", createdAt: "2027-09-08"), + EventVolunteerGroup(name: "Group 2", createdAt: "2027-09-09"), + ]; + + when(mockEventService.fetchVolunteerGroupsByEvent("1")) + .thenAnswer((_) async => mockGroups); + + when( + mockEventService.createVolunteerGroup({ + 'eventId': "1", + 'name': "New Group", + 'volunteersRequired': 5, + }), + ).thenThrow("exception"); + + await tester.pumpWidget(volunteerGroupsScreen()); + await tester.pumpAndSettle(); + + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + expect(find.text("There aren't any volunteer groups"), findsNothing); + expect(find.byKey(const Key("group_data")), findsNWidgets(2)); + + expect(find.byKey(const Key("add_group_btn")), findsOneWidget); + await tester.tap(find.byKey(const Key("add_group_btn"))); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("add_grp_dialogue")), findsOneWidget); + + await tester.enterText( + find.byKey(const Key("group_name_field")), + "", + ); + await tester.enterText( + find.byKey(const Key("volunteers_required_field")), + "0", + ); + + await tester.tap(find.text('Create Group')); + await tester.pumpAndSettle(); + + expect( + find.text('Please enter valid data'), + findsOneWidget, + ); + }); + }); +} diff --git a/test/views/after_auth_screens/feed/individual_post_test.dart b/test/views/after_auth_screens/feed/individual_post_test.dart new file mode 100644 index 000000000..351be4fef --- /dev/null +++ b/test/views/after_auth_screens/feed/individual_post_test.dart @@ -0,0 +1,331 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/comment/comment_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/feed/individual_post.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/post_widget.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Widget createIndividualPostViewWidget(Post post) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: IndividualPostView(post: post), + navigatorKey: navigationService.navigatorKey, + ); + }, + ); +} + +final LikedBy user = LikedBy(sId: "test_id"); + +final u1 = User( + id: '123', + firstName: 'Lakshay', + lastName: 'Gupta', + email: 'test@test.com', +); +final u2 = User( + id: '123', + firstName: 'Ankit', + lastName: 'Varshney', + email: 'test@test.com', +); +final List users = [u1, u2]; +List comments = [ + Comments(sId: 'comment1'), + Comments(sId: 'comment2'), + Comments(sId: 'comment3'), + Comments(sId: 'comment4'), + Comments(sId: 'comment5'), + Comments(sId: 'comment6'), +]; +final comment = Comment( + creator: User( + id: '123', + firstName: 'Ankit', + lastName: 'Varshney', + email: 'test@test.com', + ), + createdAt: '123456', + text: 'test text', + post: 'test post', + likeCount: 'test count', +); + +final LikedBy l1 = LikedBy(sId: 'test1'); +final LikedBy l2 = LikedBy(sId: 'test2'); +final List likeby = [l1, l2]; + +final comment1 = Comments(sId: 'comment1'); +final comment2 = Comments(sId: 'comment2'); +final comment3 = Comments(sId: 'comment3'); +final List comments1 = [comment1, comment2, comment3]; + +final myBirthday = DateTime.utc(2004, DateTime.june, 16, 5, 30, 0, 0, 0); +final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday, + description: 'test description', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments1, +); +Widget createLikedUserCircleAvatar(LikedBy user) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: likedUserCircleAvatar(user), + navigatorKey: navigationService.navigatorKey, + ); + }, + ); +} + +Widget createIndividualPageLikeSection() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: IndividualPageLikeSection( + usersLiked: [ + LikedBy(sId: 'test1'), + LikedBy(sId: 'test2'), + LikedBy(sId: 'test3'), + LikedBy(sId: 'test4'), + ], + ), + navigatorKey: navigationService.navigatorKey, + ); + }, + ); +} + +Widget createIndividualPostCommentSectionWidget() { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: BaseView( + onModelReady: (model) { + model.initialize(); + }, + builder: (context, model, child) { + return IndividualPostCommentSection( + comments: comments, + postID: 'test post id', + ); + }, + ), + ); +} + +Widget createCommentTemplateWidget(Comment comment) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: BaseView( + onModelReady: (model) { + model.initialize(); + }, + builder: (context, model, child) { + return CommentTemplate(comment: comment); + }, + ), + ); +} + +void main() { + setUpAll(() { + SizeConfig().test(); + testSetupLocator(); + registerServices(); + }); + + group("testing Individual Post View ", () { + testWidgets("Check if Send button is disabled", + (WidgetTester tester) async { + await tester.pumpWidget(createIndividualPostViewWidget(post)); + await tester.pumpAndSettle(); + + final textFieldFinder = find.byKey(const Key('indi_post_tf_key')); + final textButtonFinder = find.byKey(const Key('sendButton')); + expect(tester.widget(textButtonFinder).enabled, isFalse); + + // Clear the text field + await tester.enterText(textFieldFinder, ''); + await tester.pumpAndSettle(); + // The button should be disabled after clearing the text + expect(tester.widget(textButtonFinder).enabled, isFalse); + + expect(find.byType(NewsPost), findsOneWidget); + expect(find.byType(IndividualPageLikeSection), findsOneWidget); + expect(find.byType(IndividualPostCommentSection), findsOneWidget); + }); + testWidgets("Check if Send button is enabled and working", + (WidgetTester tester) async { + await tester.pumpWidget(createIndividualPostViewWidget(post)); + await tester.pumpAndSettle(); + + final textFieldFinder = find.byKey(const Key('indi_post_tf_key')); + final textButtonFinder = find.byKey(const Key('sendButton')); + expect(tester.widget(textButtonFinder).enabled, isFalse); + + // Clear the text field + await tester.enterText(textFieldFinder, ''); + await tester.pumpAndSettle(); + // The button should be disabled after clearing the text + expect(tester.widget(textButtonFinder).enabled, isFalse); + + // Enter non-empty text + await tester.enterText(textFieldFinder, 'Test Comment'); + await tester.pumpAndSettle(); + // The button should now be enabled + expect(tester.widget(textButtonFinder).enabled, isTrue); + + // Verify that the text field is cleared + expect(find.text('Test Comment'), findsOneWidget); + + // Tap the send button + await tester.tap(textButtonFinder); + await tester.pumpAndSettle(); + + expect(find.byType(NewsPost), findsOneWidget); + expect(find.byType(IndividualPageLikeSection), findsOneWidget); + expect(find.byType(IndividualPostCommentSection), findsOneWidget); + }); + testWidgets("Checking if state changes when text is cleared", + (WidgetTester tester) async { + await tester.pumpWidget(createIndividualPostViewWidget(post)); + await tester.pumpAndSettle(); + + final textFieldFinder = find.byKey(const Key('indi_post_tf_key')); + final textButtonFinder = find.byKey(const Key('sendButton')); + expect(tester.widget(textButtonFinder).enabled, isFalse); + + // Clear the text field + await tester.enterText(textFieldFinder, ''); + await tester.pumpAndSettle(); + // The button should be disabled after clearing the text + expect(tester.widget(textButtonFinder).enabled, isFalse); + + // Enter non-empty text + await tester.enterText(textFieldFinder, 'Test Comment'); + await tester.pumpAndSettle(); + // The button should now be enabled + expect(tester.widget(textButtonFinder).enabled, isTrue); + + // Verify that the text field is cleared + expect(find.text('Test Comment'), findsOneWidget); + + // Testing if state changes back + await tester.enterText(textFieldFinder, ''); + await tester.pumpAndSettle(); + expect(tester.widget(textButtonFinder).enabled, isFalse); + + // Tap the send button + await tester.tap(textButtonFinder); + await tester.pumpAndSettle(); + + expect(find.byType(NewsPost), findsOneWidget); + expect(find.byType(IndividualPageLikeSection), findsOneWidget); + expect(find.byType(IndividualPostCommentSection), findsOneWidget); + }); + }); + + group("Test for likedUserCircleAvatar", () { + testWidgets("checking if likedUserCircleAvatar widget correctly shows up", + (WidgetTester tester) async { + await tester.pumpWidget(createLikedUserCircleAvatar(user)); + await tester.pumpAndSettle(); + + expect(find.byType(CircleAvatar), findsOneWidget); + }); + }); + group("Test for IndividualPageLikeSection", () { + testWidgets( + "checking if IndividualPageLikeSection widget correctly shows up", + (WidgetTester tester) async { + await tester.pumpWidget(createIndividualPageLikeSection()); + await tester.pumpAndSettle(); + expect(find.text("Liked by"), findsOneWidget); + + expect(find.byType(Row), findsOneWidget); + expect( + find.byWidget(likedUserCircleAvatar(user)), + findsNWidgets(4), + ); + }); + }); + + group("Test for IndividualPostCommentSection", () { + testWidgets( + "checking if IndividualPostCommentSection widget correctly shows up", + (WidgetTester tester) async { + await tester.pumpWidget(createIndividualPostCommentSectionWidget()); + await tester.pumpAndSettle(); + + expect(find.text("Comments"), findsOneWidget); + }); + }); + group("Test for CommentTemplate", () { + testWidgets("checking the comment template widgets", + (WidgetTester tester) async { + await tester.pumpWidget(createCommentTemplateWidget(comment)); + await tester.pumpAndSettle(); + + expect(find.byType(Row), findsOneWidget); + expect(find.byType(CircleAvatar), findsOneWidget); + expect(find.byType(Column), findsOneWidget); + expect( + find.text( + "${comment.creator!.firstName!} ${comment.creator!.lastName!}", + ), + findsOneWidget, + ); + expect(find.text(comment.text!), findsOneWidget); + }); + }); +} diff --git a/test/views/after_auth_screens/feed/pinned_post_screen.dart b/test/views/after_auth_screens/feed/pinned_post_screen.dart new file mode 100644 index 000000000..0913743cd --- /dev/null +++ b/test/views/after_auth_screens/feed/pinned_post_screen.dart @@ -0,0 +1,144 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:file/local.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:get_it/get_it.dart'; +import 'package:mockito/mockito.dart'; +import 'package:network_image_mock/network_image_mock.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/feed/pinned_post_screen.dart'; +import 'package:talawa/views/base_view.dart'; +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +class MockCacheManager extends Mock implements DefaultCacheManager { + static const fileSystem = LocalFileSystem(); + + @override + Stream getImageFile( + String url, { + String? key, + Map? headers, + bool withProgress = true, + int? maxHeight, + int? maxWidth, + }) async* { + if (url == "wrong_url") { + throw Exception("File not found"); + } else { + yield FileInfo( + fileSystem.file(url), + FileSource.Cache, + DateTime(2050), + url, + ); + } + } +} + +Widget createApp() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const PinnedPostScreen( + post: { + 'title': 'Sample Title', + 'time': '23:00', + 'postId': 'postId', + 'imageUrl': 'imageUrl', + }, + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); +} + +Future showPinnedPostScreen(WidgetTester tester) async { + await tester.pumpWidget(createApp()); + await tester.pumpAndSettle(); +} + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + setUp(() { + registerServices(); + locator().test(); + }); + GetIt.instance.registerSingleton( + MockCacheManager(), + ); + + GetIt.instance.registerSingleton( + NavigationService(), + ); + + GetIt.instance.registerSingleton( + SizeConfig(), + ); + + tearDown(() { + unregisterServices(); + }); + + testWidgets('Check if Pinned Post Screen page shows up', (tester) async { + await showPinnedPostScreen(tester); + expect(find.byType(SafeArea), findsOneWidget); + }); + + group('Check if Pinned Post Screen page has -', () { + testWidgets('Title', (tester) async { + await showPinnedPostScreen(tester); + expect(find.text('Sample Title'), findsOneWidget); + }); + + testWidgets('Time', (tester) async { + await showPinnedPostScreen(tester); + expect(find.text('23:00hr'), findsOneWidget); + }); + }); + + // Check if cached network image is working + testWidgets('Check if CachedNetworkImage is working', (tester) async { + await mockNetworkImagesFor(() async { + await showPinnedPostScreen(tester); + expect(find.byType(CachedNetworkImage), findsOneWidget); + }); + }); + + testWidgets('Check if CachedNetworkImage shows CircularProgressIndicator', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: PinnedPostScreen( + post: { + 'title': 'Sample Title', + 'time': '23:00', + 'postId': 'postId', + 'imageUrl': 'wrong_url', + }, + cacheManager: GetIt.instance.get(), + ), + ), + ); + await tester.pump(); + expect(find.byType(CircularProgressIndicator), findsOneWidget); + }); +} diff --git a/test/views/after_auth_screens/join_org_after_auth_test/access_request_screen_test.dart b/test/views/after_auth_screens/join_org_after_auth_test/access_request_screen_test.dart new file mode 100644 index 000000000..6d92618ec --- /dev/null +++ b/test/views/after_auth_screens/join_org_after_auth_test/access_request_screen_test.dart @@ -0,0 +1,83 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/post_queries.dart'; +import 'package:talawa/view_model/access_request_view_model.dart'; +import 'package:talawa/views/after_auth_screens/join_org_after_auth/access_request_screen.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Widget accessRequestScreen() { + return BaseView( + onModelReady: (model) => model.initialise(fakeOrgInfo), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: SendAccessRequest(org: fakeOrgInfo), + navigatorKey: navigationService.navigatorKey, + ); + }, + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + }); + setUp(() => registerServices()); + tearDown(() => unregisterServices()); + group("SendRequestAccess Screen test", () { + testWidgets("SendRequestAccess screen is build correctly", + (WidgetTester tester) async { + when( + databaseFunctions.gqlAuthMutation( + queries.sendMembershipRequest("XYZ"), + ), + ).thenAnswer( + (realInvocation) async => QueryResult( + options: QueryOptions( + document: gql( + PostQueries().addLike(), + ), + ), + data: null, + source: QueryResultSource.network, + ), + ); + + await tester.pumpWidget(accessRequestScreen()); + await tester.pumpAndSettle(); + + //Verify that appbar is present with transparent background color + expect(find.byType(AppBar), findsOneWidget); + final AppBar appBar = tester.firstWidget(find.byType(AppBar)); + expect(appBar.backgroundColor, Colors.transparent); + + //Verify that the image is present + expect(find.byType(Image), findsOneWidget); + expect(find.text("You need access"), findsOneWidget); + expect( + find.text("Request access, or switch to an account with access"), + findsOneWidget, + ); + expect(find.byType(TextField), findsOneWidget); + //Verify that the send request button is present + expect(find.text("Request Access"), findsOneWidget); + + //Tap the "Request Access" button and trigger a frame + await tester.tap(find.text("Request Access")); + await tester.pump(); + }); + }); +} diff --git a/test/views/after_auth_screens/join_org_after_auth_test/join_organisation_after_auth_test.dart b/test/views/after_auth_screens/join_org_after_auth_test/join_organisation_after_auth_test.dart new file mode 100644 index 000000000..c2ac42036 --- /dev/null +++ b/test/views/after_auth_screens/join_org_after_auth_test/join_organisation_after_auth_test.dart @@ -0,0 +1,286 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:qr_code_scanner/qr_code_scanner.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/organization_search_list.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_helpers.mocks.dart'; +import '../../../helpers/test_locator.dart'; + +Widget createJoinOrgAfterAuth({ + String orgId = "fake_id", +}) { + return BaseView( + onModelReady: (model) => model.initialise(orgId), + builder: (context, model, child) { + return MaterialApp( + navigatorKey: navigationService.navigatorKey, + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: JoinOrganisationAfterAuth( + orgId: orgId, + ), + ); + }, + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + + testSetupLocator(); + locator().test(); + registerServices(); + locator().test(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group("Tests for JoinOrganizationAfterAuth - widgets", () { + testWidgets('QR Scan Test', (WidgetTester tester) async { + final controller = MockQRViewController(); + when(controller.scannedDataStream).thenAnswer((_) async* { + yield Barcode( + ' ' + '?orgid=6737904485008f171cf29924', + BarcodeFormat.qrcode, + null, + ); + }); + when(controller.stopCamera()) + .thenAnswer((realInvocation) => Future.value()); + + await tester.pumpWidget( + createJoinOrgAfterAuth(), + ); + + await tester.pumpAndSettle(const Duration(seconds: 6)); + + await tester.tap(find.byIcon(Icons.qr_code_scanner)); + await tester.pumpAndSettle(); + + expect( + find.byWidgetPredicate( + (widget) => + widget is ClipRRect && + widget.child is Container && + (widget.child! as Container).child is Column, + ), + findsOneWidget, + ); + (tester.widget(find.byType(QRView)) as QRView) + .onQRViewCreated(controller); + }); + testWidgets('QR Scan Test when url != GraphqlConfig.orgURI', + (WidgetTester tester) async { + final controller = MockQRViewController(); + when(controller.scannedDataStream).thenAnswer((_) async* { + yield Barcode( + '1' + '?orgid=6737904485008f171cf29924', + BarcodeFormat.qrcode, + null, + ); + }); + when(controller.stopCamera()) + .thenAnswer((realInvocation) => Future.value()); + + await tester.pumpWidget( + createJoinOrgAfterAuth(), + ); + + await tester.pumpAndSettle(const Duration(seconds: 6)); + + await tester.tap(find.byIcon(Icons.qr_code_scanner)); + await tester.pumpAndSettle(); + + expect( + find.byWidgetPredicate( + (widget) => + widget is ClipRRect && + widget.child is Container && + (widget.child! as Container).child is Column, + ), + findsOneWidget, + ); + (tester.widget(find.byType(QRView)) as QRView) + .onQRViewCreated(controller); + }); + testWidgets('Test _onQRViewCreated when throwing exception', + (WidgetTester tester) async { + final controller = MockQRViewController(); + when(controller.scannedDataStream).thenAnswer((_) async* { + yield Barcode( + ' ' + '?orgid=6737904485008f171cf29924', + BarcodeFormat.qrcode, + null, + ); + }); + when(controller.stopCamera()) + .thenAnswer((realInvocation) => Future.value()); + + await tester.pumpWidget( + createJoinOrgAfterAuth(), + ); + when(controller.stopCamera()).thenThrow(Exception("exception")); + + await tester.pumpAndSettle(const Duration(seconds: 6)); + + await tester.tap(find.byIcon(Icons.qr_code_scanner)); + await tester.pumpAndSettle(); + + (tester.widget(find.byType(QRView)) as QRView) + .onQRViewCreated(controller); + }); + testWidgets( + "Check if JoinOrganizationsAfterAuth shows up", + (tester) async { + await tester.pumpWidget(createJoinOrgAfterAuth()); + await tester.pumpAndSettle(const Duration(seconds: 6)); + + expect(find.byType(JoinOrganisationAfterAuth), findsOneWidget); + }, + ); + + testWidgets( + "Check if children show up correctly", + (tester) async { + await tester.pumpWidget(createJoinOrgAfterAuth()); + await tester.pumpAndSettle(const Duration(seconds: 6)); + + expect( + find.byWidgetPredicate( + (widget) => widget is Scaffold && widget.body is Column, + ), + findsOneWidget, + ); + + // expect( + // find.byWidgetPredicate( + // (widget) => + // widget is Column && + // widget.children[0] is Padding && + // widget.children[1] is ColoredBox && + // widget.children[2] is Padding && + // widget.children[3] is Expanded && + // widget.children[4] is SizedBox && + // widget.children[5] is Column, + // ), + // findsOneWidget, + // ); + + // expect( + // find.byWidgetPredicate( + // (widget) => + // widget is Column && + // widget.children[0] is RaisedRoundedButton && + // (widget.children[0] as RaisedRoundedButton).buttonLabel == + // "Join selected organisation" && + // widget.children[1] is SizedBox, + // ), + // findsOneWidget, + // ); + }, + ); + }); + + group("Tests for JoinOrganizationAfterAuth - widgets", () { + testWidgets("Check if QR bottom model sheet shows up", (tester) async { + await tester.pumpWidget(createJoinOrgAfterAuth()); + await tester.pumpAndSettle(const Duration(seconds: 6)); + + await tester.tap(find.byIcon(Icons.qr_code_scanner)); + await tester.pumpAndSettle(); + + expect( + find.byWidgetPredicate( + (widget) => + widget is ClipRRect && + widget.child is Container && + (widget.child! as Container).child is Column, + ), + findsOneWidget, + ); + }); + + // If you happen to add more tests below this one, make sure to + // re-register SelectOrganizationViewModel in that test as it will + // be disposed once this test ends, or better, write any new tests + // before this one. + + /// Search is No-Longer is a feature, if it gets implemented in future use this test + /// Really good test to learn from so not deleting + testWidgets("Check if model related functions work", (tester) async { + final orgOne = OrgInfo( + name: "org_one", + creatorInfo: User( + firstName: "ravidi", + lastName: "shaikh", + ), + userRegistrationRequired: true, + ); + final orgTwo = OrgInfo( + name: "org_two", + creatorInfo: User( + firstName: "ravidi", + lastName: "shaikh", + ), + userRegistrationRequired: true, + ); + + final selectOrgInfoVM = locator.get(); + + await tester.pumpWidget(createJoinOrgAfterAuth()); + await tester.pumpAndSettle(const Duration(seconds: 6)); + + // This button comes from CupertinoSearchTextField + // await tester.tap(find.byType(CupertinoButton)); + // await tester.pumpAndSettle(const Duration(seconds: 6)); + + // Checking for text change + selectOrgInfoVM.setState(ViewState.busy); + selectOrgInfoVM.searchController.text = "tmmmext"; + await tester.pumpAndSettle(const Duration(seconds: 6)); + + // expect(find.text("tmmmext"), findsOneWidget); + + // Checking for Org selection + + expect(selectOrgInfoVM.organizations, []); + + selectOrgInfoVM.organizations = [ + orgOne, + orgTwo, + ]; + + selectOrgInfoVM.selectedOrganization = orgOne; + + selectOrgInfoVM.notifyListeners(); + await tester.pumpAndSettle(const Duration(seconds: 6)); + + selectOrgInfoVM.searching = true; + selectOrgInfoVM.notifyListeners(); + + expect(find.byType(OrganizationSearchList), findsNothing); + }); + }); +} diff --git a/test/views/after_auth_screens/org_info_screen_test.dart b/test/views/after_auth_screens/org_info_screen_test.dart new file mode 100644 index 000000000..bace6032d --- /dev/null +++ b/test/views/after_auth_screens/org_info_screen_test.dart @@ -0,0 +1,286 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:network_image_mock/network_image_mock.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/after_auth_screens/org_info_screen.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +final OrgInfo mockOrgInfo = OrgInfo.fromJson( + { + '_id': '123', + 'image': 'image_url', + 'name': 'Org_Name', + 'description': 'aabbcc', + 'userRegistrationRequired': false, + 'creator': { + 'accessToken': 'abc', + 'refreshToken': 'abc', + '_id': '123', + 'firstName': 'Parag', + 'lastName': 'Gupta', + }, + 'members': [ + { + 'accessToken': 'abc', + 'refreshToken': 'abc', + '_id': '123', + 'firstName': 'Parag', + 'lastName': 'Gupta', + }, + ], + 'admins': [ + { + 'firstName': 'Parag', + 'lastName': '1', + }, + { + 'firstName': 'Parag', + 'lastName': '2', + }, + { + 'firstName': 'Parag', + 'lastName': '3', + } + ], + 'address': { + "city": "Delhi", + "countryCode": "IN", + "dependentLocality": "Some Dependent Locality", + "line1": "123 Random Street", + "line2": "Apartment 456", + "postalCode": "110001", + "sortingCode": "ABC-123", + "state": "Delhi", + }, + }, + memberRequest: false, +); + +final OrgInfo mockOrgInfo2 = OrgInfo.fromJson( + { + '_id': '1234', + 'image': null, + 'name': 'Org_Name', + 'description': 'aabbcc', + 'userRegistrationRequired': true, + 'creator': { + 'accessToken': 'abc', + 'refreshToken': 'abc', + '_id': '123', + 'firstName': 'Parag', + 'lastName': 'Gupta', + }, + 'members': [ + { + 'firstName': 'Paul', + 'lastName': '1', + }, + { + 'firstName': 'jon', + 'lastName': '1', + }, + { + 'firstName': 'sean', + 'lastName': '1', + }, + { + 'firstName': 'Jay', + 'lastName': '1', + }, + { + 'firstName': 'Chris', + 'lastName': '1', + }, + ], + 'admins': [ + { + 'firstName': 'Parag', + 'lastName': 'Gupta', + }, + ], + 'address': { + "city": "Delhi", + "countryCode": "IN", + "dependentLocality": "Some Dependent Locality", + "line1": "123 Random Street", + "line2": "Apartment 456", + "postalCode": "110001", + "sortingCode": "ABC-123", + "state": "Delhi", + }, + }, + memberRequest: false, +); + +Widget createOrgInfoScreen1() { + return MaterialApp( + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + home: OrganisationInfoScreen( + orgInfo: mockOrgInfo, + ), + navigatorKey: locator().navigatorKey, + ); +} + +Widget createOrgInfoScreen2() { + return MaterialApp( + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + home: OrganisationInfoScreen( + orgInfo: mockOrgInfo2, + ), + navigatorKey: locator().navigatorKey, + ); +} + +void main() { + setUpAll(() { + testSetupLocator(); + SizeConfig().test(); + GraphqlConfig().test(); + registerServices(); + }); + group('OrganisationInfoScreen Tests', () { + testWidgets('Leave button shows when organization is joined', + (WidgetTester tester) async { + mockNetworkImagesFor(() async { + userConfig.currentUser.joinedOrganizations!.add(mockOrgInfo); + + await tester.pumpWidget(createOrgInfoScreen1()); + await tester.pumpAndSettle(); + + expect(find.text('Leave'), findsOneWidget); + await tester.tap(find.text('Leave')); + await tester.pumpAndSettle(); + + expect(find.byIcon(Icons.arrow_back), findsOneWidget); + await tester.tap(find.byIcon(Icons.arrow_back)); + await tester.pumpAndSettle(); + }); + }); + testWidgets('Displays the correct organization info', + (WidgetTester tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createOrgInfoScreen1()); + await tester.pumpAndSettle(); + + expect(find.text('Org_Name'), findsOneWidget); + expect(find.text('aabbcc'), findsOneWidget); + expect(find.text('Delhi, IN'), findsOneWidget); + expect(find.text('Public'), findsOneWidget); + expect(find.byIcon(Icons.lock_open), findsOneWidget); + }); + }); + testWidgets('for private organisation', (WidgetTester tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createOrgInfoScreen2()); + await tester.pumpAndSettle(); + + expect(find.text('Org_Name'), findsOneWidget); + expect(find.text('aabbcc'), findsOneWidget); + expect(find.text('Delhi, IN'), findsOneWidget); + expect(find.text('Private'), findsOneWidget); + expect(find.byIcon(Icons.lock), findsOneWidget); + }); + }); + + testWidgets('Join button shows when organization is not joined', + (WidgetTester tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createOrgInfoScreen2()); + await tester.pumpAndSettle(); + + expect(find.text('Join'), findsOneWidget); + await tester.tap(find.byType(FloatingActionButton)); + await tester.pumpAndSettle(); + }); + }); + + testWidgets('Displays the default image when orgInfo.image is null', + (WidgetTester tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createOrgInfoScreen2()); + await tester.pumpAndSettle(); + + expect(find.byType(Image), findsOneWidget); + expect(find.byKey(const Key('image_container')), findsOneWidget); + }); + }); + testWidgets('DropDown list for admins more than 2', + (WidgetTester tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createOrgInfoScreen1()); + await tester.pumpAndSettle(); + + expect(find.text('Admins'), findsOneWidget); + expect(find.text('Parag 1'), findsOneWidget); + + expect(find.text('See all'), findsOneWidget); + await tester.tap(find.text('See all')); + await tester.pumpAndSettle(); + + expect(find.text('Parag 3'), findsOneWidget); + + expect(find.byKey(const Key('modalSheetbackBtn')), findsOneWidget); + await tester.tap(find.byKey(const Key('modalSheetbackBtn'))); + await tester.pumpAndSettle(); + }); + }); + testWidgets('DropDown list for members more than 4', + (WidgetTester tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createOrgInfoScreen2()); + await tester.pumpAndSettle(); + + expect(find.text('Members'), findsOneWidget); + expect(find.text('Paul 1'), findsOneWidget); + + expect(find.text('See all'), findsOneWidget); + await tester.tap(find.text('See all')); + await tester.pumpAndSettle(); + + expect(find.text('Chris 1'), findsOneWidget); + }); + }); + }); +} diff --git a/test/views/after_auth_screens/profile/profile_page_test.dart b/test/views/after_auth_screens/profile/profile_page_test.dart new file mode 100644 index 000000000..8828231c7 --- /dev/null +++ b/test/views/after_auth_screens/profile/profile_page_test.dart @@ -0,0 +1,161 @@ +import 'package:contained_tab_bar_view/contained_tab_bar_view.dart'; +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:talawa/constants/custom_theme.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/profile/profile_page.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Widget createProfilePage({required MainScreenViewModel mainScreenViewModel}) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + key: MainScreenViewModel.scaffoldKey, + body: ProfilePage( + key: const Key('Profile Page'), + homeModel: mainScreenViewModel, + ), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + theme: TalawaTheme.darkTheme, + ); + }, + ); +} + +void main() async { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + registerServices(); + getAndRegisterAppTheme(); + }); + group('build', () { + testWidgets('check if profilePage shows up and refreshIndicator work', + (tester) async { + await tester.pumpWidget( + createProfilePage( + mainScreenViewModel: locator(), + ), + ); + await tester.pumpAndSettle(); + expect(find.byType(RefreshIndicator), findsOneWidget); + await tester.drag( + find.byKey(const Key('profilepic')), + const Offset(0, 300), + ); + await tester.pumpAndSettle(); + }); + testWidgets('check if invitebutton work', (tester) async { + await tester.pumpWidget( + createProfilePage( + mainScreenViewModel: locator(), + ), + ); + await tester.pump(); + await tester.tap(find.byKey(const Key('inviteicon'))); + await tester.pump(); + }); + testWidgets('check if left drawer works', (tester) async { + await tester.pumpWidget( + createProfilePage( + mainScreenViewModel: locator(), + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byIcon(Icons.menu)); + await tester.pumpAndSettle(); + }); + testWidgets('check if Donate button work', (tester) async { + await tester.pumpWidget( + createProfilePage( + mainScreenViewModel: locator(), + ), + ); + await tester.pump(); + await tester.tap(find.text('Donate to the Community')); + await tester.pump(); + }); + + testWidgets('check if settings page is opening up', (tester) async { + await tester.pumpWidget( + createProfilePage( + mainScreenViewModel: locator(), + ), + ); + await tester.pump(); + final settingsIcon = find.byKey(const Key('settingIcon')); + await tester.tap(settingsIcon); + verify(navigationService.navigatorKey); + }); + testWidgets('check if User Feed is present', (tester) async { + await tester.pumpWidget( + createProfilePage( + mainScreenViewModel: locator(), + ), + ); + await tester.pump(); + + expect(find.byType(ContainedTabBarView), findsOneWidget); + expect(find.byKey(const Key("UserFeed")), findsOneWidget); + }); + testWidgets('check if User Event is present', (tester) async { + await tester.pumpWidget( + createProfilePage( + mainScreenViewModel: locator(), + ), + ); + await tester.pump(); + + expect(find.byType(ContainedTabBarView), findsOneWidget); + await tester.tap(find.text('Events')); + await tester.pump(); + }); + testWidgets('Test donate bottom sheet', (tester) async { + await tester.pumpWidget( + createProfilePage( + mainScreenViewModel: locator(), + ), + ); + await tester.pumpAndSettle(); + + expect(find.byType(ContainedTabBarView), findsOneWidget); + final orgDonateBtn = find.text('Donate to the Community'); + expect(orgDonateBtn, findsOneWidget); + await tester.tap(orgDonateBtn); + await tester.pumpAndSettle(); + + final txtfield = find.byKey(const Key('custom_amt')); + await tester.enterText(txtfield, '25'); + await tester.pump(); + + final donateBtn = find.byKey(const Key('DONATE')); + await tester.ensureVisible(donateBtn); + await tester.pumpAndSettle(); + await tester.tap(donateBtn); + + final currencyBtn = find.byKey(const Key('currency_btn')); + await tester.tap(currencyBtn); + await tester.pumpAndSettle(); + }); + }); +} diff --git a/test/views/after_auth_screens/profile/user_event_test.dart b/test/views/after_auth_screens/profile/user_event_test.dart new file mode 100644 index 000000000..8a4bb1a94 --- /dev/null +++ b/test/views/after_auth_screens/profile/user_event_test.dart @@ -0,0 +1,177 @@ +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:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart'; +import 'package:talawa/services/navigation_service.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'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/profile/user_event.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/event_card.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_helpers.mocks.dart'; +import '../../../helpers/test_locator.dart'; + +Widget userEventsScreen({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, + required bool isTest, +}) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + // return BaseView( + // onModelReady: (model) { + // model.initialize(likedBy0, 'test_post_id'); + // }, + // builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + key: MainScreenViewModel.scaffoldKey, + body: const UserEvents( + key: Key('test_key'), + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: generateRoute, + ); + }, + ); + // }, + // ); +} + +void main() { + late MockExploreEventsViewModel mockViewModel; + setUpAll(() { + SizeConfig().test(); + testSetupLocator(); + registerServices(); + mockViewModel = MockExploreEventsViewModel(); + locator.unregister(); + locator.registerSingleton(mockViewModel); + }); + tearDownAll(() { + unregisterServices(); + }); + group('tests for UserEvents Screen', () { + testWidgets('check if UserEvents Screen shows up', (tester) async { + when(mockViewModel.isBusy).thenReturn(true); + when(mockViewModel.initialise()).thenAnswer((_) async {}); + when(mockViewModel.events).thenReturn([]); + + await tester.pumpWidget(userEventsScreen(isTest: true)); + await tester.pump(); + final finder = find.byKey(const Key('test_key')); + expect(finder, findsOneWidget); + }); + testWidgets('check if CircularIndicator Shows up', (tester) async { + when(mockViewModel.isBusy).thenReturn(true); + when(mockViewModel.initialise()).thenAnswer((_) async {}); + when(mockViewModel.events).thenReturn([]); + + await tester.pumpWidget(userEventsScreen(isTest: false)); + await tester.pump(); + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsOneWidget); + }); + testWidgets('check if No Events text shows up', (tester) async { + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenAnswer((_) async {}); + when(mockViewModel.events).thenReturn([]); + + await tester.pumpWidget(userEventsScreen(isTest: true)); + await tester.pump(); + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsNothing); + expect( + find.text('You have no event in this organization'), + findsOneWidget, + ); + }); + testWidgets('check if text button shows up', (tester) async { + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenAnswer((_) async {}); + when(mockViewModel.events).thenReturn([]); + + await tester.pumpWidget(userEventsScreen(isTest: true)); + await tester.pump(); + + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsNothing); + expect( + find.text('Create your first event'), + findsOneWidget, + ); + await tester.tap(find.text('Create your first event')); + await tester.pumpAndSettle(); + }); + testWidgets('check if User Event screen shows up', (tester) async { + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenAnswer((_) async {}); + when(mockViewModel.events).thenReturn([]); + + await tester.pumpWidget(userEventsScreen(isTest: true)); + await tester.pumpAndSettle(); + expect(find.byKey(const Key('test_key')), findsOneWidget); + }); + testWidgets('check if User Events shows up if not null', (tester) async { + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenAnswer((_) async {}); + when(mockViewModel.userEvents).thenReturn([ + Event( + id: 'a', + title: 'Sample Event', + description: 'This is a fake event description.', + location: 'City Park', + recurring: false, + allDay: false, + startDate: '2022-01-01', + endDate: '2022-01-02', + startTime: '12:00 PM', + endTime: '3:00 PM', + isPublic: true, + isRegistered: false, + isRegisterable: true, + creator: User(id: 'creator'), + organization: OrgInfo(), + admins: [ + User(id: 'admin'), + ], + attendees: [ + Attendee(id: 'attendee1'), + ], + ), + ]); + + await tester.pumpWidget(userEventsScreen(isTest: true)); + await tester.pump(); + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsNothing); + expect( + find.text('Create your first event'), + findsNothing, + ); + final finder1 = find.byType(SingleChildScrollView); + expect(finder1, findsOneWidget); + expect(find.byType(EventCard), findsOneWidget); + await tester.tap(find.byType(GestureDetector)); + await tester.pumpAndSettle(); + }); + }); +} diff --git a/test/views/after_auth_screens/profile/user_feed_test.dart b/test/views/after_auth_screens/profile/user_feed_test.dart new file mode 100644 index 000000000..6c8429910 --- /dev/null +++ b/test/views/after_auth_screens/profile/user_feed_test.dart @@ -0,0 +1,199 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:talawa/models/post/post_model.dart'; +import 'package:talawa/router.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/profile/user_feed.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/post_list_widget.dart'; +import 'package:talawa/widgets/post_widget.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_helpers.mocks.dart'; +import '../../../helpers/test_locator.dart'; + +Widget userFeedScreen({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, + required bool isTest, +}) { + return MaterialApp( + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + key: MainScreenViewModel.scaffoldKey, + body: UserFeed( + forTest: isTest, + key: const Key('test_key'), + ), + ), + ); +} + +Widget userFeedScreen1({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, + required bool isTest, +}) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + // return BaseView( + // onModelReady: (model) { + // model.initialize(likedBy0, 'test_post_id'); + // }, + // builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + key: MainScreenViewModel.scaffoldKey, + body: UserFeed( + forTest: isTest, + key: const Key('test_key'), + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: generateRoute, + ); + }, + ); + // }, + // ); +} + +final List likedBy0 = [ + LikedBy(sId: 'Test user 1'), + LikedBy(sId: 'Test user 2'), +]; + +final post = Post( + sId: "test_post_id", + creator: userConfig.currentUser, + likedBy: likedBy0, +); + +void main() { + late MockOrganizationFeedViewModel mockViewModel; + + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + + SizeConfig().test(); + testSetupLocator(); + registerServices(); + mockViewModel = MockOrganizationFeedViewModel(); + locator.unregister(); + locator.registerSingleton(mockViewModel); + }); + tearDownAll(() { + unregisterServices(); + }); + + group('tests for User feed Screen', () { + testWidgets('check if UserFeedScreen shows up', (tester) async { + when(mockViewModel.isFetchingPosts).thenReturn(true); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.userPosts).thenReturn([]); + await tester.pumpWidget(userFeedScreen(isTest: true)); + await tester.pump(); + final finder = find.byKey(const Key('test_key')); + expect(finder, findsOneWidget); + }); + + testWidgets('check if CircularIndicator Shows up', (tester) async { + when(mockViewModel.isFetchingPosts).thenReturn(true); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.userPosts).thenReturn([]); + + await tester.pumpWidget(userFeedScreen(isTest: false)); + await tester.pump(); + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsOneWidget); + }); + testWidgets('check if No posts text shows up', (tester) async { + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.userPosts).thenReturn([]); + + await tester.pumpWidget(userFeedScreen(isTest: true)); + await tester.pump(); + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsNothing); + expect( + find.text('You have no post in this organization'), + findsOneWidget, + ); + }); + testWidgets('check if text button shows up', (tester) async { + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.userPosts).thenReturn([]); + + await tester.pumpWidget(userFeedScreen(isTest: true)); + await tester.pump(); + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsNothing); + expect( + find.text('Create your first post'), + findsOneWidget, + ); + await tester.tap(find.text('Create your first post')); + await tester.pumpAndSettle(); + }); + testWidgets('check if PostListWIdget shows up', (tester) async { + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.userPosts).thenReturn([ + Post( + sId: "test_post_id", + creator: userConfig.currentUser, + likedBy: likedBy0, + description: 'Testing', + comments: [Comments(sId: 'cmmnt1')], + createdAt: DateTime.now(), + organization: userConfig.currentOrg, + ), + ]); + when(mockViewModel.initialise()).thenReturn(null); + + await tester.pumpWidget(userFeedScreen1(isTest: true)); + await tester.pumpAndSettle(); + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsNothing); + final finder1 = find.byType(PostListWidget); + expect(finder1, findsOneWidget); + expect(find.byType(NewsPost), findsOneWidget); + }); + }); +} diff --git a/test/views/demo_screens/explore_events_demo_test.dart b/test/views/demo_screens/explore_events_demo_test.dart new file mode 100644 index 000000000..599982920 --- /dev/null +++ b/test/views/demo_screens/explore_events_demo_test.dart @@ -0,0 +1,226 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:talawa/constants/routing_constants.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +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/explore_event_dialogue.dart'; +import 'package:talawa/views/demo_screens/explore_events_demo.dart'; +import 'package:talawa/widgets/custom_drawer.dart'; +import 'package:talawa/widgets/event_card.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +// class MockBuildContext extends Mock implements BuildContext {} + +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 DemoExploreEvents( + key: Key('ExploreEvents'), + ), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + +void main() async { + SizeConfig().test(); + + final mockEvents = [ + Event( + id: 'event1', + admins: [User(id: 'admin1')], + creator: User(id: 'admin2'), + startTime: DateTime.now().day.toString(), + endTime: DateTime.now().day.toString(), + title: 'event title', + startDate: DateTime.now().day.toString(), + endDate: DateTime.now().day.toString(), + location: 'location', + description: 'description', + isPublic: true, + ), + ]; + + late ExploreEventsViewModel exploreEventsViewModel; + group('Test for DemoExploreEventsPage', () { + setUpAll(() { + registerServices(); + registerViewModels(); + exploreEventsViewModel = getAndRegisterExploreEventsViewModel(); + }); + tearDownAll(() { + unregisterServices(); + unregisterViewModels(); + }); + testWidgets('Test for menu button.', (tester) async { + final model = MainScreenViewModel(); + await tester.pumpWidget(createExploreEventsScreen(model)); + + await tester.pumpAndSettle(); + + final menuButton = find.byIcon(Icons.menu); + + await tester.tap(menuButton); + await tester.pumpAndSettle(); + + expect(find.byType(CustomDrawer), findsOneWidget); + }); + + testWidgets('Test for AddDate button.', (tester) async { + final model = MainScreenViewModel(); + await tester.pumpWidget(createExploreEventsScreen(model)); + + await tester.pumpAndSettle(); + + final addDateButton = find.textContaining('Add Date'); + + await tester.tap(addDateButton); + await tester.pumpAndSettle(); + + expect(find.byType(ExploreEventDialog), findsOneWidget); + }); + + testWidgets('Test for Calendar button', (tester) async { + final model = MainScreenViewModel(); + final mockModel = ExploreEventsViewModel(); + await tester.pumpWidget(createExploreEventsScreen(model)); + + await tester.pumpAndSettle(); + + final calendarBtn = find.byIcon(Icons.calendar_month); + + expect(calendarBtn, findsOneWidget); + + await tester.tap(calendarBtn); + await tester.pumpAndSettle(); + + verify( + navigationService.pushScreen( + Routes.calendar, + arguments: mockModel.events, + ), + ); + }); + + testWidgets('Test for floatingAction button', (tester) async { + final model = MainScreenViewModel(); + await tester.pumpWidget(createExploreEventsScreen(model)); + + await tester.pumpAndSettle(); + + final floatingBtn = find.byType(FloatingActionButton); + + expect(floatingBtn, findsOneWidget); + + await tester.tap(floatingBtn); + await tester.pumpAndSettle(); + + verify( + navigationService.pushScreen( + "/createEventPage", + ), + ); + }); + + testWidgets('Test for eventCard.', (tester) async { + final model = MainScreenViewModel(); + when(exploreEventsViewModel.events).thenAnswer((_) { + return mockEvents; + }); + await tester.pumpWidget(createExploreEventsScreen(model)); + + await tester.pumpAndSettle(); + + final eventCard = find.byType(EventCard).first; + + expect(eventCard, findsOneWidget); + + await tester.tap(eventCard); + await tester.pumpAndSettle(); + + verify( + navigationService.navigatorKey, + ); + }); + + testWidgets('Test for dropDown button', (tester) async { + final model = MainScreenViewModel(); + await tester.pumpWidget(createExploreEventsScreen(model)); + + await tester.pumpAndSettle(); + + final dropDownBtn = find.byType(DropdownButton); + + await tester.tap(dropDownBtn); + await tester.pumpAndSettle(); + + final createEventsBtn = find.textContaining('Created Events'); + + expect(createEventsBtn, findsOneWidget); + + await tester.tap(createEventsBtn); + await tester.pumpAndSettle(); + }); + + testWidgets('Test for ExploreEvent dialog', (tester) async { + final model = MainScreenViewModel(); + await tester.pumpWidget(createExploreEventsScreen(model)); + + await tester.pumpAndSettle(); + + final dropDownBtn = find.byType(DropdownButton); + + await tester.tap(dropDownBtn); + await tester.pumpAndSettle(); + + final createEventsBtn = find.textContaining('Created Events'); + + expect(createEventsBtn, findsOneWidget); + + await tester.tap(createEventsBtn); + await tester.pumpAndSettle(); + }); + + testWidgets('Test for layout when zero events', (tester) async { + final model = MainScreenViewModel(); + when(exploreEventsViewModel.events).thenReturn([]); + await tester.pumpWidget(createExploreEventsScreen(model)); + + await tester.pumpAndSettle(); + + final dropDownBtn = find.byType(DropdownButton); + + await tester.tap(dropDownBtn); + await tester.pumpAndSettle(); + + final createEventsBtn = find.textContaining('Created Events'); + + expect(createEventsBtn, findsOneWidget); + + await tester.tap(createEventsBtn); + await tester.pumpAndSettle(); + }); + }); +} diff --git a/test/views/demo_screens/organization_feed_demo_test.dart b/test/views/demo_screens/organization_feed_demo_test.dart new file mode 100644 index 000000000..d86261c18 --- /dev/null +++ b/test/views/demo_screens/organization_feed_demo_test.dart @@ -0,0 +1,64 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:talawa/constants/custom_theme.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/main_screen.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +Widget createHomeScreen({required bool demoMode}) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + home: MainScreen( + key: const Key('MainScreen'), + mainScreenArgs: MainScreenArgs( + mainScreenIndex: 0, + fromSignUp: false, + toggleDemoMode: demoMode, + ), + ), + ); +} + +void main() async { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + locator().test(); + locator().test(); + }); + + group('Home Page tests', () { + testWidgets('Test for menu button.', (tester) async { + await tester.pumpWidget(createHomeScreen(demoMode: true)); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + final menuButton = find.byIcon(Icons.menu); + + await tester.tap(menuButton); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("Drawer")), findsOneWidget); + }); + }); +} diff --git a/test/views/demo_screens/profile_page_demo_test.dart b/test/views/demo_screens/profile_page_demo_test.dart new file mode 100644 index 000000000..b536a2445 --- /dev/null +++ b/test/views/demo_screens/profile_page_demo_test.dart @@ -0,0 +1,100 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:talawa/constants/custom_theme.dart'; +// import 'package:talawa/locator.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/main_screen.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; +// import '../../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +Widget createProfileScreen({required bool demoMode}) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + home: MainScreen( + key: const Key('MainScreen'), + mainScreenArgs: MainScreenArgs( + mainScreenIndex: 2, + fromSignUp: false, + toggleDemoMode: demoMode, + ), + ), + ); +} + +void main() async { + // setUpAll(() { + // TestWidgetsFlutterBinding.ensureInitialized(); + // testSetupLocator(); + // }); + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + registerServices(); + locator().test(); + locator().test(); + getAndRegisterNavigationService(); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('Profile Page tests', () { + testWidgets('Test for donate button.', (tester) async { + await tester.pumpWidget(createProfileScreen(demoMode: true)); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + final donateButton = find.textContaining('Donate to the Community'); + + await tester.tap(donateButton); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("Drawer")), findsOneWidget); + }); + + testWidgets('Test for menu button.', (tester) async { + await tester.pumpWidget(createProfileScreen(demoMode: true)); + + await tester.pumpAndSettle(const Duration(seconds: 1)); + + final menuButton = find.byIcon(Icons.menu); + + await tester.tap(menuButton); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key("Drawer")), findsOneWidget); + }); + + testWidgets('check if settings page is opening up', (tester) async { + await tester.pumpWidget( + createProfileScreen( + demoMode: true, + ), + ); + await tester.pumpAndSettle(const Duration(seconds: 1)); + final settingsIcon = find.byKey(const Key('settingIcon')); + await tester.tap(settingsIcon); + verify(navigationService.pushScreen('/appSettingsPage')); + }); + }); +} diff --git a/test/views/main_screen_test.dart b/test/views/main_screen_test.dart new file mode 100644 index 000000000..064dda1f6 --- /dev/null +++ b/test/views/main_screen_test.dart @@ -0,0 +1,254 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:mockito/mockito.dart'; +// import 'package:mocktail_image_network/mocktail_image_network.dart'; +import 'package:provider/provider.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +// import 'package:talawa/views/after_auth_screens/add_post_page.dart'; +// import 'package:talawa/views/after_auth_screens/events/explore_events.dart'; +// import 'package:talawa/views/after_auth_screens/feed/organization_feed.dart'; +// import 'package:talawa/views/after_auth_screens/profile/profile_page.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/views/main_screen.dart'; +// import 'package:talawa/widgets/custom_drawer.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +Widget createMainScreen({bool demoMode = true}) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, themeModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + theme: Provider.of(context, listen: true).isdarkTheme + ? TalawaTheme.darkTheme + : TalawaTheme.lightTheme, + home: Scaffold( + body: MainScreen( + mainScreenArgs: MainScreenArgs( + fromSignUp: false, + mainScreenIndex: 0, + toggleDemoMode: demoMode, + ), + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); +} + +class MockMainScreenViewModel extends Mock implements MainScreenViewModel { + @override + int get currentPageIndex => 0; + + @override + List get pages => [const Test(key: Key('key'))]; + + @override + List get navBarItems => [ + const BottomNavigationBarItem(icon: Icon(Icons.abc), label: 'label1'), + const BottomNavigationBarItem(icon: Icon(Icons.abc), label: 'label2'), + ]; +} + +class Test extends StatelessWidget { + const Test({super.key}); + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} + +void main() async { + late GraphQLClient graphQLClient; + + setUpAll(() async { + testSetupLocator(); + registerServices(); + locator().test(); + locator().test(); + + locator.unregister(); + locator + .registerFactory(() => MockMainScreenViewModel()); + + graphQLClient = locator(); + when( + graphQLClient.query( + QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ).thenAnswer( + (realInvocation) async { + return QueryResult.internal( + source: QueryResultSource.network, + parserFn: (data) => {}, + data: { + "getPlugins": [], + }, + ); + }, + ); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group("Test for main_screen.dart", () { + testWidgets('Test join org banner.', (tester) async { + MainScreenViewModel.demoMode = true; + await tester.pumpWidget(createMainScreen()); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + final bannerFinder = find.byKey(const Key('banner')); + + await tester.tap(bannerFinder); + + verify(navigationService.pushScreen(Routes.setUrlScreen, arguments: '')); + }); + + testWidgets("Test if Join Org banner not visible.", (tester) async { + MainScreenViewModel.demoMode = false; + await tester + .pumpWidget(createMainScreen(demoMode: MainScreenViewModel.demoMode)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + }); + // + // // Don't call pumpAndSettle as the BottomNavigationBar + // // of this widget builds itself repeatedly, causing an infinite + // // loop; making the test never stop + // + // // await tester.pumpAndSettle(); + // + // expect(find.byType(MainScreen), findsOneWidget); + // }); + // + // testWidgets("Check if all children shows up", (tester) async { + // // This stub shows its effect in the next test + // + // when( + // graphQLClient.query( + // QueryOptions( + // document: gql(queries.getPluginsList()), + // ), + // ), + // ).thenAnswer( + // (realInvocation) async { + // return QueryResult.internal( + // source: QueryResultSource.network, + // parserFn: (data) => {}, + // data: { + // "getPlugins": null, + // }, + // ); + // }, + // ); + // + // await tester.pumpWidget(createMainScreen()); + // await tester.pump(); + // + // expect( + // find.byWidgetPredicate( + // (widget) => + // widget is Scaffold && + // widget.drawer is CustomDrawer && + // widget.body is IndexedStack && + // widget.bottomNavigationBar is BottomNavigationBar, + // ), + // findsOneWidget, + // ); + // + // expect(find.byIcon(Icons.home), findsOneWidget); + // expect(find.byIcon(Icons.event_note), findsOneWidget); + // expect(find.byIcon(Icons.add_box), findsOneWidget); + // expect(find.byIcon(Icons.chat_outlined), findsOneWidget); + // expect(find.byIcon(Icons.account_circle), findsOneWidget); + // + // expect(find.byType(OrganizationFeed), findsOneWidget); + // expect(find.byType(ExploreEvents), findsOneWidget); + // expect(find.byType(AddPost), findsOneWidget); + // expect(find.byType(ProfilePage), findsOneWidget); + // }); + // + // testWidgets("Check if plugin loading works", (tester) async { + // mockNetworkImages(() async { + // await tester.pumpWidget(createMainScreen()); + // await tester.pump(); + // + // expect(find.byIcon(Icons.home), findsOneWidget); + // expect(find.byIcon(Icons.event_note), findsOneWidget); + // expect(find.byIcon(Icons.add_box), findsOneWidget); + // expect(find.byIcon(Icons.chat_outlined), findsOneWidget); + // expect(find.byIcon(Icons.account_circle), findsOneWidget); + // + // expect(find.byType(OrganizationFeed), findsOneWidget); + // expect(find.byType(ExploreEvents), findsOneWidget); + // expect(find.byType(AddPost), findsOneWidget); + // expect(find.byType(ProfilePage), findsOneWidget); + // + // // If MainScreen finds some plugins, it will add them dynamically + // + // // expect(find.byType(ChangeThemeTile), findsOneWidget); + // }); + // }); + // + // testWidgets("Check if changing pages works", (tester) async { + // mockNetworkImages(() async { + // await tester.pumpWidget(createMainScreen()); + // await tester.pump(); + // + // await tester.tap(find.byIcon(Icons.home)); + // await tester.pump(); + // expect(mainScreenViewModel.currentPageIndex, 0); + // + // await tester.tap(find.byIcon(Icons.event_note)); + // await tester.pump(); + // // expect(mainScreenViewModel.currentIndex, 1); + // + // await tester.tap(find.byIcon(Icons.add_box)); + // await tester.pump(); + // // expect(mainScreenViewModel.currentIndex, 2); + // + // await tester.tap(find.byIcon(Icons.chat_outlined)); + // await tester.pump(); + // // expect(mainScreenViewModel.currentIndex, 3); + // + // await tester.tap(find.byIcon(Icons.account_circle)); + // await tester.pump(); + // // expect(mainScreenViewModel.currentIndex, 4); + // }); + // }); + }); +} diff --git a/test/widget_tests/accept_requests_page_test.dart b/test/widget_tests/accept_requests_page_test.dart deleted file mode 100644 index bced4539b..000000000 --- a/test/widget_tests/accept_requests_page_test.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/organization/accept_requests_page.dart'; - -Widget accepRequestsPage() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ], - child: MaterialApp( - home: AcceptRequestsPage(), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("accept_members_requests page tests", () { - testWidgets("Testing if member page shows up", (tester) async { - await tester.pumpWidget(accepRequestsPage()); - - //verify if [accept_members_requests] page appears - expect(find.byType(Scaffold), findsOneWidget); - expect(find.byType(Card), findsNothing); - }); - - testWidgets( - "Testing overflow of accept_members_requests page in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(440, 800); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(accepRequestsPage()); - - //verify if [accept_members_requests] page appears - - expect(find.byType(Scaffold), findsOneWidget); - expect(find.byType(Card), findsNothing); - }); - testWidgets("Testing overflow of Member Page in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(accepRequestsPage()); - - //verify if [accept_members_requests] page appears - - expect(find.byType(Scaffold), findsOneWidget); - expect(find.byType(Card), findsNothing); - }); - }); -} diff --git a/test/widget_tests/add_post_test.dart b/test/widget_tests/add_post_test.dart deleted file mode 100644 index a069642d8..000000000 --- a/test/widget_tests/add_post_test.dart +++ /dev/null @@ -1,105 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/controllers/post_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/newsfeed/add_post.dart'; - -Widget createMemberPageScreen() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ChangeNotifierProvider( - create: (_) => PostController(), - ) - ], - child: const MaterialApp( - home: AddPost(), - ), - ); - -void main() { - group("Member Page Tests", () { - testWidgets( - "Testing if addPost page shows up validations on empty submission", - (tester) async { - await tester.pumpWidget(createMemberPageScreen()); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isFalse); - }); - testWidgets( - "Testing if addPost page shows up validations on empty submission of description field", - (tester) async { - await tester.pumpWidget(createMemberPageScreen()); - final Finder title = find.byKey(const Key('Title')); - await tester.enterText(title, "Something post title"); - await tester.pump(); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isFalse); - }); - testWidgets( - "Testing if addPost page shows up validations on empty submission of title field", - (tester) async { - await tester.pumpWidget(createMemberPageScreen()); - final Finder description = find.byKey(const Key('Description')); - await tester.enterText(description, "Description for the post"); - await tester.pump(); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isFalse); - }); - testWidgets( - "Testing if addPost page shows up validations on submission on fields with data", - (tester) async { - await tester.pumpWidget(createMemberPageScreen()); - final Finder title = find.byKey(const Key('Title')); - await tester.enterText(title, "Something post title"); - final Finder description = find.byKey(const Key('Description')); - await tester.enterText(description, "Description for the post"); - await tester.pump(); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isTrue); - }); - testWidgets( - "Testing if addPost page shows up error toast on submission on fields with multiline description", - (tester) async { - await tester.pumpWidget(createMemberPageScreen()); - final Finder title = find.byKey(const Key('Title')); - await tester.enterText(title, 'Something post\n title'); - await tester.pump(); - final Finder description = find.byKey(const Key('Description')); - await tester.enterText(description, 'Description for\n the post'); - await tester.pump(); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isTrue); - }); - }); -} diff --git a/test/widget_tests/add_task_dialog_test.dart b/test/widget_tests/add_task_dialog_test.dart deleted file mode 100644 index 66fc1597a..000000000 --- a/test/widget_tests/add_task_dialog_test.dart +++ /dev/null @@ -1,88 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/views/pages/events/add_task_dialog.dart'; - -Widget addTaskDialog() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration()), - ChangeNotifierProvider(create: (_) => OrgController()), - ChangeNotifierProvider(create: (_) => AuthController()), - ChangeNotifierProvider(create: (_) => Preferences()), - ChangeNotifierProvider(create: (_) => CommentHandler()), - ChangeNotifierProvider(create: (_) => PostProvider()), - ], - child: MaterialApp( - home: Builder(builder: (context) { - SizeConfig().init(context); - return AddEventTask( - eventId: "", - ); - }), - ), - ); - -void main() { - group("add Task Dialog Tests", () { - testWidgets( - "Testing if add Task Dialog page shows up validations on empty submission", - (tester) async { - await tester.pumpWidget(addTaskDialog()); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isFalse); - }); - testWidgets( - "Testing if add Task Dialog page shows up validations on empty submission of description field", - (tester) async { - await tester.pumpWidget(addTaskDialog()); - final Finder title = find.byKey(const Key('Title')); - await tester.enterText(title, "Something post title"); - await tester.pump(); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isFalse); - }); - testWidgets( - "Testing if add Task Dialog page shows up validations on empty submission of title field", - (tester) async { - await tester.pumpWidget(addTaskDialog()); - final Finder description = find.byKey(const Key('Description')); - await tester.enterText(description, "Description for the post"); - await tester.pump(); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isFalse); - }); - testWidgets( - "Testing if add Task Dialog page shows up validations on submission on fields with data", - (tester) async { - await tester.pumpWidget(addTaskDialog()); - final Finder title = find.byKey(const Key('Title')); - await tester.enterText(title, "Something post title"); - final Finder description = find.byKey(const Key('Description')); - await tester.enterText(description, "Description for the post"); - await tester.pump(); - final Finder formWidgetFinder = find.byType(Form); - final Form formWidget = tester.widget(formWidgetFinder) as Form; - final GlobalKey formKey = - formWidget.key as GlobalKey; - expect(formKey.currentState.validate(), isTrue); - }); - }); -} diff --git a/test/widget_tests/after_auth_screens/app_settings/app_setting_page_test.dart b/test/widget_tests/after_auth_screens/app_settings/app_setting_page_test.dart new file mode 100644 index 000000000..a22ac3df0 --- /dev/null +++ b/test/widget_tests/after_auth_screens/app_settings/app_setting_page_test.dart @@ -0,0 +1,311 @@ +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:provider/provider.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/models/language/language_model.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/settings_view_models/app_setting_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/views/after_auth_screens/app_settings/app_settings_page.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +/// MockBuildContext class helps to mock the BuildContext class. +class MockBuildContext extends Mock implements BuildContext {} + +/// MockCallbackFunction class helps to mock the callback function. +class MockCallbackFunction extends Mock { + /// call function helps to mock the call function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void call(); +} + +/// 'createAppSettingScreen' is used to create the AppSettingPage widget in light mode. +/// +/// **params**: +/// * `themeMode`: Represents the theme mode of the widget. +/// +/// **returns**: +/// * `Widget`: Returns the AppSettingPage widget. +Widget createAppSettingScreen({ThemeMode themeMode = ThemeMode.light}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, themeModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: Provider.of(context, listen: true).isdarkTheme + ? TalawaTheme.darkTheme + : TalawaTheme.lightTheme, + home: const AppSettingsPage( + key: Key('AppSettingsPage'), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + }, + ); + +Future main() async { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + SizeConfig().test(); + registerServices(); + }); + + group('Setting Page Screen Widget Test in dark mode', () { + testWidgets("Testing if Settings Screen shows up", (tester) async { + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('AppSettingScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + + final backButton = find.byIcon(Icons.arrow_back); + + await tester.tap(backButton); + await tester.pumpAndSettle(); + + verify(navigationService.navigatorKey); + }); + testWidgets( + "Testing if Settings Screen shows up in dark mode with Theme selection tile", + (tester) async { + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('AppSettingScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + final switchThemeTile = find.byKey(const Key('ThemeSwitch')); + expect(switchThemeTile, findsOneWidget); + final themeToggleButton = find.byKey(const Key('ToggleTheme')); + expect(themeToggleButton, findsOneWidget); + expect((tester.firstWidget(themeToggleButton) as Switch).value, true); + }); + testWidgets( + "Testing if Settings Screen shows up in dark mode with language selection tile", + (tester) async { + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('AppSettingScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + final languageSwitchTile = find.byKey(const Key('LanguageTile')); + expect(languageSwitchTile, findsOneWidget); + final languageSelectionButton = find.byKey(const Key('LanguageSelector')); + expect(languageSelectionButton, findsOneWidget); + final Language userLanguage = languages.firstWhere( + (element) => + element.langCode == + Provider.of( + locator().navigatorKey.currentContext!, + listen: false, + ).appLocal.languageCode, + ); + expect( + ((tester.firstWidget(languageSelectionButton) as TextButton).child! + as Text) + .data, + userLanguage.langName, + ); + await tester.tap(languageSelectionButton); + await tester.pumpAndSettle(const Duration(seconds: 1)); + }); + testWidgets("Testing if theme changes from dark mode to light mode", + (tester) async { + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('AppSettingScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + final switchThemeTile = find.byKey(const Key('ThemeSwitch')); + expect(switchThemeTile, findsOneWidget); + final themeToggleButton = find.byKey(const Key('ToggleTheme')); + expect(themeToggleButton, findsOneWidget); + expect((tester.firstWidget(themeToggleButton) as Switch).value, true); + await tester.tap(themeToggleButton); + await tester.pumpAndSettle(const Duration(seconds: 1)); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + }); + testWidgets( + "Testing if theme changes from dark mode to light mode then again back to dark mode", + (tester) async { + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('AppSettingScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + final switchThemeTile = find.byKey(const Key('ThemeSwitch')); + expect(switchThemeTile, findsOneWidget); + final themeToggleButton = find.byKey(const Key('ToggleTheme')); + expect(themeToggleButton, findsOneWidget); + expect((tester.firstWidget(themeToggleButton) as Switch).value, true); + await tester.tap(themeToggleButton); + await tester.pumpAndSettle(const Duration(seconds: 1)); + expect((tester.firstWidget(themeToggleButton) as Switch).value, false); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + await tester.tap(themeToggleButton); + await tester.pumpAndSettle(const Duration(seconds: 1)); + expect((tester.firstWidget(themeToggleButton) as Switch).value, true); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + testWidgets('Test Edit Profile Tile is visible and works properly', + (tester) async { + when(userConfig.loggedIn).thenReturn(true); + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + expect(find.text('Profile'), findsOneWidget); + + final editProfile = find.textContaining('Edit Profile'); + await tester.tap(editProfile); + + verify(navigationService.navigatorKey); + }); + testWidgets('Test if help and support tiles are working', (tester) async { + when(userConfig.loggedIn).thenReturn(true); + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + + final talawaDocs = find.textContaining('Talawa Docs'); + final talawaGitHub = find.textContaining('Talawa GitHub'); + + await tester.tap(talawaDocs); + await tester.tap(talawaGitHub); + }); + testWidgets('Test if footerTile is working.', (tester) async { + const userLoggedIn = true; + when(userConfig.loggedIn).thenAnswer((_) => userLoggedIn); + + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('Logout'))); + await tester.pumpAndSettle(); + + final logoutButton = find.textContaining('Logout').last; + await tester.tap(logoutButton); + + unregisterServices(); + registerServices(); + + const loggedIn = false; + when(userConfig.loggedIn).thenAnswer((_) => loggedIn); + + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + + final joinOrgButton = find.textContaining('Join an Organisation'); + await tester.tap(joinOrgButton); + + verify(navigationService.navigatorKey); + }); + + testWidgets('Test if Logout is successful', (tester) async { + when(userConfig.loggedIn).thenAnswer((_) => true); + + final AppSettingViewModel model = AppSettingViewModel(); + + when(model.logout()).thenAnswer((realInvocation) async {}); + + await tester + .pumpWidget(createAppSettingScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('Logout'))); + await tester.pumpAndSettle(); + + final logoutButton = find.textContaining('Logout').last; + expect(logoutButton, findsOneWidget); + await tester.tap(logoutButton); + + verify(model.logout()); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/chat/direct_chats_test.dart b/test/widget_tests/after_auth_screens/chat/direct_chats_test.dart new file mode 100644 index 000000000..03a61ad19 --- /dev/null +++ b/test/widget_tests/after_auth_screens/chat/direct_chats_test.dart @@ -0,0 +1,76 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/chats/chat_list_tile_data_model.dart'; +import 'package:talawa/models/chats/chat_user.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart'; +import 'package:talawa/views/after_auth_screens/chat/direct_chats.dart'; + +import '../../../helpers/test_helpers.dart'; + +Widget createDirectChats() { + return const MaterialApp(home: Scaffold(body: DirectChats())); +} + +final model = locator(); +Widget createChatTile() { + return MaterialApp( + home: Scaffold( + body: ChatTile( + chat: ChatListTileDataModel( + [ + ChatUser( + firstName: 'test', + id: '1', + image: 'fakeHttp', + ), + ], + '1', + ), + model: model, + ), + ), + ); +} + +void main() { + setUp(() { + registerServices(); + registerViewModels(); + }); + + tearDown(() { + unregisterViewModels(); + unregisterServices(); + }); + + group('Tests for direct chats', () { + testWidgets('Check whether DirectChats shows up', (tester) async { + await tester.pumpWidget(createDirectChats()); + await tester.pump(); + + expect(find.byType(DirectChats), findsOneWidget); + expect(find.byType(ChatTile), findsOneWidget); + }); + testWidgets('Check whether ChatTile shows up', (tester) async { + await tester.pumpWidget(createChatTile()); + await tester.pump(); + + expect(find.byType(ChatTile), findsOneWidget); + + await tester.tap(find.byType(ListTile)); + verify( + locator().pushScreen( + Routes.chatMessageScreen, + arguments: ['1', model], + ), + ); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/create_event_form_test.dart b/test/widget_tests/after_auth_screens/events/create_event_form_test.dart new file mode 100644 index 000000000..a8ab9d116 --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/create_event_form_test.dart @@ -0,0 +1,164 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.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/create_event_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/create_event_form.dart'; +import 'package:talawa/views/after_auth_screens/events/create_event_page.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; + +var createEventViewModel = CreateEventViewModel(); + +// TextEditingController eventTitleTextController = TextEditingController(); +// createEventViewModel.eventTitleTextController = eventTitleTextController; + +Widget createCreateEventForm() { + final createEventViewModel = CreateEventViewModel(); + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold(body: CreateEventForm(model: createEventViewModel)), + ); +} + +Widget createEventScreen({ + ThemeMode themeMode = ThemeMode.light, + required ThemeData theme, +}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: theme, + home: const CreateEventPage( + key: Key('CreateEventScreen'), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +void main() { + SizeConfig().test(); + locator.registerSingleton(NavigationService()); + setUp(() { + registerServices(); + registerViewModels(); + }); + + tearDown(() { + unregisterViewModels(); + unregisterServices(); + }); + group('Testing create event form', () { + testWidgets("Test if create event form shows up", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createCreateEventForm()); + await tester.pump(); + expect(find.byType(TextFormField), findsNWidgets(3)); + expect( + find.descendant( + of: find.byType(Form), + matching: find.byType(TextFormField), + ), + findsNWidgets(3), + ); + }); + }); + + testWidgets("Test if create event key are working", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createCreateEventForm()); + await tester.pump(); + expect(find.byKey(const Key('create_event_form_tff1')), findsOneWidget); + expect(find.byKey(const Key('create_event_form_tff2')), findsOneWidget); + expect(find.byKey(const Key('create_event_form_tff3')), findsOneWidget); + }); + }); + testWidgets( + 'Test if form of 1st TextField is submitted on pressing enter on mobile keyboard.', + (tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createCreateEventForm()); + await tester.pump(); + + await tester.enterText( + find.byKey(const Key('create_event_form_tff1')), + 'fakeEventTitle', + ); + await tester.pump(); + await tester.testTextInput.receiveAction(TextInputAction.next); + await tester.pump(); + }); + }); + testWidgets( + 'Test if form of 2nd TextField is submitted on pressing enter on mobile keyboard.', + (tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createCreateEventForm()); + await tester.pump(); + + await tester.enterText( + find.byKey(const Key('create_event_form_tff2')), + 'fakeEventTitle', + ); + await tester.pump(); + await tester.testTextInput.receiveAction(TextInputAction.next); + await tester.pump(); + }); + }); + testWidgets( + 'Test if form of 3rd TextField is submitted on pressing enter on mobile keyboard.', + (tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createCreateEventForm()); + await tester.pump(); + + await tester.enterText( + find.byKey(const Key('create_event_form_tff3')), + 'fakeEventTitle', + ); + await tester.pump(); + await tester.testTextInput.receiveAction(TextInputAction.next); + await tester.pump(); + }); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/create_event_page_test.dart b/test/widget_tests/after_auth_screens/events/create_event_page_test.dart new file mode 100644 index 000000000..baa221a15 --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/create_event_page_test.dart @@ -0,0 +1,456 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/create_event_form.dart'; +import 'package:talawa/views/after_auth_screens/events/create_event_page.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/event_date_time_tile.dart'; +import 'package:talawa/widgets/member_name_tile.dart'; + +/// Creates an instance of CreateEventScreen with the given parameters. +/// +/// **params**: +/// * `themeMode`: ThemeMode of the app +/// * `theme`: ThemeData of the app +/// +/// **returns**: +/// * `Widget`: return the CreateEventScreen widget +Widget createEventScreen({ + ThemeMode themeMode = ThemeMode.light, + required ThemeData theme, +}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: theme, + home: const CreateEventPage( + key: Key('CreateEventScreen'), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +void main() { + setUpAll(() { + SizeConfig().test(); + setupLocator(); + graphqlConfig.test(); + }); + group("Create Event Screen Widget Test in dark mode", () { + group('Check if the validator of the create_event_form is working', () { + testWidgets("Testing if text field validator are working", + (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final addBtn = find.descendant( + of: find.byType(AppBar), + matching: find.byType(TextButton), + ); + await tester.tap(addBtn); + }); + }); + + testWidgets("Testing if dark mode is applied", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme + ?.scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + }); + group("Create Event Screen Widget Test in light mode", () { + testWidgets("Testing if light mode is applied", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme + ?.scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + }); + }); + group('Create Event Screen Widget Test', () { + testWidgets("Testing if Create Event Screen shows up", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey(const Key('CreateEventScreen')); + expect(screenScaffoldWidget, findsOneWidget); + }); + + group("Testing app bar properties and contents", () { + testWidgets("Testing if app bar shows up", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final appBarWidget = tester.firstWidget(appBar) as AppBar; + expect(appBar, findsOneWidget); + expect(appBarWidget.elevation, 1); + }); + testWidgets("Testing close button in app bar", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final appBarWidget = tester.firstWidget(appBar) as AppBar; + final closeBtn = find.descendant( + of: find.byType(AppBar), + matching: find.byType(GestureDetector), + ); + final closeIcon = find.descendant( + of: closeBtn.first, + matching: find.byIcon(Icons.close), + ); + expect(appBarWidget.leading, tester.firstWidget(closeBtn)); + expect( + (appBarWidget.leading as GestureDetector?)?.child, + tester.firstWidget(closeIcon), + ); + }); + testWidgets("Testing title in app bar", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final appBarWidget = tester.firstWidget(appBar) as AppBar; + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final title = find.descendant( + of: find.byType(AppBar), + matching: find.byType(Text), + ); + expect(appBarWidget.title, tester.firstWidget(title)); + expect(appBarWidget.centerTitle, true); + expect( + (appBarWidget.title as Text?)?.data, + appLocalization!.strictTranslate('Add Event'), + ); + expect( + (appBarWidget.title as Text?)?.style!.fontFamily, + TalawaTheme.lightTheme.textTheme.titleLarge!.fontFamily, + ); + expect( + (appBarWidget.title as Text?)?.style!.fontSize, + 20, + ); + }); + testWidgets("Testing add button in app bar", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final appBarWidget = tester.firstWidget(appBar) as AppBar; + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final addBtn = find.descendant( + of: find.byType(AppBar), + matching: find.byType(TextButton), + ); + await tester.tap(addBtn); + final addText = + find.descendant(of: addBtn, matching: find.byType(Text)); + expect(appBarWidget.actions?.length, 1); + expect(appBarWidget.actions?.first, tester.firstWidget(addBtn)); + expect( + (appBarWidget.actions?.first as TextButton?)?.child, + tester.firstWidget(addText), + ); + expect( + ((appBarWidget.actions?.first as TextButton?)?.child as Text?)?.data, + appLocalization!.strictTranslate('Add'), + ); + expect( + ((appBarWidget.actions?.first as TextButton?)?.child as Text?) + ?.style! + .fontSize, + 16, + ); + expect( + ((appBarWidget.actions?.first as TextButton?)?.child as Text?) + ?.style! + .color, + TalawaTheme.lightTheme.colorScheme.secondary, + ); + }); + }); + + group("Testing body properties and contents", () { + testWidgets("Testing Add Image section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final imageIcon = find.descendant( + of: find.byType(Row), + matching: find.byIcon(Icons.image), + ); + final addImageBtn = find.descendant( + of: find.byType(Row), + matching: find.byType(TextButton), + ); + final addImageText = find.descendant( + of: addImageBtn.first, + matching: find.byType(Text), + ); + final imageShowWidget = find.byType(Image); + expect(imageIcon, findsOneWidget); + expect(addImageText, findsOneWidget); + expect( + (tester.widget(addImageText) as Text?)?.data, + appLocalization!.strictTranslate("Add Image"), + ); + expect( + (tester.widget(addImageText) as Text?)?.style!.fontSize, + 16, + ); + expect(imageShowWidget, findsNothing); + }); + testWidgets("Testing if Create Event Form widget shows", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final createEventForm = find.byType(CreateEventForm); + expect(createEventForm, findsOneWidget); + }); + testWidgets("Testing Select Start Date and Time section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final textDesc = find.text( + appLocalization!.strictTranslate('Select Start Date'), + ); + final dateTimeTiles = find.byType(DateTimeTile); + expect(textDesc, findsOneWidget); + expect(dateTimeTiles, findsNWidgets(2)); + + expect( + (tester.widget(textDesc) as Text?)?.style!.fontSize, + 16, + ); + }); + testWidgets("Testing Select End Date and Time section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final textDesc = find.text( + appLocalization!.strictTranslate('Select End Date'), + ); + final dateTimeTiles = find.byType(DateTimeTile); + expect(textDesc, findsOneWidget); + expect(dateTimeTiles, findsNWidgets(2)); + + expect( + (tester.widget(textDesc) as Text?)?.style!.fontSize, + 16, + ); + }); + testWidgets("Testing Does not repeat section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final restoreIcon = find.descendant( + of: find.byType(Row), + matching: find.byIcon(Icons.restore), + ); + final doesNotRepeatText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Does not repeat'), + ), + ); + expect(restoreIcon, findsOneWidget); + expect(doesNotRepeatText, findsOneWidget); + expect( + (tester.widget(doesNotRepeatText) as Text?)?.style!.fontSize, + 16, + ); + }); + testWidgets("Testing Keep public section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final keepPublicText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Keep Public'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(keepPublicText, findsOneWidget); + expect(switches, findsNWidgets(3)); + expect( + (tester.widget(keepPublicText) as Text?)?.style!.fontSize, + 16, + ); + expect((tester.firstWidget(switches) as Switch).value, true); + await tester.ensureVisible(switches.first); + await tester.tap(switches.first); + await tester.pumpAndSettle(); + expect((tester.firstWidget(switches) as Switch).value, false); + }); + testWidgets("Testing Keep Registerable section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final keepRegisterableText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Keep Registerable'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(keepRegisterableText, findsOneWidget); + expect(switches, findsNWidgets(3)); + expect( + (tester.widget(keepRegisterableText) as Text?)?.style!.fontSize, + 16, + ); + expect((tester.widgetList(switches).toList()[1] as Switch).value, true); + await tester.ensureVisible(switches.at(1)); + await tester.tap(switches.at(1)); + await tester.pumpAndSettle(); + expect( + (tester.widgetList(switches).toList()[1] as Switch).value, + false, + ); + }); + testWidgets("Testing Add Members section", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final addMembersText = find.descendant( + of: find.byType(Row), + matching: find.text("Add Members"), + ); + final addIcons = find.byIcon(Icons.add); + final memberNameTiles = find.byType(MemberNameTile); + expect(addMembersText, findsOneWidget); + expect(addIcons, findsNWidgets(1)); + expect( + (tester.widget(addMembersText) as Text?)?.style!.fontSize, + 16, + ); + expect(memberNameTiles, findsNothing); + await tester.ensureVisible(addMembersText.first); + await tester.tap(addMembersText.first); + await tester.pump(); + expect(find.byType(BottomSheet), findsOneWidget); + }); + testWidgets("Testing if cancel button in app bar works", (tester) async { + await tester.pumpWidget( + createEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final closeBtn = find.descendant( + of: appBar, + matching: find.byType(GestureDetector), + ); + await tester.tap(closeBtn.first); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + }); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart b/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart new file mode 100644 index 000000000..c76749397 --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart @@ -0,0 +1,542 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +// ignore_for_file: unused_import + +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:intl/intl.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/database_mutation_functions.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/edit_event_page.dart'; +import 'package:talawa/views/after_auth_screens/events/edit_events_form.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/event_date_time_tile.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_helpers.mocks.dart'; + +Widget editEventScreen({ + ThemeMode themeMode = ThemeMode.light, + required ThemeData theme, +}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, langModel, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: theme, + home: EditEventPage( + key: const Key('EditEventScreen'), + event: Event( + id: '1', + admins: [], + startDate: DateFormat('yMd').format( + DateTime(2021, 1, 1), + ), + endDate: DateFormat('yMd').format( + DateTime(2022, 1, 1), + ), + startTime: DateFormat('h:mm a').format(DateTime(2021, 1, 1)), + endTime: DateFormat('h:mm a').format(DateTime(2022, 1, 1)), + isRegisterable: true, + isPublic: true, + isRegistered: true, + title: "Test Title", + description: "Description Title", + location: "Buea", + ), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +void main() async { + setUpAll(() async { + SizeConfig().test(); + setupLocator(); + graphqlConfig.test(); + }); + + group("Edit Event Screen Widget Test in dark mode", () { + testWidgets("Testing if dark mode is applied", (tester) async { + await tester.pumpWidget( + editEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme + ?.scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + testWidgets("Testing if tapping on Done works", (tester) async { + getAndRegisterUserConfig(); + final service = getAndRegisterEventService(); + locator().init(); + + await tester.pumpWidget(editEventScreen(theme: TalawaTheme.darkTheme)); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Done')); + await tester.pump(); + + verify( + (service as MockEventService) + .editEvent(eventId: '1', variables: anyNamed('variables')), + ); + }); + testWidgets('Tap on Add Image', (tester) async { + await tester.pumpWidget(editEventScreen(theme: TalawaTheme.darkTheme)); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Add Image')); + await tester.pump(); + }); + testWidgets('Tap on DataTimeTile date', (tester) async { + await tester.pumpWidget(editEventScreen(theme: TalawaTheme.darkTheme)); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('EventDateTimeTileDate')).first); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + + await tester.tap(find.text('31')); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + + expect(find.text('2021-01-31'), findsOneWidget); + }); + testWidgets('Tap on DataTimeTile time', (tester) async { + await tester.pumpWidget(editEventScreen(theme: TalawaTheme.darkTheme)); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('EventDateTimeTileTime')).first); + await tester.pump(); + + expect(find.byType(TimePickerDialog), findsOneWidget); + + final center = tester + .getCenter(find.byKey(const ValueKey('time-picker-dial'))); + await tester.tapAt(Offset(center.dx - 10, center.dy)); + await tester.pump(); + await tester.tapAt(Offset(center.dx, center.dy + 10)); + await tester.tap(find.text('OK')); + await tester.pump(); + + expect(find.text('9:30 AM'), findsOneWidget); + }); + testWidgets('Tap on DataTimeTile date for end', (tester) async { + await tester.pumpWidget(editEventScreen(theme: TalawaTheme.darkTheme)); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('EventDateTimeTileDate')).last); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + + await tester.tap(find.text('31')); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + + expect(find.text('2022-01-31'), findsOneWidget); + }); + testWidgets('Tap on DataTimeTile time for end', (tester) async { + await tester.pumpWidget(editEventScreen(theme: TalawaTheme.darkTheme)); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('EventDateTimeTileTime')).last); + await tester.pump(); + + expect(find.byType(TimePickerDialog), findsOneWidget); + + await tester.tap(find.text('PM')); + await tester.tap(find.text('OK')); + await tester.pump(); + + expect(find.text('12:00 PM'), findsOneWidget); + }); + }); + + group("Edit Event Screen Widget Test in light mode", () { + testWidgets("Testing if light mode is applied", (tester) async { + await tester.pumpWidget( + editEventScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme + ?.scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + }); + }); + group('Edit Event Screen Widget Test', () { + testWidgets("Testing if Edit Event Screen shows up", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey(const Key('EditEventScreen')); + expect(screenScaffoldWidget, findsOneWidget); + }); + + group("Testing app bar properties and contents", () { + testWidgets("Testing if app bar shows up", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final appBarWidget = tester.firstWidget(appBar) as AppBar; + expect(appBar, findsOneWidget); + expect(appBarWidget.elevation, 1); + }); + testWidgets("Testing close button in app bar", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final appBarWidget = tester.firstWidget(appBar) as AppBar; + final closeBtn = find.descendant( + of: find.byType(AppBar), + matching: find.byType(GestureDetector), + ); + final closeIcon = find.descendant( + of: closeBtn.first, + matching: find.byIcon(Icons.close), + ); + expect(appBarWidget.leading, tester.firstWidget(closeBtn)); + expect( + (appBarWidget.leading as GestureDetector?)?.child, + tester.firstWidget(closeIcon), + ); + }); + testWidgets("Testing title in app bar", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final appBarWidget = tester.firstWidget(appBar) as AppBar; + final title = find.descendant( + of: find.byType(AppBar), + matching: find.byType(Text), + ); + expect(appBarWidget.title, tester.firstWidget(title)); + expect(appBarWidget.centerTitle, true); + expect( + (appBarWidget.title as Text?)?.data, + 'Edit Event', + ); + expect( + (appBarWidget.title as Text?)?.style!.fontFamily, + TalawaTheme.lightTheme.textTheme.titleLarge!.fontFamily, + ); + expect( + (appBarWidget.title as Text?)?.style!.fontSize, + 20, + ); + }); + testWidgets("Testing done button in app bar", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appBar = find.byType(AppBar); + final appBarWidget = tester.firstWidget(appBar) as AppBar; + final doneBtn = find.descendant( + of: find.byType(AppBar), + matching: find.byType(TextButton), + ); + final doneText = + find.descendant(of: doneBtn, matching: find.byType(Text)); + expect(appBarWidget.actions?.length, 1); + expect(appBarWidget.actions?.first, tester.firstWidget(doneBtn)); + expect( + (appBarWidget.actions?.first as TextButton?)?.child, + tester.firstWidget(doneText), + ); + expect( + ((appBarWidget.actions?.first as TextButton?)?.child as Text?)?.data, + 'Done', + ); + expect( + ((appBarWidget.actions?.first as TextButton?)?.child as Text?) + ?.style! + .fontSize, + 16, + ); + expect( + ((appBarWidget.actions?.first as TextButton?)?.child as Text?) + ?.style! + .color, + TalawaTheme.lightTheme.colorScheme.secondary, + ); + }); + }); + + group("Testing body properties and contents", () { + testWidgets("Testing if cancel button in app bar works", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final closeBtn = find.byIcon(Icons.close); + await tester.tap(closeBtn.first); + await tester.pumpAndSettle(); + }); + testWidgets("Testing Add Image section", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final imageIcon = find.descendant( + of: find.byType(Row), + matching: find.byIcon(Icons.image), + ); + final addImageBtn = find.descendant( + of: find.byType(Row), + matching: find.byType(TextButton), + ); + final addImageText = find.descendant( + of: addImageBtn.first, + matching: find.byType(Text), + ); + final imageShowWidget = find.byType(Image); + expect(imageIcon, findsOneWidget); + expect(addImageText, findsOneWidget); + expect( + (tester.widget(addImageText) as Text?)?.data, + appLocalization!.strictTranslate("Add Image"), + ); + expect( + (tester.widget(addImageText) as Text?)?.style!.fontSize, + 16, + ); + expect(imageShowWidget, findsNothing); + }); + testWidgets("Testing if Edit Event Form widget shows", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final editEventForm = find.byType(EditEventForm); + expect(editEventForm, findsOneWidget); + }); + testWidgets("Testing Select Start Date and Time section", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final textDesc = find.text( + appLocalization!.strictTranslate('Select Start Date and Time'), + ); + final dateTimeTiles = find.byType(DateTimeTile); + expect(textDesc, findsOneWidget); + expect(dateTimeTiles, findsNWidgets(2)); + expect( + (tester.firstWidget(dateTimeTiles) as DateTimeTile).date, + DateTime(2021, 1, 1).toString().split(' ')[0], + ); + expect( + (tester.firstWidget(dateTimeTiles) as DateTimeTile).time, + TimeOfDay.fromDateTime(DateTime(2021, 1, 1)).format( + navigationService.navigatorKey.currentContext!, + ), + ); + expect( + (tester.widget(textDesc) as Text?)?.style!.fontSize, + 16, + ); + }); + testWidgets("Testing Select End Date and Time section", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final textDesc = find.text( + appLocalization!.strictTranslate('Select End Date and Time'), + ); + final dateTimeTiles = find.byType(DateTimeTile); + expect(textDesc, findsOneWidget); + expect(dateTimeTiles, findsNWidgets(2)); + expect( + (tester.widgetList(dateTimeTiles).toList()[1] as DateTimeTile).date, + DateTime(2022, 1, 1).toString().split(' ')[0], + ); + expect( + (tester.widgetList(dateTimeTiles).toList()[1] as DateTimeTile).time, + TimeOfDay.fromDateTime(DateTime(2022, 1, 1)).format( + navigationService.navigatorKey.currentContext!, + ), + ); + expect( + (tester.widgetList(dateTimeTiles).toList()[1] as DateTimeTile).time, + TimeOfDay.fromDateTime(DateTime(2022, 1, 1)).format( + navigationService.navigatorKey.currentContext!, + ), + ); + expect( + (tester.widget(textDesc) as Text?)?.style!.fontSize, + 16, + ); + }); + testWidgets("Testing Does not repeat section", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final restoreIcon = find.descendant( + of: find.byType(Row), + matching: find.byIcon(Icons.restore), + ); + final doesNotRepeatText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Does not repeat'), + ), + ); + expect(restoreIcon, findsOneWidget); + expect(doesNotRepeatText, findsOneWidget); + expect( + (tester.widget(doesNotRepeatText) as Text?)?.style!.fontSize, + 16, + ); + }); + testWidgets("Testing Keep public section", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final keepPublicText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Keep Public'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(keepPublicText, findsOneWidget); + expect(switches, findsNWidgets(2)); + expect( + (tester.widget(keepPublicText) as Text?)?.style!.fontSize, + 16, + ); + expect((tester.firstWidget(switches) as Switch).value, true); + await tester.ensureVisible(switches.first); + await tester.tap(switches.first); + await tester.pumpAndSettle(); + expect((tester.firstWidget(switches) as Switch).value, false); + }); + testWidgets("Testing Keep Registerable section", (tester) async { + await tester.pumpWidget( + editEventScreen( + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final keepRegisterableText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Keep Registerable'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + skipOffstage: false, + ); + expect(keepRegisterableText, findsOneWidget); + expect(switches, findsNWidgets(2)); + expect( + (tester.widget(keepRegisterableText) as Text?)?.style!.fontSize, + 16, + ); + expect((tester.widgetList(switches).toList()[1] as Switch).value, true); + await tester.ensureVisible(switches.at(1)); + await tester.tap(switches.at(1)); + await tester.pumpAndSettle(); + expect( + (tester.widgetList(switches).toList()[1] as Switch).value, + false, + ); + }); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/edit_events_form_test.dart b/test/widget_tests/after_auth_screens/events/edit_events_form_test.dart new file mode 100644 index 000000000..ea563160f --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/edit_events_form_test.dart @@ -0,0 +1,60 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/edit_events_form.dart'; + +import '../../../helpers/test_helpers.dart'; + +Widget createEditEventForm(EditEventViewModel model) => + MaterialApp(home: Scaffold(body: EditEventForm(model: model))); + +void main() { + SizeConfig().test(); + setUp(() { + registerServices(); + registerViewModels(); + }); + tearDown(() { + unregisterViewModels(); + }); + group('Test EditEventForm', () { + testWidgets('Test titleFocus', (tester) async { + final model = EditEventViewModel(); + + await tester.pumpWidget(createEditEventForm(model)); + + await tester.tap(find.byIcon(Icons.edit).first); + + expect(model.titleFocus.hasFocus, true); + }); + testWidgets('Test locationFocus', (tester) async { + final model = EditEventViewModel(); + + await tester.pumpWidget(createEditEventForm(model)); + + await tester.tap(find.byIcon(Icons.edit).at(1)); + + expect(model.locationFocus.hasFocus, true); + }); + testWidgets('Test descriptionFocus', (tester) async { + final model = EditEventViewModel(); + + await tester.pumpWidget(createEditEventForm(model)); + + await tester.tap(find.byIcon(Icons.edit).last); + + expect(model.descriptionFocus.hasFocus, true); + }); + testWidgets('Test descriptionFocus', (tester) async { + final model = EditEventViewModel(); + + await tester.pumpWidget(createEditEventForm(model)); + + expect(model.formKey.currentState!.validate(), false); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/event_calendar_test.dart b/test/widget_tests/after_auth_screens/events/event_calendar_test.dart new file mode 100644 index 000000000..77e87533d --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/event_calendar_test.dart @@ -0,0 +1,185 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:intl/intl.dart'; +import 'package:syncfusion_flutter_datepicker/datepicker.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_calendar_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/event_calendar.dart'; + +import '../../../helpers/test_helpers.dart'; + +Widget createEventCalendar() { + return MaterialApp( + navigatorKey: navigationService.navigatorKey, + home: EventCalendar([ + Event( + title: 'Test', + startDate: '07/14/2022', + startTime: '14:23:01', + endDate: '07/14/2022', + endTime: '21:23:01', + ), + ]), + ); +} + +Widget createEventCalender2() { + return MaterialApp( + navigatorKey: navigationService.navigatorKey, + home: EventCalendar([ + Event( + title: 'Test2', + startDate: '2022-07-14', + startTime: '14:23:01', + endDate: '2022-07-14', + endTime: '21:23:01', + ), + ]), + ); +} + +void main() { + setUp(() { + registerServices(); + }); + group("Test for _parseTime function", () { + test("Test parsing valid time string", () { + const timeString = "5:30 PM"; + final parsedTime = parseTime(timeString); + final expectedTime = DateFormat("h:mm a").parse(timeString); + expect(parsedTime, expectedTime); + }); + test("Test for invalid time string", () { + const timeString = "invalid String "; + + expect(() => parseTime(timeString), throwsException); + }); + test("Test parsing string in hms format", () { + const timeString = "12:12:12"; + + final parsedTime = parseTime(timeString); + final expectTime = DateFormat('Hms').parse(timeString); + + expect(expectTime, parsedTime); + }); + + group('Tests for EventCalendar', () { + setUp(() => locator.registerSingleton(EventCalendarViewModel())); + tearDown(() => locator.unregister()); + testWidgets('Testing if EventCalendar shows up', (tester) async { + await tester.pumpWidget(createEventCalendar()); + await tester.pump(); + + expect(find.byType(EventCalendar), findsOneWidget); + }); + testWidgets('Testing if tapping on date_range shows datePicker', + (tester) async { + await tester.pumpWidget(createEventCalendar()); + await tester.pump(); + + await tester.tap(find.byIcon(Icons.date_range)); + await tester.pumpAndSettle(); + + expect(find.byType(CalendarDatePicker), findsOneWidget); + + await tester.tap(find.text('16')); + await tester.tap(find.text('OK')); + await tester.pump(); + }); + + testWidgets('calendarViewSelection', (tester) async { + await tester.pumpWidget( + createEventCalendar(), + ); + + await tester.pump(); + + final popupButtonFinder = find.byType(PopupMenuButton); + + await tester.tap(popupButtonFinder); + await tester.pumpAndSettle(); + + await tester.tap(find.text("Day")); + await tester.pumpAndSettle(); + + await tester.tap(popupButtonFinder); + await tester.pumpAndSettle(); + + await tester.tap(find.text("Month")); + await tester.pumpAndSettle(); + + await tester.tap(popupButtonFinder); + await tester.pumpAndSettle(); + + await tester.tap(find.text("Schedule")); + await tester.pumpAndSettle(); + + await tester.tap(popupButtonFinder); + await tester.pumpAndSettle(); + + expect(find.text("Day"), findsOne); + expect(find.text("Month"), findsOne); + expect(find.text("Schedule"), findsOne); + }); + testWidgets('Testing if Event model parses dates correctly', + (tester) async { + await tester.pumpWidget(createEventCalendar()); + await tester.pump(); + + final eventCalendar = + tester.widget(find.byType(EventCalendar)); + final event = eventCalendar.eventList[0]; + + DateTime startDate; + DateTime endDate; + if (event.startDate!.contains('/')) { + startDate = DateFormat('MM/dd/yyyy').parse(event.startDate!); + } else { + startDate = DateFormat('yyyy-MM-dd').parse(event.startDate!); + } + if (event.endDate!.contains('/')) { + endDate = DateFormat('MM/dd/yyyy').parse(event.endDate!); + } else { + endDate = DateFormat('yyyy-MM-dd').parse(event.endDate!); + } + + expect(startDate, DateFormat('MM/dd/yyyy').parse('07/14/2022')); + expect(endDate, DateFormat('MM/dd/yyyy').parse('07/14/2022')); + }); + testWidgets("Testing if EventCalendar shows up", (tester) async { + await tester.pumpWidget(createEventCalender2()); + await tester.pump(); + + expect(find.byType(EventCalendar), findsOneWidget); + final eventCalendar = + tester.widget(find.byType(EventCalendar)); + final event = eventCalendar.eventList[0]; + + DateTime startDate; + DateTime endDate; + if (event.startDate!.contains('/')) { + startDate = DateFormat('MM/dd/yyyy').parse(event.startDate!); + } else { + startDate = DateFormat('yyyy-MM-dd').parse(event.startDate!); + } + if (event.endDate!.contains('/')) { + endDate = DateFormat('MM/dd/yyyy').parse(event.endDate!); + } else { + endDate = DateFormat('yyyy-MM-dd').parse(event.endDate!); + } + + expect(startDate, DateFormat('yyyy-MM-dd').parse('2022-07-14')); + expect(endDate, DateFormat('yyyy-MM-dd').parse('2022-07-14')); + }); + }); + test("dateRangePickerController getter", () async { + final EventCalendarViewModel model = EventCalendarViewModel(); + expect(model.dateRangePickerController, isA()); + expect(model.eventList, isA>()); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/event_info_page_test.dart b/test/widget_tests/after_auth_screens/events/event_info_page_test.dart new file mode 100644 index 000000000..25bc32deb --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/event_info_page_test.dart @@ -0,0 +1,184 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail_image_network/mocktail_image_network.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +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/views/after_auth_screens/events/event_info_body.dart'; +import 'package:talawa/views/after_auth_screens/events/event_info_page.dart'; +import 'package:talawa/views/after_auth_screens/events/manage_agenda_items_screen.dart'; +import 'package:talawa/views/after_auth_screens/events/volunteer_groups_screen.dart'; + +import '../../../helpers/test_helpers.dart'; + +/// Creates an instance of Event with the given parameters. +/// +/// **params**: +/// * `isPublic`: event is public or not +/// * `isCreator`: user is creator of the event or not +/// +/// **returns**: +/// * `Event`: return the Event instance +Event getEvent(bool isPublic, bool isCreator) { + return Event( + id: '1', + title: 'test', + startTime: '10000', + endTime: '20000', + location: 'ABC', + description: 'test', + creator: User( + id: isCreator ? "xzy1" : "abc1", + firstName: "Test", + lastName: "User", + email: "testuser@gmail.com", + refreshToken: "testtoken", + authToken: 'testtoken', + ), + startDate: '10000', + endDate: '20000', + admins: [ + User( + id: isCreator ? "xzy1" : "abc1", + firstName: "Test", + lastName: "User", + ), + ], + isPublic: isPublic, + organization: OrgInfo(id: 'XYZ'), + ); +} + +/// Creates an instance of EventInfoPage with the given parameters. +/// +/// **params**: +/// * `isPublic`: whether the event is public or not +/// * `isCreator`: whether the user is the creator of the event or not +/// +/// **returns**: +/// * `Widget`: return the EventInfoPage widget +Widget createEventInfoPage(bool isPublic, bool isCreator) { + return MaterialApp( + localizationsDelegates: [ + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + const AppLocalizationsDelegate(isTest: true), + ], + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + home: EventInfoPage( + args: { + 'event': getEvent(isPublic, isCreator), + 'exploreEventViewModel': ExploreEventsViewModel(), + }, + ), + ); +} + +void main() { + setUp(() { + SizeConfig().test(); + registerServices(); + registerViewModels(); + }); + tearDown(() { + unregisterViewModels(); + }); + group('Test EventInfoPage', () { + testWidgets('Test tab Bar appears', (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget(createEventInfoPage(true, true)); + await tester.pumpAndSettle(); + expect(find.byKey(const Key("tabBar")), findsOneWidget); + }); + }); + + testWidgets('Test event info section appears', (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget(createEventInfoPage(true, true)); + await tester.pumpAndSettle(); + expect(find.byKey(const Key("tabBar")), findsOneWidget); + expect(find.text('Info'), findsOneWidget); + expect(find.byType(EventInfoBody), findsOneWidget); + + //check if delete floating button appears when user is creator + expect(find.byIcon(Icons.delete), findsOneWidget); + await tester.tap(find.byIcon(Icons.delete)); + await tester.pumpAndSettle(); + }); + }); + + testWidgets('Test FloatingActionButton', (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget(createEventInfoPage(true, false)); + await tester.pumpAndSettle(); + + expect( + find.byKey( + const Key("registerEventFloatingbtn"), + ), + findsOneWidget, + ); + + await tester.tap( + find.byKey( + const Key("registerEventFloatingbtn"), + ), + ); + await tester.pumpAndSettle(); + }); + }); + testWidgets('Test if volunteer section appears on swipe left', + (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget(createEventInfoPage(true, true)); + await tester.pumpAndSettle(); + expect(find.byKey(const Key("tabBar")), findsOneWidget); + expect(find.text('Info'), findsOneWidget); + expect(find.byType(VolunteerGroupsScreen), findsNothing); + + await tester.drag( + find.byType(TabBarView), + const Offset(-500.0, 0.0), + ); + await tester.pumpAndSettle(); + + expect(find.byType(EventInfoBody), findsNothing); + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + }); + }); + testWidgets('Test if agenda section appears on swipe left', (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget(createEventInfoPage(true, true)); + await tester.pumpAndSettle(); + expect(find.byKey(const Key("tabBar")), findsOneWidget); + expect(find.text('Info'), findsOneWidget); + expect(find.byType(VolunteerGroupsScreen), findsNothing); + + await tester.drag( + find.byType(TabBarView), + const Offset(-500.0, 0.0), + ); + await tester.pumpAndSettle(); + + expect(find.byType(EventInfoBody), findsNothing); + expect(find.byType(VolunteerGroupsScreen), findsOneWidget); + + await tester.drag( + find.byType(TabBarView), + const Offset(-500.0, 0.0), + ); + await tester.pumpAndSettle(); + + expect(find.byType(VolunteerGroupsScreen), findsNothing); + expect(find.byType(ManageAgendaScreen), findsOneWidget); + }); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/explore_event_dialogue_test.dart b/test/widget_tests/after_auth_screens/events/explore_event_dialogue_test.dart new file mode 100644 index 000000000..c286ff262 --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/explore_event_dialogue_test.dart @@ -0,0 +1,277 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/after_auth_screens/events/explore_event_dialogue.dart'; +import 'package:talawa/widgets/date_time_picker.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +Widget createExploreEventDialog() { + return MaterialApp( + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + home: Builder( + builder: (context) { + return Container( + child: TextButton( + key: const Key('TextButtonKey'), + onPressed: () { + showDialog( + context: context, + builder: (_) => const ExploreEventDialog( + key: Key('ExploreEventDialog'), + ), + ); + }, + child: const Text('EventDialog'), + ), + ); + }, + ), + ); +} + +void main() { + DateTime startDate = DateTime.now().toLocal(); + // DateTime _endDate = DateTime.now().add(const Duration(days: 1)).toLocal(); + setUp(() { + registerServices(); + locator().test(); + }); + + tearDown(() { + unregisterServices(); + }); + + Future prepareDatePicker( + WidgetTester tester, + Future Function(Future date) callback, + ) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('TextButtonKey'))); + final date = customDatePicker(initialDate: startDate); + await tester.pumpAndSettle(); + + final okButton = find.text('OK'); + + await tester.tap(okButton); + await tester.pumpAndSettle(); + + expect(find.text(startDate.toString().split(' ')[0]), findsOneWidget); + await tester.ensureVisible(find.byKey(const Key('StartDateSelector'))); + await tester.tap(find.byKey(const Key('StartDateSelector'))); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + callback(date); + } + + group('Tests for DatePicker', () { + testWidgets('Testing the OK button', (tester) async { + await prepareDatePicker(tester, (date) async { + expect(find.text('OK'), findsOneWidget); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + + expect( + (await date).toString().split(' ')[0], + DateTime.now().toLocal().toString().split(' ')[0], + ); + + expect( + find.textContaining( + (await date).toLocal().toString().split(' ')[0], + ), + findsOneWidget, + ); + }); + }); + testWidgets('Testing the Cancel button', (tester) async { + await prepareDatePicker(tester, (date) async { + final cancelBtnFinder = find.text('Cancel').last; + expect(cancelBtnFinder, findsOneWidget); + await tester.tap(cancelBtnFinder); + await tester.pumpAndSettle(); + expect( + find.textContaining( + (await date).toLocal().toString().split(' ')[0], + ), + findsOneWidget, + ); + }); + }); + + testWidgets('Changing Date test', (tester) async { + await prepareDatePicker(tester, (val) async { + expect(find.text('OK'), findsOneWidget); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + + final date = customDatePicker(initialDate: startDate); + await tester.pumpAndSettle(); + + await tester.tap(find.text('10')); + await tester.pumpAndSettle(const Duration(seconds: 1)); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + expect( + (await date).toString().split(' ')[0], + DateTime(DateTime.now().year, DateTime.now().month, 10) + .toString() + .split(' ')[0], + ); + startDate = await date; + await tester.pumpAndSettle(); + expect(find.byKey(const Key('TextButtonKey')), findsOneWidget); + + expect( + startDate, + DateTime(DateTime.now().year, DateTime.now().month, 10), + ); + }); + }); + }); + + group('Tests for Explore Event Dialogue', () { + locator.registerSingleton(SizeConfig()); + + testWidgets('Tap on StartDateSelector', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + await tester.tap(find.byKey(const Key('StartDateSelector'))); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + + await tester.tap(find.text('16')); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + }); + testWidgets('Tap on EndDateSelector', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + await tester.tap(find.byKey(const Key('EndDateSelector'))); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + + await tester.tap(find.text('16')); + await tester.tap(find.text('OK')); + await tester.pump(); + }); + + testWidgets('Testing Explore Event dialog layout', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + + expect(find.byType(TextButton), findsOneWidget); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + expect(find.byType(ExploreEventDialog), findsOneWidget); + + final startDateText = find.text('Start Date'); + expect(startDateText, findsOneWidget); + + final endDateText = find.text('End Date'); + expect(endDateText, findsOneWidget); + + final cancelButtonText = find.text('Cancel'); + expect(cancelButtonText, findsOneWidget); + + final doneButtonText = find.text('Done'); + expect(doneButtonText, findsOneWidget); + }); + + testWidgets('Test for Cancel button', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + expect(find.byType(ExploreEventDialog), findsOneWidget); + + final cancelButton = find.byKey(const Key('CancelButton')); + expect(cancelButton, findsOneWidget); + await tester.tap(cancelButton); + await tester.pumpAndSettle(); + }); + + testWidgets('Test for Done button', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + expect(find.byType(ExploreEventDialog), findsOneWidget); + + final doneButton = find.byKey(const Key('DoneButton')); + expect(doneButton, findsOneWidget); + }); + + testWidgets('Test for selecting Start Date', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + final startDateButton = find.byKey(const Key('StartDateSelector')); + expect(startDateButton, findsOneWidget); + }); + testWidgets('Test for selecting End Date', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + final endDateButton = find.byKey(const Key('EndDateSelector')); + expect(endDateButton, findsOneWidget); + }); + + testWidgets('Testing the Cancel button', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + // finding Cancel Button + final x = find.text('Cancel'); + expect(x, findsOneWidget); + + await tester.tap(x); + expect(find.byKey(const Key('TextButtonKey')), findsOneWidget); + }); + testWidgets('Testing the Done button', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + // finding Done Button + final x = find.text('Done'); + expect(x, findsOneWidget); + + await tester.tap(x); + expect(find.byKey(const Key('TextButtonKey')), findsOneWidget); + }); + }); +} 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 new file mode 100644 index 000000000..e405c1370 --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/explore_events_test.dart @@ -0,0 +1,334 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:mockito/mockito.dart'; +import 'package:mocktail_image_network/mocktail_image_network.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/navigation_service.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'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/events/event_calendar.dart'; +import 'package:talawa/views/after_auth_screens/events/explore_event_dialogue.dart'; +import 'package:talawa/views/after_auth_screens/events/explore_events.dart'; +import 'package:talawa/widgets/custom_drawer.dart'; +import 'package:talawa/widgets/event_card.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_helpers.mocks.dart'; +import '../../../helpers/test_locator.dart'; + +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, + ); + +final List cachedEvents = [ + Event( + id: "event001", + title: "Annual Tech Conference", + description: + "A conference where tech enthusiasts gather to discuss the latest trends.", + location: "Tech Park, Silicon Valley", + recurring: false, + allDay: true, + startDate: "2024-09-10", + endDate: "2024-09-10", + startTime: "09:00 AM", + endTime: "05:00 PM", + isPublic: true, + isRegistered: false, + isRegisterable: true, + creator: User(id: "user123", firstName: "Alice Johnson"), + organization: OrgInfo(id: userConfig.currentOrg.id, name: "Tech Community"), + admins: [ + User(id: "admin001", firstName: "Bob Smith"), + User(id: "admin002", firstName: "Carol Lee"), + ], + attendees: [ + Attendee( + id: "attendee001", + firstName: "David", + lastName: "Brown", + image: "https://example.com/david.jpg", + ), + Attendee( + id: "attendee002", + firstName: "Eve", + lastName: "White", + image: "https://example.com/eve.jpg", + ), + ], + ), + Event( + id: "event002", + title: "Community Cleanup", + description: + "Join us for a community-wide effort to clean up our local park.", + location: "Central Park", + recurring: true, + allDay: false, + startDate: "2024-08-25", + endDate: "2024-08-25", + startTime: "08:00 AM", + endTime: "12:00 PM", + isPublic: true, + isRegistered: true, + isRegisterable: true, + creator: User(id: "user124", firstName: "John Doe"), + organization: OrgInfo(id: userConfig.currentOrg.id, name: "Green Earth"), + admins: [ + User(id: "admin003", firstName: "Sam Green"), + ], + attendees: [ + Attendee( + id: "attendee003", + firstName: "Paul", + lastName: "Black", + image: "https://example.com/paul.jpg", + ), + ], + ), + Event( + id: "event003", + title: "Coding Workshop", + description: "A hands-on workshop to improve coding skills.", + location: "TechHub, Downtown", + recurring: false, + allDay: false, + startDate: "2024-09-15", + endDate: "2024-09-15", + startTime: "10:00 AM", + endTime: "04:00 PM", + isPublic: false, + isRegistered: false, + isRegisterable: false, + creator: User(id: "user125", firstName: "Micheal Young"), + organization: OrgInfo(id: userConfig.currentOrg.id, name: "Code Masters"), + admins: [ + User(id: "admin004", firstName: "Sara Blue"), + ], + attendees: [], + ), + Event( + id: "event004", + title: "Startup Pitch Day", + description: "Pitch your startup ideas to investors and get feedback.", + location: "Innovation Hub", + recurring: false, + allDay: false, + startDate: "2024-10-05", + endDate: "2024-10-05", + startTime: "11:00 AM", + endTime: "03:00 PM", + isPublic: false, + isRegistered: true, + isRegisterable: true, + creator: User(id: "user126", firstName: "Emma Davis"), + organization: + OrgInfo(id: userConfig.currentOrg.id, name: "Startup Network"), + admins: [ + User(id: "admin005", firstName: "Jake Wilson"), + User(id: "admin006", firstName: "Nina Harris"), + ], + attendees: [ + Attendee( + id: "attendee004", + firstName: "Chris", + lastName: "Miller", + image: "https://example.com/chris.jpg", + ), + ], + ), +]; + +void main() { + SizeConfig().test(); + setUp(() { + registerServices(); + registerViewModels(); + locator.unregister(); + locator.registerSingleton(EventService()); + final eventBox = Hive.box(HiveKeys.eventFeedKey); + eventBox.addAll(cachedEvents); + }); + tearDown(() { + unregisterViewModels(); + }); + group("Test Explore Events Screen Widget:", () { + testWidgets("Testing if tapping on calendar works", (tester) async { + await mockNetworkImages(() async { + final homeModel = locator(); + + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Filter by Date')); + await tester.pump(); + + expect(find.byType(ExploreEventDialog), findsOneWidget); + }); + }); + testWidgets("Testing if tapping on calendar works when no events", + (tester) async { + await mockNetworkImages(() async { + locator.unregister(); + + final StreamController> streamController = + StreamController(); + final Stream> stream = + streamController.stream.asBroadcastStream(); + + final service = MockEventService(); + when(service.eventStream).thenAnswer((invocation) => stream); + locator.registerSingleton(service); + + final homeModel = locator(); + + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pumpAndSettle(); + + expect( + find.text("Looks like there aren't any events."), + findsOneWidget, + ); + }); + }); + testWidgets("Testing if drawer opens up", (tester) async { + await mockNetworkImages(() async { + final homeModel = locator(); + + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pump(); + // find by icon menu + expect(find.byIcon(Icons.menu), findsOneWidget); + // tap on icon menu + await tester.tap(find.byIcon(Icons.menu)); + await tester.pump(); + + // expect the drawer to be open + expect(find.byType(CustomDrawer), findsOneWidget); + }); + }); + testWidgets("Testing if showSearch works", (tester) async { + await mockNetworkImages(() async { + final homeModel = locator(); + + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pumpAndSettle(); + + expect(find.byIcon(Icons.search), findsOneWidget); + + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + expect(find.byIcon(Icons.clear), findsOneWidget); + expect(find.byIcon(Icons.arrow_back), findsOneWidget); + }); + }); + testWidgets("Testing if refresh works", (tester) async { + await mockNetworkImages(() async { + final homeModel = locator(); + + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pumpAndSettle(); + + await tester.drag( + find.byKey(const Key('ExploreEvents')), + const Offset(0, 500), + ); + await tester.pumpAndSettle(); + + verify(locator().refreshEvents()).called(2); + }); + }); + testWidgets("Testing if tapping on add icon and EventCard works", + (tester) async { + await mockNetworkImages(() async { + final homeModel = locator(); + + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pumpAndSettle(); + + await tester.tap(find.byIcon(Icons.add)); + await tester.pumpAndSettle(); + + verify(locator().pushScreen("/createEventPage")) + .called(1); + + await tester.tap(find.byType(EventCard).first); + await tester.pumpAndSettle(); + + verify( + locator() + .pushScreen("/eventInfo", arguments: anyNamed('arguments')), + ).called(1); + }); + }); + testWidgets("Testing if drop down 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'); + }); + }); + testWidgets("Testing if tapping on Calendar button works", (tester) async { + await mockNetworkImages(() async { + final homeModel = locator(); + + await tester.pumpWidget(createExploreEventsScreen(homeModel)); + await tester.pumpAndSettle(); + + expect(find.byType(EventCalendar), findsNothing); + + await tester.tap( + find.byIcon( + Icons.calendar_month, + ), + ); + await tester.pumpAndSettle(); + }); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/events/time_conversion_test.dart b/test/widget_tests/after_auth_screens/events/time_conversion_test.dart new file mode 100644 index 000000000..435375942 --- /dev/null +++ b/test/widget_tests/after_auth_screens/events/time_conversion_test.dart @@ -0,0 +1,162 @@ +import 'package:clock/clock.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/time_conversion.dart'; + +import '../../../helpers/test_helpers.dart'; + +void main() { + group('Time Conversion Utils', () { + setUp(() { + registerServices(); + }); + + tearDown(() { + unregisterServices(); + }); + + test('combineDateTime combines date and time correctly', () { + expect(combineDateTime('2023-05-01', '14:30:00'), '2023-05-01 14:30:00'); + }); + + test('splitDateTimeUTC splits UTC datetime correctly', () { + final result = splitDateTimeUTC('2023-05-01T14:30:00.000Z'); + expect(result['date'], '2023-05-01'); + expect(result['time'], '14:30:00.000Z'); + }); + + test('splitDateTimeUTC returns empty map for invalid input', () { + final result = splitDateTimeUTC('invalid-datetime'); + expect(result, isEmpty); + }); + + test('splitDateTimeLocal splits local datetime correctly', () { + final result = splitDateTimeLocal('2023-05-01T14:30:00.000'); + expect(result['date'], '2023-05-01'); + expect(result['time'], '14:30'); + }); + + test('splitDateTimeLocal returns empty map for invalid input', () { + final result = splitDateTimeLocal('invalid-datetime'); + expect(result, isEmpty); + }); + + test('convertUTCToLocal converts UTC to local time', () { + const utcTime = '2023-05-01T14:30:00.000Z'; + final localTime = convertUTCToLocal(utcTime); + expect(localTime, isNot(equals(utcTime))); + expect( + localTime, + matches(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}$'), + ); + }); + + test('convertUTCToLocal returns empty string for invalid input', () { + final localTime = convertUTCToLocal('invalid-datetime'); + expect(localTime, isEmpty); + }); + + test('convertLocalToUTC converts local to UTC time', () { + const localTime = '2023-05-01T14:30:00.000'; + final utcTime = convertLocalToUTC(localTime); + expect(utcTime, isNot(equals(localTime))); + expect( + utcTime, + matches(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$'), + ); + }); + + test('convertLocalToUTC returns empty string for invalid input', () { + final utcTime = convertLocalToUTC('invalid-datetime'); + expect(utcTime, isEmpty); + }); + + group('traverseAndConvertDates', () { + test('converts direct fields', () { + final testObj = { + 'createdAt': '2023-05-01T14:30:00.000Z', + 'name': 'Test', + }; + traverseAndConvertDates(testObj, convertUTCToLocal, splitDateTimeLocal); + expect(testObj['createdAt'], isNot(equals('2023-05-01T14:30:00.000Z'))); + expect( + testObj['createdAt'], + matches(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}$'), + ); + }); + + test('converts paired fields', () { + final testObj = { + 'startDate': '2023-05-01', + 'startTime': '14:30:00', + 'name': 'Test', + }; + traverseAndConvertDates(testObj, convertUTCToLocal, splitDateTimeLocal); + expect(testObj['startDate'], '2023-05-01'); + expect(testObj['startTime'], matches(r'^\d{2}:\d{2}$')); + }); + + test('handles invalid date/time in traverseAndConvertDates', () { + final testObj = { + 'createdAt': 'invalid-datetime', + 'startDate': 'invalid-date', + 'startTime': 'invalid-time', + 'name': 'Test', + }; + traverseAndConvertDates(testObj, convertUTCToLocal, splitDateTimeLocal); + expect(testObj['createdAt'], isEmpty); + expect(testObj['startDate'], isEmpty); + expect(testObj['startTime'], isEmpty); + }); + + test('converts nested objects', () { + final testObj = { + 'user': { + 'createdAt': '2023-05-01T14:30:00.000Z', + 'name': 'Test User', + }, + }; + traverseAndConvertDates(testObj, convertUTCToLocal, splitDateTimeLocal); + expect( + testObj['user']?['createdAt'], + isNot(equals('2023-05-01T14:30:00.000Z')), + ); + expect( + testObj['user']?['createdAt'], + matches(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}$'), + ); + }); + + test('converts objects in lists', () { + withClock(Clock.fixed(DateTime.utc(2023, 5, 1, 12, 0)), () { + final testObj = { + 'items': [ + {'createdAt': '2023-05-01T14:30:00.000Z'}, + {'createdAt': '2023-05-02T15:45:00.000Z'}, + ], + }; + traverseAndConvertDates( + testObj, + convertUTCToLocal, + splitDateTimeLocal, + ); + expect( + testObj['items']?[0]['createdAt'], + isNot(equals('2023-05-01T14:30:00.000Z')), + ); + expect( + testObj['items']?[0]['createdAt'], + matches(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}$'), + ); + expect( + testObj['items']?[1]['createdAt'], + isNot(equals('2023-05-02T15:45:00.000Z')), + ); + expect( + testObj['items']?[1]['createdAt'], + matches(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}$'), + ); + }); + }); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/feed/individual_post_test.dart b/test/widget_tests/after_auth_screens/feed/individual_post_test.dart new file mode 100644 index 000000000..e223fb682 --- /dev/null +++ b/test/widget_tests/after_auth_screens/feed/individual_post_test.dart @@ -0,0 +1,427 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/comment/comment_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/after_auth_screens/feed/individual_post.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +final LikedBy user = LikedBy(sId: "test_id"); + +final u1 = User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', +); +final u2 = User( + id: '123', + firstName: 'Ayush', + lastName: 'Chaudhary', + email: 'test@test.com', +); +final List users = [u1, u2]; + +final LikedBy l1 = LikedBy(sId: 'test1'); +final LikedBy l2 = LikedBy(sId: 'test2'); +final List likeby = [l1, l2]; + +final comment1 = Comments(sId: 'comment1'); +final comment2 = Comments(sId: 'comment2'); +final comment3 = Comments(sId: 'comment3'); +final List comments1 = [comment1, comment2, comment3]; + +final myBirthday = DateTime.utc(2004, DateTime.june, 16, 5, 30, 0, 0, 0); +final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday, + description: 'test description', + imageUrl: 'https://image.com', + videoUrl: 'https://image.com', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments1, +); + +Widget createLikedUserCircleAvatarWidget({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: likedUserCircleAvatar(user), + ), + ); +} + +final comment = Comment( + creator: User( + id: '123', + firstName: 'Ayush', + lastName: 'Chaudhary', + email: 'test@test.com', + ), + createdAt: '123456', + text: 'test text', + post: 'test post', + likeCount: 'test count', +); + +List comments = [ + Comments(sId: 'comment1'), + Comments(sId: 'comment2'), + Comments(sId: 'comment3'), + Comments(sId: 'comment4'), + Comments(sId: 'comment5'), + Comments(sId: 'comment6'), +]; + +Widget createCommentTemplateWidget({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: CommentTemplate( + comment: comment, + ), + ), + ); +} + +Widget createIndividualPageLikeSectionWidget({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: IndividualPageLikeSection( + usersLiked: [ + LikedBy(sId: 'test1'), + LikedBy(sId: 'test2'), + LikedBy(sId: 'test3'), + LikedBy(sId: 'test4'), + ], + ), + ), + ); +} + +Widget createIndividualPostCommentSectionWidget({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: IndividualPostCommentSection( + comments: comments, + postID: 'test post id', + ), + ), + ); +} + +Widget createIndividualPostViewWidget({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, + required Post post1, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: IndividualPostView( + post: post1, + ), + ), + ); +} + +void main() { + // locator.registerSingleton(LikeButtonViewModel()); + + setUpAll(() { + SizeConfig().test(); + testSetupLocator(); + registerServices(); + }); + + group('Individualpostview tests', () { + // testWidgets("Check if the IndividualPostView shows up", + // (WidgetTester tester) async { + // await tester.runAsync(() async { + // ///making a sample data + // /// also wrote all the detail + // /// used in the individual post + // + // final commentJson1 = { + // 'creator': { + // '_id': '123', + // 'firstName': 'Ayush', + // 'lastName': 'Chaudhary', + // 'email': 'test@test.com', + // }, + // 'createdAt': '123456', + // 'text': 'test text', + // 'post': 'test post', + // 'likeCount': 'test count', + // }; + // final commentJson2 = { + // 'creator': { + // '_id': '123', + // 'firstName': 'John', + // 'lastName': 'Doe', + // 'email': 'test@test.com', + // }, + // 'createdAt': '123456', + // 'text': 'test text', + // 'post': 'test post', + // 'likeCount': 'test count', + // }; + // + // final commentsJson = [commentJson1, commentJson2]; + // + // ///returning a service response through mocking, + // ///this method was called in + // ///comment view model and was returning null + // ///until I made a mock response. + // + // when(commentsService.getCommentsForPost('PostID')) + // .thenAnswer((realInvocation) async { + // return commentsJson; + // }); + // + // /// using the mock post made before me + // + // final Post post = getPostMockModel(); + // + // ///returning mock reponse of post model when + // ///.likedby is called on the model + // + // when(post.likedBy).thenReturn([LikedBy(sId: "xzy1")]); + // + // await tester.pumpWidget(createIndividualPostViewWidget(post1: post)); + // await tester.pump(); + // + // /// checking if the individual post + // /// screen pops up + // + // expect(find.byType(Scaffold), findsNWidgets(2)); + // + // ///finding the text field via its ID + // + // final textfield = find.byKey(const Key('indi_post_tf_key')); + // + // /// check if the textfield shows up + // + // expect(textfield, findsOneWidget); + // + // ///finding the text field via its type + // + // final textbtn = find.byType(TextButton); + // + // ///check if btn exist + // + // expect(textbtn, findsOneWidget); + // + // ///checking if the onPressed of + // ///text button is working when tapped + // + // await tester.tap(textbtn); + // await tester.pump(); + // + // ///tapping the text field + // ///to check if it shows up + // + // await tester.tap(textfield); + // await tester.pump(); + // + // /// Checking if the submit button is working, + // /// when keyboard send action is called + // + // await tester.showKeyboard(textfield); + // + // /// keyboard action can be + // /// simulated using the + // /// testTextInput method + // + // await tester.testTextInput.receiveAction(TextInputAction.send); + // await tester.pump(); + // }); + // }); + }); + + group('Test for likedUserCircleAvatar', () { + testWidgets('Check if the likedUserCircleAvatar shows up', (tester) async { + await tester.pumpWidget(createLikedUserCircleAvatarWidget()); + await tester.pump(); + + final findStack = find.byType(Stack); + + expect(findStack, findsNWidgets(2)); + }); + }); + + group('Test for IndividualPageLikeSection', () { + testWidgets('Check if the IndividualPageLikeSection shows up', + (tester) async { + await tester.pumpWidget(createIndividualPageLikeSectionWidget()); + await tester.pump(); + + final findColumn = find.byType(Column); + + expect(findColumn, findsNWidgets(1)); + }); + + testWidgets( + 'Check if the likedUserCircleAvatar in IndividualPageLikeSection shows up', + (tester) async { + await tester.pumpWidget(createIndividualPageLikeSectionWidget()); + await tester.pump(); + + final findStack = find.byType(Stack); + + expect(findStack, findsNWidgets(5)); + }); + }); + + group('Test for CommentTemplate', () { + testWidgets('Check if the CommentTemplate shows up', (tester) async { + await tester.pumpWidget(createCommentTemplateWidget()); + await tester.pump(); + + final findStack = find.byType(Row); + + expect(findStack, findsNWidgets(1)); + }); + + testWidgets('Check if the name is displayed in CommentTemplate ', + (tester) async { + await tester.pumpWidget(createCommentTemplateWidget()); + await tester.pump(); + + final findStack = find.text('Ayush Chaudhary'); + + expect(findStack, findsNWidgets(1)); + }); + + testWidgets('Check if the comment text is displayed in CommentTemplate ', + (tester) async { + await tester.pumpWidget(createCommentTemplateWidget()); + await tester.pump(); + + final findStack = find.text('test text'); + + expect(findStack, findsNWidgets(1)); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/feed/organization_feed_test.dart b/test/widget_tests/after_auth_screens/feed/organization_feed_test.dart new file mode 100644 index 000000000..b7072707c --- /dev/null +++ b/test/widget_tests/after_auth_screens/feed/organization_feed_test.dart @@ -0,0 +1,289 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:talawa/models/post/post_model.dart'; +import 'package:talawa/router.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/after_auth_screens/feed/organization_feed.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/post_list_widget.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_helpers.mocks.dart'; +import '../../../helpers/test_locator.dart'; + +Widget createOrganizationFeedScreen({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, + required MainScreenViewModel homeModel, +}) { + return MaterialApp( + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + key: MainScreenViewModel.scaffoldKey, + body: OrganizationFeed( + homeModel: homeModel, + key: const Key('test_key'), + ), + ), + ); +} + +// late OrganizationFeedViewModel _organizationFeedViewModel; + +Widget createOrganizationFeedScreen2({ + bool viewOnMap = true, + required MainScreenViewModel homeModel, +}) { + return BaseView( + onModelReady: (model) => model.initialize(), + // builder: (context, langModel, child) { + // return BaseView( + // onModelReady: (model) { + // model.initialise(); + // _organizationFeedViewModel = model; + // }, + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + key: MainScreenViewModel.scaffoldKey, + body: OrganizationFeed( + homeModel: homeModel, + key: const Key('test_key'), + forTest: true, + ), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: generateRoute, + ); + }, + // ); + // }, + ); +} + +final post = Post( + sId: "test_post_id", + creator: userConfig.currentUser, + likedBy: [], + description: 'Testing', + comments: [Comments(sId: 'cmmnt1')], + createdAt: DateTime.now(), + organization: userConfig.currentOrg, +); + +void main() { + late MockOrganizationFeedViewModel mockViewModel; + + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + registerServices(); + mockViewModel = MockOrganizationFeedViewModel(); + locator.unregister(); + locator.registerSingleton(mockViewModel); + }); + + tearDownAll(() { + unregisterServices(); + }); + + group('tests for Organizaiton feed Screen', () { + testWidgets('check if orgname is displayed shows up', (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(true); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.userPosts).thenReturn([]); + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen(homeModel: model)); + await tester.pump(); + + final finder = find.text('testOrg'); + expect(finder, findsOneWidget); + }); + testWidgets('check if side drawer shows up', (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(true); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.userPosts).thenReturn([]); + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen(homeModel: model)); + await tester.pump(); + + final finder = find.byIcon(Icons.menu); + + await tester.tap(finder); + await tester.pump(); + }); + testWidgets('check if Circular Indicator shows up when fetching posts', + (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(true); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.userPosts).thenReturn([]); + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen(homeModel: model)); + await tester.pump(); + + final finder = find.byType(CircularProgressIndicator); + expect(finder, findsOneWidget); + }); + testWidgets("check if the refresh indicator works fine", (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.posts) + .thenReturn([post, post, post, post, post, post]); + when(mockViewModel.pinnedPosts).thenReturn([post]); + final model = locator(); + + await tester.pumpWidget(createOrganizationFeedScreen(homeModel: model)); + await tester.pump(); + + bool refreshed = false; + when(mockViewModel.fetchNewPosts()).thenAnswer((_) async { + refreshed = true; + }); + await tester.drag( + find.byType(RefreshIndicator), + const Offset(0, 400), + ); + await tester.pumpAndSettle(); + + expect(refreshed, true); + }); + testWidgets('check if pinned posts shows up if not empty', (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.posts).thenReturn([post]); + when(mockViewModel.pinnedPosts).thenReturn([post]); + + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen2(homeModel: model)); + await tester.pumpAndSettle(); + + final finder = find.byKey(const Key('pinnedPosts')); + expect(finder, findsOneWidget); + }); + testWidgets('check if posts shows up if not empty', (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.posts).thenReturn([post]); + when(mockViewModel.pinnedPosts).thenReturn([post]); + + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen2(homeModel: model)); + await tester.pumpAndSettle(); + + final finder = find.byType(PostListWidget); + expect(finder, findsOneWidget); + }); + testWidgets('check if no posts shows up then No posts text is there', + (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.posts).thenReturn([]); + when(mockViewModel.pinnedPosts).thenReturn([post]); + + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen2(homeModel: model)); + await tester.pumpAndSettle(); + + final finder = find.text('There are no posts in this organization'); + expect(finder, findsOneWidget); + }); + testWidgets( + 'check if no posts shows up then create post textButton is present', + (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.posts).thenReturn([]); + when(mockViewModel.pinnedPosts).thenReturn([post]); + + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen2(homeModel: model)); + await tester.pumpAndSettle(); + + final finder = find.text('Create your first post'); + expect(finder, findsOneWidget); + await tester.tap(finder); + await tester.pumpAndSettle(); + }); + testWidgets( + 'check if nextPage function is called when scrolled to the bottom edge', + (tester) async { + when(mockViewModel.currentOrgName).thenReturn('testOrg'); + when(mockViewModel.isFetchingPosts).thenReturn(false); + when(mockViewModel.isBusy).thenReturn(false); + when(mockViewModel.initialise()).thenReturn(null); + when(mockViewModel.posts) + .thenReturn([post, post, post, post, post, post]); + when(mockViewModel.pinnedPosts).thenReturn([post]); + bool nextPageCalled = false; + when(mockViewModel.nextPage()).thenAnswer((_) async { + nextPageCalled = true; + }); + + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen(homeModel: model)); + await tester.pumpAndSettle(); + + await tester.drag( + find.byKey(const Key('listView')), + const Offset(0, 10), + ); + + await tester.drag( + find.byKey(const Key('listView')), + const Offset(10, 20), + ); + print(nextPageCalled); + // Verify that nextPage function is called + expect(nextPageCalled, true); + verify(mockViewModel.nextPage()).called(1); + verify(mockViewModel.previousPage()).called(1); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/feed/pinned_post_page_test.dart b/test/widget_tests/after_auth_screens/feed/pinned_post_page_test.dart new file mode 100644 index 000000000..4d0b3957a --- /dev/null +++ b/test/widget_tests/after_auth_screens/feed/pinned_post_page_test.dart @@ -0,0 +1,62 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/after_auth_screens/feed/pinned_post_page.dart'; +import 'package:talawa/widgets/post_list_widget.dart'; +import 'package:talawa/widgets/post_widget.dart'; +import 'package:visibility_detector/visibility_detector.dart'; + +import '../../../helpers/test_helpers.dart'; + +Widget createPinnedPostPage() { + return MaterialApp( + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + home: PinnedPostPage( + pinnedPosts: [ + Post( + sId: 'post1', + creator: User(firstName: 'firstName1'), + createdAt: DateTime.now(), + description: 'description1', + comments: [], + ), + ], + ), + ); +} + +void main() { + setUp(() { + registerServices(); + registerViewModels(); + }); + + group('Tests for pinned post page', () { + testWidgets('Check whether PinnedPostPage shows up', (tester) async { + VisibilityDetectorController.instance.updateInterval = Duration.zero; + + await tester.pumpWidget(createPinnedPostPage()); + await tester.pump(); + + expect(find.byType(PinnedPostPage), findsOneWidget); + expect(find.byType(PostListWidget), findsOneWidget); + expect(find.byType(NewsPost), findsOneWidget); + expect(find.textContaining('firstName1'), findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/feed/pinned_post_screen_test.dart b/test/widget_tests/after_auth_screens/feed/pinned_post_screen_test.dart new file mode 100644 index 000000000..c61cb973b --- /dev/null +++ b/test/widget_tests/after_auth_screens/feed/pinned_post_screen_test.dart @@ -0,0 +1,74 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/pre_auth_screens/signup_details.dart'; + +import '../../../helpers/test_locator.dart'; + +Widget createApp() { + final Map postDetails = { + 'title': 'Debate over stocks bybacks.', + 'postId': 'agdjvfhsjaf', + 'imageUrl': + 'https://m.wsj.net/video/20200105/wsjglossarystockbuybackssplash/wsjglossarystockbuybackssplash_640x360.jpg', + 'time': '9', + }; + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: TextButton( + onPressed: () async { + final OrgInfo org = OrgInfo( + id: '2', + name: 'test org', + userRegistrationRequired: false, + creatorInfo: User(firstName: 'test', lastName: 'test'), + ); + print(org); + await navigationService.pushScreen( + '/pinnedpostscreen', + arguments: postDetails, + ); + }, + child: const Text('Ayush'), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + + testSetupLocator(); + }); + + group('description', () { + testWidgets('Check if SignUp screen shows up', (tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + + expect(find.byType(SignUpDetails), findsNothing); + + await tester.tap(find.textContaining('Ayush')); + await tester.pumpAndSettle(); + + // expect(find.byType(SignUpDetails), findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/after_auth_screens/profile/edit_profile_page_test.dart b/test/widget_tests/after_auth_screens/profile/edit_profile_page_test.dart new file mode 100644 index 000000000..652995996 --- /dev/null +++ b/test/widget_tests/after_auth_screens/profile/edit_profile_page_test.dart @@ -0,0 +1,469 @@ +import 'dart:io'; +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/constants/custom_theme.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/after_auth_screens/profile/edit_profile_page.dart'; +import 'package:talawa/views/base_view.dart'; + +import '../../../helpers/test_helpers.dart'; +import '../../../helpers/test_locator.dart'; + +/// MockBuildContext class helps to mock the BuildContext class. +class MockBuildContext extends Mock implements BuildContext {} + +/// MockEditProfilePageViewModel class helps to mock the EditProfilePageViewModel class. +class MockEditProfilePageViewModel extends Mock + implements EditProfilePageViewModel {} + +/// MockCallbackFunction class helps to mock the callback function. +class MockCallbackFunction extends Mock { + /// call function helps to mock the call function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void call(); +} + +/// 'createEditProfilePage' is used to create the EditProfilePage widget in light mode. +/// +/// **params**: +/// * `themeMode`: Represents the theme mode of the widget. +/// +/// **returns**: +/// * `Widget`: Returns the EditProfilePage widget. +Widget createEditProfilePage({ThemeMode themeMode = ThemeMode.light}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: themeMode == ThemeMode.light + ? TalawaTheme.lightTheme + : TalawaTheme.darkTheme, + home: const EditProfilePage(), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); +Future main() async { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + locator().test(); + }); + group('Edit Profile Screen Widget Test in light mode', () { + testWidgets("Testing if Edit Profile Screen shows up", (tester) async { + userConfig.updateUser( + User(firstName: 'Test', lastName: 'Test', email: 'test@test.com'), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.light)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + final appBarText = find.byKey( + const Key('ProfileText'), + ); + expect(appBarText, findsOneWidget); + }); + testWidgets("Testing if Edit Screen shows image when not exist in database", + (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + userConfig.updateUser( + User(firstName: 'Test', lastName: 'Test', email: 'test@test.com'), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.light)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + final imageWidgetWithPicture = find.byKey( + const Key('profilepic'), + ); + expect(imageWidgetWithPicture, findsOneWidget); + }); + }); + testWidgets( + "Testing if Edit Screen shows image when already exist in database", + (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + userConfig.updateUser( + User( + firstName: 'Test', + lastName: 'Test', + email: 'test@test.com', + image: 'https://via.placeholder.com/150', + ), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.light)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + final imageWidgetWithPicture = find.byKey( + const Key('profilepic'), + ); + expect(imageWidgetWithPicture, findsOneWidget); + }); + }); + testWidgets("Testing if image selection and removal works", (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + userConfig.updateUser( + User(firstName: 'Test', lastName: 'Test', email: 'test@test.com'), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.light)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + final imageAvatar = find.byKey( + const Key('AddRemoveImageButton'), + ); + expect(imageAvatar, findsOneWidget); + tester.tap(imageAvatar); + }); + }); + }); + group('Edit Profile Screen Widget Test in dark mode', () { + testWidgets("Testing if Edit Profile Screen shows up", (tester) async { + userConfig.updateUser( + User(firstName: 'Test', lastName: 'Test', email: 'test@test.com'), + ); + await tester.pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + final appBarText = find.byKey( + const Key('ProfileText'), + ); + expect(appBarText, findsOneWidget); + }); + const Key('profilepic'); + testWidgets( + "Testing if Edit Screen shows image when already exist in database", + (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + + userConfig.updateUser( + User( + firstName: 'Test', + lastName: 'Test', + email: 'test@test.com', + image: 'https://via.placeholder.com/150', + ), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + final imageWidgetWithPicture = find.byKey( + const Key('profilepic'), + ); + expect(imageWidgetWithPicture, findsOneWidget); + }); + }); + testWidgets("Testing if modalSheet appears when changing profile picture", + (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + + userConfig.updateUser( + User( + firstName: 'Test', + lastName: 'Test', + email: 'test@test.com', + image: 'https://via.placeholder.com/150', + ), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + await tester.tap(find.byKey(const Key('AddRemoveImageButton'))); + await tester.pumpAndSettle(); + expect(find.text('Camera'), findsOneWidget); + expect(find.text('Gallery'), findsOneWidget); + expect(find.byIcon(Icons.camera_alt), findsOneWidget); + expect(find.byIcon(Icons.photo_library), findsOneWidget); + }); + }); + testWidgets("Testing if image selection from camera work fine", + (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + + userConfig.updateUser( + User( + firstName: 'Test', + lastName: 'Test', + email: 'test@test.com', + image: 'https://via.placeholder.com/150', + ), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + await tester.tap(find.byKey(const Key('AddRemoveImageButton'))); + await tester.pumpAndSettle(); + expect(find.text('Camera'), findsOneWidget); + expect(find.text('Gallery'), findsOneWidget); + expect(find.byIcon(Icons.camera_alt), findsOneWidget); + expect(find.byIcon(Icons.photo_library), findsOneWidget); + + await tester.ensureVisible(find.byIcon(Icons.camera_alt)); + await tester.tap(find.byIcon(Icons.camera_alt)); + }); + }); + testWidgets("Testing if image selection from gallery work fine", + (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + + userConfig.updateUser( + User( + firstName: 'Test', + lastName: 'Test', + email: 'test@test.com', + image: 'https://via.placeholder.com/150', + ), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + await tester.tap(find.byKey(const Key('AddRemoveImageButton'))); + await tester.pumpAndSettle(); + expect(find.text('Camera'), findsOneWidget); + expect(find.text('Gallery'), findsOneWidget); + expect(find.byIcon(Icons.camera_alt), findsOneWidget); + expect(find.byIcon(Icons.photo_library), findsOneWidget); + + await tester.ensureVisible(find.byIcon(Icons.photo_library)); + await tester.tap(find.byIcon(Icons.photo_library)); + }); + }); + testWidgets("Testing if image selection and removal works", (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + userConfig.updateUser( + User(firstName: 'Test', lastName: 'Test', email: 'test@test.com'), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + final imageAvatar = find.byKey( + const Key('AddRemoveImageButton'), + ); + expect(imageAvatar, findsOneWidget); + tester.tap(imageAvatar); + }); + }); + testWidgets("Testing Update butoon", (tester) async { + await mockNetworkImages(() async { + userConfig.updateUser(User()); + userConfig.updateUser( + User(firstName: 'Test', lastName: 'Test', email: 'test@test.com'), + ); + await tester + .pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('EditProfileScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + final updateButtonFinder = find.byKey(const Key('updatebtn')); + expect(updateButtonFinder, findsOneWidget); + await tester.tap(updateButtonFinder); + await tester.pumpAndSettle(); + }); + }); + }); + group('Testing image selection and removal in Edit Profile Screen', () { + setUp(() { + registerServices(); + //locator().test(); + }); + + tearDown(() { + unregisterServices(); + }); + + testWidgets( + 'Testing image selection when user is selecting image from device', + (tester) async { + final notifyListenerCallback = MockCallbackFunction(); + final model = EditProfilePageViewModel() + ..addListener(notifyListenerCallback); + model.initialize(); + + // with camera true + final file = File('fakePath'); + when(multimediaPickerService.getPhotoFromGallery(camera: true)) + .thenAnswer((_) async { + return file; + }); + await model.selectImage(camera: true); + verify(multimediaPickerService.getPhotoFromGallery(camera: true)); + expect(model.imageFile, file); + verify(notifyListenerCallback()); + await tester.pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + expect(find.byKey(const Key('AddRemoveImageButton')), findsOneWidget); + await tester.tap(find.byKey(const Key('AddRemoveImageButton'))); + await tester.pumpAndSettle(); + await tester.tap(find.byIcon(Icons.camera_alt)); + await tester.pumpAndSettle(); + expect(model.imageFile, isNotNull); + }); + testWidgets('Testing if image removal work properly', (tester) async { + final notifyListenerCallback = MockCallbackFunction(); + final model = EditProfilePageViewModel() + ..addListener(notifyListenerCallback); + model.initialize(); + + // testing removeImage + model.removeImage(); + expect(model.imageFile, null); + verify(notifyListenerCallback()); + }); + + // Testing onPressed for firstName + testWidgets("Testing if firstName text field gets focus", (tester) async { + userConfig.updateUser( + User(firstName: 'Test', lastName: 'Test', email: 'test@test.com'), + ); + await tester.pumpWidget(createEditProfilePage(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('FirstNameTextField'))); + await tester.pumpAndSettle(); + + // Verify the focus + expect( + FocusScope.of(tester.element(find.byType(EditProfilePage))) + .focusedChild! + .hasPrimaryFocus, + true, + ); + }); + }); +} diff --git a/test/widget_tests/events_page_test.dart b/test/widget_tests/events_page_test.dart deleted file mode 100644 index 8522d7840..000000000 --- a/test/widget_tests/events_page_test.dart +++ /dev/null @@ -1,82 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/events/events.dart'; - -Widget createEventsPageScreen() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ], - child: const MaterialApp( - home: Events(), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("events Page Tests", () { - testWidgets("Testing if events page shows up", (tester) async { - await tester.pumpWidget(createEventsPageScreen()); - - /// Verify if [events page] shows up. - expect(find.byKey(const Key('EVENTS_APP_BAR')), findsOneWidget); - expect(find.text('Events'), findsOneWidget); - }); - - testWidgets("Testing overflow of events page in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(440, 800); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createEventsPageScreen()); - - /// Verify if [events page] shows up. - expect(find.byKey(const Key('EVENTS_APP_BAR')), findsOneWidget); - expect(find.text('Events'), findsOneWidget); - }); - - testWidgets("Testing overflow of events Page in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createEventsPageScreen()); - - /// Verify if [events page] shows up. - expect(find.byKey(const Key('EVENTS_APP_BAR')), findsOneWidget); - expect(find.text('Events'), findsOneWidget); - }); - - testWidgets("Testing if add event fab shows up", (tester) async { - await tester.pumpWidget(createEventsPageScreen()); - - /// Verify if [events page] shows up. - expect(find.byKey(const Key('EVENTS_APP_BAR')), findsOneWidget); - expect(find.text('Events'), findsOneWidget); - - //get the fab - final addEventFab = find.byType(FloatingActionButton); - expect(addEventFab, findsOneWidget); - }); - }); -} diff --git a/test/widget_tests/groups_page_test.dart b/test/widget_tests/groups_page_test.dart deleted file mode 100644 index 34495e5a5..000000000 --- a/test/widget_tests/groups_page_test.dart +++ /dev/null @@ -1,92 +0,0 @@ -// Packages imports. -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/chat/groups.dart'; - -Widget groupsPage() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ], - child: const MaterialApp( - home: Groups(), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("Groups page Tests", () { - testWidgets("Testing if Groups page shows up", (tester) async { - await tester.pumpWidget(groupsPage()); - - /// Verify if [Groups page] shows up. - expect( - find.byType(Groups), - findsOneWidget, - ); - }); - - testWidgets("Testing overflow of Groups page in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(440, 800); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(groupsPage()); - - /// Verify if [Groups page] shows up. - expect( - find.byType(Groups), - findsOneWidget, - ); - }); - - testWidgets("Testing overflow of Groups page in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(groupsPage()); - - /// Verify if [Groups page] shows up. - expect( - find.byType(Groups), - findsOneWidget, - ); - }); - - testWidgets("empty groups for user with no org", (tester) async { - await tester.pumpWidget(groupsPage()); - - final emptyTextWidget = find.byKey(const Key('empty_chat_group')); - - expect(emptyTextWidget, findsOneWidget); - - // get the [ListView] widget - final listView = find.byType(ListView); - expect( - listView, - findsNothing, - ); - }); - }); -} diff --git a/test/widget_tests/home_page_test.dart b/test/widget_tests/home_page_test.dart deleted file mode 100644 index 7e79ac07d..000000000 --- a/test/widget_tests/home_page_test.dart +++ /dev/null @@ -1,135 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/home_page.dart'; - -Widget createHomePageScreen() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ChangeNotifierProvider(create: (_) => PostProvider()), - ], - child: const MaterialApp( - home: HomePage(), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - group('HomePage Widget Test', () { - testWidgets("Testing if HomePage shows up", (tester) async { - await tester.pumpWidget(createHomePageScreen()); - // debugDumpApp(); - // Verify if HomePage Page shows up by checking PersistentTabView. - expect(find.byType(PersistentTabView), findsOneWidget); - }); - - testWidgets("Testing overflow of New Article in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(440, 800); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createHomePageScreen()); - // Verify if HomePage Page shows up by checking PersistentTabView. - expect(find.byType(PersistentTabView), findsOneWidget); - }); - - testWidgets("Testing overflow of New Article in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createHomePageScreen()); - // Verify if HomePage Page shows up by checking PersistentTabView. - expect(find.byType(PersistentTabView), findsOneWidget); - }); - - testWidgets('Verifying presence of icons in HomePage', (tester) async { - await tester.pumpWidget(createHomePageScreen()); - //detecting icons by find.byIcon(Icons.home) - expect(find.byIcon(Icons.home), findsOneWidget); - expect(find.byIcon(Icons.chat), findsOneWidget); - expect(find.byIcon(Icons.calendar_today), findsOneWidget); - expect(find.byIcon(Icons.group), findsOneWidget); - expect(find.byIcon(Icons.folder), findsOneWidget); - }); - - testWidgets('Verifying if the first page is NEWSFEED', (tester) async { - await tester.pumpWidget(createHomePageScreen()); - expect(find.byKey(const Key('NEWSFEED_APP_BAR')), findsOneWidget); - //any other page should not be there - expect(find.byKey(const Key('GROUPS_APP_BAR')), findsNothing); - }); - - testWidgets('Testing if Groups Page Shows up', (tester) async { - await tester.runAsync(() async { - await tester.pumpWidget(createHomePageScreen()); - //checking if the first page is newsfeed page - expect(find.byKey(const Key('NEWSFEED_APP_BAR')), findsOneWidget); - expect(find.byKey(const Key('GROUPS_APP_BAR')), findsNothing); - final chatIcon = find.byIcon(Icons.chat); - //tapping the chatIcon - await tester.tap(chatIcon); - await tester.pump(); - // //Group page should be present - expect(find.byKey(const Key('GROUPS_APP_BAR')), findsOneWidget); - }); - }); - - testWidgets('Testing if Events Page Shows up', (tester) async { - await tester.pumpWidget(createHomePageScreen()); - //checking if the first page is newsfeed page - expect(find.byKey(const Key('NEWSFEED_APP_BAR')), findsOneWidget); - //Events page should be absent - expect(find.byKey(const Key('EVENTS_APP_BAR')), findsNothing); - final calendarIcon = find.byIcon(Icons.calendar_today); - //tapping on calendarIcon - await tester.tap(calendarIcon); - await tester.pump(); - //events page should show up - expect(find.byKey(const Key('EVENTS_APP_BAR')), findsOneWidget); - }); - - testWidgets('Testing if Member Page Shows up', (tester) async { - await tester.pumpWidget(createHomePageScreen()); - //checking if newsfeed page is present - expect(find.byKey(const Key('NEWSFEED_APP_BAR')), findsOneWidget); - expect(find.byKey(const Key('ORGANIZATION_APP_BAR')), findsNothing); - final Finder groupIcon = find.byIcon(Icons.group); - await tester.tap(groupIcon); - await tester.pump(); - //Member page should show up - expect(find.byKey(const Key('ORGANIZATION_APP_BAR')), findsOneWidget); - }); - - testWidgets('Testing if Profile Page Shows up', (tester) async { - await tester.pumpWidget(createHomePageScreen()); - //checking if newsfeed page is present - expect(find.byKey(const Key('NEWSFEED_APP_BAR')), findsOneWidget); - expect(find.byKey(const Key('PROFILE_PAGE_SCAFFOLD')), findsNothing); - final folderIcon = find.byIcon(Icons.folder); - await tester.tap(folderIcon); - await tester.pump(); - //profile page should show up - expect(find.byKey(const Key('PROFILE_PAGE_SCAFFOLD')), findsOneWidget); - }); - }); -} diff --git a/test/widget_tests/member_details.dart b/test/widget_tests/member_details.dart deleted file mode 100644 index ed33a0c4d..000000000 --- a/test/widget_tests/member_details.dart +++ /dev/null @@ -1,113 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/members/member_details.dart'; - -Widget createProfileScreen( - {String creatorId, List admins, Map member, Color color}) => - MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ], - child: MaterialApp( - home: MemberDetail( - color: color, - creatorId: creatorId, - admins: admins, - member: member, - ))); - -void main() { - group('Member Info Page Widget Tests', () { - testWidgets('When member is creator of the organization ', (tester) async { - final Map memberData = { - '_id': '5f566b32dc1b6076634d30a0', - 'firstName': 'Arya', - 'lastName': 'Stark', - 'email': 'arya@stark.com', - 'image': null - }; - final List adminsData = [ - {'_id': '5f566b32dc1b6076634d30a0'}, - {'_id': '5f566b32dsie6076634d30a0'} - ]; - await tester.pumpWidget( - createProfileScreen( - admins: adminsData, - creatorId: '5f566b32dc1b6076634d30a0', - member: memberData, - color: Colors.blue), - const Duration(microseconds: 100)); - - final privilegeFinder = find.text('User Privileges: Creator'); - //finding the privilege text widget - expect(privilegeFinder, findsOneWidget); - }); - - testWidgets('When member is admin of the organization ', (tester) async { - final Map memberData = { - '_id': '5f566b32dc1b6076634d30a0', - 'firstName': 'Arya', - 'lastName': 'Stark', - 'email': 'arya@stark.com', - 'image': null - }; - final List adminsData = [ - {'_id': '5f566b32dc1b6076634d30a0'}, - {'_id': '5f566badsie6076634d30a0'} - ]; - await tester.pumpWidget( - createProfileScreen( - admins: adminsData, - creatorId: '5f566b32dc1b60766ake30a0', - member: memberData, - color: Colors.blue), - const Duration(microseconds: 100)); - - final privilegeFinder = find.text('User Privileges: Admin'); - //finding the privilege text widget - expect(privilegeFinder, findsOneWidget); - }); - - testWidgets('When member is not a creator/admin of the organization ', - (tester) async { - final Map memberData = { - '_id': '5f566b32dc1b6076634d30a0', - 'firstName': 'Arya', - 'lastName': 'Stark', - 'email': 'arya@stark.com', - 'image': null - }; - final List adminsData = [ - {'_id': '5f566b32dc2j5076634d30a0'}, - {'_id': '5f566badsie6076634d30a0'} - ]; - await tester.pumpWidget( - createProfileScreen( - admins: adminsData, - creatorId: '5f566b32dc1b60766ake30a0', - member: memberData, - color: Colors.blue), - const Duration(microseconds: 100)); - - final privilegeFinder = find.text('User Privileges: Member'); - //finding the privilege text widget - expect(privilegeFinder, findsOneWidget); - }); - }); -} diff --git a/test/widget_tests/member_page_test.dart b/test/widget_tests/member_page_test.dart deleted file mode 100644 index a9836c1ac..000000000 --- a/test/widget_tests/member_page_test.dart +++ /dev/null @@ -1,66 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/members/members.dart'; - -Widget createMemberPageScreen() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ], - child: const MaterialApp( - home: Organizations(), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("member Page Tests", () { - testWidgets("Testing if member page shows up", (tester) async { - await tester.pumpWidget(createMemberPageScreen()); - - /// Verify if [member page] shows up. - expect(find.byKey(const Key('ORGANIZATION_APP_BAR')), findsOneWidget); - }); - - testWidgets("Testing overflow of Member page in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(440, 800); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createMemberPageScreen()); - - /// Verify if [memberpage] shows up. - expect(find.byKey(const Key('ORGANIZATION_APP_BAR')), findsOneWidget); - }); - testWidgets("Testing overflow of Member Page in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createMemberPageScreen()); - - /// Verify if [LoginPage] shows up. - expect(find.byKey(const Key('ORGANIZATION_APP_BAR')), findsOneWidget); - }); - }); -} diff --git a/test/widget_tests/news_article_test.dart b/test/widget_tests/news_article_test.dart deleted file mode 100644 index fa31330c1..000000000 --- a/test/widget_tests/news_article_test.dart +++ /dev/null @@ -1,131 +0,0 @@ -// Packages imports. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/controllers/post_controller.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/newsfeed/news_article.dart'; - -Widget newsArticlePage() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ChangeNotifierProvider( - create: (_) => PostController(), - ), - ChangeNotifierProvider( - create: (_) => CommentHandler(), - ), - ], - child: const MaterialApp( - home: NewsArticle( - index: 0, - post: { - '_id': '605259ecb1257f67811d7ae3', - 'text': 'ndlnldwnl', - 'title': 'naanlls' - }, - ), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("News Article Tests", () { - testWidgets("Testing if newsArticle Page shows up", (tester) async { - await tester.pumpWidget(newsArticlePage()); - - /// Verify if [News Article Page] shows up. - - expect( - find.byType(TextField), - findsOneWidget, - ); - }); - - testWidgets("Testing overflow of New Article in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(440, 800); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(newsArticlePage()); - - /// Verify if [News Article Page] shows up. - expect( - find.byType(TextField), - findsOneWidget, - ); - }); - - testWidgets("Testing overflow of New Article in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(newsArticlePage()); - - /// Verify if [News Article Page] shows up. - expect( - find.byType(TextField), - findsOneWidget, - ); - }); - - testWidgets("Load Comments Button is working", (tester) async { - await tester.pumpWidget(newsArticlePage()); - - // Get the Load Comment button. - final loadCommentsButton = find.text("Load Comments"); - - // Tap on the loadCommentsButton. - await tester.tap(loadCommentsButton); - await tester.pumpAndSettle(); - - // Comments Icon Should be displayed. - const iconKey = ValueKey('commentIcon'); - - expect( - find.byKey(iconKey), - findsWidgets, - ); - }); - }); - - testWidgets("Check if Leave a Comments Button is Working", - (WidgetTester tester) async { - //find all the widget needed - - final leaveCommentTextField = - find.byKey(const ValueKey('leaveCommentField')); - final leaveCommentButton = find.byKey(const ValueKey('leaveCommentButton')); - - //execute the test - await tester.pumpWidget(newsArticlePage()); - await tester.enterText(leaveCommentTextField, "hello how are you"); - await tester.tap(leaveCommentButton); - await tester.pump(); - - //check output - expect(find.text("hello how are you"), findsOneWidget); - }); -} diff --git a/test/widget_tests/organization_settings_test.dart b/test/widget_tests/organization_settings_test.dart deleted file mode 100644 index 7016751e3..000000000 --- a/test/widget_tests/organization_settings_test.dart +++ /dev/null @@ -1,170 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:talawa/views/pages/organization/organization_settings.dart'; - -Widget createProfileScreen({bool isCreator, List organization, bool public}) => - MaterialApp( - home: OrganizationSettings( - creator: isCreator, - organization: organization, - public: public, - ), - ); - -void main() { - group('Organization Page Widget Tests', () { - testWidgets( - 'When user is creator of the organization and organization is not public', - (tester) async { - final List joinedCreator = [ - { - 'image': null, - '_id': '60581ebccf13b54d55284afd', - 'name': 'Test', - 'admins': [ - {'_id': '60573d99cf13b54d55284aac'} - ], - 'description': 'Test', - 'isPublic': false, - 'creator': { - '_id': '60573d99cf13b54d55284aac', - 'firstName': 'Test', - 'lastName': 'Test' - } - } - ]; - - await tester.pumpWidget( - createProfileScreen( - public: false, - isCreator: true, - organization: joinedCreator, - ), - const Duration(microseconds: 100)); - - //finding the update organization tile so that the creator can update organization - expect(find.byKey(const Key('Update Organization')), findsOneWidget); - //finding the Accept MemberShip Requests tile so that creator can accept member joining requests - expect( - find.byKey(const Key('Accept MemberShip Requests')), findsOneWidget); - //finding the Member(s) tile so that the creator can see all the members of the organization and can remove/make them admin - expect(find.byKey(const Key('Member(s)')), findsOneWidget); - //finding the remove organization tile so that the creator can remove the organization - expect(find.byKey(const Key('Remove This Organization')), findsOneWidget); - }); - - testWidgets( - 'When user is creator of the organization and organization is public', - (tester) async { - final List joinedCreator = [ - { - 'image': null, - '_id': '60581ebccf13b54d55284afd', - 'name': 'Test', - 'admins': [ - {'_id': '60573d99cf13b54d55284aac'} - ], - 'description': 'Test', - 'isPublic': true, - 'creator': { - '_id': '60573d99cf13b54d55284aac', - 'firstName': 'Test', - 'lastName': 'Test' - } - } - ]; - - await tester.pumpWidget( - createProfileScreen( - public: false, - isCreator: true, - organization: joinedCreator, - ), - const Duration(microseconds: 100)); - - //finding the update organization tile so that the creator can update organization - expect(find.byKey(const Key('Update Organization')), findsOneWidget); - //finding the Accept MemberShip Requests tile so that creator can accept member joining requests - expect(find.byKey(const Key('Member(s)')), findsOneWidget); - //finding the remove organization tile so that the creator can remove the organization - expect(find.byKey(const Key('Remove This Organization')), findsOneWidget); - }); - - testWidgets( - 'When user is admin of the organization and organization is not public', - (tester) async { - final List joinedCreator = [ - { - 'image': null, - '_id': '60581ebccf13b54d55284afd', - 'name': 'Test', - 'admins': [ - {'_id': '60573d99cf13b54d55284aac'} - ], - 'description': 'Test', - 'isPublic': false, - 'creator': { - '_id': '60573d99cf13b54d55284aac', - 'firstName': 'Test', - 'lastName': 'Test' - } - } - ]; - - await tester.pumpWidget( - createProfileScreen( - public: false, - isCreator: false, - organization: joinedCreator, - ), - const Duration(microseconds: 100)); - - //finding the update organization tile so that the admin can update organization - expect(find.byKey(const Key('Update Organization')), findsOneWidget); - //finding the Accept MemberShip Requests tile so that admin can accept member joining requests - expect( - find.byKey(const Key('Accept MemberShip Requests')), findsOneWidget); - //finding the Member(s) tile so that the admin can see all the members of the organization and can remove/make them admin - expect(find.byKey(const Key('Member(s)')), findsOneWidget); - //finding the leave organization tile so that the admin can leave the organization - expect(find.byKey(const Key('Leave Organization')), findsOneWidget); - }); - - testWidgets( - 'When user is admin of the organization and organization is public', - (tester) async { - final List joinedCreator = [ - { - 'image': null, - '_id': '60581ebccf13b54d55284afd', - 'name': 'Test', - 'admins': [ - {'_id': '60573d99cf13b54d55284aac'} - ], - 'description': 'Test', - 'isPublic': false, - 'creator': { - '_id': '60573d99cf13b54d55284aac', - 'firstName': 'Test', - 'lastName': 'Test' - } - } - ]; - - await tester.pumpWidget( - createProfileScreen( - public: false, - isCreator: false, - organization: joinedCreator, - ), - const Duration(microseconds: 100)); - - //finding the update organization tile so that the creator can update organization - expect(find.byKey(const Key('Update Organization')), findsOneWidget); - //finding the Accept MemberShip Requests tile so that creator can accept member joining requests - expect(find.byKey(const Key('Member(s)')), findsOneWidget); - //finding the leave organization tile so that the admin can leave the organization - expect(find.byKey(const Key('Leave Organization')), findsOneWidget); - }); - }); -} diff --git a/test/widget_tests/pre_auth_screens/change_password_page_test.dart b/test/widget_tests/pre_auth_screens/change_password_page_test.dart new file mode 100644 index 000000000..d70a068f7 --- /dev/null +++ b/test/widget_tests/pre_auth_screens/change_password_page_test.dart @@ -0,0 +1,313 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/views/pre_auth_screens/change_password.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +import '../../helpers/test_locator.dart'; + +/// 'createChangePassScreen' is used to create the EditProfilePage widget in light mode. +/// +/// **params**: +/// * `themeMode`: Represents the theme mode of the widget. +/// +/// **returns**: +/// * `Widget`: Returns the ChangePass widget. +Widget createChangePassScreen({ThemeMode themeMode = ThemeMode.light}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: themeMode == ThemeMode.light + ? TalawaTheme.lightTheme + : TalawaTheme.darkTheme, + home: const ChangePass(key: Key('ChangePass')), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + locator().test(); + }); + group('Change Password Screen Widget Test in light mode', () { + testWidgets("Testing if Change Password Screen shows up", (tester) async { + await tester + .pumpWidget(createChangePassScreen(themeMode: ThemeMode.light)); + await tester.pumpAndSettle(); + final iconButton = find.byIcon(Icons.arrow_back); + + final screenScaffoldWidget = find.byKey( + const Key('ChangePassScreenScaffold'), + ); + expect(iconButton, findsOneWidget); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + await tester.tap(iconButton); + await tester.pumpAndSettle(); + }); + testWidgets("Testing if custom rich text shows up", (tester) async { + //pushing recover screen + await tester + .pumpWidget(createChangePassScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + + //initializing the custom rich text widget Finder + final customRichTextWidget = find.byKey( + const Key('ChangePageText'), + ); + + //initializing the greeting text + final greeting = [ + { + 'text': + "${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("Hello")}, ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': + '${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("User Name")} ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24), + }, + { + 'text': + "${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("we've")} ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': + '${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("got you covered")} ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + ]; + + //finding the custom rich text widget + expect(customRichTextWidget, findsOneWidget); + + //testing greeting text + expect( + (tester.firstWidget(customRichTextWidget) as CustomRichText).words, + greeting, + ); + }); + testWidgets("Testing the Password Input text form field", (tester) async { + //pushing change pass Screen + await tester + .pumpWidget(createChangePassScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + + //initializing the pass input field widget Finder + final passInputFieldWidget = find.byKey(const Key('PassInputField')); + //initializing the confirm pass input field widget Finder + final passConfirmInputFieldWidget = + find.byKey(const Key('PassRepeatInputField')); + //initializing the text field suffix button widget Finder + final findChangePassButton = + find.byKey(const Key('ChangePasswordButton')); + //initializing the null pass Submission widget Finder + final nullPassSubmission = find.text('Password must not be left blank'); + //initializing the invalid password submission widget Finder + final invalidPassSubmission = find.text( + 'Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)', + ); + //initializing the invalid password submission widget Finder + final misMatchPassSubmission = + find.text('Password does not match original'); + + //finding the pass input text field + expect(passInputFieldWidget, findsOneWidget); + //finding the confirm pass input text field + expect(passConfirmInputFieldWidget, findsOneWidget); + //finding the recover button + expect(findChangePassButton, findsOneWidget); + + //inputting a invalid pass in the field + await tester.enterText(passInputFieldWidget, 'nontext'); + //submitting the field with invalid input + await tester.ensureVisible(findChangePassButton); + await tester.tap(findChangePassButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the invalidPassSubmission widget appears + expect(invalidPassSubmission, findsOneWidget); + + //without inputting text in the field + await tester.enterText(passInputFieldWidget, ''); + //submitting the field with null input + await tester.tap(findChangePassButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullPassSubmission widget appears + expect(nullPassSubmission, findsOneWidget); + + //not matching confirm pass + await tester.enterText(passInputFieldWidget, 'Test@123'); + await tester.enterText(passConfirmInputFieldWidget, 'Test@12'); + //submitting the field with mismatch password input + await tester.tap(findChangePassButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullPassSubmission widget appears + expect(misMatchPassSubmission, findsOneWidget); + }); + }); + group('Change Password Screen Widget Test in dark mode', () { + testWidgets("Testing if Change Password Screen shows up", (tester) async { + await tester + .pumpWidget(createChangePassScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + // finding scaffold is present + final screenScaffoldWidget = find.byKey( + const Key('ChangePassScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + testWidgets("Testing if custom rich text shows up", (tester) async { + //pushing recover screen + await tester + .pumpWidget(createChangePassScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + + //initializing the custom rich text widget Finder + final customRichTextWidget = find.byKey( + const Key('ChangePageText'), + ); + + //initializing the greeting text + final greeting = [ + { + 'text': + "${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("Hello")}, ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': + '${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("User Name")} ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24), + }, + { + 'text': + "${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("we've")} ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': + '${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("got you covered")} ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + ]; + + //finding the custom rich text widget + expect(customRichTextWidget, findsOneWidget); + + //testing greeting text + expect( + (tester.firstWidget(customRichTextWidget) as CustomRichText).words, + greeting, + ); + }); + testWidgets("Testing the Password Input text form field", (tester) async { + //pushing change pass Screen + await tester + .pumpWidget(createChangePassScreen(themeMode: ThemeMode.dark)); + await tester.pumpAndSettle(); + + //initializing the pass input field widget Finder + final passInputFieldWidget = find.byKey(const Key('PassInputField')); + //initializing the confirm pass input field widget Finder + final passConfirmInputFieldWidget = + find.byKey(const Key('PassRepeatInputField')); + //initializing the text field suffix button widget Finder + final findRecoverButton = find.byKey(const Key('ChangePasswordButton')); + //initializing the null pass Submission widget Finder + final nullPassSubmission = find.text('Password must not be left blank'); + //initializing the invalid password submission widget Finder + final invalidPassSubmission = find.text( + 'Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)', + ); + //initializing the invalid password submission widget Finder + final misMatchPassSubmission = + find.text('Password does not match original'); + + //finding the pass input text field + expect(passInputFieldWidget, findsOneWidget); + //finding the confirm pass input text field + expect(passConfirmInputFieldWidget, findsOneWidget); + //finding the recover button + expect(findRecoverButton, findsOneWidget); + + //inputting a invalid pass in the field + await tester.enterText(passInputFieldWidget, 'nontext'); + //submitting the field with invalid input + await tester.ensureVisible(findRecoverButton); + await tester.tap(findRecoverButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the invalidPassSubmission widget appears + expect(invalidPassSubmission, findsOneWidget); + + //without inputting text in the field + await tester.enterText(passInputFieldWidget, ''); + //submitting the field with null input + await tester.tap(findRecoverButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullPassSubmission widget appears + expect(nullPassSubmission, findsOneWidget); + + //not matching confirm pass + await tester.enterText(passInputFieldWidget, 'Test@123'); + await tester.enterText(passConfirmInputFieldWidget, 'Test@12'); + //submitting the field with mismatch password input + await tester.tap(findRecoverButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullPassSubmission widget appears + expect(misMatchPassSubmission, findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/pre_auth_screens/login_test.dart b/test/widget_tests/pre_auth_screens/login_test.dart new file mode 100644 index 000000000..cf250e32e --- /dev/null +++ b/test/widget_tests/pre_auth_screens/login_test.dart @@ -0,0 +1,256 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +// import 'package:talawa/views/main_screen.dart'; +import 'package:talawa/views/pre_auth_screens/login.dart'; +import 'package:talawa/views/pre_auth_screens/recover.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +import '../../helpers/test_locator.dart'; + +Widget createApp() { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: TextButton( + onPressed: () async { + await navigationService.pushScreen('/login'); + }, + child: const Text('ravidi'), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); +} + +Future showLoginScreen(WidgetTester tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + await tester.tap(find.textContaining('ravidi')); + await tester.pumpAndSettle(); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + }); + group('Test for Login screen', () { + testWidgets('Check if Login screen shows up', (tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + + expect(find.byType(Login), findsNothing); + + await tester.tap(find.textContaining('ravidi')); + await tester.pumpAndSettle(); + + expect(find.byType(Login), findsOneWidget); + }); + + testWidgets('Check if back button works', (tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + + expect(find.byType(Login), findsNothing); + + await tester.tap(find.textContaining('ravidi')); + await tester.pumpAndSettle(); + + expect(find.byType(Login), findsOneWidget); + + await tester.tap( + find.descendant( + of: find.byType(AppBar), + matching: find.byType(IconButton), + ), + ); + await tester.pumpAndSettle(); + + expect(find.byType(Login), findsNothing); + }); + + testWidgets('Check if all widgets are present', (tester) async { + await showLoginScreen(tester); + + expect(find.byType(Scaffold), findsOneWidget); + expect(find.byType(AppBar), findsOneWidget); + expect(find.byType(SingleChildScrollView), findsOneWidget); + expect(find.byType(CustomRichText), findsOneWidget); + expect(find.byType(TextFormField), findsNWidgets(2)); + expect(find.byType(RaisedRoundedButton), findsOneWidget); + }); + + testWidgets('Check if all texts show up properly', (tester) async { + await showLoginScreen(tester); + + // expect(find.text("We're Glad you're Back "), findsOneWidget); + expect( + find.textContaining("Enter your registered Email"), + findsOneWidget, + ); + expect(find.textContaining("Enter your password"), findsOneWidget); + expect(find.textContaining("Forgot password"), findsOneWidget); + }); + + testWidgets("Testing the email Input text form field", (tester) async { + //pushing setUrlScreen + await showLoginScreen(tester); + + //initializing the email input field widget Finder + final emailInputFieldWidget = find.byKey(const Key('EmailInputField')); + //initializing the text field suffix button widget Finder + final findLoginButton = find.byKey(const Key('LoginButton')); + //initializing the nullEmailSubmission widget Finder + final nullEmailSubmission = find.text('Email must not be left blank'); + //initializing the invalidEmailSubmission widget Finder + final invalidEmailSubmission = + find.text('Please enter a valid Email Address'); + + //finding the email input text field + expect(emailInputFieldWidget, findsOneWidget); + //finding the login button + expect(findLoginButton, findsOneWidget); + + //inputting a non email text in the field + await tester.enterText(emailInputFieldWidget, 'non-url text'); + //submitting the field with non url input + await tester.ensureVisible(findLoginButton); + await tester.tap(findLoginButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the invalidEmailSubmission widget appears + expect(invalidEmailSubmission, findsOneWidget); + + //without inputting text in the field + await tester.enterText(emailInputFieldWidget, ''); + //submitting the field with non url input + await tester.tap(findLoginButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullEmailSubmission widget appears + expect(nullEmailSubmission, findsOneWidget); + }); + + testWidgets("Testing the password Input text form field", (tester) async { + //pushing setUrlScreen + await showLoginScreen(tester); + + //initializing the password input field widget Finder + final passwordInputFieldWidget = + find.byKey(const Key('PasswordInputField')); + //initializing the pa Finder + final iconButton = find.byIcon(Icons.visibility_off); + //initializing the text field suffix button widget Finder + final findLoginButton = find.byKey(const Key('LoginButton')); + //initializing the nullPasswordSubmission widget Finder + final nullPasswordSubmission = + find.text('Password must not be left blank'); + //initializing the invalidPasswordSubmission widget Finder + final invalidPasswordSubmission = find.text( + 'Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)', + ); + //initializing the spacePasswordSubmission widget Finder + final spacePasswordSubmission = + find.text('Password must not contain spaces'); + + //finding the password input text field + expect(passwordInputFieldWidget, findsOneWidget); + //finding the iconbutton + expect(iconButton, findsOneWidget); + //finding the login button + expect(findLoginButton, findsOneWidget); + + //inputting a invalid password text in the field + await tester.enterText(passwordInputFieldWidget, 'test'); + //submitting the field with invalid password input + await tester.ensureVisible(findLoginButton); + await tester.tap(findLoginButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the invalidPasswordSubmission widget appears + expect(invalidPasswordSubmission, findsOneWidget); + + //without inputting text in the field + await tester.enterText(passwordInputFieldWidget, ''); + //submitting the field without input + await tester.tap(findLoginButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullPasswordSubmission widget appears + expect(nullPasswordSubmission, findsOneWidget); + + //inputting a password with spaces in the field + await tester.enterText(passwordInputFieldWidget, 'testing spaces'); + //submitting the field with spaces input + await tester.tap(findLoginButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the spacePasswordSubmission widget appears + expect(spacePasswordSubmission, findsOneWidget); + + await tester.tap(iconButton); + await tester.pumpAndSettle(); + }); + + // TODO: uncomment after implementing mock LoginViewModel + + // testWidgets('Check if Login button works', (tester) async { + // await showLoginScreen(tester); + + // await tester.enterText(find.byType(TextFormField).first, 'ravidi'); + // await tester.enterText(find.byType(TextFormField).last, 'shaikh'); + + // await tester.tap(find.textContaining('Login')); + // await tester.pumpAndSettle(); + + // expect(find.byType(MainScreen), findsNothing); + + // await tester.enterText(find.byType(TextFormField).first, 'ravidi@ravidi.ravidi'); + // await tester.enterText(find.byType(TextFormField).last, 'Shaikh@1234'); + + // await tester.tap(find.textContaining('Login')); + // await tester.pumpAndSettle(); + + // expect(find.byType(MainScreen), findsOneWidget); + // }); + + testWidgets('Check if login button works', (tester) async { + await showLoginScreen(tester); + + final loginButton = find.byKey(const Key('LoginButton')); + expect(loginButton, findsOneWidget); + + await tester.tap(loginButton); + await tester.pumpAndSettle(); + }); + testWidgets('Check if tip button works', (tester) async { + await showLoginScreen(tester); + + final tipButton = find.text('Tip'); + expect(tipButton, findsOneWidget); + + await tester.tap(tipButton); + await tester.pumpAndSettle(); + }); + + testWidgets('Check if Recover button works', (tester) async { + await showLoginScreen(tester); + + expect(find.byType(Recover), findsNothing); + + await tester.tap(find.textContaining('Forgot password')); + await tester.pumpAndSettle(); + + expect(find.byType(Recover), findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/pre_auth_screens/recover_page_test.dart b/test/widget_tests/pre_auth_screens/recover_page_test.dart new file mode 100644 index 000000000..dbfc2a115 --- /dev/null +++ b/test/widget_tests/pre_auth_screens/recover_page_test.dart @@ -0,0 +1,189 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/views/pre_auth_screens/recover.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +import '../../helpers/test_locator.dart'; + +Widget createRecoverScreenLight({ThemeMode themeMode = ThemeMode.light}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: TalawaTheme.lightTheme, + home: const Recover(key: Key('Recover')), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +Widget createRecoverScreenDark({ThemeMode themeMode = ThemeMode.dark}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: TalawaTheme.darkTheme, + home: const Recover(key: Key('Recover')), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + locator().test(); + }); + group('Select Language Screen Widget Test in light mode', () { + testWidgets("Testing if Select Language Screen shows up", (tester) async { + await tester.pumpWidget(createRecoverScreenLight()); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('RecoverScreenScaffold'), + ); + final iconButton = find.byIcon(Icons.arrow_back); + expect(screenScaffoldWidget, findsOneWidget); + expect(iconButton, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + await tester.tap(iconButton); + await tester.pumpAndSettle(); + }); + }); + group('Select Language Screen Widget Test in dark mode', () { + testWidgets("Testing if Select Language Screen shows up", (tester) async { + await tester.pumpWidget(createRecoverScreenDark()); + await tester.pumpAndSettle(); + // finding scaffold is present + final screenScaffoldWidget = find.byKey( + const Key('RecoverScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + testWidgets("Testing if custom rich text shows up", (tester) async { + //pushing recover screen + await tester.pumpWidget(createRecoverScreenDark()); + await tester.pumpAndSettle(); + + //initializing the custom rich text widget Finder + final customRichTextWidget = find.byKey( + const Key('RecoverPageText'), + ); + + //initializing the greeting text + final greeting = [ + { + 'text': + "${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("Sit back relax, we'll")} ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': + '${AppLocalizations.of(navigationService.navigatorKey.currentContext!)!.translate("Recover")} ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24), + }, + { + 'text': AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + )! + .translate("your password"), + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + ]; + + //finding the custom rich text widget + expect(customRichTextWidget, findsOneWidget); + + //testing greeting text + expect( + (tester.firstWidget(customRichTextWidget) as CustomRichText).words, + greeting, + ); + }); + testWidgets("Testing the email Input text form field", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget(createRecoverScreenDark()); + await tester.pumpAndSettle(); + + //initializing the url input field widget Finder + final emailInputFieldWidget = find.byKey(const Key('EmailInputField')); + //initializing the text field suffix button widget Finder + final findRecoverButton = find.byKey(const Key('RecoverButton')); + //initializing the nullUrlSubmission widget Finder + final nullEmailSubmission = find.text('Email must not be left blank'); + //initializing the invalidUrlSubmission widget Finder + final invalidEmailSubmission = + find.text('Please enter a valid Email Address'); + + //finding the url input text field + expect(emailInputFieldWidget, findsOneWidget); + //finding the recover button + expect(findRecoverButton, findsOneWidget); + + //inputting a non email text in the field + await tester.enterText(emailInputFieldWidget, 'non-url text'); + //submitting the field with non url input + await tester.tap(findRecoverButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the invalidUrlSubmission widget appears + expect(invalidEmailSubmission, findsOneWidget); + + //without inputting text in the field + await tester.enterText(emailInputFieldWidget, ''); + //submitting the field with non url input + await tester.tap(findRecoverButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullEmailSubmission widget appears + expect(nullEmailSubmission, findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/pre_auth_screens/select_language_page_test.dart b/test/widget_tests/pre_auth_screens/select_language_page_test.dart new file mode 100644 index 000000000..9b762034f --- /dev/null +++ b/test/widget_tests/pre_auth_screens/select_language_page_test.dart @@ -0,0 +1,286 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +// import 'package:path_provider/path_provider.dart' as path; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/views/pre_auth_screens/select_language.dart'; + +import '../../helpers/test_locator.dart'; + +Widget createSelectLanguageScreenLight({ + ThemeMode themeMode = ThemeMode.light, +}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: TalawaTheme.lightTheme, + home: const SelectLanguage(key: Key('SelectLanguage')), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +Widget createSelectLanguageScreenDark({ThemeMode themeMode = ThemeMode.dark}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + darkTheme: TalawaTheme.darkTheme, + home: const SelectLanguage(key: Key('SelectLanguage')), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +Future main() async { + //initializing Hive + + TestWidgetsFlutterBinding.ensureInitialized(); + + testSetupLocator(); + locator().test(); + locator().test(); + + group('test both light and dark modes', () { + group('Select Language Screen Widget Test in light mode', () { + testWidgets("Testing if Select Language Screen shows up", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('SelectLanguageScreenScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + }); + testWidgets("Testing if screen title shows up", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('Select Language')); + expect(findAppNameWidget, findsOneWidget); + + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.color, + TalawaTheme.lightTheme.textTheme.headlineSmall!.color, + ); + + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontFamily, + TalawaTheme.lightTheme.textTheme.headlineSmall!.fontFamily, + ); + + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontSize, + TalawaTheme.lightTheme.textTheme.headlineSmall!.fontSize, + ); + }); + //This will be added once we implement the search box + // testWidgets("Testing if search box shows up", (tester) async { + // await tester.pumpWidget(createSelectLanguageScreenLight()); + // await tester.pumpAndSettle(); + // final findAppNameWidget = find.byKey(const Key('SearchField')); + // expect(findAppNameWidget, findsOneWidget); + // }); + testWidgets("Testing if languages list shows up", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('LanguagesList')); + expect(findAppNameWidget, findsOneWidget); + }); + testWidgets("Testing if all languages are shown", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('LanguageItem')); + expect(findAppNameWidget, findsNWidgets(languages.length)); + }); + testWidgets("Testing if only one language is selected", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('Selected')); + expect(findAppNameWidget, findsOneWidget); + }); + testWidgets("Testing unselected language items", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('NotSelected')); + expect(findAppNameWidget, findsNWidgets(languages.length - 1)); + }); + testWidgets("Testing to change language items", (tester) async { + final int randomNumber = Random().nextInt(languages.length); + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + + final findAppNameWidget = find.byKey(Key('LanguageItem$randomNumber')); + await tester.tap(findAppNameWidget); + await tester.pumpAndSettle(); + + expect( + (tester.firstWidget(findAppNameWidget) as Container).decoration, + BoxDecoration(color: const Color(0xFFC4C4C4).withOpacity(0.15)), + ); + }); + testWidgets("Testing to navigate to MainScreen", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + + final findAppNameWidget = find.byKey(const Key('NavigateToMainScreen')); + + await tester.tap(findAppNameWidget); + await tester.pumpAndSettle(const Duration(seconds: 3)); + + expect(findAppNameWidget, findsNothing); + }); + testWidgets("Testing to select and navigate button appears", + (tester) async { + await tester.pumpWidget(createSelectLanguageScreenLight()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('SelectLangTextButton')); + expect(findAppNameWidget, findsOneWidget); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontSize, + 18, + ); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.color, + const Color(0xFF008A37), + ); + }); + }); + group('Select Language Screen Widget Test in dark mode', () { + testWidgets("Testing if Select Language Screen shows up", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + final screenScaffoldWidget = + find.byKey(const Key('SelectLanguageScreenScaffold')); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .darkTheme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + testWidgets("Testing if screen title shows up", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.text('Select Language'); + expect(findAppNameWidget, findsOneWidget); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.color, + TalawaTheme.darkTheme.textTheme.headlineSmall!.color, + ); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontFamily, + TalawaTheme.darkTheme.textTheme.headlineSmall!.fontFamily, + ); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontSize, + TalawaTheme.darkTheme.textTheme.headlineSmall!.fontSize, + ); + }); + // This is not needed now will be added when required + // testWidgets("Testing if search box shows up", (tester) async { + // await tester.pumpWidget(createSelectLanguageScreenDark()); + // await tester.pumpAndSettle(); + // final findAppNameWidget = find.byKey(const Key('SearchField')); + // expect(findAppNameWidget, findsOneWidget); + // }); + testWidgets("Testing if languages list shows up", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('LanguagesList')); + expect(findAppNameWidget, findsOneWidget); + }); + testWidgets("Testing if all languages are shown", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('LanguageItem')); + expect(findAppNameWidget, findsNWidgets(languages.length)); + }); + testWidgets("Testing if only one language is selected", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('Selected')); + expect(findAppNameWidget, findsOneWidget); + }); + testWidgets("Testing unselected language items", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('NotSelected')); + expect(findAppNameWidget, findsNWidgets(languages.length - 1)); + }); + testWidgets("Testing to change language items", (tester) async { + final int randomNumber = Random().nextInt(languages.length); + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + + final findAppNameWidget = find.byKey(Key('LanguageItem$randomNumber')); + await tester.tap(findAppNameWidget); + await tester.pumpAndSettle(); + + expect( + (tester.firstWidget(findAppNameWidget) as Container).decoration, + BoxDecoration(color: const Color(0xFFC4C4C4).withOpacity(0.15)), + ); + }); + testWidgets("Testing to select and navigate button appears", + (tester) async { + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('SelectLangTextButton')); + expect(findAppNameWidget, findsOneWidget); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontSize, + 18, + ); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.color, + const Color(0xFF008A37), + ); + }); + testWidgets("Testing to navigate to url page", (tester) async { + await tester.pumpWidget(createSelectLanguageScreenDark()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.byKey(const Key('NavigateToMainScreen')); + await tester.tap(findAppNameWidget); + await tester.pumpAndSettle(const Duration(seconds: 3)); + expect(findAppNameWidget, findsNothing); + }); + }); + }); +} diff --git a/test/widget_tests/pre_auth_screens/select_organization_test.dart b/test/widget_tests/pre_auth_screens/select_organization_test.dart new file mode 100644 index 000000000..91370aca4 --- /dev/null +++ b/test/widget_tests/pre_auth_screens/select_organization_test.dart @@ -0,0 +1,135 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/utils/queries.dart'; +import 'package:talawa/view_model/pre_auth_view_models/select_organization_view_model.dart'; +import 'package:talawa/views/pre_auth_screens/select_organization.dart'; +import 'package:talawa/widgets/organization_search_list.dart'; + +import '../../helpers/test_helpers.dart'; + +void main() { + const Key selectOrgKey = Key("selectOrgKey"); + const String orgID = "-1"; + Widget createSelectOrgPage({String? customorgID}) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + home: SelectOrganization( + key: selectOrgKey, + selectedOrgId: customorgID ?? orgID, + ), + ); + } + + Widget organizationSearchList({ + required SelectOrganizationViewModel orgViewModel, + }) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + home: Scaffold( + body: OrganizationSearchList(model: orgViewModel), + ), + ); + } + + SizeConfig().test(); + + group("Select Organization Test", () { + setUp(() { + registerViewModels(); + registerServices(); + locator.registerFactory(() => Queries()); + }); + + tearDown(() { + unregisterViewModels(); + unregisterServices(); + locator.unregister(); + }); + + testWidgets("Test if SelectOrganization Page is displayed ", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createSelectOrgPage()); + await tester.pump(); + final selectOrgFinder = find.byKey(selectOrgKey); + expect(selectOrgFinder, findsOneWidget); + }); + }); + + testWidgets('test organization search list', (tester) async { + final orgViewModel = SelectOrganizationViewModel(); + orgViewModel.organizations = []; + for (var i = 0; i < 6; i++) { + orgViewModel.organizations.add( + OrgInfo( + admins: [], + members: [], + creatorInfo: User(id: 'azad'), + id: i.toString(), + description: 'description', + name: 'azads org', + userRegistrationRequired: true, + ), + ); + } + await tester + .pumpWidget(organizationSearchList(orgViewModel: orgViewModel)); + await tester.pumpAndSettle(); + }); + + testWidgets('test organization search list', (tester) async { + final orgViewModel = SelectOrganizationViewModel(); + + await tester + .pumpWidget(organizationSearchList(orgViewModel: orgViewModel)); + await tester.pumpAndSettle(); + }); + + testWidgets("Test if back-arrow is present", (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createSelectOrgPage()); + await tester.pump(); + + final orgFinder = find.byKey(selectOrgKey); + final appBarFinder = + find.descendant(of: orgFinder, matching: find.byType(AppBar)); + expect(appBarFinder, findsOneWidget); + + // final appBarWidget = tester.firstWidget(appBarFinder) as AppBar; + + // expect( + // appBarWidget.leading, + // isA().having( + // (icon) => icon.icon, + // "icon", + // Icons.arrow_back, + // ), + // ); + }); + }); + }); +} diff --git a/test/widget_tests/pre_auth_screens/set_url_page_test.dart b/test/widget_tests/pre_auth_screens/set_url_page_test.dart new file mode 100644 index 000000000..8633a7dd2 --- /dev/null +++ b/test/widget_tests/pre_auth_screens/set_url_page_test.dart @@ -0,0 +1,835 @@ +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:provider/provider.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/pre_auth_screens/set_url.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +import '../../helpers/test_helpers.dart'; + +/// Returns the SetUrlScreen widget. +/// +/// **params**: +/// * `themeMode`: ThemeMode of the app. +/// * `theme`: ThemeData of the app. +/// +/// **returns**: +/// * `Widget`: SetUrlScreen widget. +Widget createSetUrlScreen({ + ThemeMode themeMode = ThemeMode.light, + ThemeData? theme, +}) => + MultiProvider( + providers: [ + ChangeNotifierProvider( + create: (_) => AppLanguage(isTest: true), + ), + ], + child: MaterialApp( + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: theme ?? TalawaTheme.lightTheme, + darkTheme: TalawaTheme.darkTheme, + home: const SetUrl( + key: Key('SetUrl'), + uri: 'null', + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ), + ); + +Future main() async { + //opening Hive Boxes + // await Hive.openBox('currentUser'); + // await Hive.openBox('currentOrg'); + //setting up MVVM + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + setupLocator(); + registerServices(); + + //initializing test functions + locator().test(); + locator().test(); + }); + + //Testing in light mode/normal mode + group('Select Language Screen Widget Test in light mode', () { + testWidgets("Testing if Select Language Screen shows up", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the screenScaffold Finder + final screenScaffoldWidget = + find.byKey(const Key('SetUrlScreenScaffold')); + + //finding the scaffold + expect(screenScaffoldWidget, findsOneWidget); + //testing scaffold color + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + }); + + testWidgets("Testing if icon button shows up", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the logo Finder + final iconButton = find.byIcon(Icons.qr_code_scanner); + + //finding the logo + expect(iconButton, findsOneWidget); + //testing logo size + expect( + (tester.firstWidget(iconButton) as Icon).semanticLabel, + 'Join Organisation with QR', + ); + + expect((tester.firstWidget(iconButton) as Icon).size, 30); + await tester.tap(iconButton); + await tester.pumpAndSettle(); + }); + testWidgets("Testing if app logo shows up", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the logo Finder + final logoWidget = find.byKey(const Key('LogoPainter')); + + //finding the logo + expect(logoWidget, findsOneWidget); + //testing logo size + expect( + (tester.firstWidget(logoWidget) as CustomPaint).size, + Size( + SizeConfig.screenWidth! * 0.6, + SizeConfig.screenWidth! * 0.6, + ), + ); + }); + + testWidgets("Testing if custom rich text shows up", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the custom rich text widget Finder + final customRichTextWidget = find.byKey(const Key('UrlPageText')); + //initializing the greeting text + final greeting = [ + { + 'text': 'Join ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24, fontWeight: FontWeight.w700), + }, + { + 'text': 'and ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'Collaborate ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24, fontWeight: FontWeight.w700), + }, + { + 'text': 'with your ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'Organizations', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall! + .copyWith(fontSize: 24, color: const Color(0xFF4285F4)), + }, + ]; + + //finding the custom rich text widget + expect(customRichTextWidget, findsOneWidget); + + //testing greeting text + expect( + (tester.firstWidget(customRichTextWidget) as CustomRichText).words, + greeting, + ); + }); + testWidgets("Testing the Url Input text form field", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the url input field widget Finder + final urlInputFieldWidget = find.byKey(const Key('UrlInputField')); + //initializing the text field suffix button widget Finder + final findVerifyButton = find.byKey(const Key('VerifyButton')); + //initializing the nullUrlSubmission widget Finder + final nullErrorUrlSubmission = find.text('Please verify URL first'); + //initializing the invalidUrlSubmission widget Finder + final invalidUrlSubmission = find.text('Enter a valid URL'); + + //finding the url input text field + expect(urlInputFieldWidget, findsOneWidget); + //finding the verify suffix button in text form field + expect(findVerifyButton, findsOneWidget); + + /*//submitting the field with null url + await tester.tap(findVerifyButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullErrorUrlSubmission widget appears + expect(nullErrorUrlSubmission, findsOneWidget);*/ + + //inputting a non url text in the field + await tester.enterText(urlInputFieldWidget, 'non-url text'); + //submitting the field with non url input + await tester.tap(findVerifyButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the invalidUrlSubmission widget appears + expect(invalidUrlSubmission, findsOneWidget); + + //inputting an existing url text in the field + await tester.enterText( + urlInputFieldWidget, + 'https:///graphql', + ); + //submitting the field with a existing url + await tester.tap(findVerifyButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing nullErrorUrlSubmission is not found + expect(nullErrorUrlSubmission, findsNothing); + //testing invalidUrlSubmission is not found + expect(invalidUrlSubmission, findsNothing); + }); + testWidgets("Testing change language button", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the change language widget Finder + final changeLanguageWidget = find.byKey(const Key('ChangeLanguage')); + //initializing the screen scaffold + final screenScaffoldWidget = + find.byKey(const Key('SelectLanguageScreenScaffold')); + //initializing the center offset of changeLanguageWidget + final offset = tester.getCenter(changeLanguageWidget); + //finding the change language widget appears + expect(changeLanguageWidget, findsOneWidget); + + //taping the change language button + await tester.tapAt(offset); + await tester.pumpAndSettle(); + //testing that the scaffold is no more visible + expect(screenScaffoldWidget, findsNothing); + await tester.tap(changeLanguageWidget, warnIfMissed: false); + await tester.pumpAndSettle(); + }); + testWidgets("Testing if login button works", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the login button Finder + final loginButtonWidget = find.byKey(const Key('LoginButton')); + + //finding the login button + expect(loginButtonWidget, findsOneWidget); + //testing the login button widget + expect( + (tester.firstWidget(loginButtonWidget) as RaisedRoundedButton) + .backgroundColor, + TalawaTheme.lightTheme.colorScheme.tertiary, + ); + expect( + (tester.firstWidget(loginButtonWidget) as RaisedRoundedButton) + .textColor, + TalawaTheme + .lightTheme.inputDecorationTheme.focusedBorder!.borderSide.color, + ); + expect( + (tester.firstWidget(loginButtonWidget) as RaisedRoundedButton) + .buttonLabel, + 'Login', + ); + await tester.ensureVisible(loginButtonWidget); + await tester.tap(loginButtonWidget); + await tester.pumpAndSettle(); + }); + + testWidgets("Check navigation to Login page when Login button is pressed.", + (tester) async { + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + expect(find.byKey(const Key('SetUrlScreenScaffold')), findsOneWidget); + + await tester.enterText( + find.byKey(const Key('UrlInputField')), + 'https:///graphql', + ); + + final finder = find.byKey(const Key('LoginButton')); + await tester.ensureVisible(finder); + await tester.tap(finder); + await tester.pumpAndSettle(); + expect(find.byKey(const Key('UrlPageText')), findsOneWidget); + }); + testWidgets("Testing if signup button works", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the signup button Finder + final signupButtonWidget = find.byKey(const Key('SignUpButton')); + + //finding the signup button + expect(signupButtonWidget, findsOneWidget); + //testing the signup button widget + expect( + (tester.firstWidget(signupButtonWidget) as RaisedRoundedButton) + .backgroundColor, + TalawaTheme + .lightTheme.inputDecorationTheme.focusedBorder!.borderSide.color, + ); + expect( + (tester.firstWidget(signupButtonWidget) as RaisedRoundedButton) + .textColor, + TalawaTheme.lightTheme.colorScheme.secondaryContainer, + ); + expect( + (tester.firstWidget(signupButtonWidget) as RaisedRoundedButton) + .buttonLabel, + 'Sign Up', + ); + await tester.tap(signupButtonWidget, warnIfMissed: false); + await tester.pumpAndSettle(); + }); + testWidgets( + "Testing onFieldSubmitted in TextFormField by simulating keyboard hits", + (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + final formFinder = find.ancestor( + of: find.byKey(const Key('UrlInputField')), + matching: find.byType(Form), + ); + final formWidget = tester.firstWidget(formFinder) as Form; + (formWidget.key! as GlobalKey).currentState!.save(); + + final textFinder = find.byKey(const Key('UrlInputField')); + await tester.tap(textFinder); + await tester.pump(); + await tester.showKeyboard(textFinder); + await tester.testTextInput.receiveAction(TextInputAction.done); + }); + testWidgets("Testing onTap in sign up button", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + final btnFinder = find.byKey(const Key('SignUpButton')); + + await tester.dragUntilVisible( + btnFinder.first, + find.byType(SingleChildScrollView).first, + const Offset(100, 0), + ); + await tester.tap(btnFinder.first); + await tester.pump(); + }); + testWidgets("Testing onTap in Change Language Gesture Detector", + (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + final gestureDetectorFinder = find.byKey(const Key('ChangeLanguage')); + + await tester.dragUntilVisible( + gestureDetectorFinder.first, + find.byType(SingleChildScrollView).first, + const Offset(100, 0), + ); + + final GlobalKey navigator = GlobalKey(); + + when(navigationService.navigatorKey).thenAnswer((_) => navigator); + when(navigationService.pop()).thenAnswer((_) async => 1); + + await tester.tap(gestureDetectorFinder.first); + await tester.pump(); + + verify(navigationService.pop()); + }); + }); + + //Testing in dark mode + group('Select Language Screen Widget Test in dark mode', () { + testWidgets("Testing if Select Language Screen shows up", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the screenScaffold Finder + final screenScaffoldWidget = + find.byKey(const Key('SetUrlScreenScaffold')); + + //finding the scaffold + expect(screenScaffoldWidget, findsOneWidget); + //testing scaffold color + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .darkTheme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + + testWidgets("Testing if icon button shows up", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the logo Finder + final iconButton = find.byIcon(Icons.qr_code_scanner); + + //finding the logo + expect(iconButton, findsOneWidget); + //testing logo size + expect( + (tester.firstWidget(iconButton) as Icon).semanticLabel, + 'Join Organisation with QR', + ); + + expect((tester.firstWidget(iconButton) as Icon).size, 30); + await tester.tap(iconButton); + await tester.pumpAndSettle(); + }); + testWidgets("Check if QR button works", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + final iconButton = find.byIcon(Icons.qr_code_scanner); + + // tapping the qr button + await tester.tap(iconButton); + await tester.pumpAndSettle(); + + expect(find.byType(ClipRRect), findsOneWidget); + expect(find.byType(QRView), findsOneWidget); + }); + testWidgets("Testing if app logo shows up", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the logo Finder + final logoWidget = find.byKey(const Key('LogoPainter')); + + //finding the logo + expect(logoWidget, findsOneWidget); + //testing logo size + expect( + (tester.firstWidget(logoWidget) as CustomPaint).size, + Size( + SizeConfig.screenWidth! * 0.6, + SizeConfig.screenWidth! * 0.6, + ), + ); + }); + testWidgets("Testing if custom rich text shows up", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the custom rich text widget Finder + final customRichTextWidget = find.byKey(const Key('UrlPageText')); + //initializing the greeting text + final greeting = [ + { + 'text': 'Join ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24, fontWeight: FontWeight.w700), + }, + { + 'text': 'and ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'Collaborate ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24, fontWeight: FontWeight.w700), + }, + { + 'text': 'with your ', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': 'Organizations', + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall! + .copyWith(fontSize: 24, color: const Color(0xFF4285F4)), + }, + ]; + + //finding the custom rich text widget + expect(customRichTextWidget, findsOneWidget); + + //testing greeting text + expect( + (tester.firstWidget(customRichTextWidget) as CustomRichText).words, + greeting, + ); + }); + testWidgets("Testing the Url Input text form field", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the url input field widget Finder + final urlInputFieldWidget = find.byKey(const Key('UrlInputField')); + //initializing the text field suffix button widget Finder + final findVerifyButton = find.byKey(const Key('VerifyButton')); + //initializing the nullUrlSubmission widget Finder + final nullErrorUrlSubmission = find.text('Please verify URL first'); + //initializing the invalidUrlSubmission widget Finder + final invalidUrlSubmission = find.text('Enter a valid URL'); + + //finding the url input text field + expect(urlInputFieldWidget, findsOneWidget); + //finding the verify suffix button in text form field + expect(findVerifyButton, findsOneWidget); + + /* //submitting the field with null url + await tester.tap(findVerifyButton); + await tester.pumpAndSettle(); + //testing the nullErrorUrlSubmission widget appears + expect(nullErrorUrlSubmission, findsOneWidget);*/ + + //inputting a non url text in the field + await tester.enterText(urlInputFieldWidget, 'non-url text'); + //submitting the field with non url input + await tester.tap(findVerifyButton); + await tester.pumpAndSettle(); + //testing the invalidUrlSubmission widget appears + expect(invalidUrlSubmission, findsOneWidget); + + //inputting an existing url text in the field + await tester.enterText( + urlInputFieldWidget, + 'https:///graphql', + ); + //submitting the field with a existing url + await tester.tap(findVerifyButton); + await tester.pumpAndSettle(); + //testing nullErrorUrlSubmission is not found + expect(nullErrorUrlSubmission, findsNothing); + //testing invalidUrlSubmission is not found + expect(invalidUrlSubmission, findsNothing); + }); + testWidgets("Testing change language button", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the change language widget Finder + final changeLanguageWidget = find.byKey(const Key('ChangeLanguage')); + //initializing the screen scaffold + final screenScaffoldWidget = + find.byKey(const Key('SelectLanguageScreenScaffold')); + //initializing the center offset of changeLanguageWidget + final offset = tester.getCenter(changeLanguageWidget); + //finding the change language widget appears + expect(changeLanguageWidget, findsOneWidget); + + //taping the change language button + await tester.tapAt(offset); + await tester.pumpAndSettle(); + //testing that the scaffold is no more visible + expect(screenScaffoldWidget, findsNothing); + await tester.tap(changeLanguageWidget, warnIfMissed: false); + await tester.pumpAndSettle(); + }); + testWidgets("Testing if login button works", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the login button Finder + final loginButtonWidget = find.byKey(const Key('LoginButton')); + + //finding the login button + expect(loginButtonWidget, findsOneWidget); + //testing the login button widget + expect( + (tester.firstWidget(loginButtonWidget) as RaisedRoundedButton) + .backgroundColor, + TalawaTheme.darkTheme.colorScheme.tertiary, + ); + expect( + (tester.firstWidget(loginButtonWidget) as RaisedRoundedButton) + .textColor, + TalawaTheme + .darkTheme.inputDecorationTheme.focusedBorder!.borderSide.color, + ); + expect( + (tester.firstWidget(loginButtonWidget) as RaisedRoundedButton) + .buttonLabel, + 'Login', + ); + + await tester.ensureVisible(loginButtonWidget); + await tester.tap(loginButtonWidget); + await tester.pumpAndSettle(); + }); + testWidgets("Testing if signup button works", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //initializing the signup button Finder + final signupButtonWidget = find.byKey(const Key('SignUpButton')); + + //finding the signup button + expect(signupButtonWidget, findsOneWidget); + //testing the signup button widget + expect( + (tester.firstWidget(signupButtonWidget) as RaisedRoundedButton) + .backgroundColor, + TalawaTheme + .darkTheme.inputDecorationTheme.focusedBorder!.borderSide.color, + ); + expect( + (tester.firstWidget(signupButtonWidget) as RaisedRoundedButton) + .textColor, + TalawaTheme.darkTheme.colorScheme.secondaryContainer, + ); + expect( + (tester.firstWidget(signupButtonWidget) as RaisedRoundedButton) + .buttonLabel, + 'Sign Up', + ); + await tester.tap(signupButtonWidget, warnIfMissed: false); + await tester.pumpAndSettle(); + }); + testWidgets( + "Testing onFieldSubmitted in TextFormField by simulating keyboard hits", + (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + final formFinder = find.ancestor( + of: find.byKey(const Key('UrlInputField')), + matching: find.byType(Form), + ); + final formWidget = tester.firstWidget(formFinder) as Form; + (formWidget.key! as GlobalKey).currentState!.save(); + + final textFinder = find.byKey(const Key('UrlInputField')); + await tester.tap(textFinder); + await tester.pump(); + await tester.showKeyboard(textFinder); + await tester.testTextInput.receiveAction(TextInputAction.done); + }); + testWidgets("Testing onTap in sign up button", (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + final btnFinder = find.byKey(const Key('SignUpButton')); + + await tester.dragUntilVisible( + btnFinder.first, + find.byType(SingleChildScrollView).first, + const Offset(100, 0), + ); + await tester.tap(btnFinder.first); + await tester.pump(); + }); + testWidgets("Testing onTap in Change Language Gesture Detector", + (tester) async { + //pushing setUrlScreen + await tester.pumpWidget( + createSetUrlScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + final gestureDetectorFinder = find.byKey(const Key('ChangeLanguage')); + + await tester.dragUntilVisible( + gestureDetectorFinder.first, + find.byType(SingleChildScrollView).first, + const Offset(100, 0), + ); + + final GlobalKey navigator = GlobalKey(); + + when(navigationService.navigatorKey).thenAnswer((_) => navigator); + when(navigationService.pop()).thenAnswer((_) async => 1); + + await tester.tap(gestureDetectorFinder.first); + await tester.pump(); + + verify(navigationService.pop()); + }); + }); +} diff --git a/test/widget_tests/pre_auth_screens/signup_details_test.dart b/test/widget_tests/pre_auth_screens/signup_details_test.dart new file mode 100644 index 000000000..820d5457b --- /dev/null +++ b/test/widget_tests/pre_auth_screens/signup_details_test.dart @@ -0,0 +1,281 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/pre_auth_screens/signup_details.dart'; + +import '../../helpers/test_locator.dart'; + +Widget createApp() { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: TextButton( + onPressed: () async { + final OrgInfo org = OrgInfo( + id: '2', + name: 'test org', + userRegistrationRequired: false, + creatorInfo: User(firstName: 'test', lastName: 'test'), + ); + + await navigationService.pushScreen('/signupDetails', arguments: org); + }, + child: const Text('Ayush'), + ), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); +} + +Future showSignUpScreen(WidgetTester tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + await tester.tap(find.textContaining('Ayush')); + await tester.pumpAndSettle(); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + + testSetupLocator(); + }); + + group('Test For SignUp Screen', () { + testWidgets('Check if SignUp screen shows up', (tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + + expect(find.byType(SignUpDetails), findsNothing); + + await tester.tap(find.textContaining('Ayush')); + await tester.pumpAndSettle(); + + expect(find.byType(SignUpDetails), findsOneWidget); + }); + testWidgets('Check if arrow back works', (tester) async { + await tester.pumpWidget(createApp()); + await tester.pump(); + + expect(find.byType(SignUpDetails), findsNothing); + + await tester.tap(find.textContaining('Ayush')); + await tester.pumpAndSettle(); + + expect(find.byType(SignUpDetails), findsOneWidget); + + final finder = find.byIcon(Icons.arrow_back); + + await tester.tap(finder); + await tester.pump(); + + expect(find.text('Ayush'), findsOneWidget); + }); + + testWidgets("Testing if input field and signup button appear", + (tester) async { + await showSignUpScreen(tester); + + final firstNameInputFieldWidget = + find.byKey(const Key('FirstNameInputField')); + + final findSignUpButton = find.text('Next'); + expect(firstNameInputFieldWidget, findsOneWidget); + + expect(findSignUpButton, findsOneWidget); + }); +//.................................................................... + testWidgets('Testing validator for first name input form invalid', + (tester) async { + await showSignUpScreen(tester); + + final invalidFirstNameSubmission = find.text('Invalid Firstname'); + + final firstNameInputFieldWidget = + find.byKey(const Key('FirstNameInputField')); + + final findSignUpButton = find.text('Next'); + + await tester.enterText(firstNameInputFieldWidget, '<>'); + + await tester.dragUntilVisible( + findSignUpButton, + findSignUpButton, + const Offset(0, 50), + ); + + await tester.tap(findSignUpButton); + await tester.pumpAndSettle(const Duration(milliseconds: 1000)); + + expect(invalidFirstNameSubmission, findsOneWidget); + }); + testWidgets('Testing validator for first name input form null', + (tester) async { + await showSignUpScreen(tester); + + final nullSubmission = find.text('Firstname must not be left blank.'); + + final firstNameInputFieldWidget = + find.byKey(const Key('FirstNameInputField')); + + final findSignUpButton = find.text('Next'); + + await tester.enterText(firstNameInputFieldWidget, ''); + + await tester.dragUntilVisible( + findSignUpButton, + findSignUpButton, + const Offset(0, 50), + ); + + await tester.tap(findSignUpButton); + await tester.pumpAndSettle(const Duration(milliseconds: 1000)); + + expect(nullSubmission, findsOneWidget); + }); +//........................................................................... + + testWidgets('Testing validator for last name input form invalid', + (tester) async { + await showSignUpScreen(tester); + + final invalidLastNameSubmission = find.text('Invalid Lastname'); + + final lastNameInputFieldWidget = + find.byKey(const Key('LastNameInputField')); + + final findSignUpButton = find.text('Next'); + + await tester.enterText(lastNameInputFieldWidget, '<>'); + + await tester.dragUntilVisible( + findSignUpButton, + findSignUpButton, + const Offset(0, 50), + ); + + await tester.tap(findSignUpButton); + await tester.pumpAndSettle(const Duration(milliseconds: 1000)); + + expect(invalidLastNameSubmission, findsOneWidget); + }); + testWidgets('Testing validator for last name input form null', + (tester) async { + await showSignUpScreen(tester); + + final nullSubmission = find.text('Lastname must not be left blank.'); + + final lastNameInputFieldWidget = + find.byKey(const Key('LastNameInputField')); + + final findSignUpButton = find.text('Next'); + + await tester.enterText(lastNameInputFieldWidget, ''); + + await tester.dragUntilVisible( + findSignUpButton, + findSignUpButton, + const Offset(0, 50), + ); + + await tester.tap(findSignUpButton); + await tester.pumpAndSettle(const Duration(milliseconds: 1000)); + + expect(nullSubmission, findsOneWidget); + }); + }); + //...................................................................................... + testWidgets("Testing the password Input text form field", (tester) async { + //pushing setUrlScreen + await showSignUpScreen(tester); + + //initializing the password input field widget Finder + final passwordInputFieldWidget = find.byKey(const Key('signuppassword')); + //initializing the pa Finder + final iconButton = find.byIcon(Icons.visibility_off); + //initializing the text field suffix button widget Finder + final findSignUpButton = find.text('Next'); + //initializing the nullPasswordSubmission widget Finder + final nullPasswordSubmission = find.text('Password must not be left blank'); + //initializing the invalidPasswordSubmission widget Finder + final invalidPasswordSubmission = find.text( + 'Your password must be at least 8 characters long, contain at least one numeric, one uppercase and one lowercase letters and one special character (@,#,\$,etc.)', + ); + //initializing the spacePasswordSubmission widget Finder + final spacePasswordSubmission = + find.text('Password must not contain spaces'); + + await tester.dragUntilVisible( + findSignUpButton, + findSignUpButton, + const Offset(0, 50), + ); + //finding the password input text field + expect(passwordInputFieldWidget, findsOneWidget); + //finding the iconbutton + expect(iconButton, findsOneWidget); + //finding the login button + expect(findSignUpButton, findsOneWidget); + + //inputting a invalid password text in the field + await tester.enterText(passwordInputFieldWidget, 'test'); + //submitting the field with invalid password input + await tester.ensureVisible(findSignUpButton); + await tester.tap(findSignUpButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the invalidPasswordSubmission widget appears + expect(invalidPasswordSubmission, findsOneWidget); + + //without inputting text in the field + await tester.enterText(passwordInputFieldWidget, ''); + //submitting the field without input + await tester.ensureVisible(findSignUpButton); + await tester.tap(findSignUpButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the nullPasswordSubmission widget appears + expect(nullPasswordSubmission, findsOneWidget); + + //inputting a password with spaces in the field + await tester.enterText(passwordInputFieldWidget, 'testing spaces'); + //submitting the field with spaces input + await tester.ensureVisible(findSignUpButton); + await tester.tap(findSignUpButton); + await tester.pumpAndSettle(const Duration(milliseconds: 500)); + //testing the spacePasswordSubmission widget appears + expect(spacePasswordSubmission, findsOneWidget); + + await tester.tap(iconButton); + await tester.pumpAndSettle(); + }); + + testWidgets( + "Testing onFieldSubmitted in password TextFormField by simulating keyboard hits", + (tester) async { + await showSignUpScreen(tester); + // final formFinder = find.ancestor( + // of: find.byKey(const Key('signuppassword')), + // matching: find.byType(Form)); + // final formWidget = tester.firstWidget(formFinder) as Form; + // (formWidget.key! as GlobalKey).currentState!.save(); + + final textFinder = find.byKey(const Key('signuppassword')); + await tester.tap(textFinder); + await tester.pump(); + await tester.showKeyboard(textFinder); + await tester.testTextInput.receiveAction(TextInputAction.next); + }); +} diff --git a/test/widget_tests/pre_auth_screens/signup_progress_indicator_test.dart b/test/widget_tests/pre_auth_screens/signup_progress_indicator_test.dart new file mode 100644 index 000000000..3dab9721d --- /dev/null +++ b/test/widget_tests/pre_auth_screens/signup_progress_indicator_test.dart @@ -0,0 +1,73 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/signup_progress_indicator.dart'; +import 'package:timelines/timelines.dart'; + +Widget createSignupProgressIndicator() { + return MaterialApp( + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: SignupProgressIndicator( + key: const Key('pgIndicator'), + currentPageIndex: 1, + ), + ), + ); +} + +void main() { + SizeConfig().test(); + group('Test for SignupProgressIndicator', () { + testWidgets('Check if SignupProgressIndicator widget shows up', + (tester) async { + await tester.pumpWidget(createSignupProgressIndicator()); + await tester.pump(); + + expect(find.byType(Timeline), findsOneWidget); + expect(find.byType(DotIndicator), findsNWidgets(3)); + }); + + testWidgets('Check dotindicator color', (tester) async { + await tester.pumpWidget(createSignupProgressIndicator()); + await tester.pump(); + + final dotIndicatorFinder = find.byType(DotIndicator); + final dotIndicator = tester.widgetList(dotIndicatorFinder); + + expect( + (dotIndicator.elementAt(0) as DotIndicator).color, + const Color(0xFF008A37), + ); + expect( + (dotIndicator.elementAt(1) as DotIndicator).color, + const Color(0xFF008A37), + ); + expect( + (dotIndicator.elementAt(2) as DotIndicator).color, + const Color(0xFF737373), + ); + }); + testWidgets('Check dotindicator icon', (tester) async { + await tester.pumpWidget(createSignupProgressIndicator()); + await tester.pump(); + + final dotIndicatorFinder = find.byType(DotIndicator); + final dotIndicator = tester.widgetList(dotIndicatorFinder); + + expect( + (dotIndicator.elementAt(0) as DotIndicator).child, + isA(), + ); + }); + }); +} diff --git a/test/widget_tests/pre_auth_screens/splash_screen_test.dart b/test/widget_tests/pre_auth_screens/splash_screen_test.dart new file mode 100644 index 000000000..50f08eab4 --- /dev/null +++ b/test/widget_tests/pre_auth_screens/splash_screen_test.dart @@ -0,0 +1,323 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +// ignore_for_file: unused_import + +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:talawa/constants/custom_theme.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/splash_screen.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:uni_links/uni_links.dart'; + +Widget createSplashScreenLight({ThemeMode themeMode = ThemeMode.light}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: TalawaTheme.lightTheme, + home: const SplashScreen( + key: Key('SplashScreen'), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +Widget createSplashScreenDark({ThemeMode themeMode = ThemeMode.dark}) => + BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + darkTheme: TalawaTheme.darkTheme, + home: const SplashScreen( + key: Key('SplashScreen'), + ), + navigatorKey: navigationService.navigatorKey, + onGenerateRoute: router.generateRoute, + ); + }, + ); + +Future main() async { + setUpAll(() { + setupLocator(); + graphqlConfig.test(); + }); + + group('Splash Screen Widget Test in light mode', () { + testWidgets("Testing if Splash Screen shows up", (tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + final screenScaffoldWidget = + find.byKey(const Key('SplashScreenScaffold')); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + }); + testWidgets("Testing if app logo shows up", (tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + final logoWidget = find.byKey(const Key('LogoPainter')); + expect(logoWidget, findsOneWidget); + expect( + (tester.firstWidget(logoWidget) as CustomPaint).size, + Size( + SizeConfig.screenWidth! * 0.6, + SizeConfig.screenWidth! * 0.6, + ), + ); + }); + testWidgets("Testing if app name shows up", (tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.text('TALAWA'); + expect(findAppNameWidget, findsOneWidget); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.color, + TalawaTheme.lightTheme.textTheme.headlineMedium!.color, + ); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontFamily, + TalawaTheme.lightTheme.textTheme.headlineMedium!.fontFamily, + ); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontSize, + TalawaTheme.lightTheme.textTheme.headlineMedium!.fontSize, + ); + }); + testWidgets("Testing if provider text shows up", (tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + final findProviderTextWidget = find.text('from'); + expect(findProviderTextWidget, findsOneWidget); + expect( + (tester.firstWidget(findProviderTextWidget) as Text).style!.color, + TalawaTheme.lightTheme.textTheme.bodySmall!.color, + ); + expect( + (tester.firstWidget(findProviderTextWidget) as Text).style!.fontFamily, + TalawaTheme.lightTheme.textTheme.bodySmall!.fontFamily, + ); + expect( + (tester.firstWidget(findProviderTextWidget) as Text).style!.fontSize, + TalawaTheme.lightTheme.textTheme.bodySmall!.fontSize, + ); + }); + testWidgets("Testing if provider name shows up", (tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + final findProviderNameWidget = find.text('PALISADOES'); + expect(findProviderNameWidget, findsOneWidget); + expect( + (tester.firstWidget(findProviderNameWidget) as Text).style!.color, + TalawaTheme.lightTheme.textTheme.titleSmall!.color, + ); + expect( + (tester.firstWidget(findProviderNameWidget) as Text).style!.fontFamily, + TalawaTheme.lightTheme.textTheme.titleSmall!.fontFamily, + ); + }); + }); + group('Splash Screen Widget Test in dark mode', () { + testWidgets("Testing if Splash Screen shows up", (tester) async { + await tester.pumpWidget(createSplashScreenDark()); + await tester.pumpAndSettle(); + final screenScaffoldWidget = + find.byKey(const Key('SplashScreenScaffold')); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .darkTheme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + testWidgets("Testing if app logo shows up", (tester) async { + await tester.pumpWidget(createSplashScreenDark()); + await tester.pumpAndSettle(); + final logoWidget = find.byKey(const Key('LogoPainter')); + expect(logoWidget, findsOneWidget); + expect( + (tester.firstWidget(logoWidget) as CustomPaint).size, + Size( + SizeConfig.screenWidth! * 0.6, + SizeConfig.screenWidth! * 0.6, + ), + ); + }); + testWidgets("Testing if app name shows up", (tester) async { + await tester.pumpWidget(createSplashScreenDark()); + await tester.pumpAndSettle(); + final findAppNameWidget = find.text('TALAWA'); + expect(findAppNameWidget, findsOneWidget); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.color, + TalawaTheme.darkTheme.textTheme.headlineMedium!.color, + ); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontFamily, + TalawaTheme.darkTheme.textTheme.headlineMedium!.fontFamily, + ); + expect( + (tester.firstWidget(findAppNameWidget) as Text).style!.fontSize, + TalawaTheme.darkTheme.textTheme.headlineMedium!.fontSize, + ); + }); + testWidgets("Testing if provider text shows up", (tester) async { + await tester.pumpWidget(createSplashScreenDark()); + await tester.pumpAndSettle(); + final findProviderTextWidget = find.text('from'); + expect(findProviderTextWidget, findsOneWidget); + expect( + (tester.firstWidget(findProviderTextWidget) as Text).style!.color, + TalawaTheme.darkTheme.textTheme.bodySmall!.color, + ); + expect( + (tester.firstWidget(findProviderTextWidget) as Text).style!.fontFamily, + TalawaTheme.darkTheme.textTheme.bodySmall!.fontFamily, + ); + expect( + (tester.firstWidget(findProviderTextWidget) as Text).style!.fontSize, + TalawaTheme.darkTheme.textTheme.bodySmall!.fontSize, + ); + }); + testWidgets("Testing if provider name shows up", (tester) async { + await tester.pumpWidget(createSplashScreenDark()); + await tester.pumpAndSettle(); + final findProviderNameWidget = find.text('PALISADOES'); + expect(findProviderNameWidget, findsOneWidget); + expect( + (tester.firstWidget(findProviderNameWidget) as Text).style!.color, + TalawaTheme.darkTheme.textTheme.titleSmall!.color, + ); + expect( + (tester.firstWidget(findProviderNameWidget) as Text).style!.fontFamily, + TalawaTheme.darkTheme.textTheme.titleSmall!.fontFamily, + ); + }); + }); +} + +// Added the following test cases + +Future testWidgets1(WidgetTester tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + + // Mock the uriLinkStream to emit a test URI + final testUri = Uri.parse("https://example.com"); + uriLinkStream.any(testUri as bool Function(Uri? element)); + + // Wait for the URI to be handled + await tester.pumpAndSettle(); + + // Verify that the latest URI is updated correctly + expect(find.text("Latest URI: $testUri"), findsOneWidget); +} + +Future testWidgets2(WidgetTester tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + + // Mock the userConfig.userLoggedIn() to return true + when(userConfig.userLoggedIn()).thenAnswer((_) async => true); + + // Wait for the user log in to be handled + await tester.pumpAndSettle(); + + // Verify that the user log in is handled correctly + expect(find.text("User logged in"), findsOneWidget); +} + +Future testWidgets3(WidgetTester tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + + // Mock the userConfig.userLoggedIn() to return true + when(userConfig.userLoggedIn()).thenAnswer((_) async => true); + + // Mock the uriLinkStream to emit a test URI + final testUri = Uri.parse("https://example.com"); + uriLinkStream.any(testUri as bool Function(Uri? element)); + + // Wait for the URI to be handled + await tester.pumpAndSettle(); + + // Verify that the user log in is not handled + expect(find.text("User logged in"), findsNothing); +} + +Future testWidgets4(WidgetTester tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + + // Mock the userConfig.userLoggedIn() to return true + when(userConfig.userLoggedIn()).thenAnswer((_) async => true); + + // Wait for the user log in to be handled + await tester.pumpAndSettle(); + + // Verify that the user log in is handled correctly + expect(find.text("User logged in"), findsOneWidget); +} + +Future testWidgets5(WidgetTester tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + + // Mock the userConfig.userLoggedIn() to return true + when(userConfig.userLoggedIn()).thenAnswer((_) async => true); + + // Mock the initial URI to be a test URI + final testUri = Uri.parse("https://example.com"); + when(getInitialUri()).thenAnswer((_) async => testUri); + + // Wait for the initial URI to be handled + await tester.pumpAndSettle(); + + // Verify that the user log in is not handled + expect(find.text("User logged in"), findsNothing); +} + +Future testWidgets6(WidgetTester tester) async { + await tester.pumpWidget(createSplashScreenLight()); + await tester.pumpAndSettle(); + + // Mock the userConfig.userLoggedIn() to return true + when(userConfig.userLoggedIn()).thenAnswer((_) async => true); + + // Wait for the user log in to be handled + await tester.pumpAndSettle(); + + // Verify that the user log in is handled correctly + expect(find.text("User logged in"), findsOneWidget); +} diff --git a/test/widget_tests/pre_auth_screens/waiting_page_test.dart b/test/widget_tests/pre_auth_screens/waiting_page_test.dart new file mode 100644 index 000000000..2d945e41c --- /dev/null +++ b/test/widget_tests/pre_auth_screens/waiting_page_test.dart @@ -0,0 +1,202 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +// import 'dart:io'; + +import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +// import 'package:hive/hive.dart'; +// import 'package:path_provider/path_provider.dart' as path; +import 'package:talawa/constants/custom_theme.dart'; +// import 'package:talawa/models/organization/org_info.dart'; +// import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/views/pre_auth_screens/waiting_screen.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +Widget createWaitingScreenLight({ThemeMode themeMode = ThemeMode.light}) => + MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: TalawaTheme.lightTheme, + home: const WaitingPage(key: Key('WaitingPage')), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + +Widget createWaitingScreenDark({ThemeMode themeMode = ThemeMode.dark}) => + MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + key: const Key('Root'), + themeMode: themeMode, + theme: TalawaTheme.darkTheme, + home: const WaitingPage(key: Key('WaitingPage')), + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + ); + +Future main() async { + TestWidgetsFlutterBinding.ensureInitialized(); + // const testMockStorage = './test/fixtures/core'; + // const channel = MethodChannel( + // 'plugins.flutter.io/path_provider', + // ); + // channel.setMockMethodCallHandler((MethodCall methodCall) async { + // return testMockStorage; + // }); //initializing Hive + // final Directory dir = await path.getApplicationDocumentsDirectory(); + // Hive + // ..init(dir.path) + // ..registerAdapter(UserAdapter()) + // ..registerAdapter(OrgInfoAdapter()); + // // opening Hive Boxes + // await Hive.openBox('currentUser'); + // await Hive.openBox('currentOrg'); + // await Hive.openBox('url'); + setUp(() { + registerServices(); + registerViewModels(); + locator().test(); + }); + tearDown(() { + unregisterServices(); + unregisterViewModels(); + }); + + group('Waiting Screen Widget Test in light mode', () { + testWidgets("Testing if Select Language Screen shows up", (tester) async { + await tester.pumpWidget(createWaitingScreenLight()); + await tester.pumpAndSettle(); + final screenScaffoldWidget = find.byKey( + const Key('WaitingPageScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.lightTheme.scaffoldBackgroundColor, + ); + }); + }); + group('Waiting Screen Widget Test in dark mode', () { + testWidgets("Testing if Select Language Screen shows up", (tester) async { + await tester.pumpWidget(createWaitingScreenDark()); + await tester.pumpAndSettle(); + // finding scaffold is present + final screenScaffoldWidget = find.byKey( + const Key('WaitingPageScaffold'), + ); + expect(screenScaffoldWidget, findsOneWidget); + expect( + (tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp) + .theme! + .scaffoldBackgroundColor, + TalawaTheme.darkTheme.scaffoldBackgroundColor, + ); + }); + }); + group('Testing for greeting text', () { + testWidgets("Testing if greeting text shows up", (tester) async { + await tester.pumpWidget(createWaitingScreenLight()); + await tester.pumpAndSettle(); + //initializing the custom rich text widget Finder + final customRichTextWidget = find.byKey( + const Key('WaitingPageText'), + ); + + //initializing the greeting text + final greeting = [ + { + 'text': "Please wait", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + { + 'text': " Test ", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .titleLarge! + .copyWith(fontSize: 24), + }, + { + 'text': "for organisation(s) to accept your invitation.", + 'textStyle': Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall, + }, + ]; + + //finding the custom rich text widget + expect(customRichTextWidget, findsOneWidget); + + //testing greeting text + expect( + (tester.firstWidget(customRichTextWidget) as CustomRichText).words, + greeting, + ); + }); + }); + group('Testing for pending request list', () { + testWidgets("Testing pending membership request list", (tester) async { + await tester.pumpWidget(createWaitingScreenLight()); + await tester.pumpAndSettle(); + //initializing the custom rich text widget Finder + final pendingRequestList = find.byKey( + const Key('PendingRequestList'), + ); + //initializing the custom rich text widget Finder + final pendingItem = find.byKey( + const Key('WaitingJoin'), + ); + + //finding the custom rich text widget + expect(pendingRequestList, findsOneWidget); + + //testing greeting text + expect(pendingItem, findsNWidgets(2)); + await tester.tap(pendingRequestList); + await tester.pumpAndSettle(); + }); + }); + group('Testing for join org button', () { + testWidgets("Testing Join org button", (tester) async { + await tester.pumpWidget(createWaitingScreenLight()); + await tester.pumpAndSettle(); + //initializing the join org button widget Finder + final joinOrgButton = find.byKey( + const Key('JoinOrg'), + ); + + //finding the join org button widget + expect(joinOrgButton, findsOneWidget); + + //testing greeting text + final RaisedRoundedButton joinButton = + tester.firstWidget(joinOrgButton) as RaisedRoundedButton; + await tester.pump(const Duration(milliseconds: 100)); + expect(joinButton.buttonLabel, "Join Organisation"); + }); + }); +} diff --git a/test/widget_tests/profile_page_test.dart b/test/widget_tests/profile_page_test.dart deleted file mode 100644 index acb42b9c9..000000000 --- a/test/widget_tests/profile_page_test.dart +++ /dev/null @@ -1,247 +0,0 @@ -// Packages imports. -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/views/pages/login_signup/set_url_page.dart'; - -Widget createLoginPageScreen() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration()), - ChangeNotifierProvider(create: (_) => OrgController()), - ChangeNotifierProvider(create: (_) => AuthController()), - ChangeNotifierProvider(create: (_) => Preferences()), - ChangeNotifierProvider(create: (_) => CommentHandler()), - ChangeNotifierProvider(create: (_) => PostProvider()), - ], - child: MaterialApp( - home: UrlPage(), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - // Function for ignoring overflow errors. - // ignore: prefer_function_declarations_over_variables - final void Function(FlutterErrorDetails) onErrorIgnoreOverflowErrors = ( - FlutterErrorDetails details, { - bool forceReport = false, - }) { - assert(details != null); - assert(details.exception != null); - - bool ifIsOverflowError = false; - - // Detect overflow error. - final exception = details.exception; - if (exception is FlutterError) { - ifIsOverflowError = !exception.diagnostics.any( - (e) => e.value.toString().startsWith( - "A RenderFlex overflowed by", - ), - ); - } - - // Ignore if is overflow error. - if (ifIsOverflowError) { - // ignore: avoid_print - print("Over flow error"); - } - - // Throw other errors. - else { - FlutterError.dumpErrorToConsole( - details, - forceReport: forceReport, - ); - } - }; - group("Login Page Tests", () { - testWidgets("Testing if LoginPage shows up", (tester) async { - await tester.pumpWidget(createLoginPageScreen()); - - /// Verify if [LoginPage] shows up. - expect( - find.byType(Form), - findsOneWidget, - ); - }); - - testWidgets("Testing overflow of LoginPage in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = Size( - SizeConfig.safeBlockHorizontal * 110, - SizeConfig.safeBlockVertical * 100); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createLoginPageScreen()); - - //finding is the circular progress indicator is visible to user - //expect(find.byKey(Key('loading')), findsOneWidget); - }); - - testWidgets("Testing overflow of LoginPage in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createLoginPageScreen()); - - /// Verify if [LoginPage] shows up. - expect( - find.byType(Form), - findsOneWidget, - ); - }); - - testWidgets("Create an Account Button is disabled if url not verfied", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - await tester.pumpWidget(createLoginPageScreen()); - - // Get the create account button. - final createAccountButton = find.text("Create an Account"); - - // Tap on the createAccountButton. - await tester.tap(createAccountButton); - await tester.pumpAndSettle(); - - // RegisterForm should not be displayed. - expect( - find.text("SIGN UP"), - findsNothing, - ); - }); - - testWidgets("Login Button is disabled if url not verfied", (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - await tester.pumpWidget(createLoginPageScreen()); - - // Get the login button. - final loginButton = find.text("Login"); - - // Tap on the login button - await tester.tap(loginButton); - await tester.pumpAndSettle(); - - // LoginForm should not be displayed. - expect( - find.text("SIGN IN"), - findsNothing, - ); - }); - - testWidgets("Create an Account Button is working if url is verfied", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createLoginPageScreen()); - - // Get the create account button. - final createAccountButton = find.text("Create an Account"); - - /// Enter [calico.palisadoes.org] in [TextFormField]. - await tester.enterText( - find.byType(TextFormField), - 'calico.palisadoes.org', - ); - - // Check if saveMsg is "Set URL". - expect( - find.text("Set URL"), - findsOneWidget, - ); - - // Get the Set URL Button. - final setURLButton = find.text("Set URL"); - - // Tap on Set URL Button. - await tester.tap(setURLButton); - await tester.pumpAndSettle(); - - // Verify that saveMsg changes from "Set URL" to "URL SAVED!". - expect( - find.text("Set URL"), - findsNothing, - ); - expect( - find.text("URL SAVED!"), - findsOneWidget, - ); - - // Tap on the createAccountButton. - await tester.tap(createAccountButton); - await tester.pumpAndSettle(); - - // RegisterForm should be displayed. - expect( - find.text("SIGN UP"), - findsOneWidget, - ); - }); - - testWidgets("Login Button is working if url is verfied", (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createLoginPageScreen()); - - // Get the create account button. - final loginButton = find.text("Login"); - - /// Enter [calico.palisadoes.org] in [TextFormField]. - await tester.enterText( - find.byType(TextFormField), - 'calico.palisadoes.org', - ); - - // Check if saveMsg is "Set URL". - expect( - find.text("Set URL"), - findsOneWidget, - ); - - // Get the Set URL Button. - final setURLButton = find.text("Set URL"); - - // Tap on Set URL Button. - await tester.tap(setURLButton); - await tester.pumpAndSettle(); - - // Verify that saveMsg changes from "Set URL" to "URL SAVED!". - expect( - find.text("Set URL"), - findsNothing, - ); - expect( - find.text("URL SAVED!"), - findsOneWidget, - ); - - // Tap on the loginButton. - await tester.tap(loginButton); - await tester.pumpAndSettle(); - - // LoginForm should be displayed. - expect( - find.text("SIGN IN"), - findsOneWidget, - ); - }); - }); -} diff --git a/test/widget_tests/register_form_test.dart b/test/widget_tests/register_form_test.dart deleted file mode 100644 index 1ccdfccfc..000000000 --- a/test/widget_tests/register_form_test.dart +++ /dev/null @@ -1,370 +0,0 @@ -// Packages imports. -import 'dart:math'; - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/views/pages/login_signup/register_page.dart'; -import '../helper.dart'; - -Widget createRegisterPageScreen() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration()), - ChangeNotifierProvider(create: (_) => OrgController()), - ChangeNotifierProvider(create: (_) => AuthController()), - ChangeNotifierProvider(create: (_) => Preferences()), - ChangeNotifierProvider(create: (_) => CommentHandler()), - ChangeNotifierProvider(create: (_) => PostProvider()), - ], - child: MaterialApp( - home: Builder( - builder: (context) { - SizeConfig().init(context); - return RegisterPage(); - }, - ), - ), - ); - -void main() { - group('Register Page Tests', () { - testWidgets("Check if Register Page shows up", (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createRegisterPageScreen()); - - /// Verify if [Register Page] shows up. - expect( - find.byType(RegisterPage), - findsOneWidget, - ); - }); - - testWidgets("Validations return false when empty form is submitted", - (tester) async { - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createRegisterPageScreen()); - - /// Get the hold of [Form] Widget. - final form = tester.widget(find.byType(Form)); - - /// Get the hold of [Form Key]. - final formKey = form.key as GlobalKey; - - // Get hold of SIGN UP button. - final signUpButton = find.text("SIGN UP"); - - // Tap on the signUpButton. - await tester.tap(signUpButton); - await tester.pumpAndSettle(); - - // Verify that key's current state validates to false. - expect( - formKey.currentState.validate(), - false, - ); - - /// Verify that we are still on [Register Page]. - expect( - find.byType(RegisterPage), - findsOneWidget, - ); - }); - - testWidgets( - "Validations return false when any one of five fields are empty", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createRegisterPageScreen()); - - /// Make an instance of [Random] class. - final Random random = Random(); - - /// Get the hold of [Form] Widget. - final form = tester.widget(find.byType(Form)); - - /// Get the hold of [Form Key]. - final formKey = form.key as GlobalKey; - - /// Get the total number of [TextFormField]'s. - final length = tester.widgetList(find.byType(TextFormField)).length; - - /// Generate random number between [0, 5]. - final int index = random.nextInt(length); - - if (index == 0) { - // Fill all the other TextFormFields except at index 0. - // Fill in last name field. - await tester.enterText( - find.byType(TextFormField).at(1), - "Last Name", - ); - - // Fill in email field. - await tester.enterText( - find.byType(TextFormField).at(2), - "test@gmail.com", - ); - - // Fill in password field. - await tester.enterText( - find.byType(TextFormField).at(3), - "Password1@", - ); - - // Fill in confirm password field. - await tester.enterText( - find.byType(TextFormField).at(4), - "Password1@", - ); - } else if (index == 1) { - // Fill all the other TextFormFields except at index 1. - // Fill in first name. - await tester.enterText( - find.byType(TextFormField).at(0), - "First Name", - ); - - // Fill in email field. - await tester.enterText( - find.byType(TextFormField).at(2), - "test@gmail.com", - ); - - // Fill in password field. - await tester.enterText( - find.byType(TextFormField).at(3), - "Password1@", - ); - - // Fill in confirm password field. - await tester.enterText( - find.byType(TextFormField).at(4), - "Password1@", - ); - } else if (index == 2) { - // Fill all the other TextFormFields except at index 2. - // Fill in first name. - await tester.enterText( - find.byType(TextFormField).at(0), - "First Name", - ); - - // Fill in last name field. - await tester.enterText( - find.byType(TextFormField).at(1), - "Last Name", - ); - - // Fill in password field. - await tester.enterText( - find.byType(TextFormField).at(3), - "Password1@", - ); - - // Fill in confirm password field. - await tester.enterText( - find.byType(TextFormField).at(4), - "Password1@", - ); - } else if (index == 3) { - // Fill all the other TextFormFields except at index 3. - // Fill in first name. - await tester.enterText( - find.byType(TextFormField).at(0), - "First Name", - ); - - // Fill in last name field. - await tester.enterText( - find.byType(TextFormField).at(1), - "Last Name", - ); - - // Fill in email field. - await tester.enterText( - find.byType(TextFormField).at(2), - "test@gmail.com", - ); - - // Fill in confirm password field. - await tester.enterText( - find.byType(TextFormField).at(4), - "Password1@", - ); - } else if (index == 4) { - // Fill all the other TextFormFields except at index 4. - // Fill in first name. - await tester.enterText( - find.byType(TextFormField).at(0), - "First Name", - ); - - // Fill in last name field. - await tester.enterText( - find.byType(TextFormField).at(1), - "Last Name", - ); - - // Fill in email field. - await tester.enterText( - find.byType(TextFormField).at(2), - "test@gmail.com", - ); - - // Fill in password field. - await tester.enterText( - find.byType(TextFormField).at(3), - "Password1@", - ); - } - - // Get hold of SIGN UP button. - final signUpButton = find.text("SIGN UP"); - - // Tap on the signUpButton. - await tester.tap(signUpButton); - await tester.pumpAndSettle(); - - // Verify that key's current state validates to false. - expect( - formKey.currentState.validate(), - false, - ); - - /// Verify that we are still on [Register Page]. - expect( - find.byType(RegisterPage), - findsOneWidget, - ); - }); - - testWidgets("Validations return false when both password field don't match", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createRegisterPageScreen()); - - /// Get the hold of [Form] Widget. - final form = tester.widget(find.byType(Form)); - - /// Get the hold of [Form Key]. - final formKey = form.key as GlobalKey; - - // Fill in first name. - await tester.enterText( - find.byType(TextFormField).at(0), - "First Name", - ); - - // Fill in last name field. - await tester.enterText( - find.byType(TextFormField).at(1), - "Last Name", - ); - - // Fill in email field. - await tester.enterText( - find.byType(TextFormField).at(2), - "test@gmail.com", - ); - - // Fill in password field. - await tester.enterText( - find.byType(TextFormField).at(3), - "Password1@", - ); - - // Fill in confirm password field (slightly different this time). - await tester.enterText( - find.byType(TextFormField).at(4), - "Password1@2", - ); - - // Get hold of SIGN UP button. - final signUpButton = find.text("SIGN UP"); - - // Tap on the signUpButton. - await tester.tap(signUpButton); - await tester.pumpAndSettle(); - - // Verify that key's current state validates to false. - expect( - formKey.currentState.validate(), - false, - ); - }); - - testWidgets("Validations return true when all fields are correctly filled", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createRegisterPageScreen()); - - /// Get the hold of [Form] Widget. - final form = tester.widget(find.byType(Form)); - - /// Get the hold of [Form Key]. - final formKey = form.key as GlobalKey; - - // Fill in first name. - await tester.enterText( - find.byType(TextFormField).at(0), - "First Name", - ); - - // Fill in last name field. - await tester.enterText( - find.byType(TextFormField).at(1), - "Last Name", - ); - - // Fill in email field. - await tester.enterText( - find.byType(TextFormField).at(2), - "test@gmail.com", - ); - - // Fill in password field. - await tester.enterText( - find.byType(TextFormField).at(3), - "Password1@", - ); - - // Fill in confirm password field. - await tester.enterText( - find.byType(TextFormField).at(4), - "Password1@", - ); - - // Get hold of SIGN UP button. - final signUpButton = find.text("SIGN UP"); - - // Tap on the signUpButton. - await tester.tap(signUpButton); - await tester.pumpAndSettle(); - - // Verify that key's current state validates to true - expect( - formKey.currentState.validate(), - true, - ); - }); - }); -} diff --git a/test/widget_tests/registrant_list_test.dart b/test/widget_tests/registrant_list_test.dart deleted file mode 100644 index e19b1f79a..000000000 --- a/test/widget_tests/registrant_list_test.dart +++ /dev/null @@ -1,80 +0,0 @@ -// Packages imports. -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/events/registrant_list.dart'; - -Widget registrantListPage() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ], - child: const MaterialApp( - home: RegList( - event: { - '_id': "6065ab230499450027b568af", - 'title': 'Weeb meet', - 'description': 'Let meet', - 'isPublic': true, - 'isRegisterable': true, - 'recurring': false, - 'recurrance': 'DAILY', - 'startTime': 1617258600000000, - 'endTime': 1617388140000000, - 'allDay': false, - 'location': 'India', - 'isRegistered': false - }, - ), - ), - ); -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("Registrant List Tests", () { - testWidgets("Testing if Registrant List Page shows up", (tester) async { - await tester.pumpWidget(registrantListPage()); - - /// Verify if [Registrant List Page] shows up. - - expect( - find.byType(Container), - findsWidgets, - ); - }); - - testWidgets("Testing overflow of Registrant List in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(440, 800); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(registrantListPage()); - }); - - testWidgets("Testing overflow of Registrant List in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(registrantListPage()); - }); - }); -} diff --git a/test/widget_tests/set_url_page_test.dart b/test/widget_tests/set_url_page_test.dart deleted file mode 100644 index 2a37490bc..000000000 --- a/test/widget_tests/set_url_page_test.dart +++ /dev/null @@ -1,293 +0,0 @@ -// Packages imports. -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/views/pages/login_signup/set_url_page.dart'; -import '../helper.dart'; - -Widget createLoginPageScreen() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration()), - ChangeNotifierProvider(create: (_) => OrgController()), - ChangeNotifierProvider(create: (_) => AuthController()), - ChangeNotifierProvider(create: (_) => Preferences()), - ChangeNotifierProvider(create: (_) => CommentHandler()), - ChangeNotifierProvider(create: (_) => PostProvider()), - ], - child: MaterialApp( - home: Builder(builder: (context) { - SizeConfig().init(context); - return UrlPage(); - }), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("Login Page Tests", () { - testWidgets("Testing if LoginPage shows up", (tester) async { - await tester.pumpWidget(createLoginPageScreen()); - - /// Verify if [LoginPage] shows up. - expect( - find.byType(Form), - findsOneWidget, - ); - }); - - testWidgets("Testing overflow of LoginPage in a mobile screen", - (tester) async { - await tester.pumpWidget(createLoginPageScreen()); - binding.window.physicalSizeTestValue = Size( - SizeConfig.safeBlockHorizontal * 110, - SizeConfig.safeBlockVertical * 100); - binding.window.devicePixelRatioTestValue = 1.0; - - /// Verify if [LoginPage] shows up. - expect( - find.byType(Form), - findsOneWidget, - ); - }); - - testWidgets("Testing overflow of LoginPage in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = Size( - SizeConfig.safeBlockHorizontal * 256, - SizeConfig.safeBlockVertical * 96); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(createLoginPageScreen()); - - /// Verify if [LoginPage] shows up. - expect( - find.byType(Form), - findsOneWidget, - ); - }); - - testWidgets("Create an Account Button is disabled if url not verfied", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - await tester.pumpWidget(createLoginPageScreen()); - - // Get the create account button. - final createAccountButton = find.text("Create an Account"); - - // Tap on the createAccountButton. - await tester.tap(createAccountButton); - await tester.pumpAndSettle(); - - // RegisterForm should not be displayed. - expect( - find.text("SIGN UP"), - findsNothing, - ); - }); - - testWidgets("Login Button is disabled if url not verfied", (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - await tester.pumpWidget(createLoginPageScreen()); - - // Get the login button. - final loginButton = find.text("Login"); - - // Tap on the login button - await tester.tap(loginButton); - await tester.pumpAndSettle(); - - // LoginForm should not be displayed. - expect( - find.text("SIGN IN"), - findsNothing, - ); - }); - - testWidgets("Create an Account Button is working if url is verfied", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createLoginPageScreen()); - - // Get the create account button. - final createAccountButton = find.text("Create an Account"); - - /// Enter [calico.palisadoes.org] in [TextFormField]. - await tester.enterText( - find.byType(TextFormField), - 'calico.palisadoes.org', - ); - - // Check if saveMsg is "Set URL". - expect( - find.text("Set URL"), - findsOneWidget, - ); - - // Get the Set URL Button. - final setURLButton = find.text("Set URL"); - - // Tap on Set URL Button. - await tester.tap(setURLButton); - await tester.pumpAndSettle(); - - // Verify that saveMsg changes from "Set URL" to "URL SAVED!". - expect( - find.text("Set URL"), - findsNothing, - ); - expect( - find.text("URL SAVED!"), - findsOneWidget, - ); - - // Tap on the createAccountButton. - await tester.tap(createAccountButton); - await tester.pumpAndSettle(); - - // RegisterForm should be displayed. - expect( - find.text("SIGN UP"), - findsOneWidget, - ); - }); - - testWidgets("Login Button is working if url is verfied", (tester) async { - //FlutterError.onError = onErrorIgnoreOverflowErrors; - await tester.pumpWidget(createLoginPageScreen()); - - // Get the create account button. - final loginButton = find.text("Login"); - - /// Enter [calico.palisadoes.org] in [TextFormField]. - await tester.enterText( - find.byType(TextFormField), - 'talawa-graphql-api.herokuapp.com/graphql', - ); - - // Check if saveMsg is "Set URL". - expect( - find.text("Set URL"), - findsOneWidget, - ); - - // Get the Set URL Button. - final setURLButton = find.text("Set URL"); - - // Tap on Set URL Button. - await tester.tap(setURLButton); - await tester.pumpAndSettle(); - - // Verify that saveMsg changes from "Set URL" to "URL SAVED!". - expect( - find.text("Set URL"), - findsNothing, - ); - expect( - find.text("URL SAVED!"), - findsOneWidget, - ); - - // Tap on the loginButton. - await tester.tap(loginButton); - await tester.pumpAndSettle(); - - // LoginForm should be displayed. - expect( - find.text("Login"), - findsOneWidget, - ); - }); - - testWidgets("Protocol selection button is available or not", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createLoginPageScreen()); - - // Verify that protocol selection button is present. - expect( - find.text("HTTP"), - findsOneWidget, - ); - }); - - testWidgets("On changing protocol 'URL Saved!' text changes to 'Set URL'", - (tester) async { - // Ignore overflow errors. - FlutterError.onError = onErrorIgnoreOverflowErrors; - - await tester.pumpWidget(createLoginPageScreen()); - - /// Enter [calico.palisadoes.org] in [TextFormField]. - await tester.enterText( - find.byType(TextFormField), - 'calico.palisadoes.org', - ); - - // Check if saveMsg is "Set URL". - expect( - find.text("Set URL"), - findsOneWidget, - ); - - // Get the Set URL Button. - final setURLButton = find.text("Set URL"); - - // Tap on Set URL Button. - await tester.tap(setURLButton); - await tester.pumpAndSettle(); - - // Verify that saveMsg changes from "Set URL" to "URL SAVED!". - expect( - find.text("Set URL"), - findsNothing, - ); - expect( - find.text("URL SAVED!"), - findsOneWidget, - ); - - // Get the DropdownButton - final dropDownButton = find.text("HTTP").first; - - // Tap on the dropDownButton. - await tester.tap(dropDownButton); - await tester.pumpAndSettle(); - - // Get the httpsOptionButton. - final httpsOptionButton = find.text("HTTPS").first; - - // Tap on the httpsOptionButton. - await tester.tap(httpsOptionButton); - await tester.pumpAndSettle(); - - // Verify that saveMsg changes from "URL SAVED!" to "Set URL". - expect( - find.text("Set URL"), - findsOneWidget, - ); - expect( - find.text("URL SAVED!"), - findsNothing, - ); - }); - }); -} diff --git a/test/widget_tests/task_list_test.dart b/test/widget_tests/task_list_test.dart deleted file mode 100644 index 27e0af3f4..000000000 --- a/test/widget_tests/task_list_test.dart +++ /dev/null @@ -1,80 +0,0 @@ -// Packages imports. -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/views/pages/events/task_list.dart'; - -Widget taskListPage() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration(), - ), - ChangeNotifierProvider( - create: (_) => OrgController(), - ), - ChangeNotifierProvider( - create: (_) => AuthController(), - ), - ChangeNotifierProvider( - create: (_) => Preferences(), - ), - ], - child: const MaterialApp( - home: TaskList( - event: { - '_id': "6065ab230499450027b568af", - 'title': 'Weeb meet', - 'description': 'Let meet', - 'isPublic': true, - 'isRegisterable': true, - 'recurring': false, - 'recurrance': 'DAILY', - 'startTime': 1617258600000000, - 'endTime': 1617388140000000, - 'allDay': false, - 'location': 'India', - 'isRegistered': false - }, - ), - ), - ); -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("Task List Tests", () { - testWidgets("Testing if tasklist Page shows up", (tester) async { - await tester.pumpWidget(taskListPage()); - - /// Verify if [tasklist Page] shows up. - - expect( - find.byType(Container), - findsWidgets, - ); - }); - - testWidgets("Testing overflow of Task List in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(440, 800); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(taskListPage()); - }); - - testWidgets("Testing overflow of Task List in a tablet screen", - (tester) async { - binding.window.physicalSizeTestValue = const Size(1024, 768); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(taskListPage()); - }); - }); -} diff --git a/test/widget_tests/update_profile_widget_test.dart b/test/widget_tests/update_profile_widget_test.dart deleted file mode 100644 index 611e382f6..000000000 --- a/test/widget_tests/update_profile_widget_test.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/views/pages/organization/update_profile_page.dart'; - -Widget createProfileUpdateScreen() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration()), - ChangeNotifierProvider(create: (_) => OrgController()), - ChangeNotifierProvider(create: (_) => AuthController()), - ChangeNotifierProvider(create: (_) => Preferences()), - ChangeNotifierProvider(create: (_) => CommentHandler()), - ChangeNotifierProvider(create: (_) => PostProvider()), - ], - child: MaterialApp( - home: Builder(builder: (BuildContext context) { - SizeConfig().init(context); - return const UpdateProfilePage( - userDetails: [ - { - "firstName": "Test", - "lastName": "User", - "email": "test@test.com", - } - ], - ); - }), - ), - ); - -void main() { - group('Member Info Page Widget Tests', () { - testWidgets("3 TestFormField Exist in Profile Page Update", - (WidgetTester tester) async { - await tester.pumpWidget( - createProfileUpdateScreen(), const Duration(microseconds: 100)); - - final textField = find.byType(TextFormField); - expect(textField, findsNWidgets(3)); - }); - - testWidgets("Flexible Space Bar in Profile Widget", - (WidgetTester tester) async { - await tester.pumpWidget( - createProfileUpdateScreen(), const Duration(microseconds: 100)); - - final tile = find.byType(ListTile); - expect(tile, findsOneWidget); - }); - }); -} diff --git a/test/widget_tests/user_task_tab_test.dart b/test/widget_tests/user_task_tab_test.dart deleted file mode 100644 index b4983b3c3..000000000 --- a/test/widget_tests/user_task_tab_test.dart +++ /dev/null @@ -1,78 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:provider/provider.dart'; - -// Local files imports. -import 'package:talawa/controllers/auth_controller.dart'; -import 'package:talawa/controllers/org_controller.dart'; -import 'package:talawa/services/comment.dart'; -import 'package:talawa/services/post_provider.dart'; -import 'package:talawa/services/preferences.dart'; -import 'package:talawa/utils/gql_client.dart'; -import 'package:talawa/utils/ui_scaling.dart'; -import 'package:talawa/views/pages/members/user_taskstab.dart'; - -Widget userTasksPage() => MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => GraphQLConfiguration()), - ChangeNotifierProvider(create: (_) => OrgController()), - ChangeNotifierProvider(create: (_) => AuthController()), - ChangeNotifierProvider(create: (_) => Preferences()), - ChangeNotifierProvider(create: (_) => CommentHandler()), - ChangeNotifierProvider(create: (_) => PostProvider()), - ], - child: MaterialApp( - home: Builder(builder: (context) { - SizeConfig().init(context); - return UserTasks( - member: const { - '_id': "6076f6d2cd2288002704654b", - }, - ); - }), - ), - ); - -void main() { - final TestWidgetsFlutterBinding binding = - TestWidgetsFlutterBinding.ensureInitialized() - as TestWidgetsFlutterBinding; - - group("users task tab page tests", () { - testWidgets("Testing if users task tab shows up", (tester) async { - await tester.pumpWidget(userTasksPage()); - - await tester.pumpAndSettle(); - //verify if [users task tab ] page appears - expect(find.byType(Container), findsOneWidget); - }); - - testWidgets("Testing overflow of users task tab page in a mobile screen", - (tester) async { - binding.window.physicalSizeTestValue = Size( - SizeConfig.safeBlockHorizontal * 110, - SizeConfig.safeBlockVertical * 100); - binding.window.devicePixelRatioTestValue = 1.0; - - await tester.pumpWidget(userTasksPage()); - await tester.pumpAndSettle(); - - //verify if [users task tab] page appears - expect(find.byType(Container), findsOneWidget); - }); - testWidgets("Testing overflow of users task tab in a tablet screen", - (tester) async { - await tester.pumpWidget(userTasksPage()); - await tester.pumpAndSettle(); - binding.window.physicalSizeTestValue = Size( - SizeConfig.safeBlockHorizontal * 256, - SizeConfig.safeBlockVertical * 96); - binding.window.devicePixelRatioTestValue = 1.0; - - //verify if [ users task tab ] page appears - - expect(find.byType(Container), findsOneWidget); - }); - }); -} diff --git a/test/widget_tests/widgets/agenda_item_tile_test.dart b/test/widget_tests/widgets/agenda_item_tile_test.dart new file mode 100644 index 000000000..8ff3cf6d4 --- /dev/null +++ b/test/widget_tests/widgets/agenda_item_tile_test.dart @@ -0,0 +1,136 @@ +// ignore_for_file: talawa_api_doc +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/events/event_agenda_category.dart'; +import 'package:talawa/models/events/event_agenda_item.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/widgets/agenda_item_tile.dart'; + +void main() { + late EventAgendaItem testAgendaItem; + SizeConfig().test(); + setUp(() { + testAgendaItem = EventAgendaItem( + id: '1', + title: 'Test Agenda Item', + description: 'Test Description', + duration: '00:30', + sequence: 1, + categories: [ + AgendaCategory(id: '1', name: 'Category 1'), + AgendaCategory(id: '2', name: 'Category 2'), + ], + attachments: [], + urls: ['https://example.com'], + ); + }); + + Widget createExpandableAgendaItemTile() { + return MaterialApp( + home: Scaffold( + body: ExpandableAgendaItemTile( + item: testAgendaItem, + onEdit: () {}, + onDelete: () {}, + ), + ), + ); + } + + group('ExpandableAgendaItemTile Widget Tests', () { + testWidgets('ExpandableAgendaItemTile renders correctly', + (WidgetTester tester) async { + await tester.pumpWidget(createExpandableAgendaItemTile()); + await tester.pumpAndSettle(); + + expect(find.byType(ExpandableAgendaItemTile), findsOneWidget); + expect(find.text('Test Agenda Item'), findsOneWidget); + expect(find.byIcon(Icons.drag_handle), findsOneWidget); + expect(find.byIcon(Icons.edit), findsOneWidget); + expect(find.byIcon(Icons.delete), findsOneWidget); + }); + + testWidgets('Expansion works correctly', (WidgetTester tester) async { + await tester.pumpWidget(createExpandableAgendaItemTile()); + await tester.pumpAndSettle(); + + // Initially, the expanded content should not be visible + expect(find.text('Description:'), findsNothing); + + // Tap to expand + await tester.tap(find.text('Test Agenda Item')); + await tester.pumpAndSettle(); + + // Now the expanded content should be visible + expect(find.text('Description:'), findsOneWidget); + }); + + testWidgets('Categories are displayed correctly', + (WidgetTester tester) async { + await tester.pumpWidget(createExpandableAgendaItemTile()); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Test Agenda Item')); + await tester.pumpAndSettle(); + + expect(find.text('Categories:'), findsOneWidget); + expect(find.text('Category 1'), findsOneWidget); + expect(find.text('Category 2'), findsOneWidget); + }); + + testWidgets('URLs are displayed correctly', (WidgetTester tester) async { + await tester.pumpWidget(createExpandableAgendaItemTile()); + await tester.pumpAndSettle(); + + await tester.tap(find.text('Test Agenda Item')); + await tester.pumpAndSettle(); + + expect(find.text('URLs:'), findsOneWidget); + expect(find.text('https://example.com'), findsOneWidget); + }); + + testWidgets('Edit button calls onEdit callback', + (WidgetTester tester) async { + bool editCalled = false; + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: ExpandableAgendaItemTile( + item: testAgendaItem, + onEdit: () => editCalled = true, + onDelete: () {}, + ), + ), + ), + ); + await tester.pumpAndSettle(); + + await tester.tap(find.byIcon(Icons.edit)); + await tester.pumpAndSettle(); + + expect(editCalled, isTrue); + }); + + testWidgets('Delete button calls onDelete callback', + (WidgetTester tester) async { + bool deleteCalled = false; + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: ExpandableAgendaItemTile( + item: testAgendaItem, + onEdit: () {}, + onDelete: () => deleteCalled = true, + ), + ), + ), + ); + await tester.pumpAndSettle(); + + await tester.tap(find.byIcon(Icons.delete)); + await tester.pumpAndSettle(); + + expect(deleteCalled, isTrue); + }); + }); +} diff --git a/test/widget_tests/widgets/custom_alert_dialog_test.dart b/test/widget_tests/widgets/custom_alert_dialog_test.dart new file mode 100644 index 000000000..b05950d59 --- /dev/null +++ b/test/widget_tests/widgets/custom_alert_dialog_test.dart @@ -0,0 +1,138 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; + +import '../../helpers/test_locator.dart'; + +bool success = false; +bool cancelled = false; + +void onSuccess() { + success = true; +} + +void onCancel() { + cancelled = true; +} + +Widget createCustomAlertDialog({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + navigationService.pushDialog( + CustomAlertDialog( + success: onSuccess, + secondaryButtonTap: passSecondaryFunc ? onCancel : null, + dialogSubTitle: 'Yes Boi', + reverse: reverse, + ), + ); + }, + ), + ), + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + }); + group('Test for CustomAlertDialog', () { + testWidgets('Check if the AlertDialog shows up', (tester) async { + await tester.pumpWidget(createCustomAlertDialog()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(AlertDialog), findsOneWidget); + }); + + testWidgets('Check for the RaisedRoundedButtons', (tester) async { + await tester.pumpWidget(createCustomAlertDialog()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(RaisedRoundedButton), findsNWidgets(2)); + }); + + testWidgets('Check if the Confirm button works', (tester) async { + await tester.pumpWidget(createCustomAlertDialog()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + final buttonFinder = find.byType(RaisedRoundedButton); + + await tester.tap(buttonFinder.last); + await tester.pump(); + + expect(success, true); + }); + + testWidgets('Check if the Cancel button works (with secondary func)', + (tester) async { + await tester.pumpWidget(createCustomAlertDialog()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + final buttonFinder = find.byType(RaisedRoundedButton); + + await tester.tap(buttonFinder.first); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(AlertDialog), findsOneWidget); + }); + + testWidgets('Check if the Cancel button works (without secondary func)', + (tester) async { + await tester + .pumpWidget(createCustomAlertDialog(passSecondaryFunc: false)); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + final buttonFinder = find.byType(RaisedRoundedButton); + + await tester.tap(buttonFinder.first); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(AlertDialog), findsNothing); + }); + }); +} diff --git a/test/widget_tests/widgets/custom_avatar_test.dart b/test/widget_tests/widgets/custom_avatar_test.dart new file mode 100644 index 000000000..79419bf51 --- /dev/null +++ b/test/widget_tests/widgets/custom_avatar_test.dart @@ -0,0 +1,330 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:shimmer/shimmer.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; + +/// main function. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() { + group('CustomAvatar', () { + testWidgets('renders correctly when image is not null', + (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: false, + imageUrl: 'https://example.com/image.jpg', + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + expect(find.byType(CachedNetworkImage), findsOneWidget); + }); + + testWidgets('renders correctly when image is null', + (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: true, + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + expect(find.text('A'), findsOneWidget); + }); + + testWidgets('renders correctly with default fontSize and maxRadius', + (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: true, + firstAlphabet: 'A', + ), + ), + ); + + final textFinder = find.text('A'); + final textWidget = tester.widget(textFinder); + expect(textWidget.style!.fontSize, 40); + + final circleAvatarFinder = find.byType(CircleAvatar); + final circleAvatarWidget = + tester.widget(circleAvatarFinder); + expect(circleAvatarWidget.maxRadius, 16); + }); + }); + + testWidgets( + 'CircularAvatar with error icon is shown when image fails to load', + (widgetTester) async { + await widgetTester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: false, + imageUrl: ' ', + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + await widgetTester.pump(const Duration(seconds: 5)); + + expect( + find.byWidgetPredicate( + (widget) => + widget is CachedNetworkImage && + widget.errorWidget != null && + widget.errorWidget is Function && + widget.errorWidget!( + widgetTester.binding.rootElement!, + '', + Exception(), + ) is CircleAvatar && + (widget.errorWidget!( + widgetTester.binding.rootElement!, + '', + Exception(), + ) as CircleAvatar) + .child is Icon && + ((widget.errorWidget!( + widgetTester.binding.rootElement!, + '', + Exception(), + ) as CircleAvatar) + .child as Icon?) + ?.icon == + Icons.error, + ), + findsOneWidget, + ); + }); + testWidgets('renders correctly when image is null and checks for theme color', + (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: true, + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + final circleAvatarFinder = find.byType(CircleAvatar); + final circleAvatarWidget = tester.widget(circleAvatarFinder); + expect( + circleAvatarWidget.backgroundColor, + Theme.of(tester.element(circleAvatarFinder)) + .iconTheme + .color! + .withOpacity(0.2), + ); + }); + + testWidgets( + 'renders correctly when image is not null and checks for theme color', + (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: false, + imageUrl: 'https://example.com/image.jpg', + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + final cachedNetworkImageFinder = find.byType(CachedNetworkImage); + final cachedNetworkImageWidget = + tester.widget(cachedNetworkImageFinder); + expect(cachedNetworkImageWidget.imageUrl, 'https://example.com/image.jpg'); + }); + + testWidgets('renders placeholder correctly when image is loading', + (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: false, + imageUrl: 'https://example.com/image.jpg', + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + await tester.pump(Duration.zero); // Start loading image + + expect(find.byType(Shimmer), findsOneWidget); + }); + + testWidgets('CircleAvatar is shown when image fails to load', + (widgetTester) async { + await widgetTester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: false, + imageUrl: ' ', + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + await widgetTester.pump(const Duration(seconds: 5)); + + expect( + find.byWidgetPredicate( + (widget) => + widget is CachedNetworkImage && + widget.errorWidget != null && + widget.errorWidget is Function && + widget.errorWidget!( + widgetTester.binding.rootElement!, + '', + Exception(), + ) is CircleAvatar, + ), + findsOneWidget, + ); + }); + testWidgets('CircleAvatar in image builder is shown', (widgetTester) async { + await widgetTester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: false, + imageUrl: ' ', + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + await widgetTester.pump(const Duration(seconds: 5)); + + expect( + find.byWidgetPredicate( + (widget) => + widget is CachedNetworkImage && + widget.imageBuilder != null && + widget.imageBuilder is Function && + widget.imageBuilder!( + widgetTester.binding.rootElement!, + const NetworkImage( + 'https://imgs.search.brave.com/OHazbRf4oO5wuydAbr6061fUGuEw-rlDB1SuXWnJgTo/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9pLnBp/bmltZy5jb20vb3Jp/Z2luYWxzLzZiLzIy/L2JhLzZiMjJiYTg2/Yzk3NjBiMzQ4YjNh/NTMzOGFjMzI4ZmJm/LmpwZw', + ), + ) is CircleAvatar, + ), + findsOneWidget, + ); + }); + + testWidgets('CircleAvatar in image builder is shown with correct image', + (widgetTester) async { + await widgetTester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: false, + imageUrl: ' ', + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + await widgetTester.pump(const Duration(seconds: 5)); + + expect( + find.byWidgetPredicate( + (widget) => + widget is CachedNetworkImage && + widget.imageBuilder != null && + widget.imageBuilder is Function && + widget.imageBuilder!( + widgetTester.binding.rootElement!, + const NetworkImage( + 'https://imgs.search.brave.com/OHazbRf4oO5wuydAbr6061fUGuEw-rlDB1SuXWnJgTo/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9pLnBp/bmltZy5jb20vb3Jp/Z2luYWxzLzZiLzIy/L2JhLzZiMjJiYTg2/Yzk3NjBiMzQ4YjNh/NTMzOGFjMzI4ZmJm/LmpwZw', + ), + ) is CircleAvatar && + (widget.imageBuilder!( + widgetTester.binding.rootElement!, + const NetworkImage( + 'https://imgs.search.brave.com/OHazbRf4oO5wuydAbr6061fUGuEw-rlDB1SuXWnJgTo/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9pLnBp/bmltZy5jb20vb3Jp/Z2luYWxzLzZiLzIy/L2JhLzZiMjJiYTg2/Yzk3NjBiMzQ4YjNh/NTMzOGFjMzI4ZmJm/LmpwZw', + ), + ) as CircleAvatar) + .backgroundImage == + const NetworkImage( + 'https://imgs.search.brave.com/OHazbRf4oO5wuydAbr6061fUGuEw-rlDB1SuXWnJgTo/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9pLnBp/bmltZy5jb20vb3Jp/Z2luYWxzLzZiLzIy/L2JhLzZiMjJiYTg2/Yzk3NjBiMzQ4YjNh/NTMzOGFjMzI4ZmJm/LmpwZw', + ), + ), + findsOneWidget, + ); + }); + + testWidgets('CircleAvatar in image builder is shown with correct theme', + (widgetTester) async { + await widgetTester.pumpWidget( + const MaterialApp( + home: CustomAvatar( + isImageNull: false, + imageUrl: ' ', + firstAlphabet: 'A', + fontSize: 40, + maxRadius: 16, + ), + ), + ); + + await widgetTester.pump(const Duration(seconds: 5)); + + expect( + find.byWidgetPredicate( + (widget) => + widget is CachedNetworkImage && + widget.imageBuilder != null && + widget.imageBuilder is Function && + widget.imageBuilder!( + widgetTester.binding.rootElement!, + const NetworkImage( + 'https://imgs.search.brave.com/OHazbRf4oO5wuydAbr6061fUGuEw-rlDB1SuXWnJgTo/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9pLnBp/bmltZy5jb20vb3Jp/Z2luYWxzLzZiLzIy/L2JhLzZiMjJiYTg2/Yzk3NjBiMzQ4YjNh/NTMzOGFjMzI4ZmJm/LmpwZw', + ), + ) is CircleAvatar && + (widget.imageBuilder!( + widgetTester.binding.rootElement!, + const NetworkImage( + 'https://imgs.search.brave.com/OHazbRf4oO5wuydAbr6061fUGuEw-rlDB1SuXWnJgTo/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9pLnBp/bmltZy5jb20vb3Jp/Z2luYWxzLzZiLzIy/L2JhLzZiMjJiYTg2/Yzk3NjBiMzQ4YjNh/NTMzOGFjMzI4ZmJm/LmpwZw', + ), + ) as CircleAvatar) + .backgroundColor == + Theme.of(widgetTester.binding.rootElement!) + .iconTheme + .color! + .withOpacity(0.2), + ), + findsOneWidget, + ); + }); +} diff --git a/test/widget_tests/widgets/custom_drawer_test.dart b/test/widget_tests/widgets/custom_drawer_test.dart new file mode 100644 index 000000000..0f243ddcc --- /dev/null +++ b/test/widget_tests/widgets/custom_drawer_test.dart @@ -0,0 +1,303 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:talawa/constants/custom_theme.dart'; +import 'package:talawa/constants/routing_constants.dart'; +import 'package:talawa/models/mainscreen_navigation_args.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/services/graphql_config.dart'; +// import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.dart'; +// import 'package:talawa/view_model/main_screen_view_model.dart'; +import 'package:talawa/views/main_screen.dart'; +import 'package:talawa/widgets/custom_alert_dialog.dart'; +// import 'package:talawa/widgets/custom_alert_dialog.dart'; +import '../../helpers/test_helpers.dart'; +// import '../../helpers/test_helpers.mocks.dart'; +import '../../helpers/test_locator.dart'; + +class MockBuildContext extends Mock implements BuildContext {} + +bool _switchOrgcalled = false; + +class MockCustomDrawerViewModel extends Mock implements CustomDrawerViewModel { + final _scrollController = ScrollController(); + @override + ScrollController get controller => _scrollController; + @override + List get switchAbleOrg { + print("hi"); + return [OrgInfo(id: 'test1', name: 'name')]; + } + + @override + OrgInfo get selectedOrg => OrgInfo(id: 'test1', name: 'name'); + @override + void switchOrg(OrgInfo orginfo) { + _switchOrgcalled = true; + } +} + +class MockScrollController extends Mock implements ScrollController { + @override + ScrollPosition get position => MockScrollPosition(); +} + +class MockScrollPosition extends Mock implements ScrollPosition {} + +Widget createHomePageScreen({required bool demoMode}) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + home: MainScreen( + key: const Key('MainScreen'), + mainScreenArgs: MainScreenArgs( + mainScreenIndex: 0, + fromSignUp: false, + toggleDemoMode: demoMode, + ), + ), + ); +} + +void main() async { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + + locator().test(); + locator().test(); + registerServices(); + }); + // setUp(() { + // }); + + tearDownAll(() { + unregisterServices(); + }); + + group('Exit Button', () { + testWidgets("Tapping Tests for Exit", (tester) async { + final customDrawerViewModel = CustomDrawerViewModel(); + + final Widget buildAlertDialog = MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + home: customDrawerViewModel.exitAlertDialog(), + ); + + await tester.pumpWidget(buildAlertDialog); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + final exitDialog = find.byKey(const Key("Exit?")); + await tester.tap(find.text('Exit')); + + expect(exitDialog, findsOneWidget); + }); + }); + + group('Test Organization action Buttons', () { + testWidgets('Test Join Organization Button when user not logged in.', + (tester) async { + await tester.pumpWidget(createHomePageScreen(demoMode: true)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + // if user not logged in + when(userConfig.loggedIn).thenReturn(false); + + MainScreenViewModel.scaffoldKey.currentState?.openDrawer(); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key('Drawer')), findsOneWidget); + + final buttonFinder = find.byKey(MainScreenViewModel.keyDrawerJoinOrg); + + await tester.tap(buttonFinder); + await tester.pumpAndSettle(); + + when( + navigationService.popAndPushScreen( + Routes.setUrlScreen, + arguments: '', + ), + ).thenAnswer((_) async {}); + + verify( + navigationService.popAndPushScreen( + Routes.setUrlScreen, + arguments: '', + ), + ); + }); + + testWidgets('Test leave current Organization Button.', (tester) async { + await tester.pumpWidget(createHomePageScreen(demoMode: true)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + // if user not logged in + when(userConfig.loggedIn).thenReturn(true); + + MainScreenViewModel.scaffoldKey.currentState?.openDrawer(); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key('Drawer')), findsOneWidget); + + final buttonFinder = find.byKey( + MainScreenViewModel.keyDrawerLeaveCurrentOrg, + ); + + final tmp = CustomAlertDialog( + key: const Key("Exit?"), + reverse: true, + dialogSubTitle: 'Are you sure you want to exit this organization?', + successText: 'Exit', + success: () { + //Exit org + }, + ); + + when( + navigationService.pushDialog(tmp), + ).thenAnswer((realInvocation) async {}); + + await tester.ensureVisible(buttonFinder); + await tester.pumpAndSettle(); + + await tester.tap(buttonFinder); + await tester.pumpAndSettle(); + + verifyNever(navigationService.pushDialog(tmp)).called(0); + // expect(find.text('Exit'), findsOneWidget); + }); + + testWidgets('Test Join Organization Button when user logged in.', + (tester) async { + await tester.pumpWidget(createHomePageScreen(demoMode: true)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + // if user not logged in + when(userConfig.loggedIn).thenReturn(true); + + MainScreenViewModel.scaffoldKey.currentState?.openDrawer(); + await tester.pumpAndSettle(); + + final buttonFinder = find.byKey(MainScreenViewModel.keyDrawerJoinOrg); + + await tester.tap(buttonFinder); + await tester.pumpAndSettle(); + + when( + navigationService.popAndPushScreen( + Routes.joinOrg, + arguments: '-1', + ), + ).thenAnswer((_) async {}); + + verify( + navigationService.popAndPushScreen( + Routes.joinOrg, + arguments: '-1', + ), + ); + }); + + testWidgets('Test Switch org list.', (tester) async { + await tester.pumpWidget(createHomePageScreen(demoMode: true)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + locator.unregister(); + + locator.registerSingleton( + MockCustomDrawerViewModel(), + ); + + // if user not logged in + when(userConfig.loggedIn).thenReturn(false); + + MainScreenViewModel.scaffoldKey.currentState?.openDrawer(); + await tester.pumpAndSettle(); + + expect(find.byKey(const Key('Switching Org')), findsOneWidget); + + final buttonFinder = find.byKey(const Key('Org')); + + await tester.tap(buttonFinder); + + expect(_switchOrgcalled, true); + }); + }); + + group('Custom Drawer Test', () { + /*testWidgets("Widget Testing", (tester) async { + // pumping the Widget + await tester.pumpWidget(createHomePageScreen()); + await tester.pumpAndSettle(); + // Opening the Drawer so that it can be loaded in the widget tree and built() is called + await tester.dragFrom( + tester.getTopLeft(find.byType(MaterialApp)), const Offset(300, 0)); + await tester.pumpAndSettle(); + // getting the Finders for Code Coverage + expect(find.byKey(const ValueKey("Drawer")), findsOneWidget); + expect(find.byKey(const ValueKey("Custom Drawer")), findsOneWidget); + expect(find.text("Selected Organization"), findsOneWidget); + expect(find.text("Switch Organization"), findsOneWidget); + final listOfOrgs = find.byKey(const ValueKey("Switching Org")); + expect(listOfOrgs, findsOneWidget); + expect(find.byKey(MainScreenViewModel.keyDrawerCurOrg), findsOneWidget); + expect(find.byKey(MainScreenViewModel.keyDrawerSwitchableOrg), + findsOneWidget); + expect(find.byType(UserAccountsDrawerHeader), findsOneWidget); + expect(find.text("Join new Organization"), findsOneWidget); + expect(find.text("Leave Current Organization"), findsOneWidget); + final fromPalisadoes = find.byKey(const ValueKey("From Palisadoes")); + expect(fromPalisadoes, findsOneWidget); + }); + testWidgets("Tapping Tests for Org", (tester) async { + await tester.pumpWidget(createHomePageScreen()); + await tester.pumpAndSettle(); + // Opening the Drawer so that it can be loaded in the widget tree and built() is called + await tester.dragFrom( + tester.getTopLeft(find.byType(MaterialApp)), const Offset(300, 0)); + await tester.pumpAndSettle(); + final orgs = find.byKey(const ValueKey("Org")); + // Atleast One Org should be there + // ignore: invalid_use_of_protected_member + expect(orgs.allCandidates.isEmpty, false); + await tester.tap(orgs.first); + // Was not required but done for code Coverage + // Sized + final sizedbox = find.byKey(const ValueKey("Sized Box Drawer")); + // ignore: invalid_use_of_protected_member + expect(sizedbox.allCandidates.isEmpty, false); + }); + testWidgets("Tapping Tests for Join", (tester) async { + await tester.pumpWidget(createHomePageScreen()); + await tester.pumpAndSettle(); + tester.binding.window.physicalSizeTestValue = const Size(800, 4000); + MainScreenViewModel.scaffoldKey.currentState?.openDrawer(); + await tester.pumpAndSettle(); + final joinOrg = find.byKey(MainScreenViewModel.keyDrawerJoinOrg); + await tester.tap(joinOrg); + // await tester.pumpAndSettle(); + });*/ + }); +} diff --git a/test/widget_tests/widgets/custom_list_tile_test.dart b/test/widget_tests/widgets/custom_list_tile_test.dart new file mode 100644 index 000000000..dfc781cf8 --- /dev/null +++ b/test/widget_tests/widgets/custom_list_tile_test.dart @@ -0,0 +1,384 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/models/options/options.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/organization/org_info_address.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; +import 'package:talawa/widgets/custom_list_tile.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +TileType _tileType = TileType.org; +OrgInfo _orgInfo = OrgInfo(); +const Key _key = Key('CustomListTileKey'); +int _index = 0; +Options _option = Options( + icon: const Icon(Icons.add), + title: 'Test', + subtitle: 'Just a test', +); +bool _showIcon = false; +User _userInfo = User(); + +// ignore: prefer_function_declarations_over_variables +dynamic Function(OrgInfo)? _onTapOrgInfo = (OrgInfo orgInfo) => true; + +// ignore: prefer_function_declarations_over_variables +void Function()? _onTapOption = () => {}; + +// ignore: prefer_function_declarations_over_variables +dynamic Function()? _onTapUserInfo = () => {}; + +Widget _createCustomListTile() { + return MaterialApp( + navigatorKey: navigationService.navigatorKey, + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: CustomListTile( + key: _key, + index: _index, + type: _tileType, + option: _option, + showIcon: _showIcon, + onTapOrgInfo: _onTapOrgInfo, + onTapOption: _onTapOption, + userInfo: _userInfo, + orgInfo: _orgInfo, + onTapUserInfo: _onTapUserInfo, + ), + ), + ); +} + +void main() { + SizeConfig().test(); + setUp(() async { + _tileType = TileType.org; + _orgInfo = OrgInfo(); + _index = 0; + _option = Options( + icon: const Icon(Icons.add), + title: 'Test', + subtitle: 'Just a test', + ); + _showIcon = false; + _onTapOrgInfo = (OrgInfo orgInfo) => true; + + _userInfo = User(); + _onTapOption = () => {}; + _onTapUserInfo = () => {}; + registerServices(); + }); + tearDown(() { + unregisterServices(); + }); + group('Custom list tile test', () { + testWidgets("Test type is org ", (WidgetTester tester) async { + bool executed = false; + _orgInfo = OrgInfo( + name: 'Test Name', + userRegistrationRequired: false, + creatorInfo: User( + firstName: 'Test firstname', + lastName: 'Test lastname', + ), + address: Address( + city: 'Test City', + countryCode: 'TC', + ), + ); + _onTapOrgInfo = (OrgInfo orgInfo) { + executed = true; + }; + _tileType = TileType.org; + await tester.pumpWidget(_createCustomListTile()); + await tester.pumpAndSettle(); + + // test to see if custom list tile widget shows up + expect(find.byKey(_key), findsOneWidget); + + // test to see if onTap of Inkwell works + await tester.tap(find.byType(InkWell)); + await tester.pump(); + expect(executed, true); + + // test to check that there is no icon + expect(find.byIcon(Icons.add), findsNothing); + + // Testing Rich Text for org name and address shows up + final orgName = find.byKey(const Key('OrgNamewithOrgAddress')); + + expect(orgName, findsOneWidget); + + // Test for icon when is public is true + expect(find.byIcon(Icons.lock_open), findsOneWidget); + + final iconFinder = find.descendant( + of: find.byType(Expanded).at(1), + matching: find.byType(Icon), + ); + final iconWidget = tester.firstWidget(iconFinder) as Icon; + + expect(iconWidget.color, const Color(0xFF34AD64)); + + // Test for sized box when showIcon is false + final sizedBoxFinder = find + .descendant( + of: find.byType(Expanded).at(1), + matching: find.byType(SizedBox), + ) + .at(0); + expect(sizedBoxFinder, findsOneWidget); + }); + + testWidgets("Test for orgs when is Public is false ", + (WidgetTester tester) async { + _orgInfo = OrgInfo( + name: 'Test Name', + userRegistrationRequired: true, + creatorInfo: User( + firstName: 'Test firstname', + lastName: 'Test lastname', + ), + ); + _tileType = TileType.org; + + await tester.pumpWidget(_createCustomListTile()); + await tester.pumpAndSettle(); + + // Test for is public display + expect( + find.text( + AppLocalizations.of(navigationService.navigatorKey.currentContext!)! + .strictTranslate('Private'), + ), + findsNothing, + ); + + // Test for icon when is public is false + expect(find.byIcon(Icons.lock), findsOneWidget); + + final iconFinder = find.descendant( + of: find.byType(Expanded).at(1), + matching: find.byType(Icon), + ); + final iconWidget = tester.firstWidget(iconFinder) as Icon; + + expect(iconWidget.color, const Color(0xffFABC57)); + }); + + testWidgets("Test when type is user ", (WidgetTester tester) async { + bool executed = false; + _tileType = TileType.user; + _userInfo = User( + firstName: 'Test firstname', + lastName: 'Test lastname', + ); + _onTapUserInfo = () => {executed = true}; + await tester.pumpWidget(_createCustomListTile()); + await tester.pumpAndSettle(); + + // test to see if custom list tile widget shows up + expect(find.byKey(_key), findsOneWidget); + + // test to see if onTap of Inkwell works + await tester.tap(find.byType(InkWell)); + await tester.pump(); + expect(executed, true); + + // test to check that there is a custom avatar + // expect(find.byType(CustomAvatar), findsOneWidget); + + // test to check that there is no icon + expect(find.byIcon(Icons.add), findsNothing); + + // test the properties passed to CustomAvatar + // final customAvatarFinder = find.byType(CustomAvatar); + // final customAvatarWidget = + // tester.firstWidget(customAvatarFinder) as CustomAvatar; + // expect(customAvatarWidget.isImageNull, true); + // expect(customAvatarWidget.imageUrl, null); + // expect(customAvatarWidget.firstAlphabet, 'T'); + + // Testing Text for that contains user's name + final userNameFinder = find + .descendant( + of: find.byType(Expanded).at(0), + matching: find.byType(Text), + ) + .first; + + final userNameWidget = tester.firstWidget(userNameFinder) as Text; + + expect(userNameWidget.data, 'Test firstname Test lastname'); + // expect( + // userNameWidget.style, + // Theme.of(navigationService.navigatorKey.currentContext!) + // .textTheme + // .titleLarge, + // ); + + // Testing SizedBox for users fallback for creater info + // final userSizedBoxFallback = find + // .descendant( + // of: find.byType(Expanded).at(0), + // matching: find.byType(SizedBox), + // ) + // .first; + + // expect(userSizedBoxFallback, findsOneWidget); + + // Testing SizedBox for users fallback for userRegistrationRequired info + // final userSizedBoxFallback1 = find + // .descendant( + // of: find.byType(Expanded).at(1), + // matching: find.byType(SizedBox), + // ) + // .first; + // + // expect(userSizedBoxFallback1, findsOneWidget); + }); + testWidgets("Test when type is option", (WidgetTester tester) async { + bool executed = false; + _tileType = TileType.option; + _onTapOption = () => executed = true; + await tester.pumpWidget(_createCustomListTile()); + await tester.pumpAndSettle(); + + // test to see if custom list tile widget shows up + expect(find.byKey(_key), findsOneWidget); + + // test to see if onTap of Inkwell works + await tester.ensureVisible(find.byType(InkWell)); + await tester.tap(find.byType(InkWell)); + await tester.pump(); + expect(executed, true); + + // test to check that there is no custom avatar + expect(find.byType(CustomAvatar), findsNothing); + + // test to check that there is an icon + // expect(find.byIcon(Icons.add), findsOneWidget); + + // Testing Text that contains option's title + final optionTitleFinder = find + .descendant( + of: find.byType(Expanded).at(0), + matching: find.byType(Text), + ) + .first; + + final optionTitleWidget = tester.firstWidget(optionTitleFinder) as Text; + + expect(optionTitleWidget.data, 'Test'); + expect( + optionTitleWidget.style, + Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .bodyMedium + ?.copyWith(fontSize: 18, color: Colors.black), + ); + + // Testing Text that contains option's subtitle + final optionSubtitleFinder = find + .descendant( + of: find.byType(Expanded).at(0), + matching: find.byType(Text), + ) + .at(0); + + final optionSubtitleWidget = + tester.firstWidget(optionSubtitleFinder) as Text; + + expect(optionSubtitleWidget.data, 'Test'); + expect( + optionSubtitleWidget.style, + Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .bodyMedium + ?.copyWith( + color: Colors.black, + fontSize: 18, + ), + ); + + // Testing SizedBox for option when trailing icon button is null (fallback for creater info) + final optionSizedBoxFallback = find + .descendant( + of: find.byType(Expanded).at(1), + matching: find.byType(SizedBox), + ) + .first; + + expect(optionSizedBoxFallback, findsOneWidget); + }); + testWidgets("Test when option trailing icon button is not null", + (WidgetTester tester) async { + _tileType = TileType.option; + _option = Options( + icon: const Icon(Icons.add), + title: 'Test', + subtitle: 'Just a test', + trailingIconButton: IconButton( + icon: const Icon(Icons.send), + onPressed: () {}, + ), + ); + await tester.pumpWidget(_createCustomListTile()); + await tester.pumpAndSettle(); + + // Testing TextStyle that contains option's title + final optionTitleFinder = find + .descendant( + of: find.byType(Expanded).at(0), + matching: find.byType(Text), + ) + .first; + + final optionTitleWidget = tester.firstWidget(optionTitleFinder) as Text; + + expect( + optionTitleWidget.style, + Theme.of(navigationService.navigatorKey.currentContext!) + .textTheme + .headlineSmall! + .copyWith(fontSize: 18, color: Colors.black), + ); + + // Testing TextStyle that contains option's subtitle + // final optionSubtitleFinder = find + // .descendant( + // of: find.byType(Expanded).at(0), + // matching: find.byType(Text), + // ) + // .at(0); + + // final optionSubtitleWidget = + // tester.firstWidget(optionSubtitleFinder) as Text; + + // expect( + // optionSubtitleWidget.style, + // Theme.of(navigationService.navigatorKey.currentContext!) + // .textTheme + // .titleLarge?.copyWith(fontSize: 18, color: Colors.black,), + // ); + + // Test for checking if trailing icon button is shown + expect(find.byIcon(Icons.send), findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/widgets/custom_progress_dialog_test.dart b/test/widget_tests/widgets/custom_progress_dialog_test.dart new file mode 100644 index 000000000..f26930234 --- /dev/null +++ b/test/widget_tests/widgets/custom_progress_dialog_test.dart @@ -0,0 +1,60 @@ +// 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:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; + +import '../../helpers/test_helpers.dart'; + +Widget createCustomProgressDialog() { + return MaterialApp( + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + home: const Scaffold( + body: SingleChildScrollView( + child: CustomProgressDialog( + key: Key('testing'), + ), + ), + ), + ); +} + +void main() { + SizeConfig().test(); + + setUp(() { + registerServices(); + registerViewModels(); + }); + + tearDown(() async { + unregisterViewModels(); + unregisterServices(); + }); + group('Test for CustomProgressDialog', () { + testWidgets( + 'Check if CustomProgressDialog widget shows up when connection available', + (tester) async { + // Build the widget + await tester.pumpWidget(createCustomProgressDialog()); + await tester.pump(); + await tester.pump(); + + expect(find.byType(CupertinoActivityIndicator), findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/widgets/date_time_picker_test.dart b/test/widget_tests/widgets/date_time_picker_test.dart new file mode 100644 index 000000000..584e7b855 --- /dev/null +++ b/test/widget_tests/widgets/date_time_picker_test.dart @@ -0,0 +1,117 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/widgets/date_time_picker.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +final chooseDate = DateTime(2020, 04, 03); +final cancelDate = DateTime(2017, 11, 16); +late DateTime testDate; + +const chooseTime = TimeOfDay(hour: 10, minute: 10); +const cancelTime = TimeOfDay(hour: 5, minute: 5); +late TimeOfDay testTime; + +Widget dateTimePicker({required dynamic checkProp, bool isTimeType = false}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + home: Scaffold( + body: Center( + child: ElevatedButton( + onPressed: () async { + if (isTimeType) { + testTime = + await customTimePicker(initialTime: checkProp as TimeOfDay); + } else { + testDate = + await customDatePicker(initialDate: checkProp as DateTime); + } + }, + child: const Text('Open'), + ), + ), + ), + ); +} + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + registerServices(); + + group('TimePicker tests', () { + testWidgets('Check if time picker shows up', (tester) async { + await tester.pumpWidget( + dateTimePicker(checkProp: TimeOfDay.now(), isTimeType: true), + ); + + await tester.tap(find.text('Open')); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TimePickerDialog), findsOneWidget); + }); + + testWidgets('Check if selecting a time works', (tester) async { + await tester + .pumpWidget(dateTimePicker(checkProp: chooseTime, isTimeType: true)); + + await tester.tap(find.text('Open')); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); + await tester.tap(find.textContaining('OK')); + + expect(testTime, chooseTime); + }); + + testWidgets('Check if cancelling the time picker works', (tester) async { + await tester + .pumpWidget(dateTimePicker(checkProp: cancelTime, isTimeType: true)); + await tester.ensureVisible(find.text('Open')); + await tester.tap(find.text('Open')); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); + await tester.tap(find.textContaining('Cancel')); + + expect(testTime, cancelTime); + }); + }); + + group('DatePicker tests', () { + testWidgets('Check if date picker shows up', (tester) async { + await tester.pumpWidget(dateTimePicker(checkProp: DateTime.now())); + + await tester.tap(find.text('Open')); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(DatePickerDialog), findsOneWidget); + }); + + testWidgets('Check if selecting a date works', (tester) async { + await tester.pumpWidget(dateTimePicker(checkProp: chooseDate)); + + await tester.tap(find.text('Open')); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); + await tester.tap(find.textContaining('OK')); + + expect(testDate, chooseDate); + }); + + testWidgets('Check if cancelling the date picker works', (tester) async { + await tester.pumpWidget(dateTimePicker(checkProp: cancelDate)); + + await tester.tap(find.text('Open')); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); + await tester.tap(find.textContaining('Cancel')); + + expect(testDate, cancelDate); + }); + }); +} diff --git a/test/widget_tests/widgets/event_card_test.dart b/test/widget_tests/widgets/event_card_test.dart new file mode 100644 index 000000000..b71c68ca1 --- /dev/null +++ b/test/widget_tests/widgets/event_card_test.dart @@ -0,0 +1,217 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail_image_network/mocktail_image_network.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/user/user_info.dart'; + +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/event_card.dart'; + +import '../../helpers/test_locator.dart'; + +Event getEvent({bool? isRegistered, bool isPublic = false}) { + return Event( + title: "Testing", + location: "PyasePyasePyasePyasePyasePyase", + description: "Testing for the Event Card Widget", + startDate: "13 Dec", + endDate: "13 Dec", + startTime: "07:10PM", + endTime: "08:15PM", + isPublic: isPublic, + isRegistered: isRegistered, + attendees: [Attendee(id: "attendee1")], + creator: User(id: "ravidi"), + ); +} + +Widget createCustomEventCard( + Event event, { + bool isSearchItem = false, + String? eventTitleHighlightedText, +}) { + return MaterialApp( + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: EventCard( + key: const Key('event_card'), + event: event, + isSearchItem: isSearchItem, + eventTitleHighlightedText: eventTitleHighlightedText, + ), + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + }); + + group("Test for EventCard widget", () { + testWidgets('Check if Event Card shows up', (tester) async { + mockNetworkImages(() async { + expect(find.byType(EventCard), findsNothing); + + await tester.pumpWidget(createCustomEventCard(getEvent())); + await tester.pump(); + + expect(find.byType(EventCard), findsOneWidget); + }); + }); + + testWidgets('Check for child(ren)', (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget(createCustomEventCard(getEvent())); + await tester.pump(); + + expect( + find.descendant( + of: find.byType(EventCard), + matching: find.descendant( + of: find.byType(Padding), + matching: find.byType(Stack), + ), + ), + findsOneWidget, + ); + + expect( + find.descendant( + of: find.byType(Stack), + matching: find.byType(Card), + ), + findsOneWidget, + ); + + expect( + find.descendant( + of: find.byType(Stack), + matching: find.byType(Positioned), + ), + findsOneWidget, + ); + }); + }); + + testWidgets('Check for conditional widgets - false', (tester) async { + mockNetworkImages(() async { + const eventTitleHighlightedText = "ravidi"; + const eventTitle = "Testing"; + + await tester.pumpWidget( + createCustomEventCard( + getEvent(), + isSearchItem: false, + eventTitleHighlightedText: eventTitleHighlightedText, + ), + ); + await tester.pump(); + + expect( + find.descendant( + of: find.byType(Positioned), + matching: find.byType(DecoratedBox), + ), + findsNothing, + ); + expect(find.text("Registered"), findsNothing); + + expect( + find.text(eventTitleHighlightedText, findRichText: true), + findsNothing, + ); + expect(find.text(eventTitle), findsOneWidget); + expect(find.text('public'), findsNothing); + expect(find.text('private'), findsOneWidget); + }); + }); + + testWidgets('Check for conditional widgets - true', (tester) async { + mockNetworkImages(() async { + const eventTitleHighlightedText = "ravidi"; + const eventTitle = "Testing"; + + await tester.pumpWidget( + createCustomEventCard( + getEvent(isRegistered: true, isPublic: true), + isSearchItem: true, + eventTitleHighlightedText: eventTitleHighlightedText, + ), + ); + await tester.pump(); + + expect( + find.descendant( + of: find.byType(Positioned), + matching: find.byType(DecoratedBox), + ), + findsOneWidget, + ); + expect(find.text("Registered"), findsOneWidget); + + expect( + find.text(eventTitleHighlightedText, findRichText: true), + findsOneWidget, + ); + expect(find.text(eventTitle), findsNothing); + expect(find.text('public'), findsOneWidget); + expect(find.text('private'), findsNothing); + }); + }); + + testWidgets('Check for texts', (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget(createCustomEventCard(getEvent())); + await tester.pump(); + + expect(find.text("13 Dec - 13 Dec"), findsOneWidget); // duration date + expect(find.text("07:10PM - 08:15PM"), findsOneWidget); // duration time + expect( + find.text("PyasePyasePyasePyase"), + findsOneWidget, + ); // trimmed location + expect( + find.text("Testing for the Event Card Widget"), + findsOneWidget, + ); // event description + expect(find.text("1"), findsOneWidget); + }); + }); + + testWidgets('check for created text', (tester) async { + mockNetworkImages(() async { + const eventTitleHighlightedText = "ravidi"; + userConfig.currentUser.id = "ravidi"; + await tester.pumpWidget( + createCustomEventCard( + getEvent(isRegistered: true, isPublic: true), + isSearchItem: false, + eventTitleHighlightedText: eventTitleHighlightedText, + ), + ); + await tester.pump(); + expect(find.text("Created"), findsOneWidget); + expect(find.byIcon(Icons.verified), findsOneWidget); + expect(find.byType(SizedBox), findsWidgets); + }); + }); + }); +} diff --git a/test/widget_tests/widgets/event_date_time_tile_test.dart b/test/widget_tests/widgets/event_date_time_tile_test.dart new file mode 100644 index 000000000..41f22175b --- /dev/null +++ b/test/widget_tests/widgets/event_date_time_tile_test.dart @@ -0,0 +1,173 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/widgets/event_date_time_tile.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +/// Instance of callback function. +class MockCallbackFunction extends Mock { + /// Callback function. + /// + /// **params**: + /// None + /// + /// **returns**: + /// None + void call(); +} + +/// A callback function to set date. +final setDateCallback = MockCallbackFunction(); + +/// A callback function to set time. +final setTimeCallback = MockCallbackFunction(); + +/// Creates a widget for testing. +/// +/// **params**: +/// None +/// +/// **returns**: +/// * `Widget`: Returns mocked Material App Widget +Widget createWidget() { + return MaterialApp( + home: Scaffold( + body: DateTimeTile( + isAllDay: false, + date: "fakeDate", + time: "fakeTime", + setDate: setDateCallback, + setTime: setTimeCallback, + ), + ), + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + }); + + setUp(() { + registerServices(); + locator().test(); + }); + + tearDown(() { + unregisterServices(); + }); + + group('Tests for DateTimeTile widget', () { + testWidgets('Checking if the widget shows up', (tester) async { + await tester.pumpWidget(createWidget()); + expect(find.byType(Container), findsWidgets); + }); + + testWidgets("Checking padding", (tester) async { + await tester.pumpWidget(createWidget()); + + final paddingFinder = find.byType(Padding); + final padding = tester.firstWidget(paddingFinder); + + expect(paddingFinder, findsOneWidget); + expect( + (padding as Padding).padding, + EdgeInsets.symmetric(horizontal: SizeConfig.screenWidth! * 0.083), + ); + }); + + testWidgets("Checking tap Inkwell for setDate", (tester) async { + await tester.pumpWidget(createWidget()); + + final inkwellFinder = find.byType(InkWell).first; + + await tester.tap(inkwellFinder); + await tester.pump(); + + expect(inkwellFinder, findsOneWidget); + + verify(setDateCallback()); + }); + + testWidgets("Checking tap Inkwell for setTime", (tester) async { + await tester.pumpWidget(createWidget()); + + final inkwellFinder = find.byType(InkWell).last; + + await tester.tap(inkwellFinder); + await tester.pump(); + + expect(inkwellFinder, findsOneWidget); + + verify(setTimeCallback()); + }); + + testWidgets("Testing the icons", (tester) async { + await tester.pumpWidget(createWidget()); + + final iconFinder = find.byType(Icon); + final icon = tester.firstWidget(iconFinder); + + expect( + (icon as Icon).color, + const Color(0xff524F4F), + ); + expect( + icon.size, + 19, + ); + expect( + icon.icon, + Icons.calendar_today, + ); + + final iconFinder2 = find.byType(Icon).last; + final icon2 = tester.firstWidget(iconFinder2); + + expect( + (icon2 as Icon).color, + const Color(0xff524F4F), + ); + expect( + icon2.size, + 19, + ); + expect( + icon2.icon, + Icons.schedule, + ); + }); + + testWidgets("Testing text widgets", (tester) async { + await tester.pumpWidget(createWidget()); + final textFinder = find.byType(Text).first; + final text = tester.firstWidget(textFinder); + + expect( + (text as Text).data, + "fakeDate", + ); + expect( + text.style, + const TextStyle(fontSize: 16), + ); + + final textFinder2 = find.byType(Text).last; + final text2 = tester.firstWidget(textFinder2); + + expect( + (text2 as Text).data, + "fakeTime", + ); + expect( + text2.style, + const TextStyle(fontSize: 16), + ); + }); + }); +} diff --git a/test/widget_tests/widgets/event_search_delegate_test.dart b/test/widget_tests/widgets/event_search_delegate_test.dart new file mode 100644 index 000000000..bd9ec2a6c --- /dev/null +++ b/test/widget_tests/widgets/event_search_delegate_test.dart @@ -0,0 +1,322 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:hive/hive.dart'; +import 'package:network_image_mock/network_image_mock.dart'; +import 'package:talawa/constants/constants.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/events/event_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/event_service.dart'; +import 'package:talawa/services/navigation_service.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'; +import 'package:talawa/views/after_auth_screens/events/event_info_page.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/event_card.dart'; +import 'package:talawa/widgets/event_search_delegate.dart'; + +import '../../helpers/test_helpers.dart'; + +Widget createEventSearch() { + return MaterialApp( + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + home: Scaffold( + body: BaseView( + onModelReady: (model) => model.initialise(), + builder: (context, model, child) { + return IconButton( + onPressed: () { + showSearch( + context: context, + delegate: EventSearch( + eventList: model.events, + exploreEventsViewModel: model, + ), + ); + }, + icon: const Icon(Icons.search), + ); + }, + ), + ), + ); +} + +final List cachedEvents = [ + Event( + id: "event001", + title: "Annual Tech Conference", + description: + "A conference where tech enthusiasts gather to discuss the latest trends.", + location: "Tech Park, Silicon Valley", + recurring: false, + allDay: true, + startDate: "2024-09-10", + endDate: "2024-09-10", + startTime: "09:00 AM", + endTime: "05:00 PM", + isPublic: true, + isRegistered: false, + isRegisterable: true, + creator: User(id: "user123", firstName: "Alice Johnson"), + organization: OrgInfo(id: userConfig.currentOrg.id, name: "Tech Community"), + admins: [ + User(id: "admin001", firstName: "Bob", lastName: "Smith"), + User(id: "admin002", firstName: "Carol", lastName: "Lee"), + ], + attendees: [ + Attendee( + id: "attendee001", + firstName: "David", + lastName: "Brown", + image: "https://example.com/david.jpg", + ), + Attendee( + id: "attendee002", + firstName: "Eve", + lastName: "White", + image: "https://example.com/eve.jpg", + ), + ], + ), + Event( + id: "event002", + title: "Community Cleanup", + description: + "Join us for a community-wide effort to clean up our local park.", + location: "Central Park", + recurring: true, + allDay: false, + startDate: "2024-08-25", + endDate: "2024-08-25", + startTime: "08:00 AM", + endTime: "12:00 PM", + isPublic: true, + isRegistered: true, + isRegisterable: true, + creator: User(id: "user124", firstName: "John Doe"), + organization: OrgInfo(id: userConfig.currentOrg.id, name: "Green Earth"), + admins: [ + User(id: "admin003", firstName: "Sam", lastName: "Green"), + ], + attendees: [ + Attendee( + id: "attendee003", + firstName: "Paul", + lastName: "Black", + image: "https://example.com/paul.jpg", + ), + ], + ), + Event( + id: "event003", + title: "Coding Workshop", + description: "A hands-on workshop to improve coding skills.", + location: "TechHub, Downtown", + recurring: false, + allDay: false, + startDate: "2024-09-15", + endDate: "2024-09-15", + startTime: "10:00 AM", + endTime: "04:00 PM", + isPublic: false, + isRegistered: false, + isRegisterable: false, + creator: User(id: "user125", firstName: "Micheal Young"), + organization: OrgInfo(id: userConfig.currentOrg.id, name: "Code Masters"), + admins: [ + User(id: "admin004", firstName: "Sara", lastName: "Blue"), + ], + attendees: [], + ), + Event( + id: "event004", + title: "Startup Pitch Day", + description: "Pitch your startup ideas to investors and get feedback.", + location: "Innovation Hub", + recurring: false, + allDay: false, + startDate: "2024-10-05", + endDate: "2024-10-05", + startTime: "11:00 AM", + endTime: "03:00 PM", + isPublic: false, + isRegistered: true, + isRegisterable: true, + creator: User(id: "user126", firstName: "Emma Davis"), + organization: + OrgInfo(id: userConfig.currentOrg.id, name: "Startup Network"), + admins: [ + User(id: "admin005", firstName: "Jake", lastName: 'Wilson'), + User(id: "admin006", firstName: "Nina", lastName: 'Harris'), + ], + attendees: [ + Attendee( + id: "attendee004", + firstName: "Chris", + lastName: "Miller", + image: "https://example.com/chris.jpg", + ), + ], + ), +]; + +void main() { + SizeConfig().test(); + + setUpAll(() { + registerServices(); + registerViewModels(); + locator.unregister(); + locator.registerSingleton(EventService()); + final eventsBox = Hive.box(HiveKeys.eventFeedKey); + eventsBox.addAll(cachedEvents); + }); + + tearDownAll(() { + final eventsBox = Hive.box(HiveKeys.eventFeedKey); + eventsBox.clear(); + unregisterViewModels(); + unregisterServices(); + }); + + group('Test for EventSearch Delegate', () { + testWidgets('Check if EventSearch shows up', (tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createEventSearch()); + await tester.pump(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + expect(find.byIcon(Icons.arrow_back), findsOneWidget); + expect(find.byIcon(Icons.clear), findsOneWidget); + expect(find.byType(TextField), findsOneWidget); + expect(find.byType(EventCard), findsNWidgets(4)); + }); + }); + testWidgets('Check if back button works fine', (tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createEventSearch()); + await tester.pump(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + final x = find.descendant( + of: find.byType(AppBar), + matching: find.byType(IconButton), + ); + await tester.tap(x.first); + await tester.pumpAndSettle(); + + expect(find.byIcon(Icons.arrow_back), findsNothing); + }); + }); + + testWidgets('Check if typing in textfield works', (tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createEventSearch()); + await tester.pump(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + final textfield = find.byType(TextField); + await tester.enterText(textfield, 'Coding'); + await tester.pumpAndSettle(); + + expect(find.byType(EventCard), findsOneWidget); + + await tester.enterText(textfield, 'teste'); + await tester.pumpAndSettle(); + + expect(find.byType(EventCard), findsNothing); + }); + }); + + testWidgets('Check if buildResult works', (tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createEventSearch()); + await tester.pump(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + final textfield = find.byType(TextField); + await tester.enterText(textfield, 'Coding'); + await tester.pumpAndSettle(); + + await tester.showKeyboard(textfield); + await tester.pump(); + + await tester.testTextInput.receiveAction(TextInputAction.send); + await tester.pump(); + + expect(find.byType(EventCard), findsOneWidget); + + await tester.enterText(textfield, 'teste'); + await tester.pumpAndSettle(); + + expect(find.byType(EventCard), findsNothing); + }); + }); + testWidgets('Check if clear button works fine', (tester) async { + mockNetworkImagesFor(() async { + await tester.pumpWidget(createEventSearch()); + await tester.pump(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + final x = find.descendant( + of: find.byType(AppBar), + matching: find.byType(IconButton), + ); + + final textfield = find.byType(TextField); + await tester.enterText(textfield, 'test'); + await tester.pumpAndSettle(); + + await tester.tap(x.last); + await tester.pumpAndSettle(); + final textWidget = tester.firstWidget(textfield); + expect((textWidget as TextField).controller!.text, ''); + + await tester.tap(x.last); + await tester.pumpAndSettle(); + expect(find.byIcon(Icons.clear), findsNothing); + }); + }); + + testWidgets('Check if tapping on event card works', (tester) async { + mockNetworkImagesFor(() async { + locator.unregister(); + locator.registerSingleton(NavigationService()); + + await tester.pumpWidget(createEventSearch()); + await tester.pump(); + await tester.tap(find.byIcon(Icons.search)); + await tester.pumpAndSettle(); + + final textfield = find.byType(TextField); + await tester.enterText(textfield, 'Coding'); + await tester.pumpAndSettle(); + + final eventCardFinder = find.byType(EventCard); + await tester.tap(eventCardFinder); + await tester.pumpAndSettle(); + + expect(find.byType(EventInfoPage), findsOneWidget); + }); + }); + }); +} diff --git a/test/widget_tests/widgets/from_palisadoes_test.dart b/test/widget_tests/widgets/from_palisadoes_test.dart new file mode 100644 index 000000000..dc3f9efa2 --- /dev/null +++ b/test/widget_tests/widgets/from_palisadoes_test.dart @@ -0,0 +1,43 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/from_palisadoes.dart'; + +Widget createFromPalisadoes() { + return const MaterialApp( + localizationsDelegates: [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: FromPalisadoes(), + ), + ); +} + +void main() { + SizeConfig().test(); + group('Test for FromPalisadoes', () { + testWidgets('Check if FromPalisadoes widget shows up', (tester) async { + await tester.pumpWidget(createFromPalisadoes()); + await tester.pump(); + + expect(find.byType(Column), findsOneWidget); + }); + + testWidgets('Check if from Palisadoes text shows up', (tester) async { + await tester.pumpWidget(createFromPalisadoes()); + await tester.pump(); + + expect(find.byType(Text), findsNWidgets(2)); + expect(find.textContaining('from'), findsOneWidget); + expect(find.textContaining('PALISADOES'), findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/widgets/lang_switch_test.dart b/test/widget_tests/widgets/lang_switch_test.dart new file mode 100644 index 000000000..6140030b4 --- /dev/null +++ b/test/widget_tests/widgets/lang_switch_test.dart @@ -0,0 +1,61 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/router.dart' as router; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/views/pre_auth_screens/select_language.dart'; +import 'package:talawa/widgets/lang_switch.dart'; + +import '../../helpers/test_locator.dart'; + +Widget createLanguageTile() { + return BaseView( + onModelReady: (appLanguageModel) => appLanguageModel.initialize(), + builder: (_, __, ___) => MaterialApp( + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + navigatorKey: locator().navigatorKey, + onGenerateRoute: router.generateRoute, + home: const Scaffold( + body: LanguageTile(), + ), + ), + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + sizeConfig.test(); + }); + group('Test for LanguageTile', () { + testWidgets('Check if LanguageTile widget shows up', (tester) async { + await tester.pumpWidget(createLanguageTile()); + await tester.pump(); + + expect(find.byType(ListTile), findsOneWidget); + expect(find.byType(TextButton), findsOneWidget); + }); + + testWidgets('Tapping on TextButton pushes SelectLanguage widget', + (tester) async { + await tester.pumpWidget(createLanguageTile()); + await tester.pump(); + + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.byType(SelectLanguage), findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/widgets/member_name_tile_test.dart b/test/widget_tests/widgets/member_name_tile_test.dart new file mode 100644 index 000000000..21691f147 --- /dev/null +++ b/test/widget_tests/widgets/member_name_tile_test.dart @@ -0,0 +1,157 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:network_image_mock/network_image_mock.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/widgets/member_name_tile.dart'; + +bool isDeleted = false; + +void onDelete() { + isDeleted = true; +} + +Widget createMemberNameTile({String? userImage}) { + return MaterialApp( + theme: TalawaTheme.darkTheme, + home: Material( + child: MemberNameTile( + userName: 'ravidev', + userImage: userImage, + onDelete: onDelete, + ), + ), + ); +} + +void main() { + SizeConfig().test(); + + group('Tests for MemberNameTile widget', () { + testWidgets('Checking if the widget shows up', (tester) async { + await tester.pumpWidget(createMemberNameTile()); + + expect(find.byType(Padding), findsWidgets); + }); + + testWidgets('Checking for the child Container', (tester) async { + await tester.pumpWidget(createMemberNameTile()); + + final containerFinder = find.byType(Container).first; + final container = tester.firstWidget(find.byType(Container)); + + expect(containerFinder, findsOneWidget); + + expect( + (container as Container).decoration, + BoxDecoration( + borderRadius: BorderRadius.circular(SizeConfig.screenHeight! * 0.02), + color: TalawaTheme.darkTheme.colorScheme.primaryContainer, + ), + ); + }); + + testWidgets('Checking for the Row', (tester) async { + await tester.pumpWidget(createMemberNameTile()); + + final rowFinder = find.byType(Row); + final row = tester.firstWidget(rowFinder); + + expect(rowFinder, findsOneWidget); + + expect((row as Row).mainAxisAlignment, MainAxisAlignment.spaceBetween); + expect(row.crossAxisAlignment, CrossAxisAlignment.center); + + expect(row.children[0], isA()); + expect(row.children[1], isA()); + expect(row.children[2], isA()); + }); + + testWidgets('Checking for CircleAvatar (without image)', (tester) async { + await tester.pumpWidget(createMemberNameTile()); + + final circleAvatarFinder = find.byType(CircleAvatar); + final circleAvatar = tester.firstWidget(circleAvatarFinder); + expect(circleAvatarFinder, findsOneWidget); + + expect( + (circleAvatar as CircleAvatar).radius, + SizeConfig.screenHeight! * 0.0201, + ); + expect( + circleAvatar.backgroundColor, + TalawaTheme.darkTheme.colorScheme.secondary, + ); + expect( + circleAvatar.child, + isA().having( + (text) => text.style, + 'Checking text style', + const TextStyle(color: Colors.white), + ), + ); + + expect(find.textContaining('R'), findsOneWidget); + }); + + testWidgets('Checking for CircleAvatar (with image)', (tester) async { + const String userImage = 'https://www.example.org/non-existent.png'; + + // Mock NetworkImages for CircularAvatar + await mockNetworkImagesFor( + () => tester.pumpWidget( + createMemberNameTile(userImage: userImage), + ), + ); + + final circleAvatarFinder = find.byType(CircleAvatar); + final circleAvatar = tester.firstWidget(circleAvatarFinder); + + expect(circleAvatarFinder, findsOneWidget); + + expect( + (circleAvatar as CircleAvatar).radius, + SizeConfig.screenHeight! * 0.0201, + ); + expect( + circleAvatar.backgroundImage, + const NetworkImage(userImage), + ); + expect( + circleAvatar.backgroundColor, + null, + ); + expect( + circleAvatar.child, + null, + ); + + expect(find.textContaining('R'), findsNWidgets(0)); + }); + + testWidgets('Checking for the cancel button', (tester) async { + await tester.pumpWidget(createMemberNameTile()); + + final iconButtonFinder = find.byType(IconButton); + final iconButton = tester.firstWidget(iconButtonFinder); + + expect(iconButtonFinder, findsOneWidget); + + expect((iconButton as IconButton).padding, EdgeInsets.zero); + expect( + iconButton.icon, + isA() + .having((icon) => icon.color, 'color', const Color(0xff524F4F)) + .having((icon) => icon.size, 'size', 19), + ); + + expect(isDeleted, false); + await tester.tap(iconButtonFinder); + await tester.pump(); + expect(isDeleted, true); + }); + }); +} diff --git a/test/widget_tests/widgets/pinned_carousel_widget_test.dart b/test/widget_tests/widgets/pinned_carousel_widget_test.dart new file mode 100644 index 000000000..0bef6213f --- /dev/null +++ b/test/widget_tests/widgets/pinned_carousel_widget_test.dart @@ -0,0 +1,155 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/pinned_carousel_widget.dart'; + +import '../../helpers/test_locator.dart'; + +List pinnedPosts = [ + Post(sId: 'ravidi', creator: User(), description: 'henlo_boi_'), + Post(sId: 'ravidi', creator: User(), description: 'henlo_boi_' * 10), +]; + +Widget createPinnedCarouselWidget() { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: PinnedPostCarousel( + pinnedPosts: pinnedPosts, + navigateToPinnedPostPage: () { + navigationService.pushDialog( + const AlertDialog(), + ); + }, + navigateToIndividualPostPage: + () {}, // Since it's not used in the widget file anywhere, so no way of testing it. + ), + ), + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + SizeConfig().test(); + }); + group('Test for PinnedPostCarousel', () { + testWidgets('Check if the widget shows up', (tester) async { + await tester.pumpWidget(createPinnedCarouselWidget()); + await tester.pump(); + + expect(find.byType(PinnedPostCarousel), findsOneWidget); + }); + + testWidgets('Check for inner children', (tester) async { + await tester.pumpWidget(createPinnedCarouselWidget()); + await tester.pump(); + + expect( + find.byType(Row), + findsNWidgets(2), + ); // 1 from CustomCarouselScroller + expect( + find.byType(Expanded), + findsNWidgets(7), + ); // 4 from CustomCarouselScroller + expect(find.byType(GestureDetector), findsNWidgets(2)); + }); + + testWidgets('Check if texts show up', (tester) async { + await tester.pumpWidget(createPinnedCarouselWidget()); + await tester.pump(); + + expect(find.textContaining("See all Pinned news"), findsOneWidget); + expect(find.textContaining("henlo_boi_"), findsOneWidget); + + // TODO: uncomment when page view gets implemented + + // await tester.scrollUntilVisible(find.byType(PageView), 10); // Future reference + // await tester.pump(const Duration(seconds: 1)); // Future reference + // expect(find.textContaining("${'henlo_boi_' * 9}..."), findsOneWidget); // Future reference + }); + + testWidgets('Check if navigating to pinned post works', (tester) async { + await tester.pumpWidget(createPinnedCarouselWidget()); + await tester.pump(); + + expect(find.byType(AlertDialog), findsNothing); + + await tester.tap(find.byType(GestureDetector).last); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(AlertDialog), findsOneWidget); + }); + + testWidgets('Testing for different lengths of description Strings', + (tester) async { + await tester.pumpWidget(createPinnedCarouselWidget()); + await tester.pumpAndSettle(); + }); + testWidgets('PageView onPageChanged test', (tester) async { + await tester.pumpWidget(createPinnedCarouselWidget()); + await tester.pumpAndSettle(); + final customCarouselScroller = find.byType(CustomCarouselScroller); + final CustomCarouselScrollerState customCarouselScrollerState = + tester.state(customCarouselScroller); + expect( + pinnedPosts[customCarouselScrollerState.pindex].description!.length, + lessThanOrEqualTo(90), + ); + customCarouselScrollerState.controller.jumpToPage(1); + expect(customCarouselScrollerState.pindex, 1); + expect( + pinnedPosts[customCarouselScrollerState.pindex].description!.length, + greaterThan(90), + ); + }); + + testWidgets('Test the text displayed based on length of description', + (tester) async { + await tester.pumpWidget(createPinnedCarouselWidget()); + await tester.pumpAndSettle(); + final customCarouselScroller = find.byType(CustomCarouselScroller); + final CustomCarouselScrollerState customCarouselScrollerState = + tester.state(customCarouselScroller); + int currentPage = customCarouselScrollerState.pindex; + + expect(find.text(pinnedPosts[currentPage].description!), findsOneWidget); + customCarouselScrollerState.controller.jumpToPage(1); + await tester.pump(); + currentPage = customCarouselScrollerState.pindex; + expect( + find.text( + '${pinnedPosts[currentPage].description!.substring(0, 90)}...', + ), + findsOneWidget, + ); + }); + }); +} diff --git a/test/widget_tests/widgets/pinned_post_test.dart b/test/widget_tests/widgets/pinned_post_test.dart new file mode 100644 index 000000000..96684df0a --- /dev/null +++ b/test/widget_tests/widgets/pinned_post_test.dart @@ -0,0 +1,244 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/views/after_auth_screens/feed/pinned_post_screen.dart'; +import 'package:talawa/widgets/pinned_post.dart'; +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +/// List of pinned posts. +/// +///This file contains demo data for pinned posts. It contains a list of type Map and sample data. +const pinnedPostsDemoData = [ + { + "_id": "1", + "text": "church meeting", + "createdAt": "2023-03-15T15:28:52.122Z", + "imageUrl": + "https://imgs.search.brave.com/OHazbRf4oO5wuydAbr6061fUGuEw-rlDB1SuXWnJgTo/rs:fit:500:0:0/g:ce/aHR0cHM6Ly9pLnBp/bmltZy5jb20vb3Jp/Z2luYWxzLzZiLzIy/L2JhLzZiMjJiYTg2/Yzk3NjBiMzQ4YjNh/NTMzOGFjMzI4ZmJm/LmpwZw", + "creator": { + "firstName": "Rutvik", + "lastName": "Chandla", + "id": "asdasdasd", + }, + "likedBy": [ + {"firstName": "User", "lastName": "1", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "2", "id": "asdasdasdas"}, + {"firstName": "User", "lastName": "3", "id": "asdasdasdas"}, + ], + "comments": [ + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + { + "text": "This is the posted comment", + "creator": {"firstName": "User", "lastName": "4", "id": "asdasdasdas"}, + }, + ], + }, +]; + +///List of pinned post. +List _pinnedPosts = + pinnedPostsDemoData.map((e) => Post.fromJson(e)).toList(); + +/// getter for pinned post. +/// +/// **params**: + +List get pinnedPosts { + return _pinnedPosts; +} + +/// main function. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + registerServices(); + locator().test(); + }); + tearDownAll(() { + unregisterServices(); + }); + + testWidgets('If container is coming on calling pinnedwidget', + (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost( + pinnedPost: pinnedPosts, + model: mainScreenViewModel, + ), + ), + ); + await widgetTester.pump(const Duration(seconds: 5)); + expect(find.byKey(const Key('hello')), findsOneWidget); + }); + + testWidgets('Text widget is present when there are pinned posts', + (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost( + pinnedPost: pinnedPosts, + model: mainScreenViewModel, + ), + ), + ); + await widgetTester.pump(const Duration(seconds: 5)); + expect(find.byType(Text), findsWidgets); + }); + + testWidgets('Text widget displays the correct text', (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost( + pinnedPost: pinnedPosts, + model: mainScreenViewModel, + ), + ), + ); + await widgetTester.pump(const Duration(seconds: 5)); + expect(find.text('church meeting'), findsOneWidget); + }); + + testWidgets('Tapping on a post triggers navigation', (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost( + pinnedPost: pinnedPosts, + model: mainScreenViewModel, + ), + ), + ); + await widgetTester.pump(const Duration(seconds: 5)); + + await widgetTester.tap(find.byType(GestureDetector)); + await widgetTester.pumpAndSettle(); + expect(find.byType(PinnedPost), findsNothing); + expect(find.byType(PinnedPostScreen), findsOneWidget); + }); + + testWidgets('Container comes if list is empty', (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost(pinnedPost: [], model: mainScreenViewModel), + ), + ); + await widgetTester.pump(); + expect(find.byKey(const Key('hi')), findsOneWidget); + }); + testWidgets('Error widget is displayed when image fails to load', + (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost( + pinnedPost: pinnedPosts, + model: mainScreenViewModel, + ), + ), + ); + await widgetTester.pump(const Duration(seconds: 5)); + + expect( + find.byWidgetPredicate( + (widget) => widget is CachedNetworkImage && widget.errorWidget != null, + ), + findsOneWidget, + ); + }); + + testWidgets('CircularProgressIndicator is shown when image fails to load', + (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost( + pinnedPost: pinnedPosts, + model: mainScreenViewModel, + ), + ), + ); + + await widgetTester.pump(const Duration(seconds: 5)); + + expect( + find.byWidgetPredicate( + (widget) => + widget is CachedNetworkImage && + widget.errorWidget != null && + widget.errorWidget is Function && + widget.errorWidget!( + widgetTester.binding.rootElement!, + '', + Exception(), + ) is SizedBox, + ), + findsOneWidget, + ); + }); + testWidgets('CachedNetworkImage displays correct image', + (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost( + pinnedPost: pinnedPosts, + model: mainScreenViewModel, + ), + ), + ); + await widgetTester.pump(const Duration(seconds: 5)); + + expect( + find.byWidgetPredicate( + (widget) => + widget is CachedNetworkImage && + widget.imageUrl == pinnedPosts[0].imageUrl, + ), + findsOneWidget, + ); + }); + + testWidgets('CachedNetworkImage displays correct image', + (widgetTester) async { + await widgetTester.pumpWidget( + MaterialApp( + home: PinnedPost( + pinnedPost: pinnedPosts, + model: mainScreenViewModel, + ), + ), + ); + await widgetTester.pump(const Duration(seconds: 5)); + + final imageWidget = find.byWidgetPredicate( + (widget) => + widget is CachedNetworkImage && + widget.imageUrl == pinnedPosts[0].imageUrl, + ); + + expect(imageWidget, findsOneWidget); + }); +} diff --git a/test/widget_tests/widgets/post_container_test.dart b/test/widget_tests/widgets/post_container_test.dart new file mode 100644 index 000000000..af78704cc --- /dev/null +++ b/test/widget_tests/widgets/post_container_test.dart @@ -0,0 +1,155 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail_image_network/mocktail_image_network.dart'; +import 'package:talawa/widgets/post_container.dart'; + +/// main function. +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() { + group('PostContainer Widget Tests', () { + testWidgets('PostContainer should be built without crashing', + (WidgetTester tester) async { + await tester.runAsync(() async { + await mockNetworkImages(() async { + await tester.pumpWidget( + const MaterialApp( + home: PostContainer( + photoUrl: + 'https://www.fcbarcelona.com/fcbarcelona/photo/2022/08/02/ae5252d1-b79b-4950-9e34-6e67fac09bb0/LeoMessi20092010_pic_fcb-arsenal62.jpg', + ), + ), + ); + }); + + expect(find.byType(PostContainer), findsOneWidget); + }); + }); + testWidgets( + 'PostContainer should display an image when photoUrl is provided', + (tester) async { + await mockNetworkImages( + () async => tester.pumpWidget( + const MaterialApp( + home: PostContainer( + photoUrl: + 'https://www.fcbarcelona.com/fcbarcelona/photo/2022/08/02/ae5252d1-b79b-4950-9e34-6e67fac09bb0/LeoMessi20092010_pic_fcb-arsenal62.jpg', + ), + ), + ), + ); + + expect(find.byType(Image), findsOneWidget); + }); + + testWidgets( + 'PostContainer should not display an image when photoUrl is null', + (tester) async { + await tester.pumpWidget( + const MaterialApp( + home: PostContainer(photoUrl: null), + ), + ); + expect(find.byType(Image), findsNothing); + expect(find.byType(Container), findsOneWidget); + }); + + testWidgets( + 'initState should be called and variables should be initialized correctly', + (WidgetTester tester) async { + await tester.runAsync(() async { + await mockNetworkImages(() async { + await tester.pumpWidget( + const MaterialApp( + home: PostContainer( + photoUrl: + 'https://www.fcbarcelona.com/fcbarcelona/photo/2022/08/02/ae5252d1-b79b-4950-9e34-6e67fac09bb0/LeoMessi20092010_pic_fcb-arsenal62.jpg', + ), + ), + ); + }); + final postContainerState = + tester.state(find.byType(PostContainer)); + expect(postContainerState.startedPlaying, isFalse); + expect(postContainerState.inView, isTrue); + expect(find.byType(PostContainer), findsOneWidget); + }); + }); + + testWidgets( + 'PageController should be disposed when widget is removed from tree', + (WidgetTester tester) async { + await tester.runAsync(() async { + await mockNetworkImages(() async { + await tester.pumpWidget( + const MaterialApp( + home: PostContainer( + photoUrl: + 'https://www.fcbarcelona.com/fcbarcelona/photo/2022/08/02/ae5252d1-b79b-4950-9e34-6e67fac09bb0/LeoMessi20092010_pic_fcb-arsenal62.jpg', + ), + ), + ); + }); + final postContainerState = + tester.state(find.byType(PostContainer)); + final pageController = postContainerState.controller; + + await tester.pumpWidget( + MaterialApp(home: Container()), + ); + + try { + pageController.position; + fail('Should throw AssertionError'); + } catch (e) { + expect(e, isInstanceOf()); + } + }); + }); + + testWidgets('PostContainer should change inView to true when visible', + (WidgetTester tester) async { + await tester.runAsync(() async { + await mockNetworkImages(() async { + await tester.pumpWidget( + const MaterialApp( + home: PostContainer( + photoUrl: + 'https://www.fcbarcelona.com/fcbarcelona/photo/2022/08/02/ae5252d1-b79b-4950-9e34-6e67fac09bb0/LeoMessi20092010_pic_fcb-arsenal62.jpg', + ), + ), + ); + }); + + final postContainerState = + tester.state(find.byType(PostContainer)); + expect(postContainerState.inView, isTrue); + }); + }); + + testWidgets('PostContainer should change inView to false when not visible', + (WidgetTester tester) async { + await tester.runAsync(() async { + await mockNetworkImages(() async { + await tester.pumpWidget( + const MaterialApp( + home: PostContainer( + photoUrl: + 'https://www.fcbarcelona.com/fcbarcelona/photo/2022/08/02/ae5252d1-b79b-4950-9e34-6e67fac09bb0/LeoMessi20092010_pic_fcb-arsenal62.jpg', + ), + ), + ); + }); + + final postContainerState = + tester.state(find.byType(PostContainer)); + postContainerState.inView = false; + expect(postContainerState.inView, isFalse); + }); + }); + }); +} diff --git a/test/widget_tests/widgets/post_detailed_page_test.dart b/test/widget_tests/widgets/post_detailed_page_test.dart new file mode 100644 index 000000000..772298d02 --- /dev/null +++ b/test/widget_tests/widgets/post_detailed_page_test.dart @@ -0,0 +1,238 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/post_detailed_page.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +const longString = + 'iloveicecreamiloveicecreamiloveicecreamiloveicecreamiloveicecreamiloveicecreamiloveicecreamiloveicecreamiloveicecreamiloveicecreamiloveicecreamil888890'; +const shortString = 'I love ice-cream'; +const tagString = 'I love ice-cream #icecream'; +const multiTagString = 'I love ice-cream #icec#ream'; +Widget createDescriptionTextWidgetWithShortText() { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const Scaffold( + body: DescriptionTextWidget( + text: shortString, + ), + ), + ); +} + +Widget createDescriptionTextWidgetWithLongText() { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const Scaffold( + body: DescriptionTextWidget( + text: longString, + ), + ), + ); +} + +Widget createDescriptionTextWidgetWithTag() { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const Scaffold( + body: DescriptionTextWidget( + text: tagString, + ), + ), + ); +} + +Widget createDescriptionTextWidgetWithMultiTag() { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const Scaffold( + body: DescriptionTextWidget( + text: multiTagString, + ), + ), + ); +} + +void main() { + SizeConfig().test(); + locator.registerSingleton(NavigationService()); + + setUp(() { + registerServices(); + registerViewModels(); + }); + + tearDown(() { + unregisterViewModels(); + unregisterServices(); + }); + group('Description Widget test', () { + testWidgets( + "Test if Description text Widget is displayed with text less than 150", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithShortText()); + await tester.pump(); + expect(find.byType(DescriptionTextWidget), findsOneWidget); + }); + }); + testWidgets( + "Test if Description text Widget is displayed with text more than 150", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithLongText()); + await tester.pump(); + expect(find.byType(DescriptionTextWidget), findsOneWidget); + }); + }); + testWidgets( + "Test if Description text Widget is displayed with text more than 150", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithTag()); + await tester.pump(); + expect(find.byType(DescriptionTextWidget), findsOneWidget); + }); + }); + testWidgets( + "Test if Description text Widget is displayed with text more than 150", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithMultiTag()); + await tester.pump(); + expect(find.byType(DescriptionTextWidget), findsOneWidget); + }); + }); + testWidgets("Test if 1 text Widget is displayed with text less than 150", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithShortText()); + await tester.pump(); + expect(find.byType(Text), findsNWidgets(1)); + }); + }); + + testWidgets("Test if 2 text Widget is displayed with text more than 150", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithLongText()); + await tester.pump(); + expect(find.byType(Text), findsNWidgets(2)); + }); + }); + + testWidgets( + "Test if text Widget display content properly with text more than 150", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithLongText()); + await tester.pump(); + expect(find.text('${longString.substring(0, 150)}...'), findsOneWidget); + }); + }); + + testWidgets("Test if show more button is working", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithLongText()); + await tester.pump(); + final showLessMore = find.byType(InkWell); + await tester.tap(showLessMore); + await tester.pump(); + //showing more + expect(find.text(longString), findsOneWidget); + }); + }); + testWidgets("Test if show less button is working", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createDescriptionTextWidgetWithLongText()); + await tester.pump(); + final showLessMore = find.byType(InkWell); + await tester.tap(showLessMore); + await tester.pump(); + + await tester.tap(showLessMore); + await tester.pump(); + //showing less + expect(find.text('${longString.substring(0, 150)}...'), findsOneWidget); + }); + }); + }); +} diff --git a/test/widget_tests/widgets/post_list_widget_test.dart b/test/widget_tests/widgets/post_list_widget_test.dart new file mode 100644 index 000000000..2097168c6 --- /dev/null +++ b/test/widget_tests/widgets/post_list_widget_test.dart @@ -0,0 +1,81 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart'; +import 'package:talawa/widgets/post_list_widget.dart'; + +import '../../helpers/test_helpers.dart'; + +void main() { + const Key postListKey = Key("postListKey"); + + Widget createPostListWidget(List postlist) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + home: Scaffold( + body: PostListWidget( + posts: postlist, + key: postListKey, + ), + ), + ); + } + + group("Post List Widget Test-", () { + setUp(() { + registerServices(); + locator.registerFactory(() => LikeButtonViewModel()); + }); + + tearDown(() { + unregisterServices(); + locator.unregister(); + }); + + testWidgets("Test if PostList Widget is displayed ", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createPostListWidget([])); + await tester.pump(); + final postListFinder = find.byKey(postListKey); + expect(postListFinder, findsOneWidget); + }); + }); + + testWidgets("Test if PostList Widget is not scrollable", + (WidgetTester tester) async { + final mockPost1 = getPostMockModel(description: "MockPost1"); + final mockPost2 = getPostMockModel(description: "MockPost2"); + + final List postList = [mockPost1, mockPost2]; + //Extremely large screen to test if scrolling takes place + + // ignore: deprecated_member_use + tester.binding.window.physicalSizeTestValue = const Size(100000, 100000); + await tester.runAsync(() async { + await tester.pumpWidget(createPostListWidget(postList)); + await tester.pump(); + //Attempt to scroll + + // await tester.drag(find.byType(ListView), const Offset(0, -800)); + // await tester.pump(); + // First post in list should still be visible as scrolling is disabled + expect(find.text(mockPost1.description!), findsOneWidget); + }); + }); + }); +} diff --git a/test/widget_tests/widgets/post_modal_test.dart b/test/widget_tests/widgets/post_modal_test.dart new file mode 100644 index 000000000..d2c6ebf81 --- /dev/null +++ b/test/widget_tests/widgets/post_modal_test.dart @@ -0,0 +1,197 @@ +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:talawa/enums/enums.dart'; +import 'package:talawa/models/comment/comment_model.dart'; +import 'package:talawa/models/organization/org_info.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/models/user/user_info.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/lang_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/post_modal.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +//Mock classes +class MockFunction extends Mock { + void call(Post post); +} + +class MockNavigationService extends Mock implements NavigationService {} + +//test data +final MockFunction mockDeletePost = MockFunction(); +final LikedBy user = LikedBy(sId: "test_id"); + +//fake user data +final u1 = User( + id: '123', + firstName: 'Lakshay', + lastName: 'Gupta', + email: 'test@test.com', +); +final u2 = User( + id: '123', + firstName: 'Ankit', + lastName: 'Varshney', + email: 'test@test.com', +); +final List users = [u1, u2]; + +List comments = [ + Comments(sId: 'comment1'), + Comments(sId: 'comment2'), + Comments(sId: 'comment3'), + Comments(sId: 'comment4'), + Comments(sId: 'comment5'), + Comments(sId: 'comment6'), +]; + +//fake comment data +final comment = Comment( + creator: User( + id: '123', + firstName: 'Ankit', + lastName: 'Varshney', + email: 'test@test.com', + ), + createdAt: '123456', + text: 'test text', + post: 'test post', + likeCount: 'test count', +); + +final LikedBy l1 = LikedBy(sId: 'test1'); +final LikedBy l2 = LikedBy(sId: 'test2'); +final List likeby = [l1, l2]; + +final comment1 = Comments(sId: 'comment1'); +final comment2 = Comments(sId: 'comment2'); +final comment3 = Comments(sId: 'comment3'); +final List comments1 = [comment1, comment2, comment3]; + +final myBirthday = DateTime.utc(2004, DateTime.june, 16, 5, 30, 0, 0, 0); + +//fake post data +final post = Post( + creator: User( + id: '123', + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + ), + sId: "sid", + createdAt: myBirthday, + description: 'test description', + organization: OrgInfo(admins: users), + likedBy: likeby, + comments: comments1, +); + +Widget createPostBottomModal() { + return BaseView( + onModelReady: (model) => model.initialize(), + builder: (context, model, child) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: const [ + AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: PostBottomModal( + post: post, + deletePost: mockDeletePost, + ), + navigatorKey: navigationService.navigatorKey, + ); + }, + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + registerServices(); + }); + + tearDownAll(() => unregisterServices()); + + group('PostBottomModalTest -', () { + testWidgets('has a post widget', (tester) async { + await tester.pumpWidget(createPostBottomModal()); + await tester.pumpAndSettle(); + + // Verify the existence of PostBottomModal widget and reportPost button + expect(find.byType(PostBottomModal), findsOneWidget); + expect(find.byKey(const Key('reportPost')), findsOneWidget); + + // Tap the reportPost button and verify the behavior + await tester.tap(find.byKey(const Key('reportPost'))); + await tester.pumpAndSettle(); + + verify( + navigationService.showTalawaErrorSnackBar( + 'Your Report has been sent to the Admin', + MessageType.info, + ), + ).called(1); + }); + + testWidgets('Testing the delete Post button', (tester) async { + await tester.pumpWidget(createPostBottomModal()); + await tester.pumpAndSettle(); + + // Verify the existence of delete Post button + expect(find.byIcon(Icons.delete), findsOneWidget); + expect(find.byKey(const Key('deletePost')), findsOneWidget); + + // Tap the delete Post button and verify the behavior + await tester.tap(find.byKey(const Key('deletePost'))); + await tester.pumpAndSettle(); + + // verify(mockDeletePost.call(post)).called(1); + + // Verify the presence of AlertDialog and its elements + expect(find.byType(AlertDialog), findsOneWidget); + expect(find.byKey(const Key('alert_dialog_yes_btn')), findsOneWidget); + expect(find.text('The post was deleted'), findsOneWidget); + + // Tap the yes button in AlertDialog and verify the behavior + await tester.tap(find.byKey(const Key('alert_dialog_yes_btn'))); + await tester.pumpAndSettle(); + + verify( + navigationService.navigatorKey, + ).called(2); + }); + + testWidgets("Testing no button of alertDialogBox", (tester) async { + await tester.pumpWidget(createPostBottomModal()); + await tester.pumpAndSettle(); + + // Tap the delete Post button and verify the behavior + expect(find.byKey(const Key('deletePost')), findsOneWidget); + await tester.tap(find.byKey(const Key('deletePost'))); + await tester.pumpAndSettle(); + + // Verify the presence of AlertDialog and its no button + expect(find.byType(AlertDialog), findsOneWidget); + expect(find.byKey(const Key('alert_dialog_no_btn')), findsOneWidget); + + // Tap the no button in AlertDialog and verify the behavior + await tester.tap(find.byKey(const Key('alert_dialog_no_btn'))); + await tester.pumpAndSettle(); + + // Verify that AlertDialog is dismissed + expect(find.byType(AlertDialog), findsNothing); + }); + }); +} diff --git a/test/widget_tests/widgets/post_widget_test.dart b/test/widget_tests/widgets/post_widget_test.dart new file mode 100644 index 000000000..5064449a9 --- /dev/null +++ b/test/widget_tests/widgets/post_widget_test.dart @@ -0,0 +1,435 @@ +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:network_image_mock/network_image_mock.dart'; +import 'package:talawa/constants/custom_theme.dart'; +import 'package:talawa/locator.dart'; +import 'package:talawa/models/post/post_model.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart'; +import 'package:talawa/views/base_view.dart'; +import 'package:talawa/widgets/custom_avatar.dart'; +import 'package:talawa/widgets/multi_reaction.dart'; +import 'package:talawa/widgets/post_container.dart'; +import 'package:talawa/widgets/post_detailed_page.dart'; +import 'package:talawa/widgets/post_modal.dart'; +import 'package:talawa/widgets/post_widget.dart'; +// import 'package:talawa/widgets/video_widget.dart'; +// import 'package:visibility_detector/visibility_detector.dart'; + +import '../../helpers/test_helpers.dart'; + +/// Key for NewsPost widget. +const Key newsPostKey = Key("newsPostKey"); + +/// Key for PostContainer widget. +const Key postContainerKey = Key("postContainerKey"); + +/// [createNewsPostWidget] is a method that returns a NewsPost widget. +/// +/// **params**: +/// * `function`: Function(Post)? - function to be called when the post comment is clicked. +/// * `post`: Post object containing all the data related to the post. +/// +/// **returns**: +/// * `Widget`: NewsPost widget. +Widget createNewsPostWidget([Function(Post)? function, Post? post]) { + return MaterialApp( + locale: const Locale('en'), + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + themeMode: ThemeMode.light, + theme: TalawaTheme.lightTheme, + home: Scaffold( + body: NewsPost( + key: newsPostKey, + post: post ?? getPostMockModel(), + function: function, + ), + ), + ); +} + +void main() { + SizeConfig().test(); + locator.registerSingleton(NavigationService()); + + setUp(() { + registerServices(); + registerViewModels(); + }); + + tearDown(() { + unregisterViewModels(); + unregisterServices(); + }); + + group('Testing News Post Widget - ', () { + testWidgets("Test if News Post Widget is displayed ", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + final postFinder = find.byKey(newsPostKey); + expect(postFinder, findsOneWidget); + }); + }); + + group('Post Widget Test functionality-', () { + testWidgets("Test if like button changes colour if liked", + (WidgetTester tester) async { + await tester.runAsync(() async { + final Post post = getPostMockModel(); + when(post.likedBy).thenReturn([LikedBy(sId: "xzy1")]); + await tester.pumpWidget( + createNewsPostWidget( + null, + post, + ), + ); + await tester.pump(); + + final postFinder = find.byKey(newsPostKey); + final columnFinder = + find.descendant(of: postFinder, matching: find.byType(Column)); + final column2Finder = columnFinder.at(2); + final secondColumnWidget = + tester.firstWidget(column2Finder) as Column; + print(secondColumnWidget); + + // final thirdPaddingWidget = secondColumnWidget.children[2] as Padding; + // + // final first3GestureDetectorFinder = find.descendant( + // of: find.byWidget(thirdPaddingWidget), + // matching: find.byType(GestureDetector), + // ); + // final first3GestureDetectorWidget = tester + // .firstWidget(first3GestureDetectorFinder) as GestureDetector; + + // expect( + // (first3GestureDetectorWidget.child! as Icon).color, + // TalawaTheme.lightTheme.colorScheme.secondary, + // ); + }); + }); + + testWidgets("test onTap of GestureDetector's", (tester) async { + await tester.runAsync(() async { + int clicked = 0; + await tester + .pumpWidget(createNewsPostWidget((Post post) => clicked++)); + await tester.pump(); + + await tester.tap(find.byKey(const Key('commentButton'))); + await tester.pump(); + expect(clicked, 1); + + await tester.tap(find.byType(GestureDetector).last); + await tester.pump(); + expect(clicked, 2); + }); + }); + }); + + group("Post Widget Test is all Widgets exist-", () { + testWidgets("Test if Column exists", (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + final postFinder = find.byKey(newsPostKey); + final firstColumnFinder = find + .descendant(of: postFinder, matching: find.byType(Column)) + .first; + + //Test if 3 Columns exists + expect(firstColumnFinder, findsOneWidget); + + final firstColumnWidget = + tester.firstWidget(firstColumnFinder) as Column; + + // Test if first column has cross axis alignment of start + expect( + firstColumnWidget.crossAxisAlignment, + CrossAxisAlignment.start, + ); + + // Testing if all direct children of column are there + expect(firstColumnWidget.children[0], isA()); + expect(firstColumnWidget.children[1], isA()); + // expect(firstColumnWidget.children[2], isA()); + expect( + firstColumnWidget.children[2], + isA>(), + ); + }); + }); + testWidgets('Test Props of List Tile', (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + final postFinder = find.byKey(newsPostKey); + final columnFinder = find + .descendant(of: postFinder, matching: find.byType(Column)) + .first; + + final listTileFinder = find.descendant( + of: columnFinder, + matching: find.byType(ListTile), + ); + + // Tests if List Tile is a child of the first Column + expect(listTileFinder, findsOneWidget); + + final listTileWidget = tester.firstWidget(listTileFinder) as ListTile; + + // Tests if leading of list tile is custom avatar + expect(listTileWidget.leading.runtimeType, CustomAvatar); + + final customAvatarFinder = find.descendant( + of: listTileFinder.first, + matching: find.byType(CustomAvatar), + ); + + // Tests if Custom Avatar is a descendant of list tile + expect(customAvatarFinder, findsOneWidget); + + final customAvatarWidget = + tester.firstWidget(customAvatarFinder) as CustomAvatar; + + // Testing props of Custom Avatar Widget + expect(customAvatarWidget.isImageNull, true); + expect(customAvatarWidget.imageUrl, ' /null'); + expect(customAvatarWidget.fontSize, 20); + expect(customAvatarWidget.firstAlphabet, 'T'); + + // Tests if leading of list tile is custom avatar + expect(listTileWidget.title.runtimeType, Text); + + final textsOfListTileFinder = find.descendant( + of: listTileFinder.first, + matching: find.byType(Text), + ); + + // Testing if 3 Text Widget are children of list tile + // expect(textsOfListTileFinder, findsNWidgets(3)); + + final titleListTileFinder = textsOfListTileFinder.at(1); + final titleListTileWidget = + tester.firstWidget(titleListTileFinder) as Text; + + // Testing properties of title Text Widget of list tile + expect(titleListTileWidget.data, "TestName null"); + expect(titleListTileWidget.style!.fontSize, 16); + expect(titleListTileWidget.style!.fontWeight, FontWeight.w400); + + final subtitleListTileFinder = textsOfListTileFinder.at(1); + final subtitleListTileWidget = + tester.firstWidget(subtitleListTileFinder) as Text; + + // Testing properties of title Text Widget of list tile + expect(subtitleListTileWidget.data, "TestName null"); + }); + }); + testWidgets("Test props of DescriptionTextWidget", + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + final postFinder = find.byKey(newsPostKey); + final columnFinder = find + .descendant(of: postFinder, matching: find.byType(Column)) + .first; + final descriptionTextWidgetFinder = find.descendant( + of: columnFinder, + matching: find.byType(DescriptionTextWidget), + ); + + // Testing if DescriptionTextWidget shows + expect(descriptionTextWidgetFinder, findsOneWidget); + + final descriptionTextWidget = + tester.firstWidget(descriptionTextWidgetFinder) + as DescriptionTextWidget; + + // Testing if the text description is correct + expect(descriptionTextWidget.text, "TestDescription"); + }); + }); + + testWidgets("Test props of Base view", (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + final postFinder = find.byKey(newsPostKey); + final columnFinder = + find.descendant(of: postFinder, matching: find.byType(Column)); + + final baseViewWidget = (tester.firstWidget(columnFinder) as Column) + .children[2] as BaseView; + + // Testing if the text description is correct + expect(baseViewWidget.onModelReady, isNotNull); + expect(baseViewWidget.builder, isNotNull); + final column2Finder = columnFinder.at(2); + expect(column2Finder, findsOneWidget); + + final secondColumnWidget = + tester.firstWidget(column2Finder) as Column; + print(secondColumnWidget); + }); + }); + + group('Test props of children for baseview', () { + testWidgets( + 'Test MultiReactButton presence and onReactionChanged property in NewsPostWidget', + (WidgetTester tester) async { + await tester.runAsync(() async { + // Variable to check if onReactionChanged is called + bool reactionChangedCalled = false; + + // Build the NewsPostWidget containing the MultiReactButton + await tester.pumpWidget( + MultiReactButton( + toggle: () { + // Set the flag when onReactionChanged is called + reactionChangedCalled = true; + }, + ), + ); + + // Find the MultiReactButton widget within the NewsPostWidget + final multiReactButtonFinder = find.byType(MultiReactButton); + + // Ensure the MultiReactButton widget is present in the widget tree + expect(multiReactButtonFinder, findsOneWidget); + + // Simulate a reaction change on the MultiReactButton + await tester.tap( + multiReactButtonFinder, + ); // Replace with your actual tap action + await tester.pump(); + + // Ensure that onReactionChanged callback was triggered + expect(reactionChangedCalled, true); + }); + }); + testWidgets('Test props first padding widget', + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + final postFinder = find.byKey(newsPostKey); + final columnFinder = + find.descendant(of: postFinder, matching: find.byType(Column)); + final column2Finder = columnFinder.at(2); + final secondColumnWidget = + tester.firstWidget(column2Finder) as Column; + final firstPaddingWidget = + secondColumnWidget.children[0] as Padding; + + final firstGestureDetectorFinder = find.descendant( + of: find.byWidget(firstPaddingWidget), + matching: find.byType(GestureDetector), + ); + print(firstGestureDetectorFinder); + + final secondGestureDetectorFinder = find.descendant( + of: find.byWidget(firstPaddingWidget), + matching: find.byType(GestureDetector), + ); + print(secondGestureDetectorFinder); + }); + }); + + testWidgets('Test props second padding widget', + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + final postFinder = find.byKey(newsPostKey); + final columnFinder = + find.descendant(of: postFinder, matching: find.byType(Column)); + final column2Finder = columnFinder.at(2); + final secondColumnWidget = + tester.firstWidget(column2Finder) as Column; + final secondPaddingWidget = + secondColumnWidget.children[1] as Padding; + print(secondPaddingWidget); + }); + }); + + testWidgets('Test props third padding widget', + (WidgetTester tester) async { + await tester.runAsync(() async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + final postFinder = find.byKey(newsPostKey); + final columnFinder = + find.descendant(of: postFinder, matching: find.byType(Column)); + final column2Finder = columnFinder.at(2); + final secondColumnWidget = + tester.firstWidget(column2Finder) as Column; + print(secondColumnWidget); + }); + }); + + testWidgets('Test if report button opens modal bottom sheet', + (WidgetTester tester) async { + await tester.pumpWidget(createNewsPostWidget()); + await tester.pump(); + + final reportButtonFinder = find.byKey(const Key('reportButton')); + expect(reportButtonFinder, findsOneWidget); + + await tester.tap(reportButtonFinder); + await tester.pumpAndSettle(); + + final modalBottomSheetFinder = + find.byKey(const Key('reportPost')).first; + expect(modalBottomSheetFinder, findsOneWidget); + + final postBottomModalFinder = find.byType(PostBottomModal); + expect(postBottomModalFinder, findsOneWidget); + }); + + testWidgets("Test post image", (tester) async { + await tester.runAsync(() async { + await mockNetworkImagesFor(() async { + final Post post = getPostMockModel(); + when(post.imageUrl).thenReturn( + "testImageUrl", + ); + + await tester.pumpWidget( + createNewsPostWidget( + null, + post, + ), + ); + + await tester.pumpAndSettle(); + + final postParentContainer = + find.byKey(const Key('postParentContainer')); + expect(postParentContainer, findsOneWidget); + final postContainer = find + .descendant( + of: postParentContainer, + matching: find.byType(PostContainer), + ) + .first; + + expect(postContainer, findsOneWidget); + }); + }); + }); + }); + }); + }); +} diff --git a/test/widget_tests/widgets/raised_round_edge_button_test.dart b/test/widget_tests/widgets/raised_round_edge_button_test.dart new file mode 100644 index 000000000..563d093ec --- /dev/null +++ b/test/widget_tests/widgets/raised_round_edge_button_test.dart @@ -0,0 +1,156 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/widgets/raised_round_edge_button.dart'; + +const backgroundColor = Colors.black; +const foregroundColor = Colors.white; +const key = Key('ravidi'); +const buttonLabel = 'm_button'; + +int count = 0; + +void onTap() { + count++; +} + +Widget createRaisedRoundButton({ + double? width, + double? height, + bool showArrow = false, +}) { + return MaterialApp( + home: Scaffold( + body: RaisedRoundedButton( + key: key, + backgroundColor: backgroundColor, + textColor: foregroundColor, + buttonLabel: buttonLabel, + onTap: onTap, + width: width, + height: height, + showArrow: showArrow, + ), + ), + ); +} + +void main() { + SizeConfig().test(); + group('Test for RaisedRoundButton widget', () { + testWidgets('Check if the widget shows up', (tester) async { + await tester.pumpWidget(createRaisedRoundButton()); + await tester.pump(); + + expect(find.byKey(key), findsOneWidget); + }); + + testWidgets('Check if tapping works', (tester) async { + await tester.pumpWidget(createRaisedRoundButton()); + await tester.pump(); + + expect(count, 0); + await tester.tap(find.byType(GestureDetector)); + expect(count, 1); + }); + + testWidgets('Check for size (without providing size)', (tester) async { + await tester.pumpWidget(createRaisedRoundButton()); + await tester.pump(); + + final containerFinder = find.byType(Container); + final container = tester.firstWidget(containerFinder); + + expect(containerFinder, findsOneWidget); + + expect( + (container as Container).constraints, + BoxConstraints( + minWidth: SizeConfig.screenWidth! * 0.94, + maxWidth: SizeConfig.screenWidth! * 0.94, + minHeight: SizeConfig.screenHeight! * 0.07, + maxHeight: SizeConfig.screenHeight! * 0.07, + ), + ); + }); + + testWidgets('Check for size (providing size)', (tester) async { + await tester.pumpWidget(createRaisedRoundButton(width: 100, height: 100)); + await tester.pump(); + + final containerFinder = find.byType(Container); + final container = tester.firstWidget(containerFinder); + + expect(containerFinder, findsOneWidget); + + expect( + (container as Container).constraints, + const BoxConstraints( + minWidth: 100, + maxWidth: 100, + minHeight: 100, + maxHeight: 100, + ), + ); + }); + + testWidgets('Check for inner widget (show arrow)', (tester) async { + await tester.pumpWidget(createRaisedRoundButton(showArrow: true)); + await tester.pump(); + + expect(find.byType(Row), findsOneWidget); + expect(find.byType(Expanded), findsNWidgets(3)); + + final iconFinder = find.byType(Icon); + expect(iconFinder, findsNWidgets(2)); + + final iconOne = tester.widgetList(iconFinder).first; + final iconTwo = tester.widgetList(iconFinder).last; + + expect( + iconOne, + isA() + .having( + (icon) => icon.icon, + 'icon', + Icons.arrow_forward, + ) + .having( + (icon) => icon.color, + 'color', + Colors.transparent, + ), + ); + + expect( + iconTwo, + isA() + .having( + (icon) => icon.icon, + 'icon', + Icons.arrow_forward, + ) + .having( + (icon) => icon.color, + 'color', + foregroundColor, + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect(find.textContaining(buttonLabel), findsOneWidget); + }); + + testWidgets("Check for inner widget (don't show arrow)", (tester) async { + await tester.pumpWidget(createRaisedRoundButton()); + await tester.pump(); + + expect(find.byType(Row), findsNothing); + expect(find.textContaining(buttonLabel), findsOneWidget); + expect(find.byType(Text), findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/widgets/recurrence_dialog_test.dart b/test/widget_tests/widgets/recurrence_dialog_test.dart new file mode 100644 index 000000000..08b43ff58 --- /dev/null +++ b/test/widget_tests/widgets/recurrence_dialog_test.dart @@ -0,0 +1,260 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:intl/intl.dart'; +import 'package:talawa/constants/recurrence_values.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart'; +import 'package:talawa/widgets/recurrence_dialog.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +void main() { + late CreateEventViewModel model; + + group('ShowRecurrenceDialog', () { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + }); + + setUp(() { + locator().test(); + registerServices(); + model = CreateEventViewModel(); + model.initialize(); + }); + + tearDown(() => unregisterServices()); + + testWidgets('shows correct initial values', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: ShowRecurrenceDialog(model: model), + ), + ); + + expect(find.text('Does not repeat'), findsOneWidget); + expect(find.text('Daily'), findsOneWidget); + expect( + find.text( + RecurrenceUtils.getRecurrenceRuleText( + Frequency.weekly, + {RecurrenceUtils.weekDays[model.recurrenceStartDate.weekday - 1]}, + model.interval, + model.count, + model.weekDayOccurenceInMonth, + model.recurrenceStartDate, + model.recurrenceEndDate, + ), + ), + findsOneWidget, + ); + expect( + find.text( + RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + null, + model.interval, + model.count, + model.weekDayOccurenceInMonth, + model.recurrenceStartDate, + model.recurrenceEndDate, + ), + ), + findsOneWidget, + ); + expect( + find.text( + RecurrenceUtils.getRecurrenceRuleText( + Frequency.yearly, + null, + model.interval, + model.count, + model.weekDayOccurenceInMonth, + model.recurrenceStartDate, + model.recurrenceEndDate, + ), + ), + findsOneWidget, + ); + expect( + find.text( + 'Monday to Friday ${model.recurrenceEndDate != null ? "until ${DateFormat('MMMM d, y').format(model.recurrenceEndDate!)}" : ""}', + ), + findsOneWidget, + ); + expect(find.text('Custom...'), findsOneWidget); + }); + + testWidgets('shows correct initial values for last weekday occurrence', + (tester) async { + model.recurrenceStartDate = DateTime(2023, 02, 28); + await tester.pumpWidget( + MaterialApp( + home: ShowRecurrenceDialog(model: model), + ), + ); + + expect( + find.text( + RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + {'TUESDAY'}, + model.interval, + model.count, + -1, + model.recurrenceStartDate, + model.recurrenceEndDate, + ), + ), + findsOneWidget, + ); + }); + + testWidgets('updates model when Does not repeat is selected', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: ShowRecurrenceDialog(model: model), + ), + ); + + await tester.tap(find.text('Does not repeat')); + await tester.pump(); + + expect(model.isRecurring, false); + expect(model.recurrenceLabel, 'Does not repeat'); + expect(model.frequency, Frequency.weekly); + expect(model.weekDays, { + days[DateTime.now().weekday - 1], + }); + expect(model.weekDayOccurenceInMonth, null); + }); + + testWidgets('updates model when Daily is selected', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: ShowRecurrenceDialog(model: model), + ), + ); + + await tester.tap(find.text('Daily')); + await tester.pump(); + + expect(model.isRecurring, true); + expect(model.recurrenceLabel, 'Daily'); + expect(model.frequency, Frequency.daily); + }); + + testWidgets('updates model when Weekly is selected', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: ShowRecurrenceDialog(model: model), + ), + ); + final label = RecurrenceUtils.getRecurrenceRuleText( + Frequency.weekly, + {RecurrenceUtils.weekDays[model.recurrenceStartDate.weekday - 1]}, + model.interval, + model.count, + model.weekDayOccurenceInMonth, + model.recurrenceStartDate, + model.recurrenceEndDate, + ); + await tester.tap(find.text(label)); + await tester.pump(); + + expect(model.isRecurring, true); + expect(model.recurrenceLabel, label); + expect(model.frequency, Frequency.weekly); + expect( + model.weekDays, + { + RecurrenceUtils.weekDays[model.recurrenceStartDate.weekday - 1] + .toUpperCase(), + }, + ); + }); + + testWidgets('updates model when Monthly is selected', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: ShowRecurrenceDialog(model: model), + ), + ); + + final label = RecurrenceUtils.getRecurrenceRuleText( + Frequency.monthly, + null, + model.interval, + model.count, + model.weekDayOccurenceInMonth, + model.recurrenceStartDate, + model.recurrenceEndDate, + ); + + await tester.tap(find.text(label)); + await tester.pump(); + + expect(model.isRecurring, true); + expect(model.recurrenceLabel, label); + expect(model.frequency, Frequency.monthly); + }); + + testWidgets('updates model when Yearly is selected', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: ShowRecurrenceDialog(model: model), + ), + ); + + final label = RecurrenceUtils.getRecurrenceRuleText( + Frequency.yearly, + null, + model.interval, + model.count, + model.weekDayOccurenceInMonth, + model.recurrenceStartDate, + model.recurrenceEndDate, + ); + + await tester.tap(find.text(label)); + await tester.pump(); + + expect(model.isRecurring, true); + expect(model.recurrenceLabel, label); + expect(model.frequency, Frequency.yearly); + }); + + testWidgets('updates model when Monday to Friday is selected', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: ShowRecurrenceDialog(model: model), + ), + ); + + final label = + 'Monday to Friday ${model.recurrenceEndDate != null ? "until ${DateFormat('MMMM d, y').format(model.recurrenceEndDate!)}" : ""}'; + + await tester.tap(find.text(label)); + await tester.pump(); + + expect(model.isRecurring, true); + expect(model.recurrenceLabel, label); + expect(model.frequency, Frequency.weekly); + expect( + model.weekDays, + { + 'MONDAY', + 'TUESDAY', + 'WEDNESDAY', + 'THURSDAY', + 'FRIDAY', + }, + ); + }); + }); +} diff --git a/test/widget_tests/widgets/rich_text_test.dart b/test/widget_tests/widgets/rich_text_test.dart new file mode 100644 index 000000000..428dcc5a0 --- /dev/null +++ b/test/widget_tests/widgets/rich_text_test.dart @@ -0,0 +1,94 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/rich_text.dart'; + +const List> words = [ + { + 'text': 'Hello', + 'textStyle': TextStyle(color: Colors.red, fontSize: 20), + }, + { + 'text': 'Hello', + 'textStyle': TextStyle(color: Colors.black, fontSize: 10), + }, + { + 'text': 'Hello', + 'textStyle': TextStyle(color: Colors.black, fontSize: 10), + } +]; + +Widget createCustomRichText(String locale) { + return MaterialApp( + locale: Locale(locale), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: const CustomRichText(key: Key('richText'), words: words), + ); +} + +void main() { + group('Tests for CustomRichText widget', () { + testWidgets('Check if CustomRichText shows up', (tester) async { + await tester.pumpWidget(createCustomRichText('en')); + await tester.pump(); + + expect(find.byType(RichText), findsOneWidget); + }); + + testWidgets('Check for TextSpan(s) (en)', (tester) async { + await tester.pumpWidget(createCustomRichText('en')); + await tester.pump(); + + // Since TextSpan isn't a widget, only way to check if it worked correctly + // is by looking at the text + expect( + (tester.firstWidget(find.byType(RichText)) as RichText) + .text + .toPlainText(), + 'Hello Hello Hello ', + ); + }); + + testWidgets('Check for individual TextSpan(s) (en)', (tester) async { + await tester.pumpWidget(createCustomRichText('en')); + await tester.pump(); + + // First + expect( + (tester.firstWidget(find.byType(RichText)) as RichText).text.style, + isA() + .having((style) => style.color, 'Color', Colors.red) + .having((style) => style.fontSize, 'Font size', 20.0), + ); + + // Second + expect( + ((tester.firstWidget(find.byType(RichText)) as RichText).text + as TextSpan) + .children![0] + .style, + isA() + .having((style) => style.color, 'Color', Colors.black) + .having((style) => style.fontSize, 'Font size', 10.0), + ); + }); + }); +} diff --git a/test/widget_tests/widgets/talawa_error_dialog_test.dart b/test/widget_tests/widgets/talawa_error_dialog_test.dart new file mode 100644 index 000000000..9ea0786de --- /dev/null +++ b/test/widget_tests/widgets/talawa_error_dialog_test.dart @@ -0,0 +1,354 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/talawa_error_dialog.dart'; + +import '../../helpers/test_locator.dart'; + +Widget createTalawaErrorWidget1({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + navigationService.showTalawaErrorDialog( + "Test Error", + MessageType.error, + ); + }, + ), + ), + ); +} + +Widget createTalawaErrorWidget2({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + navigationService.showTalawaErrorDialog( + "Test Error", + MessageType.warning, + ); + }, + ), + ), + ); +} + +Widget createTalawaErrorWidget3({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + navigationService.showTalawaErrorDialog( + "Test Error", + MessageType.info, + ); + }, + ), + ), + ); +} + +Widget createTalawaErrorWidget4({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + navigationService.showTalawaErrorDialog( + "Test Error", + MessageType.random, + ); + }, + ), + ), + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + }); + group('Test for TalawaErrorWidget', () { + testWidgets('Check if the Error Widget shows up(error)', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget1()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + }); + testWidgets('Check if the Error Widget shows up(random)', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget4()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + }); + testWidgets('Check if the Error title shows up(error)', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget1()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + + final finder = find.text('Error'); + expect(finder, findsOneWidget); + }); + + testWidgets('Check if the Error Widget text shows up(error)', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget1()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + + final finder = find.text('Test Error'); + expect(finder, findsOneWidget); + }); + + testWidgets('Check if the Error Widget icon shows up(error)', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget1()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + + final finder = find.byType(SvgPicture); + expect(finder, findsOneWidget); + }); + + testWidgets('Check if the close Button is working', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget1()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + await tester.tap(find.textContaining('Dismiss')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsNothing); + }); + testWidgets('Check if the Error text shows up(warning)', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget2()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + }); + testWidgets('Check if the Error text shows up(warning)', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget2()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + + final finder = find.text('Warning'); + expect(finder, findsOneWidget); + }); + testWidgets('Check if the Error Widget text shows up(warning)', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget2()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + + final finder = find.text('Test Error'); + expect(finder, findsOneWidget); + }); + testWidgets('Check if the Error Widget icon shows up(warning)', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget2()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + + final finder = find.byType(SvgPicture); + expect(finder, findsOneWidget); + }); + + testWidgets('Check if the close Button is working', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget2()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + await tester.tap(find.textContaining('Dismiss')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsNothing); + }); + testWidgets('Check if the Error Widget shows up (info)', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget3()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + }); + testWidgets('Check if the Error Widget shows up (info)', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget3()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + final finder = find.text('Information'); + expect(finder, findsOneWidget); + }); + testWidgets('Check if the Error Widget shows up (info)', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget3()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + + final finder = find.text('Test Error'); + + expect(finder, findsOneWidget); + }); + + testWidgets('Check if the Error Widget icon shows up (info)', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget3()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsOneWidget); + + final finder = find.byType(SvgPicture); + expect(finder, findsOneWidget); + }); + + testWidgets('Check if the close Button is working', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget3()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + await tester.tap(find.textContaining('Close')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorDialog), findsNothing); + }); + }); +} diff --git a/test/widget_tests/widgets/talawa_error_snackbar_test.dart b/test/widget_tests/widgets/talawa_error_snackbar_test.dart new file mode 100644 index 000000000..13e2c1108 --- /dev/null +++ b/test/widget_tests/widgets/talawa_error_snackbar_test.dart @@ -0,0 +1,246 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:talawa/enums/enums.dart'; +import 'package:talawa/services/navigation_service.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/widgets/talawa_error_snackbar.dart'; + +import '../../helpers/test_locator.dart'; + +Widget createTalawaErrorWidget({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + navigationService.showTalawaErrorSnackBar( + "Test Error", + MessageType.warning, + ); + }, + ), + ), + ); +} + +Widget createTalawaErrorWidget2({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + navigationService.showTalawaErrorSnackBar( + "Test Error", + MessageType.error, + ); + }, + ), + ), + ); +} + +Widget createTalawaErrorWidget3({ + bool reverse = false, + String? dialogTitle, + bool passSecondaryFunc = true, +}) { + return MaterialApp( + navigatorKey: locator().navigatorKey, + navigatorObservers: [], + locale: const Locale('en'), + supportedLocales: [ + const Locale('en', 'US'), + const Locale('es', 'ES'), + const Locale('fr', 'FR'), + const Locale('hi', 'IN'), + const Locale('zh', 'CN'), + const Locale('de', 'DE'), + const Locale('ja', 'JP'), + const Locale('pt', 'PT'), + ], + localizationsDelegates: [ + const AppLocalizationsDelegate(isTest: true), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + home: Scaffold( + body: TextButton( + child: const Text('Open'), + onPressed: () { + navigationService.showTalawaErrorSnackBar( + "Test Error", + MessageType.info, + ); + }, + ), + ), + ); +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + SizeConfig().test(); + testSetupLocator(); + }); + group('Test for TalawaErrorWidget', () { + testWidgets('Check if the Snackbar shows up in warning form', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + }); + testWidgets('Check if the Snackbar shows up in error form', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget2()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + }); + testWidgets('Check if the Snackbar shows up in info form', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget3()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + }); + testWidgets("Check if the Snackbar's text shows up in warning form", + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + + final errorMesgFinder = find.text('Test Error'); + + expect(errorMesgFinder, findsOneWidget); + }); + testWidgets('Check if the Snackbar"s text shows up in error form', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget2()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + + final errorMesgFinder = find.text('Test Error'); + + expect(errorMesgFinder, findsOneWidget); + }); + testWidgets('Check if the Snackbar"s text shows up in info form', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget3()); + await tester.pump(); + + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + + final errorMesgFinder = find.text('Test Error'); + + expect(errorMesgFinder, findsOneWidget); + }); + + testWidgets('Check if the Snackbar icon shows up in info form', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget3()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + + final iconFinder = find.byIcon(Icons.info_outline); + + expect(iconFinder, findsOneWidget); + }); + + testWidgets('Check if the Snackbar shows up in error form', (tester) async { + await tester.pumpWidget(createTalawaErrorWidget2()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + + final iconFinder = find.byIcon(Icons.error); + + expect(iconFinder, findsOneWidget); + }); + testWidgets('Check if the Snackbar shows up in warning form', + (tester) async { + await tester.pumpWidget(createTalawaErrorWidget()); + await tester.pump(); + await tester.tap(find.textContaining('Open')); + await tester.pump(const Duration(seconds: 1)); + + expect(find.byType(TalawaErrorSnackBar), findsOneWidget); + + final iconFinder = find.byIcon(Icons.error); + + expect(iconFinder, findsOneWidget); + }); + }); +} diff --git a/test/widget_tests/widgets/theme_switch_test.dart b/test/widget_tests/widgets/theme_switch_test.dart new file mode 100644 index 000000000..b0496aeca --- /dev/null +++ b/test/widget_tests/widgets/theme_switch_test.dart @@ -0,0 +1,96 @@ +// ignore_for_file: talawa_api_doc +// ignore_for_file: talawa_good_doc_comments + +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:provider/provider.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/utils/app_localization.dart'; +import 'package:talawa/view_model/theme_view_model.dart'; +import 'package:talawa/widgets/theme_switch.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +Widget createApp() { + return const MaterialApp( + home: Scaffold( + body: ChangeThemeTile(), + ), + ); +} + +class LocalizationsInj extends StatelessWidget { + const LocalizationsInj({super.key, required this.child}); + final Widget child; + + @override + Widget build(BuildContext context) { + return MaterialApp( + localizationsDelegates: const [ + AppLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + supportedLocales: const [ + Locale('en', ''), + ], + home: child, + ); + } +} + +void main() { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + testSetupLocator(); + locator().test(); + }); + + setUp(() { + registerServices(); + locator().test(); + }); + + tearDown(() { + unregisterServices(); + }); + + group('Tests for theme_switch widget', () { + testWidgets("Testing the widget", (tester) async { + final mockAppTheme = getAndRegisterAppTheme(); + + when(mockAppTheme.isdarkTheme).thenReturn(true); + + await tester.pumpWidget( + ChangeNotifierProvider.value( + value: mockAppTheme, + child: const LocalizationsInj( + child: Scaffold( + body: ChangeThemeTile(), + ), + ), + ), + ); + await tester.pumpAndSettle(); + expect(find.byType(ListTile), findsOneWidget); + expect(find.byType(Text), findsOneWidget); + + final listTileFinder = find.byType(ListTile).first; + final listTile = tester.firstWidget(listTileFinder); + expect( + (listTile as ListTile).contentPadding, + const EdgeInsets.fromLTRB(3.6, 0.0, 3.6, 0.0), + ); + expect((listTile.trailing! as Switch).autofocus, true); + expect((listTile.trailing! as Switch).value, true); + + final switchWidget = listTile.trailing! as Switch; + switchWidget.onChanged!.call(true); + verify(mockAppTheme.switchTheme(isOn: true)); + }); + }); +} diff --git a/test/widget_tests/widgets/venue_card_test.dart b/test/widget_tests/widgets/venue_card_test.dart new file mode 100644 index 000000000..90fc001bc --- /dev/null +++ b/test/widget_tests/widgets/venue_card_test.dart @@ -0,0 +1,107 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:network_image_mock/network_image_mock.dart'; +import 'package:talawa/models/events/event_venue.dart'; +import 'package:talawa/services/graphql_config.dart'; +import 'package:talawa/services/size_config.dart'; +import 'package:talawa/widgets/venue_card.dart'; + +import '../../helpers/test_helpers.dart'; +import '../../helpers/test_locator.dart'; + +void main() { + testSetupLocator(); + setUp(() { + GraphqlConfig.orgURI = 'http://example.com/graphql'; + registerServices(); + locator().test(); + }); + + group('VenueCard Widget Tests', () { + testWidgets('Displays venue details correctly', + (WidgetTester tester) async { + final venue = Venue( + id: '1', + capacity: 100, + description: 'A beautiful venue for events.', + imageUrl: 'http://localhost:4000/images/venue.jpg', + name: 'Main Hall', + organizationId: 'org1', + ); + + await mockNetworkImagesFor(() async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: VenueCard( + venue: venue, + isSelected: false, + ), + ), + ), + ); + + expect(find.text('Main Hall'), findsOneWidget); + expect(find.text('Capacity: 100'), findsOneWidget); + expect(find.text('A beautiful venue for events.'), findsOneWidget); + expect(find.byIcon(Icons.check_circle), findsNothing); + }); + }); + + testWidgets('Displays selected state correctly', + (WidgetTester tester) async { + final venue = Venue( + id: '1', + capacity: 100, + description: 'A beautiful venue for events.', + imageUrl: 'http://localhost:4000/images/venue.jpg', + name: 'Main Hall', + organizationId: 'org1', + ); + + await mockNetworkImagesFor(() async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: VenueCard( + venue: venue, + isSelected: true, + ), + ), + ), + ); + + expect(find.byIcon(Icons.check_circle), findsOneWidget); + }); + }); + + testWidgets('Displays default image when imageUrl is empty', + (WidgetTester tester) async { + final venue = Venue( + id: '1', + capacity: 100, + description: 'A beautiful venue for events.', + imageUrl: '', + name: 'Main Hall', + organizationId: 'org1', + ); + + await mockNetworkImagesFor(() async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: VenueCard( + venue: venue, + isSelected: false, + ), + ), + ), + ); + expect( + find.byKey(const Key('image_container')), + findsWidgets, + ); + }); + }); + }); +}