Unact / yandex_mapkit

Flutter implementation of YandexMapkit
MIT License
133 stars 149 forks source link

YandexMap widget not displaying correctly on repeated screen opens in Flutter #383

Open nurullohabduvohidov opened 1 month ago

nurullohabduvohidov commented 1 month ago

I'm encountering an issue with the YandexMap widget in Flutter. When navigating back and forth between screens, the map widget sometimes fails to load correctly or appears blank. This problem persists across Android.

This is my code.

https://github.com/user-attachments/assets/b1c2a421-1436-40ef-b037-514f79d0d58d

import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:sott/core/app_text_style.dart'; import 'package:yandex_mapkit/yandex_mapkit.dart';

class YandexExample extends StatefulWidget { const YandexExample({super.key});

@override State createState() => _YandexExampleState(); }

class _YandexExampleState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("Yandex Example"), ), body: ListView.builder( itemCount: 50, itemBuilder: (context, index) { return InkWell( onTap: () { Navigator.of(context).push( MaterialPageRoute(builder: (context) => const YandexMapPage(),) ); }, child: Container( height: 48.h, color: Colors.red, alignment: Alignment.center, margin: EdgeInsets.only(bottom: 20.h), child: Text("Go to map $index", style: AppTextStyle.medium16,), ), ); }, ), ); } }

class YandexMapPage extends StatelessWidget { const YandexMapPage({super.key});

@override Widget build(BuildContext context) { return Scaffold( body: SizedBox( height: 192.h, child: const YandexMap(), ), ); } }