Open
Description
Using the latest master (b29092e) results in the map showing in front of any navigation. For example, showing an input form when the map is open, will briefly show the form (flashed on the screen), then what appears to be a new map instance shown in front of it.
Reproducible on Android 9. Based on by testing, everything works as expected iOS 15 and Android 12.
Workaround is to set useHybridComposition
to false
.
@yoavrofe, I'm tagging you because you submitted the useHybridComposition
change and thought you might be able to offer some insight.
Example app:
mapbox_gl:
git: https://github.com/flutter-mapbox-gl/maps.git
import 'package:flutter/material.dart';
import 'package:mapbox_gl/mapbox_gl.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Mapbox Bug',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
MapboxMap.useHybridComposition = true;
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
MapboxMap(
accessToken: "access_token",
initialCameraPosition: const CameraPosition(target: LatLng(0, 0)),
),
Center(
child: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const Scaffold(
body: Center(child: Text("New Page")),
),
),
);
},
),
),
],
),
);
}
}