Skip to content

Commit 3c2397b

Browse files
committed
docs: Add English API documentation and English comments.
1 parent 8845824 commit 3c2397b

File tree

7 files changed

+824
-243
lines changed

7 files changed

+824
-243
lines changed

API.md

+234-226
Large diffs are not rendered by default.

API_zh.md

+278
Large diffs are not rendered by default.

README.md

+25-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ A really easy to use flutter toast library!
2828

2929
- Pure flutter implementation
3030

31+
- Supports global configuration
32+
3133

3234
### 🐼Online Demo
3335

@@ -48,19 +50,19 @@ Loading|Text|CustomWidget
4850

4951
### 🐮Getting started
5052

51-
#### 1. add dependencies into you project pubspec.yaml file
53+
#### 1. Add dependencies into you project pubspec.yaml file
5254
``` yaml
5355
dependencies:
5456
bot_toast: ^3.0.5
5557
# bot_toast: ^4.0.0 #null safety
5658
```
5759

58-
#### 2. import BotToast lib
60+
#### 2. Import BotToast Lib
5961
``` dart
6062
import 'package:bot_toast/bot_toast.dart';
6163
```
6264

63-
#### 3. initialization BotToast
65+
#### 3. Initialization BotToast
6466
``` dart
6567
MaterialApp(
6668
title: 'BotToast Demo',
@@ -85,7 +87,7 @@ MaterialApp(
8587
)
8688
```
8789

88-
#### 4. use BotToast
90+
#### 4. Use BotToast
8991
``` dart
9092
var cancel = BotToast.showText(text:"xxxx"); //popup a text toast;
9193
...
@@ -132,6 +134,25 @@ var cancel = BotToast.showAnimationWidget(...)
132134
cancel(); //close
133135
```
134136

137+
#### 5. Modify Global Configuration
138+
139+
``` dart
140+
/// For example: Globally change the animation duration for standard notifications to 1 second.
141+
BotToast.defaultOption.notification.animationDuration = const Duration(seconds: 1);
142+
143+
/// For more default options, refer to the following configurations:
144+
/// [BotToast.defaultOption.simpleNotification] corresponds to the default values of [showSimpleNotification].
145+
/// [BotToast.defaultOption.notification] corresponds to the default values of [showNotification].
146+
/// [BotToast.defaultOption.customNotification] corresponds to the default values of [showCustomNotification].
147+
/// [BotToast.defaultOption.text] corresponds to the default values of [showText].
148+
/// [BotToast.defaultOption.customText] corresponds to the default values of [showCustomText].
149+
/// [BotToast.defaultOption.loading] corresponds to the default values of [showLoading].
150+
/// [BotToast.defaultOption.customLoading] corresponds to the default values of [showCustomLoading].
151+
/// [BotToast.defaultOption.attached] corresponds to the default values of [showAttachedWidget].
152+
/// [BotToast.defaultOption.animation] corresponds to the default values of [showAnimationWidget].
153+
/// [BotToast.defaultOption.enhanced] corresponds to the default values of [showEnhancedWidget].
154+
```
155+
135156
### 🐼3.0 version
136157

137158
#### Major changes:

README_zh.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ BotToast 🤖
3131

3232
- 纯flutter实现
3333

34+
- 支持全局配置
35+
3436

3537

3638
### 🐼在线demo
@@ -139,6 +141,25 @@ cancel(); //关闭
139141

140142
<br>
141143

144+
#### 5. 修改全局配置
145+
146+
``` dart
147+
///例如:全局修改标准通知的动画时间为 1 秒。
148+
BotToast.defaultOption.notification.animationDuration=const Duration(seconds: 1);
149+
150+
///更多默认选项参考下述配置
151+
///[BotToast.defaultOption.simpleNotification] 对应 [showSimpleNotification] 的默认值
152+
///[BotToast.defaultOption.notification] 对应 [showNotification] 的默认值
153+
///[BotToast.defaultOption.customNotification] 对应 [showCustomNotification] 的默认值
154+
///[BotToast.defaultOption.text] 对应 [showText] 的默认值
155+
///[BotToast.defaultOption.customText] 对应 [showCustomText] 的默认值
156+
///[BotToast.defaultOption.loading] 对应 [showLoading] 的默认值
157+
///[BotToast.defaultOption.customLoading] 对应 [showCustomLoading] 的默认值
158+
///[BotToast.defaultOption.attached] 对应 [showAttachedWidget] 的默认值
159+
///[BotToast.defaultOption.animation] 对应 [showAnimationWidget] 的默认值
160+
///[BotToast.defaultOption.enhanced] 对应 [showEnhancedWidget] 的默认值
161+
```
162+
142163
### 🐼3.0版本
143164

144165
#### 主要改动:
@@ -186,7 +207,7 @@ MaterialApp(
186207
<br>
187208

188209
### 📃主要Api文档
189-
[主要Api文档](API.md)
210+
[主要Api文档](API_zh.md)
190211

191212

192213

example/lib/notification/simple_notification.dart

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class _SimpleNotificationState extends State<SimpleNotification> {
1919

2020
@override
2121
void initState() {
22+
///全局范围内将标准通知的动画时间修改为 1 秒
23+
BotToast.defaultOption.notification.animationDuration=const Duration(seconds: 1);
2224
BotToast.showSimpleNotification(
2325
title: "Notification title",
2426
subTitle: "Notification subtitle",

0 commit comments

Comments
 (0)