Fix text painter longest line resizing logic for TextWidthBasis.longestLine (#143024)

Fixes https://github.com/flutter/flutter/issues/142309.
This commit is contained in:
LongCatIsLooong
2024-02-10 15:39:20 -08:00
committed by GitHub
parent 4fdfe7850a
commit bc49cf8091
4 changed files with 68 additions and 37 deletions

View File

@@ -35,7 +35,7 @@ class ProductCard extends StatelessWidget {
// The fontSize to use for computing the heuristic UI scaling factor.
const double defaultFontSize = 14.0;
final double containerScaingFactor = MediaQuery.textScalerOf(context).scale(defaultFontSize) / defaultFontSize;
final double containerScalingFactor = MediaQuery.textScalerOf(context).scale(defaultFontSize) / defaultFontSize;
return ScopedModelDescendant<AppStateModel>(
builder: (BuildContext context, Widget? child, AppStateModel model) {
@@ -56,7 +56,7 @@ class ProductCard extends StatelessWidget {
child: imageWidget,
),
SizedBox(
height: kTextBoxHeight * containerScaingFactor,
height: kTextBoxHeight * containerScalingFactor,
width: 121.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,

View File

@@ -180,7 +180,7 @@ class _DemoItem extends StatelessWidget {
final bool isDark = theme.brightness == Brightness.dark;
// The fontSize to use for computing the heuristic UI scaling factor.
const double defaultFontSize = 14.0;
final double containerScaingFactor = MediaQuery.textScalerOf(context).scale(defaultFontSize) / defaultFontSize;
final double containerScalingFactor = MediaQuery.textScalerOf(context).scale(defaultFontSize) / defaultFontSize;
return RawMaterialButton(
splashColor: theme.primaryColor.withOpacity(0.12),
highlightColor: Colors.transparent,
@@ -188,7 +188,7 @@ class _DemoItem extends StatelessWidget {
_launchDemo(context);
},
child: Container(
constraints: BoxConstraints(minHeight: _kDemoItemHeight * containerScaingFactor),
constraints: BoxConstraints(minHeight: _kDemoItemHeight * containerScalingFactor),
child: Row(
children: <Widget>[
Container(