-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathtd_cell_page.dart
157 lines (149 loc) · 5.79 KB
/
td_cell_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import 'package:flutter/material.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import '../../base/example_widget.dart';
import '../annotation/demo.dart';
class TDCellPage extends StatelessWidget {
const TDCellPage({super.key});
@override
Widget build(BuildContext context) {
return Container(
color: TDTheme.of(context).grayColor2,
child: ExamplePage(
title: tdTitle(context),
desc: '一行内容/功能的垂直排列方式。一行项目左侧为主要内容展示区域,右侧可增加更多操作内容。',
exampleCodeGroup: 'cell',
children: [
ExampleModule(title: '组件类型', children: [
ExampleItem(
ignoreCode: true,
desc: '单行单元格',
center: false,
builder: (BuildContext context) {
return const CodeWrapper(builder: _buildSimple);
},
),
ExampleItem(
ignoreCode: true,
desc: '多行单元格',
center: false,
builder: (BuildContext context) {
return const CodeWrapper(builder: _buildDesSimple);
},
),
]),
ExampleModule(title: '组件样式', children: [
ExampleItem(
ignoreCode: true,
desc: '卡片单元格',
center: false,
builder: (BuildContext context) {
return const CodeWrapper(builder: _buildCard);
},
),
]),
],
test: [
ExampleItem(
ignoreCode: true,
desc: '自定义内边距-padding',
center: false,
builder: (BuildContext context) {
return const CodeWrapper(builder: _buildPadding);
},
),
],
));
}
}
@Demo(group: 'cell')
Widget _buildSimple(BuildContext context) {
return const TDCellGroup(
cells: [
TDCell(arrow: true, title: '单行标题'),
TDCell(arrow: true, title: '单行标题', required: true),
TDCell(arrow: true, title: '单行标题', noteWidget: TDBadge(TDBadgeType.message, count: '8')),
TDCell(arrow: false, title: '单行标题', rightIconWidget: TDSwitch(isOn: true)),
TDCell(arrow: true, title: '单行标题', note: '辅助信息'),
TDCell(arrow: true, title: '单行标题', leftIcon: TDIcons.lock_on),
TDCell(arrow: false, title: '单行标题'),
],
);
}
@Demo(group: 'cell')
Widget _buildDesSimple(BuildContext context) {
return const TDCellGroup(
cells: [
TDCell(arrow: true, title: '单行标题', description: '一段很长很长的内容文字'),
TDCell(arrow: true, title: '单行标题', description: '一段很长很长的内容文字', required: true),
TDCell(
arrow: true, title: '单行标题', description: '一段很长很长的内容文字', noteWidget: TDBadge(TDBadgeType.message, count: '8')),
TDCell(arrow: false, title: '单行标题', description: '一段很长很长的内容文字', rightIconWidget: TDSwitch(isOn: true)),
TDCell(arrow: true, title: '单行标题', description: '一段很长很长的内容文字', note: '辅助信息'),
TDCell(arrow: true, title: '单行标题', description: '一段很长很长的内容文字一段很长很长的内容文字一段很长很长的内', leftIcon: TDIcons.lock_on),
TDCell(arrow: false, title: '单行标题', description: '一段很长很长的内容文字一段很长很长的内容文字一段很长很长的内'),
TDCell(arrow: false, title: '多行高度不定,长文本自动换行,该选项的描述是一段很长的内容', description: '一段很长很长的内容文字一段很长很长的内容文字一段很长很长的内'),
TDCell(
arrow: true,
title: '多行带头像',
description: '一段很长很长的内容文字',
image: AssetImage('assets/img/td_avatar_1.png'),
),
// NetworkImage('https://tdesign.gtimg.com/mobile/demos/avatar1.png')),
TDCell(
arrow: true,
title: '多行带图片',
description: '一段很长很长的内容文字',
image: AssetImage('assets/img/image.png'),
imageCircle: 8,
),
],
);
}
@Demo(group: 'cell')
Widget _buildCard(BuildContext context) {
return const TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, title: '单行标题'),
TDCell(arrow: true, title: '单行标题', required: true),
TDCell(arrow: true, title: '单行标题'),
],
);
}
@Demo(group: 'cell')
Widget _buildPadding(BuildContext context) {
var style = TDCellStyle.cellStyle(context);
style.padding = const EdgeInsets.all(30);
return TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, title: 'padding-all-30', style: style,),
],
);
}
// @Demo(group: 'cell')
// Widget _buildBorder(BuildContext context) {
// return const TDCellGroup(
// theme: TDCellGroupTheme.cardTheme,
// bordered: true,
// cells: [
// TDCell(arrow: true, title: '单行标题'),
// TDCell(arrow: true, title: '单行标题', required: true),
// TDCell(arrow: true, title: '单行标题'),
// ],
// );
// }
// @Demo(group: 'cell')
// Widget _buildTitle(BuildContext context) {
// var style = TDCellStyle.cellStyle(context);
// style.leftIconColor = TDTheme.of(context).fontGyColor1;
// return TDCellGroup(
// title: '标题',
// style: style,
// cells: const [
// TDCell(title: 'item', leftIcon: TDIcons.app),
// TDCell(title: 'item', leftIcon: TDIcons.app),
// TDCell(title: 'item', leftIcon: TDIcons.app),
// ],
// );
// }