update
This commit is contained in:
@ -3,11 +3,13 @@
|
|||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/services/location_service.dart';
|
import 'package:rogapp/services/location_service.dart';
|
||||||
|
import 'package:rogapp/services/perfecture_service.dart';
|
||||||
|
|
||||||
class HomeController extends GetxController {
|
class HomeController extends GetxController {
|
||||||
|
|
||||||
List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
|
List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
|
||||||
List<GeoJsonFeature> currentFeature = <GeoJsonFeature>[].obs;
|
List<GeoJsonFeature> currentFeature = <GeoJsonFeature>[].obs;
|
||||||
|
List<dynamic> perfectures = <dynamic>[].obs;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -16,6 +18,12 @@ class HomeController extends GetxController {
|
|||||||
LocationService.loadLocations().then((value){
|
LocationService.loadLocations().then((value){
|
||||||
locations.add(value!);
|
locations.add(value!);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PerfectureService.loadPerfectures().then((value){
|
||||||
|
perfectures.add(value);
|
||||||
|
print(perfectures);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GeoJsonFeature? getFeatureForLatLong(double lat, double long){
|
GeoJsonFeature? getFeatureForLatLong(double lat, double long){
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||||
import 'package:rogapp/pages/home/home_controller.dart';
|
import 'package:rogapp/pages/home/home_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
import 'package:rogapp/services/perfecture_service.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ class HomePage extends GetView<HomeController> {
|
|||||||
|
|
||||||
final HomeController homeController = Get.find<HomeController>();
|
final HomeController homeController = Get.find<HomeController>();
|
||||||
|
|
||||||
|
|
||||||
void changeCurrentFeature(GeoJsonFeature fs){
|
void changeCurrentFeature(GeoJsonFeature fs){
|
||||||
if(homeController.currentFeature.length > 0){
|
if(homeController.currentFeature.length > 0){
|
||||||
homeController.currentFeature.clear();
|
homeController.currentFeature.clear();
|
||||||
@ -74,7 +76,12 @@ class HomePage extends GetView<HomeController> {
|
|||||||
height: 50.0,
|
height: 50.0,
|
||||||
child: BreadCrumb(
|
child: BreadCrumb(
|
||||||
items: <BreadCrumbItem>[
|
items: <BreadCrumbItem>[
|
||||||
BreadCrumbItem(content: Text('Item1', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),)),
|
BreadCrumbItem(
|
||||||
|
content: ElevatedButton(child: Text("Press"), onPressed: (){
|
||||||
|
print("-----");
|
||||||
|
print(homeController.perfectures[0][0]);
|
||||||
|
},)
|
||||||
|
),
|
||||||
BreadCrumbItem(content: Text('Item2', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),)),
|
BreadCrumbItem(content: Text('Item2', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),)),
|
||||||
],
|
],
|
||||||
divider: Icon(Icons.chevron_right),
|
divider: Icon(Icons.chevron_right),
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/rendering.dart';
|
||||||
|
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||||
import 'package:flutter_map/plugin_api.dart';
|
import 'package:flutter_map/plugin_api.dart';
|
||||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson/geojson.dart';
|
||||||
@ -11,6 +13,7 @@ import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
|
|||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
|
import 'package:rogapp/widgets/perfecture_widget.dart';
|
||||||
|
|
||||||
|
|
||||||
class MapPage extends StatelessWidget {
|
class MapPage extends StatelessWidget {
|
||||||
@ -57,88 +60,110 @@ class MapPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Obx(() =>
|
child: Column(
|
||||||
Stack(
|
children: [
|
||||||
children: [
|
Container(
|
||||||
FlutterMap(
|
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
mapController: mapController,
|
alignment: Alignment.centerLeft,
|
||||||
options: MapOptions(
|
height: 50.0,
|
||||||
center: LatLng(37.15319600454702, 139.58765950528198),
|
child: SingleChildScrollView(
|
||||||
zoom: 6,
|
scrollDirection: Axis.horizontal,
|
||||||
maxZoom: 20,
|
child: BreadCrumb(
|
||||||
plugins: [
|
items: <BreadCrumbItem>[
|
||||||
MarkerClusterPlugin(),
|
BreadCrumbItem(content:
|
||||||
],
|
//Text('Item1', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),)
|
||||||
onTap: (_, __) =>
|
PerfectureWidget(),
|
||||||
_popupController
|
),
|
||||||
.hideAllPopups(), // Hide popup when the map is tapped.
|
BreadCrumbItem(content: Text('Item2', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),)),
|
||||||
),
|
|
||||||
children: [
|
|
||||||
BaseLayer(),
|
|
||||||
LocationMarkerLayerWidget(),
|
|
||||||
homeController.locations.length > 0 ?
|
|
||||||
MarkerClusterLayerWidget(
|
|
||||||
options: MarkerClusterLayerOptions(
|
|
||||||
spiderfyCircleRadius: 80,
|
|
||||||
spiderfySpiralDistanceMultiplier: 2,
|
|
||||||
circleSpiralSwitchover: 12,
|
|
||||||
maxClusterRadius: 20,
|
|
||||||
rotate: true,
|
|
||||||
onMarkerTap: (marker){
|
|
||||||
GeoJsonFeature? fs = homeController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
|
||||||
print(fs);
|
|
||||||
if(fs != null){
|
|
||||||
if(homeController.currentFeature.length > 0) {
|
|
||||||
homeController.currentFeature.clear();
|
|
||||||
}
|
|
||||||
homeController.currentFeature.add(fs);
|
|
||||||
|
|
||||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
|
||||||
builder:((context) => BottomSheetWidget())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
size: Size(40, 40),
|
|
||||||
anchor: AnchorPos.align(AnchorAlign.center),
|
|
||||||
fitBoundsOptions: const FitBoundsOptions(
|
|
||||||
padding: EdgeInsets.all(50),
|
|
||||||
maxZoom: 15,
|
|
||||||
),
|
|
||||||
markers:homeController.locations[0].collection.map((i) {
|
|
||||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
|
||||||
return Marker(
|
|
||||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
|
||||||
height: 70.0,
|
|
||||||
width: 70.0,
|
|
||||||
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
|
||||||
builder: (ctx) => Icon(Icons.pin_drop),
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
builder: (context, markers) {
|
|
||||||
return Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
|
||||||
color: Colors.blue),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
markers.length.toString(),
|
|
||||||
style: TextStyle(color: Colors.white),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
): Container(height:0,width: 0),
|
|
||||||
],
|
],
|
||||||
)
|
divider: Icon(Icons.chevron_right),
|
||||||
],
|
),
|
||||||
)
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Obx(() =>
|
||||||
|
Stack(
|
||||||
|
children: [
|
||||||
|
FlutterMap(
|
||||||
|
mapController: mapController,
|
||||||
|
options: MapOptions(
|
||||||
|
center: LatLng(37.15319600454702, 139.58765950528198),
|
||||||
|
zoom: 6,
|
||||||
|
maxZoom: 20,
|
||||||
|
plugins: [
|
||||||
|
MarkerClusterPlugin(),
|
||||||
|
],
|
||||||
|
onTap: (_, __) =>
|
||||||
|
_popupController
|
||||||
|
.hideAllPopups(), // Hide popup when the map is tapped.
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
BaseLayer(),
|
||||||
|
LocationMarkerLayerWidget(),
|
||||||
|
homeController.locations.length > 0 ?
|
||||||
|
MarkerClusterLayerWidget(
|
||||||
|
options: MarkerClusterLayerOptions(
|
||||||
|
spiderfyCircleRadius: 80,
|
||||||
|
spiderfySpiralDistanceMultiplier: 2,
|
||||||
|
circleSpiralSwitchover: 12,
|
||||||
|
maxClusterRadius: 20,
|
||||||
|
rotate: true,
|
||||||
|
onMarkerTap: (marker){
|
||||||
|
GeoJsonFeature? fs = homeController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||||
|
print(fs);
|
||||||
|
if(fs != null){
|
||||||
|
if(homeController.currentFeature.length > 0) {
|
||||||
|
homeController.currentFeature.clear();
|
||||||
|
}
|
||||||
|
homeController.currentFeature.add(fs);
|
||||||
|
|
||||||
|
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||||
|
builder:((context) => BottomSheetWidget())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
size: Size(40, 40),
|
||||||
|
anchor: AnchorPos.align(AnchorAlign.center),
|
||||||
|
fitBoundsOptions: const FitBoundsOptions(
|
||||||
|
padding: EdgeInsets.all(50),
|
||||||
|
maxZoom: 15,
|
||||||
|
),
|
||||||
|
markers:homeController.locations[0].collection.map((i) {
|
||||||
|
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||||
|
return Marker(
|
||||||
|
anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||||
|
height: 70.0,
|
||||||
|
width: 70.0,
|
||||||
|
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||||
|
builder: (ctx) => Icon(Icons.pin_drop),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
builder: (context, markers) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
|
color: Colors.blue),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
markers.length.toString(),
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
): Container(height:0,width: 0),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ class LocationService{
|
|||||||
final geo = GeoJson();
|
final geo = GeoJson();
|
||||||
GeoJsonFeatureCollection? fs;
|
GeoJsonFeatureCollection? fs;
|
||||||
print("#### feature collection ####");
|
print("#### feature collection ####");
|
||||||
String url = 'http://container.intranet.sumasen.net:8100/api/location/';
|
String url = 'http://localhost:8100/api/location/';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
|||||||
24
lib/services/perfecture_service.dart
Normal file
24
lib/services/perfecture_service.dart
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
|
||||||
|
class PerfectureService{
|
||||||
|
|
||||||
|
static Future<List<dynamic>?> loadPerfectures() async {
|
||||||
|
List<dynamic> perfs = [];
|
||||||
|
String url = 'http://localhost:8100/api/perf/';
|
||||||
|
final response = await http.get(Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
|
perfs = json.decode(response.body);
|
||||||
|
}
|
||||||
|
return perfs;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -22,6 +22,20 @@ class BottomSheetWidget extends StatelessWidget {
|
|||||||
if (!await launch(url)) throw 'Could not launch $url';
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
@ -84,69 +98,116 @@ class BottomSheetWidget extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Padding(
|
||||||
children: [
|
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||||
homeController.currentFeature[0].properties!["address"] != null ?
|
child: Column(
|
||||||
Row(
|
children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
homeController.currentFeature[0].properties!["address"] != null ?
|
||||||
children: [
|
Row(
|
||||||
Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
SizedBox(width: 12.0,),
|
children: [
|
||||||
Obx(() => Text(homeController.currentFeature[0].properties!["address"],
|
Expanded(
|
||||||
style: TextStyle(color: Colors.blue,),
|
child: Container(
|
||||||
))
|
alignment: Alignment.topRight,
|
||||||
],
|
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
|
||||||
): 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,),
|
|
||||||
),
|
),
|
||||||
))
|
SizedBox(width: 12.0,),
|
||||||
],
|
Expanded(
|
||||||
): Container(width: 0.0, height: 0.0,),
|
child: Container(
|
||||||
homeController.currentFeature[0].properties!["videos"] != null ?
|
alignment: Alignment.topLeft,
|
||||||
Row(
|
child: Obx(() => Text(homeController.currentFeature[0].properties!["address"] ?? '',
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
style: TextStyle(color: Colors.blue,),
|
||||||
children: [
|
softWrap: true,
|
||||||
Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)),
|
overflow: TextOverflow.ellipsis,)
|
||||||
SizedBox(width: 12.0,),
|
),
|
||||||
Obx(() => Text(homeController.currentFeature[0].properties!["videos"],
|
),
|
||||||
style: TextStyle(color: Colors.blue,),
|
)
|
||||||
))
|
],
|
||||||
],
|
): Container(width: 0.0, height: 0,),
|
||||||
): Container(width: 0.0, height: 0.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,),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
59
lib/widgets/perfecture_widget.dart
Normal file
59
lib/widgets/perfecture_widget.dart
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:rogapp/pages/home/home_controller.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class PerfectureWidget extends StatefulWidget {
|
||||||
|
PerfectureWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
final HomeController homeController = Get.find<HomeController>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PerfectureWidget> createState() => _PerfectureWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||||
|
String dropdownValue = 'One';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<DropdownMenuItem<String>> getDropdownItems() {
|
||||||
|
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||||
|
|
||||||
|
print("---------");
|
||||||
|
print(widget.homeController.perfectures);
|
||||||
|
|
||||||
|
for (List<String> currency in widget.homeController.perfectures[0]) {
|
||||||
|
var newDropdown = DropdownMenuItem(
|
||||||
|
child: Text("dddd"),
|
||||||
|
value: "qqqq",
|
||||||
|
);
|
||||||
|
|
||||||
|
dropDownItems.add(newDropdown);
|
||||||
|
}
|
||||||
|
return dropDownItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return DropdownButton<String>(
|
||||||
|
value: dropdownValue,
|
||||||
|
icon: const Icon(Icons.arrow_downward),
|
||||||
|
elevation: 16,
|
||||||
|
style: const TextStyle(color: Colors.deepPurple),
|
||||||
|
underline: Container(
|
||||||
|
height: 2,
|
||||||
|
color: Colors.deepPurpleAccent,
|
||||||
|
),
|
||||||
|
onChanged: (String? newValue) {
|
||||||
|
setState(() {
|
||||||
|
dropdownValue = newValue!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items:getDropdownItems());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user