You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
6.2 KiB
Dart

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import 'package:flutter/material.dart';
import 'package:hyzp_ybqx/components/dioFun.dart';
import 'package:map_launcher/map_launcher.dart';
//import 'package:hyzp_ybqx/widget/player_pro.dart';
import '../../../components/commonFun.dart';
import '../../../services/Storage.dart';
import 'maps_sheet.dart';
//确认对话框
class dwInfoDialog extends Dialog {
dwInfoDialog({
@required this.id,
this.title = "",
@required this.dwIndex,
this.content,
// 导航相关参数
this.parentContext,
this.destinationLatitude,
this.destinationLongitude,
this.destinationTitle,
this.availableMaps,
});
int dwIndex;
String id;
String title;
String content;
bool ret = false;
BuildContext parentContext;
@override
Widget build(BuildContext context) {
Size mediaSize = MediaQuery.of(context).size;
return WillPopScope(
child: Material(
type: MaterialType.transparency,
child: Container(
padding: EdgeInsets.only(top: 116),
alignment: Alignment(0, -1),
color: Colors.black12,
child: Container(
// height: 260,
// width: 300,
height: mediaSize.height * 0.51,
width: mediaSize.width * 0.95,
//color: Colors.white, //Cannot provide both a color and a decoration
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.blue, width: 2.0),
borderRadius: BorderRadius.all(
Radius.circular(5),
),
),
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child: Text(
"${this.title}",
style: TextStyle(
fontSize: 20.0,
),
),
),
Align(
alignment: Alignment.centerRight,
child: InkWell(
child: Icon(Icons.close),
onTap: () {
getingDwVideo = false;
Navigator.pop(context, ret);
},
),
)
],
),
),
Divider(color: Colors.blue),
Container(
padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
width: double.infinity,
height: mediaSize.height * 0.28,
child: SingleChildScrollView(
child: Text(content, style: TextStyle(fontSize: 18.0, color: Colors.blue)),
),
),
SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
RaisedButton(
onPressed: () {
ret = true;
//getDwspUrl(index: dwIndex, context: context);
getDwspUrlNew(indexRecord: dwIndex, context: context);
},
child: Text("视频"),
),
RaisedButton(
onPressed: () async {
ret = true;
getingDwVideo = false;
navigationMap(context);
},
child: Text("导航"),
),
RaisedButton(
child: Text("取消"),
onPressed: () async {
getingDwVideo = false;
Navigator.pop(context, ret); //关闭弹框返回sRet
},
)
],
),
],
),
),
),
),
onWillPop: () {
// 屏蔽点击返回键的操作
getingDwVideo = false;
Navigator.pop(context, ret);
},
);
}
// 导航相关代码
double destinationLatitude = 28.45382237207785;
double destinationLongitude = 104.7506958256658;
String destinationTitle = '珙县大坪上';
double originLatitude;
double originLongitude;
String originTitle = '我的位置';
List<Coords> waypoints = [
// Coords(37.7705112, -122.4108267),
// Coords(37.6988984, -122.4830961),
// Coords(37.7935754, -122.483654),
];
DirectionsMode directionsMode = DirectionsMode.driving;
List<AvailableMap> availableMaps;
// String defaultMapName = 'Amap';
String defaultMapName = g_defaultMapName;
AvailableMap defalutMap;
navigationMap(BuildContext context) {
print('this.defalutMap = ${defalutMap}');
if (defalutMap != null) {
defalutMap.showDirections(
destination: Coords(
destinationLatitude,
destinationLongitude,
),
destinationTitle: destinationTitle,
origin: originLatitude == null || originLongitude == null
? null
: Coords(originLatitude, originLongitude),
originTitle: originTitle,
waypoints: waypoints,
directionsMode: directionsMode,
);
} else {
MapsSheet.show(
context: parentContext,
onMapTap: (map) {
if (g_bSaveDefaultMap) {
g_defaultMapName = map.mapName;
Storage.setString('defaultMapName', g_defaultMapName);
}
map.showDirections(
destination: Coords(
destinationLatitude,
destinationLongitude,
),
destinationTitle: destinationTitle,
origin: originLatitude == null || originLongitude == null
? null
: Coords(originLatitude, originLongitude),
originTitle: originTitle,
waypoints: waypoints,
directionsMode: directionsMode,
);
},
);
}
Navigator.pop(context, ret); //关闭弹框返回sRet
}
}