49 lines
938 B
Dart
49 lines
938 B
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:plan/widgets/ui_kit/empty/index.dart';
|
|
|
|
class LoadingBox extends StatelessWidget {
|
|
final bool loading;
|
|
final bool isEmpty;
|
|
final Widget child;
|
|
|
|
const LoadingBox({
|
|
super.key,
|
|
required this.loading,
|
|
required this.isEmpty,
|
|
required this.child,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
///加载中
|
|
if (loading) {
|
|
return SliverFillRemaining(
|
|
child: Center(
|
|
child: CupertinoActivityIndicator(
|
|
radius: 14,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
///空状态
|
|
if (isEmpty) {
|
|
return SliverFillRemaining(
|
|
child: Empty(
|
|
title: "No data",
|
|
),
|
|
);
|
|
}
|
|
|
|
///正常
|
|
return SliverToBoxAdapter(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 15),
|
|
child: Container(
|
|
child: child,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|