-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathtd_empty_page.dart
65 lines (58 loc) · 1.78 KB
/
td_empty_page.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import 'package:flutter/material.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import '../annotation/demo.dart';
import '../base/example_widget.dart';
class TDEmptyPage extends StatefulWidget {
const TDEmptyPage({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => _TDEmptyPageState();
}
class _TDEmptyPageState extends State<TDEmptyPage> {
@override
Widget build(BuildContext context) {
return ExamplePage(
title: tdTitle(),
exampleCodeGroup: 'empty',
desc: '用于空状态时的占位提示。',
children: [
ExampleModule(
title: '组件类型',
children: [
ExampleItem(desc: '图标空状态', builder: _iconEmpty),
ExampleItem(desc: '自定义图片空状态', builder: _imageEmpty),
ExampleItem(desc: '带操作空状态', builder: _operationEmpty),
]
),
]);
}
@Demo(group: 'empty')
Widget _iconEmpty(BuildContext context) {
return const TDEmpty(
type: TDEmptyType.plain,
emptyText: '描述文字',
);
}
@Demo(group: 'empty')
Widget _imageEmpty(BuildContext context) {
return TDEmpty(
type: TDEmptyType.plain,
emptyText: '描述文字',
image: Container(
width: 120,
height: 120,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(TDTheme.of(context).radiusDefault),
image: const DecorationImage(image: AssetImage('assets/img/empty.png'))
),
),
);
}
@Demo(group: 'empty')
Widget _operationEmpty(BuildContext context) {
return const TDEmpty(
type: TDEmptyType.operation,
operationText: '操作按钮',
emptyText: '描述文字',
);
}
}