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

pull/1560/head
Mouad Debbar 2 years ago committed by GitHub
parent 6fbc6fef7a
commit 4f059e686e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -1910,39 +1910,42 @@ class ComponentDecoration extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return RepaintBoundary(
padding: const EdgeInsets.symmetric(vertical: 10.0), child: Padding(
child: Column( padding: const EdgeInsets.symmetric(vertical: 10.0),
children: [ child: Column(
Row( children: [
mainAxisAlignment: MainAxisAlignment.center, Row(
children: [ mainAxisAlignment: MainAxisAlignment.center,
Text(label, style: Theme.of(context).textTheme.titleSmall), children: [
Tooltip( Text(label, style: Theme.of(context).textTheme.titleSmall),
message: tooltipMessage, Tooltip(
child: const Padding( message: tooltipMessage,
padding: EdgeInsets.symmetric(horizontal: 5.0), child: const Padding(
child: Icon(Icons.info_outline, size: 16)), padding: EdgeInsets.symmetric(horizontal: 5.0),
), child: Icon(Icons.info_outline, size: 16)),
], ),
), ],
ConstrainedBox( ),
constraints: const BoxConstraints.tightFor(width: widthConstraint), ConstrainedBox(
child: Card( constraints:
elevation: 0, const BoxConstraints.tightFor(width: widthConstraint),
shape: RoundedRectangleBorder( child: Card(
side: BorderSide( elevation: 0,
color: Theme.of(context).colorScheme.outline, 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,
), ),
), ),
), ],
], ),
), ),
); );
} }

Loading…
Cancel
Save