update
This commit is contained in:
@ -1,122 +0,0 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/home/home_controller.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:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||
|
||||
class HomePage extends GetView<HomeController> {
|
||||
|
||||
final HomeController homeController = Get.find<HomeController>();
|
||||
|
||||
|
||||
void changeCurrentFeature(GeoJsonFeature fs){
|
||||
if(homeController.currentFeature.length > 0){
|
||||
homeController.currentFeature.clear();
|
||||
}
|
||||
homeController.currentFeature.add(fs);
|
||||
}
|
||||
|
||||
Image getImage(int index){
|
||||
if(homeController.locations[0].collection[index].properties!["photos"] == null || homeController.locations[0].collection[index].properties!["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(homeController.locations[0].collection[index].properties!["photos"]));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
drawer: DrawerPage(),
|
||||
appBar: AppBar(
|
||||
title: Text("app_title".tr),
|
||||
centerTitle: true,
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.map),
|
||||
onPressed: (){
|
||||
//print(homeController.locations.length);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
floatingActionButton: new FloatingActionButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.MAP);
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: new Icon(Icons.document_scanner),
|
||||
elevation: 4.0,
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(child: IconButton(icon: Icon(Icons.camera_enhance), onPressed: (){},),),
|
||||
Expanded(child: new Text('')),
|
||||
Expanded(child: IconButton(icon: Icon(Icons.travel_explore), onPressed: (){}),),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
body:Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
height: 50.0,
|
||||
child: BreadCrumb(
|
||||
items: <BreadCrumbItem>[
|
||||
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),)),
|
||||
],
|
||||
divider: Icon(Icons.chevron_right),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() =>
|
||||
homeController.locations.length > 0 ?
|
||||
ListView.builder(
|
||||
itemCount: homeController.locations[0].collection.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (_, index){
|
||||
return Card(
|
||||
child: ListTile(
|
||||
onTap: (){
|
||||
GeoJsonFeature gf = homeController.locations[0].collection[index];
|
||||
changeCurrentFeature(gf);
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
builder: (context) => BottomSheetWidget(),
|
||||
);
|
||||
},
|
||||
leading: getImage(index),
|
||||
title: Text(homeController.locations[0].collection[index].properties!['location_name'].toString()),
|
||||
subtitle: Text(homeController.locations[0].collection[index].properties!['category']),
|
||||
),
|
||||
);
|
||||
},
|
||||
) : Container(width: 0, height: 0,),
|
||||
)
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user