mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Avoid allocation of large canvases on the web (#1557)
This commit is contained in:
@@ -252,10 +252,12 @@ class ColorGroup extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
children: children,
|
||||
return RepaintBoundary(
|
||||
child: Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
children: children,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1910,39 +1910,42 @@ class ComponentDecoration extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(label, style: Theme.of(context).textTheme.titleSmall),
|
||||
Tooltip(
|
||||
message: tooltipMessage,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5.0),
|
||||
child: Icon(Icons.info_outline, size: 16)),
|
||||
),
|
||||
],
|
||||
),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints.tightFor(width: widthConstraint),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
return RepaintBoundary(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(label, style: Theme.of(context).textTheme.titleSmall),
|
||||
Tooltip(
|
||||
message: tooltipMessage,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5.0),
|
||||
child: Icon(Icons.info_outline, size: 16)),
|
||||
),
|
||||
],
|
||||
),
|
||||
ConstrainedBox(
|
||||
constraints:
|
||||
const BoxConstraints.tightFor(width: widthConstraint),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: child,
|
||||
),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user