Skip to content

Commit c2e3ccb

Browse files
boywithdvriscait
andauthored
fix: Add stack to avoid_single_child (#57)
* fix: Add stack to avoid_single_child * fix: Make corrections according to the regularity of other texts * Update packages/altive_lints/lib/src/lints/avoid_single_child.dart Co-authored-by: Ryunosuke Muramatsu <[email protected]> * fix: Correction to Hello from the World * Update packages/altive_lints/lib/src/lints/avoid_single_child.dart Co-authored-by: Ryunosuke Muramatsu <[email protected]> --------- Co-authored-by: Ryunosuke Muramatsu <[email protected]>
1 parent b8eeef2 commit c2e3ccb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/altive_lints/lib/src/lints/avoid_single_child.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:custom_lint_builder/custom_lint_builder.dart';
66
/// An `avoid_single_child` rule that warns against using layout
77
/// widgets intended for multiple children with only one child.
88
///
9-
/// This includes widgets like `Column`,`Row`, `Flex`, `Wrap`,
9+
/// This includes widgets like `Column`, `Row`, `Stack`, `Flex`, `Wrap`,
1010
/// `ListView`, and `SliverList`.
1111
///
1212
/// Using these widgets with a single child can lead to
@@ -57,6 +57,7 @@ class AvoidSingleChild extends DartLintRule {
5757
'Row',
5858
'Flex',
5959
'Wrap',
60+
'Stack',
6061
'ListView',
6162
'SliverList',
6263
].contains(className)) {

packages/altive_lints/lint_test/lints/avoid_single_child.dart

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ class MyWidget extends StatelessWidget {
3636
],
3737
),
3838
// expect_lint: avoid_single_child
39+
const Stack(
40+
children: [
41+
Text('Hello'),
42+
],
43+
),
44+
// expect_lint: avoid_single_child
3945
ListView(
4046
children: const [
4147
Text('Hello'),
@@ -44,7 +50,7 @@ class MyWidget extends StatelessWidget {
4450
// expect_lint: avoid_single_child
4551
SliverList.list(
4652
children: const [
47-
Text('World'),
53+
Text('Hello'),
4854
],
4955
),
5056
// expect_lint: avoid_single_child

0 commit comments

Comments
 (0)