update for flutter_map
This commit is contained in:
@ -1,50 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/location_service.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/services/location_service.dart';
|
||||
|
||||
class CatWidget extends StatefulWidget {
|
||||
CatWidget({ Key? key, required this.indexController, }) : super(key: key);
|
||||
// class CatWidget extends StatefulWidget {
|
||||
// CatWidget({ Key? key, required this.indexController, }) : super(key: key);
|
||||
|
||||
IndexController indexController;
|
||||
// IndexController indexController;
|
||||
|
||||
@override
|
||||
State<CatWidget> createState() => _CatWidgetState();
|
||||
}
|
||||
// @override
|
||||
// State<CatWidget> createState() => _CatWidgetState();
|
||||
// }
|
||||
|
||||
class _CatWidgetState extends State<CatWidget> {
|
||||
String defaultValue = "---";
|
||||
// class _CatWidgetState extends State<CatWidget> {
|
||||
// String defaultValue = "---";
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return
|
||||
PopupMenuButton(
|
||||
onSelected: (value) {
|
||||
widget.indexController.currentCat.clear();
|
||||
widget.indexController.currentCat.add(value.toString());
|
||||
widget.indexController.refreshLocationForCat();
|
||||
setState(() {
|
||||
print(value);
|
||||
//widget.indexController.is_loading.value = true;
|
||||
defaultValue = value.toString();
|
||||
});
|
||||
},
|
||||
itemBuilder: (BuildContext context){
|
||||
List<PopupMenuItem> itms = <PopupMenuItem>[];
|
||||
for(dynamic d in widget.indexController.cats[0]){
|
||||
PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||
itms.add(itm);
|
||||
}
|
||||
return itms;
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return
|
||||
// PopupMenuButton(
|
||||
// onSelected: (value) {
|
||||
// widget.indexController.currentCat.clear();
|
||||
// widget.indexController.currentCat.add(value.toString());
|
||||
// widget.indexController.refreshLocationForCat();
|
||||
// setState(() {
|
||||
// print(value);
|
||||
// //widget.indexController.is_loading.value = true;
|
||||
// defaultValue = value.toString();
|
||||
// });
|
||||
// },
|
||||
// itemBuilder: (BuildContext context){
|
||||
// List<PopupMenuItem> itms = <PopupMenuItem>[];
|
||||
// for(dynamic d in widget.indexController.cats[0]){
|
||||
// PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||
// itms.add(itm);
|
||||
// }
|
||||
// return itms;
|
||||
// }
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// widget.indexController.cats.map((e) =>
|
||||
// PopupMenuItem(
|
||||
// value: defaultValue,
|
||||
// child: Text(e[0]['category'].toString()),
|
||||
// )
|
||||
// ).toList(),
|
||||
// // widget.indexController.cats.map((e) =>
|
||||
// // PopupMenuItem(
|
||||
// // value: defaultValue,
|
||||
// // child: Text(e[0]['category'].toString()),
|
||||
// // )
|
||||
// // ).toList(),
|
||||
Reference in New Issue
Block a user