Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit e799380

Browse files
committed
test: fix tests
1 parent 6163c3b commit e799380

File tree

2 files changed

+57
-17
lines changed

2 files changed

+57
-17
lines changed

test/src/analyzers/lint_analyzer/rules/rules_list/avoid_border_all/avoid_border_all_rule_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import '../../../../../helpers/rule_test_helper.dart';
66

77
const _examplePath = 'avoid_border_all/examples/example.dart';
88
const _exampleWithVariablesPath =
9-
'avoid_border_all/examples/example_with_variables..dart';
9+
'avoid_border_all/examples/example_with_final_variables.dart';
1010

1111
void main() {
1212
group('AvoidBorderAllRule', () {
Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,63 @@
1-
import 'package:flutter/material.dart';
2-
3-
void main() {
4-
runApp(const MyApp());
5-
}
6-
71
class MyApp extends StatelessWidget {
8-
const MyApp({Key? key}) : super(key: key);
9-
102
@override
113
Widget build(BuildContext context) {
12-
final boolean = MediaQuery.of(context).size.width > 300;
13-
final aLocalColor = boolean ? Colors.red : Colors.black;
14-
15-
return MaterialApp(
16-
home: Container(
17-
decoration: BoxDecoration(
18-
border: Border.all(color: aLocalColor),
19-
),
4+
final aLocalColor = true ? Colors.red : Colors.black;
5+
6+
return Container(
7+
decoration: BoxDecoration(
8+
border: Border.all(color: aLocalColor),
209
),
2110
);
2211
}
2312
}
13+
14+
enum Colors {
15+
red,
16+
black,
17+
}
18+
19+
class Border {
20+
factory Border.all({
21+
Color color = const Color(0xFF000000),
22+
double width = 1.0,
23+
BorderStyle style = BorderStyle.solid,
24+
}) {
25+
final side = BorderSide(color: color, width: width, style: style);
26+
27+
return Border.fromBorderSide(side);
28+
}
29+
30+
const Border.fromBorderSide(BorderSide _);
31+
}
32+
33+
enum BorderStyle {
34+
none,
35+
solid,
36+
}
37+
38+
class BorderSide {
39+
final Color color;
40+
final double width;
41+
final BorderStyle style;
42+
43+
const BorderSide({
44+
this.color = const Color(0xFF000000),
45+
this.width = 1.0,
46+
this.style = BorderStyle.solid,
47+
});
48+
}
49+
50+
class Container extends Widget {
51+
final Widget? child;
52+
final Border? border;
53+
54+
const Container({this.child, this.border});
55+
}
56+
57+
class StatelessWidget extends Widget {}
58+
59+
class Widget {
60+
const Widget();
61+
}
62+
63+
class BuildContext {}

0 commit comments

Comments
 (0)