addErrorChildren method

List<Widget> addErrorChildren(
  1. BuildContext context
)

添加错误子组件列表

Implementation

List<Widget> addErrorChildren(BuildContext context) {
  final list = <Widget>[];

  list.add(errorImage ??
      Image.asset(
        'assets/images/ic_result_network.webp',
        package: 'flutter_empty',
        width: imageSize,
        height: imageSize,
      ));
  list.add(const Gap(4));
  if (errorTitle != null) {
    list.add(errorTitle!);
    list.add(const Gap(4));
  }
  if (errorContent != null) {
    list.add(errorContent!);
    list.add(const Gap(4));
  }
  list.add(ElevatedButton(
    onPressed: errorPressed,
    child: errorButtonChild ??
        const Text(
          '再试一次',
        ),
    style: errorButtonStyle ?? (buttonStyle ?? (ElevatedButton.styleFrom())),
  ));

  return list;
}