pull/1/head
戴余标 3 years ago
parent 915315adcb
commit 4e7c96f393

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/pages/one_alarm/alarm_detail_page.dart';
import 'package:aku_new_community/pages/one_alarm/widget/alarm_page.dart';
@ -6,14 +8,24 @@ import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:amap_flutter_location/amap_flutter_location.dart';
import 'package:amap_flutter_map/amap_flutter_map.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:hive_flutter/adapters.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../main_initialize.dart';
import '../../utils/hive_store.dart';
import '../../widget/others/user_tool.dart';
class GeographicInformationPage extends StatefulWidget {
GeographicInformationPage({Key? key}) : super(key: key);
@ -28,7 +40,15 @@ class _GeographicInformationPageState extends State<GeographicInformationPage> {
@override
void initState() {
super.initState();
Future.delayed(Duration(milliseconds: 1000), () async {
//
//AMap
// await AmapLocation.instance.init(iosKey: 'ios key');
PermissionUtil.getLocationPermission();
UserTool.appProvider.startLocation();
});
}
@override
@ -55,7 +75,7 @@ class _GeographicInformationPageState extends State<GeographicInformationPage> {
_mapController = controller;
_mapController!.moveCamera(
CameraUpdate.newCameraPosition(
CameraPosition(target: _target, zoom: 18),
CameraPosition(target: _target, zoom: 14),
),
);
},

@ -13,6 +13,8 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../widget/others/user_tool.dart';
class PermissionUtil {
static Future<bool> getLocationPermission() async {
return await Permission.locationWhenInUse.request().isGranted;
@ -37,6 +39,7 @@ class _AlarmPageState extends State<AlarmPage> {
void initState() {
super.initState();
PermissionUtil.getLocationPermission();
UserTool.appProvider.startLocation();
}
@override
@ -72,7 +75,7 @@ class _AlarmPageState extends State<AlarmPage> {
_mapController = controller;
_mapController!.moveCamera(
CameraUpdate.newCameraPosition(
CameraPosition(target: _target, zoom: 18),
CameraPosition(target: _target, zoom: 14),
),
);
},

@ -109,9 +109,9 @@ class _SplashPageState extends State<SplashPage> {
}
//AMap
// await AmapLocation.instance.init(iosKey: 'ios key');
if (Platform.isAndroid || Platform.isIOS) {
await Permission.locationWhenInUse.request();
}
// if (Platform.isAndroid || Platform.isIOS) {
// await Permission.locationWhenInUse.request();
// }
//
EquatableConfig.stringify = true;
AMapFlutterLocation.updatePrivacyShow(true, true);
@ -119,7 +119,7 @@ class _SplashPageState extends State<SplashPage> {
MainInitialize.initTheme();
MainInitialize.initWechat();
MainInitialize.initWebSocket();
UserTool.appProvider.startLocation();
// UserTool.appProvider.startLocation();
UserTool.appProvider.initApplications();
//
await UserTool.dataProvider.init();

Loading…
Cancel
Save