fixed popup buttons added location stream and center button

This commit is contained in:
2024-03-06 11:40:00 +05:30
parent 2f329669e9
commit e6a7d37519
6 changed files with 112 additions and 44 deletions

View File

@ -11,9 +11,11 @@ import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/utils/location_controller.dart';
import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/current_position_widget.dart';
import 'package:rogapp/widgets/game_state_view.dart';
class MapWidget extends StatefulWidget {
@ -28,6 +30,7 @@ class _MapWidgetState extends State<MapWidget> {
final DestinationController destinationController =
Get.find<DestinationController>();
final LocationController locationController = Get.find<LocationController>();
StreamSubscription? subscription;
Timer? _timer;
@ -50,6 +53,7 @@ class _MapWidgetState extends State<MapWidget> {
DatabaseHelper db = DatabaseHelper.instance;
db.getDestinationByLatLon(des.lat!, des.lon!).then((value) {
destinationController.shouldShowBottomSheet = false;
showModalBottomSheet(
constraints:
BoxConstraints.loose(Size(Get.width, Get.height * 0.85)),
@ -60,6 +64,7 @@ class _MapWidgetState extends State<MapWidget> {
destination: des, isAlreadyCheckedIn: value.isNotEmpty))
//builder:((context) => BottomSheetWidget())
).whenComplete(() {
destinationController.shouldShowBottomSheet = true;
destinationController.skipGps = false;
});
});
@ -176,10 +181,10 @@ class _MapWidgetState extends State<MapWidget> {
}
void _centerMapOnUser() {
//print("showBottomSheet ${destinationController.shouldShowBottomSheet}");
if (destinationController.shouldShowBottomSheet) {
destinationController.centerMapToCurrentLocation();
}
print("showBottomSheet ${destinationController.shouldShowBottomSheet}");
//if (destinationController.shouldShowBottomSheet) {
destinationController.centerMapToCurrentLocation();
//}
}
@override
@ -246,7 +251,9 @@ class _MapWidgetState extends State<MapWidget> {
: Container(),
),
CurrentLocationLayer(
followOnLocationUpdate: FollowOnLocationUpdate.never,
positionStream: locationController
.locationMarkerPositionStreamController.stream,
alignDirectionOnUpdate: AlignOnUpdate.never,
turnOnHeadingUpdate: TurnOnHeadingUpdate.never,
style: const LocationMarkerStyle(
marker: DefaultLocationMarker(
@ -284,6 +291,7 @@ class _MapWidgetState extends State<MapWidget> {
],
)),
const Positioned(top: 0, left: 0, child: GameStateWidget()),
const Positioned(bottom: 10, right: 10, child: CurrentPosition())
// const Positioned(
// bottom: 10,
// left: 0,