-
Notifications
You must be signed in to change notification settings - Fork 97
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
Conversation
@Luozf12345 辛苦cr |
Widget _buildBasicResult(BuildContext context) { | ||
return const Column( | ||
children: const [ | ||
TDResult( |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个也是同理,需要拆分一下。最好都拆分成类似_buildCustomResult那样比较单一的实例代码。
🤔 这个 PR 的性质是?
🔗 相关 Issue
#212
💡 需求背景和解决方案
问题:按照设计稿完成Result组件开发,设计稿地址:https://codesign.qq.com/s/332865
验收标准:
●支持设计稿示例的所有状态
●按照“Result 结果 移动端展示”实现示例页面
●设计走查通过
●演示代码拆分合理、可读性高
基础结果
带描述结果
自定义结果
页面事例
api文档
代码示例(基础组件)
📝 更新日志
feat(Result结果): 新增Result结果组件
本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单