createErrorView method
创建错误视图,子类可override自定义
Implementation
@protected
Widget createErrorView(
BuildContext context,
VM viewModel,
ViewStateController controller,
) {
return SimpleWidget(
width: double.infinity,
height: double.infinity,
onTap: onErrorViewTap(),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'packages/yxr_flutter_basic/lib/images/status_default_nonetwork.png',
width: 144,
height: 115,
fit: BoxFit.cover,
),
Container(
margin: const EdgeInsets.only(top: 24),
child: Text(
textAlign: TextAlign.center,
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),
),
),
)
],
),
);
}