Files
tm_app/lib/core/utils/app_toast.dart
T
AmirReza Jamali ce170f9bc8
continuous-integration/drone/push Build is passing
Wrap long toast messages instead of truncating
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 14:36:40 +03:30

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),
);
}
}