Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cool_ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
cool_ui
Commits
27f3d640
提交
27f3d640
authored
6 年前
作者:
Kevin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改了Toast的位置计算方式
上级
7fd8f603
master
1.9
1.8
1.6
0.2.2
0.2.1
0.2.0
0.1.16
0.1.14
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
73 行增加
和
54 行删除
+73
-54
CHANGELOG.md
CHANGELOG.md
+5
-0
README.md
README.md
+21
-14
weui_toast.dart
lib/dialogs/weui_toast.dart
+47
-40
没有找到文件。
CHANGELOG.md
浏览文件 @
27f3d640
## [0.1.6] - TODO:修改了Toast的位置计算方式
*
TODO: 修改了Toast的位置计算方式
*
TODO: 开放了Toast的位置设置
*
TODO: 修改了README.md文档的大小
## [0.1.5] - TODO:添加了popoverConstraints参数
*
TODO: CupertionPopoverButton添加了CupertionPopoverButton参数,用于设置最大最小宽度,取消必填的高宽
...
...
This diff is collapsed.
Click to expand it.
README.md
浏览文件 @
27f3d640
...
...
@@ -75,7 +75,8 @@ CupertinoPopoverButton(
});
```

<img
width=
"38%"
height=
"38%"
src=
"./images/popover_demo.gif"
/>
## CupertinoPopoverMenuList
Popover弹出的菜单样式列表,一般与
[
CupertinoPopoverMenuItem
](
#CupertinoPopoverMenuItem
)
一起用,会给两个Item加间隔线
...
...
@@ -99,7 +100,7 @@ const CupertinoPopoverMenuItem({
});
```
| Param | Type | Description |
| --- | --- | --- |
| --- | --- | --- |
--- |
|
[
leading
]
|
<code>
Widget
<Widget></code>
| 菜单左边,一般放图标 |
|
[
child
]
|
<code>
Widget
<Widget></code>
| 菜单内容 |
|
[
onTap
]
|
<code>
BoolCallback
</code>
| | 按钮点击事件,返回true取消默认反应(不关闭Popover) |
...
...
@@ -124,19 +125,21 @@ VoidCallback showWeuiToast({
@required
BuildContext
context
,
@required
Widget
message
,
@required
Widget
icon
,
Alignment
alignment
=
const
Alignment
(
0.0
,-
0.2
),
RouteTransitionsBuilder
transitionBuilder
})
```
| Param | Type | Description |
| --- | --- | --- |
|
[
context
]
|
<code>
BuildContext
<Widget></code>
| 上下文 |
|
[
message
]
|
<code>
Widget
<Widget></code>
| 提示消息 |
|
[
icon
]
|
<code>
Widget
<Widget></code>
| 图标 |
|
[
transitionBuilder
]
|
<code>
RouteTransitionsBuilder
<Widget></code>
| 自定义过度动画 |
| Param | Type | Default | Description |
| --- | --- | --- | --- |
|
[
context
]
|
<code>
BuildContext
<Widget></code>
| | 上下文 |
|
[
message
]
|
<code>
Widget
<Widget></code>
| | 提示消息 |
|
[
alignment
]
|
<code>
Alignment
<Widget></code>
| 默认是居中偏上 | Toast的位置 |
|
[
icon
]
|
<code>
Widget
<Widget></code>
| | 图标 |
|
[
transitionBuilder
]
|
<code>
RouteTransitionsBuilder
<Widget></code>
| | 自定义过度动画 |
返回参数:VoidCallback,用于关闭Toast

<img
width=
"38%"
height=
"38%"
src=
"./images/toast_demo.gif"
/>
## showWeuiSuccessToast
仿Weui的SuccessToast效果
...
...
@@ -144,6 +147,7 @@ VoidCallback showWeuiToast({
Future
showWeuiSuccessToast
(
{
@required
BuildContext
context
,
@required
Widget
message
=
const
Text
(
"成功"
),
Alignment
alignment
=
const
Alignment
(
0.0
,-
0.2
),
RouteTransitionsBuilder
transitionBuilder
,
Duration
closeDuration
=
const
Duration
(
seconds:
3
)
})
...
...
@@ -152,6 +156,7 @@ Future showWeuiSuccessToast({
| --- | --- | --- | --- |
|
[
context
]
|
<code>
BuildContext
<Widget></code>
| | 上下文 |
|
[
transitionBuilder
]
|
<code>
RouteTransitionsBuilder
<Widget></code>
| | 自定义过度动画 |
|
[
alignment
]
|
<code>
Alignment
<Widget></code>
| 默认是居中偏上 | Toast的位置 |
|
[
message
]
|
<code>
Widget
<Widget></code>
| 成功| 提示消息 |
|
[
closeDuration
]
|
<code>
Duration
<Widget></code>
| 3s | 关闭时间 |
...
...
@@ -164,13 +169,15 @@ Future showWeuiSuccessToast({
VoidCallback
showWeuiToast
(
{
@required
BuildContext
context
,
@required
Widget
message
,
Alignment
alignment
=
const
Alignment
(
0.0
,-
0.2
),
RouteTransitionsBuilder
transitionBuilder
})
```
| Param | Type | Description |
| --- | --- | --- |
|
[
context
]
|
<code>
BuildContext
<Widget></code>
| 上下文 |
|
[
message
]
|
<code>
Widget
<Widget></code>
| 提示消息 |
|
[
transitionBuilder
]
|
<code>
RouteTransitionsBuilder
<Widget></code>
| 自定义过度动画 |
| Param | Type | Default | Description |
| --- | --- | --- | --- |
|
[
context
]
|
<code>
BuildContext
<Widget></code>
| | 上下文 |
|
[
message
]
|
<code>
Widget
<Widget></code>
| | 提示消息 |
|
[
alignment
]
|
<code>
Alignment
<Widget></code>
| 默认是居中偏上 | Toast的位置 |
|
[
transitionBuilder
]
|
<code>
RouteTransitionsBuilder
<Widget></code>
| | 自定义过度动画 |
返回参数:VoidCallback,用于关闭Toast
This diff is collapsed.
Click to expand it.
lib/dialogs/weui_toast.dart
浏览文件 @
27f3d640
...
...
@@ -6,9 +6,11 @@ class WeuiToast extends TransitionRoute{
final
Widget
icon
;
final
RouteTransitionsBuilder
_transitionBuilder
;
final
Duration
closeDuration
;
final
Alignment
alignment
;
WeuiToast
({
@required
this
.
message
,
@required
this
.
icon
,
this
.
alignment
=
const
Alignment
(
0.0
,-
0.2
),
Duration
transitionDuration
=
const
Duration
(
milliseconds:
100
),
RouteTransitionsBuilder
transitionBuilder
,
this
.
closeDuration
...
...
@@ -56,48 +58,45 @@ class WeuiToast extends TransitionRoute{
Widget
_buildToastScope
(
BuildContext
context
){
return
Material
(
color:
Colors
.
transparent
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
Padding
(
padding:
EdgeInsets
.
only
(
top:
180.0
),
child:
AnimatedBuilder
(
animation:
animation
,
builder:
(
context
,
child
){
return
_buildTransition
(
context
,
animation
,
secondaryAnimation
,
child
);
},
child:
Container
(
width:
122.0
,
decoration:
BoxDecoration
(
color:
Color
.
fromRGBO
(
17
,
17
,
17
,
0.7
),
borderRadius:
BorderRadius
.
circular
(
5.0
)
),
constraints:
BoxConstraints
(
minHeight:
122.0
,
),
child:
Column
(
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
top:
22.0
),
constraints:
BoxConstraints
(
minHeight:
55.0
)
,
child:
IconTheme
(
data:
IconThemeData
(
color:
Colors
.
white
,
size:
55.0
),
child:
icon
),
),
DefaultTextStyle
(
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
16.0
),
child:
message
,
child:
Align
(
alignment:
this
.
alignment
,
child:
IntrinsicHeight
(
child:
AnimatedBuilder
(
animation:
animation
,
builder:
(
context
,
child
){
return
_buildTransition
(
context
,
animation
,
secondaryAnimation
,
child
);
},
child:
Container
(
width:
122.0
,
decoration:
BoxDecoration
(
color:
Color
.
fromRGBO
(
17
,
17
,
17
,
0.7
),
borderRadius:
BorderRadius
.
circular
(
5.0
)
),
constraints:
BoxConstraints
(
minHeight:
122.0
,
),
child:
Column
(
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
top:
22.0
),
constraints:
BoxConstraints
(
minHeight:
55.0
)
,
child:
IconTheme
(
data:
IconThemeData
(
color:
Colors
.
white
,
size:
55.0
),
child:
icon
),
),
DefaultTextStyle
(
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
16.0
),
],
),
child:
message
,
),
],
),
),
)
]
,
)
,
)
,
)
,
)
);
}
...
...
@@ -122,11 +121,13 @@ Future showWeuiSuccessToast({
@required
BuildContext
context
,
Widget
message
=
const
Text
(
"成功"
),
RouteTransitionsBuilder
transitionBuilder
,
Alignment
alignment
=
const
Alignment
(
0.0
,-
0.2
),
Duration
closeDuration
=
const
Duration
(
seconds:
3
)
}){
var
hide
=
showWeuiToast
(
context:
context
,
alignment:
alignment
,
message:
message
,
icon:
Icon
(
CoolUIIcons
.
success_no_circle
),
transitionBuilder:
transitionBuilder
);
...
...
@@ -140,10 +141,12 @@ Future showWeuiSuccessToast({
VoidCallback
showWeuiLoadingToast
(
{
@required
BuildContext
context
,
@required
Widget
message
,
Alignment
alignment
=
const
Alignment
(
0.0
,-
0.2
),
RouteTransitionsBuilder
transitionBuilder
}){
return
showWeuiToast
(
context:
context
,
alignment:
alignment
,
message:
message
,
icon:
WeuiLoadingIcon
(),
transitionBuilder:
transitionBuilder
);
...
...
@@ -153,13 +156,17 @@ VoidCallback showWeuiToast({
@required
BuildContext
context
,
@required
Widget
message
,
@required
Widget
icon
,
Alignment
alignment
=
const
Alignment
(
0.0
,-
0.2
),
RouteTransitionsBuilder
transitionBuilder
}){
Completer
<
VoidCallback
>
result
=
Completer
<
VoidCallback
>();
Navigator
.
of
(
context
,
rootNavigator:
true
).
push
(
WeuiToast
(
alignment:
alignment
,
message:
Builder
(
builder:
(
context
){
result
.
complete
(()=>
Navigator
.
pop
(
context
));
if
(!
result
.
isCompleted
){
result
.
complete
(()=>
Navigator
.
pop
(
context
));
}
return
message
;
}),
icon:
icon
,
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论