diff --git a/.flutter-plugins b/.flutter-plugins
index 47e9027..4398bd5 100644
--- a/.flutter-plugins
+++ b/.flutter-plugins
@@ -1,2 +1,3 @@
-image_cropper=F:\\book\\AndroidDevelopmetKit\\flutter_sdk\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\image_cropper-0.0.4\\
-image_picker=F:\\book\\AndroidDevelopmetKit\\flutter_sdk\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\image_picker-0.4.6\\
+# This is a generated file; do not edit or check into version control.
+image_cropper=D:\\Users\\Hiuwin\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_cropper-0.0.9\\
+image_picker=D:\\Users\\Hiuwin\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_picker-0.4.12+1\\
diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies
new file mode 100644
index 0000000..c226a5a
--- /dev/null
+++ b/.flutter-plugins-dependencies
@@ -0,0 +1 @@
+{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_cropper","path":"D:\\\\Users\\\\Hiuwin\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_cropper-0.0.9\\\\","native_build":true,"dependencies":[]},{"name":"image_picker","path":"D:\\\\Users\\\\Hiuwin\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker-0.4.12+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"image_cropper","path":"D:\\\\Users\\\\Hiuwin\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_cropper-0.0.9\\\\","native_build":true,"dependencies":[]},{"name":"image_picker","path":"D:\\\\Users\\\\Hiuwin\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker-0.4.12+1\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"image_cropper","dependencies":[]},{"name":"image_picker","dependencies":[]}],"date_created":"2023-03-30 19:51:37.930856","version":"3.7.3"}
\ No newline at end of file
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 7e1356e..a7e877d 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -7,15 +7,12 @@ if (localPropertiesFile.exists()) {
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
-if (flutterRoot == null) {
- throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
-}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 27
+ compileSdkVersion 33
lintOptions {
disable 'InvalidPackage'
@@ -25,9 +22,9 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.libs.flutterimageppicker"
minSdkVersion 16
- targetSdkVersion 27
- versionCode 1
- versionName "1.0"
+ targetSdkVersion flutter.targetSdkVersion
+ versionCode 2
+ versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 6fa3699..ae2740d 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -41,6 +41,9 @@
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
+
diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh
new file mode 100644
index 0000000..63e1303
--- /dev/null
+++ b/ios/Flutter/flutter_export_environment.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# This is a generated file; do not edit or check into version control.
+export "FLUTTER_ROOT=C:\src\flutter"
+export "FLUTTER_APPLICATION_PATH=D:\Users\Hiuwin\Desktop\flutter_image_ppicker"
+export "COCOAPODS_PARALLEL_CODE_SIGN=true"
+export "FLUTTER_TARGET=lib\main.dart"
+export "FLUTTER_BUILD_DIR=build"
+export "FLUTTER_BUILD_NAME=1.0.0"
+export "FLUTTER_BUILD_NUMBER=1"
+export "DART_OBFUSCATION=false"
+export "TRACK_WIDGET_CREATION=true"
+export "TREE_SHAKE_ICONS=false"
+export "PACKAGE_CONFIG=.dart_tool/package_config.json"
diff --git a/lib/home_screen.dart b/lib/home_screen.dart
index 512aa5f..25f14e9 100644
--- a/lib/home_screen.dart
+++ b/lib/home_screen.dart
@@ -5,7 +5,7 @@ import 'package:flutter_image_ppicker/image_picker_handler.dart';
import 'package:flutter_image_ppicker/image_picker_dialog.dart';
class HomeScreen extends StatefulWidget {
- HomeScreen({Key key, this.title}) : super(key: key);
+ HomeScreen({Key? key, required this.title}) : super(key: key);
final String title;
@override
@@ -13,11 +13,10 @@ class HomeScreen extends StatefulWidget {
}
class _HomeScreenState extends State
- with TickerProviderStateMixin,ImagePickerListener{
-
- File _image;
- AnimationController _controller;
- ImagePickerHandler imagePicker;
+ with TickerProviderStateMixin, ImagePickerListener {
+ late File _image;
+ late AnimationController _controller;
+ late ImagePickerHandler imagePicker;
@override
void initState() {
@@ -27,9 +26,8 @@ class _HomeScreenState extends State
duration: const Duration(milliseconds: 500),
);
- imagePicker=new ImagePickerHandler(this,_controller);
+ imagePicker = new ImagePickerHandler(this, _controller);
imagePicker.init();
-
}
@override
@@ -38,16 +36,13 @@ class _HomeScreenState extends State
super.dispose();
}
-
-
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
- title: new Text(widget.title,
- style: new TextStyle(
- color: Colors.white
- ),
+ title: new Text(
+ widget.title,
+ style: new TextStyle(color: Colors.white),
),
),
body: new GestureDetector(
@@ -56,7 +51,6 @@ class _HomeScreenState extends State
child: _image == null
? new Stack(
children: [
-
new Center(
child: new CircleAvatar(
radius: 80.0,
@@ -66,7 +60,6 @@ class _HomeScreenState extends State
new Center(
child: new Image.asset("assets/photo_camera.png"),
),
-
],
)
: new Container(
@@ -78,15 +71,13 @@ class _HomeScreenState extends State
image: new ExactAssetImage(_image.path),
fit: BoxFit.cover,
),
- border:
- Border.all(color: Colors.red, width: 5.0),
+ border: Border.all(color: Colors.red, width: 5.0),
borderRadius:
new BorderRadius.all(const Radius.circular(80.0)),
),
),
),
),
-
);
}
@@ -96,5 +87,4 @@ class _HomeScreenState extends State
this._image = _image;
});
}
-
}
diff --git a/lib/image_picker_dialog.dart b/lib/image_picker_dialog.dart
index 4220424..d51b336 100644
--- a/lib/image_picker_dialog.dart
+++ b/lib/image_picker_dialog.dart
@@ -4,15 +4,17 @@ import 'package:flutter/material.dart';
import 'package:flutter_image_ppicker/image_picker_handler.dart';
class ImagePickerDialog extends StatelessWidget {
+ late ImagePickerHandler _listener;
+ late AnimationController _controller;
+ late BuildContext context;
- ImagePickerHandler _listener;
- AnimationController _controller;
- BuildContext context;
+ // ImagePickerDialog(this._listener, this._controller);
- ImagePickerDialog(this._listener, this._controller);
+ late Animation _drawerContentsOpacity;
+ late Animation _drawerDetailsPosition;
- Animation _drawerContentsOpacity;
- Animation _drawerDetailsPosition;
+ ImagePickerDialog(ImagePickerHandler imagePickerHandler,
+ AnimationController animationController);
void initState() {
_drawerContentsOpacity = new CurvedAnimation(
@@ -38,12 +40,12 @@ class ImagePickerDialog extends StatelessWidget {
showDialog(
context: context,
builder: (BuildContext context) => new SlideTransition(
- position: _drawerDetailsPosition,
- child: new FadeTransition(
- opacity: new ReverseAnimation(_drawerContentsOpacity),
- child: this,
- ),
- ),
+ position: _drawerDetailsPosition,
+ child: new FadeTransition(
+ opacity: new ReverseAnimation(_drawerContentsOpacity),
+ child: this,
+ ),
+ ),
);
}
@@ -137,5 +139,4 @@ class ImagePickerDialog extends StatelessWidget {
);
return loginBtn;
}
-
}
diff --git a/lib/image_picker_handler.dart b/lib/image_picker_handler.dart
index ba91618..260de95 100644
--- a/lib/image_picker_handler.dart
+++ b/lib/image_picker_handler.dart
@@ -7,42 +7,40 @@ import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';
class ImagePickerHandler {
- ImagePickerDialog imagePicker;
- AnimationController _controller;
- ImagePickerListener _listener;
+ ImagePickerDialog? imagePicker;
+ AnimationController? _controller;
+ ImagePickerListener? _listener;
ImagePickerHandler(this._listener, this._controller);
openCamera() async {
- imagePicker.dismissDialog();
+ imagePicker!.dismissDialog();
var image = await ImagePicker.pickImage(source: ImageSource.camera);
- cropImage(image);
+ cropImage(image as File);
}
openGallery() async {
- imagePicker.dismissDialog();
+ imagePicker!.dismissDialog();
var image = await ImagePicker.pickImage(source: ImageSource.gallery);
- cropImage(image);
+ cropImage(image as File);
}
void init() {
- imagePicker = new ImagePickerDialog(this, _controller);
- imagePicker.initState();
+ imagePicker = new ImagePickerDialog(this, _controller!);
+ imagePicker!.initState();
}
Future cropImage(File image) async {
- File croppedFile = await ImageCropper.cropImage(
+ File croppedFile = (await ImageCropper.cropImage(
sourcePath: image.path,
- ratioX: 1.0,
- ratioY: 1.0,
maxWidth: 512,
maxHeight: 512,
- );
- _listener.userImage(croppedFile);
+ )) as File;
+ _listener!.userImage(croppedFile);
}
showDialog(BuildContext context) {
- imagePicker.getImage(context);
+ imagePicker!.getImage(context);
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 5234b84..a26f5e5 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,58 +1,21 @@
name: flutter_image_ppicker
description: A new Flutter application.
+environment:
+ sdk: '>=2.18.2 <3.0.0'
dependencies:
flutter:
sdk: flutter
-
- cupertino_icons: ^0.1.2
- image_picker: "^0.4.5"
+ image_picker: ^0.4.5
image_cropper: ^0.0.4
+ cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
-
-
-# For information on the generic Dart part of this file, see the
-# following page: https://www.dartlang.org/tools/pub/pubspec
-
-# The following section is specific to Flutter.
+ flutter_lints: ^2.0.1
flutter:
-
- # The following line ensures that the Material Icons font is
- # included with your application, so that you can use the icons in
- # the material Icons class.
uses-material-design: true
- assets:
- - assets/photo_camera.png
- # To add assets to your application, add an assets section, like this:
- # assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
-
- # An image asset can refer to one or more resolution-specific "variants", see
- # https://flutter.io/assets-and-images/#resolution-aware.
-
- # For details regarding adding assets from package dependencies, see
- # https://flutter.io/assets-and-images/#from-packages
- # To add custom fonts to your application, add a fonts section here,
- # in this "flutter" section. Each entry in this list should have a
- # "family" key with the font family name, and a "fonts" key with a
- # list giving the asset and other descriptors for the font. For
- # example:
- # fonts:
- # - family: Schyler
- # fonts:
- # - asset: fonts/Schyler-Regular.ttf
- # - asset: fonts/Schyler-Italic.ttf
- # style: italic
- # - family: Trajan Pro
- # fonts:
- # - asset: fonts/TrajanPro.ttf
- # - asset: fonts/TrajanPro_Bold.ttf
- # weight: 700
- #
- # For details regarding fonts from package dependencies,
- # see https://flutter.io/custom-fonts/#from-packages
+assets:
+ - assets/photo_camera.png
\ No newline at end of file