更新高德地图key

修改_location变量避空,使得高德地图不可用时不会卡在启动页
hmxc
张萌 3 years ago
parent 0473acee25
commit adad457df1

@ -7,7 +7,7 @@
<application android:name="io.flutter.app.FlutterApplication" android:label="小蜜蜂智慧社区" android:icon="@mipmap/ic_launcher" android:networkSecurityConfig="@xml/network_security_config">
<service android:name="com.amap.api.location.APSService"></service>
<meta-data android:name="com.amap.api.v2.apikey"
android:value="ee697f99e8381b7efde08b9976052bd0"/>
android:value="717cf8c606307809bcbd6661123b9837"/>
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user

@ -68,8 +68,8 @@ class _AlarmPageState extends State<AlarmPage> {
final appProvider =
Provider.of<AppProvider>(context, listen: false);
LatLng _target = LatLng(
appProvider.location!['latitude'] as double,
appProvider.location!['longitude'] as double,
(appProvider.location?['latitude'] ?? 0) as double,
(appProvider.location?['longitude'] ?? 0 )as double,
);
_mapController = controller;
_mapController!.moveCamera(
@ -127,7 +127,7 @@ class _AlarmPageState extends State<AlarmPage> {
child: Text(
(appProvider.location == null)
? '加载中……'
: appProvider.location!['address']
: (appProvider.location?['address'] ?? '')
as String,
style: TextStyle(
color: Color(0xff666666),

@ -174,8 +174,8 @@ class AppProvider extends ChangeNotifier {
longitude = 116.46;
latitude = 39.92;
} else {
longitude = _location!['longitude'];
latitude = _location!['latitude'];
longitude = _location?['longitude']??116.46;
latitude = _location?['latitude']??39.92;
}
Response response = await Dio().get(

Loading…
Cancel
Save