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:
dahoud
2026-04-15 20:27:23 +00:00
parent 744faa3a9c
commit 7cd7c6fc9e
36 changed files with 1890 additions and 837 deletions

View File

@@ -3,6 +3,7 @@ library snackbar_helper;
import 'package:flutter/material.dart';
import '../../core/error/failures.dart';
import '../design_system/tokens/app_colors.dart';
/// Helper class for showing consistent Snackbar messages throughout the app
class SnackbarHelper {
@@ -16,12 +17,12 @@ class SnackbarHelper {
final snackBar = SnackBar(
content: Row(
children: [
const Icon(Icons.check_circle, color: Colors.white),
const Icon(Icons.check_circle, color: AppColors.onPrimary),
const SizedBox(width: 12),
Expanded(child: Text(message)),
],
),
backgroundColor: Colors.green[700],
backgroundColor: AppColors.success,
behavior: SnackBarBehavior.floating,
duration: duration,
action: action,
@@ -39,18 +40,18 @@ class SnackbarHelper {
final snackBar = SnackBar(
content: Row(
children: [
const Icon(Icons.error_outline, color: Colors.white),
const Icon(Icons.error_outline, color: AppColors.onPrimary),
const SizedBox(width: 12),
Expanded(child: Text(message)),
],
),
backgroundColor: Colors.red[700],
backgroundColor: AppColors.error,
behavior: SnackBarBehavior.floating,
duration: duration,
action: onRetry != null
? SnackBarAction(
label: 'Réessayer',
textColor: Colors.white,
textColor: AppColors.onPrimary,
onPressed: onRetry,
)
: null,
@@ -67,12 +68,12 @@ class SnackbarHelper {
final snackBar = SnackBar(
content: Row(
children: [
const Icon(Icons.warning_amber, color: Colors.white),
const Icon(Icons.warning_amber, color: AppColors.onPrimary),
const SizedBox(width: 12),
Expanded(child: Text(message)),
],
),
backgroundColor: Colors.orange[700],
backgroundColor: AppColors.warning,
behavior: SnackBarBehavior.floating,
duration: duration,
);
@@ -88,12 +89,12 @@ class SnackbarHelper {
final snackBar = SnackBar(
content: Row(
children: [
const Icon(Icons.info_outline, color: Colors.white),
const Icon(Icons.info_outline, color: AppColors.onPrimary),
const SizedBox(width: 12),
Expanded(child: Text(message)),
],
),
backgroundColor: Colors.blue[700],
backgroundColor: AppColors.info,
behavior: SnackBarBehavior.floating,
duration: duration,
);
@@ -112,12 +113,12 @@ class SnackbarHelper {
final snackBar = SnackBar(
content: Row(
children: [
const Icon(Icons.construction, color: Colors.white),
const Icon(Icons.construction, color: AppColors.onPrimary),
const SizedBox(width: 12),
Expanded(child: Text(message)),
],
),
backgroundColor: Colors.blue[700],
backgroundColor: AppColors.info,
behavior: SnackBarBehavior.floating,
duration: const Duration(seconds: 4),
);
@@ -140,26 +141,26 @@ class SnackbarHelper {
IconData icon;
if (failure is NetworkFailure) {
backgroundColor = Colors.orange[700]!;
backgroundColor = AppColors.warning;
icon = Icons.wifi_off;
} else if (failure is UnauthorizedFailure) {
backgroundColor = Colors.red[700]!;
backgroundColor = AppColors.error;
icon = Icons.lock_outline;
} else if (failure is ForbiddenFailure) {
backgroundColor = Colors.deepOrange[700]!;
backgroundColor = AppColors.warning;
icon = Icons.block;
} else if (failure is ValidationFailure) {
backgroundColor = Colors.amber[700]!;
backgroundColor = AppColors.warningUI;
icon = Icons.error_outline;
} else {
backgroundColor = Colors.red[700]!;
backgroundColor = AppColors.error;
icon = Icons.error_outline;
}
final snackBar = SnackBar(
content: Row(
children: [
Icon(icon, color: Colors.white),
Icon(icon, color: AppColors.onPrimary),
const SizedBox(width: 12),
Expanded(child: Text(failure.getUserMessage())),
],
@@ -170,7 +171,7 @@ class SnackbarHelper {
action: failure.isRetryable && onRetry != null
? SnackBarAction(
label: 'Réessayer',
textColor: Colors.white,
textColor: AppColors.onPrimary,
onPressed: onRetry,
)
: null,
@@ -192,14 +193,14 @@ class SnackbarHelper {
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
valueColor: AlwaysStoppedAnimation<Color>(AppColors.onPrimary),
),
),
const SizedBox(width: 12),
Expanded(child: Text(message)),
],
),
backgroundColor: Colors.grey[800],
backgroundColor: AppColors.surfaceDark,
behavior: SnackBarBehavior.floating,
duration: duration,
);