Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(step): Update TDesign step components #429

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions tdesign-component/example/lib/component_test/step_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

void main() async {
runApp(StepTestApp());
}

class StepTestApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Step Test',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: TestPage(),
);
}
}

class TestPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// 创建水平步骤条的数据
List<TDStepsItemData> horizontalSteps = [
TDStepsItemData(title: Text('Step 1'), content: Text('Horizontal Step 1')),
TDStepsItemData(title: Text('Step 2'), content: Text('Horizontal Step 2')),
TDStepsItemData(title: Text('Step 3'), content: Text('Horizontal Step 3')),
];

// 创建垂直步骤条的数据
List<TDStepsItemData> verticalSteps = [
TDStepsItemData(
title: Text('2024-12-28'),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 隐藏内容 实际可以展示Text
Text('今天是星期六,下面是拍摄的照片'),
Image.asset('assets/img/image.png', width: 100, height: 100),
],
),
),
TDStepsItemData(title: Text('2024-12-29'), content: Text('今天是星期天')),
TDStepsItemData(title: Text('2024-12-30'), content: Text('')),
];

return Scaffold(
appBar: AppBar(
title: Text('TDSteps Test Page'),
),
body: Column(
children: [
// 水平步骤条
Expanded(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: TDSteps(
steps: horizontalSteps,
activeIndex: 1, // 设置当前激活的步骤索引
direction: TDStepsDirection.horizontal, // 设置步骤条方向为水平
status: TDStepsStatus.success, // 设置步骤条状态
),
),
),
// 垂直步骤条
Expanded(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: TDSteps(
steps: verticalSteps,
activeIndex: 1, // 设置当前激活的步骤索引
direction: TDStepsDirection.vertical, // 设置步骤条方向为垂直
status: TDStepsStatus.success, // 设置步骤条状态
),
),
),
],
),
);
}
}
168 changes: 84 additions & 84 deletions tdesign-component/example/lib/page/td_steps_page.dart

Large diffs are not rendered by default.

Loading