-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to reproduce
`class HomePage extends StatefulWidget {
const HomePage({super.key,);
@OverRide
State createState() => _HomePageState();
}
class _HomePageState extends State {
final Completer _controller = Completer();
AuthViewModel? authViewModel;
late ProfileViewModel _profileViewModel;
String? _mapStyle;
String pinningAddress = "";
double? lat, long;
LatLng? mapLatLong;
CameraPosition? cameraPosition;
DateTime? backButtonPressedTime;
@OverRide
void initState() {
super.initState();
_loadMapStyle();
authViewModel = Provider.of(context, listen: false);
profileViewModel = Provider.of(context, listen: false);
WidgetsBinding.instance.addPostFrameCallback(() {
_setLocation();
_profileViewModel.fetchProfileDetails();
_showLocationBottomSheet();
});
}
getAddress() async {
List placeMarks = await placemarkFromCoordinates(
cameraPosition!.target.latitude,
cameraPosition!.target.longitude,
);
setState(() {
pinningAddress =
"${placeMarks.first.name},${placeMarks.first.thoroughfare!.isEmpty ? "" : "${placeMarks.first.thoroughfare},"}${placeMarks.first.locality},${placeMarks.first.postalCode},${placeMarks.first.administrativeArea},${placeMarks.first.country}. ";
mapLatLong = LatLng(
cameraPosition!.target.latitude,
cameraPosition!.target.longitude,
);
// Logger.appLogs("lat::$lat lan::
});
}
_setLocation(){
authViewModel?.getCurrentLocation();
lat = authViewModel?.currentLocation?.latitude;
long = authViewModel?.currentLocation?.longitude;
cameraPosition = CameraPosition(
target: LatLng(lat ?? 9.924045, long ??78.122215)
);
getAddress();
}
void _loadMapStyle() async {
_mapStyle = await rootBundle.loadString(FileAssets.mapStyle);
}
void _showLocationBottomSheet() {
locationBottomSheet(context: context, validFun: () {});
}
Future _onWillPop() async {
DateTime currentTime = DateTime.now();
if (backButtonPressedTime == null ||
currentTime.difference(backButtonPressedTime!) >
const Duration(seconds: 3)) {
backButtonPressedTime = currentTime;
ToastContext().init(context);
ToastUtil.showSnackBar(context, Strings.pressBackAgain);
return false;
}
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
return true;
}
@OverRide
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: _onWillPop,
child: Consumer(
builder: (context,value,widget) {
return Scaffold(
extendBodyBehindAppBar: true,
backgroundColor: AppColorData.appSecondaryColor,
appBar: CommonAppBar(
backgroundColor: AppColorData.transparent,
titleText: "",
isLeadingWidget: true,
leading: _buildProfileWidget(value.profileDetailsResponseModel),
actions: [
locationButtonWidget(
controller: _controller,
latitude: lat,
longitude: long,
setState: setState,
onTap: () async {
GoogleMapController googleMapController = await _controller.future;
googleMapController.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
zoom: 18,
target: LatLng(
lat!,
long!,
),
),
),
);
}
),
],
),
body: _buildBody(),
);
}
),
);
}
Widget _buildBody() {
return Stack(
children: [
_buildGoogleMap(),
_buildAddress(),
_buildPin(),
_buildBottomSheet(),
],
);
}
Widget _buildGoogleMap() {
if (lat == null || long == null) {
return const Loader();
}
return GoogleMap(
compassEnabled: false,
buildingsEnabled: false,
myLocationEnabled: true,
mapToolbarEnabled: false,
myLocationButtonEnabled: false,
initialCameraPosition: CameraPosition(
target: LatLng(lat!, long!),
zoom: 18,
),
onCameraIdle: () async {
await getAddress();
},
onCameraMove: (position) {
cameraPosition = position;
},
style: _mapStyle,
onMapCreated: (mapController) {
_controller.complete(mapController);
},
);
}
Widget _buildPin() {
return Center(
child: SvgPicture.asset(SVGAssets.locationPicker, height: 25, width: 25),
);
}
Widget _buildAddress(){
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 200,
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: AppColorData.appSecondaryColor,
borderRadius: BorderRadius.circular(6)
),
child: CommonText(
text: pinningAddress,
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: context.bodySmall,
),
),
SizedBox(height: 90,)
],
),
);
}
Widget _buildBottomSheet() {
return Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: InitBottomSheet(
context: context,
controller: _controller,
initPinAddress: pinningAddress,
latLong: mapLatLong),
);
}
Widget _buildProfileWidget(ProfileDetailsResponseModel? value) {
return GestureDetector(
onTap: () {
locationBottomSheet(
context: context,
validFun: () => Get.toNamed(RouterNames.profileMenu),
);
},
child: Container(
height: 40,
margin: EdgeInsets.only(top: 10, left: 10),
width: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: AppColorData.transparent,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.network("${EndPointConstants.baseUrl}/${value?.data?.profile?.profile}",
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) =>
SvgPicture.asset(SVGAssets.emptyProfileImg)),
),
),
);
}
}`
Actual results
only working up to android versions 11 kindly help me to fix this issue
Logs
Logs
D/MapsInitializer(24092): preferredRenderer: null
D/zzcc (24092): preferredRenderer: null
I/zzcc (24092): Making Creator dynamically
W/.rebustar.ride(24092): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
I/DynamiteModule(24092): Considering local module com.google.android.gms.maps_core_dynamite:0 and remote module com.google.android.gms.maps_core_dynamite:245125201
I/DynamiteModule(24092): Selected remote version of com.google.android.gms.maps_core_dynamite, version >= 245125201
V/DynamiteModule(24092): Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/.rebustar.ride(24092): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/Google Android Maps SDK(24092): Google Play services package version: 250632013
W/.rebustar.ride(24092): Accessing hidden method Lsun/misc/Unsafe;->getUnsafe()Lsun/misc/Unsafe; (greylist,core-platform-api, linking, allowed)
I/Google Android Maps SDK(24092): Google Play services maps renderer version(maps_core): 245125201
D/de (24092): about to start loading native library asynchronously
W/.rebustar.ride(24092): Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
W/t (24092): Suppressed StrictMode policy violation: StrictModeDiskReadViolation
I/o (24092): Using GMM server: https://clients4.google.com/glm/mmap
W/t (24092): Suppressed StrictMode policy violation: StrictModeDiskReadViolation
W/t (24092): Suppressed StrictMode policy violation: StrictModeDiskWriteViolation
W/t (24092): Suppressed StrictMode policy violation: StrictModeDiskReadViolation
D/o (24092): Using Non-null serverVersionMetadataManager to load previous metadata.
I/native (24092): I0000 00:00:1739791328.027817 24092 jni_init.cc:30] Initializing JNI...
W/.rebustar.ride(24092): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
I/Google Android Maps SDK(24092): Google Play services client version: 18020000
I/flutter (24092): [IMPORTANT:flutter/shell/platform/android/platform_view_android.cc(308)] Flutter recommends migrating plugins that create and register surface textures to the new surface producer API. See https://docs.flutter.dev/release/breaking-changes/android-surface-plugins
W/ProxyAndroidLoggerBackend(24092): Too many Flogger logs received before configuration. Dropping old logs.
W/ProxyAndroidLoggerBackend(24092): Too many Flogger logs received before configuration. Dropping old logs.
W/OpenGLRenderer(24092): dequeueBuffer failed, error = -110; switching to fallback
E/ANR_LOG (24092): >>> msg's executing time is too long
E/ANR_LOG (24092): Blocked msg = { when=-4s18ms what=0 target=android.view.Choreographer$FrameHandler callback=android.view.Choreographer$FrameDisplayEventReceiver } , cost = 4018 ms
E/ANR_LOG (24092): >>>Current msg List is:
E/ANR_LOG (24092): Current msg <1> = { when=-4s22ms what=0 target=android.os.Handler callback=com.google.maps.api.android.lib6.impl.cd }
E/ANR_LOG (24092): Current msg <2> = { when=-4s17ms barrier=105 }
E/ANR_LOG (24092): Current msg <3> = { when=-553ms what=1 target=android.location.LocationManager$GnssStatusListenerTransport$GnssHandler }
E/ANR_LOG (24092): >>>CURRENT MSG DUMP OVER<<<
I/Choreographer(24092): Skipped 241 frames! The application may be doing too much work on its main thread.
D/Surface (24092): lockHardwareCanvas
W/OpenGLRenderer(24092): reserveNext failed, error = -2147483648 (Unknown error -2147483648)
D/Surface (24092): Surface::disconnect(this=0x703968c000,api=1)
I/BufferQueueProducer(24092): [SurfaceTexture-0-24092-0](this:0x704379f000,id:0,api:1,p:24092,c:24092) disconnect(P): api 1
I/OpenGLRenderer(24092): Davey! duration=4031ms; Flags=0, IntendedVsync=25761595923750, Vsync=25765612590497, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=25765615182612, AnimationStart=25765615521612, PerformTraversalsStart=25765616195996, DrawStart=25765617373381, SyncQueued=25765622981150, SyncStart=25765623884919, IssueDrawCommandsStart=25765624209689, SwapBuffers=25765626302843, FrameCompleted=25765628275073, DequeueBufferDuration=336000, QueueBufferDuration=647000,
Flutter Doctor output
Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.29.0, on Ubuntu 20.04.4 LTS 5.15.0-102-generic, locale en_IN) [238ms]
• Flutter version 3.29.0 on channel stable at /home/abservetech/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 35c388afb5 (7 days ago), 2025-02-10 12:48:41 -0800
• Engine revision f73bfc4522
• Dart version 3.7.0
• DevTools version 2.42.2
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [2.5s]
• Android SDK at /home/abservetech/Android/Sdk
• Platform android-35, build-tools 34.0.0
• Java binary at: /snap/android-studio/161/jbr/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
• All Android licenses accepted.
[✓] Chrome - develop for the web [158ms]
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop [822ms]
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 2024.1) [157ms]
• Android Studio at /snap/android-studio/161
• Flutter plugin version 83.0.2
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
[✓] Android Studio (version 2023.3) [72ms]
• Android Studio at /snap/android-studio/157
• Flutter plugin version 80.0.1
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
[✓] VS Code (version 1.92.2) [10ms]
• VS Code at /usr/share/code
• Flutter extension version 3.104.0
[✓] Connected device (3 available) [190ms]
• RMX1825 (mobile) • G6PJEMDUCU55YLUK • android-arm64 • Android 10 (API 29)
• Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.4 LTS 5.15.0-102-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.60
[✓] Network resources [511ms]
• All expected network resources are available.
• No issues found!
