feat(shared): legacy presentation/ + shared design system + widgets
- lib/presentation : pages legacy (explore/network, notifications) avec BLoC - lib/shared/design_system : UnionFlow Design System v2 (tokens, components) + MD3 tokens + module_colors par feature - lib/shared/widgets : widgets transversaux (core_card, core_shimmer, error_widget, loading_widget, powered_by_lions_dev, etc.) - lib/shared/constants + utils
This commit is contained in:
@@ -3,6 +3,7 @@ library error_display_widget;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../core/error/failures.dart';
|
||||
import '../design_system/tokens/app_colors.dart';
|
||||
|
||||
/// Error display widget that shows failures in a user-friendly way
|
||||
class ErrorDisplayWidget extends StatelessWidget {
|
||||
@@ -48,7 +49,7 @@ class ErrorDisplayWidget extends StatelessWidget {
|
||||
Text(
|
||||
failure.getUserMessage(),
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Colors.grey[600],
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -98,15 +99,15 @@ class ErrorDisplayWidget extends StatelessWidget {
|
||||
/// Get appropriate color for error type
|
||||
Color _getErrorColor(BuildContext context) {
|
||||
if (failure is NetworkFailure) {
|
||||
return Colors.orange;
|
||||
return AppColors.warning;
|
||||
} else if (failure is UnauthorizedFailure) {
|
||||
return Colors.red;
|
||||
return AppColors.error;
|
||||
} else if (failure is ForbiddenFailure) {
|
||||
return Colors.deepOrange;
|
||||
return AppColors.warning;
|
||||
} else if (failure is ValidationFailure) {
|
||||
return Colors.amber;
|
||||
return AppColors.warningUI;
|
||||
} else if (failure is NotImplementedFailure) {
|
||||
return Colors.blue[700]!;
|
||||
return AppColors.info;
|
||||
} else {
|
||||
return Theme.of(context).colorScheme.error;
|
||||
}
|
||||
@@ -183,7 +184,7 @@ class ErrorBanner extends StatelessWidget {
|
||||
failure.getUserMessage(),
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.grey[700],
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -228,15 +229,15 @@ class ErrorBanner extends StatelessWidget {
|
||||
|
||||
Color _getErrorColor(BuildContext context) {
|
||||
if (failure is NetworkFailure) {
|
||||
return Colors.orange;
|
||||
return AppColors.warning;
|
||||
} else if (failure is UnauthorizedFailure) {
|
||||
return Colors.red;
|
||||
return AppColors.error;
|
||||
} else if (failure is ForbiddenFailure) {
|
||||
return Colors.deepOrange;
|
||||
return AppColors.warning;
|
||||
} else if (failure is ValidationFailure) {
|
||||
return Colors.amber;
|
||||
return AppColors.warningUI;
|
||||
} else if (failure is NotImplementedFailure) {
|
||||
return Colors.blue[700]!;
|
||||
return AppColors.info;
|
||||
} else {
|
||||
return Theme.of(context).colorScheme.error;
|
||||
}
|
||||
@@ -282,7 +283,7 @@ void showErrorSnackBar(
|
||||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: failure is NetworkFailure ? Colors.orange : Colors.red,
|
||||
backgroundColor: failure is NetworkFailure ? AppColors.warning : AppColors.error,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
action: failure.isRetryable && onRetry != null
|
||||
? SnackBarAction(
|
||||
|
||||
Reference in New Issue
Block a user