ce170f9bc8
continuous-integration/drone/push Build is passing
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
60 lines
1.4 KiB
Dart
60 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:toastification/toastification.dart';
|
|
|
|
class AppToast {
|
|
static void success(BuildContext context, String message) {
|
|
toastification.show(
|
|
context: context,
|
|
type: ToastificationType.success,
|
|
style: ToastificationStyle.flatColored,
|
|
title: Text(
|
|
message,
|
|
maxLines: 5,
|
|
softWrap: true,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
autoCloseDuration: const Duration(seconds: 3),
|
|
);
|
|
}
|
|
|
|
static void error(BuildContext context, String message) {
|
|
toastification.show(
|
|
context: context,
|
|
type: ToastificationType.error,
|
|
style: ToastificationStyle.flatColored,
|
|
title: Text(
|
|
message,
|
|
maxLines: 5,
|
|
softWrap: true,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
autoCloseDuration: const Duration(seconds: 3),
|
|
);
|
|
}
|
|
|
|
static void notification(
|
|
BuildContext context,
|
|
String title,
|
|
String description,
|
|
) {
|
|
toastification.show(
|
|
context: context,
|
|
type: ToastificationType.info,
|
|
style: ToastificationStyle.flatColored,
|
|
title: Text(
|
|
title,
|
|
maxLines: 2,
|
|
softWrap: true,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
description: Text(
|
|
description,
|
|
maxLines: 5,
|
|
softWrap: true,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
autoCloseDuration: const Duration(seconds: 6),
|
|
);
|
|
}
|
|
}
|