Some delay in message

This commit is contained in:
Vicente J. Ruiz Jurado 2018-08-04 11:23:22 +02:00
parent 76085dcb2f
commit 6467ef9374

View file

@ -1,3 +1,6 @@
import 'dart:async';
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:fires_flutter/models/yourLocation.dart'; import 'package:fires_flutter/models/yourLocation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -7,7 +10,6 @@ import 'customMoment.dart';
import 'generated/i18n.dart'; import 'generated/i18n.dart';
import 'models/appState.dart'; import 'models/appState.dart';
import 'models/fireMapState.dart'; import 'models/fireMapState.dart';
import 'package:comunes_flutter/comunes_flutter.dart';
typedef void OnSave(); typedef void OnSave();
typedef void OnCancel(); typedef void OnCancel();
@ -20,7 +22,10 @@ class GenericMapBottom extends StatelessWidget {
final GlobalKey<ScaffoldState> scaffoldKey; final GlobalKey<ScaffoldState> scaffoldKey;
GenericMapBottom( GenericMapBottom(
{@required this.onSave, @required this.onCancel, @required this.state, @required this.scaffoldKey}); {@required this.onSave,
@required this.onCancel,
@required this.state,
@required this.scaffoldKey});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -34,8 +39,8 @@ class GenericMapBottom extends StatelessWidget {
actions: buildActionList(loc, context, kmAround, scaffoldKey)); actions: buildActionList(loc, context, kmAround, scaffoldKey));
} }
List<Widget> buildActionList( List<Widget> buildActionList(YourLocation loc, BuildContext context,
YourLocation loc, BuildContext context, int kmAround, GlobalKey<ScaffoldState> scaffoldState) { int kmAround, GlobalKey<ScaffoldState> scaffoldState) {
List<Widget> actionList = new List<Widget>(); List<Widget> actionList = new List<Widget>();
switch (state.status) { switch (state.status) {
case FireMapStatus.edit: case FireMapStatus.edit:
@ -70,25 +75,32 @@ class GenericMapBottom extends StatelessWidget {
.from(context, state.fireNotification.when)), .from(context, state.fireNotification.when)),
], ],
), ),
state.industries.length >= 0 || state.falsePos.length > 0 ? new Text(S.of(context).itSeemsNotAtForesFire, style: new TextStyle(color: fires600)): null, state.industries.length >= 0 || state.falsePos.length > 0
? new Text(S.of(context).itSeemsNotAtForesFire,
style: new TextStyle(color: fires600))
: null,
new DropdownButton<String>( new DropdownButton<String>(
style: new TextStyle( style: new TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 18.0, fontSize: 18.0,
), ),
hint: new Text(S.of(context).notAWildfire), hint: new Text(S.of(context).notAWildfire),
items: <String>[S.of(context).itSeemsAIndustry, S.of(context).itSeemsAControlledBurning, S.of(context).itSeemsAFalseAlarm].map((String value) { items: <String>[
return new DropdownMenuItem <String>( S.of(context).itSeemsAIndustry,
value: value, S.of(context).itSeemsAControlledBurning,
child: new Text(value) S.of(context).itSeemsAFalseAlarm
); ].map((String value) {
}).toList(), return new DropdownMenuItem<String>(
onChanged: (value) { value: value, child: new Text(value));
// FIXME api call }).toList(),
scaffoldKey.currentState.showSnackBar(new SnackBar( onChanged: (value) async {
content: new Text(S.of(context).thanksForParticipating), // FIXME api call
)); await new Future.delayed(new Duration(milliseconds: 500));
}), scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text(
S.of(context).thanksForParticipating),
));
}),
]))))); ])))));
break; break;
case FireMapStatus.unsubscribe: case FireMapStatus.unsubscribe: