提交 b809290a authored 作者: shixiaochen's avatar shixiaochen

1、优化StateLayout控件(修改列表空省图展示逻辑)

上级 90787f8c
...@@ -34,7 +34,7 @@ class _StateLayoutState extends State<StateLayout> { ...@@ -34,7 +34,7 @@ class _StateLayoutState extends State<StateLayout> {
} }
Widget _loadingWidget() { Widget _loadingWidget() {
return Column( return const Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
...@@ -46,19 +46,19 @@ class _StateLayoutState extends State<StateLayout> { ...@@ -46,19 +46,19 @@ class _StateLayoutState extends State<StateLayout> {
Widget _otherWidget() { Widget _otherWidget() {
switch (widget.type) { switch (widget.type) {
case StateType.network: case StateType.network:
return _buildNormalView(widget.errorImg ?? '', '无网络连接'); return _buildNormalView(widget.errorImg, '无网络连接');
case StateType.loading: case StateType.loading:
return Container(); return Container();
case StateType.empty: case StateType.empty:
return _buildNormalView(widget.emptyImg ?? '', widget.hintText ?? '暂无数据'); return _buildNormalView(widget.emptyImg, widget.hintText ?? '暂无数据');
case StateType.error: case StateType.error:
return _buildNormalView(widget.errorImg ?? '', '加载失败,请点击重试'); return _buildNormalView(widget.errorImg, '加载失败,请点击重试');
case StateType.success: case StateType.success:
return Container(); return Container();
} }
} }
Widget _buildNormalView(String img, String hintText) { Widget _buildNormalView(String? img, String hintText) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (widget.onRefresh != null) { if (widget.onRefresh != null) {
...@@ -70,11 +70,11 @@ class _StateLayoutState extends State<StateLayout> { ...@@ -70,11 +70,11 @@ class _StateLayoutState extends State<StateLayout> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
const SizedBox(height: 30.0), const SizedBox(height: 30.0),
ImageWidget.loadAssetImage( img != null && img.isNotEmpty ?ImageWidget.loadAssetImage(
img, img,
width: 133.5*2, width: 133.5*2,
height: 95*2, height: 95*2,
), ): const SizedBox(),
Text( Text(
hintText, hintText,
style: const TextStyle( style: const TextStyle(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论