Files
be_happy_public/lib/presentation/state/map_state.dart
2026-05-29 11:40:55 +03:00

77 lines
2.4 KiB
Dart

import 'package:be_happy/domain/entities/user_check_flags.dart';
import '../../domain/entities/point.dart';
import '../../domain/entities/scooter.dart';
import '../../domain/entities/zone.dart';
import '../../domain/entities/client_notification.dart';
enum ScooterStatus { initial, loading, success, failure }
class ScooterState {
final List<Scooter> scooters;
final List<Scooter> reservedScooters;
final Scooter? selectedScooterForFocus;
final List<Zone> zones;
final List<double> area;
final List<double> areaScooters;
final ScooterStatus status;
final bool isGeomarksShowed;
final String? address;
final String? errorMessage;
final String phoneNumber;
final int balance;
final UserCheckFlags flags;
final ClientNotification? lastNotification;
ScooterState({
this.scooters = const [],
this.reservedScooters = const [],
this.selectedScooterForFocus,
this.zones = const [],
this.area = const [],
this.areaScooters = const [],
this.status = ScooterStatus.initial,
required this.isGeomarksShowed,
this.address,
this.errorMessage,
this.phoneNumber = "+375XXXXXXXXX",
this.balance = 999,
this.flags = const UserCheckFlags(hasFine: false, hasUnpaidOrder: false, hasCard: false),
this.lastNotification,
});
ScooterState copyWith({
List<Scooter>? scooters,
List<Scooter>? reservedScooters,
Scooter? selectedScooterForFocus,
List<Zone>? zones,
List<double>? area,
List<double>? areaScooters,
ScooterStatus? status,
bool? isGeomarksShowed,
String? address,
String? errorMessage,
String? phoneNumber,
int? balance,
UserCheckFlags? flags,
ClientNotification? lastNotification,
}) {
return ScooterState(
scooters: scooters ?? this.scooters,
reservedScooters: reservedScooters ?? this.reservedScooters,
selectedScooterForFocus: selectedScooterForFocus ?? this.selectedScooterForFocus,
zones: zones ?? this.zones,
area: area ?? this.area,
areaScooters: areaScooters ?? this.areaScooters,
status: status ?? this.status,
address: address ?? this.address,
isGeomarksShowed: isGeomarksShowed?? this.isGeomarksShowed,
errorMessage: errorMessage ?? this.errorMessage,
phoneNumber: phoneNumber ?? this.phoneNumber,
balance: balance ?? this.balance,
flags: flags ?? this.flags,
lastNotification: lastNotification ?? this.lastNotification,
);
}
}