sync changes
This commit is contained in:
@@ -53,9 +53,11 @@ android {
|
|||||||
versionName = flutter.versionName
|
versionName = flutter.versionName
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation ("com.yandex.android:maps.mobile:4.5.1-full")
|
}
|
||||||
}
|
|
||||||
|
dependencies {
|
||||||
|
implementation ("com.yandex.android:maps.mobile:4.22.0-full")
|
||||||
}
|
}
|
||||||
|
|
||||||
flutter {
|
flutter {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.yandex.mapkit.MapKitFactory
|
|||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
||||||
class MainActivity : FlutterActivity() {
|
class MainActivity : FlutterActivity() {
|
||||||
|
|
||||||
override protected fun onCreate(savedInstanceState: Bundle?) {
|
override protected fun onCreate(savedInstanceState: Bundle?) {
|
||||||
MapKitFactory.setApiKey("a0ef1404-2650-4f28-9891-c965ecc09174")
|
MapKitFactory.setApiKey("a0ef1404-2650-4f28-9891-c965ecc09174")
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
yandexMapkit.variant=full
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ pluginManagement {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||||
id("com.android.application") version "8.7.3" apply false
|
id("com.android.application") version "8.9.1" apply false
|
||||||
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
lib/data/interceptor/auth_interceptor.dart
Normal file
26
lib/data/interceptor/auth_interceptor.dart
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:be_happy/presentation/viewmodel/splash_bloc.dart';
|
||||||
|
import 'package:be_happy/presentation/event/spalsh_event.dart';
|
||||||
|
|
||||||
|
import '../../di/service_locator.dart';
|
||||||
|
|
||||||
|
class AuthInterceptor extends Interceptor {
|
||||||
|
|
||||||
|
AuthInterceptor();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onError(DioException err, ErrorInterceptorHandler handler) {
|
||||||
|
final String path = err.requestOptions.path;
|
||||||
|
|
||||||
|
if (err.response?.statusCode == 401) {
|
||||||
|
if (!path.contains('/auth/client/refresh') && !path.contains('/auth/client/login')) {
|
||||||
|
print('Interceptor: 401 на обычном запросе. Пытаемся обновить токен...');
|
||||||
|
getIt<SplashBloc>().add(AuthCheckRequested());
|
||||||
|
} else {
|
||||||
|
print('Interceptor: 401 на запросе авторизации. Пробрасываем ошибку дальше.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onError(err, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -667,8 +667,22 @@ class ApiService {
|
|||||||
|
|
||||||
return ScooterOrder.fromJson(response.data);
|
return ScooterOrder.fromJson(response.data);
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
|
if (e.response?.statusCode == 400) {
|
||||||
|
final data = e.response?.data;
|
||||||
|
|
||||||
|
if (data is Map && data['message'] is List) {
|
||||||
|
final firstError = data['message'][0]['message'].toString();
|
||||||
|
|
||||||
|
if (firstError.contains("Wrong start zone")) {
|
||||||
|
throw WrongZoneException(message: "Некорректная зона для начала поездки.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data is Map && data['message'] is String) {}
|
||||||
|
} else {
|
||||||
_handleDioError(e);
|
_handleDioError(e);
|
||||||
return null;
|
}
|
||||||
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -684,8 +698,22 @@ class ApiService {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
|
if (e.response?.statusCode == 400) {
|
||||||
|
final data = e.response?.data;
|
||||||
|
|
||||||
|
if (data is Map && data['message'] is List) {
|
||||||
|
final firstError = data['message'][0]['message'].toString();
|
||||||
|
|
||||||
|
if (firstError.contains("Wrong start zone")) {
|
||||||
|
throw WrongZoneException(message: "Некорректная зона для начала поездки.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data is Map && data['message'] is String) {}
|
||||||
|
} else {
|
||||||
_handleDioError(e);
|
_handleDioError(e);
|
||||||
return null;
|
}
|
||||||
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -762,8 +790,8 @@ class ApiService {
|
|||||||
if (data is Map && data['message'] is List) {
|
if (data is Map && data['message'] is List) {
|
||||||
final firstError = data['message'][0]['message'].toString();
|
final firstError = data['message'][0]['message'].toString();
|
||||||
|
|
||||||
if (firstError.contains("Wrong zone")) {
|
if (firstError.contains("Wrong start zone")) {
|
||||||
throw WrongZoneException(message: firstError);
|
throw WrongZoneException(message: "Некорректная зона для завершения поездки.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,32 +55,47 @@ class GeocodingRemoteDataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<MasstransitRoute>?> getPedestrianRoutes(Point userPosition,
|
Future<List<MasstransitRoute>?> getPedestrianRoutes(
|
||||||
Point targetPosition) async {
|
Point userPosition,
|
||||||
|
Point targetPosition,
|
||||||
|
) async {
|
||||||
|
try {
|
||||||
|
|
||||||
|
print("From: ${userPosition.latitude}, ${userPosition.longitude}");
|
||||||
|
print("To: ${targetPosition.latitude}, ${targetPosition.longitude}");
|
||||||
|
|
||||||
final (session, resultFuture) = await YandexPedestrian.requestRoutes(
|
final (session, resultFuture) = await YandexPedestrian.requestRoutes(
|
||||||
points: [
|
points: [
|
||||||
RequestPoint(
|
RequestPoint(point: userPosition, requestPointType: RequestPointType.wayPoint),
|
||||||
point: userPosition, requestPointType: RequestPointType.wayPoint),
|
RequestPoint(point: targetPosition, requestPointType: RequestPointType.wayPoint)
|
||||||
RequestPoint(point: targetPosition,
|
|
||||||
requestPointType: RequestPointType.wayPoint)
|
|
||||||
],
|
],
|
||||||
fitnessOptions: FitnessOptions(avoidSteep: false, avoidStairs: false),
|
fitnessOptions: const FitnessOptions(avoidSteep: false, avoidStairs: false),
|
||||||
timeOptions: TimeOptions()
|
timeOptions: const TimeOptions()
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
|
||||||
final result = await resultFuture;
|
final result = await resultFuture;
|
||||||
|
|
||||||
final distance = result.routes?.first.metadata.weight.walkingDistance.value;
|
if (result.routes == null || result.routes!.isEmpty) {
|
||||||
|
print("Маршруты не найдены: список пуст или null");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
print("Дистанция до самоката: $distance");
|
final route = result.routes!.first;
|
||||||
|
|
||||||
|
final distance = route.metadata.weight.walkingDistance?.value;
|
||||||
|
|
||||||
|
if (distance != null) {
|
||||||
|
print("Дистанция до самоката: $distance м");
|
||||||
|
} else {
|
||||||
|
print("Дистанция не найдена в метаданных маршрута");
|
||||||
|
}
|
||||||
|
|
||||||
return result.routes;
|
return result.routes;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e, stack) {
|
||||||
print('Error: $e');
|
print('Pedestrian route error: $e');
|
||||||
}
|
print('Stack trace: $stack');
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,6 +164,8 @@ class ScooterRepositoryImpl extends ScooterRepository {
|
|||||||
}
|
}
|
||||||
} on AuthException catch (e) {
|
} on AuthException catch (e) {
|
||||||
result = Failure(AuthFailure(e.attemptsLeft));
|
result = Failure(AuthFailure(e.attemptsLeft));
|
||||||
|
} on WrongZoneException catch (e) {
|
||||||
|
result = Failure(WrongZoneFailure(e.message));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
result = Failure(UnknownFailure("Неизвестная ошибка"));
|
result = Failure(UnknownFailure("Неизвестная ошибка"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ import 'package:get_it/get_it.dart';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import '../data/interceptor/auth_interceptor.dart';
|
||||||
import '../data/network/api_service.dart';
|
import '../data/network/api_service.dart';
|
||||||
import '../data/network/geocoding_remote_datasource.dart';
|
import '../data/network/geocoding_remote_datasource.dart';
|
||||||
import '../data/repositories/auth_repository_impl.dart';
|
import '../data/repositories/auth_repository_impl.dart';
|
||||||
@@ -110,6 +111,7 @@ Future<void> setupDependencies() async {
|
|||||||
final sharedPreferences = await SharedPreferences.getInstance();
|
final sharedPreferences = await SharedPreferences.getInstance();
|
||||||
final dio = Dio();
|
final dio = Dio();
|
||||||
dio.interceptors.add(LogInterceptor(responseBody: true, requestBody: true));
|
dio.interceptors.add(LogInterceptor(responseBody: true, requestBody: true));
|
||||||
|
dio.interceptors.add(AuthInterceptor());
|
||||||
// HTTP
|
// HTTP
|
||||||
getIt.registerSingleton<http.Client>(http.Client());
|
getIt.registerSingleton<http.Client>(http.Client());
|
||||||
//SecureStorage
|
//SecureStorage
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class _ActiveRideSheetState extends State<ActiveRideSheet> {
|
|||||||
_bloc = getIt<ActiveRideBloc>();
|
_bloc = getIt<ActiveRideBloc>();
|
||||||
_bloc.add(LoadScooterOrder(widget.orderId));
|
_bloc.add(LoadScooterOrder(widget.orderId));
|
||||||
|
|
||||||
// Локальный таймер для обновления UI каждую секунду
|
|
||||||
_localTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
_localTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
if (mounted && !_bloc.state.isPaused) {
|
if (mounted && !_bloc.state.isPaused) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@@ -60,7 +59,6 @@ class _ActiveRideSheetState extends State<ActiveRideSheet> {
|
|||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (!state.inZone) {
|
if (!state.inZone) {
|
||||||
BotToast.showCustomNotification(
|
BotToast.showCustomNotification(
|
||||||
// duration: const Duration(seconds: 4),
|
|
||||||
|
|
||||||
toastBuilder: (_) {
|
toastBuilder: (_) {
|
||||||
return NotificationToast(
|
return NotificationToast(
|
||||||
@@ -125,7 +123,6 @@ class _ActiveRideSheetState extends State<ActiveRideSheet> {
|
|||||||
? state.elapsedTime
|
? state.elapsedTime
|
||||||
: state.elapsedTime + (DateTime.now().difference(DateTime.now().subtract(const Duration(seconds: 1))));
|
: state.elapsedTime + (DateTime.now().difference(DateTime.now().subtract(const Duration(seconds: 1))));
|
||||||
|
|
||||||
// Для отображения текущего времени в реальном времени
|
|
||||||
final effectiveElapsedTime = state.isPaused
|
final effectiveElapsedTime = state.isPaused
|
||||||
? state.elapsedTime
|
? state.elapsedTime
|
||||||
: DateTime.now().difference(state.order?.startAt ?? state.order?.createdAt ?? DateTime.now());
|
: DateTime.now().difference(state.order?.startAt ?? state.order?.createdAt ?? DateTime.now());
|
||||||
@@ -189,7 +186,6 @@ class _ActiveRideSheetState extends State<ActiveRideSheet> {
|
|||||||
|
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
// 🔹 ТАЙМЕР
|
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 20),
|
margin: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
|||||||
@@ -5,15 +5,23 @@ import 'package:flutter/cupertino.dart';
|
|||||||
|
|
||||||
class TariffInfoSheet extends StatefulWidget {
|
class TariffInfoSheet extends StatefulWidget {
|
||||||
final Tariff tariff;
|
final Tariff tariff;
|
||||||
|
final bool isInsurance;
|
||||||
|
final Function(bool) onChanged;
|
||||||
|
|
||||||
const TariffInfoSheet({super.key, required this.tariff});
|
const TariffInfoSheet({super.key, required this.tariff, required this.isInsurance, required this.onChanged});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TariffInfoSheet> createState() => _TariffInfoSheetState();
|
State<TariffInfoSheet> createState() => _TariffInfoSheetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TariffInfoSheetState extends State<TariffInfoSheet> {
|
class _TariffInfoSheetState extends State<TariffInfoSheet> {
|
||||||
bool _isInsuranceEnabled = true;
|
late bool _isInsuranceEnabled;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_isInsuranceEnabled = widget.isInsurance;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -80,7 +88,6 @@ class _TariffInfoSheetState extends State<TariffInfoSheet> {
|
|||||||
|
|
||||||
const Divider(color: Colors.white24, height: 40),
|
const Divider(color: Colors.white24, height: 40),
|
||||||
|
|
||||||
// Страховка
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const Text(
|
const Text(
|
||||||
@@ -100,7 +107,10 @@ class _TariffInfoSheetState extends State<TariffInfoSheet> {
|
|||||||
child: CupertinoSwitch(
|
child: CupertinoSwitch(
|
||||||
value: _isInsuranceEnabled,
|
value: _isInsuranceEnabled,
|
||||||
activeColor: const Color(0xFF66E3C4),
|
activeColor: const Color(0xFF66E3C4),
|
||||||
onChanged: (val) => setState(() => _isInsuranceEnabled = val),
|
onChanged: (val) {
|
||||||
|
setState(() => _isInsuranceEnabled = val);
|
||||||
|
widget.onChanged(val);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -108,7 +118,6 @@ class _TariffInfoSheetState extends State<TariffInfoSheet> {
|
|||||||
|
|
||||||
const Divider(color: Colors.white24, height: 40),
|
const Divider(color: Colors.white24, height: 40),
|
||||||
|
|
||||||
// Список правил (Bullet points)
|
|
||||||
_buildInfoBullet('Оплата страховки осуществляется только по банковской карте отдельным платежом'),
|
_buildInfoBullet('Оплата страховки осуществляется только по банковской карте отдельным платежом'),
|
||||||
_buildInfoBullet('В режиме паузы время тарифа приостанавливается'),
|
_buildInfoBullet('В режиме паузы время тарифа приостанавливается'),
|
||||||
_buildInfoBullet('При старте заказа будет заблокирована сумма в размере 7 рублей для проверки платежеспособности. Сумма разблокируется по факту списания средств за поездку.'),
|
_buildInfoBullet('При старте заказа будет заблокирована сумма в размере 7 рублей для проверки платежеспособности. Сумма разблокируется по факту списания средств за поездку.'),
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ class TariffSheet extends StatefulWidget {
|
|||||||
|
|
||||||
class _TariffSheetState extends State<TariffSheet> {
|
class _TariffSheetState extends State<TariffSheet> {
|
||||||
int? _selectedTariffIndex;
|
int? _selectedTariffIndex;
|
||||||
bool _hasPaymentCard = true;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -40,7 +39,27 @@ class _TariffSheetState extends State<TariffSheet> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<TariffSheetBloc, TariffSheetState>(
|
return BlocConsumer<TariffSheetBloc, TariffSheetState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state.status == TariffSheetStatus.failure && state.errorMessage != null) {
|
||||||
|
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
state.errorMessage!,
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.redAccent.withOpacity(0.9),
|
||||||
|
behavior: SnackBarBehavior.floating,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
margin: const EdgeInsets.all(20),
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state.status == TariffSheetStatus.loading) {
|
if (state.status == TariffSheetStatus.loading) {
|
||||||
return Align(
|
return Align(
|
||||||
@@ -193,7 +212,7 @@ class _TariffSheetState extends State<TariffSheet> {
|
|||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'${widget.scooter.batteryLevel.toInt()}%', // ✅ Цифры
|
'${widget.scooter.batteryLevel.toInt()}%',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
@@ -245,6 +264,7 @@ class _TariffSheetState extends State<TariffSheet> {
|
|||||||
'Минута на паузе ${tariff.pausePrice.toStringAsFixed(0)} ${tariff.currency}',
|
'Минута на паузе ${tariff.pausePrice.toStringAsFixed(0)} ${tariff.currency}',
|
||||||
],
|
],
|
||||||
isSelected: _selectedTariffIndex == index,
|
isSelected: _selectedTariffIndex == index,
|
||||||
|
isInsurance: state.isInsurance,
|
||||||
tariff: tariff,
|
tariff: tariff,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -380,7 +400,7 @@ class _TariffSheetState extends State<TariffSheet> {
|
|||||||
0,
|
0,
|
||||||
state.useBalance ? null : state.selectedCard?.id,
|
state.useBalance ? null : state.selectedCard?.id,
|
||||||
state.useBalance,
|
state.useBalance,
|
||||||
false
|
state.isInsurance
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
context.pushReplacement('/home/current-rides-sheet');
|
context.pushReplacement('/home/current-rides-sheet');
|
||||||
@@ -421,6 +441,7 @@ class _TariffCard extends StatelessWidget {
|
|||||||
final String currency;
|
final String currency;
|
||||||
final String subtitle;
|
final String subtitle;
|
||||||
final List<String> details;
|
final List<String> details;
|
||||||
|
final bool isInsurance;
|
||||||
final bool isSelected;
|
final bool isSelected;
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
|
|
||||||
@@ -432,6 +453,7 @@ class _TariffCard extends StatelessWidget {
|
|||||||
required this.subtitle,
|
required this.subtitle,
|
||||||
required this.details,
|
required this.details,
|
||||||
required this.isSelected,
|
required this.isSelected,
|
||||||
|
required this.isInsurance,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -448,14 +470,11 @@ class _TariffCard extends StatelessWidget {
|
|||||||
: Colors.white.withOpacity(0.19),
|
: Colors.white.withOpacity(0.19),
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
// Используем Stack, чтобы наложить кнопку поверх контента
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
// Основной контент карточки
|
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// Заголовок с иконкой часов
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(
|
const Icon(
|
||||||
@@ -531,8 +550,16 @@ class _TariffCard extends StatelessWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
builder: (context) => TariffInfoSheet(tariff: tariff),
|
builder: (context) => TariffInfoSheet(
|
||||||
|
tariff: tariff,
|
||||||
|
isInsurance: isInsurance,
|
||||||
|
onChanged: (val) {
|
||||||
|
context.read<TariffSheetBloc>().add(InsuranceToggled(val));
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print('Info pressed for $title');
|
print('Info pressed for $title');
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ class PaymentCardChanged extends TariffSheetEvent {
|
|||||||
PaymentCardChanged(this.card);
|
PaymentCardChanged(this.card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class InsuranceToggled extends TariffSheetEvent {
|
||||||
|
final bool isEnabled;
|
||||||
|
InsuranceToggled(this.isEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
class SelectBalancePressed extends TariffSheetEvent {}
|
class SelectBalancePressed extends TariffSheetEvent {}
|
||||||
|
|
||||||
class BookScooterPressed extends TariffSheetEvent {
|
class BookScooterPressed extends TariffSheetEvent {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:be_happy/presentation/viewmodel/payment_methods_bloc.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
@@ -6,6 +7,7 @@ import '../../core/app_colors.dart';
|
|||||||
import '../components/custom_app_bar.dart';
|
import '../components/custom_app_bar.dart';
|
||||||
import '../components/card_input_field.dart'; // ← новый импорт
|
import '../components/card_input_field.dart'; // ← новый импорт
|
||||||
import '../components/utils/card_formatter.dart';
|
import '../components/utils/card_formatter.dart';
|
||||||
|
import '../event/payment_methods_event.dart';
|
||||||
import '../viewmodel/add_card_bloc.dart';
|
import '../viewmodel/add_card_bloc.dart';
|
||||||
import '../event/add_card_event.dart';
|
import '../event/add_card_event.dart';
|
||||||
import '../state/add_card_state.dart';
|
import '../state/add_card_state.dart';
|
||||||
@@ -28,7 +30,6 @@ class AddCardScreen extends StatelessWidget {
|
|||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// 🔹 ВЕРХНЯЯ ЧАСТЬ (шапка + форма)
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
@@ -37,7 +38,6 @@ class AddCardScreen extends StatelessWidget {
|
|||||||
const CustomAppBar(title: 'Добавление карты'),
|
const CustomAppBar(title: 'Добавление карты'),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
// 🔹 ОСНОВНОЙ КОНТЕЙНЕР С ПОЛЯМИ
|
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -46,7 +46,6 @@ class AddCardScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Номер карты
|
|
||||||
BlocBuilder<AddCardBloc, AddCardState>(
|
BlocBuilder<AddCardBloc, AddCardState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return CardInputField(
|
return CardInputField(
|
||||||
@@ -60,7 +59,6 @@ class AddCardScreen extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
letterSpacing: 2,
|
letterSpacing: 2,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
// Очищаем от пробелов перед отправкой в BLoC
|
|
||||||
final cleanValue = value.replaceAll(' ', '');
|
final cleanValue = value.replaceAll(' ', '');
|
||||||
context.read<AddCardBloc>().add(CardNumberChanged(cleanValue));
|
context.read<AddCardBloc>().add(CardNumberChanged(cleanValue));
|
||||||
},
|
},
|
||||||
@@ -137,7 +135,6 @@ class AddCardScreen extends StatelessWidget {
|
|||||||
|
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
// 🔹 КНОПКА "ДОБАВИТЬ КАРТУ"
|
|
||||||
BlocBuilder<AddCardBloc, AddCardState>(
|
BlocBuilder<AddCardBloc, AddCardState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Container(
|
return Container(
|
||||||
@@ -153,7 +150,8 @@ class AddCardScreen extends StatelessWidget {
|
|||||||
? () => {
|
? () => {
|
||||||
context.read<AddCardBloc>().add(
|
context.read<AddCardBloc>().add(
|
||||||
AddCardSubmitted()),
|
AddCardSubmitted()),
|
||||||
context.go("/home/payment-methods")
|
context.read<PaymentMethodsBloc>()..add(PaymentMethodsStarted()),
|
||||||
|
context.pop()
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
@@ -205,7 +203,6 @@ class AddCardScreen extends StatelessWidget {
|
|||||||
horizontal: 20, vertical: 24),
|
horizontal: 20, vertical: 24),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Текст о безопасности
|
|
||||||
const Text(
|
const Text(
|
||||||
'Мы не сохраняем данные карты у себя. Оплата происходит '
|
'Мы не сохраняем данные карты у себя. Оплата происходит '
|
||||||
'через сертифицированный провайдер Беларуси bePaid. '
|
'через сертифицированный провайдер Беларуси bePaid. '
|
||||||
@@ -221,10 +218,6 @@ class AddCardScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
// Логотипы платёжных систем
|
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ class OrderHistoryDetailScreen extends StatelessWidget {
|
|||||||
padding: EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white.withOpacity(0.3),
|
color: Colors.white.withOpacity(0.3),
|
||||||
borderRadius: BorderRadius.circular(12), // Опционально: скругление углов
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
order.status == 'Paid' ? 'ОПЛАЧЕН' : 'НЕ ОПЛАЧЕН',
|
order.status == 'Paid' ? 'ОПЛАЧЕН' : 'НЕ ОПЛАЧЕН',
|
||||||
@@ -262,7 +262,7 @@ class OrderHistoryDetailScreen extends StatelessWidget {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
_DetailRow(
|
_DetailRow(
|
||||||
label: 'Страховка',
|
label: 'Страховка',
|
||||||
value: order.isInsurance ? '1 руб' : '—',
|
value: order.isInsurance ? "${order.insurancePrice} руб." : '—',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import '../../core/app_colors.dart';
|
import '../../core/app_colors.dart';
|
||||||
import '../components/code_dots.dart';
|
import '../components/code_dots.dart';
|
||||||
|
import '../event/map_event.dart';
|
||||||
import '../event/spalsh_event.dart';
|
import '../event/spalsh_event.dart';
|
||||||
|
import '../viewmodel/map_bloc.dart';
|
||||||
import '../viewmodel/pin_bloc.dart';
|
import '../viewmodel/pin_bloc.dart';
|
||||||
import '../event/pin_event.dart';
|
import '../event/pin_event.dart';
|
||||||
import '../state/pin_state.dart';
|
import '../state/pin_state.dart';
|
||||||
@@ -143,6 +145,24 @@ class _PinLoginScreenState extends State<PinLoginScreen> {
|
|||||||
style: const TextStyle(color: AppColors.white70),
|
style: const TextStyle(color: AppColors.white70),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
|
if (state is! PinCreateInProgress)
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.read<MapBloc>().add(LogoutPressed());
|
||||||
|
context.read<SplashBloc>().add(AuthCheckRequested());
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
"Забыли PIN-код?",
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.whiteText,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(height: 40),
|
const SizedBox(height: 40),
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
|
import '../../core/app_colors.dart';
|
||||||
import '../../di/service_locator.dart';
|
import '../../di/service_locator.dart';
|
||||||
import '../../domain/entities/payment_card.dart';
|
import '../../domain/entities/payment_card.dart';
|
||||||
import '../../domain/usecase/get_payment_cards_usecase.dart';
|
import '../../domain/usecase/get_payment_cards_usecase.dart';
|
||||||
|
import '../components/app_checkbox.dart';
|
||||||
import '../components/custom_app_bar.dart'; // ✅ Уже есть
|
import '../components/custom_app_bar.dart'; // ✅ Уже есть
|
||||||
import '../components/gradient_button.dart';
|
import '../components/gradient_button.dart';
|
||||||
import '../components/payment_option.dart';
|
import '../components/payment_option.dart';
|
||||||
@@ -51,7 +53,6 @@ class TopUpScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
_buildCardSelector(state, context),
|
_buildCardSelector(state, context),
|
||||||
_buildAddCardButton(() => context.push("/home/payment-methods/add-card")),
|
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
_buildAgreement(state, context),
|
_buildAgreement(state, context),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
@@ -159,7 +160,6 @@ class TopUpScreen extends StatelessWidget {
|
|||||||
subtitle: '****${state.selectedCard!.cardLastNumber}',
|
subtitle: '****${state.selectedCard!.cardLastNumber}',
|
||||||
isSelected: true,
|
isSelected: true,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// Открываем модалку как вложенную, не закрывая текущую
|
|
||||||
final selectedCard = await showModalBottomSheet<PaymentCard>(
|
final selectedCard = await showModalBottomSheet<PaymentCard>(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
@@ -236,18 +236,22 @@ class TopUpScreen extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _buildAgreement(TopUpState state, BuildContext context) {
|
Widget _buildAgreement(TopUpState state, BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Checkbox(
|
AppCheckbox(
|
||||||
value: state.isAgreed,
|
value: state.isAgreed,
|
||||||
onChanged: (v) =>
|
onChanged: (v) =>
|
||||||
context.read<TopUpBloc>().add(ToggleAgreement(v ?? false)),
|
context.read<TopUpBloc>().add(ToggleAgreement(v ?? false)),
|
||||||
side: const BorderSide(color: Colors.white54),
|
|
||||||
),
|
),
|
||||||
const Expanded(
|
const SizedBox(width: 12),
|
||||||
child: Text(
|
Flexible(
|
||||||
'Я принимаю условия покупки бонусного пакета, при котором денежные средства не подлежат возврату...',
|
child: Text.rich(
|
||||||
style: TextStyle(color: Colors.white54, fontSize: 12),
|
TextSpan(
|
||||||
|
text: 'Я принимаю условия покупки бонусного пакета, при котором денежные средства не подлежат возврату... ',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: AppColors.white70,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -266,23 +270,4 @@ class TopUpScreen extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAddCardButton(VoidCallback onPressed) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 10),
|
|
||||||
child: OutlinedButton.icon(
|
|
||||||
onPressed: onPressed,
|
|
||||||
icon: const Icon(Icons.add, color: Colors.white),
|
|
||||||
label: const Text(
|
|
||||||
'Добавить платежную карту',
|
|
||||||
style: TextStyle(color: Colors.white),
|
|
||||||
),
|
|
||||||
style: OutlinedButton.styleFrom(
|
|
||||||
side: const BorderSide(color: Colors.white54),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(30),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ class TariffSheetState {
|
|||||||
final List<Tariff> tariffs;
|
final List<Tariff> tariffs;
|
||||||
final String? errorMessage;
|
final String? errorMessage;
|
||||||
final PaymentCard? selectedCard;
|
final PaymentCard? selectedCard;
|
||||||
|
final bool isInsurance;
|
||||||
final int userBalance;
|
final int userBalance;
|
||||||
final bool useBalance ;
|
final bool useBalance ;
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ class TariffSheetState {
|
|||||||
this.status = TariffSheetStatus.initial,
|
this.status = TariffSheetStatus.initial,
|
||||||
this.tariffs = const [],
|
this.tariffs = const [],
|
||||||
this.selectedCard,
|
this.selectedCard,
|
||||||
|
this.isInsurance = false,
|
||||||
this.errorMessage,
|
this.errorMessage,
|
||||||
this.userBalance = 0,
|
this.userBalance = 0,
|
||||||
this.useBalance = false,
|
this.useBalance = false,
|
||||||
@@ -26,6 +28,7 @@ class TariffSheetState {
|
|||||||
List<Tariff>? tariffs,
|
List<Tariff>? tariffs,
|
||||||
PaymentCard? selectedCard,
|
PaymentCard? selectedCard,
|
||||||
String? errorMessage,
|
String? errorMessage,
|
||||||
|
bool? isInsurance,
|
||||||
int? userBalance,
|
int? userBalance,
|
||||||
bool? useBalance,
|
bool? useBalance,
|
||||||
|
|
||||||
@@ -35,6 +38,7 @@ class TariffSheetState {
|
|||||||
selectedCard: selectedCard ?? this.selectedCard,
|
selectedCard: selectedCard ?? this.selectedCard,
|
||||||
useBalance: useBalance ?? this.useBalance,
|
useBalance: useBalance ?? this.useBalance,
|
||||||
userBalance: userBalance ?? this.userBalance,
|
userBalance: userBalance ?? this.userBalance,
|
||||||
|
isInsurance: isInsurance ?? this.isInsurance,
|
||||||
errorMessage: errorMessage ?? this.errorMessage,
|
errorMessage: errorMessage ?? this.errorMessage,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ class ActiveRideBloc extends Bloc<ActiveRideEvent, ActiveRideState> {
|
|||||||
if (orderResult is Success<ScooterOrder>) {
|
if (orderResult is Success<ScooterOrder>) {
|
||||||
final order = orderResult.data;
|
final order = orderResult.data;
|
||||||
|
|
||||||
|
|
||||||
// Пытаемся достать доп. данные, если они Success
|
|
||||||
final orderData = activeOrderData is Success<ActiveScooterOrder>
|
final orderData = activeOrderData is Success<ActiveScooterOrder>
|
||||||
? activeOrderData.data
|
? activeOrderData.data
|
||||||
: null;
|
: null;
|
||||||
@@ -80,7 +78,6 @@ class ActiveRideBloc extends Bloc<ActiveRideEvent, ActiveRideState> {
|
|||||||
inZone: orderData?.zone,
|
inZone: orderData?.zone,
|
||||||
));
|
));
|
||||||
|
|
||||||
//synchronize
|
|
||||||
_syncTimer?.cancel();
|
_syncTimer?.cancel();
|
||||||
_syncTimer = Timer.periodic(const Duration(seconds: 5), (timer) {
|
_syncTimer = Timer.periodic(const Duration(seconds: 5), (timer) {
|
||||||
add(SyncScooterOrder(event.orderId));
|
add(SyncScooterOrder(event.orderId));
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ class CurrentRidesBloc extends Bloc<CurrentRidesEvent, CurrentRidesState> {
|
|||||||
) async {
|
) async {
|
||||||
emit(state.copyWith(status: CurrentRidesStatus.loading));
|
emit(state.copyWith(status: CurrentRidesStatus.loading));
|
||||||
|
|
||||||
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
|
|
||||||
final result = await _getClientOrdersUsecase();
|
final result = await _getClientOrdersUsecase();
|
||||||
|
|
||||||
if (result is Success<List<ScooterOrder>>) {
|
if (result is Success<List<ScooterOrder>>) {
|
||||||
|
|||||||
@@ -55,10 +55,11 @@ class ScooterDetailModalBloc
|
|||||||
|
|
||||||
final routes = await _getPedestrianRoutesUsecase(
|
final routes = await _getPedestrianRoutesUsecase(
|
||||||
Point(latitude: event.userLatitude, longitude: event.userLongitude),
|
Point(latitude: event.userLatitude, longitude: event.userLongitude),
|
||||||
Point(latitude: scooter.latitude, longitude: scooter.longitude),
|
Point(latitude: scooter.longitude, longitude: scooter.latitude),
|
||||||
);
|
);
|
||||||
|
|
||||||
final distance = routes?.firstOrNull?.metadata.weight.walkingDistance.value;
|
final distance = routes?.firstOrNull?.metadata.weight.walkingDistance.value;
|
||||||
|
print("Distance is: $distance");
|
||||||
final time = routes?.firstOrNull?.metadata.weight.time.value;
|
final time = routes?.firstOrNull?.metadata.weight.time.value;
|
||||||
|
|
||||||
if (result is Success<Scooter>) {
|
if (result is Success<Scooter>) {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'package:be_happy/core/failures.dart';
|
||||||
|
import 'package:be_happy/domain/entities/scooter_order.dart';
|
||||||
import 'package:be_happy/domain/usecase/get_profile_usecase.dart';
|
import 'package:be_happy/domain/usecase/get_profile_usecase.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ class TariffSheetBloc extends Bloc<TariffSheetEvent, TariffSheetState> {
|
|||||||
on<PaymentCardChanged>(_onPaymentCardChanged);
|
on<PaymentCardChanged>(_onPaymentCardChanged);
|
||||||
on<BookScooterPressed>(_onBookScooterPressed);
|
on<BookScooterPressed>(_onBookScooterPressed);
|
||||||
on<SelectBalancePressed>(_onSelectBalancePressed);
|
on<SelectBalancePressed>(_onSelectBalancePressed);
|
||||||
|
on<InsuranceToggled>(_onInsuranceToggled);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onStarted(
|
Future<void> _onStarted(
|
||||||
@@ -92,12 +95,12 @@ class TariffSheetBloc extends Bloc<TariffSheetEvent, TariffSheetState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _onBookScooterPressed(
|
FutureOr<void> _onBookScooterPressed (
|
||||||
BookScooterPressed event,
|
BookScooterPressed event,
|
||||||
Emitter<TariffSheetState> emit,
|
Emitter<TariffSheetState> emit,
|
||||||
) {
|
) async {
|
||||||
try {
|
try {
|
||||||
_bookScooterUsecase(
|
final result = await _bookScooterUsecase(
|
||||||
scooterId: event.scooterId,
|
scooterId: event.scooterId,
|
||||||
planId: event.planId,
|
planId: event.planId,
|
||||||
cardId: event.cardId,
|
cardId: event.cardId,
|
||||||
@@ -105,7 +108,23 @@ class TariffSheetBloc extends Bloc<TariffSheetEvent, TariffSheetState> {
|
|||||||
isBalance: event.isBalance,
|
isBalance: event.isBalance,
|
||||||
isInsurance: event.isInsurance,
|
isInsurance: event.isInsurance,
|
||||||
);
|
);
|
||||||
Future.delayed(const Duration(milliseconds: 300));
|
|
||||||
|
switch (result) {
|
||||||
|
|
||||||
|
case Success<ScooterOrder>():
|
||||||
|
// TODO: Handle this case.
|
||||||
|
throw UnimplementedError();
|
||||||
|
case Failure<ScooterOrder>():
|
||||||
|
if (result is WrongZoneFailure) {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
status: TariffSheetStatus.failure,
|
||||||
|
errorMessage: result.failure.message,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
@@ -125,4 +144,8 @@ class TariffSheetBloc extends Bloc<TariffSheetEvent, TariffSheetState> {
|
|||||||
selectedCard: null,
|
selectedCard: null,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FutureOr<void> _onInsuranceToggled(InsuranceToggled event, Emitter<TariffSheetState> emit) async {
|
||||||
|
emit(state.copyWith(isInsurance: event.isEnabled));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
108
pubspec.lock
108
pubspec.lock
@@ -29,10 +29,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
|
sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.13.0"
|
version: "2.13.1"
|
||||||
bloc:
|
bloc:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -125,10 +125,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: cupertino_icons
|
name: cupertino_icons
|
||||||
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.8"
|
version: "1.0.9"
|
||||||
device_info_plus:
|
device_info_plus:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -205,10 +205,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: file_selector_macos
|
name: file_selector_macos
|
||||||
sha256: "19124ff4a3d8864fdc62072b6a2ef6c222d55a3404fe14893a3c02744907b60c"
|
sha256: "5e0bbe9c312416f1787a68259ea1505b52f258c587f12920422671807c4d618a"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.4+4"
|
version: "0.9.5"
|
||||||
file_selector_platform_interface:
|
file_selector_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -274,10 +274,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_plugin_android_lifecycle
|
name: flutter_plugin_android_lifecycle
|
||||||
sha256: c2fe1001710127dfa7da89977a08d591398370d099aacdaa6d44da7eb14b8476
|
sha256: "38d1c268de9097ff59cf0e844ac38759fc78f76836d37edad06fa21e182055a0"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.31"
|
version: "2.0.34"
|
||||||
flutter_secure_storage:
|
flutter_secure_storage:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -436,18 +436,18 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: image_picker
|
name: image_picker
|
||||||
sha256: "784210112be18ea55f69d7076e2c656a4e24949fa9e76429fe53af0c0f4fa320"
|
sha256: "91c025426c2881c551100bce834e201c835a170151545f58d17da5180ca7d9ac"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.1"
|
version: "1.2.2"
|
||||||
image_picker_android:
|
image_picker_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image_picker_android
|
name: image_picker_android
|
||||||
sha256: "28f3987ca0ec702d346eae1d90eda59603a2101b52f1e234ded62cff1d5cfa6e"
|
sha256: d5b3e1774af29c9ab00103afb0d4614070f924d2e0057ac867ec98800114793f
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.13+1"
|
version: "0.8.13+17"
|
||||||
image_picker_for_web:
|
image_picker_for_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -460,10 +460,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image_picker_ios
|
name: image_picker_ios
|
||||||
sha256: eb06fe30bab4c4497bad449b66448f50edcc695f1c59408e78aa3a8059eb8f0e
|
sha256: "956c16a42c0c708f914021666ffcd8265dde36e673c9fa68c81f7d085d9774ad"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.13"
|
version: "0.8.13+3"
|
||||||
image_picker_linux:
|
image_picker_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -476,10 +476,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image_picker_macos
|
name: image_picker_macos
|
||||||
sha256: d58cd9d67793d52beefd6585b12050af0a7663c0c2a6ece0fb110a35d6955e04
|
sha256: "86f0f15a309de7e1a552c12df9ce5b59fe927e71385329355aec4776c6a8ec91"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.2"
|
version: "0.2.2+1"
|
||||||
image_picker_platform_interface:
|
image_picker_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -504,6 +504,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.19.0"
|
version: "0.19.0"
|
||||||
|
jni:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: jni
|
||||||
|
sha256: c2230682d5bc2362c1c9e8d3c7f406d9cbba23ab3f2e203a025dd47e0fb2e68f
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
jni_flutter:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: jni_flutter
|
||||||
|
sha256: "8b59e590786050b1cd866677dddaf76b1ade5e7bc751abe04b86e84d379d3ba6"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.1"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -516,10 +532,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: json_annotation
|
name: json_annotation
|
||||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
sha256: cb09e7dac6210041fad964ed7fbee004f14258b4eca4040f72d1234062ace4c8
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.9.0"
|
version: "4.11.0"
|
||||||
leak_tracker:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -616,6 +632,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
|
package_config:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_config
|
||||||
|
sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.0"
|
||||||
path:
|
path:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -636,18 +660,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
sha256: "3b4c1fc3aa55ddc9cd4aa6759984330d5c8e66aa7702a6223c61540dc6380c37"
|
sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.19"
|
version: "2.3.1"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_foundation
|
name: path_provider_foundation
|
||||||
sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd"
|
sha256: "6d13aece7b3f5c5a9731eaf553ff9dcbc2eff41087fd2df587fd0fed9a3eb0c4"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.2"
|
version: "2.5.1"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -716,26 +740,26 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: shared_preferences
|
name: shared_preferences
|
||||||
sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5"
|
sha256: c3025c5534b01739267eb7d76959bbc25a6d10f6988e1c2a3036940133dd10bf
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.3"
|
version: "2.5.5"
|
||||||
shared_preferences_android:
|
shared_preferences_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_android
|
name: shared_preferences_android
|
||||||
sha256: bd14436108211b0d4ee5038689a56d4ae3620fd72fd6036e113bf1345bc74d9e
|
sha256: e8d4762b1e2e8578fc4d0fd548cebf24afd24f49719c08974df92834565e2c53
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.13"
|
version: "2.4.23"
|
||||||
shared_preferences_foundation:
|
shared_preferences_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_foundation
|
name: shared_preferences_foundation
|
||||||
sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03"
|
sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.4"
|
version: "2.5.6"
|
||||||
shared_preferences_linux:
|
shared_preferences_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -748,10 +772,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_platform_interface
|
name: shared_preferences_platform_interface
|
||||||
sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80"
|
sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.1"
|
version: "2.4.2"
|
||||||
shared_preferences_web:
|
shared_preferences_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -777,10 +801,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
|
sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.1"
|
version: "1.10.2"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -841,18 +865,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_android
|
name: url_launcher_android
|
||||||
sha256: "81777b08c498a292d93ff2feead633174c386291e35612f8da438d6e92c4447e"
|
sha256: "3bb000251e55d4a209aa0e2e563309dc9bb2befea2295fd0cec1f51760aac572"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.3.20"
|
version: "6.3.29"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_ios
|
name: url_launcher_ios
|
||||||
sha256: d80b3f567a617cb923546034cc94bfe44eb15f989fe670b37f26abdb9d939cb7
|
sha256: cfde38aa257dae62ffe79c87fab20165dfdf6988c1d31b58ebf59b9106062aad
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.3.4"
|
version: "6.3.6"
|
||||||
url_launcher_linux:
|
url_launcher_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -865,10 +889,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_macos
|
name: url_launcher_macos
|
||||||
sha256: c043a77d6600ac9c38300567f33ef12b0ef4f4783a2c1f00231d2b1941fea13f
|
sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.3"
|
version: "3.2.5"
|
||||||
url_launcher_platform_interface:
|
url_launcher_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -913,10 +937,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
|
sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "15.0.0"
|
version: "15.2.0"
|
||||||
web:
|
web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -974,5 +998,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.1"
|
version: "4.2.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.8.1 <4.0.0"
|
dart: ">=3.9.0 <4.0.0"
|
||||||
flutter: ">=3.32.0"
|
flutter: ">=3.35.6"
|
||||||
|
|||||||
Reference in New Issue
Block a user