addEmptyChildren method

List<Widget> addEmptyChildren(
  1. BuildContext context
)

添加空子组件列表

Implementation

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

  list.add(emptyImage ??
      Image.asset(
        'assets/images/ic_result_empty.webp',
        package: 'flutter_empty',
        width: imageSize,
        height: imageSize,
      ));
  list.add(const Gap(4));
  if (emptyTitle != null) {
    list.add(emptyTitle!);
    list.add(const Gap(4));
  }
  if (emptyContent != null) {
    list.add(emptyContent!);
    list.add(const Gap(4));
  }
  list.add(ElevatedButton(
    onPressed: emptyPressed,
    child: emptyButtonChild ??
        const Text(
          '再试一次',
        ),
    style: emptyButtonStyle ?? (buttonStyle ?? (ElevatedButton.styleFrom())),
  ));

  return list;
}