├── res └── values │ └── strings_en.arb ├── android ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ └── styles.xml │ │ │ └── drawable │ │ │ │ └── launch_background.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── aeologic │ │ │ │ └── fluttercameraapp │ │ │ │ └── MainActivity.java │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── .gitignore ├── settings.gradle ├── build.gradle ├── gradlew.bat └── gradlew ├── .DS_Store ├── assets ├── .DS_Store └── images │ ├── ic_no_image.png │ ├── ic_shutter_1.png │ ├── ic_powered_by.png │ ├── ic_switch_camera_3.png │ └── ic_flutter_devs_logo.png ├── screens ├── demo.gif ├── android1.jpg ├── android2.jpg ├── iphone1.jpg ├── iphone2.jpg └── iphone3.jpg ├── lib ├── constant │ └── Constant.dart ├── utility │ └── DiagonalClipper.dart ├── main.dart ├── generated │ └── i18n.dart └── screen │ ├── SplashScreen.dart │ ├── HomeScreen.dart │ └── CameraHomeScreen.dart ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── AppDelegate.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── 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-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── main.m │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── .gitignore ├── Podfile.lock └── Podfile ├── .idea ├── vcs.xml ├── modules.xml ├── libraries │ ├── Flutter_Plugins.xml │ ├── Dart_SDK.xml │ └── Dart_Packages.xml ├── CameraUIDemo.iml ├── misc.xml ├── codeStyles │ └── Project.xml └── workspace.xml ├── .flutter-plugins ├── pubspec.yaml ├── README.md ├── test └── widget_test.dart ├── flutter_camera_app_android.iml ├── flutter_camera_app.iml ├── .packages └── pubspec.lock /res/values/strings_en.arb: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/.DS_Store -------------------------------------------------------------------------------- /assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/assets/.DS_Store -------------------------------------------------------------------------------- /screens/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/screens/demo.gif -------------------------------------------------------------------------------- /screens/android1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/screens/android1.jpg -------------------------------------------------------------------------------- /screens/android2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/screens/android2.jpg -------------------------------------------------------------------------------- /screens/iphone1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/screens/iphone1.jpg -------------------------------------------------------------------------------- /screens/iphone2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/screens/iphone2.jpg -------------------------------------------------------------------------------- /screens/iphone3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/screens/iphone3.jpg -------------------------------------------------------------------------------- /lib/constant/Constant.dart: -------------------------------------------------------------------------------- 1 | final String HOME_SCREEN="/HOME_SCREEN"; 2 | final String CAMERA_SCREEN="/CAMERA_SCREEN"; -------------------------------------------------------------------------------- /assets/images/ic_no_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/assets/images/ic_no_image.png -------------------------------------------------------------------------------- /assets/images/ic_shutter_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/assets/images/ic_shutter_1.png -------------------------------------------------------------------------------- /assets/images/ic_powered_by.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/assets/images/ic_powered_by.png -------------------------------------------------------------------------------- /assets/images/ic_switch_camera_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/assets/images/ic_switch_camera_3.png -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /assets/images/ic_flutter_devs_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/assets/images/ic_flutter_devs_logo.png -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.class 3 | .gradle 4 | /local.properties 5 | /.idea/workspace.xml 6 | /.idea/libraries 7 | .DS_Store 8 | /build 9 | /captures 10 | GeneratedPluginRegistrant.java 11 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flutter-devs/flutter_camera_demo/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/flutter-devs/flutter_camera_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.flutter-plugins: -------------------------------------------------------------------------------- 1 | camera=C:\\Users\\ashish\\AppData\\Local\\Android\\flutter\\.pub-cache\\git\\plugins-f934e9975f4434446198434982524669fd40f36b\\packages\\camera\\ 2 | path_provider=C:\\Users\\ashish\\AppData\\Local\\Android\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-0.4.1\\ 3 | -------------------------------------------------------------------------------- /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-4.4-all.zip 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/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. -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/aeologic/fluttercameraapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.aeologic.fluttercameraapp; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /lib/utility/DiagonalClipper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class DialogonalClipper extends CustomClipper { 5 | @override 6 | Path getClip(Size size) { 7 | Path path = new Path(); 8 | path.lineTo(0.0, size.height - 60.0); 9 | path.lineTo(size.width, size.height); 10 | path.lineTo(size.width, 0.0); 11 | path.close(); 12 | return path; 13 | } 14 | 15 | @override 16 | bool shouldReclip(CustomClipper oldClipper) => true; 17 | } 18 | -------------------------------------------------------------------------------- /.idea/libraries/Flutter_Plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.1.2' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/app.flx 37 | /Flutter/app.zip 38 | /Flutter/flutter_assets/ 39 | /Flutter/App.framework 40 | /Flutter/Flutter.framework 41 | /Flutter/Generated.xcconfig 42 | /ServiceDefinitions.json 43 | 44 | Pods/ 45 | .symlinks/ 46 | -------------------------------------------------------------------------------- /.idea/CameraUIDemo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_camera_app 2 | description: A new Flutter Camera application. 3 | 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | cupertino_icons: ^0.1.2 14 | #camera: ^0.2.3 15 | camera: 16 | git: 17 | url: git://github.com/kmorkos/plugins.git 18 | ref: camera/crash-fix 19 | path: packages/camera/ 20 | path_provider: ^0.4.1 21 | 22 | dev_dependencies: 23 | flutter_test: 24 | sdk: flutter 25 | 26 | flutter: 27 | 28 | uses-material-design: true 29 | 30 | assets: 31 | - assets/images/ic_flutter_devs_logo.png 32 | - assets/images/ic_powered_by.png 33 | - assets/images/ic_shutter_1.png 34 | - assets/images/ic_switch_camera_3.png 35 | - assets/images/ic_no_image.png 36 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - camera (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | - path_provider (0.0.1): 6 | - Flutter 7 | 8 | DEPENDENCIES: 9 | - camera (from `.symlinks/plugins/camera/ios`) 10 | - Flutter (from `.symlinks/flutter/ios`) 11 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 12 | 13 | EXTERNAL SOURCES: 14 | camera: 15 | :path: ".symlinks/plugins/camera/ios" 16 | Flutter: 17 | :path: ".symlinks/flutter/ios" 18 | path_provider: 19 | :path: ".symlinks/plugins/path_provider/ios" 20 | 21 | SPEC CHECKSUMS: 22 | camera: be01db3b2193839f9af56a9db99b7fea444d35f3 23 | Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296 24 | path_provider: 09407919825bfe3c2deae39453b7a5b44f467873 25 | 26 | PODFILE CHECKSUM: 1e5af4103afd21ca5ead147d7b81d06f494f51a2 27 | 28 | COCOAPODS: 1.5.3 29 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Camera Demo 2 | 3 | A Flutter app to showcase Camera View. 4 | 5 | # Demo 6 | 7 | 8 | 9 | 10 | # Android Screen 11 | 12 | 13 | 14 | # iOS Screen 15 | 16 | 17 | 18 | 19 | ## Getting Started 20 | 21 | For help getting started with Flutter, view our online 22 | [documentation](https://flutter.io/). 23 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:camera/camera.dart'; 2 | import 'dart:async'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_camera_app/constant/Constant.dart'; 6 | import 'package:flutter_camera_app/screen/CameraHomeScreen.dart'; 7 | import 'package:flutter_camera_app/screen/HomeScreen.dart'; 8 | import 'package:flutter_camera_app/screen/SplashScreen.dart'; 9 | 10 | List cameras; 11 | 12 | Future main() async { 13 | try { 14 | cameras = await availableCameras(); 15 | } on CameraException catch (e) { 16 | //logError(e.code, e.description); 17 | } 18 | 19 | runApp( 20 | MaterialApp( 21 | title: "Camera App", 22 | debugShowCheckedModeBanner: false, 23 | theme: ThemeData( 24 | primarySwatch: Colors.blue, 25 | ), 26 | home: SplashScreen(), 27 | routes: { 28 | HOME_SCREEN: (BuildContext context) => HomeScreen(), 29 | CAMERA_SCREEN: (BuildContext context) => CameraHomeScreen(cameras), 30 | }, 31 | ), 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter 3 | // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to 4 | // find child widgets in the widget tree, read text, and verify that the values of widget properties 5 | // are correct. 6 | 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_test/flutter_test.dart'; 9 | 10 | import 'package:flutter_camera_app/main.dart'; 11 | 12 | void main() { 13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 14 | // Build our app and trigger a frame. 15 | await tester.pumpWidget(new MyApp()); 16 | 17 | // Verify that our counter starts at 0. 18 | expect(find.text('0'), findsOneWidget); 19 | expect(find.text('1'), findsNothing); 20 | 21 | // Tap the '+' icon and trigger a frame. 22 | await tester.tap(find.byIcon(Icons.add)); 23 | await tester.pump(); 24 | 25 | // Verify that our counter has incremented. 26 | expect(find.text('0'), findsNothing); 27 | expect(find.text('1'), findsOneWidget); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | -------------------------------------------------------------------------------- /flutter_camera_app_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /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 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | Flutter Camera App 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | NSCameraUsageDescription 26 | Can I use the camera please? 27 | NSMicrophoneUsageDescription 28 | Can I use the mic please? 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UIRequiresFullScreen 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.aeologic.fluttercameraapp" 37 | minSdkVersion 21 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 27 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /lib/generated/i18n.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'dart:async'; 3 | 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | // ignore_for_file: non_constant_identifier_names 7 | // ignore_for_file: camel_case_types 8 | // ignore_for_file: prefer_single_quotes 9 | 10 | //This file is automatically generated. DO NOT EDIT, all your changes would be lost. 11 | 12 | class S implements WidgetsLocalizations { 13 | const S(); 14 | 15 | static const GeneratedLocalizationsDelegate delegate = 16 | const GeneratedLocalizationsDelegate(); 17 | 18 | static S of(BuildContext context) => 19 | Localizations.of(context, WidgetsLocalizations); 20 | 21 | @override 22 | TextDirection get textDirection => TextDirection.ltr; 23 | 24 | } 25 | 26 | class en extends S { 27 | const en(); 28 | } 29 | 30 | 31 | class GeneratedLocalizationsDelegate extends LocalizationsDelegate { 32 | const GeneratedLocalizationsDelegate(); 33 | 34 | List get supportedLocales { 35 | return const [ 36 | 37 | const Locale("en", ""), 38 | 39 | ]; 40 | } 41 | 42 | LocaleResolutionCallback resolution({Locale fallback}) { 43 | return (Locale locale, Iterable supported) { 44 | final Locale languageLocale = new Locale(locale.languageCode, ""); 45 | if (supported.contains(locale)) 46 | return locale; 47 | else if (supported.contains(languageLocale)) 48 | return languageLocale; 49 | else { 50 | final Locale fallbackLocale = fallback ?? supported.first; 51 | return fallbackLocale; 52 | } 53 | }; 54 | } 55 | 56 | @override 57 | Future load(Locale locale) { 58 | final String lang = getLang(locale); 59 | switch (lang) { 60 | 61 | case "en": 62 | return new SynchronousFuture(const en()); 63 | 64 | default: 65 | return new SynchronousFuture(const S()); 66 | } 67 | } 68 | 69 | @override 70 | bool isSupported(Locale locale) => supportedLocales.contains(locale); 71 | 72 | @override 73 | bool shouldReload(GeneratedLocalizationsDelegate old) => false; 74 | } 75 | 76 | String getLang(Locale l) => l.countryCode != null && l.countryCode.isEmpty 77 | ? l.languageCode 78 | : l.toString(); 79 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | def parse_KV_file(file, separator='=') 8 | file_abs_path = File.expand_path(file) 9 | if !File.exists? file_abs_path 10 | return []; 11 | end 12 | pods_ary = [] 13 | skip_line_start_symbols = ["#", "/"] 14 | File.foreach(file_abs_path) { |line| 15 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 16 | plugin = line.split(pattern=separator) 17 | if plugin.length == 2 18 | podname = plugin[0].strip() 19 | path = plugin[1].strip() 20 | podpath = File.expand_path("#{path}", file_abs_path) 21 | pods_ary.push({:name => podname, :path => podpath}); 22 | else 23 | puts "Invalid plugin specification: #{line}" 24 | end 25 | } 26 | return pods_ary 27 | end 28 | 29 | target 'Runner' do 30 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 31 | # referring to absolute paths on developers' machines. 32 | system('rm -rf .symlinks') 33 | system('mkdir -p .symlinks/plugins') 34 | 35 | # Flutter Pods 36 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 37 | if generated_xcode_build_settings.empty? 38 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 39 | end 40 | generated_xcode_build_settings.map { |p| 41 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 42 | symlink = File.join('.symlinks', 'flutter') 43 | File.symlink(File.dirname(p[:path]), symlink) 44 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 45 | end 46 | } 47 | 48 | # Plugin Pods 49 | plugin_pods = parse_KV_file('../.flutter-plugins') 50 | plugin_pods.map { |p| 51 | symlink = File.join('.symlinks', 'plugins', p[:name]) 52 | File.symlink(p[:path], symlink) 53 | pod p[:name], :path => File.join(symlink, 'ios') 54 | } 55 | end 56 | 57 | post_install do |installer| 58 | installer.pods_project.targets.each do |target| 59 | target.build_configurations.each do |config| 60 | config.build_settings['ENABLE_BITCODE'] = 'NO' 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /lib/screen/SplashScreen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_camera_app/constant/Constant.dart'; 5 | 6 | class SplashScreen extends StatefulWidget { 7 | @override 8 | SplashScreenState createState() => new SplashScreenState(); 9 | } 10 | 11 | class SplashScreenState extends State 12 | with SingleTickerProviderStateMixin { 13 | var _visible = true; 14 | 15 | AnimationController animationController; 16 | Animation animation; 17 | 18 | startTime() async { 19 | var _duration = new Duration(seconds: 3); 20 | return new Timer(_duration, navigationPage); 21 | } 22 | 23 | void navigationPage() { 24 | Navigator.of(context).pushReplacementNamed(HOME_SCREEN); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | animationController = new AnimationController( 31 | vsync: this, 32 | duration: new Duration(seconds: 2), 33 | ); 34 | animation = 35 | new CurvedAnimation(parent: animationController, curve: Curves.easeOut); 36 | 37 | animation.addListener(() => this.setState(() {})); 38 | animationController.forward(); 39 | 40 | setState(() { 41 | _visible = !_visible; 42 | }); 43 | startTime(); 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | return Scaffold( 49 | body: Stack( 50 | fit: StackFit.expand, 51 | children: [ 52 | new Column( 53 | mainAxisAlignment: MainAxisAlignment.end, 54 | mainAxisSize: MainAxisSize.min, 55 | children: [ 56 | Padding( 57 | padding: EdgeInsets.only(bottom: 30.0), 58 | child: new Image.asset( 59 | 'assets/images/ic_powered_by.png', 60 | height: 25.0, 61 | fit: BoxFit.scaleDown, 62 | ), 63 | ) 64 | ], 65 | ), 66 | new Column( 67 | mainAxisAlignment: MainAxisAlignment.center, 68 | children: [ 69 | new Image.asset( 70 | 'assets/images/ic_flutter_devs_logo.png', 71 | width: animation.value * 250, 72 | height: animation.value * 250, 73 | ), 74 | ], 75 | ), 76 | ], 77 | ), 78 | ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /flutter_camera_app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 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 | 39 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /.packages: -------------------------------------------------------------------------------- 1 | # Generated by pub on 2019-01-22 12:46:40.804091. 2 | async:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib/ 3 | boolean_selector:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib/ 4 | camera:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/git/plugins-f934e9975f4434446198434982524669fd40f36b/packages/camera/lib/ 5 | charcode:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/ 6 | collection:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/ 7 | cupertino_icons:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.2/lib/ 8 | flutter:file:///C:/Users/ashish/AppData/Local/Android/flutter/packages/flutter/lib/ 9 | flutter_test:file:///C:/Users/ashish/AppData/Local/Android/flutter/packages/flutter_test/lib/ 10 | matcher:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib/ 11 | meta:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib/ 12 | path:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib/ 13 | path_provider:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-0.4.1/lib/ 14 | quiver:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.1/lib/ 15 | sky_engine:file:///C:/Users/ashish/AppData/Local/Android/flutter/bin/cache/pkg/sky_engine/lib/ 16 | source_span:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.1/lib/ 17 | stack_trace:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/ 18 | stream_channel:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib/ 19 | string_scanner:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib/ 20 | term_glyph:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.1/lib/ 21 | test_api:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.1/lib/ 22 | typed_data:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/ 23 | vector_math:file:///C:/Users/ashish/AppData/Local/Android/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/ 24 | flutter_camera_app:lib/ 25 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.8" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.0.4" 18 | camera: 19 | dependency: "direct main" 20 | description: 21 | path: "packages/camera/" 22 | ref: "camera/crash-fix" 23 | resolved-ref: f934e9975f4434446198434982524669fd40f36b 24 | url: "git://github.com/kmorkos/plugins.git" 25 | source: git 26 | version: "0.2.3" 27 | charcode: 28 | dependency: transitive 29 | description: 30 | name: charcode 31 | url: "https://pub.dartlang.org" 32 | source: hosted 33 | version: "1.1.2" 34 | collection: 35 | dependency: transitive 36 | description: 37 | name: collection 38 | url: "https://pub.dartlang.org" 39 | source: hosted 40 | version: "1.14.11" 41 | cupertino_icons: 42 | dependency: "direct main" 43 | description: 44 | name: cupertino_icons 45 | url: "https://pub.dartlang.org" 46 | source: hosted 47 | version: "0.1.2" 48 | flutter: 49 | dependency: "direct main" 50 | description: flutter 51 | source: sdk 52 | version: "0.0.0" 53 | flutter_test: 54 | dependency: "direct dev" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | matcher: 59 | dependency: transitive 60 | description: 61 | name: matcher 62 | url: "https://pub.dartlang.org" 63 | source: hosted 64 | version: "0.12.3+1" 65 | meta: 66 | dependency: transitive 67 | description: 68 | name: meta 69 | url: "https://pub.dartlang.org" 70 | source: hosted 71 | version: "1.1.6" 72 | path: 73 | dependency: transitive 74 | description: 75 | name: path 76 | url: "https://pub.dartlang.org" 77 | source: hosted 78 | version: "1.6.2" 79 | path_provider: 80 | dependency: "direct main" 81 | description: 82 | name: path_provider 83 | url: "https://pub.dartlang.org" 84 | source: hosted 85 | version: "0.4.1" 86 | quiver: 87 | dependency: transitive 88 | description: 89 | name: quiver 90 | url: "https://pub.dartlang.org" 91 | source: hosted 92 | version: "2.0.1" 93 | sky_engine: 94 | dependency: transitive 95 | description: flutter 96 | source: sdk 97 | version: "0.0.99" 98 | source_span: 99 | dependency: transitive 100 | description: 101 | name: source_span 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.4.1" 105 | stack_trace: 106 | dependency: transitive 107 | description: 108 | name: stack_trace 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.9.3" 112 | stream_channel: 113 | dependency: transitive 114 | description: 115 | name: stream_channel 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.6.8" 119 | string_scanner: 120 | dependency: transitive 121 | description: 122 | name: string_scanner 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.0.4" 126 | term_glyph: 127 | dependency: transitive 128 | description: 129 | name: term_glyph 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "1.0.1" 133 | test_api: 134 | dependency: transitive 135 | description: 136 | name: test_api 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "0.2.1" 140 | typed_data: 141 | dependency: transitive 142 | description: 143 | name: typed_data 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "1.1.6" 147 | vector_math: 148 | dependency: transitive 149 | description: 150 | name: vector_math 151 | url: "https://pub.dartlang.org" 152 | source: hosted 153 | version: "2.0.8" 154 | sdks: 155 | dart: ">=2.0.0 <3.0.0" 156 | flutter: ">=0.1.4 <2.0.0" 157 | -------------------------------------------------------------------------------- /lib/screen/HomeScreen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_camera_app/constant/Constant.dart'; 6 | 7 | class HomeScreen extends StatefulWidget { 8 | HomeScreen(); 9 | 10 | @override 11 | State createState() { 12 | return _HomeScreenState(); 13 | } 14 | } 15 | 16 | class _HomeScreenState extends State { 17 | String _imagePath; 18 | Widget image; 19 | double _headerHeight = 320.0; 20 | final String _assetImagePath = 'assets/images/ic_no_image.png'; 21 | 22 | _HomeScreenState(); 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return Scaffold( 32 | body: Stack( 33 | children: [ 34 | _imagePath != null 35 | ? _getImageFromFile(_imagePath) 36 | : _getImageFromAsset(), 37 | _getCameraFab(), 38 | _getLogo(), 39 | ], 40 | )); 41 | } 42 | 43 | Widget _getImageFromAsset() { 44 | return Padding( 45 | padding: EdgeInsets.only(bottom: 30.0), 46 | child: Container( 47 | width: double.infinity, 48 | height: _headerHeight, 49 | color: Colors.grey, 50 | child: Column( 51 | mainAxisAlignment: MainAxisAlignment.center, 52 | children: [ 53 | Image.asset( 54 | _assetImagePath, 55 | //fit: BoxFit.fill, 56 | width: 60.0, 57 | height: 60.0, 58 | //centerSlice: Rect.fromLTRB(2.0, 2.0, 2.0, 2.0), 59 | //colorBlendMode: BlendMode.srcOver, 60 | //color: Color.fromARGB(120, 20, 10, 40), 61 | ), 62 | Container( 63 | margin: EdgeInsets.only(top: 8.0), 64 | child: Text( 65 | 'No Image Available', 66 | style: TextStyle( 67 | color: Colors.grey[350], 68 | fontSize: 16.0, 69 | ), 70 | ), 71 | ), 72 | ], 73 | )), 74 | ); 75 | } 76 | 77 | Widget _getImageFromFile(String imagePath) { 78 | return Padding( 79 | padding: EdgeInsets.only(bottom: 30.0), 80 | child: Image.file( 81 | File( 82 | imagePath, 83 | ), 84 | fit: BoxFit.cover, 85 | width: double.infinity, 86 | height: _headerHeight, 87 | ), 88 | ); 89 | } 90 | 91 | Widget _getTopHeader() { 92 | return Padding( 93 | padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 32.0), 94 | child: Row( 95 | children: [ 96 | Icon(Icons.menu, size: 32.0, color: Colors.white), 97 | Expanded( 98 | child: Padding( 99 | padding: EdgeInsets.only(left: 16.0), 100 | child: Text( 101 | "My Profile", 102 | style: TextStyle( 103 | fontSize: 20.0, 104 | color: Colors.white, 105 | fontWeight: FontWeight.bold), 106 | ), 107 | ), 108 | ), 109 | Icon(Icons.mode_edit, color: Colors.white), 110 | ], 111 | ), 112 | ); 113 | } 114 | 115 | Widget _getCameraFab() { 116 | return Positioned( 117 | top: _headerHeight - 30.0, 118 | right: 16.0, 119 | child: FloatingActionButton( 120 | onPressed: _openCamera, 121 | child: Icon( 122 | Icons.photo_camera, 123 | color: Colors.white, 124 | ), 125 | backgroundColor: Colors.green, 126 | ), 127 | ); 128 | } 129 | 130 | Widget _getLogo() { 131 | return Container( 132 | margin: EdgeInsets.only(top: 200.0), 133 | alignment: Alignment.center, 134 | child: Center( 135 | child: Image.asset( 136 | 'assets/images/ic_flutter_devs_logo.png', 137 | width: 160.0, 138 | height: 160.0, 139 | fit: BoxFit.contain, 140 | ), 141 | ), 142 | ); 143 | } 144 | 145 | Future _openCamera() async { 146 | final imagePath = await Navigator.of(context).pushNamed(CAMERA_SCREEN); 147 | 148 | setState(() { 149 | _imagePath = imagePath; 150 | }); 151 | 152 | if (imagePath != null) { 153 | print("$imagePath"); 154 | 155 | image = Image.file( 156 | File(imagePath), 157 | height: _headerHeight, 158 | width: double.infinity, 159 | fit: BoxFit.cover, 160 | ); 161 | } 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /lib/screen/CameraHomeScreen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:camera/camera.dart'; 5 | import 'package:path_provider/path_provider.dart'; 6 | import 'package:flutter/material.dart'; 7 | 8 | class CameraHomeScreen extends StatefulWidget { 9 | List cameras; 10 | 11 | CameraHomeScreen(this.cameras); 12 | 13 | @override 14 | State createState() { 15 | return _CameraHomeScreenState(); 16 | } 17 | } 18 | 19 | class _CameraHomeScreenState extends State { 20 | String imagePath; 21 | bool _toggleCamera = false; 22 | CameraController controller; 23 | 24 | @override 25 | void initState() { 26 | try { 27 | onCameraSelected(widget.cameras[0]); 28 | } catch (e) { 29 | print(e.toString()); 30 | } 31 | super.initState(); 32 | } 33 | 34 | @override 35 | void dispose() { 36 | controller?.dispose(); 37 | super.dispose(); 38 | } 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | if (widget.cameras.isEmpty) { 43 | return Container( 44 | alignment: Alignment.center, 45 | padding: EdgeInsets.all(16.0), 46 | child: Text( 47 | 'No Camera Found', 48 | style: TextStyle( 49 | fontSize: 16.0, 50 | color: Colors.white, 51 | ), 52 | ), 53 | ); 54 | } 55 | 56 | if (!controller.value.isInitialized) { 57 | return Container( 58 | ); 59 | } 60 | 61 | return AspectRatio( 62 | aspectRatio: controller.value.aspectRatio, 63 | child: Container( 64 | child: Stack( 65 | children: [ 66 | CameraPreview(controller), 67 | Align( 68 | alignment: Alignment.bottomCenter, 69 | child: Container( 70 | width: double.infinity, 71 | height: 120.0, 72 | padding: EdgeInsets.all(20.0), 73 | color: Color.fromRGBO(00, 00, 00, 0.7), 74 | child: Stack( 75 | children: [ 76 | Align( 77 | alignment: Alignment.center, 78 | child: Material( 79 | color: Colors.transparent, 80 | child: InkWell( 81 | borderRadius: BorderRadius.all(Radius.circular(50.0)), 82 | onTap: () { 83 | _captureImage(); 84 | }, 85 | child: Container( 86 | padding: EdgeInsets.all(4.0), 87 | child: Image.asset( 88 | 'assets/images/ic_shutter_1.png', 89 | width: 72.0, 90 | height: 72.0, 91 | ), 92 | ), 93 | ), 94 | ), 95 | ), 96 | Align( 97 | alignment: Alignment.centerRight, 98 | child: Material( 99 | color: Colors.transparent, 100 | child: InkWell( 101 | borderRadius: BorderRadius.all(Radius.circular(50.0)), 102 | onTap: () { 103 | if (!_toggleCamera) { 104 | onCameraSelected(widget.cameras[1]); 105 | setState(() { 106 | _toggleCamera = true; 107 | }); 108 | } else { 109 | onCameraSelected(widget.cameras[0]); 110 | setState(() { 111 | _toggleCamera = false; 112 | }); 113 | } 114 | }, 115 | child: Container( 116 | padding: EdgeInsets.all(4.0), 117 | child: Image.asset( 118 | 'assets/images/ic_switch_camera_3.png', 119 | color: Colors.grey[200], 120 | width: 42.0, 121 | height: 42.0, 122 | ), 123 | ), 124 | ), 125 | ), 126 | ), 127 | ], 128 | ), 129 | ), 130 | ), 131 | ], 132 | ), 133 | ), 134 | ); 135 | 136 | 137 | } 138 | 139 | void onCameraSelected(CameraDescription cameraDescription) async { 140 | if (controller != null) await controller.dispose(); 141 | controller = CameraController(cameraDescription, ResolutionPreset.medium); 142 | 143 | controller.addListener(() { 144 | if (mounted) setState(() {}); 145 | if (controller.value.hasError) { 146 | showMessage('Camera Error: ${controller.value.errorDescription}'); 147 | } 148 | }); 149 | 150 | try { 151 | await controller.initialize(); 152 | } on CameraException catch (e) { 153 | showException(e); 154 | } 155 | 156 | if (mounted) setState(() {}); 157 | } 158 | 159 | String timestamp() => new DateTime.now().millisecondsSinceEpoch.toString(); 160 | 161 | void _captureImage() { 162 | takePicture().then((String filePath) { 163 | if (mounted) { 164 | setState(() { 165 | imagePath = filePath; 166 | }); 167 | if (filePath != null) { 168 | showMessage('Picture saved to $filePath'); 169 | setCameraResult(); 170 | } 171 | } 172 | }); 173 | } 174 | 175 | void setCameraResult() { 176 | Navigator.pop(context, imagePath); 177 | } 178 | 179 | Future takePicture() async { 180 | if (!controller.value.isInitialized) { 181 | showMessage('Error: select a camera first.'); 182 | return null; 183 | } 184 | final Directory extDir = await getApplicationDocumentsDirectory(); 185 | final String dirPath = '${extDir.path}/FlutterDevs/Camera/Images'; 186 | await new Directory(dirPath).create(recursive: true); 187 | final String filePath = '$dirPath/${timestamp()}.jpg'; 188 | 189 | if (controller.value.isTakingPicture) { 190 | // A capture is already pending, do nothing. 191 | return null; 192 | } 193 | 194 | try { 195 | await controller.takePicture(filePath); 196 | } on CameraException catch (e) { 197 | showException(e); 198 | return null; 199 | } 200 | return filePath; 201 | } 202 | 203 | void showException(CameraException e) { 204 | logError(e.code, e.description); 205 | showMessage('Error: ${e.code}\n${e.description}'); 206 | } 207 | 208 | void showMessage(String message) { 209 | print(message); 210 | } 211 | 212 | void logError(String code, String message) => 213 | print('Error: $code\nMessage: $message'); 214 | } 215 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_Packages.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |