gjh дней назад: 5
Родитель
Сommit
6d4290d01c
2 измененных файлов с 72 добавлено и 0 удалено
  1. 36 0
      lib/widget/empty_widget.dart
  2. 36 0
      lib/widget/loading_widget.dart

+ 36 - 0
lib/widget/empty_widget.dart

@@ -0,0 +1,36 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+
4
+///无数据Widget
5
+class EmptyWidget extends StatelessWidget {
6
+  final Widget? icon;
7
+  final String? text;
8
+
9
+  const EmptyWidget({super.key, this.text, this.icon});
10
+
11
+  @override
12
+  Widget build(BuildContext context) {
13
+    return Center(
14
+      child: Row(
15
+        mainAxisSize: MainAxisSize.min,
16
+        crossAxisAlignment: CrossAxisAlignment.center,
17
+        children: [
18
+          icon == null
19
+              ? Icon(
20
+                  Icons.sentiment_dissatisfied,
21
+                  size: 35.r,
22
+                )
23
+              : icon!,
24
+          SizedBox(
25
+            width: 10.w,
26
+          ),
27
+          text == null
28
+              ? SizedBox()
29
+              : Text(
30
+                  text!,
31
+                )
32
+        ],
33
+      ),
34
+    );
35
+  }
36
+}

+ 36 - 0
lib/widget/loading_widget.dart

@@ -0,0 +1,36 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+
4
+///加载Widget
5
+class LoadingWidget extends StatelessWidget {
6
+  final Widget? icon;
7
+  final String? text;
8
+
9
+  const LoadingWidget({super.key, this.text, this.icon});
10
+
11
+  @override
12
+  Widget build(BuildContext context) {
13
+    return Center(
14
+      child: Row(
15
+        mainAxisSize: MainAxisSize.min,
16
+        crossAxisAlignment: CrossAxisAlignment.center,
17
+        children: [
18
+          icon == null
19
+              ? Icon(
20
+                  Icons.downloading,
21
+                  size: 35.r,
22
+                )
23
+              : icon!,
24
+          SizedBox(
25
+            width: 10.w,
26
+          ),
27
+          text == null
28
+              ? SizedBox()
29
+              : Text(
30
+                  text!,
31
+                )
32
+        ],
33
+      ),
34
+    );
35
+  }
36
+}