В настоящее время я использую пакет google_maps_flutter и помещаю его в стек и накладываю на него кнопкой. Когда кнопка нажата, должно появиться предупреждение.
Проблема, с которой я сейчас сталкиваюсь, заключается в том, что она работает при первой загрузке, но если я выхожу из приложения, помещаю его в фоновый режим и снова вхожу в приложение, alertDialog больше не отображается. Он существует на экране, потому что я не могу переместить карту, и мне нужно щелкнуть область, где обычно находится кнопка, но она не видна.
Есть идеи о том, что происходит?
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Center(
child: new Stack(
children: <Widget>[
new Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: new Opacity(
opacity: opacity,
child: new GoogleMap(
onMapCreated: initializeMap,
options: GoogleMapOptions(
//trackCameraPosition: true,
compassEnabled: true,
myLocationEnabled: true,
),
),
),
),
new Align(
alignment: new Alignment(0, 1),
child: new GestureDetector(
onTap: () {
alert();
},
child: new Image.asset(
'assets/test.png',
height: 150.0,
fit: BoxFit.cover,
),
),
),
],
),
),
),
}
alert() {
return showCupertinoDialog(
context: context,
builder: (BuildContext context) {
return new CupertinoAlertDialog(
title: new Text("hello"),
content: new Text("hello"),
actions: <Widget>[
CupertinoDialogAction(
isDefaultAction: true,
child: Text("Ok"),
onPressed: () {
Navigator.pop(context);
}
),
CupertinoDialogAction(
child: Text("Cancel"),
onPressed: () {
Navigator.pop(context);
}
)
],
);
},
);
}