update for flutter_map
This commit is contained in:
11
lib/pages/rog/rog_binding.dart
Normal file
11
lib/pages/rog/rog_binding.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/rog/rog_controller.dart';
|
||||
import 'package:rogapp/utils/app_controller.dart';
|
||||
|
||||
class RogBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<AppController>(AppController());
|
||||
Get.put<RogController>(RogController());
|
||||
}
|
||||
}
|
||||
32
lib/pages/rog/rog_controller.dart
Normal file
32
lib/pages/rog/rog_controller.dart
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/location.dart';
|
||||
import 'package:sliding_up_panel/sliding_up_panel.dart';
|
||||
|
||||
class RogController extends GetxController {
|
||||
|
||||
// RX vars
|
||||
List<Location> locations = <Location>[].obs;
|
||||
var currentLocation = {}.obs;
|
||||
var currentUser = {}.obs;
|
||||
var isLoading = false.obs;
|
||||
|
||||
// Controllers in home page
|
||||
PanelController panelController = PanelController();
|
||||
MapController mapController = MapController();
|
||||
|
||||
|
||||
Location? getIncidentForLatLong(double lat, double long){
|
||||
for(Location l in locations){
|
||||
print("i - ${l.latitude}, ${l.longitude} -- ${lat}, ${long}");
|
||||
if(l.latitude == lat && l.longitude == long){
|
||||
return l;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
46
lib/pages/rog/rog_page.dart
Normal file
46
lib/pages/rog/rog_page.dart
Normal file
@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/location.dart';
|
||||
import 'package:rogapp/pages/rog/rog_controller.dart';
|
||||
import 'package:rogapp/utils/app_controller.dart';
|
||||
import 'package:rogapp/widgets/collapsed_widget.dart';
|
||||
import 'package:sliding_up_panel/sliding_up_panel.dart';
|
||||
|
||||
class RogPage extends StatelessWidget {
|
||||
RogPage({Key? key}) : super(key: key);
|
||||
|
||||
final AppController appController = Get.find<AppController>();
|
||||
final RogController rogController = Get.find<RogController>();
|
||||
|
||||
void addlocation(){
|
||||
print("called add location");
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("app_title".tr, style: TextStyle(fontSize: 28),),
|
||||
),
|
||||
body: ,
|
||||
);
|
||||
}
|
||||
|
||||
_scrollingList(ScrollController sc) {
|
||||
return ListView.builder(
|
||||
controller: sc,
|
||||
itemCount: 50,
|
||||
itemBuilder: (BuildContext context, int i){
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Text("$i"),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user