https://github.com/virskor/flutterwechattoast
A new Flutter plugin for Wechat styled toast
https://github.com/virskor/flutterwechattoast
Last synced: 3 months ago
JSON representation
A new Flutter plugin for Wechat styled toast
- Host: GitHub
- URL: https://github.com/virskor/flutterwechattoast
- Owner: virskor
- License: other
- Created: 2020-03-18T05:41:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T08:44:11.000Z (about 5 years ago)
- Last Synced: 2025-01-08T17:52:43.419Z (5 months ago)
- Language: Dart
- Size: 155 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# flutter_wechat_toast
A wechat styled toast plugin. This package is quite simple, only 3 methods requied. Make sure you need it or this will be your best choise before your installation.
![]()
![]()
![]()
## install
Add following item into your pubspec.yaml
```yaml
flutter_wechat_toast: ^1.0.1
```Recommened you install it from git repo. because this package may contains bugs or changes.
## Examples and Noticing
This package required 3 methods to build a toast widget.
You can using await to wait toast widget dismissed.```dart
text() async{
await WechatToast(context: context).failed(message: '操作失败');
print('done');
}
```### Parameters
Create a toast widget, you can specify these arguments.```dart
/// build context
final BuildContext context;/// mask will forbid users operation before toast finished
final bool mask;/// display duration
final Duration duration;/// borderRadius you are prefered
final BorderRadiusGeometry borderRadius;/// elevation
final double elevation;
```### Demo:
```dart
import 'package:flutter_wechat_toast/flutter_wechat_toast.dart';/// ...
MaterialButton(
child: Text('Toast failed'),
onPressed: () => WechatToast(context: context).failed(message: '操作失败'),
),
MaterialButton(
child: Text('Toast success'),
onPressed: () =>
WechatToast(context: context).success(message: '操作成功'),
),
MaterialButton(
child: Text('Toast loading'),
onPressed: () async{
final Function close = WechatToast(context: context).loading(message: '加载中');await Future.delayed(const Duration(seconds: 5));
close();
},
),
MaterialButton(
child: Text('Toast success and remove Mask'),
onPressed: () =>
WechatToast(context: context, mask: false).success(message: '无遮罩'),
),
```