|
|
@ -1,12 +1,15 @@
|
|
|
|
|
|
|
|
import 'package:akuCommunity/pages/one_alarm/widget/explain_template.dart';
|
|
|
|
import 'package:akuCommunity/utils/headers.dart';
|
|
|
|
import 'package:akuCommunity/utils/headers.dart';
|
|
|
|
import 'package:akuCommunity/widget/common_app_bar.dart';
|
|
|
|
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
|
|
|
|
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
|
|
|
|
import 'package:amap_location_fluttify/amap_location_fluttify.dart';
|
|
|
|
import 'package:amap_location_fluttify/amap_location_fluttify.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_beautiful_popup/main.dart';
|
|
|
|
import 'package:flutter_icons/flutter_icons.dart';
|
|
|
|
import 'package:flutter_icons/flutter_icons.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class PermissionUtil {
|
|
|
|
class PermissionUtil {
|
|
|
|
static Future<bool> getLocationPermission() async {
|
|
|
|
static Future<bool> getLocationPermission() async {
|
|
|
@ -26,12 +29,48 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
myLocationType: MyLocationType.Locate,
|
|
|
|
myLocationType: MyLocationType.Locate,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
Future<void> _makephonenum(String url)async{
|
|
|
|
Future<void> _makephonenum(String url) async {
|
|
|
|
(await canLaunch(url))?await launch(url):throw 'Could not launch $url';
|
|
|
|
(await canLaunch(url)) ? await launch(url) : throw 'Could not launch $url';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AmapController _amapController;
|
|
|
|
AmapController _amapController;
|
|
|
|
Location _location;
|
|
|
|
Location _location;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void showExplain(BuildContext context) {
|
|
|
|
|
|
|
|
final popup = BeautifulPopup.customize(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
build: (options) => ExplainTemplate(options),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
popup.show(
|
|
|
|
|
|
|
|
title: Text(
|
|
|
|
|
|
|
|
'功能说明',
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
fontSize: 32.sp,
|
|
|
|
|
|
|
|
color: Color(0xff15c0ec),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
content: Text(
|
|
|
|
|
|
|
|
'点击“呼叫110”后,您可以直接拨打本地110。页面中提供了您当前所在位置,以便您与警方沟通。(GPS信号弱时,位置可能存在偏移)',
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 28.sp,
|
|
|
|
|
|
|
|
color: Color(0xff666666),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
|
|
|
MaterialButton(
|
|
|
|
|
|
|
|
color: Color(0xff15c0ec),
|
|
|
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
|
|
|
side: BorderSide.none,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
|
|
|
|
|
child: Text('关闭'),
|
|
|
|
|
|
|
|
onPressed: Navigator.of(context).pop,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
close: SizedBox());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
@ -49,14 +88,20 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
return BeeScaffold(
|
|
|
|
appBar: PreferredSize(
|
|
|
|
title: '一键报警',
|
|
|
|
child: CommonAppBar(
|
|
|
|
actions: [
|
|
|
|
title: '一键报警',
|
|
|
|
InkWell(
|
|
|
|
subtitle: '功能说明',
|
|
|
|
onTap: () {
|
|
|
|
),
|
|
|
|
showExplain(context);
|
|
|
|
preferredSize: Size.fromHeight(kToolbarHeight),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.fromLTRB(32.w, 28.w, 32.w, 20.w),
|
|
|
|
|
|
|
|
child: '全部已读'.text.black.size(28.sp).make(),
|
|
|
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
body: Stack(
|
|
|
|
body: Stack(
|
|
|
|
alignment: Alignment.topCenter,
|
|
|
|
alignment: Alignment.topCenter,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
@ -90,9 +135,7 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SizedBox(height: 24.w),
|
|
|
|
SizedBox(height: 24.w),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
margin: EdgeInsets.only(top: 24.w, left: 32.w),
|
|
|
|
top: 24.w,
|
|
|
|
|
|
|
|
left: 32.w),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
'当前位置(仅供参考)',
|
|
|
|
'当前位置(仅供参考)',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
@ -102,9 +145,7 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
margin: EdgeInsets.only(top: 20.w, left: 32.w),
|
|
|
|
top: 20.w,
|
|
|
|
|
|
|
|
left: 32.w),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
@ -114,8 +155,7 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
size: 29.sp,
|
|
|
|
size: 29.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin:
|
|
|
|
margin: EdgeInsets.only(left: 5.w),
|
|
|
|
EdgeInsets.only(left: 5.w),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
(_location == null)
|
|
|
|
(_location == null)
|
|
|
|
? '加载中……'
|
|
|
|
? '加载中……'
|
|
|
@ -140,8 +180,7 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
width: 66.w,
|
|
|
|
width: 66.w,
|
|
|
|
height: 66.w,
|
|
|
|
height: 66.w,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.circular(66.w),
|
|
|
|
BorderRadius.circular(66.w),
|
|
|
|
|
|
|
|
boxShadow: <BoxShadow>[
|
|
|
|
boxShadow: <BoxShadow>[
|
|
|
|
BoxShadow(
|
|
|
|
BoxShadow(
|
|
|
|
color: Color(0x1F000000),
|
|
|
|
color: Color(0x1F000000),
|
|
|
@ -153,12 +192,10 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
child: FlatButton(
|
|
|
|
child: FlatButton(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.circular(66.w)),
|
|
|
|
BorderRadius.circular(66.w)),
|
|
|
|
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
_amapController?.setCenterCoordinate(
|
|
|
|
_amapController?.setCenterCoordinate(_location.latLng);
|
|
|
|
_location.latLng);
|
|
|
|
|
|
|
|
Future.delayed(Duration(milliseconds: 500), () {
|
|
|
|
Future.delayed(Duration(milliseconds: 500), () {
|
|
|
|
if (mounted) _amapController.setZoomLevel(16);
|
|
|
|
if (mounted) _amapController.setZoomLevel(16);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -193,8 +230,8 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
width: 196.w,
|
|
|
|
width: 196.w,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
borderRadius:
|
|
|
|
Radius.circular(196.w)),
|
|
|
|
BorderRadius.all(Radius.circular(196.w)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
height: 172.w,
|
|
|
|
height: 172.w,
|
|
|
@ -205,8 +242,8 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
end: Alignment.topLeft,
|
|
|
|
end: Alignment.topLeft,
|
|
|
|
colors: [Color(0xffef0909), Color(0xffff8880)],
|
|
|
|
colors: [Color(0xffef0909), Color(0xffff8880)],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
borderRadius:
|
|
|
|
Radius.circular(172.w)),
|
|
|
|
BorderRadius.all(Radius.circular(172.w)),
|
|
|
|
boxShadow: <BoxShadow>[
|
|
|
|
boxShadow: <BoxShadow>[
|
|
|
|
BoxShadow(
|
|
|
|
BoxShadow(
|
|
|
|
color: Color(0xfffd7770).withOpacity(0.33),
|
|
|
|
color: Color(0xfffd7770).withOpacity(0.33),
|
|
|
@ -218,8 +255,7 @@ class _AlarmPageState extends State<AlarmPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: FlatButton(
|
|
|
|
child: FlatButton(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
borderRadius: BorderRadius.circular(172.w)),
|
|
|
|
172.w)),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
_makephonenum('tel:110');
|
|
|
|
_makephonenum('tel:110');
|
|
|
|