Skip to content

Commit ed160c9

Browse files
committed
test: add file for tests
1 parent 266bcdb commit ed160c9

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Check the `avoid_hardcoded_color` rule.
2+
//
3+
// This file ends with the name `_test.dart`,
4+
// so it should be exempt from the warning.
5+
6+
import 'package:flutter/material.dart';
7+
8+
class MyWidget extends StatelessWidget {
9+
const MyWidget({super.key});
10+
11+
@override
12+
Widget build(BuildContext context) {
13+
return Column(
14+
children: [
15+
const ColoredBox(color: Color(0xFF00FF00)),
16+
const ColoredBox(color: Color.fromRGBO(0, 255, 0, 1)),
17+
const ColoredBox(color: Colors.green),
18+
ColoredBox(color: Theme.of(context).colorScheme.primary),
19+
ColoredBox(color: _colorScheme.primary),
20+
const ColoredBox(color: Colors.transparent),
21+
],
22+
);
23+
}
24+
}
25+
26+
ColorScheme get _colorScheme => const ColorScheme.dark(
27+
primary: Color.fromRGBO(0, 255, 0, 1),
28+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Check the `avoid_hardcoded_color` rule.
2+
//
3+
// It should exclude warnings for the entire `test` directory.
4+
5+
import 'package:flutter/material.dart';
6+
7+
class MyWidget extends StatelessWidget {
8+
const MyWidget({super.key});
9+
10+
@override
11+
Widget build(BuildContext context) {
12+
return Column(
13+
children: [
14+
const ColoredBox(color: Color(0xFF00FF00)),
15+
const ColoredBox(color: Color.fromRGBO(0, 255, 0, 1)),
16+
const ColoredBox(color: Colors.green),
17+
ColoredBox(color: Theme.of(context).colorScheme.primary),
18+
ColoredBox(color: _colorScheme.primary),
19+
const ColoredBox(color: Colors.transparent),
20+
],
21+
);
22+
}
23+
}
24+
25+
ColorScheme get _colorScheme => const ColorScheme.dark(
26+
primary: Color.fromRGBO(0, 255, 0, 1),
27+
);

0 commit comments

Comments
 (0)