SEND063
This commit is contained in:
@@ -2,24 +2,35 @@ 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 {
|
||||
/// Returns the localized string for this status,
|
||||
/// e.g. “Processing”, “Success”, “Error”.
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user