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 Pun
2022-05-05 15:22:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a2555a7eb184412791d7a873678ee7c605fb608b
a2555a7e
1 parent
9cdfd00e
U
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
10 deletions
lib/account/page/account_edit_page.dart
pubspec.yaml
lib/account/page/account_edit_page.dart
View file @
a2555a7
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_picker/image_picker.dart'
;
class
AccountEditPage
extends
StatefulWidget
{
const
AccountEditPage
({
Key
?
key
})
:
super
(
key:
key
);
...
...
@@ -66,13 +69,60 @@ class MapScreenState extends State<AccountEditPage>
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
CircleAvatar
(
backgroundColor:
Colors
.
red
,
radius:
25
.
px
,
child:
const
Icon
(
Icons
.
camera_alt
,
color:
Colors
.
white
,
InkWell
(
child:
CircleAvatar
(
backgroundColor:
Colors
.
red
,
radius:
25
.
px
,
child:
const
Icon
(
Icons
.
camera_alt
,
color:
Colors
.
white
,
),
),
onTap:
()
{
showModalBottomSheet
(
context:
context
,
builder:
(
context
)
{
return
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
ListTile
(
title:
const
Center
(
child:
Text
(
'拍照'
,
style:
TextStyle
(
fontSize:
18
,
),
),
),
onTap:
()
{
_getImage
();
},
),
ListTile
(
title:
const
Center
(
child:
Text
(
'相册'
,
style:
TextStyle
(
fontSize:
18
,
),
),
),
onTap:
()
{
onImageButtonPressed
(
ImageSource
.
gallery
,
context:
context
,
capturedImageFile:
(
s
)
{
print
(
"file path
${s}
"
);
setState
(()
{
// _imageFile = s;
});
},
);
},
),
],
);
});
},
)
],
)),
...
...
@@ -154,7 +204,7 @@ class MapScreenState extends State<AccountEditPage>
children:
<
Widget
>[
Flexible
(
child:
TextField
(
decoration:
InputDecoration
(
decoration:
InputDecoration
(
hintText:
ParlandoLocalizations
.
of
(
context
)
.
accountEditPageUserNamePlaceholder
,
...
...
@@ -200,7 +250,7 @@ class MapScreenState extends State<AccountEditPage>
children:
<
Widget
>[
Flexible
(
child:
TextField
(
decoration:
InputDecoration
(
decoration:
InputDecoration
(
hintText:
ParlandoLocalizations
.
of
(
context
)
.
accountEditPageUserEmailPlaceholder
,
...
...
@@ -245,7 +295,7 @@ class MapScreenState extends State<AccountEditPage>
children:
<
Widget
>[
Flexible
(
child:
TextField
(
decoration:
InputDecoration
(
decoration:
InputDecoration
(
hintText:
ParlandoLocalizations
.
of
(
context
)
.
accountEditPageUserPhonePlaceholder
,
...
...
@@ -412,3 +462,33 @@ class MapScreenState extends State<AccountEditPage>
);
}
}
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
(
sourcePath:
pickedFile
.
path
,
aspectRatio:
CropAspectRatio
(
ratioX:
1
,
ratioY:
1
),
compressQuality:
100
,
maxHeight:
700
,
maxWidth:
700
,
compressFormat:
ImageCompressFormat
.
jpg
,
androidUiSettings:
AndroidUiSettings
(
toolbarColor:
Colors
.
white
,
toolbarTitle:
"genie cropper"
,
),
);
print
(
"cropper
${val.runtimeType}
"
);
capturedImageFile
(
val
.
path
);
}
typedef
capturedImageFile
=
String
Function
(
String
);
typedef
void
OnPickImageCallback
(
double
maxWidth
,
double
maxHeight
,
int
quality
);
\ No newline at end of file
...
...
pubspec.yaml
View file @
a2555a7
...
...
@@ -52,7 +52,8 @@ dependencies:
# 启动URL的插件(支持Web) https://github.com/flutter/plugins/tree/master/packages/url_launcher
url_launcher
:
^6.0.18
# 图片选择插件(支持Web) https://github.com/flutter/plugins/tree/master/packages/image_picker
image_picker
:
^0.8.4+5
image_picker
:
^0.8.5
image_cropper
:
^2.0.0
# 侧滑删除 https://github.com/letsar/flutter_slidable
flutter_slidable
:
^1.1.0
# WebView插件 https://github.com/flutter/plugins/tree/master/packages/webview_flutter
...
...
Please
register
or
login
to post a comment