1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 23:08:59 +00:00

Avoid allocation of large canvases on the web (#1557)

This commit is contained in:
Mouad Debbar
2023-01-12 15:56:11 +00:00
committed by GitHub
parent 6fbc6fef7a
commit 4f059e686e
2 changed files with 39 additions and 34 deletions

View File

@@ -252,11 +252,13 @@ class ColorGroup extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
return RepaintBoundary(
child: Card(
clipBehavior: Clip.antiAlias,
child: Column(
children: children,
),
),
);
}
}

View File

@@ -1910,7 +1910,8 @@ class ComponentDecoration extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
return RepaintBoundary(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: Column(
children: [
@@ -1927,7 +1928,8 @@ class ComponentDecoration extends StatelessWidget {
],
),
ConstrainedBox(
constraints: const BoxConstraints.tightFor(width: widthConstraint),
constraints:
const BoxConstraints.tightFor(width: widthConstraint),
child: Card(
elevation: 0,
shape: RoundedRectangleBorder(
@@ -1944,6 +1946,7 @@ class ComponentDecoration extends StatelessWidget {
),
],
),
),
);
}
}