├── android
├── settings_aar.gradle
├── gradle.properties
├── .gitignore
├── app
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── launcher_icon.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── launcher_icon.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── launcher_icon.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── launcher_icon.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── launcher_icon.png
│ │ │ │ ├── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ │ └── values
│ │ │ │ │ └── styles.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── parthpanchal
│ │ │ │ │ └── sharespace
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── AndroidManifest.xml
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ └── profile
│ │ │ └── AndroidManifest.xml
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── settings.gradle
└── build.gradle
├── ios
├── Flutter
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── AppFrameworkInfo.plist
├── Runner
│ ├── Runner-Bridging-Header.h
│ ├── Assets.xcassets
│ │ ├── LaunchImage.imageset
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ └── AppIcon.appiconset
│ │ │ ├── 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-50x50@1x.png
│ │ │ ├── Icon-App-50x50@2x.png
│ │ │ ├── Icon-App-57x57@1x.png
│ │ │ ├── Icon-App-57x57@2x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-72x72@1x.png
│ │ │ ├── Icon-App-72x72@2x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── Main.storyboard
│ │ └── LaunchScreen.storyboard
│ └── Info.plist
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── WorkspaceSettings.xcsettings
│ │ └── IDEWorkspaceChecks.plist
├── Runner.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
└── .gitignore
├── assets
├── images
│ ├── chill.png
│ ├── empty.png
│ ├── friends.png
│ ├── noUser.png
│ ├── welcome.png
│ ├── app_icon.png
│ ├── girl_comp.png
│ ├── profile_icon.png
│ └── pablo-friendship.png
├── flares
│ └── animation.flr
└── fonts
│ ├── Aileron-Black.otf
│ ├── Aileron-Bold.otf
│ ├── Aileron-Italic.otf
│ ├── Aileron-Regular.otf
│ ├── Aileron-SemiBold.otf
│ └── ProductSans-Medium.ttf
├── Screenshots
├── SHARE SPACE.png
├── LogIN_framed.png
└── SignUp_framed.png
├── lib
├── services
│ ├── firestore_path.dart
│ ├── image_picker.dart
│ ├── push_notification-_service.dart
│ ├── firebase_storage.dart
│ ├── api.dart
│ ├── database.dart
│ └── Authenticate.dart
├── values
│ ├── decoration.dart
│ ├── values.dart
│ ├── styles.dart
│ ├── strings.dart
│ ├── gradients.dart
│ ├── borders.dart
│ ├── colors.dart
│ └── sizes.dart
├── models
│ ├── joke.dart
│ ├── Post.dart
│ ├── user.dart
│ └── dog.dart
├── widgets
│ ├── custom_divider.dart
│ ├── clipShadowPath.dart
│ ├── custom_painters.dart
│ ├── custom_button.dart
│ ├── custom_text_form_field.dart
│ ├── spaces.dart
│ ├── outline_border_2.dart
│ └── custom_shape_clippers.dart
├── Animations
│ └── fade_in.dart
├── screens
│ ├── AuthScreens
│ │ ├── auth.dart
│ │ ├── signUpHome.dart
│ │ ├── login.dart
│ │ └── signUp.dart
│ └── AppScreens
│ │ ├── splashscreen.dart
│ │ ├── about.dart
│ │ ├── dogScreen.dart
│ │ ├── todos.dart
│ │ ├── joke.dart
│ │ ├── AllUsers.dart
│ │ └── NewPost.dart
├── main.dart
└── Router
│ └── routes.dart
├── .metadata
├── .gitignore
├── LICENSE
├── README.md
└── pubspec.yaml
/android/settings_aar.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/assets/images/chill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/chill.png
--------------------------------------------------------------------------------
/assets/images/empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/empty.png
--------------------------------------------------------------------------------
/assets/images/friends.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/friends.png
--------------------------------------------------------------------------------
/assets/images/noUser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/noUser.png
--------------------------------------------------------------------------------
/assets/images/welcome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/welcome.png
--------------------------------------------------------------------------------
/Screenshots/SHARE SPACE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/Screenshots/SHARE SPACE.png
--------------------------------------------------------------------------------
/assets/flares/animation.flr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/flares/animation.flr
--------------------------------------------------------------------------------
/assets/images/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/app_icon.png
--------------------------------------------------------------------------------
/assets/images/girl_comp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/girl_comp.png
--------------------------------------------------------------------------------
/Screenshots/LogIN_framed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/Screenshots/LogIN_framed.png
--------------------------------------------------------------------------------
/Screenshots/SignUp_framed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/Screenshots/SignUp_framed.png
--------------------------------------------------------------------------------
/assets/fonts/Aileron-Black.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/fonts/Aileron-Black.otf
--------------------------------------------------------------------------------
/assets/fonts/Aileron-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/fonts/Aileron-Bold.otf
--------------------------------------------------------------------------------
/assets/images/profile_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/profile_icon.png
--------------------------------------------------------------------------------
/assets/fonts/Aileron-Italic.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/fonts/Aileron-Italic.otf
--------------------------------------------------------------------------------
/assets/fonts/Aileron-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/fonts/Aileron-Regular.otf
--------------------------------------------------------------------------------
/assets/fonts/Aileron-SemiBold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/fonts/Aileron-SemiBold.otf
--------------------------------------------------------------------------------
/assets/fonts/ProductSans-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/fonts/ProductSans-Medium.ttf
--------------------------------------------------------------------------------
/assets/images/pablo-friendship.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/assets/images/pablo-friendship.png
--------------------------------------------------------------------------------
/lib/services/firestore_path.dart:
--------------------------------------------------------------------------------
1 | class FirestorePath {
2 | String user_url(String uid) {
3 | return 'users/$uid';
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-hdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-mdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/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/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parthpanchal123/Share-Space/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/parthpanchal/sharespace/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.parthpanchal.sharespace
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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-5.6.2-all.zip
7 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/lib/services/image_picker.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:image_picker/image_picker.dart';
5 |
6 | class Image_Picker {
7 | Future pickImage({@required ImageSource source}) async {
8 | return ImagePicker.pickImage(source: source);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/lib/values/decoration.dart:
--------------------------------------------------------------------------------
1 | part of 'values.dart';
2 |
3 | class Decorations {
4 | static customBoxDecoration({
5 | double blurRadius = 5,
6 | Color color = const Color(0xFFD6D7FB),
7 | }) {
8 | return BoxDecoration(
9 | boxShadow: [BoxShadow(blurRadius: blurRadius, color: color)]);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.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: e6b34c2b5c96bb95325269a29a84e83ed8909b5f
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/lib/values/values.dart:
--------------------------------------------------------------------------------
1 | library values;
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter/widgets.dart';
5 | import 'package:google_fonts/google_fonts.dart';
6 |
7 | part 'colors.dart';
8 | part 'borders.dart';
9 | part 'sizes.dart';
10 | part 'strings.dart';
11 | part 'styles.dart';
12 | part 'gradients.dart';
13 | part 'decoration.dart';
14 |
--------------------------------------------------------------------------------
/lib/models/joke.dart:
--------------------------------------------------------------------------------
1 | class Joke_Model {
2 | String type, setup, punchline;
3 |
4 | Joke_Model({this.type, this.setup, this.punchline});
5 |
6 | factory Joke_Model.fromJson(Map json) {
7 | return Joke_Model(
8 | type: json['type'] ?? "",
9 | setup: json['setup'] ?? "",
10 | punchline: json['punchline'] ?? "");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/lib/models/Post.dart:
--------------------------------------------------------------------------------
1 | class Post {
2 | String todo, desc, link, category;
3 |
4 | Post({this.todo, this.desc, this.link, this.category});
5 |
6 | Map toMap(String todo, String desc, String link, String category) {
7 | return ({'todo': todo, 'desc': desc, 'link': link, 'category': category});
8 | }
9 |
10 | factory Post.fromJson(Map post_json) {
11 | return Post(todo: post_json['todo'], desc: post_json['desc'], link: post_json['link'], category: post_json['category']);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/lib/models/user.dart:
--------------------------------------------------------------------------------
1 | class User {
2 | String uid, photoUrl, displayName, email, status, memberSince;
3 |
4 | User({this.uid, this.displayName, this.email, this.photoUrl, this.status, this.memberSince});
5 |
6 | factory User.fromJson(Map user_json) {
7 | return User(
8 | uid: user_json['uid'],
9 | displayName: user_json['displayName'],
10 | email: user_json['email'],
11 | status: user_json['status'],
12 | photoUrl: user_json['photoUrl'] ?? "",
13 | memberSince: user_json['memberSince']);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/lib/widgets/custom_divider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:random_Fun/values/values.dart';
3 |
4 | class CustomDivider extends StatelessWidget {
5 | CustomDivider({
6 | this.width = Sizes.WIDTH_80,
7 | this.height = Sizes.HEIGHT_1,
8 | this.color = AppColors.white,
9 | });
10 |
11 | final double width;
12 | final double height;
13 | final Color color;
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return Container(
18 | width: width,
19 | height: height,
20 | color: color,
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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:3.5.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | classpath 'com.google.gms:google-services:4.3.3'
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | google()
18 | jcenter()
19 | }
20 | }
21 |
22 | rootProject.buildDir = '../build'
23 | subprojects {
24 | project.buildDir = "${rootProject.buildDir}/${project.name}"
25 | }
26 | subprojects {
27 | project.evaluationDependsOn(':app')
28 | }
29 |
30 | task clean(type: Delete) {
31 | delete rootProject.buildDir
32 | }
33 |
--------------------------------------------------------------------------------
/lib/services/push_notification-_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:firebase_messaging/firebase_messaging.dart';
4 |
5 | class PushNotificationService {
6 | final FirebaseMessaging _fcm = FirebaseMessaging();
7 |
8 | Future init() {
9 | if (Platform.isIOS) {
10 | _fcm.requestNotificationPermissions(IosNotificationSettings());
11 | }
12 |
13 | _fcm.configure(onMessage: (Map message) async {
14 | print('onMessage : $message');
15 | }, onLaunch: (Map message) async {
16 | print('onMessage : $message');
17 |
18 | // navigateTo(message);
19 | }, onResume: (Map message) async {
20 | print('onMessage : $message');
21 | // navigateTo(message);
22 | });
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lib/values/styles.dart:
--------------------------------------------------------------------------------
1 | part of 'values.dart';
2 |
3 | class Styles {
4 | static TextStyle customTextStyle({
5 | Color color = AppColors.blackShade3,
6 | FontWeight fontWeight = FontWeight.w600,
7 | double fontSize = Sizes.TEXT_SIZE_14,
8 | FontStyle fontStyle: FontStyle.normal,
9 | }) {
10 | return GoogleFonts.lato(
11 | fontSize: fontSize,
12 | color: color,
13 | fontWeight: fontWeight,
14 | fontStyle: fontStyle,
15 | );
16 | }
17 |
18 | static TextStyle customTextStyle2({
19 | Color color = AppColors.blackShade7,
20 | FontWeight fontWeight = FontWeight.w600,
21 | double fontSize = Sizes.TEXT_SIZE_16,
22 | FontStyle fontStyle: FontStyle.normal,
23 | }) {
24 | return GoogleFonts.comfortaa(
25 | fontSize: fontSize,
26 | color: color,
27 | fontWeight: fontWeight,
28 | fontStyle: fontStyle,
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/lib/services/firebase_storage.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:cloud_firestore/cloud_firestore.dart';
4 | import 'package:firebase_storage/firebase_storage.dart';
5 | import 'package:random_Fun/services/firestore_path.dart';
6 |
7 | class Storage {
8 | Future uploadProfileImage(File file, String uid) async {
9 | String path = FirestorePath().user_url(uid) + '/avatar.png';
10 |
11 | StorageReference ref = FirebaseStorage.instance.ref().child(path);
12 | final uploadTask =
13 | ref.putFile(file, StorageMetadata(contentType: 'image/png'));
14 | final snapshot = await uploadTask.onComplete;
15 | if (snapshot.error != null) {
16 | print('upload error code: ${snapshot.error}');
17 | throw snapshot.error;
18 | }
19 | final downloadUrl = await snapshot.ref.getDownloadURL();
20 | print('downloadUrl: $downloadUrl');
21 | return downloadUrl;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
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 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | *.json
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
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 | #key propertiies file
38 | key.properties
39 |
40 | #outputs folder
41 | build
42 |
43 | #ads file
44 | donate.dart
45 |
46 | # Symbolication related
47 | app.*.symbols
48 |
49 | # Obfuscation related
50 | app.*.map.json
51 |
52 | # Exceptions to above rules.
53 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
54 |
--------------------------------------------------------------------------------
/lib/Animations/fade_in.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:simple_animations/simple_animations.dart';
3 |
4 | class FadeAnimation extends StatelessWidget {
5 | final double delay;
6 | final Widget child;
7 |
8 | FadeAnimation(this.delay, this.child);
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | final tween = MultiTrackTween(
13 | [Track("opacity").add(Duration(milliseconds: 500), Tween(begin: 0.0, end: 1.0)), Track("translateY").add(Duration(milliseconds: 500), Tween(begin: -130.0, end: 0.0), curve: Curves.easeOut)]);
14 |
15 | return ControlledAnimation(
16 | delay: Duration(milliseconds: (500 * delay).round()),
17 | duration: tween.duration,
18 | tween: tween,
19 | child: child,
20 | builderWithChild: (context, child, animation) => Opacity(
21 | opacity: animation["opacity"],
22 | child: Transform.translate(offset: Offset(0, animation["translateY"]), child: child),
23 | ),
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2020 Parth Panchal
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/lib/widgets/clipShadowPath.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | @immutable
4 | class ClipShadowPath extends StatelessWidget {
5 | final Shadow shadow;
6 | final CustomClipper clipper;
7 | final Widget child;
8 |
9 | ClipShadowPath({
10 | @required this.shadow,
11 | @required this.clipper,
12 | @required this.child,
13 | });
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return CustomPaint(
18 | painter: _ClipShadowPainter(
19 | clipper: this.clipper,
20 | shadow: this.shadow,
21 | ),
22 | child: ClipPath(child: child, clipper: this.clipper),
23 | );
24 | }
25 | }
26 |
27 | class _ClipShadowPainter extends CustomPainter {
28 | final Shadow shadow;
29 | final CustomClipper clipper;
30 |
31 | _ClipShadowPainter({@required this.shadow, @required this.clipper});
32 |
33 | @override
34 | void paint(Canvas canvas, Size size) {
35 | var paint = shadow.toPaint();
36 | var clipPath = clipper.getClip(size).shift(shadow.offset);
37 | canvas.drawPath(clipPath, paint);
38 | }
39 |
40 | @override
41 | bool shouldRepaint(CustomPainter oldDelegate) {
42 | return true;
43 | }
44 | }
--------------------------------------------------------------------------------
/lib/screens/AuthScreens/auth.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:provider/provider.dart';
3 | import 'package:random_Fun/models/user.dart';
4 | import 'package:random_Fun/screens/AuthScreens/signUpHome.dart';
5 | import 'package:random_Fun/screens/homeScreen.dart';
6 | import 'package:random_Fun/services/Authenticate.dart';
7 |
8 | class AuthWidget extends StatefulWidget {
9 | @override
10 | _AuthWidgetState createState() => _AuthWidgetState();
11 | }
12 |
13 | class _AuthWidgetState extends State {
14 | @override
15 | void initState() {
16 | super.initState();
17 | }
18 |
19 | @override
20 | Widget build(BuildContext context) {
21 | final _auth = Provider.of(context);
22 |
23 | return StreamBuilder(
24 | stream: _auth.onStateChanged,
25 | builder: (context, AsyncSnapshot snapshot) {
26 | if (snapshot.hasData) {
27 | final user = snapshot.data;
28 | if (user != null) {
29 | return Provider.value(
30 | value: user,
31 | child: HomeScreen(),
32 | );
33 | } else {
34 | return SignUpHome();
35 | }
36 | } else {
37 | return SignUpHome();
38 | }
39 | },
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/services/api.dart:
--------------------------------------------------------------------------------
1 | import 'package:random_Fun/models/dog.dart';
2 | import 'package:random_Fun/models/joke.dart';
3 | import 'dart:convert' as convert;
4 | import 'package:http/http.dart' as http;
5 |
6 | class Api {
7 | List jokes = [];
8 | List dogs_images = [];
9 | Future> getJoke() async {
10 | var url = "https://official-joke-api.appspot.com/jokes/ten";
11 | try {
12 | var response = await http.get(url);
13 | if (response.statusCode == 200) {
14 | var jokes_data = convert.jsonDecode(response.body);
15 |
16 | jokes_data.forEach((joke) => {jokes.add(Joke_Model.fromJson(joke))});
17 | }
18 | return jokes;
19 | } catch (e) {
20 | print(e.toString());
21 | return Future.error(e.toString());
22 | }
23 | }
24 |
25 | Future getDogs(int breed) async {
26 | var url = "https://dog.ceo/api/breed/${Dog().breeds[breed]}/images";
27 | try {
28 | var response = await http.get(url);
29 | if (response.statusCode == 200) {
30 | var dogs_data = convert.jsonDecode(response.body);
31 |
32 | dogs_data['message'].forEach((dog_img) => {dogs_images.add(dog_img)});
33 | }
34 | return dogs_images;
35 | } catch (e) {
36 | print(e.toString());
37 | return Future.error(e.toString());
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:random_Fun/Router/routes.dart';
3 | import 'package:random_Fun/screens/AppScreens/splashscreen.dart';
4 | import 'package:random_Fun/screens/AuthScreens/auth.dart';
5 | import 'package:provider/provider.dart';
6 | import 'package:random_Fun/services/Authenticate.dart';
7 | import 'package:random_Fun/services/api.dart';
8 | import 'package:random_Fun/services/database.dart';
9 | import 'package:random_Fun/services/firebase_storage.dart';
10 | import 'package:random_Fun/services/image_picker.dart';
11 | import 'package:random_Fun/services/push_notification-_service.dart';
12 |
13 | void main() {
14 | runApp(MultiProvider(
15 | providers: [
16 | Provider(create: (_) => Authenticate()),
17 | Provider(create: (_) => Api()),
18 | Provider(
19 | create: (_) => Database(),
20 | ),
21 | Provider(create: (_) => Image_Picker()),
22 | Provider(create: (_) => Storage()),
23 | Provider(create: (_) => PushNotificationService())
24 | ],
25 | child: MaterialApp(
26 | debugShowCheckedModeBanner: false,
27 | theme: ThemeData(primaryColor: Colors.black, accentColor: Color(0xff212121), fontFamily: 'Aileron'),
28 | routes: routes,
29 | home: SplashScreen(),
30 | ),
31 | ));
32 | }
33 |
--------------------------------------------------------------------------------
/lib/Router/routes.dart:
--------------------------------------------------------------------------------
1 | import 'package:random_Fun/screens/AppScreens/AllUsers.dart';
2 | import 'package:random_Fun/screens/AppScreens/NewPost.dart';
3 | import 'package:random_Fun/screens/AppScreens/about.dart';
4 | import 'package:random_Fun/screens/AppScreens/dogScreen.dart';
5 | import 'package:random_Fun/screens/AppScreens/donate.dart';
6 | import 'package:random_Fun/screens/AppScreens/joke.dart';
7 | import 'package:random_Fun/screens/AppScreens/todos.dart';
8 | import 'package:random_Fun/screens/AppScreens/userProfile.dart';
9 | import 'package:random_Fun/screens/AuthScreens/auth.dart';
10 | import 'package:random_Fun/screens/AuthScreens/login.dart';
11 | import 'package:random_Fun/screens/AuthScreens/signUp.dart';
12 | import 'package:random_Fun/screens/AuthScreens/signUpHome.dart';
13 | import 'package:random_Fun/screens/homeScreen.dart';
14 |
15 | final routes = {
16 | '/home': (context) => HomeScreen(),
17 | '/initial': (context) => AuthWidget(),
18 | '/login': (context) => LoginScreen(),
19 | 'signUp': (context) => SignUp(),
20 | '/signUpHome': (context) => SignUpHome(),
21 | '/profile': (context) => UserProfile(),
22 | '/joke': (context) => Joke(),
23 | '/newPost': (context) => NewPost(),
24 | '/allUsers': (context) => AllUsers(),
25 | '/dog': (context) => DogScreen(),
26 | '/todo': (context) => Todo(),
27 | '/about': (context) => About(),
28 | '/donate': (context) => Donate(),
29 | };
30 |
--------------------------------------------------------------------------------
/lib/widgets/custom_painters.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:random_Fun/values/values.dart';
5 |
6 | class DrawCircle extends CustomPainter {
7 | DrawCircle({
8 | @required this.radius,
9 | @required this.offset,
10 | @required this.color,
11 | this.elevation = Sizes.ELEVATION_8,
12 | this.transparentOccluder = true,
13 | this.shadowColor,
14 | this.hasShadow = false,
15 | this.shadowOffset = Sizes.SIZE_1,
16 | }) {
17 | _paint = Paint()
18 | ..color = color
19 | ..strokeWidth = 10.0
20 | ..style = PaintingStyle.fill;
21 | }
22 |
23 | final double radius;
24 | final Offset offset;
25 | final Color color;
26 | final double elevation;
27 | final bool transparentOccluder;
28 | final bool hasShadow;
29 | final Color shadowColor;
30 | final double shadowOffset;
31 | Paint _paint;
32 |
33 | @override
34 | void paint(Canvas canvas, Size size) {
35 | if (hasShadow) {
36 | Path oval = Path()
37 | ..addOval(
38 | Rect.fromCircle(center: offset, radius: radius + shadowOffset));
39 |
40 | canvas.drawShadow(oval, shadowColor ?? Colors.black.withOpacity(0.7),
41 | elevation, transparentOccluder);
42 | }
43 |
44 | canvas.drawCircle(offset, radius, _paint);
45 | }
46 |
47 | @override
48 | bool shouldRepaint(CustomPainter oldDelegate) {
49 | return false;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/lib/values/strings.dart:
--------------------------------------------------------------------------------
1 | part of values;
2 |
3 | class StringConst {
4 | //strings
5 |
6 | static const String WELCOME = "Welcome ,";
7 | static const String WELCOME_BACK = "Welcome back,";
8 | static const String REGISTER = "Register";
9 | static const String SIGN_IN_MSG = "Hey! Good to see you again.";
10 | static const String SIGN_UP_MSG = "We are happy to see you here!";
11 |
12 | static const String LOG_IN_2 = "Login";
13 | static const String LOG_IN_5 = "Log In !";
14 | static const String SIGN_UP_2 = "Sign Up !";
15 | static const String SIGN_UP_3 = "Sign Up !";
16 | static const String EASY_SIGN_UP = "It's easier to sign up now";
17 |
18 | //hint_text
19 | static const String USER_DISPLAY_NAME = "Display Name";
20 | static const String EMAIL_ADDRESS = "Email Address";
21 | static const String PASSWORD = "Password";
22 |
23 | //Buttons
24 | static const String SIGN_ME_UP = "Sign me up !";
25 | static const String CONTINUE_WITH_GOOGLE = "Continue with Google";
26 | static const String USE_EMAIL = "I'll use email !";
27 |
28 | static const String ALREADY_HAVE_AN_ACCOUNT = "Already have an account? ";
29 | static const String DONT_HAVE_AN_ACCOUNT = "Don't have an account ? ";
30 |
31 | static const String Profile = 'Profile';
32 | static const String SignOut = 'Sign out';
33 |
34 | static const List menuChoices = [Profile, SignOut];
35 | static const String policy = "https://docs.google.com/document/d/1kVf3bC0TY6dbcyIsjh4PS_OrNtuchJqcI4yzxflhYEI/edit?usp=sharing";
36 | }
37 |
--------------------------------------------------------------------------------
/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 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | random_Fun
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/lib/widgets/custom_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:random_Fun/values/values.dart';
3 | import 'package:random_Fun/widgets/spaces.dart';
4 |
5 | class CustomButton extends StatelessWidget {
6 | CustomButton({
7 | this.title,
8 | this.onPressed,
9 | // this.width = Sizes.WIDTH_150,
10 | this.height = Sizes.HEIGHT_50,
11 | this.elevation = Sizes.ELEVATION_1,
12 | this.borderRadius = Sizes.RADIUS_24,
13 | this.color = AppColors.blackShade5,
14 | this.borderSide = Borders.defaultPrimaryBorder,
15 | this.textStyle,
16 | this.icon,
17 | this.hasIcon = false,
18 | });
19 |
20 | final VoidCallback onPressed;
21 | // final double width;
22 | final double height;
23 | final double elevation;
24 | final double borderRadius;
25 | final String title;
26 | final Color color;
27 | final BorderSide borderSide;
28 | final TextStyle textStyle;
29 | final Widget icon;
30 | final bool hasIcon;
31 |
32 | @override
33 | Widget build(BuildContext context) {
34 | return MaterialButton(
35 | onPressed: onPressed,
36 | elevation: elevation,
37 | // minWidth: width ?? MediaQuery.of(context).size.width,
38 | shape: RoundedRectangleBorder(
39 | borderRadius: BorderRadius.circular(borderRadius),
40 | side: borderSide,
41 | ),
42 |
43 | height: height,
44 | color: color,
45 | child: Row(
46 | mainAxisAlignment: MainAxisAlignment.center,
47 | children: [
48 | hasIcon ? icon : Container(),
49 | hasIcon ? SpaceW8() : Container(),
50 | title != null
51 | ? Text(
52 | title,
53 | style: textStyle,
54 | )
55 | : Container(),
56 | ],
57 | ),
58 | );
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/lib/models/dog.dart:
--------------------------------------------------------------------------------
1 | class Dog {
2 | List breeds = [
3 | 'affenpinscher',
4 | 'african',
5 | 'airedale',
6 | 'akita',
7 | 'appenzeller',
8 | 'australian',
9 | 'basenji',
10 | 'beagle',
11 | 'bluetick',
12 | 'borzoi',
13 | 'bouvier',
14 | 'boxer',
15 | 'brabancon',
16 | 'briard',
17 | 'buhund',
18 | 'bulldog',
19 | 'bullterrier',
20 | 'cairn',
21 | 'cattledog',
22 | 'chihuahua',
23 | 'chow',
24 | 'clumber',
25 | 'cockapoo',
26 | 'collie',
27 | 'coonhound',
28 | 'corgi',
29 | 'cotondetulear',
30 | 'dachshund',
31 | 'dalmatian',
32 | 'dane',
33 | 'deerhound',
34 | 'dhole',
35 | 'dingo',
36 | 'doberman',
37 | 'elkhound',
38 | 'entlebucher',
39 | 'eskimo',
40 | 'finnish',
41 | 'frise',
42 | 'germanshepherd',
43 | 'greyhound',
44 | 'groenendael',
45 | 'havanese',
46 | 'hound',
47 | 'husky',
48 | 'keeshond',
49 | 'kelpie',
50 | 'komondor',
51 | 'kuvasz',
52 | 'labrador',
53 | 'leonberg',
54 | 'lhasa',
55 | 'malamute',
56 | 'malinois',
57 | 'maltese',
58 | 'mastiff',
59 | 'mexicanhairless',
60 | 'mix',
61 | 'mountain',
62 | 'newfoundland',
63 | 'otterhound',
64 | 'ovcharka',
65 | 'papillon',
66 | 'pekinese',
67 | 'pembroke',
68 | 'pinscher',
69 | 'pitbull',
70 | 'pointer',
71 | 'pomeranian',
72 | 'poodle',
73 | 'pug',
74 | 'puggle',
75 | 'pyrenees',
76 | 'redbone',
77 | 'retriever',
78 | 'ridgeback',
79 | 'rottweiler',
80 | 'saluki',
81 | 'samoyed',
82 | 'schipperke',
83 | 'schnauzer',
84 | 'setter',
85 | 'sheepdog',
86 | 'shiba',
87 | 'shihtzu',
88 | 'spaniel',
89 | 'springer',
90 | 'stbernard',
91 | 'terrier',
92 | 'vizsla',
93 | 'waterdog',
94 | 'weimaraner',
95 | 'whippet',
96 | 'wolfhound'
97 | ];
98 | }
99 |
--------------------------------------------------------------------------------
/lib/values/gradients.dart:
--------------------------------------------------------------------------------
1 | part of values;
2 |
3 | //enum GradientColors { curvesGradient0, curvesGradient1, curvesGradient2, curvesGradient3, curvesGradient4 }
4 |
5 | List GradientColors = [Gradients.curvesGradient0, Gradients.curvesGradient1, Gradients.curvesGradient2, Gradients.curvesGradient3, Gradients.curvesGradient4];
6 |
7 | class Gradients {
8 | static const LinearGradient buttonGradient = LinearGradient(
9 | begin: Alignment.centerLeft,
10 | end: Alignment.centerRight,
11 | colors: [
12 | AppColors.green,
13 | AppColors.greenShade1,
14 | ],
15 | );
16 |
17 | static const LinearGradient curvesGradient0 = LinearGradient(
18 | begin: Alignment.centerLeft,
19 | end: Alignment.centerRight,
20 | colors: [
21 | Color(0xff12c2e9),
22 | Color(0xffc471ed),
23 | Color(0xfff64f59),
24 | ],
25 | );
26 |
27 | static const LinearGradient curvesGradient1 = LinearGradient(
28 | colors: [
29 | AppColors.orange,
30 | AppColors.orangeShade1,
31 | AppColors.deepOrange,
32 | ],
33 | );
34 |
35 | static const LinearGradient curvesGradient2 = LinearGradient(
36 | colors: [
37 | Color(0xff4e54c8),
38 | Color(0xff4e54c8),
39 | ],
40 | );
41 |
42 | static const LinearGradient curvesGradient3 = LinearGradient(
43 | begin: Alignment.topLeft,
44 | end: Alignment.bottomRight,
45 | colors: [
46 | Color(0xff0f0c29),
47 | Color(0xFF302b63),
48 | Color(0xFF24243e),
49 | ],
50 | );
51 |
52 | static const LinearGradient curvesGradient4 = LinearGradient(
53 | begin: Alignment.centerLeft,
54 | end: Alignment.centerRight,
55 | colors: [
56 | Color(0xff4e54c8),
57 | Color(0xff8f94fb),
58 | ],
59 | );
60 |
61 | static const Gradient headerOverlayGradient = LinearGradient(
62 | begin: Alignment(0.51436, 1.07565),
63 | end: Alignment(0.51436, -0.03208),
64 | stops: [
65 | 0,
66 | 0.17571,
67 | 1,
68 | ],
69 | colors: [
70 | Color.fromARGB(255, 0, 0, 0),
71 | Color.fromARGB(255, 8, 8, 8),
72 | Color.fromARGB(105, 45, 45, 45),
73 | ],
74 | );
75 | }
76 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Share Space : A fun social platform to fight boredom .
2 |
3 | [](https://opensource.org/licenses/MIT)
4 | 
5 | 
6 | 
7 | 
8 |
9 | 
10 |
11 | Share Space is a social app where you and your friends can suggest some interesting things to do in this quarantine like watching some film/series or reading an interesting book, listening to some good music or any other interesting activity .
12 |
13 |
14 |
15 | **How does Share Space work ?**
16 |
17 | • **_Getting Started_** : You can either sign-up through email and password or use your Google account to sign-in.
18 |
19 | • **_Update your profile picture and status_** : You can select any photo stored in your phone and update it as your profile picture and update your status too.
20 |
21 | • **_Creating Posts_** : You can create a post containing your amazing idea and share it with all your fiends. You can like others post too.
22 |
23 | • **_Viewing all posts_** : On the home screen, you can view all your friend's posts and like them. The posts are updated according the time of upload.
24 |
25 | • **_Other fun things_** : You can try guessing some puns and know how funny :p you are.You can also meet some random dogs from the internet and select from a number of breeds.
26 |
27 | ## Setting up locally
28 |
29 | To build and run the app on your device, do the following:
30 |
31 | * Install Flutter by following the instructions on their website.
32 | * Clone this repo to your local machine using git clone https://github.com/parthpanchal123/Share-Space.git.
33 | * Head over to firebase . Create a new project and get your google-services.json file and paste it in /android/app directory .
34 | * Android: Connect your devices/emulators and run the app using **flutter run --release** in the root of the project directory.
35 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
29 |
30 |
31 | def keystoreProperties = new Properties()
32 | def keystorePropertiesFile = rootProject.file('key.properties')
33 | if (keystorePropertiesFile.exists()) {
34 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
35 | }
36 |
37 | android {
38 | compileSdkVersion 28
39 |
40 | sourceSets {
41 | main.java.srcDirs += 'src/main/kotlin'
42 | }
43 |
44 | lintOptions {
45 | disable 'InvalidPackage'
46 | }
47 |
48 | defaultConfig {
49 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
50 | applicationId "com.parthpanchal.sharespace"
51 | minSdkVersion 21
52 | targetSdkVersion 28
53 | versionCode 4
54 | versionName "4.0.2"
55 | }
56 |
57 |
58 |
59 | signingConfigs {
60 | release {
61 | keyAlias keystoreProperties['keyAlias']
62 | keyPassword keystoreProperties['keyPassword']
63 | storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
64 | storePassword keystoreProperties['storePassword']
65 | }
66 | }
67 | buildTypes {
68 | release {
69 | signingConfig signingConfigs.release
70 | }
71 | }
72 |
73 | }
74 |
75 | flutter {
76 | source '../..'
77 | }
78 |
79 | dependencies {
80 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
81 | implementation 'com.google.firebase:firebase-analytics:17.2.2'
82 | implementation 'com.google.firebase:firebase-messaging:20.2.0'
83 | implementation 'com.google.firebase:firebase-messaging:20.2.0'
84 | implementation 'com.google.android.gms:play-services-ads:19.1.0'
85 | }
86 |
87 | apply plugin: 'com.google.gms.google-services'
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
8 |
9 |
13 | //this is a fake id ufcourse
16 |
23 |
27 |
31 |
32 |
33 |
38 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
55 |
58 |
59 |
--------------------------------------------------------------------------------
/lib/screens/AppScreens/splashscreen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flare_loading/flare_loading.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:page_transition/page_transition.dart';
6 | import 'package:random_Fun/Animations/fade_in.dart';
7 | import 'package:random_Fun/screens/AuthScreens/auth.dart';
8 |
9 | class SplashScreen extends StatefulWidget {
10 | @override
11 | _SplashScreenState createState() => _SplashScreenState();
12 | }
13 |
14 | class _SplashScreenState extends State {
15 | @override
16 | void initState() {
17 | // TODO: implement initState
18 | super.initState();
19 | startTime();
20 | }
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return Scaffold(
25 | backgroundColor: Colors.white,
26 | body: Container(
27 | margin: EdgeInsets.all(16.0),
28 | child: Column(
29 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
30 | children: [
31 | FadeAnimation(
32 | 1.3,
33 | Text(
34 | 'Share Space',
35 | style: TextStyle(fontWeight: FontWeight.w900, fontSize: 40.0),
36 | )),
37 | FadeAnimation(
38 | 1.6,
39 | Container(
40 | decoration: BoxDecoration(boxShadow: [
41 | BoxShadow(
42 | color: Colors.grey.withOpacity(0.3),
43 | spreadRadius: 3,
44 | blurRadius: 10,
45 | offset: Offset(0, 3), // changes position of shadow
46 | ),
47 | ]),
48 | child: ClipRRect(
49 | borderRadius: BorderRadius.circular(8.0),
50 | child: Image.asset('assets/images/pablo-friendship.png'),
51 | ),
52 | )),
53 | FadeAnimation(
54 | 2.0,
55 | Text(
56 | 'Welcome to the party ! 🎉',
57 | style: TextStyle(fontWeight: FontWeight.w600, fontSize: 20.0),
58 | )),
59 | FadeAnimation(
60 | 2.3,
61 | Text(
62 | '#social 🌐 #fun 😉 ',
63 | style: TextStyle(fontWeight: FontWeight.w100, fontSize: 20.0),
64 | )),
65 | FadeAnimation(
66 | 2.5,
67 | Container(
68 | width: 50.0,
69 | height: 50.0,
70 | child: FlareLoading(
71 | name: 'assets/flares/animation.flr',
72 | startAnimation: 'active',
73 | loopAnimation: 'active',
74 | onError: (err, stack) {
75 | print(err);
76 | },
77 | onSuccess: (_) {
78 | print('Finished');
79 | },
80 | )))
81 | ],
82 | ),
83 | ));
84 | }
85 |
86 | startTime() async {
87 | var _duration = new Duration(seconds: 5);
88 | return Timer(_duration, () {
89 | Navigator.pushReplacement(context, PageTransition(type: PageTransitionType.rightToLeftWithFade, child: AuthWidget()));
90 | });
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/lib/values/borders.dart:
--------------------------------------------------------------------------------
1 | part of values;
2 |
3 | class Borders {
4 | static const BorderSide defaultPrimaryBorder =
5 | BorderSide(width: Sizes.WIDTH_0, style: BorderStyle.none);
6 |
7 | static const UnderlineInputBorder primaryInputBorder = UnderlineInputBorder(
8 | borderSide: BorderSide(
9 | color: AppColors.whiteShade1,
10 | width: Sizes.WIDTH_1,
11 | style: BorderStyle.solid,
12 | ),
13 | );
14 |
15 | static const UnderlineInputBorder enabledBorder = UnderlineInputBorder(
16 | borderSide: BorderSide(
17 | color: AppColors.whiteShade1,
18 | width: Sizes.WIDTH_1,
19 | style: BorderStyle.solid,
20 | ),
21 | );
22 |
23 | static const UnderlineInputBorder focusedBorder = UnderlineInputBorder(
24 | borderSide: BorderSide(
25 | color: AppColors.blackShade3,
26 | width: Sizes.WIDTH_2,
27 | style: BorderStyle.solid,
28 | ),
29 | );
30 |
31 | static const UnderlineInputBorder disabledBorder = UnderlineInputBorder(
32 | borderSide: BorderSide(
33 | color: AppColors.grey,
34 | width: Sizes.WIDTH_1,
35 | style: BorderStyle.solid,
36 | ),
37 | );
38 |
39 | static const OutlineInputBorder outlineEnabledBorder = OutlineInputBorder(
40 | borderRadius: BorderRadius.all(Radius.circular(Sizes.RADIUS_30)),
41 | borderSide: BorderSide(
42 | color: AppColors.grey,
43 | width: Sizes.WIDTH_1,
44 | style: BorderStyle.solid,
45 | ),
46 | );
47 |
48 | static const OutlineInputBorder outlineFocusedBorder = OutlineInputBorder(
49 | borderRadius: BorderRadius.all(Radius.circular(Sizes.RADIUS_30)),
50 | borderSide: BorderSide(
51 | color: AppColors.grey,
52 | width: Sizes.WIDTH_1,
53 | style: BorderStyle.solid,
54 | ),
55 | );
56 |
57 | static const OutlineInputBorder outlineBorder = OutlineInputBorder(
58 | borderRadius: BorderRadius.all(Radius.circular(Sizes.RADIUS_30)),
59 | borderSide: BorderSide(
60 | color: AppColors.grey,
61 | width: Sizes.WIDTH_1,
62 | style: BorderStyle.solid,
63 | ),
64 | );
65 |
66 | static const UnderlineInputBorder noBorder = UnderlineInputBorder(
67 | borderSide: BorderSide(
68 | style: BorderStyle.none,
69 | ),
70 | );
71 |
72 | static customBorder({
73 | Color color = AppColors.blackShade10,
74 | double width = Sizes.WIDTH_1,
75 | BorderStyle style = BorderStyle.solid,
76 | }) {
77 | return BorderSide(
78 | color: color,
79 | width: width,
80 | style: style,
81 | );
82 | }
83 |
84 | static customOutlineInputBorder({
85 | double borderRadius = Sizes.RADIUS_12,
86 | Color color = AppColors.grey,
87 | double width = Sizes.WIDTH_1,
88 | BorderStyle style = BorderStyle.solid,
89 | }) {
90 |
91 | return OutlineInputBorder(
92 | borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
93 | borderSide: BorderSide(
94 | color: color,
95 | width: width,
96 | style: style,
97 | ),
98 | );
99 | }
100 |
101 | static customUnderlineInputBorder({
102 | Color color = AppColors.grey,
103 | double width = Sizes.WIDTH_1,
104 | BorderStyle style = BorderStyle.solid,
105 | }) {
106 | return UnderlineInputBorder(
107 | borderSide: BorderSide(
108 | color: color,
109 | width: width,
110 | style: style,
111 | ),
112 | );
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/services/database.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:intl/intl.dart';
3 | import 'package:random_Fun/models/Post.dart';
4 | import 'package:random_Fun/models/user.dart';
5 |
6 | class Database {
7 | final db = Firestore.instance.collection('users');
8 | static int count = 0;
9 |
10 | Future addUserToDatabase(User user) async {
11 | var now = new DateTime.now();
12 | var formatter = DateFormat.yMd().add_jm();
13 | String curr_date_str = formatter.format(now);
14 |
15 | await db
16 | .document(user.uid)
17 | .setData({
18 | "uid": user.uid,
19 | "displayName": user.displayName ?? "",
20 | "email": user.email,
21 | "photoUrl":
22 | user.photoUrl ?? "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdn3.iconfinder.com%2Fdata%2Ficons%2Fusers-23%2F64%2F_Male_Profile_Round_Circle_Users-512.png&f=1&nofb=1",
23 | "status": "Heyy , there I am new here !",
24 | "memberSince": curr_date_str
25 | })
26 | .then((value) => {print("User is added to db !")})
27 | .catchError((error) {
28 | return Future.error("Some issues");
29 | });
30 | }
31 |
32 | Future> getPostsLists(String uid) async {
33 | return await Firestore.instance.collection('all_posts/$uid/my_posts').getDocuments().then((value) => value.documents.map((e) => Post.fromJson(e.data)).toList());
34 | }
35 |
36 | Future updatePhotoUrl(String uid, String photoUrl) async {
37 | await db.document(uid).updateData({'photoUrl': photoUrl}).then((value) {
38 | return true;
39 | });
40 | return false;
41 | }
42 |
43 | Future createNewPost(String uid, Map newPost) async {
44 | count = count + 1;
45 | Firestore.instance.collection('all_posts').document(uid).setData({'postOwner': uid, 'createdAt': FieldValue.serverTimestamp()});
46 |
47 | Firestore.instance
48 | .collection('all_posts')
49 | .document(uid)
50 | .collection('my_posts')
51 | .document()
52 | .setData({'todo': newPost['todo'], 'desc': newPost['desc'], 'link': newPost['link'], 'category': newPost['category'], 'createdAt': FieldValue.serverTimestamp(), 'likes': 0})
53 | .then((status) {})
54 | .catchError((errorMsg) {
55 | return Future.error("Unable to update post currently !");
56 | });
57 | }
58 |
59 | Stream getAllUserPosts() {
60 | return Firestore.instance.collection('all_posts').snapshots();
61 | }
62 |
63 | Stream getUserDetails(String uid) {
64 | DocumentReference ref = db.document(uid);
65 | final snapshots = ref.snapshots();
66 | return snapshots.map((snapshot) => User.fromJson(snapshot.data));
67 | }
68 |
69 | Future getUser(String uid) async {
70 | final user = await db.document(uid).get();
71 | return user.data;
72 | }
73 |
74 | Future getUserByName(String name) async {
75 | return await db.getDocuments().then((value) => value.documents.where((user) => user.data['displayName'].toLowerCase().contains(name.toLowerCase())).toList());
76 | }
77 |
78 | Stream getAllPosts(String uid) {
79 | return Firestore.instance.collection('/all_posts/$uid/my_posts').snapshots();
80 | }
81 |
82 | Future updateStatus(String uid, String status) async {
83 | await db.document(uid).updateData({'status': status}).then((value) {
84 | return true;
85 | });
86 | return false;
87 | }
88 |
89 | Future checkNewUser(User user) async {
90 | bool isNewUser = true;
91 |
92 | DocumentSnapshot snap = await db.document(user.uid).get();
93 | if (snap.exists) {
94 | isNewUser = false;
95 | } else {
96 | isNewUser = true;
97 | }
98 | return isNewUser;
99 |
100 | // .then((docRef) {
101 | // if (docRef.exists) {
102 | // isNewUser = false;
103 | // return isNewUser;
104 | // }
105 | // });
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/lib/widgets/custom_text_form_field.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 | import 'package:random_Fun/values/values.dart';
4 |
5 | class CustomTextFormField extends StatelessWidget {
6 | final TextStyle textStyle;
7 |
8 | final TextEditingController controller;
9 | final TextStyle hintTextStyle;
10 | final TextStyle labelStyle;
11 | final TextStyle titleStyle;
12 | final Widget prefixIcon;
13 | final Widget suffixIcon;
14 | final String hintText;
15 | final String labelText;
16 | final String title;
17 | final bool obscured;
18 | final bool hasPrefixIcon;
19 | final bool hasSuffixIcon;
20 | final bool hasTitle;
21 | final bool hasTitleIcon;
22 | final Widget titleIcon;
23 | final TextInputType textInputType;
24 | final ValueChanged onChanged;
25 | final ValueChanged onFieldSubmitted;
26 | final FormFieldValidator validator;
27 | final List inputFormatters;
28 | final InputBorder border;
29 | final InputBorder enabledBorder;
30 | final InputBorder focusedBorder;
31 | final double width;
32 | final double height;
33 | final EdgeInsetsGeometry contentPadding;
34 | final EdgeInsetsGeometry textFormFieldMargin;
35 | final int maxLines;
36 | final TextInputAction textInputAction;
37 | final bool autofocus;
38 |
39 | CustomTextFormField(
40 | {this.textInputAction,
41 | this.prefixIcon,
42 | this.maxLines,
43 | this.controller,
44 | this.suffixIcon,
45 | this.textStyle,
46 | this.hintTextStyle,
47 | this.labelStyle,
48 | this.titleStyle,
49 | this.titleIcon,
50 | this.hasTitleIcon = false,
51 | this.title,
52 | this.contentPadding,
53 | this.textFormFieldMargin,
54 | this.hasTitle = false,
55 | this.border = Borders.primaryInputBorder,
56 | this.focusedBorder = Borders.focusedBorder,
57 | this.enabledBorder = Borders.enabledBorder,
58 | this.hintText,
59 | this.labelText,
60 | this.hasPrefixIcon = false,
61 | this.hasSuffixIcon = false,
62 | this.obscured = false,
63 | this.textInputType,
64 | this.onChanged,
65 | this.onFieldSubmitted,
66 | this.validator,
67 | this.inputFormatters,
68 | this.width,
69 | this.height,
70 | this.autofocus});
71 |
72 | @override
73 | Widget build(BuildContext context) {
74 | return Column(
75 | crossAxisAlignment: CrossAxisAlignment.start,
76 | children: [
77 | Row(
78 | children: [
79 | hasTitleIcon ? titleIcon : Container(),
80 | hasTitle ? Text(title, style: titleStyle) : Container(),
81 | ],
82 | ),
83 | // hasTitle ? SpaceH4() : Container(),
84 | Container(
85 | width: width,
86 | height: height,
87 | margin: textFormFieldMargin,
88 | child: TextFormField(
89 | onEditingComplete: () {
90 | FocusScope.of(context).nextFocus();
91 | },
92 | onFieldSubmitted: onFieldSubmitted,
93 | autofocus: autofocus,
94 | cursorColor: Theme.of(context).accentColor,
95 | textInputAction: textInputAction,
96 | maxLines: maxLines,
97 | style: textStyle,
98 | controller: controller,
99 | keyboardType: textInputType,
100 | onChanged: onChanged,
101 | validator: validator,
102 | inputFormatters: inputFormatters,
103 | decoration: InputDecoration(
104 | contentPadding: contentPadding,
105 | labelText: labelText,
106 | labelStyle: labelStyle,
107 | border: border,
108 | enabledBorder: enabledBorder,
109 | focusedBorder: focusedBorder,
110 | prefixIcon: hasPrefixIcon ? prefixIcon : null,
111 | suffixIcon: hasSuffixIcon ? suffixIcon : null,
112 | hintText: hintText,
113 | hintStyle: hintTextStyle,
114 | ),
115 | obscureText: obscured,
116 | ),
117 | ),
118 | ],
119 | );
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/lib/values/colors.dart:
--------------------------------------------------------------------------------
1 | part of values;
2 |
3 | class AppColors {
4 | static const Color primaryColor = Color.fromARGB(255, 255, 255, 255);
5 | static const Color secondaryColor = Color.fromARGB(255, 246, 247, 255);
6 |
7 | static const Color primaryText = Color(0xFF000000);
8 |
9 |
10 | //Black
11 | static const Color black = Color(0xFF000000);
12 | static const Color blackShade1 = Color(0xFF3B3870);
13 | static const Color blackShade2 = Color(0xFF2D3041);
14 | static const Color blackShade3 = Color(0xFF797C82);
15 | static const Color blackShade4 = Color(0xFF626061);
16 | static const Color blackShade5 = Color(0xFF323345);
17 | static const Color blackShade6 = Color(0xFF51515E);
18 | static const Color blackShade7 = Color(0xFF2F2F2F);
19 | static const Color blackShade8 = Color(0xFF040404);
20 | static const Color blackShade9 = Color(0xFF767676);
21 | static const Color blackShade10 = Color(0xFF606060);
22 |
23 |
24 |
25 | static const Color darkModeColor = Color(0xFF323337);
26 |
27 |
28 | //White
29 | static const Color white = Color(0xFFFFFFFF);
30 | static const Color whiteShade1 = Color(0xFFF6F6F6);
31 | static const Color whiteShade2 = Color(0xFFF8F9FD);
32 |
33 | //deepBlue
34 | static const Color lightBlueShade1 = Color(0xFFCED5E0);
35 | static const Color lightBlueShade2 = Color(0xFFA7B4C5);
36 | static const Color lightBlueShade5 = Color(0xFF526479);
37 |
38 | //Orange
39 | static const Color orange = Color(0xFFF9AC5F);
40 | static const Color deepOrange = Color(0xFFF86A5B);
41 | static const Color orangeShade1 = Color(0xFFF98A5D);
42 | static const Color orangeShade2 = Color(0xFFFDECE3);
43 | static const Color orangeShade3 = Color(0xFFFA947F);
44 | static const Color orangeShade4 = Color(0xFFFF9023);
45 | static const Color orangeShade5 = Color(0xFFF59312);
46 |
47 | //Grey
48 | static const Color grey = Color(0xFFE0E0E0);
49 | static const Color greyShade1 = Color(0xFFE7E7E7);
50 | static const Color greyShade2 = Color(0xFFDAD0D3);
51 | static const Color greyShade3 = Color(0xFFEDEEF2);
52 | static const Color greyShade6 = Color(0xFFADB1C0);
53 | static const Color greyShade7 = Color(0xFFB2B2B2);
54 | static const Color greyShade8 = Color(0xFFA3A3A3);
55 |
56 | //green
57 | static const Color green = Color(0xFF18D3BF);
58 | static const Color greenShade1 = Color(0xFF23E9A6);
59 |
60 | //lime green
61 | static const Color lightGreenShade1 = Color(0xFF69C7C6);
62 | static const Color deepLimeGreen = Color(0xFF2DA6AB);
63 | static const Color deepDarkGreen = Color(0xFF247EAA);
64 |
65 | //Red
66 | static const Color googleRed = Color(0xFFD42D21);
67 | static const Color red = Color(0xFFF1291A);
68 | static const Color redShade4 = Color(0xFFFF4758);
69 | static const Color redShade5 = Color(0xFFFB4656);
70 |
71 | static const Color pink = Color(0xFFC2366D);
72 | static const Color pinkShade1 = Color(0xFFDC669F);
73 | static const Color pinkShade2 = Color(0xFFFF9796);
74 | static const Color pinkShade3 = Color(0xFFFF6673);
75 |
76 | //Blue
77 | static const Color twitterBlue = Color(0xFF1867C7);
78 | static const Color facebookBlue = Color(0xFF44619D);
79 | static const Color linkedInBlue = Color(0xFF0467C2);
80 | static const Color lighterBlue = Color(0xFFD8F4FD);
81 | static const Color lighterBlue2 = Color(0xFFD0EBF7);
82 | static const Color lightBlue = Color(0xFF83C0CF);
83 | static const Color blue = Color(0xFF4045EE);
84 | static const Color blueShade1 = Color(0xFF70C4CD);
85 | static const Color blueShade2 = Color(0xFF47A9FF);
86 | static const Color seaBlue1 = Color(0xFF47B3FE);
87 | static const Color seaBlue2 = Color(0xFF2DCBFE);
88 | static const Color seaBlue3 = Color(0xFF0DE6FE);
89 |
90 |
91 | static const Color purple = Color(0xFF7B80FF);
92 |
93 | static const Color violet = Color(0xFF8764C3);
94 | static const Color violetShade1 = Color(0xFFB9A7D9);
95 | static const Color violetShade2 = Color(0xFF9121F9);
96 | // static const Color violetShade2 = Color(0xFF9121F9);
97 | static const Color violetShade200 = Color(0xFF655796);
98 |
99 | static const Color yellow = Color(0xFFFFC702);
100 |
101 |
102 | static const Color deepBrown = Color(0xFF666D73);
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: random_Fun
2 | description: A new Flutter project.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 4.0.0+2
19 |
20 | environment:
21 | sdk: ">=2.7.0 <3.0.0"
22 |
23 | dependencies:
24 | flutter:
25 | sdk: flutter
26 |
27 | google_fonts: ^1.1.0
28 | font_awesome_flutter: ^8.8.1
29 | google_sign_in: ^4.4.6
30 | firebase_auth: ^0.16.0
31 | provider: ^4.1.1
32 | modal_progress_hud: ^0.1.3
33 | flip_card: ^0.4.4
34 | http: ^0.12.1
35 | fluttertoast: ^4.0.1
36 | cloud_firestore: ^0.13.5
37 | image_picker: ^0.6.6+1
38 | firebase_storage: ^3.1.5
39 | curved_navigation_bar: ^0.3.2
40 | chips_choice: ^1.2.0
41 | cached_network_image: ^2.2.0+1
42 | draggable_scrollbar_sliver: ^0.0.3
43 | time_formatter: ^1.0.0+5
44 | shared_preferences: ^0.5.7+3
45 | firebase_messaging: ^6.0.16
46 | flutter_overboard: ^1.1.5
47 | firebase_admob: ^0.9.3+2
48 | flare_splash_screen: ^3.0.1
49 | flare_loading: ^2.1.1
50 | simple_animations: ^2.2.1
51 | page_transition: ^1.1.5
52 | url_launcher: ^5.4.10
53 |
54 | # The following adds the Cupertino Icons font to your application.
55 | # Use with the CupertinoIcons class for iOS style icons.
56 | cupertino_icons: ^0.1.3
57 | intl: ^0.16.1
58 |
59 |
60 | dev_dependencies:
61 | flutter_test:
62 | sdk: flutter
63 | flutter_launcher_icons: ^0.7.5
64 |
65 |
66 | flutter_icons:
67 | android: "launcher_icon"
68 | ios: true
69 | image_path: "assets/images/app_icon.png"
70 |
71 | # For information on the generic Dart part of this file, see the
72 | # following page: https://dart.dev/tools/pub/pubspec
73 |
74 | # The following section is specific to Flutter.
75 | flutter:
76 |
77 | # The following line ensures that the Material Icons font is
78 | # included with your application, so that you can use the icons in
79 | # the material Icons class.
80 | uses-material-design: true
81 |
82 | # To add assets to your application, add an assets section, like this:
83 | assets:
84 | - assets/images/
85 | - assets/flares/animation.flr
86 |
87 |
88 | # An image asset can refer to one or more resolution-specific "variants", see
89 | # https://flutter.dev/assets-and-images/#resolution-aware.
90 |
91 | # For details regarding adding assets from package dependencies, see
92 | # https://flutter.dev/assets-and-images/#from-packages
93 |
94 | # To add custom fonts to your application, add a fonts section here,
95 | # in this "flutter" section. Each entry in this list should have a
96 | # "family" key with the font family name, and a "fonts" key with a
97 | # list giving the asset and other descriptors for the font. For
98 | # example:
99 | fonts:
100 | - family: ProductSans
101 | fonts:
102 | - asset: assets/fonts/ProductSans-Medium.ttf
103 | - family: Aileron
104 | fonts:
105 | - asset: assets/fonts/Aileron-SemiBold.otf
106 | # style: italic
107 | # - asset: assets/fonts/Aileron-Italic.otf
108 | # - asset: fonts/Schyler-Italic.ttf
109 | # style: italic
110 | # - family: Trajan Pro
111 | # fonts:
112 | # - asset: fonts/TrajanPro.ttf
113 | # - asset: fonts/TrajanPro_Bold.ttf
114 | # weight: 700
115 | #
116 | # For details regarding fonts from package dependencies,
117 | # see https://flutter.dev/custom-fonts/#from-packages
118 |
--------------------------------------------------------------------------------
/lib/screens/AppScreens/about.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_overboard/flutter_overboard.dart';
3 |
4 | final pages = [
5 | PageModel(color: Colors.indigo, imageAssetPath: 'assets/images/welcome.png', title: 'Welcome to , Share Space !', body: 'A fun social place where we together fight boredom !', doAnimateImage: true),
6 | PageModel.withChild(
7 | child: Column(
8 | children: [
9 | Padding(
10 | padding: EdgeInsets.only(bottom: 10.0, top: 25.0),
11 | child: Column(
12 | children: [
13 | Image.asset('assets/images/friends.png', width: 200.0, height: 200.0),
14 | Text(
15 | 'How it works ?',
16 | style: TextStyle(color: Colors.white, fontSize: 30),
17 | )
18 | ],
19 | ),
20 | ),
21 | Padding(
22 | padding: const EdgeInsets.all(8.0),
23 | child: Container(
24 | margin: EdgeInsets.all(10.0),
25 | child: Column(
26 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
27 | children: [
28 | Padding(
29 | padding: const EdgeInsets.all(8.0),
30 | child: Text(
31 | String.fromCharCode(0x2022) + " " + "Create a post describing an interesting thing you're doing . For eg : Reading an interesting book or binge watching some series .",
32 | style: TextStyle(color: Colors.white, fontSize: 15.0),
33 | ),
34 | ),
35 | Padding(
36 | padding: const EdgeInsets.all(8.0),
37 | child: Text(String.fromCharCode(0x2022) + " " + "Once created a post , you can see it posted on the home feed .", style: TextStyle(color: Colors.white, fontSize: 15.0)),
38 | ),
39 | Padding(
40 | padding: const EdgeInsets.all(8.0),
41 | child: Text(String.fromCharCode(0x2022) + " " + "Your friends can now get your amazing idea and like your post .", style: TextStyle(color: Colors.white, fontSize: 15.0)),
42 | ),
43 | Padding(
44 | padding: const EdgeInsets.all(8.0),
45 | child: Text(
46 | String.fromCharCode(0x2022) + " " + "Yayy ,Pat yourself ! , You just helped your friends .",
47 | style: TextStyle(color: Colors.white, fontSize: 15.0),
48 | textAlign: TextAlign.left,
49 | ),
50 | ),
51 | ],
52 | ),
53 | ),
54 | )
55 | ],
56 | ),
57 | color: Colors.purple,
58 | doAnimateChild: true),
59 | PageModel.withChild(
60 | child: Column(
61 | children: [
62 | Padding(
63 | padding: EdgeInsets.only(bottom: 10.0, top: 25.0),
64 | child: Column(
65 | children: [
66 | Image.asset('assets/images/chill.png', width: 300.0, height: 300.0),
67 | Text(
68 | 'What else ?',
69 | style: TextStyle(color: Colors.white, fontSize: 30),
70 | ),
71 | Padding(
72 | padding: EdgeInsets.all(8.0),
73 | child: Text(
74 | 'Heyy , but wait what if your friends too dont have any ideas ! Unless they get one , try Guessing the Puns 😁 and also some random dog 🐕 images from the world .',
75 | style: TextStyle(color: Colors.white, fontSize: 15.0),
76 | textAlign: TextAlign.center,
77 | )),
78 | ],
79 | ),
80 | ),
81 | ],
82 | ),
83 | color: Colors.orange,
84 | doAnimateChild: true),
85 | ];
86 |
87 | class About extends StatelessWidget {
88 | @override
89 | Widget build(BuildContext context) {
90 | return Scaffold(
91 | body: OverBoard(
92 | pages: pages,
93 | showBullets: true,
94 | skipCallback: () {
95 | Navigator.pop(context);
96 | },
97 | finishCallback: () {
98 | Navigator.pop(context);
99 | },
100 | ),
101 | );
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/lib/services/Authenticate.dart:
--------------------------------------------------------------------------------
1 | import 'package:firebase_auth/firebase_auth.dart';
2 | import 'package:google_sign_in/google_sign_in.dart';
3 | import 'package:random_Fun/models/user.dart';
4 |
5 | class Authenticate {
6 | GoogleSignIn _googleSignIn = GoogleSignIn(
7 | scopes: [
8 | 'email',
9 | ],
10 | );
11 | final FirebaseAuth _auth = FirebaseAuth.instance;
12 |
13 | Future getCurrentUserID() async {
14 | final user = await _auth.currentUser();
15 | return user.uid;
16 | }
17 |
18 | //Handling Google sign in
19 | Future handleSignIn() async {
20 | try {
21 | final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
22 |
23 | if (googleUser == null) {
24 | return Future.error("You did not select an account to sign in !");
25 | }
26 | final GoogleSignInAuthentication googleAuth = await googleUser.authentication;
27 |
28 | final AuthCredential credential = GoogleAuthProvider.getCredential(
29 | accessToken: googleAuth.accessToken,
30 | idToken: googleAuth.idToken,
31 | );
32 |
33 | final FirebaseUser user = (await _auth.signInWithCredential(credential)).user;
34 |
35 | return userFromFirebase(user);
36 | } catch (e) {
37 | print("Problem is " + e.toString());
38 | print(e.code);
39 |
40 | switch (e.code) {
41 | case "network_error":
42 | return Future.error("Please check your internet connection !");
43 | break;
44 | case "ERROR_USER_DISABLED":
45 | return Future.error("Sorry your account is disabled !");
46 | break;
47 | case "ERROR_TOO_MANY_REQUESTS":
48 | return Future.error("Too many requests. Try again later.");
49 | break;
50 | default:
51 | return Future.error("Cannot sign you now :( ");
52 | break;
53 | }
54 | }
55 | }
56 |
57 | Future signUpWithEmailAndPassword(String email, String password) async {
58 | try {
59 | AuthResult res = await _auth.createUserWithEmailAndPassword(email: email, password: password);
60 | print("User registered ");
61 | return res.user;
62 | } catch (e) {
63 | switch (e.code) {
64 | case "ERROR_INVALID_EMAIL":
65 | return Future.error("Your email is invalid");
66 | break;
67 | case "ERROR_EMAIL_ALREADY_IN_USE":
68 | return Future.error("This email is already registered !");
69 | break;
70 | case "ERROR_WEAK_PASSWORD":
71 | return Future.error("This password is too weak !");
72 | break;
73 | }
74 | return Future.error("Cannot register you now , Try checking your internet connection !");
75 | }
76 | }
77 |
78 | Future signInWithEmailAndPassword(String email, String password) async {
79 | try {
80 | AuthResult res = await _auth.signInWithEmailAndPassword(email: email, password: password);
81 | print("User Signed In ");
82 | print(res.user.uid);
83 | return userFromFirebase(res.user);
84 | } catch (e) {
85 | switch (e.code) {
86 | case "ERROR_WRONG_PASSWORD":
87 | return Future.error("Please check your password again !");
88 | break;
89 | case "ERROR_INVALID_EMAIL":
90 | return Future.error("Your email is invalid");
91 | break;
92 | case "ERROR_EMAIL_ALREADY_IN_USE":
93 | return Future.error("This email is already registered !");
94 | break;
95 | case "ERROR_USER_NOT_FOUND":
96 | return Future.error("There is no user corresponding to that email , try again !");
97 | break;
98 | case "ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL":
99 | return Future.error("There's already a google account with that email . Try signing instead with google !");
100 | break;
101 | }
102 | return Future.error("No such user exists . Try registering first !");
103 | }
104 | }
105 |
106 | Stream get onStateChanged {
107 | return _auth.onAuthStateChanged.map(userFromFirebase);
108 | }
109 |
110 | User userFromFirebase(FirebaseUser user) {
111 | return user != null ? User(uid: user.uid, displayName: user.displayName ?? "", email: user.email ?? "", photoUrl: user.photoUrl ?? "", status: "I am new here !") : null;
112 | }
113 |
114 | Future logOut() async {
115 | await _auth.signOut();
116 | await _googleSignIn.signOut();
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/lib/screens/AppScreens/dogScreen.dart:
--------------------------------------------------------------------------------
1 | import 'package:chips_choice/chips_choice.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:modal_progress_hud/modal_progress_hud.dart';
4 | import 'package:random_Fun/models/dog.dart';
5 | import 'package:random_Fun/services/api.dart';
6 | import 'package:random_Fun/values/values.dart';
7 |
8 | class DogScreen extends StatefulWidget {
9 | @override
10 | _DogScreenState createState() => _DogScreenState();
11 | }
12 |
13 | class _DogScreenState extends State {
14 | int tag = 0;
15 | bool isLoading = false;
16 | @override
17 | Widget build(BuildContext context) {
18 | return Scaffold(
19 | appBar: AppBar(
20 | title: Text("Dogs's Lovers Only :P"),
21 | centerTitle: true,
22 | ),
23 | body: Container(
24 | margin: EdgeInsets.all(8.0),
25 | child: Column(
26 | children: [
27 | Container(
28 | //height: 130.0,
29 | decoration: BoxDecoration(color: Theme.of(context).accentColor, borderRadius: BorderRadius.all(Radius.circular(10.0))),
30 | child: Column(
31 | mainAxisAlignment: MainAxisAlignment.start,
32 | crossAxisAlignment: CrossAxisAlignment.center,
33 | children: [
34 | Row(
35 | mainAxisAlignment: MainAxisAlignment.start,
36 | children: [
37 | Expanded(
38 | child: Container(
39 | decoration: BoxDecoration(gradient: Gradients.curvesGradient0, borderRadius: BorderRadius.only(topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0))),
40 | padding: EdgeInsets.all(10.0),
41 | child: Text(
42 | 'Select a breed ....',
43 | textAlign: TextAlign.left,
44 | ),
45 | ),
46 | ),
47 | ],
48 | ),
49 | Container(
50 | margin: EdgeInsets.symmetric(vertical: 10.0),
51 | child: ChipsChoice.single(
52 | value: tag,
53 | options: ChipsChoiceOption.listFrom(
54 | source: Dog().breeds,
55 | value: (i, v) => i,
56 | label: (i, v) => v,
57 | ),
58 | onChanged: (val) {
59 | setState(() {
60 | tag = val;
61 | isLoading = true;
62 | });
63 | },
64 | ),
65 | ),
66 | ],
67 | ),
68 | ),
69 | Expanded(
70 | child: ModalProgressHUD(
71 | color: AppColors.blueShade2,
72 | opacity: 0.4,
73 | inAsyncCall: isLoading,
74 | progressIndicator: CircularProgressIndicator(),
75 | child: FutureBuilder(
76 | future: Api().getDogs(tag).whenComplete(() {
77 | setState(() {
78 | isLoading = false;
79 | });
80 | }),
81 | builder: (context, snapshot) {
82 | if (snapshot.hasData) {
83 | return ListView.builder(
84 | shrinkWrap: true,
85 | itemCount: snapshot.data.length,
86 | itemBuilder: (context, index) {
87 | return Padding(
88 | padding: const EdgeInsets.all(8.0),
89 | child: ClipRRect(
90 | borderRadius: BorderRadius.all(Radius.circular(20.0)),
91 | child: Container(
92 | decoration: BoxDecoration(),
93 | child: Image.network(
94 | snapshot.data[index],
95 | ),
96 | ),
97 | ),
98 | );
99 | },
100 | );
101 | } else {
102 | return Center(
103 | child: CircularProgressIndicator(),
104 | );
105 | }
106 | },
107 | ),
108 | ),
109 | )
110 | ],
111 | ),
112 | ),
113 | );
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/lib/widgets/spaces.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SpaceH2 extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return SizedBox(
7 | height: 2.0,
8 | );
9 | }
10 | }
11 |
12 | class SpaceH4 extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return SizedBox(
16 | height: 4.0,
17 | );
18 | }
19 | }
20 |
21 | class SpaceH8 extends StatelessWidget {
22 | @override
23 | Widget build(BuildContext context) {
24 | return SizedBox(
25 | height: 8.0,
26 | );
27 | }
28 | }
29 |
30 | class SpaceH12 extends StatelessWidget {
31 | @override
32 | Widget build(BuildContext context) {
33 | return SizedBox(
34 | height: 12.0,
35 | );
36 | }
37 | }
38 |
39 | class SpaceH16 extends StatelessWidget {
40 | @override
41 | Widget build(BuildContext context) {
42 | return SizedBox(
43 | height: 16.0,
44 | );
45 | }
46 | }
47 |
48 | class SpaceH20 extends StatelessWidget {
49 | @override
50 | Widget build(BuildContext context) {
51 | return SizedBox(
52 | height: 20.0,
53 | );
54 | }
55 | }
56 |
57 | class SpaceH24 extends StatelessWidget {
58 | @override
59 | Widget build(BuildContext context) {
60 | return SizedBox(
61 | height: 24.0,
62 | );
63 | }
64 | }
65 |
66 | class SpaceH30 extends StatelessWidget {
67 | @override
68 | Widget build(BuildContext context) {
69 | return SizedBox(
70 | height: 30.0,
71 | );
72 | }
73 | }
74 |
75 | class SpaceH36 extends StatelessWidget {
76 | @override
77 | Widget build(BuildContext context) {
78 | return SizedBox(
79 | height: 36.0,
80 | );
81 | }
82 | }
83 |
84 | class SpaceH40 extends StatelessWidget {
85 | @override
86 | Widget build(BuildContext context) {
87 | return SizedBox(
88 | height: 40.0,
89 | );
90 | }
91 | }
92 |
93 | class SpaceH180 extends StatelessWidget {
94 | @override
95 | Widget build(BuildContext context) {
96 | return SizedBox(
97 | height: 180.0,
98 | );
99 | }
100 | }
101 |
102 | class SpaceH200 extends StatelessWidget {
103 | @override
104 | Widget build(BuildContext context) {
105 | return SizedBox(
106 | height: 200.0,
107 | );
108 | }
109 | }
110 |
111 | class SpaceH44 extends StatelessWidget {
112 | @override
113 | Widget build(BuildContext context) {
114 | return SizedBox(
115 | height: 44.0,
116 | );
117 | }
118 | }
119 |
120 | class SpaceH48 extends StatelessWidget {
121 | @override
122 | Widget build(BuildContext context) {
123 | return SizedBox(
124 | height: 48.0,
125 | );
126 | }
127 | }
128 |
129 | class SpaceH96 extends StatelessWidget {
130 | @override
131 | Widget build(BuildContext context) {
132 | return SizedBox(
133 | height: 96.0,
134 | );
135 | }
136 | }
137 | //Widths
138 |
139 | class SpaceW4 extends StatelessWidget {
140 | @override
141 | Widget build(BuildContext context) {
142 | return SizedBox(
143 | width: 4.0,
144 | );
145 | }
146 | }
147 |
148 | class SpaceW8 extends StatelessWidget {
149 | @override
150 | Widget build(BuildContext context) {
151 | return SizedBox(
152 | width: 8.0,
153 | );
154 | }
155 | }
156 |
157 | class SpaceW12 extends StatelessWidget {
158 | @override
159 | Widget build(BuildContext context) {
160 | return SizedBox(
161 | width: 12.0,
162 | );
163 | }
164 | }
165 |
166 | class SpaceW16 extends StatelessWidget {
167 | @override
168 | Widget build(BuildContext context) {
169 | return SizedBox(
170 | width: 16.0,
171 | );
172 | }
173 | }
174 |
175 | class SpaceW20 extends StatelessWidget {
176 | @override
177 | Widget build(BuildContext context) {
178 | return SizedBox(
179 | width: 20.0,
180 | );
181 | }
182 | }
183 |
184 | class SpaceW24 extends StatelessWidget {
185 | @override
186 | Widget build(BuildContext context) {
187 | return SizedBox(
188 | width: 24.0,
189 | );
190 | }
191 | }
192 |
193 |
194 | class SpaceW30 extends StatelessWidget {
195 | @override
196 | Widget build(BuildContext context) {
197 | return SizedBox(
198 | width: 30.0,
199 | );
200 | }
201 | }
202 |
203 |
204 | class SpaceW36 extends StatelessWidget {
205 | @override
206 | Widget build(BuildContext context) {
207 | return SizedBox(
208 | width: 36.0,
209 | );
210 | }
211 | }
212 |
213 |
214 | class SpaceW40 extends StatelessWidget {
215 | @override
216 | Widget build(BuildContext context) {
217 | return SizedBox(
218 | width: 40.0,
219 | );
220 | }
221 | }
222 |
223 | class SpaceW48 extends StatelessWidget {
224 | @override
225 | Widget build(BuildContext context) {
226 | return SizedBox(
227 | width: 48.0,
228 | );
229 | }
230 | }
231 |
232 | class SpaceW60 extends StatelessWidget {
233 | @override
234 | Widget build(BuildContext context) {
235 | return SizedBox(
236 | width: 60.0,
237 | );
238 | }
239 | }
240 |
241 |
--------------------------------------------------------------------------------
/lib/screens/AppScreens/todos.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart';
3 | import 'package:random_Fun/Animations/fade_in.dart';
4 |
5 | class Todo extends StatefulWidget {
6 | @override
7 | _TodoState createState() => _TodoState();
8 | }
9 |
10 | class _TodoState extends State {
11 | List todos = [
12 | "Write a letter to your future self. Talk about your hopes, dreams and goals. Keep it in an envelope addressed to your future self (maybe even set a date for when to open it). Your future self will appreciate it.",
13 | "Can you talk over a distance with two cans and a string? Great time to find out.",
14 | "See if you can bottle flip 20 times in a row. Good luck.",
15 | "Watch scary movies. Friday the 13th but like…every night.",
16 | "Invent fresh memes. Meme a picture in your camera roll and watch it go viral. Bonus points if your memes are quarantine-themed.",
17 | "Attempt Zentangling. By drawing structured patterns over and over again you could create an art masterpiece.",
18 | "Re-watch shows from your childhood. You can find “Danny Phantom” on Hulu or “The Proud Family” on Disney+. Notice any “adult” references that you didn’t catch as a kid ? :p",
19 | "Make a YouTube video. I hear “What to Do When You’re Bored” is trending. We’re all losing our minds.",
20 | "Reminisce by watching old home videos. Does your mom still have the same clothing she wore 20 years ago? Because same.",
21 | "Here’s a bold one: Text your crush. Now’s the perfect time to shoot your shot. You’re both bored and longing for human interaction. Maybe you’ll come out of this quarantine with a date.",
22 | "Tone your abs. Do sit-ups, planking, squats and lunges. Come out of this quarantine looking ripped.",
23 | "Learn to play an instrument. You can find millio,ns of tutorials on YouTube.",
24 | "Go outside and stretch your legs. As long as you stay six feet away from others.",
25 | "Try to put a shirt on while doing a handstand. It’s definitely as hard as it sounds.",
26 | "Teach yourself ASL or a foreign language using Duolingo.",
27 | " Check in on your friends. Talk about life until all hours of the night.",
28 | "Find out what Hogwarts house you belong to with the Pottermore quiz. Ravenclaw gang.",
29 | "Watch a silent movie and make up the dialogue. Doing it with someone else may make you feel a little bit more sane.",
30 | "Learn how to juggle. Now when someone asks if you have a secret talent you can finally say, “Yes, I do.” Show off your juggling skills.",
31 | "Listen to a TED Talk for inspiration and motivation.",
32 | "Make slime. Start a collection. Mix colors together or try different slime recipes.",
33 | "Watch the sunset. Welcome a new day and try all of this stuff again."
34 | ];
35 | @override
36 | Widget build(BuildContext context) {
37 | return Scaffold(
38 | appBar: AppBar(
39 | title: Text('Never get bored !'),
40 | centerTitle: true,
41 | ),
42 | body: Column(
43 | children: [
44 | Padding(
45 | padding: const EdgeInsets.all(10.0),
46 | child: Container(
47 | child: Text(
48 | 'Try these amazing random things !',
49 | style: TextStyle(fontSize: 20.0),
50 | )),
51 | ),
52 | Expanded(
53 | child: ListView.builder(
54 | itemCount: todos.length,
55 | itemBuilder: (context, index) {
56 | return FadeAnimation(
57 | 1.2,
58 | Container(
59 | margin: EdgeInsets.all(10.0),
60 | decoration: BoxDecoration(
61 | borderRadius: BorderRadius.all(Radius.circular(15.0)),
62 | color: Colors.white,
63 | boxShadow: [
64 | BoxShadow(
65 | color: Colors.grey.withOpacity(0.3),
66 | spreadRadius: 3,
67 | blurRadius: 10,
68 | offset: Offset(0, 3), // changes position of shadow
69 | ),
70 | ],
71 | ),
72 | child: Padding(
73 | padding: const EdgeInsets.all(10.0),
74 | child: Row(
75 | mainAxisAlignment: MainAxisAlignment.start,
76 | crossAxisAlignment: CrossAxisAlignment.start,
77 | children: [
78 | Padding(
79 | padding: const EdgeInsets.symmetric(horizontal: 8.0),
80 | child: Icon(
81 | FontAwesomeIcons.arrowCircleRight,
82 | size: 20.0,
83 | ),
84 | ),
85 | Flexible(
86 | child: Text(
87 | todos[index],
88 | style: TextStyle(fontSize: 16.0),
89 | )),
90 | ],
91 | ),
92 | ),
93 | ));
94 | },
95 | ),
96 | )
97 | ],
98 | ),
99 | );
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/lib/screens/AppScreens/joke.dart:
--------------------------------------------------------------------------------
1 | import 'package:flip_card/flip_card.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:fluttertoast/fluttertoast.dart';
4 | import 'package:font_awesome_flutter/font_awesome_flutter.dart';
5 | import 'package:modal_progress_hud/modal_progress_hud.dart';
6 | import 'package:provider/provider.dart';
7 | import 'package:random_Fun/Animations/fade_in.dart';
8 | import 'package:random_Fun/models/joke.dart';
9 | import 'package:random_Fun/services/api.dart';
10 | import 'package:random_Fun/values/values.dart';
11 |
12 | class Joke extends StatefulWidget {
13 | @override
14 | _JokeState createState() => _JokeState();
15 | }
16 |
17 | class _JokeState extends State {
18 | bool isLoading = false;
19 | final scaffoldKey = GlobalKey();
20 |
21 | @override
22 | void initState() {
23 | // TODO: implement initState
24 | super.initState();
25 | Fluttertoast.showToast(gravity: ToastGravity.BOTTOM, backgroundColor: AppColors.whiteShade2, msg: "Click on the card to reveal the pun !", timeInSecForIosWeb: 5);
26 | }
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | final _api = Provider.of(context, listen: false);
31 | return Scaffold(
32 | key: scaffoldKey,
33 | backgroundColor: Color(0xffF7F8FA),
34 | appBar: AppBar(
35 | title: Text('Its Joke time :p'),
36 | elevation: 0.0,
37 | centerTitle: true,
38 | actions: [
39 | InkWell(
40 | onTap: () async {
41 | setState(() {
42 | isLoading = true;
43 | _api.jokes.clear();
44 | });
45 | await _api.getJoke().then((value) {
46 | setState(() {
47 | isLoading = false;
48 | });
49 | scaffoldKey.currentState.showSnackBar(SnackBar(
50 | content: Text("Seems you're having a fun time , New jokes updated !"),
51 | ));
52 | });
53 | },
54 | child: Padding(
55 | padding: const EdgeInsets.all(10.0),
56 | child: Icon(Icons.refresh),
57 | ),
58 | )
59 | ],
60 | ),
61 | body: ModalProgressHUD(
62 | color: AppColors.blueShade2,
63 | opacity: 0.4,
64 | inAsyncCall: isLoading,
65 | progressIndicator: CircularProgressIndicator(),
66 | child: Container(
67 | child: FutureBuilder(
68 | future: _api.getJoke(),
69 | builder: (context, snapshot) {
70 | if (snapshot.hasData) {
71 | return FadeAnimation(1.2, ListView.builder(itemCount: snapshot.data.length, shrinkWrap: true, itemBuilder: (context, index) => joke_card(snapshot.data[index], context)));
72 | } else {
73 | return Center(child: CircularProgressIndicator());
74 | }
75 | },
76 | )),
77 | ),
78 | // floatingActionButton: FloatingActionButton.extended(
79 | // icon: Icon(FontAwesomeIcons.smileWink),
80 | // onPressed: () async {
81 | // setState(() {
82 | // isLoading = true;
83 | // });
84 | // await _api.getJoke().then((value) {
85 | // setState(() {
86 | // isLoading = false;
87 | // });
88 | // });
89 | // },
90 | // label: Text('Get a new joke')),
91 | );
92 | }
93 | }
94 |
95 | Widget joke_card(Joke_Model joke, BuildContext context) {
96 | return FlipCard(
97 | direction: FlipDirection.HORIZONTAL,
98 | front: Container(
99 | padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 15.0),
100 | decoration: BoxDecoration(boxShadow: [
101 | BoxShadow(
102 | color: Colors.grey.withOpacity(0.3),
103 | spreadRadius: 3,
104 | blurRadius: 10,
105 | offset: Offset(0, 3), // changes position of shadow
106 | ),
107 | ], borderRadius: BorderRadius.all(Radius.circular(10.0)), color: Colors.white),
108 | margin: EdgeInsets.all(10.0),
109 | child: Column(
110 | crossAxisAlignment: CrossAxisAlignment.start,
111 | children: [
112 | Padding(
113 | padding: const EdgeInsets.only(bottom: 10.0),
114 | child: Text(
115 | "Type : ${joke.type}",
116 | style: TextStyle(fontWeight: FontWeight.w300),
117 | ),
118 | ),
119 | Row(
120 | crossAxisAlignment: CrossAxisAlignment.start,
121 | children: [
122 | Padding(
123 | padding: const EdgeInsets.only(right: 8.0),
124 | child: Icon(FontAwesomeIcons.arrowRight),
125 | ),
126 | Flexible(
127 | child: Text(
128 | "Question : ${joke.setup}",
129 | style: TextStyle(fontWeight: FontWeight.w500, fontSize: 18.0),
130 | ),
131 | ),
132 | ],
133 | ),
134 | ],
135 | ),
136 | ),
137 | back: Container(
138 | padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 15.0),
139 | decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(10.0)), color: Colors.white),
140 | margin: EdgeInsets.all(10.0),
141 | child: Column(
142 | crossAxisAlignment: CrossAxisAlignment.start,
143 | children: [
144 | Padding(
145 | padding: const EdgeInsets.only(bottom: 8.0),
146 | child: Text(
147 | "Question : ${joke.setup}",
148 | style: TextStyle(fontWeight: FontWeight.w300, fontSize: 16.0),
149 | ),
150 | ),
151 | Text(
152 | "Answer : ${joke.punchline}",
153 | style: TextStyle(fontWeight: FontWeight.w500, fontFamily: 'Aileron', fontStyle: FontStyle.italic, fontSize: 18.0),
154 | ),
155 | ],
156 | ),
157 | ),
158 | );
159 |
160 | // child: Column(
161 | // crossAxisAlignment: CrossAxisAlignment.start,
162 | // children: [
163 | // Text(
164 | // "Catergory : ${joke.type}",
165 | // textAlign: TextAlign.left,
166 | // style: TextStyle(),
167 | // ),
168 | // FlipCard(
169 | // flipOnTouch: true,
170 | // direction: FlipDirection.HORIZONTAL,
171 | // front: ListTile(
172 | // title: Text(joke.setup),
173 | // ),
174 | // back: ListTile(
175 | // title: Text(joke.punchline),
176 | // ),
177 | // ),
178 | // ],
179 | // ),
180 | }
181 |
--------------------------------------------------------------------------------
/lib/values/sizes.dart:
--------------------------------------------------------------------------------
1 | part of values;
2 |
3 | class Sizes {
4 | static const double SIZE_120 = 120.0;
5 | static const double SIZE_60 = 60.0;
6 | static const double SIZE_48 = 48.0;
7 | static const double SIZE_36 = 36.0;
8 | static const double SIZE_24 = 24.0;
9 | static const double SIZE_20 = 20.0;
10 | static const double SIZE_16 = 16.0;
11 | static const double SIZE_12 = 12.0;
12 | static const double SIZE_8 = 8.0;
13 | static const double SIZE_6 = 6.0;
14 | static const double SIZE_4 = 4.0;
15 | static const double SIZE_2 = 2.0;
16 | static const double SIZE_1 = 1.0;
17 | static const double SIZE_0 = 0.0;
18 |
19 |
20 | //TextSizes
21 | static const double TEXT_SIZE_96 = 96.0;
22 | static const double TEXT_SIZE_60 = 60.0;
23 | static const double TEXT_SIZE_50 = 50.0;
24 | static const double TEXT_SIZE_48 = 48.0;
25 | static const double TEXT_SIZE_44 = 44.0;
26 | static const double TEXT_SIZE_40 = 40.0;
27 | static const double TEXT_SIZE_36 = 36.0;
28 | static const double TEXT_SIZE_34 = 34.0;
29 | static const double TEXT_SIZE_32 = 32.0;
30 | static const double TEXT_SIZE_30 = 30.0;
31 | static const double TEXT_SIZE_28 = 28.0;
32 | static const double TEXT_SIZE_24 = 24.0;
33 | static const double TEXT_SIZE_22 = 22.0;
34 | static const double TEXT_SIZE_20 = 20.0;
35 | static const double TEXT_SIZE_18 = 18.0;
36 | static const double TEXT_SIZE_16 = 16.0;
37 | static const double TEXT_SIZE_14 = 14.0;
38 | static const double TEXT_SIZE_12 = 12.0;
39 | static const double TEXT_SIZE_10 = 10.0;
40 | static const double TEXT_SIZE_8 = 8.0;
41 |
42 | //IconSizes
43 | static const double ICON_SIZE_50 = 50.0;
44 | static const double ICON_SIZE_40 = 40.0;
45 | static const double ICON_SIZE_32 = 32.0;
46 | static const double ICON_SIZE_30 = 30.0;
47 | static const double ICON_SIZE_24 = 24.0;
48 | static const double ICON_SIZE_22 = 22.0;
49 | static const double ICON_SIZE_20 = 20.0;
50 | static const double ICON_SIZE_18 = 18.0;
51 | static const double ICON_SIZE_16 = 16.0;
52 | static const double ICON_SIZE_14 = 14.0;
53 | static const double ICON_SIZE_12 = 12.0;
54 | static const double ICON_SIZE_10 = 10.0;
55 | static const double ICON_SIZE_8 = 8.0;
56 |
57 | //Heights
58 | static const double HEIGHT_300 = 300.0;
59 | static const double HEIGHT_240 = 240.0;
60 | static const double HEIGHT_200 = 200.0;
61 | static const double HEIGHT_180 = 180.0;
62 | static const double HEIGHT_160 = 160.0;
63 | static const double HEIGHT_150 = 150.0;
64 | static const double HEIGHT_130 = 130.0;
65 | static const double HEIGHT_100 = 100.0;
66 | static const double HEIGHT_60 = 60.0;
67 | static const double HEIGHT_50 = 50.0;
68 | static const double HEIGHT_48 = 48.0;
69 | static const double HEIGHT_46 = 46.0;
70 | static const double HEIGHT_44 = 44.0;
71 | static const double HEIGHT_40 = 40.0;
72 | static const double HEIGHT_36 = 36.0;
73 | static const double HEIGHT_32 = 32.0;
74 | static const double HEIGHT_30 = 30.0;
75 | static const double HEIGHT_25 = 25.0;
76 | static const double HEIGHT_24 = 24.0;
77 | static const double HEIGHT_22 = 22.0;
78 | static const double HEIGHT_20 = 20.0;
79 | static const double HEIGHT_18 = 18.0;
80 | static const double HEIGHT_16 = 16.0;
81 | static const double HEIGHT_14 = 14.0;
82 | static const double HEIGHT_10 = 10.0;
83 | static const double HEIGHT_8 = 8.0;
84 | static const double HEIGHT_4 = 4.0;
85 | static const double HEIGHT_3 = 3.0;
86 | static const double HEIGHT_2 = 2.0;
87 | static const double HEIGHT_1 = 1.0;
88 |
89 | //Widths
90 | static const double WIDTH_300 = 300.0;
91 | static const double WIDTH_236 = 236.0;
92 | static const double WIDTH_200 = 200.0;
93 | static const double WIDTH_180 = 180.0;
94 | static const double WIDTH_170 = 170.0;
95 | static const double WIDTH_160 = 160.0;
96 | static const double WIDTH_150 = 150.0;
97 | static const double WIDTH_120 = 120.0;
98 | static const double WIDTH_100 = 100.0;
99 | static const double WIDTH_80 = 80.0;
100 | static const double WIDTH_60 = 60.0;
101 | static const double WIDTH_50 = 50.0;
102 | static const double WIDTH_40 = 40.0;
103 | static const double WIDTH_32 = 32.0;
104 | static const double WIDTH_30 = 30.0;
105 | static const double WIDTH_25 = 25.0;
106 | static const double WIDTH_24 = 24.0;
107 | static const double WIDTH_22 = 22.0;
108 | static const double WIDTH_20 = 20.0;
109 | static const double WIDTH_18 = 18.0;
110 | static const double WIDTH_16 = 16.0;
111 | static const double WIDTH_14 = 14.0;
112 | static const double WIDTH_12 = 12.0;
113 | static const double WIDTH_10 = 10.0;
114 | static const double WIDTH_8 = 8.0;
115 | static const double WIDTH_6 = 6.0;
116 | static const double WIDTH_4 = 4.0;
117 | static const double WIDTH_2 = 2.0;
118 | static const double WIDTH_1 = 1.0;
119 | static const double WIDTH_0 = 0.0;
120 |
121 | //Margins
122 | static const double MARGIN_200 = 200.0;
123 | static const double MARGIN_60 = 60.0;
124 | static const double MARGIN_48 = 48.0;
125 | static const double MARGIN_46 = 46.0;
126 | static const double MARGIN_44 = 44.0;
127 | static const double MARGIN_40 = 40.0;
128 | static const double MARGIN_36 = 36.0;
129 | static const double MARGIN_32 = 32.0;
130 | static const double MARGIN_30 = 30.0;
131 | static const double MARGIN_26 = 26.0;
132 | static const double MARGIN_24 = 24.0;
133 | static const double MARGIN_22 = 22.0;
134 | static const double MARGIN_20 = 20.0;
135 | static const double MARGIN_18 = 18.0;
136 | static const double MARGIN_16 = 16.0;
137 | static const double MARGIN_14 = 14.0;
138 | static const double MARGIN_12 = 12.0;
139 | static const double MARGIN_10 = 10.0;
140 | static const double MARGIN_8 = 8.0;
141 | static const double MARGIN_4 = 4.0;
142 | static const double MARGIN_0 = 0.0;
143 |
144 | //Paddings
145 | static const double PADDING_40 = 40.0;
146 | static const double PADDING_36 = 36.0;
147 | static const double PADDING_32 = 32.0;
148 | static const double PADDING_24 = 24.0;
149 | static const double PADDING_22 = 22.0;
150 | static const double PADDING_20 = 20.0;
151 | static const double PADDING_18 = 18.0;
152 | static const double PADDING_16 = 16.0;
153 | static const double PADDING_14 = 14.0;
154 | static const double PADDING_12 = 12.0;
155 | static const double PADDING_10 = 10.0;
156 | static const double PADDING_8 = 8.0;
157 | static const double PADDING_4 = 4.0;
158 | static const double PADDING_2 = 2.0;
159 | static const double PADDING_0 = 0.0;
160 |
161 | //Radius
162 | static const double RADIUS_80 = 80.0;
163 | static const double RADIUS_70 = 70.0;
164 | static const double RADIUS_60 = 60.0;
165 | static const double RADIUS_40 = 40.0;
166 | static const double RADIUS_32 = 32.0;
167 | static const double RADIUS_30 = 30.0;
168 | static const double RADIUS_24 = 24.0;
169 | static const double RADIUS_22 = 22.0;
170 | static const double RADIUS_20 = 20.0;
171 | static const double RADIUS_18 = 18.0;
172 | static const double RADIUS_16 = 16.0;
173 | static const double RADIUS_14 = 14.0;
174 | static const double RADIUS_12 = 12.0;
175 | static const double RADIUS_10 = 10.0;
176 | static const double RADIUS_8 = 8.0;
177 | static const double RADIUS_6 = 6.0;
178 | static const double RADIUS_4 = 4.0;
179 | static const double RADIUS_0 = 0.0;
180 |
181 | //Elevations
182 | static const double ELEVATION_16 = 16.0;
183 | static const double ELEVATION_14 = 14.0;
184 | static const double ELEVATION_12 = 12.0;
185 | static const double ELEVATION_10 = 10.0;
186 | static const double ELEVATION_8 = 8.0;
187 | static const double ELEVATION_6 = 6.0;
188 | static const double ELEVATION_4 = 4.0;
189 | static const double ELEVATION_2 = 2.0;
190 | static const double ELEVATION_1 = 1.0;
191 | static const double ELEVATION_0 = 0.0;
192 | }
--------------------------------------------------------------------------------
/lib/screens/AuthScreens/signUpHome.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart';
3 | import 'package:modal_progress_hud/modal_progress_hud.dart';
4 | import 'package:page_transition/page_transition.dart';
5 | import 'package:provider/provider.dart';
6 | import 'package:random_Fun/screens/AuthScreens/signUp.dart';
7 | import 'package:random_Fun/services/Authenticate.dart';
8 | import 'package:random_Fun/services/database.dart';
9 | import 'package:random_Fun/values/values.dart';
10 | import 'package:random_Fun/widgets/custom_button.dart';
11 | import 'package:random_Fun/widgets/spaces.dart';
12 | import 'package:shared_preferences/shared_preferences.dart';
13 | import 'package:url_launcher/url_launcher.dart';
14 |
15 | class SignUpHome extends StatefulWidget {
16 | @override
17 | _SignUpHomeState createState() => _SignUpHomeState();
18 | }
19 |
20 | class _SignUpHomeState extends State {
21 | bool isLoading = false;
22 | final _scaffoldKey = GlobalKey();
23 | bool isChecked = false;
24 | Future _prefs = SharedPreferences.getInstance();
25 | SharedPreferences prefs;
26 | @override
27 | void initState() {
28 | _checkIfAccepted();
29 | super.initState();
30 | }
31 |
32 | _checkIfAccepted() async {
33 | prefs = await _prefs;
34 |
35 | if (prefs.getBool('isAccepted') == null) {
36 | prefs.setBool('isAccepted', false);
37 | } else {
38 | isChecked = prefs.getBool('isAccepted');
39 | print(isChecked);
40 | }
41 |
42 | setState(() {
43 | isChecked = prefs.getBool("isAccepted");
44 | });
45 | }
46 |
47 | onAgreementAccepted(bool value) async {
48 | prefs = await _prefs;
49 | prefs.setBool("isAccepted", value);
50 |
51 | setState(() {
52 | isChecked = value;
53 | });
54 | }
55 |
56 | _launchURL() async {
57 | const url = StringConst.policy;
58 | if (await canLaunch(url)) {
59 | await launch(url);
60 | } else {
61 | throw 'Could not launch $url';
62 | }
63 | }
64 |
65 | @override
66 | Widget build(BuildContext context) {
67 | ThemeData theme = Theme.of(context);
68 | final _auth = Provider.of(context, listen: false);
69 | return Scaffold(
70 | backgroundColor: Colors.white,
71 | key: _scaffoldKey,
72 | body: ModalProgressHUD(
73 | color: AppColors.blueShade2,
74 | opacity: 0.4,
75 | inAsyncCall: isLoading,
76 | progressIndicator: CircularProgressIndicator(),
77 | child: SafeArea(
78 | child: Container(
79 | child: Column(
80 | children: [
81 | Spacer(flex: 1),
82 | Image(
83 | image: AssetImage('assets/images/girl_comp.png'),
84 | height: 300,
85 | filterQuality: FilterQuality.high,
86 | ),
87 | Spacer(flex: 1),
88 | Text(
89 | StringConst.SIGN_UP_2,
90 | style: theme.textTheme.headline5.copyWith(
91 | color: AppColors.black,
92 | fontSize: Sizes.TEXT_SIZE_40,
93 | fontWeight: FontWeight.w600,
94 | ),
95 | ),
96 | SpaceH8(),
97 | Text(
98 | StringConst.EASY_SIGN_UP,
99 | style: theme.textTheme.subtitle2.copyWith(color: AppColors.greyShade8, fontWeight: FontWeight.bold),
100 | ),
101 | Spacer(flex: 1),
102 | Container(
103 | decoration: Decorations.customBoxDecoration(blurRadius: 10),
104 | width: MediaQuery.of(context).size.width * 0.8,
105 | child: CustomButton(
106 | title: StringConst.CONTINUE_WITH_GOOGLE,
107 | elevation: Sizes.ELEVATION_12,
108 | hasIcon: true,
109 | icon: Icon(
110 | FontAwesomeIcons.google,
111 | color: AppColors.white,
112 | ),
113 | color: AppColors.blue,
114 | textStyle: theme.textTheme.button.copyWith(color: AppColors.white, fontWeight: FontWeight.w600, fontSize: Sizes.TEXT_SIZE_14),
115 | onPressed: () async {
116 | prefs = await _prefs;
117 |
118 | if (prefs.getBool("isAccepted") == false) {
119 | _scaffoldKey.currentState.showSnackBar(SnackBar(content: Text("Please accept the terms before proceeding !")));
120 | return;
121 | }
122 |
123 | final _db = Provider.of(context, listen: false);
124 | setState(() {
125 | isLoading = true;
126 | });
127 | final c_user = await _auth.handleSignIn().catchError((error) {
128 | print(error.toString());
129 | setState(() {
130 | isLoading = false;
131 | });
132 | _scaffoldKey.currentState.showSnackBar(SnackBar(content: Text(error.toString())));
133 | });
134 | if (c_user != null) {
135 | final isNew = await _db.checkNewUser(c_user);
136 | print("The user isn " + isNew.toString());
137 | if (isNew) {
138 | await _db.addUserToDatabase(c_user).catchError((error) {
139 | print("From here " + error.toString());
140 | });
141 | }
142 | }
143 | },
144 | ),
145 | ),
146 | SpaceH12(),
147 | Container(
148 | width: MediaQuery.of(context).size.width * 0.6,
149 | child: CustomButton(
150 | title: StringConst.USE_EMAIL,
151 | elevation: Sizes.ELEVATION_2,
152 | color: AppColors.white,
153 | borderSide: Borders.customBorder(width: 1.5),
154 | textStyle: theme.textTheme.button.copyWith(color: AppColors.blackShade10, fontWeight: FontWeight.w600, fontSize: Sizes.TEXT_SIZE_14),
155 | onPressed: () {
156 | Navigator.push(context, PageTransition(type: PageTransitionType.rightToLeftWithFade, child: SignUp()));
157 | }),
158 | ),
159 | Spacer(flex: 1),
160 | Row(
161 | mainAxisAlignment: MainAxisAlignment.center,
162 | children: [
163 | Checkbox(
164 | value: isChecked ?? false,
165 | onChanged: onAgreementAccepted,
166 | activeColor: AppColors.blue,
167 | ),
168 | isChecked != true
169 | ? GestureDetector(
170 | onTap: _launchURL,
171 | child: Text(
172 | 'Accept terms and conditions',
173 | style: TextStyle(
174 | fontSize: Sizes.TEXT_SIZE_14,
175 | decoration: TextDecoration.underline,
176 | color: AppColors.purple,
177 | ),
178 | ))
179 | : Text("Already accepted terms ! Login now . ")
180 | ],
181 | ),
182 | ],
183 | ),
184 | ),
185 | ),
186 | ),
187 | );
188 | }
189 | }
190 |
--------------------------------------------------------------------------------
/lib/screens/AppScreens/AllUsers.dart:
--------------------------------------------------------------------------------
1 | import 'package:cached_network_image/cached_network_image.dart';
2 | import 'package:cloud_firestore/cloud_firestore.dart';
3 | import 'package:flutter/material.dart';
4 | import 'package:font_awesome_flutter/font_awesome_flutter.dart';
5 | import 'package:provider/provider.dart';
6 | import 'package:random_Fun/services/database.dart';
7 | import 'package:random_Fun/values/values.dart';
8 | import 'package:random_Fun/widgets/custom_button.dart';
9 |
10 | class AllUsers extends StatefulWidget {
11 | @override
12 | _AllUsersState createState() => _AllUsersState();
13 | }
14 |
15 | class _AllUsersState extends State {
16 | String _name = '';
17 | @override
18 | Widget build(BuildContext context) {
19 | final nameController = TextEditingController(text: '');
20 | final _formKey = GlobalKey();
21 |
22 | final db = Provider.of(context);
23 | final focus = FocusNode();
24 |
25 | return Scaffold(
26 | appBar: AppBar(
27 | title: Text('All Users'),
28 | centerTitle: true,
29 | actions: [
30 | InkWell(
31 | onTap: () {
32 | showDialog(
33 | barrierDismissible: true,
34 | context: context,
35 | builder: (context) => AlertDialog(
36 | content: Container(
37 | decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(40.0))),
38 | child: Form(
39 | key: _formKey,
40 | child: Column(
41 | mainAxisSize: MainAxisSize.min,
42 | children: [
43 | TextFormField(
44 | autofocus: true,
45 | textInputAction: TextInputAction.done,
46 | controller: nameController,
47 | decoration: InputDecoration(hintText: "Enter user's name to search .."),
48 | validator: (name) {
49 | if (name.isEmpty || name == '' || name.length > 20) {
50 | return "Enter a valid name to search !. ";
51 | }
52 | },
53 | onFieldSubmitted: (name) {
54 | _name = name;
55 | Navigator.pop(context);
56 | },
57 | ),
58 | SizedBox(
59 | height: 10.0,
60 | ),
61 | CustomButton(
62 | title: 'Search',
63 | textStyle: TextStyle(color: Colors.white),
64 | elevation: Sizes.ELEVATION_8,
65 | color: Theme.of(context).accentColor,
66 | height: Sizes.HEIGHT_40,
67 | onPressed: () async {
68 | if (_formKey.currentState.validate()) {
69 | _name = nameController.text;
70 | Navigator.pop(context);
71 | }
72 | },
73 | )
74 | ],
75 | ),
76 | ),
77 | ),
78 | ));
79 | },
80 | child: Padding(
81 | padding: const EdgeInsets.all(10.0),
82 | child: Icon(FontAwesomeIcons.search),
83 | ),
84 | )
85 | ],
86 | ),
87 | body: Container(
88 | child: Column(
89 | children: [
90 | Container(
91 | margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 8.0),
92 | child: Column(
93 | children: [],
94 | ),
95 | ),
96 | Expanded(
97 | child: Container(
98 | height: MediaQuery.of(context).size.height,
99 | child: StreamBuilder(
100 | stream: Firestore.instance.collection('users').where('displayName', isEqualTo: _name == '' ? null : _name).snapshots(),
101 | builder: (context, snapshot) {
102 | if (snapshot.hasData) {
103 | if (_name == '') {
104 | return Container(
105 | margin: EdgeInsets.symmetric(horizontal: 8.0, vertical: 8.0),
106 | child: ListView(
107 | shrinkWrap: true,
108 | itemExtent: 100,
109 | controller: ScrollController(initialScrollOffset: 1.0),
110 | children: snapshot.data.documents.map((document) {
111 | return UserCard(document, context);
112 | }).toList(),
113 | ),
114 | );
115 | } else {
116 | return FutureBuilder(
117 | future: db.getUserByName(_name),
118 | builder: (context, snapshot) {
119 | if (snapshot.hasData) {
120 | if (snapshot.data.length == 0) {
121 | return Center(
122 | child: Container(
123 | height: MediaQuery.of(context).size.height,
124 | color: Colors.white,
125 | child: Column(
126 | mainAxisAlignment: MainAxisAlignment.center,
127 | children: [
128 | Container(width: 200.0, height: 200.0, child: Image.asset('assets/images/noUser.png')),
129 | Center(
130 | child: Text('No such user found !'),
131 | ),
132 | ],
133 | ),
134 | ),
135 | );
136 | }
137 |
138 | return ListView.builder(
139 | itemCount: snapshot.data.length,
140 | itemBuilder: (context, index) => UserCard(snapshot.data[index], context),
141 | );
142 | } else {
143 | return Center(
144 | child: CircularProgressIndicator(),
145 | );
146 | }
147 | },
148 | );
149 | }
150 | } else {
151 | return Center(
152 | child: CircularProgressIndicator(),
153 | );
154 | }
155 | }),
156 | ),
157 | )
158 | ],
159 | ),
160 | ));
161 | }
162 | }
163 |
164 | Widget UserCard(DocumentSnapshot user, BuildContext context) {
165 | return GestureDetector(
166 | onTap: () {
167 | Navigator.pushNamed(context, '/profile', arguments: {'uid': user['uid']});
168 | },
169 | child: Padding(
170 | padding: const EdgeInsets.all(8.0),
171 | child: Container(
172 | height: 100.0,
173 | decoration: BoxDecoration(
174 | borderRadius: BorderRadius.all(Radius.circular(15.0)),
175 | color: Colors.white,
176 | boxShadow: [
177 | BoxShadow(
178 | color: Colors.grey.withOpacity(0.3),
179 | spreadRadius: 3,
180 | blurRadius: 10,
181 | offset: Offset(0, 3), // changes position of shadow
182 | ),
183 | ],
184 | ),
185 | child: Row(
186 | children: [
187 | Hero(
188 | tag: Text('profile'),
189 | child: Container(
190 | margin: EdgeInsets.only(left: 10.0),
191 | height: 60.0,
192 | width: 60.0,
193 | decoration: BoxDecoration(
194 | shape: BoxShape.circle,
195 | border: Border.all(color: Colors.black, width: 1),
196 | image: new DecorationImage(fit: BoxFit.fill, image: CachedNetworkImageProvider(user['photoUrl'])),
197 | ),
198 | ),
199 | ),
200 | Column(
201 | mainAxisAlignment: MainAxisAlignment.center,
202 | crossAxisAlignment: CrossAxisAlignment.start,
203 | children: [
204 | Container(
205 | margin: EdgeInsets.only(left: 14.0),
206 | child: Hero(
207 | tag: Text('displyaName'),
208 | child: Text(
209 | user['displayName'],
210 | style: TextStyle(fontSize: 18),
211 | ),
212 | )),
213 | Container(margin: EdgeInsets.only(left: 14.0), child: Hero(tag: Text('status'), child: Text(user['status']))),
214 | ],
215 | )
216 | ],
217 | ),
218 | ),
219 | ),
220 | );
221 | }
222 |
--------------------------------------------------------------------------------
/lib/widgets/outline_border_2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'dart:math' as math;
3 | import 'dart:ui' show lerpDouble;
4 |
5 | class OutlineInputBorder2 extends InputBorder {
6 | /// Creates a rounded rectangle outline border for an [InputDecorator].
7 | ///
8 | /// If the [borderSide] parameter is [BorderSide.none], it will not draw a
9 | /// border. However, it will still define a shape (which you can see if
10 | /// [InputDecoration.filled] is true).
11 | ///
12 | /// If an application does not specify a [borderSide] parameter of
13 | /// value [BorderSide.none], the input decorator substitutes its own, using
14 | /// [copyWith], based on the current theme and [InputDecorator.isFocused].
15 | ///
16 | /// The [borderRadius] parameter defaults to a value where all four
17 | /// corners have a circular radius of 4.0. The [borderRadius] parameter
18 | /// must not be null and the corner radii must be circular, i.e. their
19 | /// [Radius.x] and [Radius.y] values must be the same.
20 | ///
21 | /// See also:
22 | ///
23 | /// * [InputDecoration.hasFloatingPlaceholder], which should be set to false
24 | /// when the [borderSide] is [BorderSide.none]. If let as true, the label
25 | /// will extend beyond the container as if the border were still being
26 | /// drawn.
27 | const OutlineInputBorder2({
28 | BorderSide borderSide = const BorderSide(),
29 | this.borderRadius = const BorderRadius.all(Radius.circular(4.0)),
30 | this.gapPadding = 2.0,
31 | }) : assert(borderRadius != null),
32 | assert(gapPadding != null && gapPadding >= 0.0),
33 | super(borderSide: borderSide);
34 |
35 | // The label text's gap can extend into the corners (even both the top left
36 | // and the top right corner). To avoid the more complicated problem of finding
37 | // how far the gap penetrates into an elliptical corner, just require them
38 | // to be circular.
39 | //
40 | // This can't be checked by the constructor because const constructor.
41 | static bool _cornersAreCircular(BorderRadius borderRadius) {
42 | return borderRadius.topLeft.x == borderRadius.topLeft.y
43 | && borderRadius.bottomLeft.x == borderRadius.bottomLeft.y
44 | && borderRadius.topRight.x == borderRadius.topRight.y
45 | && borderRadius.bottomRight.x == borderRadius.bottomRight.y;
46 | }
47 |
48 | /// Horizontal padding on either side of the border's
49 | /// [InputDecoration.labelText] width gap.
50 | ///
51 | /// This value is used by the [paint] method to compute the actual gap width.
52 | final double gapPadding;
53 |
54 | /// The radii of the border's rounded rectangle corners.
55 | ///
56 | /// The corner radii must be circular, i.e. their [Radius.x] and [Radius.y]
57 | /// values must be the same.
58 | final BorderRadius borderRadius;
59 |
60 | @override
61 | bool get isOutline => true;
62 |
63 | @override
64 | OutlineInputBorder2 copyWith({
65 | BorderSide borderSide,
66 | BorderRadius borderRadius,
67 | double gapPadding,
68 | }) {
69 | return OutlineInputBorder2(
70 | borderSide: borderSide ?? this.borderSide,
71 | borderRadius: borderRadius ?? this.borderRadius,
72 | gapPadding: gapPadding ?? this.gapPadding,
73 | );
74 | }
75 |
76 | @override
77 | EdgeInsetsGeometry get dimensions {
78 | return EdgeInsets.all(borderSide.width);
79 | }
80 |
81 | @override
82 | OutlineInputBorder2 scale(double t) {
83 | return OutlineInputBorder2(
84 | borderSide: borderSide.scale(t),
85 | borderRadius: borderRadius * t,
86 | gapPadding: gapPadding * t,
87 | );
88 | }
89 |
90 | @override
91 | ShapeBorder lerpFrom(ShapeBorder a, double t) {
92 | if (a is OutlineInputBorder2) {
93 | final OutlineInputBorder2 outline = a;
94 | return OutlineInputBorder2(
95 | borderRadius: BorderRadius.lerp(outline.borderRadius, borderRadius, t),
96 | borderSide: BorderSide.lerp(outline.borderSide, borderSide, t),
97 | gapPadding: outline.gapPadding,
98 | );
99 | }
100 | return super.lerpFrom(a, t);
101 | }
102 |
103 | @override
104 | ShapeBorder lerpTo(ShapeBorder b, double t) {
105 | if (b is OutlineInputBorder2) {
106 | final OutlineInputBorder2 outline = b;
107 | return OutlineInputBorder2(
108 | borderRadius: BorderRadius.lerp(borderRadius, outline.borderRadius, t),
109 | borderSide: BorderSide.lerp(borderSide, outline.borderSide, t),
110 | gapPadding: outline.gapPadding,
111 | );
112 | }
113 | return super.lerpTo(b, t);
114 | }
115 |
116 | @override
117 | Path getInnerPath(Rect rect, { TextDirection textDirection }) {
118 | return Path()
119 | ..addRRect(borderRadius.resolve(textDirection).toRRect(rect).deflate(borderSide.width));
120 | }
121 |
122 | @override
123 | Path getOuterPath(Rect rect, { TextDirection textDirection }) {
124 | return Path()
125 | ..addRRect(borderRadius.resolve(textDirection).toRRect(rect));
126 | }
127 |
128 | Path _gapBorderPath(Canvas canvas, RRect center, double start, double extent) {
129 | // When the corner radii on any side add up to be greater than the
130 | // given height, each radius has to be scaled to not exceed the
131 | // size of the width/height of the RRect.
132 | final RRect scaledRRect = center.scaleRadii();
133 |
134 | final Rect tlCorner = Rect.fromLTWH(
135 | scaledRRect.left,
136 | scaledRRect.top,
137 | scaledRRect.tlRadiusX * 2.0,
138 | scaledRRect.tlRadiusY * 2.0,
139 | );
140 | final Rect trCorner = Rect.fromLTWH(
141 | scaledRRect.right - scaledRRect.trRadiusX * 2.0,
142 | scaledRRect.top,
143 | scaledRRect.trRadiusX * 2.0,
144 | scaledRRect.trRadiusY * 2.0,
145 | );
146 | final Rect brCorner = Rect.fromLTWH(
147 | scaledRRect.right - scaledRRect.brRadiusX * 2.0,
148 | scaledRRect.bottom - scaledRRect.brRadiusY * 2.0,
149 | scaledRRect.brRadiusX * 2.0,
150 | scaledRRect.brRadiusY * 2.0,
151 | );
152 | final Rect blCorner = Rect.fromLTWH(
153 | scaledRRect.left,
154 | scaledRRect.bottom - scaledRRect.blRadiusY * 2.0,
155 | scaledRRect.blRadiusX * 2.0,
156 | scaledRRect.blRadiusX * 2.0,
157 | );
158 |
159 | const double cornerArcSweep = math.pi / 2.0;
160 | final double tlCornerArcSweep = start < scaledRRect.tlRadiusX
161 | ? math.asin((start / scaledRRect.tlRadiusX).clamp(-1.0, 1.0))
162 | : math.pi / 2.0;
163 |
164 | final Path path = Path()
165 | ..addArc(tlCorner, math.pi, tlCornerArcSweep)
166 | ..moveTo(scaledRRect.left + scaledRRect.tlRadiusX, scaledRRect.top);
167 |
168 | if (start > scaledRRect.tlRadiusX)
169 | path.lineTo(scaledRRect.left + start, scaledRRect.top);
170 |
171 | const double trCornerArcStart = (3 * math.pi) / 2.0;
172 | const double trCornerArcSweep = cornerArcSweep;
173 | if (start + extent < scaledRRect.width - scaledRRect.trRadiusX) {
174 | path
175 | ..relativeMoveTo(extent, 0.0)
176 | ..lineTo(scaledRRect.right - scaledRRect.trRadiusX, scaledRRect.top)
177 | ..addArc(trCorner, trCornerArcStart, trCornerArcSweep);
178 | } else if (start + extent < scaledRRect.width) {
179 | final double dx = scaledRRect.width - (start + extent);
180 | final double sweep = math.acos(dx / scaledRRect.trRadiusX);
181 | path.addArc(trCorner, trCornerArcStart + sweep, trCornerArcSweep - sweep);
182 | }
183 |
184 | return path
185 | ..moveTo(scaledRRect.right, scaledRRect.top + scaledRRect.trRadiusY)
186 | ..lineTo(scaledRRect.right, scaledRRect.bottom - scaledRRect.brRadiusY)
187 | ..addArc(brCorner, 0.0, cornerArcSweep)
188 | ..lineTo(scaledRRect.left + scaledRRect.blRadiusX, scaledRRect.bottom)
189 | ..addArc(blCorner, math.pi / 2.0, cornerArcSweep)
190 | ..lineTo(scaledRRect.left, scaledRRect.top + scaledRRect.tlRadiusY);
191 | }
192 |
193 | /// Draw a rounded rectangle around [rect] using [borderRadius].
194 | ///
195 | /// The [borderSide] defines the line's color and weight.
196 | ///
197 | /// The top side of the rounded rectangle may be interrupted by a single gap
198 | /// if [gapExtent] is non-null. In that case the gap begins at
199 | /// `gapStart - gapPadding` (assuming that the [textDirection] is [TextDirection.ltr]).
200 | /// The gap's width is `(gapPadding + gapExtent + gapPadding) * gapPercentage`.
201 | @override
202 | void paint(
203 | Canvas canvas,
204 | Rect rect, {
205 | double gapStart,
206 | double gapExtent = 0.0,
207 | double gapPercentage = 0.0,
208 | TextDirection textDirection,
209 | }) {
210 | assert(gapExtent != null);
211 | assert(gapPercentage >= 0.0 && gapPercentage <= 1.0);
212 | assert(_cornersAreCircular(borderRadius));
213 |
214 | final Paint paint = borderSide.toPaint();
215 | final RRect outer = borderRadius.toRRect(rect);
216 | final RRect center = outer.deflate(borderSide.width / 2.0);
217 | if (gapStart == null || gapExtent <= 0.0 || gapPercentage == 0.0) {
218 | canvas.drawRRect(center, paint);
219 | } else {
220 | final double extent = lerpDouble(0.0, gapExtent + gapPadding * 2.0, gapPercentage);
221 | switch (textDirection) {
222 | case TextDirection.rtl:
223 | final Path path = _gapBorderPath(canvas, center, math.max(0.0, gapStart + gapPadding - extent), extent);
224 | canvas.drawPath(path, paint);
225 | break;
226 |
227 | case TextDirection.ltr:
228 | final Path path = _gapBorderPath(canvas, center, math.max(0.0, gapStart - gapPadding), extent);
229 | canvas.drawPath(path, paint);
230 | break;
231 | }
232 | }
233 | }
234 |
235 | @override
236 | bool operator ==(dynamic other) {
237 | if (identical(this, other))
238 | return true;
239 | if (runtimeType != other.runtimeType)
240 | return false;
241 | final OutlineInputBorder2 typedOther = other;
242 | return typedOther.borderSide == borderSide
243 | && typedOther.borderRadius == borderRadius
244 | && typedOther.gapPadding == gapPadding;
245 | }
246 |
247 | @override
248 | int get hashCode => hashValues(borderSide, borderRadius, gapPadding);
249 | }
--------------------------------------------------------------------------------
/lib/screens/AuthScreens/login.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_sign_in/google_sign_in.dart';
3 | import 'package:page_transition/page_transition.dart';
4 | import 'package:provider/provider.dart';
5 | import 'package:random_Fun/screens/AuthScreens/auth.dart';
6 | import 'package:random_Fun/screens/homeScreen.dart';
7 | import 'package:random_Fun/services/Authenticate.dart';
8 | import 'package:random_Fun/values/values.dart';
9 | import 'package:random_Fun/widgets/clipShadowPath.dart';
10 | import 'package:random_Fun/widgets/custom_button.dart';
11 | import 'package:random_Fun/widgets/custom_shape_clippers.dart';
12 | import 'package:random_Fun/widgets/custom_text_form_field.dart';
13 | import 'package:random_Fun/widgets/spaces.dart';
14 | import 'package:modal_progress_hud/modal_progress_hud.dart';
15 |
16 | class LoginScreen extends StatefulWidget {
17 | @override
18 | _LoginScreenState createState() => _LoginScreenState();
19 | }
20 |
21 | class _LoginScreenState extends State {
22 | TextEditingController emailController = TextEditingController(text: "");
23 | TextEditingController passController = TextEditingController(text: "");
24 | bool isLoading = false;
25 | final _formKey = GlobalKey();
26 | String _email, _password;
27 | bool _isSignedIn = false;
28 | final scaffoldKey = GlobalKey();
29 |
30 | @override
31 | void initState() {
32 | // TODO: implement initState
33 | super.initState();
34 | _check();
35 | }
36 |
37 | _check() async {
38 | var _googleSignIn = GoogleSignIn();
39 | var res = await _googleSignIn.isSignedIn();
40 | if (res) {
41 | setState(() {
42 | _isSignedIn = res;
43 | });
44 | }
45 | }
46 |
47 | @override
48 | Widget build(BuildContext context) {
49 | ThemeData theme = Theme.of(context);
50 | var heightOfScreen = MediaQuery.of(context).size.height;
51 | var widthOfScreen = MediaQuery.of(context).size.width;
52 |
53 | if (_isSignedIn == false) {
54 | return Scaffold(
55 | key: scaffoldKey,
56 | body: GestureDetector(
57 | onTap: () {
58 | FocusScopeNode currentFocus = FocusScope.of(context);
59 | if (!currentFocus.hasPrimaryFocus) {
60 | currentFocus.unfocus();
61 | }
62 | },
63 | child: ModalProgressHUD(
64 | color: AppColors.blueShade2,
65 | opacity: 0.4,
66 | inAsyncCall: isLoading,
67 | progressIndicator: CircularProgressIndicator(),
68 | child: Container(
69 | child: Stack(
70 | children: [
71 | ClipShadowPath(
72 | clipper: LoginDesign4ShapeClipper(),
73 | shadow: Shadow(blurRadius: 24, color: AppColors.blue),
74 | child: Container(
75 | height: heightOfScreen * 0.4,
76 | width: widthOfScreen,
77 | color: AppColors.blue,
78 | child: Container(
79 | margin: EdgeInsets.only(left: Sizes.MARGIN_24),
80 | child: Column(
81 | crossAxisAlignment: CrossAxisAlignment.start,
82 | children: [
83 | SizedBox(
84 | height: heightOfScreen * 0.1,
85 | ),
86 | Text(
87 | StringConst.WELCOME_BACK,
88 | style: theme.textTheme.headline6.copyWith(
89 | fontSize: Sizes.TEXT_SIZE_20,
90 | color: AppColors.white,
91 | ),
92 | ),
93 | Text(
94 | StringConst.LOG_IN_5,
95 | style: theme.textTheme.headline4.copyWith(
96 | color: AppColors.white,
97 | ),
98 | ),
99 | ],
100 | ),
101 | ),
102 | ),
103 | ),
104 | ListView(
105 | padding: EdgeInsets.all(Sizes.PADDING_0),
106 | children: [
107 | SizedBox(
108 | height: heightOfScreen * 0.45,
109 | ),
110 | Container(
111 | margin: EdgeInsets.symmetric(horizontal: Sizes.MARGIN_20),
112 | child: _buildForm(),
113 | ),
114 | ],
115 | ),
116 | ],
117 | ),
118 | ),
119 | ),
120 | ),
121 | );
122 | } else {
123 | return HomeScreen();
124 | }
125 | }
126 |
127 | Widget _buildForm() {
128 | ThemeData theme = Theme.of(context);
129 | final _auth = Provider.of(context);
130 | final focus = FocusNode();
131 |
132 | return Form(
133 | key: _formKey,
134 | child: Column(
135 | mainAxisSize: MainAxisSize.max,
136 | children: [
137 | CustomTextFormField(
138 | autofocus: false,
139 | textInputAction: TextInputAction.next,
140 | hasSuffixIcon: true,
141 | suffixIcon: Icon(
142 | Icons.email,
143 | color: AppColors.blackShade10,
144 | ),
145 | validator: (email) {
146 | if (email.isEmpty || email == "") {
147 | return "Email cant be empty";
148 | }
149 | },
150 | textInputType: TextInputType.emailAddress,
151 | controller: emailController,
152 | labelText: StringConst.EMAIL_ADDRESS,
153 | border: Borders.customOutlineInputBorder(),
154 | enabledBorder: Borders.customOutlineInputBorder(),
155 | focusedBorder: Borders.customOutlineInputBorder(
156 | color: AppColors.violetShade200,
157 | ),
158 | labelStyle: Styles.customTextStyle(),
159 | hintTextStyle: Styles.customTextStyle(),
160 | textStyle: Styles.customTextStyle(),
161 | onChanged: (val) {
162 | _email = val;
163 | },
164 | ),
165 | SpaceH20(),
166 | CustomTextFormField(
167 | maxLines: 1,
168 | autofocus: false,
169 | textInputAction: TextInputAction.next,
170 | validator: (pass) {
171 | if (pass.isEmpty || pass == '') {
172 | return "Password cannot be empty !";
173 | } else if (pass.length < 8) {
174 | return "Password too short !";
175 | }
176 | },
177 | controller: passController,
178 | textInputType: TextInputType.text,
179 | labelText: StringConst.PASSWORD,
180 | obscured: true,
181 | hasSuffixIcon: true,
182 | suffixIcon: Icon(
183 | Icons.lock,
184 | color: AppColors.blackShade10,
185 | ),
186 | border: Borders.customOutlineInputBorder(),
187 | enabledBorder: Borders.customOutlineInputBorder(),
188 | focusedBorder: Borders.customOutlineInputBorder(
189 | color: AppColors.violetShade200,
190 | ),
191 | labelStyle: Styles.customTextStyle(),
192 | hintTextStyle: Styles.customTextStyle(),
193 | textStyle: Styles.customTextStyle(),
194 | onChanged: (val) {
195 | _password = val;
196 | },
197 | ),
198 | SpaceH12(),
199 | Row(
200 | children: [
201 | Spacer(flex: 2),
202 | ],
203 | ),
204 | SpaceH12(),
205 | Container(
206 | width: Sizes.WIDTH_200,
207 | decoration: Decorations.customBoxDecoration(blurRadius: 10),
208 | child: CustomButton(
209 | title: StringConst.LOG_IN_2,
210 | elevation: Sizes.ELEVATION_8,
211 | textStyle: theme.textTheme.subtitle2.copyWith(
212 | color: AppColors.white,
213 | fontWeight: FontWeight.w600,
214 | ),
215 | color: AppColors.blue,
216 | height: Sizes.HEIGHT_40,
217 | onPressed: () async {
218 | if (_formKey.currentState.validate()) {
219 | setState(() {
220 | isLoading = true;
221 | });
222 |
223 | await _auth.signInWithEmailAndPassword(_email, _password).then((user) {
224 | setState(() {
225 | isLoading = false;
226 | });
227 |
228 | Navigator.pushReplacement(context, PageTransition(type: PageTransitionType.leftToRightWithFade, child: AuthWidget()));
229 | }).catchError((errorMsg) {
230 | setState(() {
231 | isLoading = false;
232 | });
233 | scaffoldKey.currentState.showSnackBar(SnackBar(
234 | content: Text(errorMsg.toString()),
235 | ));
236 | });
237 | // .then((value) => Navigator.pushReplacement(
238 | // context,
239 | // MaterialPageRoute(
240 | // builder: (context) => HomeScreen(),
241 | // )));
242 | }
243 | },
244 | ),
245 | ),
246 | Row(
247 | mainAxisAlignment: MainAxisAlignment.center,
248 | children: [
249 | InkWell(
250 | onTap: () {
251 | Navigator.pushReplacementNamed(context, '/signUpHome');
252 | },
253 | child: Padding(
254 | padding: const EdgeInsets.only(top: 20.0),
255 | child: RichText(
256 | text: TextSpan(
257 | children: [
258 | TextSpan(
259 | text: StringConst.DONT_HAVE_AN_ACCOUNT,
260 | style: theme.textTheme.subtitle.copyWith(
261 | color: AppColors.greyShade8,
262 | fontSize: Sizes.TEXT_SIZE_14,
263 | fontWeight: FontWeight.bold,
264 | ),
265 | ),
266 | TextSpan(
267 | text: StringConst.REGISTER,
268 | style: theme.textTheme.subtitle.copyWith(
269 | color: AppColors.purple,
270 | fontSize: Sizes.TEXT_SIZE_14,
271 | decoration: TextDecoration.underline,
272 | fontWeight: FontWeight.bold,
273 | )),
274 | ],
275 | ),
276 | ),
277 | ),
278 | ),
279 | ],
280 | ),
281 | ],
282 | ),
283 | );
284 | }
285 | }
286 |
--------------------------------------------------------------------------------
/lib/screens/AppScreens/NewPost.dart:
--------------------------------------------------------------------------------
1 | import 'package:chips_choice/chips_choice.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:modal_progress_hud/modal_progress_hud.dart';
4 | import 'package:provider/provider.dart';
5 | import 'package:random_Fun/models/Post.dart';
6 | import 'package:random_Fun/services/database.dart';
7 | import 'package:random_Fun/values/values.dart';
8 | import 'package:random_Fun/widgets/custom_button.dart';
9 | import 'package:random_Fun/widgets/custom_text_form_field.dart';
10 | import 'package:random_Fun/widgets/spaces.dart';
11 |
12 | class NewPost extends StatefulWidget {
13 | @override
14 | _NewPostState createState() => _NewPostState();
15 | }
16 |
17 | class _NewPostState extends State {
18 | final _formKey = GlobalKey();
19 | final _scaffoldKey = GlobalKey();
20 | final ssupController = TextEditingController(text: '');
21 | final detailController = TextEditingController(text: '');
22 | final linkController = TextEditingController(text: '');
23 |
24 | String _val, _desc, _links, _category;
25 | bool isLoading = false;
26 | final focus = FocusNode();
27 | int tag = 9;
28 | List options = [
29 | 'Books 📚 ',
30 | 'Series 🍿',
31 | 'Movies 🎬',
32 | 'Music 🎶',
33 | 'Writing ✍️',
34 | 'Technology 🖥️',
35 | 'Cars 🏎️',
36 | 'Food 🥘',
37 | 'Science 🔬',
38 | 'Random 🔀'
39 | ];
40 | @override
41 | Widget build(BuildContext context) {
42 | ThemeData theme = Theme.of(context);
43 | final db = Provider.of(context);
44 | final routes =
45 | ModalRoute.of(context).settings.arguments as Map;
46 | final String uid = routes['uid'];
47 |
48 | return Scaffold(
49 | key: _scaffoldKey,
50 | backgroundColor: Color(0xffEDF2F7),
51 | appBar: AppBar(
52 | title: Text('Share a cool idea !'),
53 | centerTitle: true,
54 | backgroundColor: Theme.of(context).primaryColor,
55 | elevation: 0.0,
56 | ),
57 | body: ModalProgressHUD(
58 | color: AppColors.blueShade2,
59 | opacity: 0.4,
60 | inAsyncCall: isLoading,
61 | progressIndicator: CircularProgressIndicator(),
62 | child: SingleChildScrollView(
63 | child: Container(
64 | margin: EdgeInsets.all(10.0),
65 | child: Column(
66 | children: [
67 | Form(
68 | key: _formKey,
69 | child: Column(
70 | mainAxisSize: MainAxisSize.max,
71 | children: [
72 | CustomTextFormField(
73 | hintText: 'Start like : I am reading a book !',
74 | autofocus: false,
75 | controller: ssupController,
76 | validator: (val) {
77 | if (val.isEmpty || val == "") {
78 | return "Describe something interesting you are doing !";
79 | }
80 | if (val.length > 51) {
81 | print(val.length);
82 | return "Keep it at most 50 words ,describe more in the next field";
83 | }
84 | },
85 | textInputType: TextInputType.text,
86 | textInputAction: TextInputAction.next,
87 | labelText: 'Whats Up ?',
88 | border: Borders.customOutlineInputBorder(),
89 | enabledBorder: Borders.customOutlineInputBorder(),
90 | focusedBorder: Borders.customOutlineInputBorder(
91 | color: AppColors.violetShade200,
92 | ),
93 | labelStyle: Styles.customTextStyle(),
94 | hintTextStyle: Styles.customTextStyle(),
95 | textStyle: Styles.customTextStyle(),
96 | onChanged: (val) {
97 | _val = val;
98 | },
99 | ),
100 | SpaceH20(),
101 | CustomTextFormField(
102 | textInputAction: TextInputAction.next,
103 | autofocus: false,
104 | controller: detailController,
105 | hintText:
106 | 'For Eg : How do you think it will entertain your friends too ?',
107 |
108 | validator: (desc) {
109 | if (desc.isEmpty ||
110 | desc == "" ||
111 | desc.length > 151 ||
112 | desc.length < 20) {
113 | print(desc.length);
114 | print(linkController.text.length);
115 | return "Keep it atleast 20 to 150 characters for better understanding !";
116 | }
117 | },
118 | textInputType: TextInputType.multiline,
119 | maxLines: 3,
120 | // controller: emailController,
121 | labelText: 'A bit more in detail !',
122 | border: Borders.customOutlineInputBorder(),
123 | enabledBorder: Borders.customOutlineInputBorder(),
124 | focusedBorder: Borders.customOutlineInputBorder(
125 | color: AppColors.violetShade200,
126 | ),
127 | labelStyle: Styles.customTextStyle(),
128 | hintTextStyle: Styles.customTextStyle(),
129 | textStyle: Styles.customTextStyle(),
130 | onChanged: (desc) {
131 | _desc = desc;
132 | },
133 | ),
134 | SpaceH20(),
135 | CustomTextFormField(
136 | hintText:
137 | 'A platform like Netfix , Prime or simply Google !',
138 | autofocus: false,
139 | controller: linkController,
140 | validator: (link) {
141 | if (link.isEmpty || link == "") {
142 | return "Where to find the resource you suggested ?";
143 | }
144 | if (link.length > 20) {
145 | return "Keep it under 20 characters";
146 | }
147 | },
148 | textInputType: TextInputType.text,
149 |
150 | // controller: emailController,
151 | labelText: 'Some links to it ?',
152 | border: Borders.customOutlineInputBorder(),
153 | enabledBorder: Borders.customOutlineInputBorder(),
154 | focusedBorder: Borders.customOutlineInputBorder(
155 | color: Theme.of(context).primaryColor,
156 | ),
157 | labelStyle: Styles.customTextStyle(),
158 | hintTextStyle: Styles.customTextStyle(),
159 | textStyle: Styles.customTextStyle(),
160 | onChanged: (link) {
161 | _links = link;
162 | },
163 | ),
164 | SpaceH12(),
165 | Container(
166 | child: Column(
167 | crossAxisAlignment: CrossAxisAlignment.start,
168 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
169 | children: [
170 | Text('Select a category'),
171 | ChipsChoice.single(
172 | value: tag,
173 | options: ChipsChoiceOption.listFrom(
174 | source: options,
175 | value: (i, v) => i,
176 | label: (i, v) => v,
177 | ),
178 | onChanged: (val) {
179 | setState(() {
180 | tag = val;
181 | });
182 | },
183 | ),
184 | ],
185 | ),
186 | ),
187 | SpaceH12(),
188 | Container(
189 | width: Sizes.WIDTH_200,
190 | decoration:
191 | Decorations.customBoxDecoration(blurRadius: 10),
192 | child: CustomButton(
193 | hasIcon: true,
194 | icon: Icon(
195 | Icons.send,
196 | color: Colors.white,
197 | ),
198 | title: 'Share It !',
199 | elevation: Sizes.ELEVATION_8,
200 | textStyle: theme.textTheme.subtitle2.copyWith(
201 | color: AppColors.white,
202 | fontWeight: FontWeight.w600,
203 | ),
204 | color: Theme.of(context).accentColor,
205 | height: Sizes.HEIGHT_40,
206 | onPressed: () async {
207 | if (_formKey.currentState.validate()) {
208 | setState(() {
209 | isLoading = true;
210 | });
211 | await db
212 | .createNewPost(
213 | uid,
214 | Post().toMap(
215 | _val, _desc, _links, options[tag]))
216 | .then((status) {
217 | setState(() {
218 | isLoading = false;
219 | ssupController.clear();
220 | detailController.clear();
221 | linkController.clear();
222 | });
223 | _scaffoldKey.currentState.showSnackBar(SnackBar(
224 | content: Text(
225 | 'Awesome 😘 , that was a great idea and now your friends can see it on their feeds !'),
226 | ));
227 | Navigator.pushNamed(context, '/home');
228 | }).catchError((errorMsg) {
229 | setState(() {
230 | isLoading = false;
231 | });
232 | _scaffoldKey.currentState.showSnackBar(SnackBar(
233 | content: Text(errorMsg.toString()),
234 | ));
235 | print(errorMsg.toString());
236 | });
237 | }
238 | },
239 | ),
240 | ),
241 | ],
242 | ),
243 | )
244 | ],
245 | ),
246 | ),
247 | ),
248 | ),
249 | );
250 | }
251 | }
252 |
--------------------------------------------------------------------------------
/lib/screens/AuthScreens/signUp.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:modal_progress_hud/modal_progress_hud.dart';
3 | import 'package:page_transition/page_transition.dart';
4 | import 'package:provider/provider.dart';
5 | import 'package:random_Fun/models/user.dart';
6 | import 'package:random_Fun/screens/AuthScreens/login.dart';
7 | import 'package:random_Fun/services/Authenticate.dart';
8 | import 'package:random_Fun/services/database.dart';
9 | import 'package:random_Fun/values/values.dart';
10 | import 'package:random_Fun/widgets/clipShadowPath.dart';
11 | import 'package:random_Fun/widgets/custom_button.dart';
12 | import 'package:random_Fun/widgets/custom_shape_clippers.dart';
13 | import 'package:random_Fun/widgets/custom_text_form_field.dart';
14 | import 'package:random_Fun/widgets/spaces.dart';
15 | import 'package:shared_preferences/shared_preferences.dart';
16 | import 'package:url_launcher/url_launcher.dart';
17 |
18 | class SignUp extends StatefulWidget {
19 | SignUp();
20 |
21 | @override
22 | _SignUpState createState() => _SignUpState();
23 | }
24 |
25 | class _SignUpState extends State {
26 | TextEditingController emailController = TextEditingController(text: "");
27 | TextEditingController passController = TextEditingController(text: "");
28 | TextEditingController nameController = TextEditingController(text: "");
29 | final _formKey = GlobalKey();
30 | final _scaffoldKey = GlobalKey();
31 | String _email, _password, _name;
32 | bool isLoading = false;
33 | bool isChecked = false;
34 | Future _prefs = SharedPreferences.getInstance();
35 | SharedPreferences prefs;
36 | @override
37 | void initState() {
38 | super.initState();
39 | _checkIfAccepted();
40 | }
41 |
42 | _checkIfAccepted() async {
43 | prefs = await _prefs;
44 | isChecked = prefs.getBool("isAccepted");
45 | }
46 |
47 | _launchURL() async {
48 | const url = StringConst.policy;
49 | if (await canLaunch(url)) {
50 | await launch(url);
51 | } else {
52 | throw 'Could not launch $url';
53 | }
54 | }
55 |
56 | onAgreementAccepted(bool value) async {
57 | prefs = await _prefs;
58 | prefs.setBool("isAccepted", value);
59 |
60 | setState(() {
61 | isChecked = value;
62 | });
63 | }
64 |
65 | @override
66 | Widget build(BuildContext context) {
67 | ThemeData theme = Theme.of(context);
68 | var heightOfScreen = MediaQuery.of(context).size.height;
69 | var widthOfScreen = MediaQuery.of(context).size.width;
70 |
71 | return Scaffold(
72 | key: _scaffoldKey,
73 | body: GestureDetector(
74 | onTap: () {
75 | FocusScopeNode currentFocus = FocusScope.of(context);
76 | if (!currentFocus.hasPrimaryFocus) {
77 | currentFocus.unfocus();
78 | }
79 | },
80 | child: ModalProgressHUD(
81 | color: AppColors.blueShade2,
82 | opacity: 0.4,
83 | inAsyncCall: isLoading,
84 | progressIndicator: CircularProgressIndicator(),
85 | child: Container(
86 | child: Stack(
87 | children: [
88 | ClipShadowPath(
89 | clipper: LoginDesign4ShapeClipper(),
90 | shadow: Shadow(blurRadius: 24, color: AppColors.blue),
91 | child: Container(
92 | height: heightOfScreen * 0.38,
93 | width: widthOfScreen,
94 | color: AppColors.blue,
95 | child: Container(
96 | margin: EdgeInsets.only(left: Sizes.MARGIN_24),
97 | child: Column(
98 | crossAxisAlignment: CrossAxisAlignment.start,
99 | children: [
100 | SizedBox(
101 | height: heightOfScreen * 0.1,
102 | ),
103 | Text(
104 | StringConst.WELCOME,
105 | style: theme.textTheme.headline6.copyWith(
106 | fontSize: Sizes.TEXT_SIZE_20,
107 | color: AppColors.white,
108 | ),
109 | ),
110 | Text(
111 | StringConst.SIGN_UP_3,
112 | style: theme.textTheme.headline4.copyWith(
113 | color: AppColors.white,
114 | ),
115 | ),
116 | ],
117 | ),
118 | ),
119 | ),
120 | ),
121 | ListView(
122 | padding: EdgeInsets.all(Sizes.PADDING_0),
123 | children: [
124 | SizedBox(
125 | height: heightOfScreen * 0.4,
126 | ),
127 | Container(
128 | margin: EdgeInsets.symmetric(horizontal: Sizes.MARGIN_20),
129 | child: _buildForm(),
130 | ),
131 | ],
132 | ),
133 | ],
134 | ),
135 | ),
136 | ),
137 | ),
138 | );
139 | }
140 |
141 | Widget _buildForm() {
142 | ThemeData theme = Theme.of(context);
143 | final _auth = Provider.of(context, listen: false);
144 | final focus = FocusNode();
145 | return Form(
146 | key: _formKey,
147 | child: Column(
148 | children: [
149 | CustomTextFormField(
150 | autofocus: false,
151 | hasSuffixIcon: true,
152 | textInputAction: TextInputAction.next,
153 | suffixIcon: Icon(
154 | Icons.person,
155 | color: AppColors.blackShade10,
156 | ),
157 | validator: (name) {
158 | if (name.isEmpty || name == '') {
159 | return "Not a proper name !";
160 | }
161 | },
162 | textInputType: TextInputType.text,
163 | controller: nameController,
164 | labelText: StringConst.USER_DISPLAY_NAME,
165 | border: Borders.customOutlineInputBorder(),
166 | enabledBorder: Borders.customOutlineInputBorder(),
167 | focusedBorder: Borders.customOutlineInputBorder(
168 | color: AppColors.violetShade200,
169 | ),
170 | labelStyle: Styles.customTextStyle(),
171 | hintTextStyle: Styles.customTextStyle(),
172 | textStyle: Styles.customTextStyle(),
173 | onChanged: (name) {
174 | _name = name;
175 | },
176 | ),
177 | SpaceH16(),
178 | CustomTextFormField(
179 | autofocus: false,
180 | textInputAction: TextInputAction.next,
181 | hasSuffixIcon: true,
182 | suffixIcon: Icon(
183 | Icons.email,
184 | color: AppColors.blackShade10,
185 | ),
186 | validator: (email) {
187 | if (!isValidEmail(email) || email.isEmpty || email == '') {
188 | return "Not a proper email !";
189 | }
190 | },
191 | textInputType: TextInputType.emailAddress,
192 | controller: emailController,
193 | labelText: StringConst.EMAIL_ADDRESS,
194 | border: Borders.customOutlineInputBorder(),
195 | enabledBorder: Borders.customOutlineInputBorder(),
196 | focusedBorder: Borders.customOutlineInputBorder(
197 | color: AppColors.violetShade200,
198 | ),
199 | labelStyle: Styles.customTextStyle(),
200 | hintTextStyle: Styles.customTextStyle(),
201 | textStyle: Styles.customTextStyle(),
202 | onChanged: (val) {
203 | _email = val;
204 | },
205 | ),
206 | SpaceH16(),
207 | CustomTextFormField(
208 | maxLines: 1,
209 | textInputAction: TextInputAction.done,
210 | autofocus: false,
211 | validator: (pass) {
212 | if (pass.isEmpty || pass == "" || pass.length < 8) {
213 | return "Password should be atleast 8 characters !";
214 | }
215 | },
216 | controller: passController,
217 | textInputType: TextInputType.text,
218 | labelText: StringConst.PASSWORD,
219 | obscured: true,
220 | hasSuffixIcon: true,
221 | suffixIcon: Icon(
222 | Icons.lock,
223 | color: AppColors.blackShade10,
224 | ),
225 | border: Borders.customOutlineInputBorder(),
226 | enabledBorder: Borders.customOutlineInputBorder(),
227 | focusedBorder: Borders.customOutlineInputBorder(
228 | color: AppColors.violetShade200,
229 | ),
230 | labelStyle: Styles.customTextStyle(),
231 | hintTextStyle: Styles.customTextStyle(),
232 | textStyle: Styles.customTextStyle(),
233 | onChanged: (val) {
234 | _password = val;
235 | },
236 | ),
237 | SpaceH12(),
238 | Row(
239 | mainAxisAlignment: MainAxisAlignment.center,
240 | children: [
241 | Checkbox(
242 | value: isChecked ?? false,
243 | onChanged: onAgreementAccepted,
244 | activeColor: AppColors.blue,
245 | ),
246 | isChecked == false
247 | ? GestureDetector(
248 | onTap: _launchURL,
249 | child: Text(
250 | 'Accept terms and conditions',
251 | style: TextStyle(
252 | fontSize: Sizes.TEXT_SIZE_14,
253 | decoration: TextDecoration.underline,
254 | color: AppColors.purple,
255 | ),
256 | ))
257 | : Text("Already accepted terms ! Login now . ")
258 | ],
259 | ),
260 | SpaceH12(),
261 | Column(
262 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
263 | children: [
264 | Container(
265 | width: Sizes.WIDTH_200,
266 | decoration: Decorations.customBoxDecoration(blurRadius: 10),
267 | child: CustomButton(
268 | title: StringConst.SIGN_ME_UP,
269 | elevation: Sizes.ELEVATION_8,
270 | textStyle: theme.textTheme.subtitle2.copyWith(
271 | color: AppColors.white,
272 | fontWeight: FontWeight.w600,
273 | ),
274 | color: AppColors.blue,
275 | height: Sizes.HEIGHT_40,
276 | onPressed: () async {
277 | prefs = await _prefs;
278 |
279 | if (prefs.getBool("isAccepted") == false) {
280 | _scaffoldKey.currentState.showSnackBar(SnackBar(content: Text("Please accept the terms before proceeding !")));
281 | return;
282 | }
283 | if (_formKey.currentState.validate()) {
284 | setState(() {
285 | isLoading = true;
286 | });
287 |
288 | final _auth = Provider.of(context, listen: false);
289 | final _db = Provider.of(context, listen: false);
290 |
291 | await _auth.signUpWithEmailAndPassword(_email, _password).then((user) async {
292 | if (user != null) {
293 | print("Name is" + _name);
294 | User newUser = User(uid: user.uid, displayName: _name, email: user.email, photoUrl: user.photoUrl, status: "I am new here");
295 | emailController.clear();
296 | passController.clear();
297 | nameController.clear();
298 | setState(() {
299 | isLoading = false;
300 | });
301 | await _db.addUserToDatabase(newUser).whenComplete(() {
302 | _scaffoldKey.currentState.showSnackBar(SnackBar(
303 | content: Text("Successfully registered , Login now !"),
304 | ));
305 | });
306 | }
307 | }).catchError((errorMsg) {
308 | setState(() {
309 | isLoading = false;
310 | });
311 | _scaffoldKey.currentState.showSnackBar(SnackBar(
312 | content: Text(errorMsg.toString()),
313 | ));
314 | });
315 | }
316 | },
317 | ),
318 | ),
319 | Container(
320 | height: MediaQuery.of(context).size.height * 0.17,
321 | child: Row(
322 | mainAxisAlignment: MainAxisAlignment.center,
323 | children: [
324 | InkWell(
325 | onTap: () {
326 | Navigator.pushReplacement(context, PageTransition(type: PageTransitionType.rightToLeftWithFade, child: LoginScreen()));
327 | },
328 | child: Padding(
329 | padding: const EdgeInsets.only(top: 20.0),
330 | child: RichText(
331 | text: TextSpan(
332 | children: [
333 | TextSpan(
334 | text: StringConst.ALREADY_HAVE_AN_ACCOUNT,
335 | style: theme.textTheme.subtitle.copyWith(
336 | color: AppColors.greyShade8,
337 | fontSize: Sizes.TEXT_SIZE_14,
338 | fontWeight: FontWeight.bold,
339 | ),
340 | ),
341 | TextSpan(
342 | text: StringConst.LOG_IN_2,
343 | style: theme.textTheme.subtitle.copyWith(
344 | color: AppColors.purple,
345 | fontSize: Sizes.TEXT_SIZE_14,
346 | decoration: TextDecoration.underline,
347 | fontWeight: FontWeight.bold,
348 | )),
349 | ],
350 | ),
351 | ),
352 | ),
353 | ),
354 | ],
355 | ),
356 | ),
357 | ],
358 | ),
359 | ],
360 | ),
361 | );
362 | }
363 | }
364 |
365 | bool isValidEmail(String email) {
366 | Pattern pattern = r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
367 | RegExp regex = new RegExp(pattern);
368 | return (!regex.hasMatch(email)) ? false : true;
369 | }
370 |
--------------------------------------------------------------------------------
/lib/widgets/custom_shape_clippers.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | //************************ for root screen *********************************//
4 | class CustomRootScreenShapeClipper extends CustomClipper {
5 | @override
6 | getClip(Size size) {
7 | final Path path = Path();
8 | path.lineTo(0.0, size.height * 0.5);
9 |
10 | var firstEndpoint = Offset(size.width * 0.7, size.height * 0);
11 | var firstControlPoint = Offset(size.width * 0.75, size.height * 0.45);
12 |
13 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
14 | firstEndpoint.dx, firstEndpoint.dy);
15 |
16 | path.lineTo(size.width, 0.0);
17 | path.close();
18 | return path;
19 | }
20 |
21 | @override
22 | bool shouldReclip(CustomClipper oldClipper) {
23 | return true;
24 | }
25 | }
26 |
27 | class CustomRootScreenShapeClipper2 extends CustomClipper {
28 | @override
29 | getClip(Size size) {
30 | final Path path = Path();
31 | path.moveTo(size.width * 0.3, size.height);
32 | path.lineTo(size.width * 0.3, size.height);
33 | path.lineTo(size.width, size.height * 0.5);
34 |
35 | var firstEndpoint = Offset(size.width * 0.3, size.height);
36 | var firstControlPoint = Offset(size.width * 0.25, size.height * 0.75);
37 |
38 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
39 | firstEndpoint.dx, firstEndpoint.dy);
40 |
41 | // path.lineTo(size.width, 0.0);
42 | path.close();
43 | return path;
44 | }
45 |
46 | @override
47 | bool shouldReclip(CustomClipper oldClipper) {
48 | return true;
49 | }
50 | }
51 |
52 | //************************ for login design 1 *********************************
53 | class CustomLoginShapeClipper1 extends CustomClipper {
54 | @override
55 | getClip(Size size) {
56 | final Path path = Path();
57 | path.lineTo(0.0, size.height * 0.5);
58 |
59 | var firstEndpoint = Offset(size.width, size.height * 0.25);
60 | var firstControlPoint = Offset(size.width * 0.75, size.height * 0.5);
61 |
62 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
63 | firstEndpoint.dx, firstEndpoint.dy);
64 |
65 | path.lineTo(size.width, 0.0);
66 | path.close();
67 | return path;
68 | }
69 |
70 | @override
71 | bool shouldReclip(CustomClipper oldClipper) {
72 | return true;
73 | }
74 | }
75 |
76 | class CustomLoginShapeClipper2 extends CustomClipper {
77 | @override
78 | getClip(Size size) {
79 | final Path path = Path();
80 | path.lineTo(0.0, size.height * 0.85);
81 |
82 | var firstEndpoint = Offset(size.width, size.height * 0.7);
83 | var firstControlPoint = Offset(size.width * 0.6, size.height * 0.85);
84 |
85 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
86 | firstEndpoint.dx, firstEndpoint.dy);
87 |
88 | path.lineTo(size.width, 0.0);
89 | path.close();
90 | return path;
91 | }
92 |
93 | @override
94 | bool shouldReclip(CustomClipper oldClipper) {
95 | return true;
96 | }
97 | }
98 |
99 | class CustomSignUpShapeClipper1 extends CustomClipper {
100 | @override
101 | getClip(Size size) {
102 | final Path path = Path();
103 | path.lineTo(0.0, size.height * 0.30);
104 |
105 | var firstEndpoint = Offset(size.width, size.height * 0.15);
106 | var firstControlPoint = Offset(size.width * 0.5, size.height * 0.13);
107 |
108 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
109 | firstEndpoint.dx, firstEndpoint.dy);
110 |
111 | path.lineTo(size.width, 0.0);
112 | path.close();
113 | return path;
114 | }
115 |
116 | @override
117 | bool shouldReclip(CustomClipper oldClipper) {
118 | return true;
119 | }
120 | }
121 |
122 | class CustomSignUpShapeClipper2 extends CustomClipper {
123 | @override
124 | getClip(Size size) {
125 | final Path path = Path();
126 | path.lineTo(0.0, size.height);
127 |
128 | var firstEndpoint = Offset(size.width, size.height * 0.52);
129 | var firstControlPoint = Offset(size.width * 0.25, size.height * 0.52);
130 |
131 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
132 | firstEndpoint.dx, firstEndpoint.dy);
133 |
134 | path.lineTo(size.width, 0.0);
135 | path.close();
136 | return path;
137 | }
138 |
139 | @override
140 | bool shouldReclip(CustomClipper oldClipper) {
141 | return true;
142 | }
143 | }
144 |
145 | class CustomSignUpShapeClipper3 extends CustomClipper {
146 | @override
147 | getClip(Size size) {
148 | final Path path = Path();
149 |
150 | path.lineTo(0.0, size.height * 0.8);
151 |
152 | var firstEndpoint = Offset(size.width, size.height * 0.7);
153 | var firstControlPoint = Offset(size.width * 0.70, size.height * 0.8);
154 |
155 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
156 | firstEndpoint.dx, firstEndpoint.dy);
157 |
158 | path.lineTo(size.width, 0.0);
159 | path.close();
160 | return path;
161 | }
162 |
163 | @override
164 | bool shouldReclip(CustomClipper oldClipper) {
165 | return true;
166 | }
167 | }
168 |
169 | //************************ for login design 3 *********************************
170 | class CustomLoginShapeClipper4 extends CustomClipper {
171 | @override
172 | getClip(Size size) {
173 | final Path path = Path();
174 | path.lineTo(0.0, size.height * 0.325);
175 |
176 | // path.lineTo(0.0, size.height * 0.3);
177 |
178 | var firstEndpoint = Offset(size.width * 0.22, size.height * 0.2);
179 | var firstControlPoint = Offset(size.width * 0.125, size.height * 0.30);
180 |
181 | // var firstEndpoint = Offset(size.width * 0.17, size.height * 0.2);
182 | // var firstControlPoint = Offset(size.width * 0.075, size.height * 0.30);
183 |
184 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
185 | firstEndpoint.dx, firstEndpoint.dy);
186 |
187 | var secondEndpoint = Offset(size.width * 0.6, size.height * 0.0725);
188 | var secondControlPoint = Offset(size.width * 0.3, size.height * 0.0825);
189 |
190 | // var secondEndpoint = Offset(size.width * 0.6, size.height * 0.05);
191 | // var secondControlPoint = Offset(size.width * 0.3, size.height * 0.06);
192 |
193 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
194 | secondEndpoint.dx, secondEndpoint.dy);
195 |
196 | var thirdEndpoint = Offset(size.width, size.height * 0.0);
197 | var thirdControlPoint = Offset(size.width * 0.99, size.height * 0.05);
198 |
199 | // var thirdEndpoint = Offset(size.width * 0.95, size.height * 0.0);
200 | // var thirdControlPoint = Offset(size.width * 0.9, size.height * 0.05);
201 |
202 | path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy,
203 | thirdEndpoint.dx, thirdEndpoint.dy);
204 | path.close();
205 | return path;
206 | }
207 |
208 | @override
209 | bool shouldReclip(CustomClipper oldClipper) {
210 | return true;
211 | }
212 | }
213 |
214 | class CustomLoginShapeClipper5 extends CustomClipper {
215 | @override
216 | getClip(Size size) {
217 | final Path path = Path();
218 | path.lineTo(0.0, size.height * 0.3);
219 |
220 | var firstEndpoint = Offset(size.width * 0.17, size.height * 0.2);
221 | var firstControlPoint = Offset(size.width * 0.075, size.height * 0.30);
222 |
223 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
224 | firstEndpoint.dx, firstEndpoint.dy);
225 |
226 | var secondEndpoint = Offset(size.width * 0.6, size.height * 0.05);
227 | var secondControlPoint = Offset(size.width * 0.3, size.height * 0.06);
228 |
229 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
230 | secondEndpoint.dx, secondEndpoint.dy);
231 |
232 | var thirdEndpoint = Offset(size.width * 0.95, size.height * 0.0);
233 | var thirdControlPoint = Offset(size.width * 0.9, size.height * 0.05);
234 |
235 | path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy,
236 | thirdEndpoint.dx, thirdEndpoint.dy);
237 |
238 | // path.lineTo(size.width, 0.0);
239 | path.close();
240 | return path;
241 | }
242 |
243 | @override
244 | bool shouldReclip(CustomClipper oldClipper) {
245 | return true;
246 | }
247 | }
248 |
249 | class CustomLoginShapeClipper3 extends CustomClipper {
250 | @override
251 | getClip(Size size) {
252 | final Path path = Path();
253 | path.moveTo(size.width * 0.05, size.height);
254 | path.lineTo(size.width, size.height);
255 | path.lineTo(size.width, size.height * 0.7);
256 |
257 | var firstEndpoint = Offset(size.width * 0.83, size.height * 0.8);
258 | var firstControlPoint = Offset(size.width * 0.925, size.height * 0.70);
259 | //
260 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
261 | firstEndpoint.dx, firstEndpoint.dy);
262 | //
263 | var secondEndpoint = Offset(size.width * 0.30, size.height * 0.95);
264 | var secondControlPoint =
265 | Offset(size.width * 0.70, size.height * 0.92); //height
266 | //
267 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
268 | secondEndpoint.dx, secondEndpoint.dy);
269 | //
270 | var thirdEndpoint = Offset(size.width * 0.05, size.height);
271 | var thirdControlPoint =
272 | Offset(size.width * 0.1, size.height * 0.95); //width
273 |
274 | path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy,
275 | thirdEndpoint.dx, thirdEndpoint.dy);
276 | //
277 | //
278 | // path.lineTo(size.width, 0.0);
279 | path.close();
280 | return path;
281 | }
282 |
283 | @override
284 | bool shouldReclip(CustomClipper oldClipper) {
285 | return true;
286 | }
287 | }
288 |
289 | class CustomLoginShapeClipper6 extends CustomClipper {
290 | @override
291 | getClip(Size size) {
292 | final Path path = Path();
293 | path.moveTo(size.width * 0, size.height);
294 | path.lineTo(size.width, size.height);
295 | path.lineTo(size.width, size.height * 0.675);
296 |
297 | var firstEndpoint = Offset(size.width * 0.78, size.height * 0.8);
298 | var firstControlPoint = Offset(size.width * 0.875, size.height * 0.70);
299 |
300 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
301 | firstEndpoint.dx, firstEndpoint.dy);
302 |
303 | var secondEndpoint = Offset(size.width * 0.30, size.height * 0.9275);
304 | var secondControlPoint = Offset(size.width * 0.70, size.height * 0.8975);
305 |
306 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
307 | secondEndpoint.dx, secondEndpoint.dy);
308 |
309 | var thirdEndpoint = Offset(size.width * 0.0, size.height);
310 | var thirdControlPoint = Offset(size.width * 0.04, size.height * 0.95);
311 |
312 | path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy,
313 | thirdEndpoint.dx, thirdEndpoint.dy);
314 |
315 | path.close();
316 | return path;
317 | }
318 |
319 | @override
320 | bool shouldReclip(CustomClipper oldClipper) {
321 | return true;
322 | }
323 | }
324 |
325 | //************************ for LoginDesign4 *********************************//
326 |
327 | class LoginDesign4ShapeClipper extends CustomClipper {
328 | @override
329 | getClip(Size size) {
330 | final Path path = Path();
331 | path.lineTo(0.0, size.height * 0.8);
332 |
333 | var firstEndpoint = Offset(size.width * 0.6, size.height * 0.55);
334 | var firstControlPoint = Offset(size.width * 0.40, size.height);
335 |
336 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
337 | firstEndpoint.dx, firstEndpoint.dy);
338 |
339 | var secondEndpoint = Offset(size.width * 0.8, size.height * 0.35);
340 | var secondControlPoint = Offset(size.width * 0.7, size.height * 0.35);
341 |
342 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
343 | secondEndpoint.dx, secondEndpoint.dy);
344 |
345 | var thirdEndpoint = Offset(size.width * 0.9, size.height * 0.25);
346 | var thirdControlPoint = Offset(size.width * 0.9, size.height * 0.35);
347 |
348 | path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy,
349 | thirdEndpoint.dx, thirdEndpoint.dy);
350 |
351 | var fourthEndpoint = Offset(size.width * 0.78, size.height * 0.15);
352 | var fourthControlPoint = Offset(size.width * 0.9, size.height * 0.15);
353 |
354 | path.quadraticBezierTo(fourthControlPoint.dx, fourthControlPoint.dy,
355 | fourthEndpoint.dx, fourthEndpoint.dy);
356 |
357 | var fifthEndpoint = Offset(size.width * 0.5, size.height * 0);
358 | var fifthControlPoint = Offset(size.width * 0.6, size.height * 0.15);
359 |
360 | path.quadraticBezierTo(fifthControlPoint.dx, fifthControlPoint.dy,
361 | fifthEndpoint.dx, fifthEndpoint.dy);
362 | // path.lineTo(size.width, 0.0);
363 | path.close();
364 | return path;
365 | }
366 |
367 | @override
368 | bool shouldReclip(CustomClipper oldClipper) {
369 | return true;
370 | }
371 | }
372 |
373 | //************************ for LoginDesign5 *********************************//
374 |
375 | class SemiCircleShapeClipper extends CustomClipper {
376 | @override
377 | getClip(Size size) {
378 | final Path path = Path();
379 | path.moveTo(size.width * 0.1, size.height * 0.0);
380 |
381 | var firstEndpoint = Offset(size.width * 0.9, size.height * 0.0);
382 | var firstControlPoint = Offset(size.width * 0.45, size.height);
383 |
384 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
385 | firstEndpoint.dx, firstEndpoint.dy);
386 |
387 | path.close();
388 | return path;
389 | }
390 |
391 | @override
392 | bool shouldReclip(CustomClipper oldClipper) {
393 | return true;
394 | }
395 | }
396 |
397 | class SemiCircleShapeClipper2 extends CustomClipper {
398 | @override
399 | getClip(Size size) {
400 | final Path path = Path();
401 | path.moveTo(size.width * 0.7, size.height * 0.0);
402 |
403 | var firstEndpoint = Offset(size.width, size.height * 0.8);
404 | var firstControlPoint = Offset(size.width * 0.6, size.height * 0.7);
405 |
406 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
407 | firstEndpoint.dx, firstEndpoint.dy);
408 |
409 | path.lineTo(size.width, 0.0);
410 | path.close();
411 | return path;
412 | }
413 |
414 | @override
415 | bool shouldReclip(CustomClipper oldClipper) {
416 | return true;
417 | }
418 | }
419 |
420 | //************************ for LoginDesign6 *********************************//
421 |
422 | class WaveShapeClipper extends CustomClipper {
423 | @override
424 | getClip(Size size) {
425 | final Path path = Path();
426 | path.lineTo(size.width * 0.0, size.height * 0.6);
427 |
428 | var firstEndpoint = Offset(size.width * 0.5, size.height * 0.6);
429 | var firstControlPoint = Offset(size.width * 0.25, size.height * 0.4);
430 |
431 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
432 | firstEndpoint.dx, firstEndpoint.dy);
433 |
434 | var secondEndpoint = Offset(size.width, size.height * 0.8);
435 | var secondControlPoint = Offset(size.width * 0.75, size.height * 0.8);
436 |
437 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
438 | secondEndpoint.dx, secondEndpoint.dy);
439 |
440 | path.lineTo(size.width, 0.0);
441 | path.close();
442 | return path;
443 | }
444 |
445 | @override
446 | bool shouldReclip(CustomClipper oldClipper) {
447 | return true;
448 | }
449 | }
450 |
451 | class ReverseWaveShapeClipper extends CustomClipper {
452 | @override
453 | getClip(Size size) {
454 | final Path path = Path();
455 | path.lineTo(size.width * 0.0, size.height * 0.8);
456 |
457 | var firstEndpoint = Offset(size.width * 0.5, size.height * 0.8);
458 | var firstControlPoint = Offset(size.width * 0.25, size.height);
459 |
460 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
461 | firstEndpoint.dx, firstEndpoint.dy);
462 |
463 | var secondEndpoint = Offset(size.width, size.height * 0.6);
464 | var secondControlPoint = Offset(size.width * 0.75, size.height * 0.6);
465 |
466 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
467 | secondEndpoint.dx, secondEndpoint.dy);
468 |
469 | path.lineTo(size.width, 0.0);
470 | path.close();
471 | return path;
472 | }
473 |
474 | @override
475 | bool shouldReclip(CustomClipper oldClipper) {
476 | return true;
477 | }
478 | }
479 |
480 | //************************ for LoginDesign7 *********************************//
481 |
482 | class LoginDesign7ShapeClipper1 extends CustomClipper {
483 | @override
484 | getClip(Size size) {
485 | final Path path = Path();
486 | path.lineTo(size.width * 0.0, size.height * 0.5);
487 |
488 | var firstEndpoint = Offset(size.width * 0.6, size.height * 0.0);
489 | var firstControlPoint = Offset(size.width * 0.3, size.height);
490 |
491 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
492 | firstEndpoint.dx, firstEndpoint.dy);
493 |
494 | path.close();
495 | return path;
496 | }
497 |
498 | @override
499 | bool shouldReclip(CustomClipper oldClipper) {
500 | return true;
501 | }
502 | }
503 |
504 | class LoginDesign7ShapeClipper2 extends CustomClipper {
505 | @override
506 | getClip(Size size) {
507 | final Path path = Path();
508 | path.moveTo(size.width * 0.3, size.height * 0.0);
509 |
510 | var firstEndpoint = Offset(size.width, size.height);
511 | var firstControlPoint = Offset(size.width * 0.2, size.height * 1);
512 |
513 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
514 | firstEndpoint.dx, firstEndpoint.dy);
515 |
516 | path.lineTo(size.width, 0.0);
517 | path.close();
518 | return path;
519 | }
520 |
521 | @override
522 | bool shouldReclip(CustomClipper oldClipper) {
523 | return true;
524 | }
525 | }
526 |
527 | class LoginDesign7ShapeClipper3 extends CustomClipper {
528 | @override
529 | getClip(Size size) {
530 | final Path path = Path();
531 | path.moveTo(size.width * 0.0, size.height * 0.9);
532 |
533 | var firstEndpoint = Offset(size.width * 0.3, size.height);
534 | var firstControlPoint = Offset(size.width * 0.3, size.height * 0.8);
535 |
536 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
537 | firstEndpoint.dx, firstEndpoint.dy);
538 |
539 | path.lineTo(0.0, size.height);
540 | path.close();
541 | return path;
542 | }
543 |
544 | @override
545 | bool shouldReclip(CustomClipper oldClipper) {
546 | return true;
547 | }
548 | }
549 |
--------------------------------------------------------------------------------