Skip to content

Commit

Permalink
feat: Created Location Selection, Boundary fetching and place fetchin…
Browse files Browse the repository at this point in the history
…g logic
  • Loading branch information
AritraBiswas9788 committed Jul 11, 2024
1 parent bebd41c commit f08be2a
Show file tree
Hide file tree
Showing 23 changed files with 1,737 additions and 237 deletions.
43 changes: 24 additions & 19 deletions lib/components/MapKmlElement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ class Mapkmlelement extends StatefulWidget {
required this.mapMovementController,
required this.elementIndex,
required this.handlerCallback(CallbackHandler handler),
required this.submitData});
required this.submitData,
this.hideFullScreen});

MapPosition position;
MapMovementController mapMovementController;
int elementIndex;
final Function handlerCallback;
Function(KmlElement) submitData;
bool? hideFullScreen;

@override
State<Mapkmlelement> createState() => _MapkmlelementState();
Expand Down Expand Up @@ -136,24 +138,27 @@ class _MapkmlelementState extends State<Mapkmlelement> {
),
),
),
Align(
alignment: Alignment.topRight,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
onPressed: () async {
print("runs");
var kmlElement = await Get.to(() => MapKmlFullscreen(
position: widget.position,
mapMovementController: widget.mapMovementController,
elementIndex: widget.elementIndex,
submitData: widget.submitData));
widget.submitData(kmlElement);
},
icon: const Icon(
Icons.fullscreen_rounded,
color: Colors.white,
size: 50.0,
Visibility(
visible: !(widget.hideFullScreen ?? false),
child: Align(
alignment: Alignment.topRight,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
onPressed: () async {
print("runs");
var kmlElement = await Get.to(() => MapKmlFullscreen(
position: widget.position,
mapMovementController: widget.mapMovementController,
elementIndex: widget.elementIndex,
submitData: widget.submitData));
widget.submitData(kmlElement);
},
icon: const Icon(
Icons.fullscreen_rounded,
color: Colors.white,
size: 50.0,
),
),
),
),
Expand Down
24 changes: 14 additions & 10 deletions lib/components/location_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ import 'package:super_liquid_galaxy_controller/data_class/country_data.dart';
import 'package:super_liquid_galaxy_controller/screens/location_picker.dart';
import 'package:super_liquid_galaxy_controller/utils/galaxy_colors.dart';
import 'package:geocoding/geocoding.dart';
import 'package:super_liquid_galaxy_controller/utils/tour_controller.dart';
import '../generated/assets.dart';

class LocationSelector extends StatefulWidget {
LocationSelector(
{super.key, this.height, this.width, this.iconSize, this.searchSize, required this.submitData});
{super.key, this.height, this.width, this.iconSize, this.searchSize, required this.submitData,required this.tourController});

double? height;
double? width;
double? iconSize;
double? searchSize;
TourController tourController;
Function(Coordinates,String) submitData;

@override
Expand All @@ -29,7 +31,6 @@ class _LocationSelectorState extends State<LocationSelector> {
late List<CountryData> jsonList;
late List<dynamic> dataList;
late String label;

late String selectedCountry;
late String selectedState;

Expand All @@ -39,6 +40,7 @@ class _LocationSelectorState extends State<LocationSelector> {
selectedCountry = "India";
selectedState = "West Bengal";
label = "$selectedCountry \n$selectedState";
widget.tourController.setSearchAround(Coordinates(latitude: 22.9867569, longitude: 87.854975), label);
initializeJsonList();
super.initState();
}
Expand Down Expand Up @@ -286,14 +288,16 @@ class _LocationSelectorState extends State<LocationSelector> {
const SizedBox(
width: 16.0,
),
Text(
label,
style: const TextStyle(
color: Colors.white,
fontSize: 30.0,
fontWeight: FontWeight.w700,
),
),
Obx((){
return Text(
widget.tourController.label.value,
style: const TextStyle(
color: Colors.white,
fontSize: 30.0,
fontWeight: FontWeight.w700,
),
);
})
],
)),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/components/navisland.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ class NavIsland extends StatelessWidget {
color: Colors.transparent,
child: InkWell(
onTap: () async {
LatLng start = LatLng(1, 5);
LatLng end = LatLng(7, 11);
LatLng start = LatLng(7, 11);
LatLng end = LatLng(1, 5);

double dashLength =
10000.0; // Length of each dash in meters
Expand Down
9 changes: 9 additions & 0 deletions lib/data_class/coordinate.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:latlong2/latlong.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart' as mp;

class Coordinates {
late double latitude;
Expand All @@ -13,6 +14,14 @@ class Coordinates {
longitude = point.longitude;
}

Coordinates.fromLatLngMap(mp.LatLng point) {
latitude = point.latitude;
longitude = point.longitude;

longitude += 360.0;
longitude %= 360.0;
}

// Override toString for better debugging output
@override
String toString() {
Expand Down
4 changes: 2 additions & 2 deletions lib/data_class/geo_reversecode_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ class Results {
this.datasource = json["datasource"] == null ? null : Datasource.fromJson(json["datasource"]);
this.country = json["country"];
this.countryCode = json["country_code"];
this.lon = json["lon"];
this.lat = json["lat"];
this.lon = json["lon"]?.toDouble();
this.lat = json["lat"]?.toDouble();
this.distance = json["distance"]?.toDouble();
this.resultType = json["result_type"];
this.formatted = json["formatted"];
Expand Down
Loading

0 comments on commit f08be2a

Please sign in to comment.