242 lines
9.7 KiB
Dart
242 lines
9.7 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';
|
|
}
|
|
|
|
// Widget getAttrib(String name){
|
|
// print("calling ...");
|
|
// if(homeController.currentFeature[0].properties!["phone"] == null || homeController.currentFeature[0].properties!["phone"] == ""){
|
|
// return Container(height: 0, width: 0,);
|
|
// }
|
|
// else {
|
|
// return Obx(() =>
|
|
// Text(homeController.currentFeature[0].properties!["phone"] ?? '',
|
|
// style: TextStyle(color: Colors.blue,),
|
|
// overflow: TextOverflow.ellipsis,)
|
|
// );
|
|
// }
|
|
// }
|
|
|
|
@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: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
|
child: Column(
|
|
children: [
|
|
homeController.currentFeature[0].properties!["address"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
|
|
),
|
|
SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => Text(homeController.currentFeature[0].properties!["address"] ?? '',
|
|
style: TextStyle(color: Colors.blue,),
|
|
softWrap: true,
|
|
overflow: TextOverflow.ellipsis,)
|
|
),
|
|
),
|
|
)
|
|
],
|
|
): Container(width: 0.0, height: 0,),
|
|
homeController.currentFeature[0].properties!["phone"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
|
SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => Text(homeController.currentFeature[0].properties!["phone"] ?? '',
|
|
style: TextStyle(color: Colors.blue,),
|
|
overflow: TextOverflow.ellipsis,)
|
|
),
|
|
),
|
|
)
|
|
],
|
|
): Container(width: 0, height: 0,),
|
|
homeController.currentFeature[0].properties!["email"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
|
SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => Text(homeController.currentFeature[0].properties!["email"] ?? '',
|
|
style: TextStyle(color: Colors.blue,),
|
|
overflow: TextOverflow.ellipsis,)
|
|
),
|
|
),
|
|
)
|
|
],
|
|
): Container(width: 0, height: 0,),
|
|
homeController.currentFeature[0].properties!["webcontents"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text(
|
|
"web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
|
SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => InkWell(
|
|
onTap: (){
|
|
_launchURL(homeController.currentFeature[0].properties!["webcontents"]);
|
|
},
|
|
child: Text(homeController.currentFeature[0].properties!["webcontents"] ?? '',
|
|
style: TextStyle(color: Colors.blue,),
|
|
softWrap: false,
|
|
overflow: TextOverflow.fade,),
|
|
)),
|
|
),
|
|
)
|
|
],
|
|
): Container(width: 0.0, height: 0.0,),
|
|
homeController.currentFeature[0].properties!["videos"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
|
SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => Text(homeController.currentFeature[0].properties!["videos"] ?? '',
|
|
style: TextStyle(color: Colors.blue,),
|
|
overflow: TextOverflow.ellipsis,)
|
|
),
|
|
),
|
|
)
|
|
],
|
|
): 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,),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |