Skip to content

Commit 648a482

Browse files
add md
1 parent 8ae5dd9 commit 648a482

File tree

4 files changed

+96
-1
lines changed

4 files changed

+96
-1
lines changed

flutter_app_upgrade/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: flutter_app_upgrade
22
description: App 升级功能
33
version: 1.1.0
4-
homepage: https://github.com/781238222/flutter-do/tree/master/flutter_app_upgrade
4+
homepage: http://laomengit.com/plugin/upgrade.html
55

66
environment:
77
sdk: ">=2.1.0 <3.0.0"

md/widgets/img/AboutDialog/123.png

71.9 KB
Loading

md/widgets/img/AboutDialog/213.png

68.5 KB
Loading

md/widgets/md/AboutDialog.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: 'AboutDialog'
3+
description: '关于对话框,包含应用程序的图标,名称,版本号和版权,以及用于显示该应用程序使用的软件的许可证的按钮'
4+
type: widgets
5+
6+
---
7+
8+
# AboutDialog
9+
10+
AboutDialog用于描述当前App信息,底部提供2个按钮:查看许可按钮和关闭按钮。AboutDialog需要和showAboutDialog配合使用,用法如下:
11+
12+
```dart
13+
showAboutDialog(
14+
context: context,
15+
applicationIcon: Image.asset(
16+
'images/bird.png',
17+
height: 100,
18+
width: 100,
19+
),
20+
applicationName: '应用程序',
21+
applicationVersion: '1.0.0',
22+
applicationLegalese: 'copyright 老孟,一枚有态度的程序员',
23+
children: <Widget>[
24+
Container(
25+
height: 30,
26+
color: Colors.red,
27+
),
28+
Container(
29+
height: 30,
30+
color: Colors.blue,
31+
),
32+
Container(
33+
height: 30,
34+
color: Colors.green,
35+
)
36+
],
37+
);
38+
```
39+
40+
效果如下:
41+
42+
![](../img/AboutDialog/213.png)
43+
44+
45+
46+
47+
48+
49+
50+
属性说明如下:
51+
52+
- `applicationIcon`:应用程序的图标。
53+
- `applicationName`:应用程序名称。
54+
- `applicationVersion`:应用程序版本。
55+
- `applicationLegalese`:著作权(copyright)的提示。
56+
- `children`:位置如上图的红蓝绿色的位置。
57+
58+
所有的属性都需要手动设置,不是自动获取的。
59+
60+
下面的2个按钮根据应用程序支持的语言显示相应的语言,比如显示中文方法如下:
61+
62+
1.`pubspec.yaml`中配置支持国际化:
63+
64+
```dart
65+
dependencies:
66+
flutter:
67+
sdk: flutter
68+
flutter_localizations:
69+
sdk: flutter
70+
```
71+
72+
2. 在MaterialApp中配置当前区域:
73+
74+
```dart
75+
MaterialApp(
76+
title: 'Flutter Demo',
77+
localizationsDelegates: [
78+
GlobalMaterialLocalizations.delegate,
79+
GlobalWidgetsLocalizations.delegate,
80+
],
81+
supportedLocales: [
82+
const Locale('zh', 'CH'),
83+
const Locale('en', 'US'),
84+
],
85+
locale: Locale('zh'),
86+
...
87+
)
88+
```
89+
90+
此时效果:
91+
92+
![](../img/AboutDialog/123.png)
93+
94+
此时点击查看许将会调用`showLicensePage`,相关效果可以查看`showLicensePage`
95+

0 commit comments

Comments
 (0)