Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clients
Ğecko
Commits
86e2f3b2
Commit
86e2f3b2
authored
Jun 12, 2022
by
poka
Browse files
feat: crop circle avatar on import
parent
5ee80a5a
Pipeline
#16034
failed
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
android/app/src/main/AndroidManifest.xml
View file @
86e2f3b2
...
...
@@ -42,6 +42,10 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</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.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
...
...
lib/providers/wallet_options.dart
View file @
86e2f3b2
...
...
@@ -11,6 +11,7 @@ import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import
'package:gecko/screens/transaction_in_progress.dart'
;
import
'package:image_picker/image_picker.dart'
;
import
'package:provider/provider.dart'
;
import
'package:image_cropper/image_cropper.dart'
;
class
WalletOptionsProvider
with
ChangeNotifier
{
TextEditingController
address
=
TextEditingController
();
...
...
@@ -88,14 +89,33 @@ class WalletOptionsProvider with ChangeNotifier {
return
''
;
}
final
newPath
=
"
${imageDirectory.path}
/
${pickedFile.name}
"
;
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'
,
),
],
);
await
imageFile
.
copy
(
newPath
);
// final File newImage = File(newPath);
final
newPath
=
"
${imageDirectory.path}
/
${pickedFile.name}
"
;
// await newImage.writeAsBytes(await pickedFile.readAsBytes());
// await pickedFile.saveTo(newPath);
// await Future.delayed(const Duration(milliseconds: 100));
if
(
croppedFile
!=
null
)
{
await
File
(
croppedFile
.
path
).
rename
(
newPath
);
}
else
{
log
.
w
(
'No image selected.'
);
return
''
;
}
// await imageFile.copy(newPath);
log
.
i
(
newPath
);
return
newPath
;
...
...
pubspec.lock
View file @
86e2f3b2
...
...
@@ -593,6 +593,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct main"
description:
...
...
pubspec.yaml
View file @
86e2f3b2
...
...
@@ -5,7 +5,7 @@ description: Pay with G1.
# 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
version
:
0.0.8+
8
version
:
0.0.8+
9
environment
:
sdk
:
'
>=2.12.0
<3.0.0'
...
...
@@ -71,6 +71,7 @@ dependencies:
dots_indicator
:
^2.1.0
web_socket_channel
:
^2.2.0
connectivity_plus
:
^2.3.3
image_cropper
:
^2.0.3
dev_dependencies
:
# flutter_launcher_icons: ^0.9.2
...
...
pokapow
@pokapow
mentioned in issue
#3 (closed)
·
Jun 12, 2022
mentioned in issue
#3 (closed)
mentioned in issue #3
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment