381 lines
16 KiB
Dart
381 lines
16 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:geojson/geojson.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:image_picker/image_picker.dart';
|
|
import 'package:rogapp/pages/index/index_controller.dart';
|
|
import 'package:rogapp/routes/app_pages.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class BottomSheetWidget extends StatelessWidget {
|
|
//const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key);
|
|
|
|
final IndexController indexController = Get.find<IndexController>();
|
|
|
|
BottomSheetWidget({Key? key}) : super(key: key);
|
|
|
|
Image getImage(GeoJsonFeature? gf){
|
|
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
|
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
|
}
|
|
else{
|
|
return Image(image: NetworkImage(
|
|
gf.properties!["photos"],
|
|
),
|
|
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
|
return Image.asset("assets/images/empty_image.png");
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
void _launchURL(url) async {
|
|
if (!await launch(url)) throw 'Could not launch $url';
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(height: 5.0,),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
MaterialButton(
|
|
onPressed: () {
|
|
indexController.makePrevious(indexController.currentFeature[0]);
|
|
},
|
|
color: Colors.blue,
|
|
textColor: Colors.white,
|
|
child: const Icon(
|
|
Icons.arrow_back_ios,
|
|
size: 14,
|
|
),
|
|
padding: const EdgeInsets.all(14),
|
|
shape: const CircleBorder(),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
child: Obx(() =>
|
|
Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
|
|
fontSize: 15.0,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
)
|
|
),
|
|
),
|
|
),
|
|
MaterialButton(
|
|
onPressed: () {
|
|
indexController.makeNext(indexController.currentFeature[0]);
|
|
},
|
|
color: Colors.blue,
|
|
textColor: Colors.white,
|
|
child: const Icon(
|
|
Icons.arrow_forward_ios,
|
|
size: 14,
|
|
),
|
|
padding: const EdgeInsets.all(14),
|
|
shape: const CircleBorder(),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: SizedBox(
|
|
height: 260.0,
|
|
child: Obx(() => getImage(indexController.currentFeature[0])),
|
|
)
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
child: Column(
|
|
children: [
|
|
indexController.currentFeature[0].properties!["address"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text("address".tr, style: const TextStyle(fontWeight: FontWeight.bold),)),
|
|
),
|
|
const SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
|
|
style: const TextStyle(color: Colors.blue,),
|
|
softWrap: true,
|
|
overflow: TextOverflow.ellipsis,)
|
|
),
|
|
),
|
|
)
|
|
],
|
|
): const SizedBox(width: 0.0, height: 0,),
|
|
indexController.currentFeature[0].properties!["phone"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text("telephone".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
|
|
const SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
|
|
style: const TextStyle(color: Colors.blue,),
|
|
overflow: TextOverflow.ellipsis,)
|
|
),
|
|
),
|
|
)
|
|
],
|
|
): const SizedBox(width: 0, height: 0,),
|
|
indexController.currentFeature[0].properties!["email"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text("email".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
|
|
const SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
|
|
style: const TextStyle(color: Colors.blue,),
|
|
overflow: TextOverflow.ellipsis,)
|
|
),
|
|
),
|
|
)
|
|
],
|
|
): const SizedBox(width: 0, height: 0,),
|
|
indexController.currentFeature[0].properties!["webcontents"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text(
|
|
"web".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
|
|
const SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => InkWell(
|
|
onTap: (){
|
|
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
|
},
|
|
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
|
|
style: const TextStyle(color: Colors.blue,),
|
|
softWrap: false,
|
|
overflow: TextOverflow.fade,),
|
|
)),
|
|
),
|
|
)
|
|
],
|
|
): const SizedBox(width: 0.0, height: 0.0,),
|
|
indexController.currentFeature[0].properties!["videos"] != null ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: Container(
|
|
alignment: Alignment.topRight,
|
|
child: Text("video".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
|
|
const SizedBox(width: 12.0,),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topLeft,
|
|
child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
|
|
style: const TextStyle(color: Colors.blue,),
|
|
overflow: TextOverflow.ellipsis,)
|
|
),
|
|
),
|
|
)
|
|
],
|
|
): const SizedBox(width: 0.0, height: 0.0,),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 20.0,),
|
|
Obx(() =>
|
|
indexController.currentAction.isNotEmpty ?
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
indexController.rog_mode.value == 0 ?
|
|
|
|
|
|
|
|
|
|
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
indexController.currentAction[0][0]["wanttogo"] == false ?
|
|
ElevatedButton(
|
|
onPressed: (){
|
|
if(indexController.currentAction.isNotEmpty){
|
|
print(indexController.currentAction[0]);
|
|
indexController.currentAction[0][0]["wanttogo"] = true;
|
|
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
|
indexController.currentAction.clear();
|
|
print("---temp---$temp");
|
|
indexController.currentAction.add([temp]);
|
|
}
|
|
indexController.makeAction(context);
|
|
},
|
|
child: Text("want_to_go".tr)
|
|
) :
|
|
ElevatedButton(
|
|
onPressed: (){
|
|
if(indexController.currentAction.isNotEmpty){
|
|
print(indexController.currentAction[0]);
|
|
indexController.currentAction[0][0]["wanttogo"] = false;
|
|
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
|
indexController.currentAction.clear();
|
|
print("---temp---$temp");
|
|
indexController.currentAction.add([temp]);
|
|
}
|
|
indexController.makeAction(context);
|
|
},
|
|
|
|
child: IconButton(
|
|
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
|
|
|
|
},
|
|
|
|
)
|
|
),
|
|
indexController.currentAction[0][0]["like"] == false ?
|
|
ElevatedButton(
|
|
onPressed: (){
|
|
if(indexController.currentAction.isNotEmpty){
|
|
print(indexController.currentAction[0]);
|
|
indexController.currentAction[0][0]["like"] = true;
|
|
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
|
indexController.currentAction.clear();
|
|
print("---temp---$temp");
|
|
indexController.currentAction.add([temp]);
|
|
}
|
|
indexController.makeAction(context);
|
|
},
|
|
child: Text("like".tr)
|
|
) :
|
|
ElevatedButton(
|
|
onPressed: (){
|
|
if(indexController.currentAction.isNotEmpty){
|
|
print(indexController.currentAction[0]);
|
|
indexController.currentAction[0][0]["like"] = false;
|
|
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
|
indexController.currentAction.clear();
|
|
print("---temp---$temp");
|
|
indexController.currentAction.add([temp]);
|
|
}
|
|
indexController.makeAction(context);
|
|
},
|
|
|
|
child: IconButton(
|
|
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
|
|
|
|
},
|
|
|
|
)
|
|
),
|
|
],
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
:
|
|
const SizedBox(width: 0, height: 0,),
|
|
indexController.rog_mode.value == 1 ?
|
|
indexController.currentAction[0][0]["checkin"] == false ?
|
|
Column(
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
ElevatedButton(
|
|
child: const Text("Image"), onPressed: (){
|
|
final ImagePicker _picker = ImagePicker();
|
|
_picker.pickImage(source: ImageSource.camera).then((value){
|
|
print("----- image---- ${value!.path}");
|
|
});
|
|
},
|
|
)
|
|
],
|
|
),
|
|
ElevatedButton(
|
|
onPressed: (){
|
|
if(indexController.currentAction.isNotEmpty){
|
|
print(indexController.currentAction[0]);
|
|
indexController.currentAction[0][0]["checkin"] = true;
|
|
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
|
indexController.currentAction.clear();
|
|
print("---temp---$temp");
|
|
indexController.currentAction.add([temp]);
|
|
}
|
|
indexController.makeAction(context);
|
|
},
|
|
child: Text("checkin".tr)
|
|
)
|
|
],
|
|
)
|
|
:
|
|
ElevatedButton(
|
|
onPressed: (){
|
|
if(indexController.currentAction.isNotEmpty){
|
|
print(indexController.currentAction[0]);
|
|
indexController.currentAction[0][0]["checkin"] = false;
|
|
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
|
indexController.currentAction.clear();
|
|
print("---temp---$temp");
|
|
indexController.currentAction.add([temp]);
|
|
}
|
|
indexController.makeAction(context);
|
|
},
|
|
|
|
child: const Icon(
|
|
Icons.favorite, color: Colors.red)
|
|
|
|
,
|
|
):
|
|
const SizedBox(width: 0, height: 0,),
|
|
],
|
|
): Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
TextButton(
|
|
onPressed: (){
|
|
Get.toNamed(AppPages.LOGIN);
|
|
},
|
|
child: const Flexible(child: Text("その他のオプションについてはログインしてください")))
|
|
],
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
SizedBox(height: 60.0,),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |