Files
syncrow-web/lib/utils/extension/app_snack_bar.dart
Faris Armoush 99924c1e62 Refactor color management and UI components for consistency
- Updated color references in various widgets to use the new `opaquePrimary` color for better visual consistency.
- Refactored `ColorsManager` to improve color definitions and removed redundant color declarations.
- Enhanced UI elements across multiple dialogs and widgets to ensure a cohesive design language.

This change promotes maintainability and aligns with the updated color scheme.
2025-07-24 10:27:17 +03:00

57 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';
extension AppSnackBarsBuildContextExtension on BuildContext {
void showSuccessSnackbar(String message) {
ScaffoldMessenger.of(this).showSnackBar(
_makeSnackbar(
message: message,
icon: Icons.check_circle,
backgroundColor: Colors.green,
),
);
}
void showFailureSnackbar(String message) {
ScaffoldMessenger.of(this).showSnackBar(
_makeSnackbar(
message: message,
icon: Icons.error,
backgroundColor: Colors.red,
),
);
}
SnackBar _makeSnackbar({
required String message,
required Color backgroundColor,
required IconData icon,
}) {
return SnackBar(
content: Row(
mainAxisSize: MainAxisSize.min,
spacing: 8,
children: [
Icon(icon, color: Colors.white),
Text(
message,
style: textTheme.bodyMedium?.copyWith(
color: ColorsManager.white,
),
),
],
),
backgroundColor: backgroundColor,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
margin: const EdgeInsetsDirectional.symmetric(
horizontal: 92,
vertical: 32,
),
);
}
}