fix order history, add CheckUser check before starting the trip, fix dialog for cancel the order, add dialog for finish the order
This commit is contained in:
@@ -378,70 +378,41 @@ class _MapScreenState extends State<MapScreen> {
|
||||
}
|
||||
|
||||
void _onMarkerTap(List<Scooter> scooters) async {
|
||||
final flags = context.read<MapBloc>().state.flags;
|
||||
|
||||
if (!flags.hasCard) {
|
||||
_showExistingNotification(
|
||||
child: PaymentNotificationCard(
|
||||
onBindCard: () {
|
||||
BotToast.cleanAll();
|
||||
context.push("/home/payment-methods");
|
||||
},
|
||||
onClose: () => BotToast.cleanAll(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (flags.hasUnpaidOrder) {
|
||||
_showExistingNotification(
|
||||
child: UnpaidOrderNotificationCard(
|
||||
onClose: () => BotToast.cleanAll(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (flags.hasFine) {
|
||||
_showExistingNotification(
|
||||
child: FineNotificationCard(
|
||||
onClose: () => BotToast.cleanAll(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
context.push(
|
||||
"/home/scooter-sheet",
|
||||
extra: {'scooters': scooters, 'currentLocation': _currentPosition},
|
||||
);
|
||||
|
||||
/*final scoot = await showModalBottomSheet<Scooter>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
isDismissible: true,
|
||||
builder: (context) {
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
ScooterDetailModalBloc(
|
||||
getIt<GetAddressByPointUsecase>(),
|
||||
getIt<GetScooterUsecase>(),
|
||||
getIt<GetPedestrianRoutesUsecase>(),
|
||||
)..add(
|
||||
ScooterDetailModalStarted(
|
||||
scooters,
|
||||
_currentPosition!.latitude,
|
||||
_currentPosition!.longitude,
|
||||
),
|
||||
),
|
||||
child: ScooterBottomSheet(),
|
||||
);
|
||||
},
|
||||
);*/
|
||||
/*bool? isBooking = false;
|
||||
if (scoot != null) {
|
||||
final result = await context.push('/home/scooter/${scoot.id}');
|
||||
|
||||
if (result == true) {
|
||||
// Даем небольшую задержку, чтобы навигация завершилась корректно
|
||||
await Future.delayed(Duration(milliseconds: 300), () async {
|
||||
isBooking = await showModalBottomSheet<bool>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
isDismissible: true,
|
||||
builder: (context) => BlocProvider(
|
||||
create: (context) => TariffSheetBloc(
|
||||
getIt<GetAvailableTariffsUsecase>(),
|
||||
getIt<GetPaymentCardsUsecase>(),
|
||||
getIt<BookScooterUsecase>(),
|
||||
),
|
||||
child: TariffSheet(scooter: scoot),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (isBooking ?? false) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => BlocProvider(
|
||||
create: (context) =>
|
||||
CurrentRidesBloc(getIt<GetClientOrdersUsecase>())
|
||||
..add(LoadClientOrders(1)),
|
||||
child: CurrentRidesSheet(clientId: 1),
|
||||
),
|
||||
);
|
||||
}*/
|
||||
}
|
||||
|
||||
void _onMapSettingsTap() {
|
||||
@@ -717,7 +688,42 @@ class _MapScreenState extends State<MapScreen> {
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: GestureDetector(
|
||||
onTap: () => context.push("/home/qr-info"),
|
||||
onTap: () {
|
||||
final flags = context.read<MapBloc>().state.flags;
|
||||
|
||||
// 🔹 Проверка флагов — показываем те же карточки, что и в listener
|
||||
if (!flags.hasCard) {
|
||||
_showExistingNotification(
|
||||
child: PaymentNotificationCard(
|
||||
onBindCard: () {
|
||||
BotToast.cleanAll();
|
||||
context.push("/home/payment-methods");
|
||||
},
|
||||
onClose: () => BotToast.cleanAll(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (flags.hasUnpaidOrder) {
|
||||
_showExistingNotification(
|
||||
child: UnpaidOrderNotificationCard(
|
||||
onClose: () => BotToast.cleanAll(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (flags.hasFine) {
|
||||
_showExistingNotification(
|
||||
child: FineNotificationCard(
|
||||
onClose: () => BotToast.cleanAll(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// ✅ Все проверки пройдены — переход на сканирование
|
||||
context.push("/home/qr-info");
|
||||
},
|
||||
child: Container(
|
||||
width: 64,
|
||||
height: 64,
|
||||
@@ -866,3 +872,18 @@ class _CircleIconButton extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _showExistingNotification({required Widget child}) {
|
||||
BotToast.showCustomNotification(
|
||||
duration: null, // не исчезает, пока пользователь не закроет
|
||||
toastBuilder: (_) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 120), // тот же отступ, что в listener
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: child, // PaymentNotificationCard / UnpaidOrderNotificationCard / FineNotificationCard
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ class ScooterDetailScreen extends StatelessWidget {
|
||||
context.pushReplacement('/home/tarif-sheet', extra: scooter);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 30)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user