flexi_toast 1.0.0
flexi_toast: ^1.0.0 copied to clipboard
Flexible and customizable solution for displaying toast notifications in Flutter applications
import 'package:flexi_toast/toast_manager.dart';
import 'package:flexi_toast/toast_position.dart';
import 'package:flexi_toast/toast_type.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flexi Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Example Flexi'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Container(),
floatingActionButton: FloatingActionButton(
onPressed: () {
ToastManager.show(
context: context,
message: "Event has been created",
description: "Sunday, December 03, 2023 at 9:00 AM",
duration: const Duration(seconds: 3),
icon: const Icon(Icons.check_circle, color: Colors.white), // Icône
position: ToastPosition.bottom,
type: ToastType.success,
);
},
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}