mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 17:29:42 +00:00

- 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.
57 lines
1.4 KiB
Dart
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,
|
|
),
|
|
);
|
|
}
|
|
}
|