This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 258
/
example.dart
119 lines (100 loc) · 2.41 KB
/
example.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
class MyWidget extends StatelessWidget {
Widget build(BuildContext context) => Column(children: [
const Container(border: Border.fromBorderSide(BorderSide())),
Container(border: Border.all()), // LINT
Container(
border: Border.all(
color: const Color(0),
),
), // LINT
Container(
border: Border.all(
color: const Color(0),
width: 1,
),
), // LINT
Container(
border: Border.all(
color: const Color(0),
width: 1,
style: BorderStyle.none,
),
), // LINT
Container(
border: Border.all(
color: const Color(0),
width: foo(),
style: BorderStyle.none,
),
),
Container(
border: Border.all(
color: Theme.of(context).color,
),
),
Container(
border: Border.all(
color: const Color(0),
width: someBool ? 1 : 0,
style: BorderStyle.none,
),
),
Container(
border: Border.all(
color: const Color(0),
width: someInt,
style: BorderStyle.none,
),
),
]);
var someBool = false;
var someInt = 5;
double foo() => 20.0;
}
class Border {
factory Border.all({
Color color = const Color(0xFF000000),
double width = 1.0,
BorderStyle style = BorderStyle.solid,
}) {
final side = BorderSide(color: color, width: width, style: style);
return Border.fromBorderSide(side);
}
const Border.fromBorderSide(BorderSide _);
}
enum BorderStyle {
none,
solid,
}
class BorderSide {
final Color color;
final double width;
final BorderStyle style;
const BorderSide({
this.color = const Color(0xFF000000),
this.width = 1.0,
this.style = BorderStyle.solid,
});
}
class Color {
final int value;
const Color(int value) : value = value & 0xFFFFFFFF;
}
class Container extends Widget {
final Widget? child;
final Border? border;
const Container({this.child, this.border});
}
class Column extends Widget {
final List<Widget> children;
Column({required this.children});
}
class StatelessWidget extends Widget {}
class Widget {
const Widget();
}
class BuildContext {}
class Theme {
const color = Color(0);
static Color of(BuildContext context) => color;
}