feat: initial commit - Habo habit tracking app
- Complete MVP with Repository Pattern, SQLite storage - Provider + ChangeNotifier state management - Navigation 2.0 with deep link support - Habit CRUD with twoDayRule, notifications, categories - Backup/Restore via JSON - Statistics with streak tracking - Material You theme support - Biometric lock support - Desktop widget support - 27 languages i18n structure - Comprehensive test suite (87/89 passing)
This commit is contained in:
48
lib/services/ui_feedback_service.dart
Normal file
48
lib/services/ui_feedback_service.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UIFeedbackService {
|
||||
final GlobalKey<ScaffoldMessengerState> _scaffoldKey;
|
||||
|
||||
UIFeedbackService(this._scaffoldKey);
|
||||
|
||||
void showSuccess(String message) {
|
||||
showMessage(message, Colors.green);
|
||||
}
|
||||
|
||||
void showError(String message) {
|
||||
showMessage(message, Colors.red);
|
||||
}
|
||||
|
||||
void showWarning(String message) {
|
||||
showMessage(message, Colors.orange);
|
||||
}
|
||||
|
||||
void showMessage(String message, [Color? color]) {
|
||||
_scaffoldKey.currentState?.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: color,
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showMessageWithAction({
|
||||
required String message,
|
||||
required String actionLabel,
|
||||
required VoidCallback onActionPressed,
|
||||
Color? backgroundColor,
|
||||
}) {
|
||||
_scaffoldKey.currentState?.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: backgroundColor,
|
||||
action: SnackBarAction(
|
||||
label: actionLabel,
|
||||
onPressed: () => onActionPressed(),
|
||||
),
|
||||
duration: const Duration(seconds: 4),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user