createEmptyView method
创建空视图,子类可override自定义
Implementation
@protected
Widget createEmptyView(
BuildContext context, VM viewModel, ViewStateController controller) {
return SimpleWidget(
width: double.infinity,
height: double.infinity,
onTap: onEmptyViewTap,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'packages/yxr_flutter_basic/lib/images/status_default_empty.png',
width: 180,
height: 180,
fit: BoxFit.cover,
),
Container(
margin: const EdgeInsets.only(top: 16),
child: Text(
controller.hintTxt ?? "未获取到相关内容~",
style: const TextStyle(fontSize: 14, color: Color(0xff999999)),
),
),
Container(
margin: const EdgeInsets.only(top: 24),
child: ElevatedButton(
onPressed: () => viewModel.onRetry(),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
elevation: 5,
padding: const EdgeInsets.only(
left: 16,
top: 10,
right: 16,
bottom: 10,
),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(24))),
),
child: Text(
controller.retryTxt ?? "重新加载",
style: const TextStyle(fontSize: 14, color: Colors.white),
),
),
)
],
),
);
}