@@ -16,60 +16,64 @@ public static class ToastServiceExtensions
16
16
/// <param name="title">Title 属性</param>
17
17
/// <param name="content">Content 属性</param>
18
18
/// <param name="autoHide">自动隐藏属性默认为 true</param>
19
- /// <returns></returns >
20
- public static Task Success ( this ToastService service , string ? title = null , string ? content = null , bool autoHide = true ) => service . Show ( new ToastOption ( )
19
+ /// <param name="showClose">是否显示关闭按钮 默认 true</param >
20
+ public static Task Success ( this ToastService service , string ? title = null , string ? content = null , bool autoHide = true , bool showClose = true ) => service . Show ( new ToastOption ( )
21
21
{
22
22
Category = ToastCategory . Success ,
23
23
IsAutoHide = autoHide ,
24
24
Title = title ?? "" ,
25
- Content = content ?? ""
25
+ Content = content ?? "" ,
26
+ ShowClose = showClose
26
27
} ) ;
27
28
28
29
/// <summary>
29
30
/// Toast 调用错误快捷方法
30
31
/// </summary>
31
32
/// <param name="service"></param>
32
- /// <param name="title"></param>
33
- /// <param name="content"></param>
34
- /// <param name="autoHide"></param>
35
- /// <returns></returns >
36
- public static Task Error ( this ToastService service , string ? title = null , string ? content = null , bool autoHide = true ) => service . Show ( new ToastOption ( )
33
+ /// <param name="title">Title 属性 </param>
34
+ /// <param name="content">Content 属性 </param>
35
+ /// <param name="autoHide">自动隐藏属性默认为 true </param>
36
+ /// <param name="showClose">是否显示关闭按钮 默认 true</param >
37
+ public static Task Error ( this ToastService service , string ? title = null , string ? content = null , bool autoHide = true , bool showClose = true ) => service . Show ( new ToastOption ( )
37
38
{
38
39
Category = ToastCategory . Error ,
39
40
IsAutoHide = autoHide ,
40
41
Title = title ?? "" ,
41
- Content = content ?? ""
42
+ Content = content ?? "" ,
43
+ ShowClose = showClose
42
44
} ) ;
43
45
44
46
/// <summary>
45
47
/// Toast 调用提示信息快捷方法
46
48
/// </summary>
47
49
/// <param name="service"></param>
48
- /// <param name="title"></param>
49
- /// <param name="content"></param>
50
- /// <param name="autoHide"></param>
51
- /// <returns></returns >
52
- public static Task Information ( this ToastService service , string ? title = null , string ? content = null , bool autoHide = true ) => service . Show ( new ToastOption ( )
50
+ /// <param name="title">Title 属性 </param>
51
+ /// <param name="content">Content 属性 </param>
52
+ /// <param name="autoHide">自动隐藏属性默认为 true </param>
53
+ /// <param name="showClose">是否显示关闭按钮 默认 true</param >
54
+ public static Task Information ( this ToastService service , string ? title = null , string ? content = null , bool autoHide = true , bool showClose = true ) => service . Show ( new ToastOption ( )
53
55
{
54
56
Category = ToastCategory . Information ,
55
57
IsAutoHide = autoHide ,
56
58
Title = title ?? "" ,
57
- Content = content ?? ""
59
+ Content = content ?? "" ,
60
+ ShowClose = showClose
58
61
} ) ;
59
62
60
63
/// <summary>
61
64
/// Toast 调用警告信息快捷方法
62
65
/// </summary>
63
66
/// <param name="service"></param>
64
- /// <param name="title"></param>
65
- /// <param name="content"></param>
66
- /// <param name="autoHide"></param>
67
- /// <returns></returns >
68
- public static Task Warning ( this ToastService service , string ? title = null , string ? content = null , bool autoHide = true ) => service . Show ( new ToastOption ( )
67
+ /// <param name="title">Title 属性 </param>
68
+ /// <param name="content">Content 属性 </param>
69
+ /// <param name="autoHide">自动隐藏属性默认为 true </param>
70
+ /// <param name="showClose">是否显示关闭按钮 默认 true</param >
71
+ public static Task Warning ( this ToastService service , string ? title = null , string ? content = null , bool autoHide = true , bool showClose = true ) => service . Show ( new ToastOption ( )
69
72
{
70
73
Category = ToastCategory . Warning ,
71
74
IsAutoHide = autoHide ,
72
75
Title = title ?? "" ,
73
- Content = content ?? ""
76
+ Content = content ?? "" ,
77
+ ShowClose = showClose
74
78
} ) ;
75
79
}
0 commit comments