Merge pull request #115 from jonahwilliams/combine_advanced_blends

Reduce SaveLayer count of advanced blends.
This commit is contained in:
Shawn 2023-09-11 10:01:33 -06:00 committed by GitHub
commit 8a29d67096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,11 +24,9 @@ class _CollapsingPullQuoteImage extends StatelessWidget {
double offsetY = (imgHeight / 2 + outerPadding * .25) * (1 - collapseAmt); double offsetY = (imgHeight / 2 + outerPadding * .25) * (1 - collapseAmt);
if (top) offsetY *= -1; // flip? if (top) offsetY *= -1; // flip?
return Transform.translate( return Transform.translate(
offset: Offset(0, offsetY), offset: Offset(0, offsetY),
child: BlendMask( child:Text(value, style: quoteStyle, textAlign: TextAlign.center),
blendModes: const [BlendMode.colorBurn], );
child: Text(value, style: quoteStyle, textAlign: TextAlign.center),
));
} }
return ValueListenableBuilder<double>( return ValueListenableBuilder<double>(
@ -88,20 +86,23 @@ class _CollapsingPullQuoteImage extends StatelessWidget {
Positioned.fill( Positioned.fill(
child: Container( child: Container(
margin: const EdgeInsets.symmetric(horizontal: 24), margin: const EdgeInsets.symmetric(horizontal: 24),
child: StaticTextScale( child: BlendMask(
child: Column( blendModes: const [BlendMode.colorBurn],
mainAxisAlignment: MainAxisAlignment.center, child: StaticTextScale(
children: [ child: Column(
SizedBox(height: 32), // push down vertical centre mainAxisAlignment: MainAxisAlignment.center,
buildText(data.pullQuote1Top, collapseAmt, top: true), children: [
buildText(data.pullQuote1Bottom, collapseAmt, top: false), SizedBox(height: 32), // push down vertical centre
if (data.pullQuote1Author.isNotEmpty) ...[ buildText(data.pullQuote1Top, collapseAmt, top: true),
Container( buildText(data.pullQuote1Bottom, collapseAmt, top: false),
margin: const EdgeInsets.only(top: 16), if (data.pullQuote1Author.isNotEmpty) ...[
child: buildText('- ${data.pullQuote1Author}', collapseAmt, top: false, isAuthor: true), Container(
) margin: const EdgeInsets.only(top: 16),
child: buildText('- ${data.pullQuote1Author}', collapseAmt, top: false, isAuthor: true),
)
],
], ],
], ),
), ),
), ),
), ),