fix(bugs): update mapStyle when change theme

This commit is contained in:
anhtunz
2025-01-22 23:13:55 +07:00
parent 408c92d843
commit bcf205f171
12 changed files with 526 additions and 543 deletions

View File

@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:developer' as dev;
import 'dart:math' as math;
import 'package:firebase_messaging/firebase_messaging.dart';
@@ -90,8 +92,7 @@ class NotificationServices {
RemoteMessage? initialMessage =
await FirebaseMessaging.instance.getInitialMessage();
if (initialMessage != null) {
// showNotification(initialMessage);
// ignore: use_build_context_synchronously
// showNotification(initialMessage)
handleMessage(context, initialMessage);
}

View File

@@ -1,4 +1,6 @@
import 'dart:developer';
import 'package:dio/dio.dart';
import 'error_response_model.dart';
@@ -87,7 +89,7 @@ class DioErrorHandler {
// }
getMas(dynamic error) {
print("myError ${error.runtimeType}");
log("myError ${error.runtimeType}");
if (error.runtimeType != String) {
errorResponse.message =
error['message'].toString(); //?? S.of(Get.context).something_wrong;
@@ -128,7 +130,7 @@ class ErrorHandler {
// return error.toString();
errorResponse.message = "The Provided API key is invalid";
return errorResponse;
} else if (error is DioError) {
} else if (error is DioException) {
return DioErrorHandler().handleDioError(error);
}
errorResponse.message = "The Provided API key is invalid";

View File

@@ -1,4 +1,4 @@
// ignore_for_file: unnecessary_this, use_build_context_synchronously, prefer_typing_uninitialized_variables, library_private_types_in_public_api
// ignore_for_file: unnecessary_this, use_build_context_synchronously, prefer_typing_uninitialized_variables, library_private_types_in_public_api, prefer_const_constructors
import 'dart:developer';
@@ -54,12 +54,10 @@ class NearBySearchSFM extends StatefulWidget {
this.textInputAction});
@override
_NearBySearchSFMState createState() =>
_NearBySearchSFMState();
_NearBySearchSFMState createState() => _NearBySearchSFMState();
}
class _NearBySearchSFMState
extends State<NearBySearchSFM> {
class _NearBySearchSFMState extends State<NearBySearchSFM> {
final subject = PublishSubject<String>();
OverlayEntry? _overlayEntry;
List<Prediction> alPredictions = [];
@@ -127,9 +125,9 @@ class _NearBySearchSFMState
String country = widget.countries![i];
if (i == 0) {
url = url + "&components=country:$country";
url = "$url&components=country:$country";
} else {
url = url + "|" + "country:" + country;
url = "$url|country:$country";
}
}
}
@@ -184,8 +182,8 @@ class _NearBySearchSFMState
}
textChanged(String text) async {
getLocation(text, widget.locationLatitude, widget.locationLongitude,
widget.radius);
getLocation(
text, widget.locationLatitude, widget.locationLongitude, widget.radius);
}
OverlayEntry? _createOverlayEntry() {
@@ -278,7 +276,9 @@ class _NearBySearchSFMState
if (this._overlayEntry != null) {
try {
this._overlayEntry?.remove();
} catch (e) {}
} catch (e) {
log("Error: $e");
}
}
}
@@ -289,7 +289,7 @@ class _NearBySearchSFMState
_showSnackBar(String errorData) {
if (widget.showError) {
final snackBar = SnackBar(
content: Text("$errorData"),
content: Text(errorData),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}

View File

@@ -26,8 +26,6 @@ class _SharedPieChartState extends State<SharedPieChart> {
int lastTouchedIndex = -1;
@override
Widget build(BuildContext context) {
int touchedIndex = -1;
TextStyle titleStyle = const TextStyle(
color: Colors.white,
fontSize: 20,
@@ -61,7 +59,6 @@ class _SharedPieChartState extends State<SharedPieChart> {
if (!event.isInterestedForInteractions ||
pieTouchResponse == null ||
pieTouchResponse.touchedSection == null) {
touchedIndex = -1;
return;
}
int newTouchedIndex =