update
This commit is contained in:
371
lib/widgets/bottom_sheet_new.dart
Normal file
371
lib/widgets/bottom_sheet_new.dart
Normal file
@ -0,0 +1,371 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.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:rogapp/widgets/bottom_sheet_controller.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
BottomSheetNew({ Key? key }) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
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"],
|
||||
),
|
||||
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 Wrap(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: [
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
indexController.makePrevious(indexController.currentFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
shape: CircleBorder(),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() =>
|
||||
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
indexController.makeNext(indexController.currentFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
shape: CircleBorder(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 260.0,
|
||||
child: Obx(() => getImage(indexController.currentFeature[0])),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
Obx(() =>
|
||||
(indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ?
|
||||
getDetails("address".tr, indexController.currentFeature[0].properties!["address"] ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
(indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ?
|
||||
getDetails("telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
(indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ?
|
||||
getDetails("email".tr, indexController.currentFeature[0].properties!["email"] ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
(indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ?
|
||||
getDetails("web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true)
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
(indexController.currentFeature[0].properties!["videos"] as String).isNotEmpty ?
|
||||
getDetails("video".tr, indexController.currentFeature[0].properties!["videos"] ?? '', isurl: true)
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
indexController.rog_mode.value == 0 ?
|
||||
indexController.currentAction.isNotEmpty ?
|
||||
getDoubleAction(context)
|
||||
:
|
||||
getSingleAction()
|
||||
:
|
||||
getCheckin(context),
|
||||
),
|
||||
SizedBox(height: 60.0,)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget getCheckin(BuildContext context){
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
indexController.currentAction[0][0]["checkin"] == false ?
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
child: 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: Icon(
|
||||
Icons.favorite, color: Colors.red)
|
||||
|
||||
,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget getSingleAction(){
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
},
|
||||
child: Text("その他のオプションについてはログインしてください"))
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget getDoubleAction(BuildContext context){
|
||||
return Container(
|
||||
color: Colors.black12,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical:8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
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: () {
|
||||
|
||||
},
|
||||
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
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: () {
|
||||
|
||||
},
|
||||
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getDetails(String label, String text, {bool isurl=false}){
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(label),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10.0,),
|
||||
Flexible(
|
||||
flex: 3,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: (){
|
||||
if(isurl){
|
||||
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
||||
}
|
||||
},
|
||||
child: Text(text,
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -18,7 +18,13 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(gf.properties!["photos"]));
|
||||
return Image(image: NetworkImage(
|
||||
gf.properties!["photos"],
|
||||
),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +37,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 8.0,),
|
||||
SizedBox(height: 5.0,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -43,9 +49,9 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
textColor: Colors.white,
|
||||
child: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 10,
|
||||
size: 14,
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: EdgeInsets.all(14),
|
||||
shape: CircleBorder(),
|
||||
),
|
||||
Expanded(
|
||||
@ -68,9 +74,9 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
textColor: Colors.white,
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 10,
|
||||
size: 14,
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: EdgeInsets.all(14),
|
||||
shape: CircleBorder(),
|
||||
),
|
||||
],
|
||||
@ -79,7 +85,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 360.0,
|
||||
height: 260.0,
|
||||
child: Obx(() => getImage(indexController.currentFeature[0])),
|
||||
)
|
||||
),
|
||||
@ -89,7 +95,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
indexController.currentFeature[0].properties!["address"] != null ?
|
||||
@ -208,7 +214,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
indexController.rog_mode == 0 ?
|
||||
indexController.rog_mode.value == 0 ?
|
||||
|
||||
|
||||
|
||||
@ -218,7 +224,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
indexController.currentAction[0][0]["wanttogo"] == false ?
|
||||
indexController.currentAction[0][0]["wanttogo"] == false ?
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
@ -297,7 +303,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
|
||||
:
|
||||
Container(width: 0, height: 0,),
|
||||
indexController.rog_mode == 1 ?
|
||||
indexController.rog_mode.value == 1 ?
|
||||
indexController.currentAction[0][0]["checkin"] == false ?
|
||||
Column(
|
||||
children: [
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
|
||||
@ -22,7 +23,12 @@ class DestinationWidget extends StatelessWidget {
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(destinationController.destinations[index]["location"]["properties"]["photos"]));
|
||||
return Image(image: NetworkImage(
|
||||
destinationController.destinations[index]["location"]["properties"]["photos"]),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +132,8 @@ class DestinationWidget extends StatelessWidget {
|
||||
indexController.getAction();
|
||||
|
||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
builder:((context) => BottomSheetWidget())
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
builder:((context) => BottomSheetNew())
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class ListWidget extends StatelessWidget {
|
||||
@ -14,7 +15,12 @@ class ListWidget extends StatelessWidget {
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]));
|
||||
return Image(
|
||||
image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +47,8 @@ class ListWidget extends StatelessWidget {
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
builder: (context) => BottomSheetWidget(),
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder:((context) => BottomSheetNew())
|
||||
);
|
||||
},
|
||||
leading: getImage(index),
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
@ -11,6 +9,7 @@ import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class MapWidget extends StatelessWidget {
|
||||
@ -139,8 +138,12 @@ class MapWidget extends StatelessWidget {
|
||||
indexController.currentFeature.add(fs);
|
||||
indexController.getAction();
|
||||
|
||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
builder:((context) => BottomSheetWidget())
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
isDismissible: true,
|
||||
builder:((context) => BottomSheetNew())
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user