Skip to content

Commit 81bc54b

Browse files
authored
Enable use_colored_box lint (flutter#117370)
1 parent 46bb853 commit 81bc54b

File tree

72 files changed

+198
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+198
-194
lines changed

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ linter:
221221
- unrelated_type_equality_checks
222222
- unsafe_html
223223
- use_build_context_synchronously
224-
# - use_colored_box # not yet tested
224+
- use_colored_box
225225
# - use_decorated_box # leads to bugs: DecoratedBox and Container are not equivalent (Container inserts extra padding)
226226
- use_enums
227227
- use_full_hex_values_for_flutter_colors

dev/benchmarks/complex_layout/lib/src/app.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ class ItemGalleryBox extends StatelessWidget {
524524
child: Column(
525525
children: <Widget>[
526526
Expanded(
527-
child: Container(
527+
child: ColoredBox(
528528
color: Theme.of(context).primaryColor,
529529
child: Center(
530530
child: Text(tabName, style: Theme.of(context).textTheme.headlineSmall!.copyWith(color: Colors.white)),

dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class _BackdropFilterPageState extends State<BackdropFilterPage> with TickerProv
9191
child: addBlur(grid(txt, 17, 5), _blurGroup),
9292
),
9393
const SizedBox(height: 20),
94-
Container(
94+
ColoredBox(
9595
color: Colors.white,
9696
child:Row(
9797
mainAxisAlignment: MainAxisAlignment.center,

dev/benchmarks/macrobenchmarks/lib/src/post_backdrop_filter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ class _PostBackdropFilterPageState extends State<PostBackdropFilterPage> with Ti
7474
),
7575
getConditionalBackdrop(),
7676
RepaintBoundary(
77-
child: Container(
77+
child: ColoredBox(
7878
color: Colors.white,
79-
child:Row(
79+
child: Row(
8080
mainAxisAlignment: MainAxisAlignment.center,
8181
children: <Widget>[
8282
const Text('Include BackdropFilter:'),

dev/integration_tests/android_views/lib/wm_integrations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
8888
Widget _statusWidget() {
8989
assert(_lastTestStatus != _LastTestStatus.pending);
9090
final String? message = _lastTestStatus == _LastTestStatus.success ? 'Success' : lastError;
91-
return Container(
91+
return ColoredBox(
9292
color: _lastTestStatus == _LastTestStatus.success ? Colors.green : Colors.red,
9393
child: Text(
9494
message!,

dev/integration_tests/flutter_gallery/lib/demo/animation/home.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
520520

521521
final List<Widget> headings = <Widget>[];
522522
for (int index = 0; index < allSections.length; index++) {
523-
headings.add(Container(
523+
headings.add(ColoredBox(
524524
color: _kAppBackgroundColor,
525525
child: ClipRect(
526526
child: _AllSectionsView(

dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class Tab1RowItem extends StatelessWidget {
214214
),
215215
));
216216
},
217-
child: Container(
217+
child: ColoredBox(
218218
color: CupertinoDynamicColor.resolve(CupertinoColors.systemBackground, context),
219219
child: SafeArea(
220220
top: false,

dev/integration_tests/flutter_gallery/lib/demo/fortnightly/fortnightly.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ over water meant for the whole central valley of California? The story will shoc
9595
return SingleChildScrollView(
9696
child: SafeArea(
9797
top: false,
98-
child: Container(
98+
child: ColoredBox(
9999
color: Theme.of(context).colorScheme.surface,
100100
child: Column(
101101
children: <Widget>[

dev/integration_tests/flutter_gallery/lib/demo/material/backdrop_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ class _BackdropDemoState extends State<BackdropDemo> with SingleTickerProviderSt
358358
);
359359
}).toList();
360360

361-
return Container(
361+
return ColoredBox(
362362
key: _backdropKey,
363363
color: theme.primaryColor,
364364
child: Stack(

dev/integration_tests/flutter_gallery/lib/demo/material/leave_behind_demo.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,15 @@ class _LeaveBehindListItem extends StatelessWidget {
243243
}
244244
return false;
245245
},
246-
background: Container(
246+
background: ColoredBox(
247247
color: theme.primaryColor,
248248
child: const Center(
249249
child: ListTile(
250250
leading: Icon(Icons.delete, color: Colors.white, size: 36.0),
251251
),
252252
),
253253
),
254-
secondaryBackground: Container(
254+
secondaryBackground: ColoredBox(
255255
color: theme.primaryColor,
256256
child: const Center(
257257
child: ListTile(

0 commit comments

Comments
 (0)