Navigációs képernyőn forráspontok megjelenítése
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9s
This commit is contained in:
@@ -42,9 +42,18 @@ class AnimatedMapFollow extends StatelessWidget {
|
||||
duration: duration,
|
||||
curve: Curves.easeOut,
|
||||
builder: (context, animatedPos, _) {
|
||||
try {
|
||||
mapController.move(animatedPos, mapController.camera.zoom);
|
||||
} catch (_) {}
|
||||
// NE hívjuk a .move()-ot közvetlenül itt — ez a builder BUILD
|
||||
// közben fut, a mapController.move() pedig a flutter_map
|
||||
// belső gesztus-kezelő widgetjén (MapInteractiveViewer) vált
|
||||
// ki setState()-et, ami "setState() called during build"
|
||||
// hibát ad. A jelenlegi képkocka VÉGÉRE halasztjuk, ahol ez
|
||||
// már biztonságos — ugyanaz az elv, mint az
|
||||
// onPositionChanged-nél.
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
try {
|
||||
mapController.move(animatedPos, mapController.camera.zoom);
|
||||
} catch (_) {}
|
||||
});
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
@@ -55,9 +64,11 @@ class AnimatedMapFollow extends StatelessWidget {
|
||||
duration: duration,
|
||||
curve: Curves.easeOut,
|
||||
builder: (context, animatedRotation, _) {
|
||||
try {
|
||||
mapController.rotate(animatedRotation);
|
||||
} catch (_) {}
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
try {
|
||||
mapController.rotate(animatedRotation);
|
||||
} catch (_) {}
|
||||
});
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user