Merge branch 'amap'

# Conflicts:
#	android/app/build.gradle
#	pubspec.yaml
hmxc
张萌 4 years ago
commit b28cac1438

@ -43,10 +43,14 @@ android {
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
//Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.akucommunity.aku_community_manager"
minSdkVersion 21
targetSdkVersion 29
ndk {
abiFilters 'arm64-v8a'
abiFilters 'armeabi-v7a'
}
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "99067fe33fa04aad88c3acac", //appkey.
@ -85,4 +89,6 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:27.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.amap.api:3dmap:latest.integration'
implementation 'com.amap.api:location:latest.integration'
}

@ -5,7 +5,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -22,8 +21,8 @@ import 'package:aku_community_manager/ui/splash/splash_page.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await AmapCore.init('');
await AmapLocation.instance.init(iosKey: '');
// await AmapCore.init('');
// await AmapLocation.instance.init(iosKey: '');
JPush jpush = new JPush();
DevUtil.setDev(true);
jpush.addEventHandler(

@ -1,4 +1,6 @@
// Flutter imports:
import 'package:amap_flutter_location/amap_flutter_location.dart';
import 'package:amap_flutter_location/amap_location_option.dart';
import 'package:flutter/material.dart';
// Project imports:
@ -26,4 +28,26 @@ class AppProvider extends ChangeNotifier {
_recentUsedApp.clear();
notifyListeners();
}
Map<String, Object> _location;
Map<String, Object> get location => _location;
AMapFlutterLocation _flutterLocation;
startLocation() {
_flutterLocation = AMapFlutterLocation();
_flutterLocation.onLocationChanged().listen((event) {
_location = event;
if (_location != null) {
stopLocation();
}
});
_flutterLocation.setLocationOption(
AMapLocationOption(onceLocation: true, needAddress: true));
_flutterLocation.startLocation();
}
stopLocation() {
_flutterLocation.stopLocation();
_flutterLocation.destroy();
}
}

@ -1,6 +1,5 @@
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';

@ -1,6 +1,7 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/item_num_model.dart';
import 'package:aku_community_manager/provider/app_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/utils/dev_util.dart';
@ -9,11 +10,11 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:get/get.dart' hide Response;
import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:power_logger/power_logger.dart';
// Project imports:
@ -39,7 +40,14 @@ class _SplashPageState extends State<SplashPage> {
}
//AMap
await AmapLocation.instance.init(iosKey: 'ios key');
// await AmapLocation.instance.init(iosKey: 'ios key');
await Permission.locationWhenInUse.request();
}
Future _initOp() async {
await _originOp();
final appProvider = Provider.of<AppProvider>(context, listen: false);
appProvider.startLocation();
}
@override
@ -49,7 +57,7 @@ class _SplashPageState extends State<SplashPage> {
if (mounted) PowerLogger.start(context, debug: DevUtil.isDev);
});
Future.delayed(Duration(milliseconds: 2000), () async {
await _originOp();
await _initOp();
Get.off(HomePage());
});
}

@ -1,22 +1,30 @@
// Flutter imports:
import 'dart:ui';
import 'package:aku_community_manager/provider/app_provider.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_cupertino_button.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:get/get.dart';
// Project imports:
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/permission_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/tool_pages/warning/warning_detail_page.dart';
import 'package:aku_community_manager/ui/tool_pages/warning/warning_sub_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:amap_flutter_map/amap_flutter_map.dart';
class PermissonUtil {
static Future getLocationPermisson() async {
return await Permission.locationWhenInUse.request().isGranted;
}
}
class WarningPage extends StatefulWidget {
WarningPage({Key key}) : super(key: key);
@ -26,11 +34,22 @@ class WarningPage extends StatefulWidget {
}
class _WarningPageState extends State<WarningPage> {
AmapController _amapController;
Location _location;
AMapController _mapController;
@override
void initState() {
super.initState();
PermissonUtil.getLocationPermisson();
}
@override
void dispose() {
_mapController?.disponse();
super.dispose();
}
@override
Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context, listen: false);
return AkuScaffold(
title: '一键报警',
actions: [
@ -50,16 +69,24 @@ class _WarningPageState extends State<WarningPage> {
],
body: Stack(
children: [
AmapView(
zoomLevel: 15,
showZoomControl: false,
showCompass: false,
showScaleControl: false,
onMapCreated: (controller) async {
_amapController = controller;
_amapController.showMyLocation(MyLocationOption());
_getLocation();
AMapWidget(
onMapCreated: (controller) {
LatLng _target = LatLng(
appProvider.location['latitude'],
appProvider.location['longitude'],
);
_mapController = controller;
_mapController.moveCamera(
CameraUpdate.newCameraPosition(
CameraPosition(target: _target, zoom: 18),
),
);
},
myLocationStyleOptions: MyLocationStyleOptions(true,
circleFillColor:
Theme.of(context).primaryColor.withOpacity(0.2),
circleStrokeColor: Theme.of(context).primaryColor),
),
///
@ -99,7 +126,9 @@ class _WarningPageState extends State<WarningPage> {
AkuBox.w(10),
Expanded(
child: Text(
_location?.address ?? '加载中',
(appProvider.location == null)
? '加载中……'
: appProvider.location['address'],
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.sp,
@ -210,7 +239,15 @@ class _WarningPageState extends State<WarningPage> {
child: AkuCupertinoButton(
minWidth: 0,
onPressed: () {
_getLocation();
LatLng _target = LatLng(
appProvider.location['latitude'],
appProvider.location['longitude'],
);
_mapController.moveCamera(
CameraUpdate.newCameraPosition(
CameraPosition(target: _target, zoom: 18),
),
);
},
child: Container(
alignment: Alignment.center,
@ -241,17 +278,17 @@ class _WarningPageState extends State<WarningPage> {
);
}
_getLocation() {
_location = null;
setState(() {});
PermissionTool.getLocationPermission().then((state) {
if (state) {
AmapLocation.instance.fetchLocation().then((location) {
_amapController.setCenterCoordinate(location.latLng);
_location = location;
setState(() {});
});
}
});
}
// _getLocation() {
// _location = null;
// setState(() {});
// PermissionTool.getLocationPermission().then((state) {
// if (state) {
// AmapLocation.instance.fetchLocation().then((location) {
// _amapController.setCenterCoordinate(location.latLng);
// _location = location;
// setState(() {});
// });
// }
// });
// }
}

@ -17,34 +17,29 @@ packages:
url: "http://test.akuhotel.com:8099/aku_fe/aku_ui.git"
source: git
version: "0.0.1"
amap_core_fluttify:
dependency: transitive
description:
name: amap_core_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.0"
amap_location_fluttify:
dependency: transitive
amap_flutter_base:
dependency: "direct main"
description:
name: amap_location_fluttify
name: amap_flutter_base
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.18.0"
amap_map_fluttify:
version: "1.0.2"
amap_flutter_location:
dependency: "direct main"
description:
name: amap_map_fluttify
name: amap_flutter_location
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.29.0"
amap_search_fluttify:
dependency: transitive
version: "1.0.1"
amap_flutter_map:
dependency: "direct main"
description:
name: amap_search_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.14.0"
path: "."
ref: nullsafety
resolved-ref: "5c50cf60d2157cc2779a171ca65c327d571389a7"
url: "http://159.75.73.143:8080/third_packages/amap_flutter_map"
source: git
version: "2.0.2-nullsafety"
analyzer:
dependency: transitive
description:
@ -164,13 +159,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
core_location_fluttify:
dependency: transitive
description:
name: core_location_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.1"
crypto:
dependency: transitive
description:
@ -262,6 +250,41 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.1"
firebase_core:
dependency: "direct main"
description:
name: firebase_core
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
firebase_crashlytics:
dependency: "direct main"
description:
name: firebase_crashlytics
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
firebase_crashlytics_platform_interface:
dependency: transitive
description:
name: firebase_crashlytics_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
flutter:
dependency: "direct main"
description: flutter
@ -324,13 +347,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
foundation_fluttify:
dependency: transitive
description:
name: foundation_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.10+1"
get:
dependency: "direct main"
description:
@ -528,21 +544,7 @@ packages:
name: path_provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.9"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4+8"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
version: "1.2.0"
pedantic:
dependency: transitive
description:
@ -556,14 +558,14 @@ packages:
name: permission_handler
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.0.1+1"
version: "6.1.1"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
version: "3.1.2"
pin_input_text_field:
dependency: "direct main"
description:
@ -584,7 +586,7 @@ packages:
name: plugin_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3"
version: "2.0.0"
power_logger:
dependency: "direct main"
description:
@ -660,6 +662,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
@ -694,42 +703,42 @@ packages:
name: url_launcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.7.10"
version: "6.0.3"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+4"
version: "2.0.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+9"
version: "2.0.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.9"
version: "2.0.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.5+1"
version: "2.0.0"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+3"
version: "2.0.0"
vector_math:
dependency: transitive
description:

@ -42,10 +42,13 @@ dependencies:
expandable: ^5.0.1
url_launcher: ^6.0.3
amap_map_fluttify: ^0.29.0
permission_handler: ^5.0.1+1
amap_flutter_map:
git:
url: http://159.75.73.143:8080/third_packages/amap_flutter_map
ref: nullsafety
amap_flutter_location: ^1.0.1
amap_flutter_base: ^1.0.2
permission_handler: ^6.1.1
velocity_x: ^2.6.0
dotted_border: ^2.0.0-nullsafety.0

Loading…
Cancel
Save