69 lines
2.0 KiB
Dart
69 lines
2.0 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<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.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<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,
|
|
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,
|
|
);
|
|
}
|
|
}
|