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(Result结果): 新增Result结果组件 #220

Merged
merged 5 commits into from
Aug 24, 2024

Conversation

shinyina
Copy link
Contributor

@shinyina shinyina commented Jul 4, 2024

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

#212

💡 需求背景和解决方案

问题:按照设计稿完成Result组件开发,设计稿地址:https://codesign.qq.com/s/332865
验收标准:
●支持设计稿示例的所有状态
●按照“Result 结果 移动端展示”实现示例页面
●设计走查通过
●演示代码拆分合理、可读性高

基础结果
image
带描述结果
image
自定义结果
image
页面事例
image
api文档
image
代码示例(基础组件)
image

📝 更新日志

  • feat(Result结果): 新增Result结果组件

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • Changelog 已提供或无须提供

@tencent-adm
Copy link
Member

tencent-adm commented Jul 4, 2024

CLA assistant check
All committers have signed the CLA.

@shinyina
Copy link
Contributor Author

shinyina commented Jul 5, 2024

@Luozf12345 辛苦cr

Widget _buildBasicResult(BuildContext context) {
return const Column(
children: const [
TDResult(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里多个示例,可以用CodeWrapper拆成多段演示代码,把ExampleItem的ignoreCode设为true,用户会看得更清晰

@override
Widget build(BuildContext context) {
// 根据主题获取默认的图标组件
Widget displayIcon = _getDefaultIconByTheme(context, theme);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以放到Icon!= null的else分支,减少一次对象创建

font: TDTheme.of(context).fontTitleExtraLarge,
)),
// 如果描述不为空,则显示描述
if (description != null)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以写成(description?.isNotEmpty ?? false),判断会更全面一些

padding: const EdgeInsets.only(top: 17),
child: TDText(
title,
textColor: TDTheme.of(context).fontGyColor1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里最好能透传一个TextStyle,允许用户自定义文字样式

}

@Demo(group: 'result')
Widget _buildBasicResult(BuildContext context) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个示例方法可以拆成_buildBasicResultSuccess/_buildBasicResultError/_buildBasicResultWarning/_buildBasicResultDefault四个方法,分别在上面打上@demo标签。现在这种拆解,演示代码还是一整块_buildBasicResult方法的内容。
你可以先修改一下,本地无法查看生成演示代码的问题,我后面看下怎么解决吧。

}

@Demo(group: 'result')
Widget _buildResultWithDescription(BuildContext context) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个也是同理,需要拆分一下。最好都拆分成类似_buildCustomResult那样比较单一的实例代码。

@Luozf12345 Luozf12345 merged commit 1944fff into Tencent:main Aug 24, 2024
1 of 2 checks passed
@github-actions github-actions bot mentioned this pull request Oct 15, 2024
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants