Skip to content

Commit 643fbd1

Browse files
committed
修复Animate,增加duration参数,增加数值检查
1 parent 99f46ca commit 643fbd1

File tree

3 files changed

+147
-298
lines changed

3 files changed

+147
-298
lines changed

tdesign-component/example/lib/page/td_progress_page.dart

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'dart:async';
22

33
import 'package:flutter/material.dart';
4-
import 'package:flutter/widgets.dart';
54
import 'package:tdesign_flutter/tdesign_flutter.dart';
65

76
import '../annotation/demo.dart';
@@ -96,32 +95,32 @@ class _TDProgressPageState extends State<TDProgressPage> {
9695

9796
@Demo(group: 'progress')
9897
Widget _buildRightLabelLinear(BuildContext context) {
99-
return const TDProgress(
100-
type: TDProgressType.linear,
98+
return TDProgress(
99+
type: ProgressType.linear,
101100
value: 0.8,
102101
strokeWidth: 6,
103-
progressLabelPosition: TDProgressLabelPosition.right);
102+
progressLabelPosition: ProgressLabelPosition.right);
104103
}
105104

106105
@Demo(group: 'progress')
107106
Widget _buildInsideLabelLinear(BuildContext context) {
108-
return const TDProgress(type: TDProgressType.linear, value: 0.8);
107+
return TDProgress(type: ProgressType.linear, value: 0.8);
109108
}
110109

111110
@Demo(group: 'progress')
112111
Widget _buildCircle(BuildContext context) {
113-
return const TDProgress(type: TDProgressType.circular, value: 0.3);
112+
return TDProgress(type: ProgressType.circular, value: 0.3);
114113
}
115114

116115
@Demo(group: 'progress')
117116
Widget _buildMicro(BuildContext context) {
118-
return const TDProgress(type: TDProgressType.micro, value: 0.75);
117+
return TDProgress(type: ProgressType.micro, value: 0.75);
119118
}
120119

121120
@Demo(group: 'progress')
122121
Widget _buildButton(BuildContext context) {
123122
return TDProgress(
124-
type: TDProgressType.button,
123+
type: ProgressType.button,
125124
onTap: _toggleProgress,
126125
onLongPress: _resetProgress,
127126
value: progressValue,
@@ -134,15 +133,15 @@ class _TDProgressPageState extends State<TDProgressPage> {
134133
mainAxisAlignment: MainAxisAlignment.start,
135134
children: [
136135
TDProgress(
137-
type: TDProgressType.micro,
136+
type: ProgressType.micro,
138137
value: microProgressValue,
139138
onTap: _toggleMicroProgress,
140139
label: TDIconLabel(isPlaying ? Icons.pause : Icons.play_arrow,
141140
color: TDTheme.of(context).brandNormalColor),
142141
),
143142
const SizedBox(width: 10),
144143
TDProgress(
145-
type: TDProgressType.micro,
144+
type: ProgressType.micro,
146145
value: microProgressValue,
147146
onTap: _resetMicroProgress,
148147
label: TDIconLabel(Icons.stop,
@@ -154,73 +153,73 @@ class _TDProgressPageState extends State<TDProgressPage> {
154153

155154
@Demo(group: 'progress')
156155
Widget _buildPrimary(BuildContext context) {
157-
return const TDProgress(
158-
type: TDProgressType.linear,
159-
progressStatus: TDProgressStatus.primary,
156+
return TDProgress(
157+
type: ProgressType.linear,
158+
progressStatus: ProgressStatus.primary,
160159
value: 0.8,
161160
strokeWidth: 6,
162-
progressLabelPosition: TDProgressLabelPosition.right);
161+
progressLabelPosition: ProgressLabelPosition.right);
163162
}
164163

165164
@Demo(group: 'progress')
166165
Widget _buildWarning(BuildContext context) {
167-
return const TDProgress(
168-
type: TDProgressType.linear,
169-
progressStatus: TDProgressStatus.warning,
166+
return TDProgress(
167+
type: ProgressType.linear,
168+
progressStatus: ProgressStatus.warning,
170169
value: 0.8,
171170
strokeWidth: 6,
172-
progressLabelPosition: TDProgressLabelPosition.right);
171+
progressLabelPosition: ProgressLabelPosition.right);
173172
}
174173

175174
@Demo(group: 'progress')
176175
Widget _buildDanger(BuildContext context) {
177-
return const TDProgress(
178-
type: TDProgressType.linear,
179-
progressStatus: TDProgressStatus.danger,
176+
return TDProgress(
177+
type: ProgressType.linear,
178+
progressStatus: ProgressStatus.danger,
180179
value: 0.8,
181180
strokeWidth: 6,
182-
progressLabelPosition: TDProgressLabelPosition.right);
181+
progressLabelPosition: ProgressLabelPosition.right);
183182
}
184183

185184
@Demo(group: 'progress')
186185
Widget _buildSuccess(BuildContext context) {
187-
return const TDProgress(
188-
type: TDProgressType.linear,
189-
progressStatus: TDProgressStatus.success,
186+
return TDProgress(
187+
type: ProgressType.linear,
188+
progressStatus: ProgressStatus.success,
190189
value: 0.8,
191190
strokeWidth: 6,
192-
progressLabelPosition: TDProgressLabelPosition.right);
191+
progressLabelPosition: ProgressLabelPosition.right);
193192
}
194193

195194
@Demo(group: 'progress')
196195
Widget _buildCirclePrimary(BuildContext context) {
197-
return const TDProgress(
198-
type: TDProgressType.circular,
199-
progressStatus: TDProgressStatus.primary,
196+
return TDProgress(
197+
type: ProgressType.circular,
198+
progressStatus: ProgressStatus.primary,
200199
value: 0.3);
201200
}
202201

203202
@Demo(group: 'progress')
204203
Widget _buildCircleWarning(BuildContext context) {
205-
return const TDProgress(
206-
type: TDProgressType.circular,
207-
progressStatus: TDProgressStatus.warning,
204+
return TDProgress(
205+
type: ProgressType.circular,
206+
progressStatus: ProgressStatus.warning,
208207
value: 0.3);
209208
}
210209

211210
@Demo(group: 'progress')
212211
Widget _buildCircleDanger(BuildContext context) {
213-
return const TDProgress(
214-
type: TDProgressType.circular,
215-
progressStatus: TDProgressStatus.danger,
212+
return TDProgress(
213+
type: ProgressType.circular,
214+
progressStatus: ProgressStatus.danger,
216215
value: 0.3);
217216
}
218217

219218
@Demo(group: 'progress')
220219
Widget _buildCircleSuccess(BuildContext context) {
221-
return const TDProgress(
222-
type: TDProgressType.circular,
223-
progressStatus: TDProgressStatus.success,
220+
return TDProgress(
221+
type: ProgressType.circular,
222+
progressStatus: ProgressStatus.success,
224223
value: 1);
225224
}
226225

0 commit comments

Comments
 (0)