File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,14 @@ part of petisland.rescue_post.sceen;
3
3
class RescueEditorScreen extends TStatefulWidget {
4
4
static const name = '/RescueEditorScreen' ;
5
5
final Rescue rescue;
6
-
6
+ final bool isEdit;
7
7
const RescueEditorScreen .create ({Key key})
8
8
: this .rescue = null ,
9
+ isEdit = false ,
10
+ super (key: key);
11
+ const RescueEditorScreen .edit ({this .rescue, Key key})
12
+ : isEdit = true ,
9
13
super (key: key);
10
- const RescueEditorScreen .edit ({this .rescue, Key key}) : super (key: key);
11
14
12
15
@override
13
16
_RescueCreationScreenState createState () => _RescueCreationScreenState ();
@@ -23,7 +26,7 @@ class _RescueCreationScreenState extends TState<RescueEditorScreen> {
23
26
24
27
@override
25
28
Widget build (BuildContext context) {
26
- final title = 'Create Rescue Post' ;
29
+ final title = widget.isEdit ? 'Edit Rescue Post' : 'Create Rescue Post' ;
27
30
return Stack (
28
31
children: [
29
32
Scaffold (
@@ -54,9 +57,9 @@ class _RescueCreationScreenState extends TState<RescueEditorScreen> {
54
57
}
55
58
56
59
void _handleCreateRescue (BuildContext context) async {
57
- final images = await _uploadImage (editingBloc.newImages);
58
- rescueService
59
- .create (editingBloc.rescue, images.map ((e) => e.id).toList ())
60
+ _uploadImage (editingBloc.newImages)
61
+ . then ((images) =>
62
+ rescueService .create (editingBloc.rescue, images.map ((e) => e.id).toList () ))
60
63
.then ((value) => rescueListingBloc.refreshRescuePost ())
61
64
.then ((value) => this .closeScreen (context, RescueEditorScreen .name))
62
65
.catchError (
You can’t perform that action at this time.
0 commit comments