181 lines
6.8 KiB
Dart
181 lines
6.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:geojson/geojson.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:rogapp/pages/home/home_controller.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class BottomSheetWidget extends StatelessWidget {
|
|
//const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key);
|
|
|
|
final HomeController homeController = Get.find<HomeController>();
|
|
|
|
Image getImage(GeoJsonFeature? gf){
|
|
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
|
return Image(image: AssetImage('assets/images/empty_image.png'));
|
|
}
|
|
else{
|
|
return Image(image: NetworkImage(gf.properties!["photos"]));
|
|
}
|
|
}
|
|
|
|
void _launchURL(url) async {
|
|
if (!await launch(url)) throw 'Could not launch $url';
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
SizedBox(height: 8.0,),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
MaterialButton(
|
|
onPressed: () {
|
|
homeController.makePrevious(homeController.currentFeature[0]);
|
|
},
|
|
color: Colors.blue,
|
|
textColor: Colors.white,
|
|
child: Icon(
|
|
Icons.arrow_back_ios,
|
|
size: 10,
|
|
),
|
|
padding: EdgeInsets.all(16),
|
|
shape: CircleBorder(),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
child: Obx(() =>
|
|
Text(homeController.currentFeature[0].properties!["location_name"], style: TextStyle(
|
|
fontSize: 15.0,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
)
|
|
),
|
|
),
|
|
),
|
|
MaterialButton(
|
|
onPressed: () {
|
|
homeController.makeNext(homeController.currentFeature[0]);
|
|
},
|
|
color: Colors.blue,
|
|
textColor: Colors.white,
|
|
child: Icon(
|
|
Icons.arrow_forward_ios,
|
|
size: 10,
|
|
),
|
|
padding: EdgeInsets.all(16),
|
|
shape: CircleBorder(),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: SizedBox(
|
|
height: 360.0,
|
|
child: Obx(() => getImage(homeController.currentFeature[0])),
|
|
)
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
children: [
|
|
homeController.currentFeature[0].properties!["address"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),),
|
|
SizedBox(width: 12.0,),
|
|
Obx(() => Text(homeController.currentFeature[0].properties!["address"],
|
|
style: TextStyle(color: Colors.blue,),
|
|
))
|
|
],
|
|
): Container(width: 0.0, height: 0,),
|
|
homeController.currentFeature[0].properties!["phone"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),),
|
|
SizedBox(width: 12.0,),
|
|
Obx(() => Text(homeController.currentFeature[0].properties!["phone"],
|
|
style: TextStyle(color: Colors.blue,),
|
|
))
|
|
],
|
|
): Container(width: 0, height: 0,),
|
|
homeController.currentFeature[0].properties!["email"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),),
|
|
SizedBox(width: 12.0,),
|
|
Obx(() => Text(homeController.currentFeature[0].properties!["email"],
|
|
style: TextStyle(color: Colors.blue,),
|
|
))
|
|
],
|
|
): Container(width: 0, height: 0,),
|
|
homeController.currentFeature[0].properties!["webcontents"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text("web".tr, style: TextStyle(fontWeight: FontWeight.bold)),
|
|
SizedBox(width: 12.0,),
|
|
Obx(() => InkWell(
|
|
onTap: (){
|
|
_launchURL(homeController.currentFeature[0].properties!["webcontents"]);
|
|
},
|
|
child: Text(homeController.currentFeature[0].properties!["webcontents"],
|
|
style: TextStyle(color: Colors.blue,),
|
|
),
|
|
))
|
|
],
|
|
): Container(width: 0.0, height: 0.0,),
|
|
homeController.currentFeature[0].properties!["videos"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)),
|
|
SizedBox(width: 12.0,),
|
|
Obx(() => Text(homeController.currentFeature[0].properties!["videos"],
|
|
style: TextStyle(color: Colors.blue,),
|
|
))
|
|
],
|
|
): Container(width: 0.0, height: 0.0,),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 20.0,),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
ElevatedButton(
|
|
onPressed: (){},
|
|
child: Text("schedule_point".tr)
|
|
),
|
|
ElevatedButton(
|
|
onPressed: (){},
|
|
child: Text("schedule_point".tr)
|
|
),
|
|
ElevatedButton(
|
|
onPressed: (){},
|
|
child: Text("schedule_point".tr)
|
|
)
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
SizedBox(height: 60.0,),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |