jhtoast 1.2.0 jhtoast: ^1.2.0 copied to clipboard
jhtoast - Flutter toast package. supported effects: text, imagetext, loading, horizontal and vertical layout. Supports iOS and Android.
jhtoast #
jhtoast - Flutter toast package. 支持的效果:文字,图文,加载中,水平垂直两种布局
pub地址:https://pub.flutter-io.cn/packages/jhtoast
使用 #
- Add this to your package's pubspec.yaml file:
dependencies:
jhtoast: ^1.1.0
- Install it
flutter pub get
- Import it
import 'package:jhtoast/jhtoast.dart';
Examples #
- 样式1 - 文字
JhToast.showText(context, msg: "这是一条提示文字信息",
// closeTime: 10
);
- 样式2 - 成功
JhToast.showSuccess(context, msg: "加载成功");
- 样式3 - 失败
JhToast.showError(context, msg: "上传失败。请重新上传数据");
- 样式4 - 警告
JhToast.showInfo(context, msg: "注意!注意!注意!");
- 样式5 - 加载中
var hide = JhToast.showLoadingText(context,
msg:"正在加载中..."
);
Future.delayed(Duration(seconds: 2),(){
hide();
});
- 样式6 - 水平加载中
var hide = JhToast.showHorizontalLoadingText(context,
msg:"正在加载中..."
);
Future.delayed(Duration(seconds: 2),(){
hide();
});
- 样式7 - 自定义图文
Widget img = Image.asset("assets/images/toast_error.png");
JhToast.showImageText(context,
msg: "自定义图文",
image: img);
- 样式8 - 水平自定义图文
Widget img = Image.asset("assets/images/toast_success.png");
JhToast.showHorizontalImageText(context,
msg: "水平自定义图文",
image: img);
- 样式9 - iOS样式加载中
var hide = JhToast.showIOSLoadingText(context,
msg:"正在加载中...",
);
Future.delayed(Duration(seconds: 2),(){
hide();
});
}