Correção no botão de iniciar corrida

This commit is contained in:
2026-03-17 19:33:25 +00:00
parent f1709d77de
commit 7f80ed47f3

View File

@@ -45,7 +45,6 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
} }
Future<void> _setupIconsAndTracking() async { Future<void> _setupIconsAndTracking() async {
// Icons reduced by ~70% as requested
_arrowIcon = await _createArrowMarker(Colors.black, Colors.white, 25); _arrowIcon = await _createArrowMarker(Colors.black, Colors.white, 25);
await _initTracking(); await _initTracking();
} }
@@ -105,7 +104,7 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
locationSettings: const LocationSettings(accuracy: LocationAccuracy.bestForNavigation, distanceFilter: 1) locationSettings: const LocationSettings(accuracy: LocationAccuracy.bestForNavigation, distanceFilter: 1)
).listen((Position position) { ).listen((Position position) {
final now = DateTime.now(); final now = DateTime.now();
if (_lastUpdate == null || now.difference(_lastUpdate!).inMilliseconds > 1000) { if (_lastUpdate == null || now.difference(_lastUpdate!).inMilliseconds > 2000) {
_lastUpdate = now; _lastUpdate = now;
_updatePosition(LatLng(position.latitude, position.longitude), position.speed); _updatePosition(LatLng(position.latitude, position.longitude), position.speed);
} }
@@ -149,7 +148,6 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
void _updateTraveledPolylines() { void _updateTraveledPolylines() {
if (_routePoints.length > 1) { if (_routePoints.length > 1) {
_polylines.clear(); _polylines.clear();
// Glow effect for the trail
_polylines.add(Polyline( _polylines.add(Polyline(
polylineId: const PolylineId('route_glow'), polylineId: const PolylineId('route_glow'),
points: List.from(_routePoints), points: List.from(_routePoints),
@@ -157,7 +155,6 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
width: 12, width: 12,
zIndex: 9 zIndex: 9
)); ));
// Main trail line
_polylines.add(Polyline( _polylines.add(Polyline(
polylineId: const PolylineId('route'), polylineId: const PolylineId('route'),
points: List.from(_routePoints), points: List.from(_routePoints),
@@ -284,8 +281,6 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
const SizedBox(height: 20), const SizedBox(height: 20),
const Text(AppStrings.runFinished, style: TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.w900, letterSpacing: 1)), const Text(AppStrings.runFinished, style: TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.w900, letterSpacing: 1)),
const SizedBox(height: 30), const SizedBox(height: 30),
// Mini Map Container
Container( Container(
height: 180, height: 180,
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -318,13 +313,11 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
), ),
), ),
const SizedBox(height: 25), const SizedBox(height: 25),
_buildResultRow(AppStrings.totalDistance, _formatDistance(finalDistance)), _buildResultRow(AppStrings.totalDistance, _formatDistance(finalDistance)),
const Divider(color: Colors.white10, height: 25), const Divider(color: Colors.white10, height: 25),
_buildResultRow(AppStrings.totalTime, _formatTime(finalTime)), _buildResultRow(AppStrings.totalTime, _formatTime(finalTime)),
const Divider(color: Colors.white10, height: 25), const Divider(color: Colors.white10, height: 25),
_buildResultRow("VELOCIDADE MÁX", "${finalMaxSpeed.toStringAsFixed(1)} ${AppStrings.kmhUnit}"), _buildResultRow("VELOCIDADE MÁX", "${finalMaxSpeed.toStringAsFixed(1)} ${AppStrings.kmhUnit}"),
const SizedBox(height: 35), const SizedBox(height: 35),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
@@ -406,7 +399,6 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: Stack( body: Stack(
children: [ children: [
// Background Map Container
Center( Center(
child: Container( child: Container(
width: MediaQuery.of(context).size.width * 0.94, width: MediaQuery.of(context).size.width * 0.94,
@@ -430,13 +422,11 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
myLocationButtonEnabled: false, myLocationButtonEnabled: false,
compassEnabled: false, compassEnabled: false,
mapToolbarEnabled: false, mapToolbarEnabled: false,
style: null, // You can add custom styling here
) )
) )
), ),
), ),
// Stats Overlay
Positioned( Positioned(
top: 115, left: 25, right: 25, top: 115, left: 25, right: 25,
child: Container( child: Container(
@@ -460,7 +450,6 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
), ),
), ),
// Countdown Overlay
if (_isCountingDown) if (_isCountingDown)
Container( Container(
color: Colors.black87, color: Colors.black87,
@@ -479,7 +468,7 @@ class _GoogleMapScreenState extends State<GoogleMapScreen> {
), ),
], ],
), ),
floatingActionButton: Padding( floatingActionButton: _isCountingDown ? null : Padding(
padding: const EdgeInsets.only(bottom: 20.0), padding: const EdgeInsets.only(bottom: 20.0),
child: FloatingActionButton.extended( child: FloatingActionButton.extended(
onPressed: _isRunning ? _finishRun : _showStartConfirmation, onPressed: _isRunning ? _finishRun : _showStartConfirmation,