fix functional bugs

This commit is contained in:
2026-05-29 11:40:55 +03:00
parent 591265a7fc
commit 134ffdde60
50 changed files with 1086 additions and 771 deletions

View File

@@ -1,13 +1,16 @@
import 'dart:async';
import 'dart:ui';
import 'package:be_happy/domain/entities/scooter.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import '../../../di/service_locator.dart';
import '../../event/active_ride_event.dart';
import '../../event/map_event.dart';
import '../../state/active_ride_state.dart';
import '../../viewmodel/active_ride_bloc.dart';
import '../../viewmodel/map_bloc.dart';
import '../dialog/finish_ride_confirmation_dialog.dart';
import '../notification_toast.dart';
@@ -56,7 +59,7 @@ class _ActiveRideSheetState extends State<ActiveRideSheet> {
return BlocProvider.value(
value: _bloc,
child: BlocConsumer<ActiveRideBloc, ActiveRideState>(
listenWhen: (previous, current) => previous.inZone != current.inZone,
listenWhen: (previous, current) => previous.inZone != current.inZone || previous.status != current.status,
listener: (context, state) {
if (!state.inZone) {
BotToast.showCustomNotification(
@@ -71,6 +74,15 @@ class _ActiveRideSheetState extends State<ActiveRideSheet> {
},
);
}
if (state.status == ActiveRideStatus.success && state.order != null) {
final scooter = state.order!.scooter;
context.read<MapBloc>().add(FocusOnScooter(Scooter(id: scooter.id,
title: scooter.title, status: scooter.status,
latitude: state.longitude, longitude: state.latitude,
batteryLevel: scooter.batteryLevel, isOnline: scooter.isOnline,
maxSpeed: scooter.maxSpeed, number: scooter.number)));
}
},
builder: (context, state) {
// Логика отображения загрузки и ошибок остается прежней
@@ -203,8 +215,8 @@ class _ActiveRideSheetState extends State<ActiveRideSheet> {
color: Colors.white,
fontSize: 32,
fontWeight: FontWeight.bold,
fontFeatures: [FontFeature.tabularFigures()],
fontFamily: 'Digital Numbers',
fontFeatures: const [FontFeature.tabularFigures()],
fontFamily: 'DigitalNumbers',
),
),
const SizedBox(height: 4),
@@ -306,10 +318,27 @@ class _ActiveRideSheetState extends State<ActiveRideSheet> {
}
// 🔹 Если отменил — ничего не делаем, диалог уже закрылся
},
borderRadius: BorderRadius.circular(16),
child: Column( // ✅ Вернули Column с иконкой и текстом
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.stop,
color: Colors.white,
size: 24,
),
const SizedBox(height: 4),
const Text(
'ЗАВЕРШИТЬ',
style: TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
),
),
),
),
),