Used awesome snackbar and fixed gemini_ico.png not found

This commit is contained in:
Marc Rejohn Castillano 2026-03-04 06:44:55 +08:00
parent c123c09233
commit 81bc618eee
4 changed files with 7 additions and 20 deletions

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

View File

@ -3763,11 +3763,7 @@ class _TaskDetailScreenState extends ConsumerState<TaskDetailScreen>
final plainText = _actionController?.document.toPlainText().trim() ?? '';
if (plainText.isEmpty) {
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Please enter some action taken text first'),
),
);
showWarningSnackBar(context, 'Please enter some action taken text first');
return;
}
@ -3829,15 +3825,11 @@ class _TaskDetailScreenState extends ConsumerState<TaskDetailScreen>
}
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Action taken improved successfully')),
);
showSuccessSnackBar(context, 'Action taken improved successfully');
}
} catch (e) {
if (context.mounted) {
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Error: $e')));
showErrorSnackBar(context, 'Error: $e');
}
} finally {
if (mounted) {

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../services/ai_service.dart';
import '../utils/snackbar.dart';
typedef TextUpdateCallback = void Function(String updatedText);
typedef ProcessingStateCallback = void Function(bool isProcessing);
@ -52,9 +53,7 @@ class _GeminiButtonState extends State<GeminiButton> {
final text = widget.textController.text.trim();
if (text.isEmpty) {
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Please enter some text first')),
);
showWarningSnackBar(context, 'Please enter some text first');
return;
}
@ -78,14 +77,10 @@ class _GeminiButtonState extends State<GeminiButton> {
widget.textController.text = trimmed;
widget.onTextUpdated(trimmed);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Text improved successfully')),
);
showSuccessSnackBar(context, 'Text improved successfully');
} catch (e) {
if (!context.mounted) return;
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Error: $e')));
showErrorSnackBar(context, 'Error: $e');
} finally {
if (mounted) {
setState(() {