Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-App
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
reason
2022-05-05 16:51:23 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4e44d1dab9851472cf18d0129492dfe445b7677a
4e44d1da
1 parent
a2555a7e
上传头像
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
23 deletions
android/app/src/main/AndroidManifest.xml
lib/account/page/account_edit_page.dart
pubspec.lock
android/app/src/main/AndroidManifest.xml
View file @
4e44d1d
...
...
@@ -19,12 +19,16 @@
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<activity
android:name=
"com.yalantis.ucrop.UCropActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar"
/>
<meta-data
android:name=
"flutterEmbedding"
android:value=
"2"
/>
...
...
lib/account/page/account_edit_page.dart
View file @
4e44d1d
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:Parlando/extension/int_extension.dart'
;
import
'package:Parlando/widgets/my_app_bar.dart'
;
import
'package:flutter_gen/gen_l10n/Parlando_localizations.dart'
;
import
'package:image_cropper/image_cropper.dart'
;
import
'package:image_picker/image_picker.dart'
;
class
AccountEditPage
extends
StatefulWidget
{
...
...
@@ -95,7 +94,17 @@ class MapScreenState extends State<AccountEditPage>
),
),
onTap:
()
{
_getImage
();
Navigator
.
pop
(
context
);
onImageButtonPressed
(
ImageSource
.
camera
,
context:
context
,
capturedImageFile:
(
s
)
{
setState
(()
{
print
(
s
);
// _imageFile = s;
});
},
);
},
),
ListTile
(
...
...
@@ -108,10 +117,13 @@ class MapScreenState extends State<AccountEditPage>
),
),
onTap:
()
{
Navigator
.
pop
(
context
);
onImageButtonPressed
(
ImageSource
.
gallery
,
context:
context
,
ImageSource
.
gallery
,
context:
context
,
capturedImageFile:
(
s
)
{
print
(
"file path
${s}
"
);
print
(
"file path
${s}
"
);
setState
(()
{
// _imageFile = s;
});
...
...
@@ -463,32 +475,46 @@ class MapScreenState extends State<AccountEditPage>
}
}
typedef
CapturedImageFile
=
String
Function
(
String
);
typedef
OnPickImageCallback
=
void
Function
(
double
maxWidth
,
double
maxHeight
,
int
quality
);
onImageButtonPressed
(
ImageSource
source
,
{
required
BuildContext
context
,
capturedImageFile
})
async
{
final
ImagePicker
_picker
=
ImagePicker
();
File
val
;
final
pickedFile
=
await
_picker
.
pickImage
(
source
:
source
,
);
val
=
await
ImageCropper
.
cropImage
(
if
(
pickedFile
==
null
)
{
capturedImageFile
(
pickedFile
!.
path
);
return
;
}
CroppedFile
?
croppedFile
=
await
ImageCropper
().
cropImage
(
sourcePath:
pickedFile
.
path
,
aspectRatio:
CropAspectRatio
(
ratioX:
1
,
ratioY:
1
),
aspectRatio:
const
CropAspectRatio
(
ratioX:
1
,
ratioY:
1
),
compressQuality:
100
,
maxHeight:
700
,
maxWidth:
700
,
compressFormat:
ImageCompressFormat
.
jpg
,
androidUiSettings:
AndroidUiSettings
(
toolbarColor:
Colors
.
white
,
toolbarTitle:
"genie cropper"
,
),
compressFormat:
ImageCompressFormat
.
png
,
aspectRatioPresets:
[
CropAspectRatioPreset
.
square
,
CropAspectRatioPreset
.
ratio3x2
,
CropAspectRatioPreset
.
original
,
CropAspectRatioPreset
.
ratio4x3
,
CropAspectRatioPreset
.
ratio16x9
],
uiSettings:
[
AndroidUiSettings
(
toolbarTitle:
'裁剪'
,
toolbarColor:
Colors
.
deepOrange
,
toolbarWidgetColor:
Colors
.
white
,
initAspectRatio:
CropAspectRatioPreset
.
original
,
lockAspectRatio:
false
),
IOSUiSettings
(
title:
'裁剪'
,
),
],
);
print
(
"cropper
${val.runtimeType}
"
);
capturedImageFile
(
val
.
path
);
capturedImageFile
(
croppedFile
!.
path
);
}
typedef
capturedImageFile
=
String
Function
(
String
);
typedef
void
OnPickImageCallback
(
double
maxWidth
,
double
maxHeight
,
int
quality
);
\ No newline at end of file
...
...
pubspec.lock
View file @
4e44d1d
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment