Flutter Notie
一个 Flutter 包,可轻松显示时尚的吐司通知。
特点
- 平滑的向上滑动动画。
- 预定义的吐司样式:成功、信息、警告、错误和默认。
- 可自定义吐司在屏幕上停留的持续时间。
安装
将 flutter_notie 添加到您的包的 pubspec.yaml 文件中
dependencies:
flutter_notie: ^0.0.6
然后从命令行安装包
flutter pub get
用法
要使用 flutter_notie,只需在您的代码中调用其静态方法之一
// Import the package.
import 'package:flutter_notie/flutter_notie.dart';
// Show a success toast notification.
FlutterNotie.success(context, message: 'This was successful!');
// Show an info toast notification.
FlutterNotie.info(context, message: 'Some information for you.');
// Show a warning toast notification.
FlutterNotie.warning(context, message: 'Be careful!');
// Show an error toast notification.
FlutterNotie.error(context, message: 'Oops, something went wrong.');
// Show a default toast notification.
FlutterNotie.defaultNotie(context, message: 'Just a regular notification.');
// Show a taost notification with a custom duration.
FlutterNotie.success(context, message: 'This was successful!', duration: Duration(seconds: 5));
截图
