├── .gitignore
├── .metadata
├── .vscode
├── launch.json
└── settings.json
├── README.md
├── amplify
├── .config
│ └── project-config.json
├── README.md
├── backend
│ ├── api
│ │ └── FlutterAmplifyApi
│ │ │ ├── parameters.json
│ │ │ ├── schema.graphql
│ │ │ ├── stacks
│ │ │ └── CustomResources.json
│ │ │ └── transform.conf.json
│ ├── auth
│ │ └── flutteramplify586ac13a
│ │ │ ├── flutteramplify586ac13a-cloudformation-template.yml
│ │ │ └── parameters.json
│ ├── backend-config.json
│ ├── storage
│ │ └── s324fe3c07
│ │ │ ├── parameters.json
│ │ │ ├── s3-cloudformation-template.json
│ │ │ └── storage-params.json
│ └── tags.json
├── cli.json
└── team-provider-info.json
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── flutter_amplify_demo
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
├── demo.gif
├── fonts
│ └── Poppins
│ │ ├── OFL.txt
│ │ ├── Poppins-Black.ttf
│ │ ├── Poppins-Bold.ttf
│ │ ├── Poppins-ExtraBold.ttf
│ │ ├── Poppins-ExtraLight.ttf
│ │ ├── Poppins-Italic.ttf
│ │ ├── Poppins-Light.ttf
│ │ ├── Poppins-Medium.ttf
│ │ ├── Poppins-Regular.ttf
│ │ ├── Poppins-SemiBold.ttf
│ │ └── Poppins-Thin.ttf
├── images
│ ├── bg_chat.jpg
│ ├── splash.png
│ └── splash.svg
└── title_image.png
├── clean.sh
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
├── lib
├── components
│ ├── get_name_bottom_sheet.dart
│ ├── google_login_button.dart
│ ├── login_text_field.dart
│ ├── primary_button.dart
│ ├── secondary_button.dart
│ ├── show_snackbar.dart
│ ├── textarea.dart
│ └── update_message_bottom_sheet.dart
├── main.dart
├── models
│ ├── ChatData.dart
│ ├── ModelProvider.dart
│ └── Users.dart
├── repositories
│ ├── chat_repository.dart
│ └── user_repository.dart
├── routes
│ ├── routes_generator.dart
│ └── routes_path.dart
├── screens
│ ├── ChatScreen
│ │ ├── ChatDetails
│ │ │ └── appbar.dart
│ │ ├── chat_detail_page.dart
│ │ └── chat_page.dart
│ ├── LoginScreen
│ │ └── login_screen.dart
│ ├── OtpScreen
│ │ └── otp_screen.dart
│ ├── RegisterScreen
│ │ └── register_screen.dart
│ ├── SettingsScreen
│ │ ├── components
│ │ │ ├── image_picker.dart
│ │ │ └── users_list.dart
│ │ └── settings_page.dart
│ ├── SplashScreen
│ │ └── splash_screen.dart
│ ├── StatusScreens
│ │ └── status_page.dart
│ └── home_screen.dart
├── services
│ ├── amplify_services.dart
│ ├── get_it_service.dart
│ ├── navigation_service.dart
│ ├── size_config.dart
│ ├── text_style.dart
│ └── validations.dart
├── stores
│ ├── auth.dart
│ ├── chat.dart
│ ├── state_keeper.dart
│ └── user.dart
├── theme
│ └── colors.dart
└── wrapper.dart
├── pubspec.lock
├── pubspec.yaml
├── test
└── widget_test.dart
└── web
├── favicon.png
├── icons
├── Icon-192.png
└── Icon-512.png
├── index.html
└── manifest.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
48 | #amplify
49 | amplify/\#current-cloud-backend
50 | amplify/.config/local-*
51 | amplify/logs
52 | amplify/mock-data
53 | amplify/backend/amplify-meta.json
54 | amplify/backend/awscloudformation
55 | amplify/backend/.temp
56 | build/
57 | dist/
58 | node_modules/
59 | aws-exports.js
60 | awsconfiguration.json
61 | amplifyconfiguration.json
62 | amplify-build-config.json
63 | amplify-gradle-config.json
64 | amplifytools.xcconfig
65 | .secret-*
66 |
67 | creds
68 |
69 | lib/amplifyconfiguration.dart
70 | android/key.jks
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "flutter_amplify_demo",
9 | "request": "launch",
10 | "type": "dart"
11 | }
12 | ]
13 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | "amplify/.config": true,
4 | "amplify/**/*-parameters.json": true,
5 | "amplify/**/amplify.state": true,
6 | "amplify/**/transform.conf.json": true,
7 | "amplify/#current-cloud-backend": true,
8 | "amplify/backend/amplify-meta.json": true,
9 | "amplify/backend/awscloudformation": true
10 | }
11 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |

Whatsapp Clone using Amplify DataStore in Flutter
7 |
8 | ## About The Project
9 |
10 | 
11 |
12 | ### Built With
13 |
14 | - [Flutter](https://flutter.dev/)
15 | - [AWS Amplify DataStore](https://docs.amplify.aws/lib/datastore/getting-started/q/platform/flutter)
16 |
17 |
18 |
19 | ## Getting Started
20 |
21 | To get a local copy up and running follow these simple steps.
22 |
23 | ### Prerequisites
24 |
25 | - You should have Flutter installed in your system.
26 | - AWS account is required to provision all the resources.
27 | - AWS Amplify CLI should be installed and configured with AWS Account.
28 |
29 | ### Installation
30 |
31 | 1. Clone the repo
32 |
33 | ```sh
34 | git clone https://github.com/GeekyAnts/flutter_amplify_datastore_demo
35 | ```
36 |
37 | 2. Install NPM packages
38 |
39 | ```sh
40 | flutter pub get
41 | ```
42 |
43 | 3. Run Amplify init to initialize Amplify project and app api to provision resource
44 |
45 | ```sh
46 | amplify init
47 | amplify add api
48 | amplify add auth
49 | // Choose email and password authentication.
50 | ```
51 |
52 | 4. Replace graphql schema in `amplify/backend/api/FlutterAmplifyApi/schema.graphql` file with below content.
53 |
54 | ```graphql
55 | type ChatRoom
56 | @model
57 | @auth(rules: [{ allow: public }])
58 | @key(name: "byUser", fields: ["userID"]) {
59 | id: ID!
60 | otherUserId: String
61 | otherUserName: String
62 | userID: ID
63 | chatId: String
64 | untitledfield: String
65 | }
66 |
67 | type ChatData @model @auth(rules: [{ allow: public }]) {
68 | id: ID!
69 | message: String
70 | createdAt: AWSDateTime
71 | chatRoomId: String
72 | senderId: String
73 | }
74 |
75 | type User @model @auth(rules: [{ allow: public }]) {
76 | id: ID!
77 | username: String!
78 | email: String
79 | bio: String
80 | profileImage: String
81 | isVerified: Boolean
82 | createdAt: AWSDateTime
83 | chats: AWSJSON
84 | ChatRooms: [ChatRoom] @connection(keyName: "byUser", fields: ["id"])
85 | }
86 | ```
87 |
88 |
89 |
90 | ## Contributing
91 |
92 | Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
93 |
94 | 1. Fork the Project
95 | 2. Create your Feature Branch (`git checkout -b feature/flutter_amplify_datastore_demo`)
96 | 3. Commit your Changes (`git commit -m 'Add some flutter_amplify_datastore_demo'`)
97 | 4. Push to the Branch (`git push origin feature/flutter_amplify_datastore_demo`)
98 | 5. Open a Pull Request
99 |
--------------------------------------------------------------------------------
/amplify/.config/project-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "projectName": "flutterAmplify",
3 | "version": "3.1",
4 | "frontend": "flutter",
5 | "flutter": {
6 | "config": {
7 | "ResDir": "./lib/"
8 | }
9 | },
10 | "providers": [
11 | "awscloudformation"
12 | ]
13 | }
--------------------------------------------------------------------------------
/amplify/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Amplify CLI
2 | This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli).
3 |
4 | Helpful resources:
5 | - Amplify documentation: https://docs.amplify.aws
6 | - Amplify CLI documentation: https://docs.amplify.aws/cli
7 | - More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files
8 | - Join Amplify's community: https://amplify.aws/community/
9 |
--------------------------------------------------------------------------------
/amplify/backend/api/FlutterAmplifyApi/parameters.json:
--------------------------------------------------------------------------------
1 | {
2 | "AppSyncApiName": "FlutterAmplifyApi",
3 | "DynamoDBBillingMode": "PAY_PER_REQUEST",
4 | "DynamoDBEnableServerSideEncryption": false
5 | }
--------------------------------------------------------------------------------
/amplify/backend/api/FlutterAmplifyApi/schema.graphql:
--------------------------------------------------------------------------------
1 | type Chatdata @model @auth(rules: [{allow: public}]) {
2 | id: ID!
3 | message: String
4 | createdAt: AWSTimestamp
5 | updatedAt: AWSTimestamp
6 | chatId: String
7 | senderId: String
8 | }
9 |
10 | type Users @model @auth(rules: [{allow: public}]) {
11 | id: ID!
12 | username: String
13 | email: AWSEmail
14 | bio: String
15 | profileImage: AWSURL
16 | isVerified: Boolean
17 | createdAt: AWSTimestamp
18 | chats: [AWSJSON]
19 | }
20 |
--------------------------------------------------------------------------------
/amplify/backend/api/FlutterAmplifyApi/stacks/CustomResources.json:
--------------------------------------------------------------------------------
1 | {
2 | "AWSTemplateFormatVersion": "2010-09-09",
3 | "Description": "An auto-generated nested stack.",
4 | "Metadata": {},
5 | "Parameters": {
6 | "AppSyncApiId": {
7 | "Type": "String",
8 | "Description": "The id of the AppSync API associated with this project."
9 | },
10 | "AppSyncApiName": {
11 | "Type": "String",
12 | "Description": "The name of the AppSync API",
13 | "Default": "AppSyncSimpleTransform"
14 | },
15 | "env": {
16 | "Type": "String",
17 | "Description": "The environment name. e.g. Dev, Test, or Production",
18 | "Default": "NONE"
19 | },
20 | "S3DeploymentBucket": {
21 | "Type": "String",
22 | "Description": "The S3 bucket containing all deployment assets for the project."
23 | },
24 | "S3DeploymentRootKey": {
25 | "Type": "String",
26 | "Description": "An S3 key relative to the S3DeploymentBucket that points to the root\nof the deployment directory."
27 | }
28 | },
29 | "Resources": {
30 | "EmptyResource": {
31 | "Type": "Custom::EmptyResource",
32 | "Condition": "AlwaysFalse"
33 | }
34 | },
35 | "Conditions": {
36 | "HasEnvironmentParameter": {
37 | "Fn::Not": [
38 | {
39 | "Fn::Equals": [
40 | {
41 | "Ref": "env"
42 | },
43 | "NONE"
44 | ]
45 | }
46 | ]
47 | },
48 | "AlwaysFalse": {
49 | "Fn::Equals": ["true", "false"]
50 | }
51 | },
52 | "Outputs": {
53 | "EmptyOutput": {
54 | "Description": "An empty output. You may delete this if you have at least one resource above.",
55 | "Value": ""
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/amplify/backend/api/FlutterAmplifyApi/transform.conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "Version": 5,
3 | "ElasticsearchWarning": true,
4 | "ResolverConfig": {
5 | "project": {
6 | "ConflictHandler": "AUTOMERGE",
7 | "ConflictDetection": "VERSION"
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/amplify/backend/auth/flutteramplify586ac13a/parameters.json:
--------------------------------------------------------------------------------
1 | {
2 | "identityPoolName": "flutteramplify586ac13a_identitypool_586ac13a",
3 | "allowUnauthenticatedIdentities": false,
4 | "resourceNameTruncated": "flutte586ac13a",
5 | "userPoolName": "flutteramplify586ac13a_userpool_586ac13a",
6 | "autoVerifiedAttributes": [
7 | "email"
8 | ],
9 | "mfaConfiguration": "OFF",
10 | "mfaTypes": [
11 | "SMS Text Message"
12 | ],
13 | "smsAuthenticationMessage": "Your authentication code is {####}",
14 | "smsVerificationMessage": "Your verification code is {####}",
15 | "emailVerificationSubject": "Your verification code",
16 | "emailVerificationMessage": "Your verification code is {####}",
17 | "defaultPasswordPolicy": false,
18 | "passwordPolicyMinLength": 8,
19 | "passwordPolicyCharacters": [],
20 | "requiredAttributes": [
21 | "email"
22 | ],
23 | "userpoolClientGenerateSecret": false,
24 | "userpoolClientRefreshTokenValidity": 30,
25 | "userpoolClientWriteAttributes": [],
26 | "userpoolClientReadAttributes": [],
27 | "userpoolClientLambdaRole": "flutte586ac13a_userpoolclient_lambda_role",
28 | "userpoolClientSetAttributes": false,
29 | "sharedId": "586ac13a",
30 | "resourceName": "flutteramplify586ac13a",
31 | "authSelections": "identityPoolAndUserPool",
32 | "authRoleArn": {
33 | "Fn::GetAtt": [
34 | "AuthRole",
35 | "Arn"
36 | ]
37 | },
38 | "unauthRoleArn": {
39 | "Fn::GetAtt": [
40 | "UnauthRole",
41 | "Arn"
42 | ]
43 | },
44 | "useDefault": "manual",
45 | "usernameAttributes": [
46 | "email, phone_number"
47 | ],
48 | "triggers": "{}",
49 | "userPoolGroupList": [],
50 | "serviceName": "Cognito",
51 | "usernameCaseSensitive": false,
52 | "parentStack": {
53 | "Ref": "AWS::StackId"
54 | },
55 | "permissions": [],
56 | "dependsOn": [],
57 | "hostedUI": true,
58 | "hostedUIDomainName": "flutteramplify70fe2805-70fe2805",
59 | "authProvidersUserPool": [
60 | "Google"
61 | ],
62 | "hostedUIProviderMeta": "[{\"ProviderName\":\"Google\",\"authorize_scopes\":\"openid email profile\",\"AttributeMapping\":{\"email\":\"email\",\"username\":\"sub\"}}]",
63 | "oAuthMetadata": "{\"AllowedOAuthFlows\":[\"code\"],\"AllowedOAuthScopes\":[\"phone\",\"email\",\"openid\",\"profile\",\"aws.cognito.signin.user.admin\"],\"CallbackURLs\":[\"myapp://\"],\"LogoutURLs\":[\"myapp://\"]}",
64 | "authProviders": [],
65 | "userPoolGroups": false,
66 | "adminQueries": false,
67 | "thirdPartyAuth": false
68 | }
--------------------------------------------------------------------------------
/amplify/backend/backend-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "api": {
3 | "FlutterAmplifyApi": {
4 | "service": "AppSync",
5 | "providerPlugin": "awscloudformation",
6 | "output": {
7 | "authConfig": {
8 | "defaultAuthentication": {
9 | "authenticationType": "API_KEY",
10 | "apiKeyConfig": {
11 | "apiKeyExpirationDays": 30,
12 | "description": "api key description"
13 | }
14 | },
15 | "additionalAuthenticationProviders": [
16 | {
17 | "authenticationType": "AWS_IAM"
18 | }
19 | ]
20 | }
21 | }
22 | }
23 | },
24 | "auth": {
25 | "flutteramplify586ac13a": {
26 | "service": "Cognito",
27 | "providerPlugin": "awscloudformation",
28 | "dependsOn": [],
29 | "customAuth": false
30 | }
31 | },
32 | "storage": {
33 | "s324fe3c07": {
34 | "service": "S3",
35 | "providerPlugin": "awscloudformation"
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/amplify/backend/storage/s324fe3c07/parameters.json:
--------------------------------------------------------------------------------
1 | {
2 | "bucketName": "flutteramplify376c099e0a9a4a87979592a7eae6cb1d",
3 | "authPolicyName": "s3_amplify_24fe3c07",
4 | "unauthPolicyName": "s3_amplify_24fe3c07",
5 | "authRoleName": {
6 | "Ref": "AuthRoleName"
7 | },
8 | "unauthRoleName": {
9 | "Ref": "UnauthRoleName"
10 | },
11 | "selectedGuestPermissions": [
12 | "s3:GetObject",
13 | "s3:ListBucket"
14 | ],
15 | "selectedAuthenticatedPermissions": [
16 | "s3:PutObject",
17 | "s3:GetObject",
18 | "s3:ListBucket",
19 | "s3:DeleteObject"
20 | ],
21 | "s3PermissionsAuthenticatedPublic": "s3:PutObject,s3:GetObject,s3:DeleteObject",
22 | "s3PublicPolicy": "Public_policy_c94f4f45",
23 | "s3PermissionsAuthenticatedUploads": "s3:PutObject",
24 | "s3UploadsPolicy": "Uploads_policy_c94f4f45",
25 | "s3PermissionsAuthenticatedProtected": "s3:PutObject,s3:GetObject,s3:DeleteObject",
26 | "s3ProtectedPolicy": "Protected_policy_c94f4f45",
27 | "s3PermissionsAuthenticatedPrivate": "s3:PutObject,s3:GetObject,s3:DeleteObject",
28 | "s3PrivatePolicy": "Private_policy_c94f4f45",
29 | "AuthenticatedAllowList": "ALLOW",
30 | "s3ReadPolicy": "read_policy_c94f4f45",
31 | "s3PermissionsGuestPublic": "DISALLOW",
32 | "s3PermissionsGuestUploads": "DISALLOW",
33 | "GuestAllowList": "DISALLOW",
34 | "triggerFunction": "NONE"
35 | }
--------------------------------------------------------------------------------
/amplify/backend/storage/s324fe3c07/s3-cloudformation-template.json:
--------------------------------------------------------------------------------
1 | {
2 | "AWSTemplateFormatVersion": "2010-09-09",
3 | "Description": "S3 resource stack creation using Amplify CLI",
4 | "Parameters": {
5 | "bucketName": {
6 | "Type": "String"
7 | },
8 | "authPolicyName": {
9 | "Type": "String"
10 | },
11 | "unauthPolicyName": {
12 | "Type": "String"
13 | },
14 | "authRoleName": {
15 | "Type": "String"
16 | },
17 | "unauthRoleName": {
18 | "Type": "String"
19 | },
20 | "s3PublicPolicy": {
21 | "Type": "String",
22 | "Default" : "NONE"
23 | },
24 | "s3PrivatePolicy": {
25 | "Type": "String",
26 | "Default" : "NONE"
27 | },
28 | "s3ProtectedPolicy": {
29 | "Type": "String",
30 | "Default" : "NONE"
31 | },
32 | "s3UploadsPolicy": {
33 | "Type": "String",
34 | "Default" : "NONE"
35 | },
36 | "s3ReadPolicy": {
37 | "Type": "String",
38 | "Default" : "NONE"
39 | },
40 | "s3PermissionsAuthenticatedPublic": {
41 | "Type": "String",
42 | "Default" : "DISALLOW"
43 | },
44 | "s3PermissionsAuthenticatedProtected": {
45 | "Type": "String",
46 | "Default" : "DISALLOW"
47 | },
48 | "s3PermissionsAuthenticatedPrivate": {
49 | "Type": "String",
50 | "Default" : "DISALLOW"
51 | },
52 | "s3PermissionsAuthenticatedUploads": {
53 | "Type": "String",
54 | "Default" : "DISALLOW"
55 | },
56 | "s3PermissionsGuestPublic": {
57 | "Type": "String",
58 | "Default" : "DISALLOW"
59 | },
60 | "s3PermissionsGuestUploads": {
61 | "Type": "String",
62 | "Default" : "DISALLOW" },
63 | "AuthenticatedAllowList": {
64 | "Type": "String",
65 | "Default" : "DISALLOW"
66 | },
67 | "GuestAllowList": {
68 | "Type": "String",
69 | "Default" : "DISALLOW"
70 | },
71 | "selectedGuestPermissions": {
72 | "Type": "CommaDelimitedList",
73 | "Default" : "NONE"
74 | },
75 | "selectedAuthenticatedPermissions": {
76 | "Type": "CommaDelimitedList",
77 | "Default" : "NONE"
78 | },
79 | "env": {
80 | "Type": "String"
81 | },
82 | "triggerFunction": {
83 | "Type": "String"
84 | }
85 |
86 |
87 | },
88 | "Conditions": {
89 | "ShouldNotCreateEnvResources": {
90 | "Fn::Equals": [
91 | {
92 | "Ref": "env"
93 | },
94 | "NONE"
95 | ]
96 | },
97 | "CreateAuthPublic": {
98 | "Fn::Not" : [{
99 | "Fn::Equals" : [
100 | {"Ref" : "s3PermissionsAuthenticatedPublic"},
101 | "DISALLOW"
102 | ]
103 | }]
104 | },
105 | "CreateAuthProtected": {
106 | "Fn::Not" : [{
107 | "Fn::Equals" : [
108 | {"Ref" : "s3PermissionsAuthenticatedProtected"},
109 | "DISALLOW"
110 | ]
111 | }]
112 | },
113 | "CreateAuthPrivate": {
114 | "Fn::Not" : [{
115 | "Fn::Equals" : [
116 | {"Ref" : "s3PermissionsAuthenticatedPrivate"},
117 | "DISALLOW"
118 | ]
119 | }]
120 | },
121 | "CreateAuthUploads": {
122 | "Fn::Not" : [{
123 | "Fn::Equals" : [
124 | {"Ref" : "s3PermissionsAuthenticatedUploads"},
125 | "DISALLOW"
126 | ]
127 | }]
128 | },
129 | "CreateGuestPublic": {
130 | "Fn::Not" : [{
131 | "Fn::Equals" : [
132 | {"Ref" : "s3PermissionsGuestPublic"},
133 | "DISALLOW"
134 | ]
135 | }]
136 | },
137 | "CreateGuestUploads": {
138 | "Fn::Not" : [{
139 | "Fn::Equals" : [
140 | {"Ref" : "s3PermissionsGuestUploads"},
141 | "DISALLOW"
142 | ]
143 | }]
144 | },
145 | "AuthReadAndList": {
146 | "Fn::Not" : [{
147 | "Fn::Equals" : [
148 | {"Ref" : "AuthenticatedAllowList"},
149 | "DISALLOW"
150 | ]
151 | }]
152 | },
153 | "GuestReadAndList": {
154 | "Fn::Not" : [{
155 | "Fn::Equals" : [
156 | {"Ref" : "GuestAllowList"},
157 | "DISALLOW"
158 | ]
159 | }]
160 | }
161 | },
162 | "Resources": {
163 | "S3Bucket": {
164 | "Type": "AWS::S3::Bucket",
165 |
166 | "DeletionPolicy" : "Retain",
167 | "Properties": {
168 | "BucketName": {
169 | "Fn::If": [
170 | "ShouldNotCreateEnvResources",
171 | {
172 | "Ref": "bucketName"
173 | },
174 | {
175 | "Fn::Join": [
176 | "",
177 | [
178 | {
179 | "Ref": "bucketName"
180 | },
181 | {
182 | "Fn::Select": [
183 | 3,
184 | {
185 | "Fn::Split": [
186 | "-",
187 | {
188 | "Ref": "AWS::StackName"
189 | }
190 | ]
191 | }
192 | ]
193 | },
194 | "-",
195 | {
196 | "Ref": "env"
197 | }
198 | ]
199 | ]
200 | }
201 | ]
202 | },
203 |
204 | "CorsConfiguration": {
205 | "CorsRules": [
206 | {
207 | "AllowedHeaders": [
208 | "*"
209 | ],
210 | "AllowedMethods": [
211 | "GET",
212 | "HEAD",
213 | "PUT",
214 | "POST",
215 | "DELETE"
216 | ],
217 | "AllowedOrigins": [
218 | "*"
219 | ],
220 | "ExposedHeaders": [
221 | "x-amz-server-side-encryption",
222 | "x-amz-request-id",
223 | "x-amz-id-2",
224 | "ETag"
225 | ],
226 | "Id": "S3CORSRuleId1",
227 | "MaxAge": "3000"
228 | }
229 | ]
230 | }
231 | }
232 | },
233 |
234 |
235 | "S3AuthPublicPolicy": {
236 | "DependsOn": [
237 | "S3Bucket"
238 | ],
239 | "Condition": "CreateAuthPublic",
240 | "Type": "AWS::IAM::Policy",
241 | "Properties": {
242 | "PolicyName": {
243 | "Ref": "s3PublicPolicy"
244 | },
245 | "Roles": [
246 | {
247 | "Ref": "authRoleName"
248 | }
249 | ],
250 | "PolicyDocument": {
251 | "Version": "2012-10-17",
252 | "Statement": [
253 | {
254 | "Effect": "Allow",
255 | "Action": {
256 | "Fn::Split" : [ "," , {
257 | "Ref": "s3PermissionsAuthenticatedPublic"
258 | } ]
259 | },
260 | "Resource": [
261 | {
262 | "Fn::Join": [
263 | "",
264 | [
265 | "arn:aws:s3:::",
266 | {
267 | "Ref": "S3Bucket"
268 | },
269 | "/public/*"
270 | ]
271 | ]
272 | }
273 | ]
274 | }
275 | ]
276 | }
277 | }
278 | },
279 | "S3AuthProtectedPolicy": {
280 | "DependsOn": [
281 | "S3Bucket"
282 | ],
283 | "Condition": "CreateAuthProtected",
284 | "Type": "AWS::IAM::Policy",
285 | "Properties": {
286 | "PolicyName": {
287 | "Ref": "s3ProtectedPolicy"
288 | },
289 | "Roles": [
290 | {
291 | "Ref": "authRoleName"
292 | }
293 | ],
294 | "PolicyDocument": {
295 | "Version": "2012-10-17",
296 | "Statement": [
297 | {
298 | "Effect": "Allow",
299 | "Action": {
300 | "Fn::Split" : [ "," , {
301 | "Ref": "s3PermissionsAuthenticatedProtected"
302 | } ]
303 | },
304 | "Resource": [
305 | {
306 | "Fn::Join": [
307 | "",
308 | [
309 | "arn:aws:s3:::",
310 | {
311 | "Ref": "S3Bucket"
312 | },
313 | "/protected/${cognito-identity.amazonaws.com:sub}/*"
314 | ]
315 | ]
316 | }
317 | ]
318 | }
319 | ]
320 | }
321 | }
322 | },
323 | "S3AuthPrivatePolicy": {
324 | "DependsOn": [
325 | "S3Bucket"
326 | ],
327 | "Condition": "CreateAuthPrivate",
328 | "Type": "AWS::IAM::Policy",
329 | "Properties": {
330 | "PolicyName": {
331 | "Ref": "s3PrivatePolicy"
332 | },
333 | "Roles": [
334 | {
335 | "Ref": "authRoleName"
336 | }
337 | ],
338 | "PolicyDocument": {
339 | "Version": "2012-10-17",
340 | "Statement": [
341 | {
342 | "Effect": "Allow",
343 | "Action": {
344 | "Fn::Split" : [ "," , {
345 | "Ref": "s3PermissionsAuthenticatedPrivate"
346 | } ]
347 | },
348 | "Resource": [
349 | {
350 | "Fn::Join": [
351 | "",
352 | [
353 | "arn:aws:s3:::",
354 | {
355 | "Ref": "S3Bucket"
356 | },
357 | "/private/${cognito-identity.amazonaws.com:sub}/*"
358 | ]
359 | ]
360 | }
361 | ]
362 | }
363 | ]
364 | }
365 | }
366 | },
367 | "S3AuthUploadPolicy": {
368 | "DependsOn": [
369 | "S3Bucket"
370 | ],
371 | "Condition": "CreateAuthUploads",
372 | "Type": "AWS::IAM::Policy",
373 | "Properties": {
374 | "PolicyName": {
375 | "Ref": "s3UploadsPolicy"
376 | },
377 | "Roles": [
378 | {
379 | "Ref": "authRoleName"
380 | }
381 | ],
382 | "PolicyDocument": {
383 | "Version": "2012-10-17",
384 | "Statement": [
385 | {
386 | "Effect": "Allow",
387 | "Action": {
388 | "Fn::Split" : [ "," , {
389 | "Ref": "s3PermissionsAuthenticatedUploads"
390 | } ]
391 | },
392 | "Resource": [
393 | {
394 | "Fn::Join": [
395 | "",
396 | [
397 | "arn:aws:s3:::",
398 | {
399 | "Ref": "S3Bucket"
400 | },
401 | "/uploads/*"
402 | ]
403 | ]
404 | }
405 | ]
406 | }
407 | ]
408 | }
409 | }
410 | },
411 | "S3AuthReadPolicy": {
412 | "DependsOn": [
413 | "S3Bucket"
414 | ],
415 | "Condition": "AuthReadAndList",
416 | "Type": "AWS::IAM::Policy",
417 | "Properties": {
418 | "PolicyName": {
419 | "Ref": "s3ReadPolicy"
420 | },
421 | "Roles": [
422 | {
423 | "Ref": "authRoleName"
424 | }
425 | ],
426 | "PolicyDocument": {
427 | "Version": "2012-10-17",
428 | "Statement": [
429 | {
430 | "Effect": "Allow",
431 | "Action": [
432 | "s3:GetObject"
433 | ],
434 | "Resource": [
435 | {
436 | "Fn::Join": [
437 | "",
438 | [
439 | "arn:aws:s3:::",
440 | {
441 | "Ref": "S3Bucket"
442 | },
443 | "/protected/*"
444 | ]
445 | ]
446 | }
447 | ]
448 | },
449 | {
450 | "Effect": "Allow",
451 | "Action": [
452 | "s3:ListBucket"
453 | ],
454 | "Resource": [
455 | {
456 | "Fn::Join": [
457 | "",
458 | [
459 | "arn:aws:s3:::",
460 | {
461 | "Ref": "S3Bucket"
462 | }
463 | ]
464 | ]
465 | }
466 | ],
467 | "Condition": {
468 | "StringLike": {
469 | "s3:prefix": [
470 | "public/",
471 | "public/*",
472 | "protected/",
473 | "protected/*",
474 | "private/${cognito-identity.amazonaws.com:sub}/",
475 | "private/${cognito-identity.amazonaws.com:sub}/*"
476 | ]
477 | }
478 | }
479 | }
480 | ]
481 | }
482 | }
483 | },
484 | "S3GuestPublicPolicy": {
485 | "DependsOn": [
486 | "S3Bucket"
487 | ],
488 | "Condition": "CreateGuestPublic",
489 | "Type": "AWS::IAM::Policy",
490 | "Properties": {
491 | "PolicyName": {
492 | "Ref": "s3PublicPolicy"
493 | },
494 | "Roles": [
495 | {
496 | "Ref": "unauthRoleName"
497 | }
498 | ],
499 | "PolicyDocument": {
500 | "Version": "2012-10-17",
501 | "Statement": [
502 | {
503 | "Effect": "Allow",
504 | "Action": {
505 | "Fn::Split" : [ "," , {
506 | "Ref": "s3PermissionsGuestPublic"
507 | } ]
508 | },
509 | "Resource": [
510 | {
511 | "Fn::Join": [
512 | "",
513 | [
514 | "arn:aws:s3:::",
515 | {
516 | "Ref": "S3Bucket"
517 | },
518 | "/public/*"
519 | ]
520 | ]
521 | }
522 | ]
523 | }
524 | ]
525 | }
526 | }
527 | },
528 | "S3GuestUploadPolicy": {
529 | "DependsOn": [
530 | "S3Bucket"
531 | ],
532 | "Condition": "CreateGuestUploads",
533 | "Type": "AWS::IAM::Policy",
534 | "Properties": {
535 | "PolicyName": {
536 | "Ref": "s3UploadsPolicy"
537 | },
538 | "Roles": [
539 | {
540 | "Ref": "unauthRoleName"
541 | }
542 | ],
543 | "PolicyDocument": {
544 | "Version": "2012-10-17",
545 | "Statement": [
546 | {
547 | "Effect": "Allow",
548 | "Action": {
549 | "Fn::Split" : [ "," , {
550 | "Ref": "s3PermissionsGuestUploads"
551 | } ]
552 | },
553 | "Resource": [
554 | {
555 | "Fn::Join": [
556 | "",
557 | [
558 | "arn:aws:s3:::",
559 | {
560 | "Ref": "S3Bucket"
561 | },
562 | "/uploads/*"
563 | ]
564 | ]
565 | }
566 | ]
567 | }
568 | ]
569 | }
570 | }
571 | },
572 | "S3GuestReadPolicy": {
573 | "DependsOn": [
574 | "S3Bucket"
575 | ],
576 | "Condition": "GuestReadAndList",
577 | "Type": "AWS::IAM::Policy",
578 | "Properties": {
579 | "PolicyName": {
580 | "Ref": "s3ReadPolicy"
581 | },
582 | "Roles": [
583 | {
584 | "Ref": "unauthRoleName"
585 | }
586 | ],
587 | "PolicyDocument": {
588 | "Version": "2012-10-17",
589 | "Statement": [
590 | {
591 | "Effect": "Allow",
592 | "Action": [
593 | "s3:GetObject"
594 | ],
595 | "Resource": [
596 | {
597 | "Fn::Join": [
598 | "",
599 | [
600 | "arn:aws:s3:::",
601 | {
602 | "Ref": "S3Bucket"
603 | },
604 | "/protected/*"
605 | ]
606 | ]
607 | }
608 | ]
609 | },
610 | {
611 | "Effect": "Allow",
612 | "Action": [
613 | "s3:ListBucket"
614 | ],
615 | "Resource": [
616 | {
617 | "Fn::Join": [
618 | "",
619 | [
620 | "arn:aws:s3:::",
621 | {
622 | "Ref": "S3Bucket"
623 | }
624 | ]
625 | ]
626 | }
627 | ],
628 | "Condition": {
629 | "StringLike": {
630 | "s3:prefix": [
631 | "public/",
632 | "public/*",
633 | "protected/",
634 | "protected/*"
635 | ]
636 | }
637 | }
638 | }
639 | ]
640 | }
641 | }
642 | }
643 | },
644 | "Outputs": {
645 | "BucketName": {
646 | "Value": {
647 | "Ref": "S3Bucket"
648 | },
649 | "Description": "Bucket name for the S3 bucket"
650 | },
651 | "Region": {
652 | "Value": {
653 | "Ref": "AWS::Region"
654 | }
655 | }
656 | }
657 | }
658 |
--------------------------------------------------------------------------------
/amplify/backend/storage/s324fe3c07/storage-params.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/amplify/backend/tags.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Key": "user:Stack",
4 | "Value": "{project-env}"
5 | },
6 | {
7 | "Key": "user:Application",
8 | "Value": "{project-name}"
9 | }
10 | ]
--------------------------------------------------------------------------------
/amplify/cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "features": {
3 | "graphqltransformer": {
4 | "addmissingownerfields": true,
5 | "validatetypenamereservedwords": true,
6 | "useexperimentalpipelinedtransformer": false,
7 | "enableiterativegsiupdates": false,
8 | "secondarykeyasgsi": true,
9 | "skipoverridemutationinputtypes": true
10 | },
11 | "frontend-ios": {
12 | "enablexcodeintegration": true
13 | },
14 | "auth": {
15 | "enablecaseinsensitivity": true
16 | },
17 | "codegen": {
18 | "useappsyncmodelgenplugin": true,
19 | "usedocsgeneratorplugin": true,
20 | "usetypesgeneratorplugin": true,
21 | "cleangeneratedmodelsdirectory": true,
22 | "retaincasestyle": true
23 | },
24 | "appsync": {
25 | "generategraphqlpermissions": true
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/amplify/team-provider-info.json:
--------------------------------------------------------------------------------
1 | {
2 | "dev": {
3 | "awscloudformation": {
4 | "AuthRoleName": "amplify-flutteramplify-dev-111734-authRole",
5 | "UnauthRoleArn": "arn:aws:iam::718679627680:role/amplify-flutteramplify-dev-111734-unauthRole",
6 | "AuthRoleArn": "arn:aws:iam::718679627680:role/amplify-flutteramplify-dev-111734-authRole",
7 | "Region": "ap-south-1",
8 | "DeploymentBucketName": "amplify-flutteramplify-dev-111734-deployment",
9 | "UnauthRoleName": "amplify-flutteramplify-dev-111734-unauthRole",
10 | "StackName": "amplify-flutteramplify-dev-111734",
11 | "StackId": "arn:aws:cloudformation:ap-south-1:718679627680:stack/amplify-flutteramplify-dev-111734/72b544a0-82f6-11eb-b462-066d6b8defd6",
12 | "AmplifyAppId": "d2dc3sxod8r2np"
13 | },
14 | "categories": {
15 | "auth": {
16 | "flutteramplify586ac13a": {}
17 | }
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | def keystoreProperties = new Properties()
29 | def keystorePropertiesFile = rootProject.file('key.properties')
30 | if (keystorePropertiesFile.exists()) {
31 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32 | }
33 |
34 | android {
35 | compileSdkVersion 30
36 |
37 | sourceSets {
38 | main.java.srcDirs += 'src/main/kotlin'
39 | }
40 |
41 | defaultConfig {
42 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
43 | applicationId "com.example.flutter_amplify_demo"
44 | minSdkVersion 21
45 | targetSdkVersion 30
46 | versionCode flutterVersionCode.toInteger()
47 | versionName flutterVersionName
48 | }
49 |
50 | signingConfigs {
51 | release {
52 | keyAlias keystoreProperties['keyAlias']
53 | keyPassword keystoreProperties['keyPassword']
54 | storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
55 | storePassword keystoreProperties['storePassword']
56 | }
57 | }
58 |
59 | buildTypes {
60 | release {
61 | // TODO: Add your own signing config for the release build.
62 | // Signing with the debug keys for now, so `flutter run --release` works.
63 | signingConfig signingConfigs.debug
64 | }
65 | }
66 | }
67 |
68 | flutter {
69 | source '../..'
70 | }
71 |
72 | dependencies {
73 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
74 | }
75 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
13 |
17 |
21 |
26 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
49 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_amplify_demo/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_amplify_demo
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.1.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/assets/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/demo.gif
--------------------------------------------------------------------------------
/assets/fonts/Poppins/OFL.txt:
--------------------------------------------------------------------------------
1 | Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins)
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 | This license is copied below, and is also available with a FAQ at:
5 | http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-Black.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-Bold.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-ExtraBold.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-ExtraLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-ExtraLight.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-Italic.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-Light.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-Medium.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-Regular.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-SemiBold.ttf
--------------------------------------------------------------------------------
/assets/fonts/Poppins/Poppins-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/fonts/Poppins/Poppins-Thin.ttf
--------------------------------------------------------------------------------
/assets/images/bg_chat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/images/bg_chat.jpg
--------------------------------------------------------------------------------
/assets/images/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/images/splash.png
--------------------------------------------------------------------------------
/assets/title_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/assets/title_image.png
--------------------------------------------------------------------------------
/clean.sh:
--------------------------------------------------------------------------------
1 | flutter clean
2 | pod repo update
3 | rm -rf ios/Podfile.lock ios/Pods/
4 | rm -rf pubspec.lock .packages .flutter-plugins
5 | flutter pub pub cache repair
6 | flutter pub get
7 | cd ios; pod install
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '13.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | target.build_configurations.each do |config|
41 | config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
42 | end
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Amplify (1.6.1):
3 | - Amplify/Default (= 1.6.1)
4 | - Amplify/Default (1.6.1)
5 | - amplify_api (0.0.1):
6 | - Amplify
7 | - amplify_core
8 | - AmplifyPlugins/AWSAPIPlugin
9 | - Flutter
10 | - amplify_auth_cognito (0.0.1):
11 | - Amplify
12 | - amplify_core
13 | - AmplifyPlugins/AWSCognitoAuthPlugin
14 | - Flutter
15 | - ObjectMapper
16 | - amplify_core (0.0.1):
17 | - Flutter
18 | - amplify_datastore (0.0.1):
19 | - Amplify
20 | - amplify_core
21 | - AmplifyPlugins/AWSDataStorePlugin
22 | - Flutter
23 | - amplify_flutter (0.0.1):
24 | - Amplify
25 | - amplify_core
26 | - AmplifyPlugins/AWSCognitoAuthPlugin
27 | - AWSPluginsCore
28 | - Flutter
29 | - AmplifyPlugins/AWSAPIPlugin (1.6.1):
30 | - AppSyncRealTimeClient (~> 1.4.0)
31 | - AWSCore (~> 2.23.0)
32 | - AWSPluginsCore (= 1.6.1)
33 | - AmplifyPlugins/AWSCognitoAuthPlugin (1.6.1):
34 | - AWSAuthCore (~> 2.23.0)
35 | - AWSCognitoIdentityProvider (~> 2.23.0)
36 | - AWSCognitoIdentityProviderASF (~> 2.23.0)
37 | - AWSCore (~> 2.23.0)
38 | - AWSMobileClient (~> 2.23.0)
39 | - AWSPluginsCore (= 1.6.1)
40 | - AmplifyPlugins/AWSDataStorePlugin (1.6.1):
41 | - AWSCore (~> 2.23.0)
42 | - AWSPluginsCore (= 1.6.1)
43 | - SQLite.swift (~> 0.12.0)
44 | - AppSyncRealTimeClient (1.4.3):
45 | - Starscream (~> 3.1.0)
46 | - AWSAuthCore (2.23.1):
47 | - AWSCore (= 2.23.1)
48 | - AWSCognitoIdentityProvider (2.23.1):
49 | - AWSCognitoIdentityProviderASF (= 2.23.1)
50 | - AWSCore (= 2.23.1)
51 | - AWSCognitoIdentityProviderASF (2.23.1)
52 | - AWSCore (2.23.1)
53 | - AWSMobileClient (2.23.1):
54 | - AWSAuthCore (= 2.23.1)
55 | - AWSCognitoIdentityProvider (= 2.23.1)
56 | - AWSCognitoIdentityProviderASF (= 2.23.1)
57 | - AWSCore (= 2.23.1)
58 | - AWSPluginsCore (1.6.1):
59 | - Amplify (= 1.6.1)
60 | - AWSCore (~> 2.23.0)
61 | - Flutter (1.0.0)
62 | - FMDB (2.7.5):
63 | - FMDB/standard (= 2.7.5)
64 | - FMDB/standard (2.7.5)
65 | - ObjectMapper (4.2.0)
66 | - path_provider (0.0.1):
67 | - Flutter
68 | - sqflite (0.0.2):
69 | - Flutter
70 | - FMDB (>= 2.7.5)
71 | - SQLite.swift (0.12.2):
72 | - SQLite.swift/standard (= 0.12.2)
73 | - SQLite.swift/standard (0.12.2)
74 | - Starscream (3.1.1)
75 |
76 | DEPENDENCIES:
77 | - amplify_api (from `.symlinks/plugins/amplify_api/ios`)
78 | - amplify_auth_cognito (from `.symlinks/plugins/amplify_auth_cognito/ios`)
79 | - amplify_core (from `.symlinks/plugins/amplify_core/ios`)
80 | - amplify_datastore (from `.symlinks/plugins/amplify_datastore/ios`)
81 | - amplify_flutter (from `.symlinks/plugins/amplify_flutter/ios`)
82 | - Flutter (from `Flutter`)
83 | - path_provider (from `.symlinks/plugins/path_provider/ios`)
84 | - sqflite (from `.symlinks/plugins/sqflite/ios`)
85 |
86 | SPEC REPOS:
87 | trunk:
88 | - Amplify
89 | - AmplifyPlugins
90 | - AppSyncRealTimeClient
91 | - AWSAuthCore
92 | - AWSCognitoIdentityProvider
93 | - AWSCognitoIdentityProviderASF
94 | - AWSCore
95 | - AWSMobileClient
96 | - AWSPluginsCore
97 | - FMDB
98 | - ObjectMapper
99 | - SQLite.swift
100 | - Starscream
101 |
102 | EXTERNAL SOURCES:
103 | amplify_api:
104 | :path: ".symlinks/plugins/amplify_api/ios"
105 | amplify_auth_cognito:
106 | :path: ".symlinks/plugins/amplify_auth_cognito/ios"
107 | amplify_core:
108 | :path: ".symlinks/plugins/amplify_core/ios"
109 | amplify_datastore:
110 | :path: ".symlinks/plugins/amplify_datastore/ios"
111 | amplify_flutter:
112 | :path: ".symlinks/plugins/amplify_flutter/ios"
113 | Flutter:
114 | :path: Flutter
115 | path_provider:
116 | :path: ".symlinks/plugins/path_provider/ios"
117 | sqflite:
118 | :path: ".symlinks/plugins/sqflite/ios"
119 |
120 | SPEC CHECKSUMS:
121 | Amplify: 4d0c3b0871e1f268c81ce5e9b65532df0a013900
122 | amplify_api: 9a94aa18c1576ee0f3bae038b34c227e07b5c6ab
123 | amplify_auth_cognito: 2e090a788d0ba4e08f6438170b1e7aac872782b4
124 | amplify_core: 8b38d20089fe4f225c14db6892f586bd03824a42
125 | amplify_datastore: e73979905bbee5c192e59f6afcd4e0692c3132bf
126 | amplify_flutter: d64b45e3a016e491bbb2e110fee57e150daf2164
127 | AmplifyPlugins: 51dfaeafe662cd571c4d4dfd3bdc5987fef2d5a7
128 | AppSyncRealTimeClient: 04df4dffe57cfbd06da336d0bfcd5641ba9adcb5
129 | AWSAuthCore: d9f9c418df00f45f399e407dc6c2bce33870b0af
130 | AWSCognitoIdentityProvider: 8bf316cc96554d4c88ca4b1dcae0589923fb95f5
131 | AWSCognitoIdentityProviderASF: f9b0d373dfce6d5395f0b69f2301f5db927d9fc8
132 | AWSCore: 48bf561f5fb3616ef42c1f7f3eeb4b502d11f69d
133 | AWSMobileClient: ffe1179b9e6d5db7cea3f807df7d47f5d00a5c65
134 | AWSPluginsCore: f41f8a478fe3fd8839ec16278b86dededefb0628
135 | Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
136 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
137 | ObjectMapper: 1eb41f610210777375fa806bf161dc39fb832b81
138 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
139 | sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
140 | SQLite.swift: d2b4642190917051ce6bd1d49aab565fe794eea3
141 | Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0
142 |
143 | PODFILE CHECKSUM: 2d003d2a4f4b67e0a26ff44e9ea1b5df6c5e26d8
144 |
145 | COCOAPODS: 1.10.1
146 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyAnts/flutter_amplify_datastore_demo/3c4b6a2732d5b5c8dfa23d0236ade575afc822be/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleURLTypes
6 |
7 |
8 | CFBundleURLSchemes
9 |
10 | myapp
11 |
12 |
13 |
14 | NSCameraUsageDescription
15 | This app requires access to the camera.
16 | NSMicrophoneUsageDescription
17 | This app does not require access to the microphone.
18 | NSPhotoLibraryUsageDescription
19 | This app requires access to the photo library.
20 |
21 | CFBundleDevelopmentRegion
22 | $(DEVELOPMENT_LANGUAGE)
23 | CFBundleExecutable
24 | $(EXECUTABLE_NAME)
25 | CFBundleIdentifier
26 | $(PRODUCT_BUNDLE_IDENTIFIER)
27 | CFBundleInfoDictionaryVersion
28 | 6.0
29 | CFBundleName
30 | flutter_amplify_demo
31 | CFBundlePackageType
32 | APPL
33 | CFBundleShortVersionString
34 | $(FLUTTER_BUILD_NAME)
35 | CFBundleSignature
36 | ????
37 | CFBundleVersion
38 | $(FLUTTER_BUILD_NUMBER)
39 | LSRequiresIPhoneOS
40 |
41 | UILaunchStoryboardName
42 | LaunchScreen
43 | UIMainStoryboardFile
44 | Main
45 | UISupportedInterfaceOrientations
46 |
47 | UIInterfaceOrientationPortrait
48 | UIInterfaceOrientationLandscapeLeft
49 | UIInterfaceOrientationLandscapeRight
50 |
51 | UISupportedInterfaceOrientations~ipad
52 |
53 | UIInterfaceOrientationPortrait
54 | UIInterfaceOrientationPortraitUpsideDown
55 | UIInterfaceOrientationLandscapeLeft
56 | UIInterfaceOrientationLandscapeRight
57 |
58 | UIViewControllerBasedStatusBarAppearance
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/components/get_name_bottom_sheet.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_amplify_demo/repositories/user_repository.dart';
3 | import 'package:flutter_amplify_demo/components/login_text_field.dart';
4 | import 'package:flutter_amplify_demo/components/primary_button.dart';
5 | import 'package:flutter_amplify_demo/routes/routes_path.dart';
6 | import 'package:flutter_amplify_demo/services/get_it_service.dart';
7 | import 'package:flutter_amplify_demo/services/navigation_service.dart';
8 | import 'package:flutter_amplify_demo/services/size_config.dart';
9 | import 'package:flutter_amplify_demo/services/text_style.dart';
10 | import 'package:flutter_amplify_demo/services/validations.dart';
11 | import 'package:flutter_amplify_demo/stores/user.dart';
12 | import 'package:flutter_amplify_demo/theme/colors.dart';
13 |
14 | getNameBottomSheet(context) {
15 | TextEditingController nameCtrl = TextEditingController();
16 | final GlobalKey formKey = GlobalKey();
17 | NavigationService _navigationService =
18 | get_it_instance_const();
19 | return showModalBottomSheet(
20 | context: context,
21 | isScrollControlled: true,
22 | backgroundColor: bgColor,
23 | builder: (context) {
24 | return Container(
25 | height: 400,
26 | width: SizeConfig.screenWidth,
27 | decoration: BoxDecoration(
28 | color: bgColor,
29 | borderRadius: BorderRadius.only(
30 | topLeft: Radius.circular(10),
31 | topRight: Radius.circular(10),
32 | ),
33 | border: Border.all(color: Colors.white.withOpacity(0.1), width: 3),
34 | ),
35 | child: Form(
36 | key: formKey,
37 | child: Padding(
38 | padding: EdgeInsets.symmetric(vertical: 20, horizontal: 30),
39 | child: Column(
40 | children: [
41 | Text(
42 | "What should we call you?",
43 | style: CustomTextStyle.loginTitleStyle,
44 | ),
45 | SizedBox(height: 24.toHeight),
46 | CustomLoginTextField(
47 | hintTextL: "Full Name",
48 | ctrl: nameCtrl,
49 | validation: Validations.validateFullName,
50 | type: TextInputType.text,
51 | ),
52 | SizedBox(height: 24.toHeight),
53 | PrimaryButton(
54 | text: "Continue",
55 | onPress: () async {
56 | if (!formKey.currentState.validate()) return;
57 | await UserRepository().updateFullname(nameCtrl.text);
58 | await UserStore().fetchCurrentUser();
59 | await UserStore().fetchAllOtherUsers();
60 | _navigationService.popAllAndReplace(RoutePath.Home);
61 | },
62 | ),
63 | ],
64 | ),
65 | ),
66 | ),
67 | );
68 | });
69 | }
70 |
--------------------------------------------------------------------------------
/lib/components/google_login_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_amplify_demo/components/get_name_bottom_sheet.dart';
3 | import 'package:flutter_amplify_demo/components/primary_button.dart';
4 | import 'package:flutter_amplify_demo/components/secondary_button.dart';
5 | import 'package:flutter_amplify_demo/components/show_snackbar.dart';
6 | import 'package:flutter_amplify_demo/routes/routes_path.dart';
7 | import 'package:flutter_amplify_demo/services/get_it_service.dart';
8 | import 'package:flutter_amplify_demo/services/navigation_service.dart';
9 | import 'package:flutter_amplify_demo/stores/auth.dart';
10 | import 'package:flutter_amplify_demo/stores/state_keeper.dart';
11 | import 'package:provider/provider.dart';
12 |
13 | class GoogleButton extends StatefulWidget {
14 | final bool isPrimaryButton;
15 | GoogleButton({Key key, this.isPrimaryButton}) : super(key: key);
16 |
17 | @override
18 | _GoogleButtonState createState() => _GoogleButtonState();
19 | }
20 |
21 | class _GoogleButtonState extends State {
22 | NavigationService _navigationService =
23 | get_it_instance_const();
24 |
25 | @override
26 | Widget build(BuildContext context) {
27 | return Consumer(builder: (_, authStore, __) {
28 | if (authStore.status[AuthStore.LOGIN_GOOGLE_USER] == Status.Error) {
29 | WidgetsBinding.instance.addPostFrameCallback((_) {
30 | showSnackBar(
31 | context,
32 | authStore.error[AuthStore.LOGIN_GOOGLE_USER],
33 | );
34 | authStore.reset(AuthStore.LOGIN_GOOGLE_USER);
35 | });
36 | }
37 | if (authStore.status[AuthStore.LOGIN_GOOGLE_USER] == Status.Loading) {
38 | return CircularProgressIndicator();
39 | }
40 | return widget.isPrimaryButton
41 | ? PrimaryButton(
42 | text: "Continue with Google",
43 | onPress: () async {
44 | bool isSignedIn = await authStore.loginWithGoogle();
45 | if (isSignedIn) {
46 | bool hasUsername = await authStore.checkUsername();
47 | if (!hasUsername)
48 | getNameBottomSheet(context);
49 | else
50 | _navigationService.popAllAndReplace(RoutePath.Home);
51 | }
52 | },
53 | )
54 | : SecondaryButton(
55 | text: "Continue with Google",
56 | onPress: () async {
57 | bool isSignedIn = await authStore.loginWithGoogle();
58 | if (isSignedIn) {
59 | bool hasUsername = await authStore.checkUsername();
60 | if (!hasUsername)
61 | getNameBottomSheet(context);
62 | else
63 | _navigationService.popAllAndReplace(RoutePath.Home);
64 | }
65 | },
66 | );
67 | });
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/lib/components/login_text_field.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_amplify_demo/theme/colors.dart';
3 | import 'package:flutter_amplify_demo/services/size_config.dart';
4 |
5 | class CustomLoginTextField extends StatelessWidget {
6 | final String hintTextL;
7 | final TextEditingController ctrl;
8 | final Function validation;
9 | final bool obscureText;
10 | final TextInputType type;
11 | final int maxLength;
12 | const CustomLoginTextField({
13 | Key key,
14 | @required this.hintTextL,
15 | @required this.ctrl,
16 | @required this.validation,
17 | this.obscureText = false,
18 | this.type,
19 | this.maxLength,
20 | }) : super(key: key);
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return TextFormField(
25 | validator: (value) => validation(value),
26 | controller: ctrl,
27 | obscureText: obscureText,
28 | keyboardType: type,
29 | maxLength: maxLength,
30 | autovalidateMode: AutovalidateMode.onUserInteraction,
31 | decoration: InputDecoration(
32 | border: OutlineInputBorder(
33 | borderSide: BorderSide(color: Colors.grey[700], width: 2.toWidth),
34 | borderRadius: BorderRadius.all(
35 | Radius.circular(18.toWidth),
36 | ),
37 | ),
38 | enabledBorder: OutlineInputBorder(
39 | borderSide: BorderSide(color: Colors.grey[700], width: 2.toWidth),
40 | borderRadius: BorderRadius.all(
41 | Radius.circular(18.toWidth),
42 | ),
43 | ),
44 | focusedBorder: OutlineInputBorder(
45 | borderSide: BorderSide(color: ThemeColor.primary, width: 2.toWidth),
46 | borderRadius: BorderRadius.all(
47 | Radius.circular(18.toWidth),
48 | ),
49 | ),
50 | disabledBorder: OutlineInputBorder(
51 | borderSide: BorderSide(color: Colors.grey[700], width: 2.toWidth),
52 | borderRadius: BorderRadius.all(
53 | Radius.circular(18.toWidth),
54 | ),
55 | ),
56 | contentPadding: EdgeInsets.symmetric(
57 | horizontal: 18.toWidth,
58 | vertical: 16.toHeight,
59 | ),
60 | hintText: hintTextL,
61 | hintStyle: TextStyle(
62 | color: Colors.grey[600],
63 | fontSize: 18.toFont,
64 | fontWeight: FontWeight.w500,
65 | ),
66 | ),
67 | style: TextStyle(
68 | color: Colors.grey[400],
69 | fontSize: 16.toFont,
70 | fontWeight: FontWeight.w500,
71 | ),
72 | );
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/lib/components/primary_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_amplify_demo/services/size_config.dart';
3 |
4 | class PrimaryButton extends StatelessWidget {
5 | final String text;
6 | final Function onPress;
7 | const PrimaryButton({
8 | Key key,
9 | this.text,
10 | this.onPress,
11 | }) : super(key: key);
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Container(
16 | width: SizeConfig.screenWidth,
17 | height: 50.toHeight,
18 | child: TextButton(
19 | onPressed: onPress,
20 | child: Text(
21 | text,
22 | style: TextStyle(
23 | fontSize: 20.toFont,
24 | fontWeight: FontWeight.w600,
25 | ),
26 | ),
27 | style: ButtonStyle(
28 | shape: MaterialStateProperty.all(
29 | RoundedRectangleBorder(
30 | borderRadius: BorderRadius.circular(18.0.toWidth),
31 | ),
32 | ),
33 | ),
34 | ),
35 | );
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/lib/components/secondary_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_amplify_demo/services/size_config.dart';
3 |
4 | class SecondaryButton extends StatefulWidget {
5 | final String text;
6 | final Function onPress;
7 | SecondaryButton({
8 | Key key,
9 | this.text,
10 | this.onPress,
11 | }) : super(key: key);
12 |
13 | @override
14 | _SecondaryButtonState createState() => _SecondaryButtonState();
15 | }
16 |
17 | class _SecondaryButtonState extends State {
18 | MaterialStateProperty backgroundColor =
19 | MaterialStateProperty.all(Colors.black);
20 |
21 | @override
22 | Widget build(BuildContext context) {
23 | return Container(
24 | width: SizeConfig.screenWidth,
25 | height: 50.toHeight,
26 | decoration: BoxDecoration(
27 | border: Border.all(
28 | color: Colors.white,
29 | width: 2.5,
30 | ),
31 | borderRadius: BorderRadius.circular(20),
32 | ),
33 | child: TextButton(
34 | onPressed: widget.onPress,
35 | child: Text(
36 | widget.text,
37 | style: TextStyle(
38 | fontSize: 20.toFont,
39 | fontWeight: FontWeight.w600,
40 | color: Colors.white,
41 | ),
42 | ),
43 | style: ButtonStyle(
44 | shape: MaterialStateProperty.all(
45 | RoundedRectangleBorder(
46 | borderRadius: BorderRadius.circular(18.0),
47 | ),
48 | ),
49 | backgroundColor: MaterialStateProperty.all(Colors.black),
50 | ),
51 | ),
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/lib/components/show_snackbar.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | showSnackBar(BuildContext context, String message) {
4 | final snackBar = SnackBar(content: Text(message));
5 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
6 | }
7 |
--------------------------------------------------------------------------------
/lib/components/textarea.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_amplify_demo/theme/colors.dart';
3 | import 'package:flutter_amplify_demo/services/size_config.dart';
4 |
5 | class TextArea extends StatelessWidget {
6 | final TextEditingController ctrl;
7 | const TextArea({
8 | Key key,
9 | @required this.ctrl,
10 | }) : super(key: key);
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | return TextFormField(
15 | controller: ctrl,
16 | maxLines: 3,
17 | autovalidateMode: AutovalidateMode.onUserInteraction,
18 | decoration: InputDecoration(
19 | border: OutlineInputBorder(
20 | borderSide: BorderSide(color: Colors.grey[700], width: 2.toWidth),
21 | borderRadius: BorderRadius.all(
22 | Radius.circular(18.toWidth),
23 | ),
24 | ),
25 | enabledBorder: OutlineInputBorder(
26 | borderSide: BorderSide(color: Colors.grey[700], width: 2.toWidth),
27 | borderRadius: BorderRadius.all(
28 | Radius.circular(18.toWidth),
29 | ),
30 | ),
31 | focusedBorder: OutlineInputBorder(
32 | borderSide: BorderSide(color: ThemeColor.primary, width: 2.toWidth),
33 | borderRadius: BorderRadius.all(
34 | Radius.circular(18.toWidth),
35 | ),
36 | ),
37 | disabledBorder: OutlineInputBorder(
38 | borderSide: BorderSide(color: Colors.grey[700], width: 2.toWidth),
39 | borderRadius: BorderRadius.all(
40 | Radius.circular(18.toWidth),
41 | ),
42 | ),
43 | contentPadding: EdgeInsets.symmetric(
44 | horizontal: 18.toWidth,
45 | vertical: 16.toHeight,
46 | ),
47 | hintText: "This cannot be empty.",
48 | hintStyle: TextStyle(
49 | color: Colors.grey[600],
50 | fontSize: 18.toFont,
51 | fontWeight: FontWeight.w500,
52 | ),
53 | ),
54 | style: TextStyle(
55 | color: Colors.grey[400],
56 | fontSize: 16.toFont,
57 | fontWeight: FontWeight.w500,
58 | ),
59 | );
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/lib/components/update_message_bottom_sheet.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_amplify_demo/components/textarea.dart';
3 | import 'package:flutter_amplify_demo/components/primary_button.dart';
4 | import 'package:flutter_amplify_demo/models/ChatData.dart';
5 | import 'package:flutter_amplify_demo/services/get_it_service.dart';
6 | import 'package:flutter_amplify_demo/services/navigation_service.dart';
7 | import 'package:flutter_amplify_demo/services/size_config.dart';
8 | import 'package:flutter_amplify_demo/services/text_style.dart';
9 | import 'package:flutter_amplify_demo/theme/colors.dart';
10 |
11 | updateMessageBottomSheet(
12 | context,
13 | Chatdata chatData,
14 | Function updateMessage,
15 | Function closeSelectionModel,
16 | ) {
17 | TextEditingController messageCtrl =
18 | TextEditingController(text: chatData.message);
19 |
20 | NavigationService _navigationService =
21 | get_it_instance_const();
22 | return showModalBottomSheet(
23 | context: context,
24 | isScrollControlled: true,
25 | backgroundColor: bgColor,
26 | builder: (context) {
27 | return Container(
28 | height: 300.toHeight,
29 | width: SizeConfig.screenWidth,
30 | decoration: BoxDecoration(
31 | color: bgColor,
32 | borderRadius: BorderRadius.only(
33 | topLeft: Radius.circular(10),
34 | topRight: Radius.circular(10),
35 | ),
36 | border: Border.all(color: Colors.white.withOpacity(0.1), width: 3),
37 | ),
38 | child: Padding(
39 | padding: EdgeInsets.symmetric(vertical: 20, horizontal: 30),
40 | child: Column(
41 | crossAxisAlignment: CrossAxisAlignment.start,
42 | children: [
43 | Text(
44 | "Update message",
45 | style: CustomTextStyle.loginTitleStyle.copyWith(
46 | fontSize: 23.toFont,
47 | ),
48 | ),
49 | SizedBox(height: 24.toHeight),
50 | TextArea(ctrl: messageCtrl),
51 | SizedBox(height: 24.toHeight),
52 | PrimaryButton(
53 | text: "Continue",
54 | onPress: () async {
55 | if (messageCtrl.text == "") return;
56 | await updateMessage(chatData.id, messageCtrl.text);
57 | closeSelectionModel();
58 | if (Navigator.canPop(context)) {
59 | Navigator.pop(context);
60 | }
61 | // await UserRepository().updateFullname(messageCtrl.text);
62 | // _navigationService.popAllAndReplace(RoutePath.Home);
63 | },
64 | ),
65 | ],
66 | ),
67 | ),
68 | );
69 | });
70 | }
71 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 | import 'package:flutter_amplify_demo/routes/routes_generator.dart';
4 | import 'package:flutter_amplify_demo/routes/routes_path.dart';
5 | import 'package:flutter_amplify_demo/services/amplify_services.dart';
6 |
7 | import 'package:flutter_amplify_demo/services/get_it_service.dart';
8 | import 'package:flutter_amplify_demo/services/navigation_service.dart';
9 | import 'package:flutter_amplify_demo/stores/auth.dart';
10 | import 'package:flutter_amplify_demo/stores/chat.dart';
11 | import 'package:flutter_amplify_demo/stores/user.dart';
12 | import 'package:flutter_amplify_demo/wrapper.dart';
13 | import 'package:provider/provider.dart';
14 |
15 | void main() {
16 | GetItService.setupLocator();
17 |
18 | SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
19 | systemNavigationBarColor: Colors.black,
20 | statusBarColor: Colors.black,
21 | ));
22 |
23 | WidgetsFlutterBinding.ensureInitialized();
24 | runApp(MyApp());
25 | }
26 |
27 | class MyApp extends StatefulWidget {
28 | MyApp({Key key}) : super(key: key);
29 |
30 | @override
31 | _MyAppState createState() => _MyAppState();
32 | }
33 |
34 | class _MyAppState extends State {
35 | @override
36 | void initState() {
37 | super.initState();
38 | AmplifyService.configureAmplify();
39 | }
40 |
41 | @override
42 | Widget build(BuildContext context) {
43 | return MultiProvider(
44 | providers: [
45 | ChangeNotifierProvider(
46 | create: (_) => ChatStore(),
47 | lazy: false,
48 | ),
49 | ChangeNotifierProvider(
50 | create: (_) => UserStore(),
51 | lazy: false,
52 | ),
53 | ChangeNotifierProvider(
54 | create: (_) => AuthStore(),
55 | lazy: false,
56 | )
57 | ],
58 | child: MaterialApp(
59 | debugShowCheckedModeBanner: false,
60 | home: Wrapper(),
61 | theme: ThemeData(
62 | fontFamily: 'Poppins',
63 | textButtonTheme: TextButtonThemeData(
64 | style: TextButton.styleFrom(
65 | primary: Colors.black,
66 | backgroundColor: Colors.white,
67 | ),
68 | ),
69 | ),
70 | navigatorKey: get_it_instance_const().navigatorKey,
71 | onGenerateRoute: generateRoute,
72 | initialRoute: RoutePath.Wrapper,
73 | ),
74 | );
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/lib/models/ChatData.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 |
16 | // ignore_for_file: public_member_api_docs
17 |
18 | import 'package:amplify_datastore_plugin_interface/amplify_datastore_plugin_interface.dart';
19 | import 'package:flutter/foundation.dart';
20 |
21 | @immutable
22 | class Chatdata extends Model {
23 | static const classType = const ChatdataType();
24 | final String id;
25 | final String message;
26 | final TemporalTimestamp createdAt;
27 | final TemporalTimestamp updatedAt;
28 | final String chatId;
29 | final String senderId;
30 |
31 | @override
32 | getInstanceType() => classType;
33 |
34 | @override
35 | String getId() {
36 | return id;
37 | }
38 |
39 | const Chatdata._internal(
40 | {@required this.id,
41 | this.message,
42 | this.createdAt,
43 | this.updatedAt,
44 | this.chatId,
45 | this.senderId});
46 |
47 | factory Chatdata(
48 | {String id,
49 | String message,
50 | TemporalTimestamp createdAt,
51 | TemporalTimestamp updatedAt,
52 | String chatId,
53 | String senderId}) {
54 | return Chatdata._internal(
55 | id: id == null ? UUID.getUUID() : id,
56 | message: message,
57 | createdAt: createdAt,
58 | updatedAt: updatedAt,
59 | chatId: chatId,
60 | senderId: senderId);
61 | }
62 |
63 | bool equals(Object other) {
64 | return this == other;
65 | }
66 |
67 | @override
68 | bool operator ==(Object other) {
69 | if (identical(other, this)) return true;
70 | return other is Chatdata &&
71 | id == other.id &&
72 | message == other.message &&
73 | createdAt == other.createdAt &&
74 | updatedAt == other.updatedAt &&
75 | chatId == other.chatId &&
76 | senderId == other.senderId;
77 | }
78 |
79 | @override
80 | int get hashCode => toString().hashCode;
81 |
82 | @override
83 | String toString() {
84 | var buffer = new StringBuffer();
85 |
86 | buffer.write("Chatdata {");
87 | buffer.write("id=" + "$id" + ", ");
88 | buffer.write("message=" + "$message" + ", ");
89 | buffer.write("createdAt=" +
90 | (createdAt != null ? createdAt.toString() : "null") +
91 | ", ");
92 | buffer.write("updatedAt=" +
93 | (updatedAt != null ? updatedAt.toString() : "null") +
94 | ", ");
95 | buffer.write("chatId=" + "$chatId" + ", ");
96 | buffer.write("senderId=" + "$senderId");
97 | buffer.write("}");
98 |
99 | return buffer.toString();
100 | }
101 |
102 | Chatdata copyWith(
103 | {String id,
104 | String message,
105 | TemporalTimestamp createdAt,
106 | TemporalTimestamp updatedAt,
107 | String chatId,
108 | String senderId}) {
109 | return Chatdata(
110 | id: id ?? this.id,
111 | message: message ?? this.message,
112 | createdAt: createdAt ?? this.createdAt,
113 | updatedAt: updatedAt ?? this.updatedAt,
114 | chatId: chatId ?? this.chatId,
115 | senderId: senderId ?? this.senderId);
116 | }
117 |
118 | Chatdata.fromJson(Map json)
119 | : id = json['id'],
120 | message = json['message'],
121 | createdAt = json['createdAt'] != null
122 | ? TemporalTimestamp.fromSeconds(json['createdAt'])
123 | : null,
124 | updatedAt = json['updatedAt'] != null
125 | ? TemporalTimestamp.fromSeconds(json['updatedAt'])
126 | : null,
127 | chatId = json['chatId'],
128 | senderId = json['senderId'];
129 |
130 | Map toJson() => {
131 | 'id': id,
132 | 'message': message,
133 | 'createdAt': createdAt?.toSeconds(),
134 | 'updatedAt': updatedAt?.toSeconds(),
135 | 'chatId': chatId,
136 | 'senderId': senderId
137 | };
138 |
139 | static final QueryField ID = QueryField(fieldName: "chatdata.id");
140 | static final QueryField MESSAGE = QueryField(fieldName: "message");
141 | static final QueryField CREATEDAT = QueryField(fieldName: "createdAt");
142 | static final QueryField UPDATEDAT = QueryField(fieldName: "updatedAt");
143 | static final QueryField CHATID = QueryField(fieldName: "chatId");
144 | static final QueryField SENDERID = QueryField(fieldName: "senderId");
145 | static var schema =
146 | Model.defineSchema(define: (ModelSchemaDefinition modelSchemaDefinition) {
147 | modelSchemaDefinition.name = "Chatdata";
148 | modelSchemaDefinition.pluralName = "Chatdata";
149 |
150 | modelSchemaDefinition.authRules = [
151 | AuthRule(authStrategy: AuthStrategy.PUBLIC, operations: [
152 | ModelOperation.CREATE,
153 | ModelOperation.UPDATE,
154 | ModelOperation.DELETE,
155 | ModelOperation.READ
156 | ])
157 | ];
158 |
159 | modelSchemaDefinition.addField(ModelFieldDefinition.id());
160 |
161 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
162 | key: Chatdata.MESSAGE,
163 | isRequired: false,
164 | ofType: ModelFieldType(ModelFieldTypeEnum.string)));
165 |
166 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
167 | key: Chatdata.CREATEDAT,
168 | isRequired: false,
169 | ofType: ModelFieldType(ModelFieldTypeEnum.timestamp)));
170 |
171 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
172 | key: Chatdata.UPDATEDAT,
173 | isRequired: false,
174 | ofType: ModelFieldType(ModelFieldTypeEnum.timestamp)));
175 |
176 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
177 | key: Chatdata.CHATID,
178 | isRequired: false,
179 | ofType: ModelFieldType(ModelFieldTypeEnum.string)));
180 |
181 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
182 | key: Chatdata.SENDERID,
183 | isRequired: false,
184 | ofType: ModelFieldType(ModelFieldTypeEnum.string)));
185 | });
186 | }
187 |
188 | class ChatdataType extends ModelType {
189 | const ChatdataType();
190 |
191 | @override
192 | Chatdata fromJson(Map jsonData) {
193 | return Chatdata.fromJson(jsonData);
194 | }
195 | }
196 |
--------------------------------------------------------------------------------
/lib/models/ModelProvider.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 |
16 | // ignore_for_file: public_member_api_docs
17 |
18 | import 'package:amplify_datastore_plugin_interface/amplify_datastore_plugin_interface.dart';
19 | import 'Chatdata.dart';
20 | import 'Users.dart';
21 |
22 | export 'Chatdata.dart';
23 | export 'Users.dart';
24 |
25 | class ModelProvider implements ModelProviderInterface {
26 | @override
27 | String version = "5dfd86f8531f44b70423917b3da919d5";
28 | @override
29 | List modelSchemas = [Chatdata.schema, Users.schema];
30 | static final ModelProvider _instance = ModelProvider();
31 |
32 | static ModelProvider get instance => _instance;
33 |
34 | ModelType getModelTypeByModelName(String modelName) {
35 | switch (modelName) {
36 | case "Chatdata":
37 | {
38 | return Chatdata.classType;
39 | }
40 | break;
41 | case "Users":
42 | {
43 | return Users.classType;
44 | }
45 | break;
46 | default:
47 | {
48 | throw Exception(
49 | "Failed to find model in model provider for model name: " +
50 | modelName);
51 | }
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/lib/models/Users.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 |
16 | // ignore_for_file: public_member_api_docs
17 |
18 | import 'package:amplify_datastore_plugin_interface/amplify_datastore_plugin_interface.dart';
19 | import 'package:collection/collection.dart';
20 | import 'package:flutter/foundation.dart';
21 |
22 | /** This is an auto generated class representing the Users type in your schema. */
23 | @immutable
24 | class Users extends Model {
25 | static const classType = const UsersType();
26 | final String id;
27 | final String username;
28 | final String email;
29 | final String bio;
30 | final String profileImage;
31 | final bool isVerified;
32 | final TemporalTimestamp createdAt;
33 | final List chats;
34 |
35 | @override
36 | getInstanceType() => classType;
37 |
38 | @override
39 | String getId() {
40 | return id;
41 | }
42 |
43 | const Users._internal(
44 | {@required this.id,
45 | this.username,
46 | this.email,
47 | this.bio,
48 | this.profileImage,
49 | this.isVerified,
50 | this.createdAt,
51 | this.chats});
52 |
53 | factory Users(
54 | {String id,
55 | String username,
56 | String email,
57 | String bio,
58 | String profileImage,
59 | bool isVerified,
60 | TemporalTimestamp createdAt,
61 | List chats}) {
62 | return Users._internal(
63 | id: id == null ? UUID.getUUID() : id,
64 | username: username,
65 | email: email,
66 | bio: bio,
67 | profileImage: profileImage,
68 | isVerified: isVerified,
69 | createdAt: createdAt,
70 | chats: chats != null ? List.unmodifiable(chats) : chats);
71 | }
72 |
73 | bool equals(Object other) {
74 | return this == other;
75 | }
76 |
77 | @override
78 | bool operator ==(Object other) {
79 | if (identical(other, this)) return true;
80 | return other is Users &&
81 | id == other.id &&
82 | username == other.username &&
83 | email == other.email &&
84 | bio == other.bio &&
85 | profileImage == other.profileImage &&
86 | isVerified == other.isVerified &&
87 | createdAt == other.createdAt &&
88 | DeepCollectionEquality().equals(chats, other.chats);
89 | }
90 |
91 | @override
92 | int get hashCode => toString().hashCode;
93 |
94 | @override
95 | String toString() {
96 | var buffer = new StringBuffer();
97 |
98 | buffer.write("Users {");
99 | buffer.write("id=" + "$id" + ", ");
100 | buffer.write("username=" + "$username" + ", ");
101 | buffer.write("email=" + "$email" + ", ");
102 | buffer.write("bio=" + "$bio" + ", ");
103 | buffer.write("profileImage=" + "$profileImage" + ", ");
104 | buffer.write("isVerified=" +
105 | (isVerified != null ? isVerified.toString() : "null") +
106 | ", ");
107 | buffer.write("createdAt=" +
108 | (createdAt != null ? createdAt.toString() : "null") +
109 | ", ");
110 | buffer.write("chats=" + (chats != null ? chats.toString() : "null"));
111 | buffer.write("}");
112 |
113 | return buffer.toString();
114 | }
115 |
116 | Users copyWith(
117 | {String id,
118 | String username,
119 | String email,
120 | String bio,
121 | String profileImage,
122 | bool isVerified,
123 | TemporalTimestamp createdAt,
124 | List chats}) {
125 | return Users(
126 | id: id ?? this.id,
127 | username: username ?? this.username,
128 | email: email ?? this.email,
129 | bio: bio ?? this.bio,
130 | profileImage: profileImage ?? this.profileImage,
131 | isVerified: isVerified ?? this.isVerified,
132 | createdAt: createdAt ?? this.createdAt,
133 | chats: chats ?? this.chats);
134 | }
135 |
136 | Users.fromJson(Map json)
137 | : id = json['id'],
138 | username = json['username'],
139 | email = json['email'],
140 | bio = json['bio'],
141 | profileImage = json['profileImage'],
142 | isVerified = json['isVerified'],
143 | createdAt = json['createdAt'] != null
144 | ? TemporalTimestamp.fromSeconds(json['createdAt'])
145 | : null,
146 | chats = json['chats']?.cast();
147 |
148 | Map toJson() => {
149 | 'id': id,
150 | 'username': username,
151 | 'email': email,
152 | 'bio': bio,
153 | 'profileImage': profileImage,
154 | 'isVerified': isVerified,
155 | 'createdAt': createdAt?.toSeconds(),
156 | 'chats': chats
157 | };
158 |
159 | static final QueryField ID = QueryField(fieldName: "users.id");
160 | static final QueryField USERNAME = QueryField(fieldName: "username");
161 | static final QueryField EMAIL = QueryField(fieldName: "email");
162 | static final QueryField BIO = QueryField(fieldName: "bio");
163 | static final QueryField PROFILEIMAGE = QueryField(fieldName: "profileImage");
164 | static final QueryField ISVERIFIED = QueryField(fieldName: "isVerified");
165 | static final QueryField CREATEDAT = QueryField(fieldName: "createdAt");
166 | static final QueryField CHATS = QueryField(fieldName: "chats");
167 | static var schema =
168 | Model.defineSchema(define: (ModelSchemaDefinition modelSchemaDefinition) {
169 | modelSchemaDefinition.name = "Users";
170 | modelSchemaDefinition.pluralName = "Users";
171 |
172 | modelSchemaDefinition.authRules = [
173 | AuthRule(authStrategy: AuthStrategy.PUBLIC, operations: [
174 | ModelOperation.CREATE,
175 | ModelOperation.UPDATE,
176 | ModelOperation.DELETE,
177 | ModelOperation.READ
178 | ])
179 | ];
180 |
181 | modelSchemaDefinition.addField(ModelFieldDefinition.id());
182 |
183 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
184 | key: Users.USERNAME,
185 | isRequired: false,
186 | ofType: ModelFieldType(ModelFieldTypeEnum.string)));
187 |
188 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
189 | key: Users.EMAIL,
190 | isRequired: false,
191 | ofType: ModelFieldType(ModelFieldTypeEnum.string)));
192 |
193 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
194 | key: Users.BIO,
195 | isRequired: false,
196 | ofType: ModelFieldType(ModelFieldTypeEnum.string)));
197 |
198 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
199 | key: Users.PROFILEIMAGE,
200 | isRequired: false,
201 | ofType: ModelFieldType(ModelFieldTypeEnum.string)));
202 |
203 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
204 | key: Users.ISVERIFIED,
205 | isRequired: false,
206 | ofType: ModelFieldType(ModelFieldTypeEnum.bool)));
207 |
208 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
209 | key: Users.CREATEDAT,
210 | isRequired: false,
211 | ofType: ModelFieldType(ModelFieldTypeEnum.timestamp)));
212 |
213 | modelSchemaDefinition.addField(ModelFieldDefinition.field(
214 | key: Users.CHATS,
215 | isRequired: false,
216 | isArray: true,
217 | ofType: ModelFieldType(ModelFieldTypeEnum.collection,
218 | ofModelName: describeEnum(ModelFieldTypeEnum.string))));
219 | });
220 | }
221 |
222 | class UsersType extends ModelType {
223 | const UsersType();
224 |
225 | @override
226 | Users fromJson(Map jsonData) {
227 | return Users.fromJson(jsonData);
228 | }
229 | }
230 |
--------------------------------------------------------------------------------
/lib/repositories/chat_repository.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
4 | import 'package:amplify_datastore/amplify_datastore.dart';
5 | import 'package:amplify_flutter/amplify.dart';
6 | import 'package:flutter/material.dart';
7 | import 'package:flutter_amplify_demo/models/ChatData.dart';
8 | import 'package:flutter_amplify_demo/models/Users.dart';
9 | import 'package:flutter_amplify_demo/stores/user.dart';
10 | import 'package:uuid/uuid.dart';
11 |
12 | class ChartRepository {
13 | Future addUserToChatList({Users otherUser}) async {
14 | AuthUser authUser = await Amplify.Auth.getCurrentUser();
15 | Users user = (await Amplify.DataStore.query(Users.classType,
16 | where: Users.ID.eq(authUser.userId)))[0];
17 | String chatId = Uuid().v4();
18 | Map updateChatData = {
19 | 'chatId': chatId,
20 | "otherUserId": otherUser.id,
21 | 'otherUserProfileImage': otherUser.profileImage,
22 | 'otherUserName': otherUser.username,
23 | };
24 |
25 | List tempJsonData =
26 | new List.from(user.chats == null ? [] : user.chats);
27 | tempJsonData.add(json.encode(updateChatData));
28 | Users updatedUser = user.copyWith(chats: tempJsonData);
29 | await Amplify.DataStore.save(updatedUser);
30 |
31 | Map otherUserChatData = {
32 | 'chatId': chatId,
33 | "otherUserId": user.id,
34 | 'otherUserProfileImage': user.profileImage,
35 | 'otherUserName': user.username,
36 | };
37 |
38 | List tempOtherUserJsonData =
39 | new List.from(otherUser.chats == null ? [] : otherUser.chats);
40 | tempOtherUserJsonData.add(json.encode(otherUserChatData));
41 | Users updatedOtherUser = otherUser.copyWith(chats: tempOtherUserJsonData);
42 | await Amplify.DataStore.save(updatedOtherUser);
43 | }
44 |
45 | Future>> getUserChatList() async {
46 | try {
47 | List