feat: crop circle avatar on import
This commit is contained in:
parent
5ee80a5af4
commit
86e2f3b2d7
|
@ -42,6 +42,10 @@
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name="com.yalantis.ucrop.UCropActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
|
||||||
<!-- Don't delete the meta-data below.
|
<!-- Don't delete the meta-data below.
|
||||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|
|
@ -11,6 +11,7 @@ import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||||
import 'package:gecko/screens/transaction_in_progress.dart';
|
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:image_cropper/image_cropper.dart';
|
||||||
|
|
||||||
class WalletOptionsProvider with ChangeNotifier {
|
class WalletOptionsProvider with ChangeNotifier {
|
||||||
TextEditingController address = TextEditingController();
|
TextEditingController address = TextEditingController();
|
||||||
|
@ -88,14 +89,33 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CroppedFile? croppedFile = await ImageCropper().cropImage(
|
||||||
|
sourcePath: imageFile.path,
|
||||||
|
aspectRatioPresets: [CropAspectRatioPreset.square],
|
||||||
|
cropStyle: CropStyle.circle,
|
||||||
|
uiSettings: [
|
||||||
|
AndroidUiSettings(
|
||||||
|
hideBottomControls: true,
|
||||||
|
toolbarTitle: 'Personnalisation',
|
||||||
|
toolbarColor: Colors.deepOrange,
|
||||||
|
toolbarWidgetColor: Colors.white,
|
||||||
|
initAspectRatio: CropAspectRatioPreset.original,
|
||||||
|
lockAspectRatio: true),
|
||||||
|
IOSUiSettings(
|
||||||
|
title: 'Cropper',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
final newPath = "${imageDirectory.path}/${pickedFile.name}";
|
final newPath = "${imageDirectory.path}/${pickedFile.name}";
|
||||||
|
|
||||||
await imageFile.copy(newPath);
|
if (croppedFile != null) {
|
||||||
// final File newImage = File(newPath);
|
await File(croppedFile.path).rename(newPath);
|
||||||
|
} else {
|
||||||
// await newImage.writeAsBytes(await pickedFile.readAsBytes());
|
log.w('No image selected.');
|
||||||
// await pickedFile.saveTo(newPath);
|
return '';
|
||||||
// await Future.delayed(const Duration(milliseconds: 100));
|
}
|
||||||
|
// await imageFile.copy(newPath);
|
||||||
|
|
||||||
log.i(newPath);
|
log.i(newPath);
|
||||||
return newPath;
|
return newPath;
|
||||||
|
|
21
pubspec.lock
21
pubspec.lock
|
@ -593,6 +593,27 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.3"
|
version: "3.1.3"
|
||||||
|
image_cropper:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: image_cropper
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.3"
|
||||||
|
image_cropper_for_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_cropper_for_web
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.4"
|
||||||
|
image_cropper_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_cropper_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
image_picker:
|
image_picker:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.8+8
|
version: 0.0.8+9
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
@ -71,6 +71,7 @@ dependencies:
|
||||||
dots_indicator: ^2.1.0
|
dots_indicator: ^2.1.0
|
||||||
web_socket_channel: ^2.2.0
|
web_socket_channel: ^2.2.0
|
||||||
connectivity_plus: ^2.3.3
|
connectivity_plus: ^2.3.3
|
||||||
|
image_cropper: ^2.0.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
# flutter_launcher_icons: ^0.9.2
|
# flutter_launcher_icons: ^0.9.2
|
||||||
|
|
Loading…
Reference in New Issue