Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Stamped
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stamped_dev
Stamped
Commits
0d0f63cf
There was an error fetching the commit references. Please try again later.
Commit
0d0f63cf
authored
1 year ago
by
Tuan Anh Nguyen
Browse files
Options
Downloads
Patches
Plain Diff
feat: add image cropping
parent
9270989d
No related branches found
No related tags found
1 merge request
!35
Create front
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/pages/create_front/select_image.dart
+36
-17
36 additions, 17 deletions
lib/pages/create_front/select_image.dart
with
36 additions
and
17 deletions
lib/pages/create_front/select_image.dart
+
36
−
17
View file @
0d0f63cf
...
...
@@ -12,10 +12,22 @@ class SelectImage extends StatelessWidget {
final
createPostcardNotifier
=
context
.
watch
<
CreatePostcardNotifier
>();
return
PageTemplate
(
title:
'
Select a Picture
'
,
title:
'
Create a Postcard
'
,
actions:
[
// TODO: next action
IconButton
(
onPressed:
()
{},
icon:
Icon
(
Icons
.
navigate_next
)),
IconButton
(
onPressed:
()
{
Navigator
.
of
(
context
)
.
push
(
MaterialPageRoute
(
// TODO: use create postcard back page
builder:
(
context
)
=
>
PageTemplate
(
title:
'Create a Postcard'
,
child:
Placeholder
(),
),
),
);
},
icon:
Icon
(
Icons
.
navigate_next
),
),
],
child:
Align
(
alignment:
Alignment
.
bottomCenter
,
...
...
@@ -24,30 +36,37 @@ class SelectImage extends StatelessWidget {
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Spacer
(),
createPostcardNotifier
.
selected
Pictur
e
==
null
createPostcardNotifier
.
selected
Imag
e
==
null
?
Text
(
'No Image Selected'
)
:
Image
.
file
(
createPostcardNotifier
.
selected
Pictur
e
!
,
createPostcardNotifier
.
selected
Imag
e
!
,
width:
double
.
infinity
,
),
Spacer
(),
ElevatedButton
.
icon
(
onPressed:
()
=
>
createPostcardNotifier
.
pickImage
(
ImageSource
.
gallery
,
),
icon:
Icon
(
Icons
.
photo_library
),
label:
Text
(
'Pick Image from Gallery'
),
_buildPickImageButton
(
createPostcardNotifier
,
source
:
ImageSource
.
gallery
,
),
ElevatedButton
.
icon
(
onPressed:
()
=
>
createPostcardNotifier
.
pickImage
(
ImageSource
.
camera
,
),
icon:
Icon
(
Icons
.
camera
),
label:
Text
(
'Take a Picture'
),
_buildPickImageButton
(
createPostcardNotifier
,
source
:
ImageSource
.
camera
,
),
],
),
),
)
;
}
ElevatedButton
_buildPickImageButton
(
CreatePostcardNotifier
createPostcardNotifier
,
{
required
ImageSource
source
,
})
{
return
ElevatedButton
.
icon
(
onPressed:
()
=
>
createPostcardNotifier
.
pickImage
(
source
),
icon:
Icon
(
Icons
.
photo_library
),
label:
Text
(
source
==
ImageSource
.
gallery
?
'Pick Image from Gallery'
:
'Take Image from Camera'
),
)
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment