39 lines
1.0 KiB
Dart
39 lines
1.0 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import 'package:pshared/generated/i18n/ps_localizations.dart';
|
|
|
|
enum OperationStatus {
|
|
pending,
|
|
processing,
|
|
retrying,
|
|
success,
|
|
skipped,
|
|
cancelled,
|
|
needsAttention,
|
|
error,
|
|
}
|
|
|
|
extension OperationStatusX on OperationStatus {
|
|
String localized(BuildContext context) {
|
|
final loc = PSLocalizations.of(context)!;
|
|
switch (this) {
|
|
case OperationStatus.pending:
|
|
return loc.operationStatusPending;
|
|
case OperationStatus.processing:
|
|
return loc.operationStatusProcessing;
|
|
case OperationStatus.retrying:
|
|
return loc.operationStatusRetrying;
|
|
case OperationStatus.success:
|
|
return loc.operationStatusSuccess;
|
|
case OperationStatus.skipped:
|
|
return loc.operationStatusSkipped;
|
|
case OperationStatus.cancelled:
|
|
return loc.operationStatusCancelled;
|
|
case OperationStatus.needsAttention:
|
|
return loc.operationStatusNeedsAttention;
|
|
case OperationStatus.error:
|
|
return loc.operationStatusError;
|
|
}
|
|
}
|
|
}
|