File tree Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export '../widget/builder/fade_image_builder.dart';
28
28
export '../widget/builder/image_page_builder.dart' ;
29
29
export '../widget/builder/video_page_builder.dart' ;
30
30
export '../widget/fixed_appbar.dart' ;
31
+ export '../widget/gaps.dart' ;
31
32
export '../widget/platform_progress_indicator.dart' ;
32
33
33
34
export 'colors.dart' ;
Original file line number Diff line number Diff line change
1
+ ///
2
+ /// [Author] Alex (https://github.com/AlexV525)
3
+ /// [Date] 2020/10/27 17:14
4
+ ///
5
+ import 'package:flutter/material.dart' ;
6
+
7
+ class Gap extends StatelessWidget {
8
+ const Gap .h (
9
+ double width, {
10
+ Key ? key,
11
+ double ? height,
12
+ this .color,
13
+ }) : _width = width,
14
+ _height = height,
15
+ super (key: key);
16
+
17
+ const Gap .v (
18
+ double height, {
19
+ Key ? key,
20
+ double ? width,
21
+ this .color,
22
+ }) : _width = width,
23
+ _height = height,
24
+ super (key: key);
25
+
26
+ final double ? _width;
27
+ final double ? _height;
28
+ final Color ? color;
29
+
30
+ @override
31
+ Widget build (BuildContext context) {
32
+ Widget _w = SizedBox (width: _width, height: _height);
33
+ if (color != null ) {
34
+ _w = ColoredBox (color: color! , child: _w);
35
+ }
36
+ return _w;
37
+ }
38
+ }
39
+
40
+ class SliverGap extends StatelessWidget {
41
+ const SliverGap .h (
42
+ double width, {
43
+ Key ? key,
44
+ double ? height,
45
+ this .color,
46
+ }) : _width = width,
47
+ _height = height,
48
+ super (key: key);
49
+
50
+ const SliverGap .v (
51
+ double height, {
52
+ Key ? key,
53
+ double ? width,
54
+ this .color,
55
+ }) : _width = width,
56
+ _height = height,
57
+ super (key: key);
58
+
59
+ final double ? _width;
60
+ final double ? _height;
61
+ final Color ? color;
62
+
63
+ @override
64
+ Widget build (BuildContext context) {
65
+ Widget child;
66
+ if (_width != null ) {
67
+ child = Gap .h (_width! , height: _height, color: color);
68
+ } else if (_height != null ) {
69
+ child = Gap .v (_height! , width: _width, color: color);
70
+ } else {
71
+ child = const SizedBox .shrink ();
72
+ }
73
+ return SliverToBoxAdapter (child: child);
74
+ }
75
+ }
You can’t perform that action at this time.
0 commit comments