diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index a10daa22fa..08ed58c612 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -362,8 +362,10 @@ class _TextPainterLayoutCacheWithOffset { static double _contentWidthFor(double minWidth, double maxWidth, TextWidthBasis widthBasis, _TextLayout layout) { // TODO(LongCatIsLooong): remove the rounding when _applyFloatingPointHack // is removed. - minWidth = minWidth.floorToDouble(); - maxWidth = maxWidth.floorToDouble(); + if (_TextLayout._shouldApplyFloatingPointHack) { + minWidth = minWidth.floorToDouble(); + maxWidth = maxWidth.floorToDouble(); + } return switch (widthBasis) { TextWidthBasis.longestLine => clampDouble(layout.longestLine, minWidth, maxWidth), TextWidthBasis.parent => clampDouble(layout.maxIntrinsicLineExtent, minWidth, maxWidth), diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index 1f722228e7..10e6220e4f 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -5041,14 +5041,8 @@ class _ScribbleFocusableState extends State<_ScribbleFocusable> implements Scrib class _ScribblePlaceholder extends WidgetSpan { const _ScribblePlaceholder({ required super.child, - super.alignment, - super.baseline, required this.size, - }) : assert(baseline != null || !( - identical(alignment, ui.PlaceholderAlignment.aboveBaseline) || - identical(alignment, ui.PlaceholderAlignment.belowBaseline) || - identical(alignment, ui.PlaceholderAlignment.baseline) - )); + }); /// The size of the span, used in place of adding a placeholder size to the [TextPainter]. final Size size; diff --git a/packages/flutter/test/material/date_range_picker_test.dart b/packages/flutter/test/material/date_range_picker_test.dart index 961372f8e3..9ec2e684da 100644 --- a/packages/flutter/test/material/date_range_picker_test.dart +++ b/packages/flutter/test/material/date_range_picker_test.dart @@ -132,7 +132,10 @@ void main() { final Offset entryButtonBottomLeft = tester.getBottomLeft( find.widgetWithIcon(IconButton, Icons.edit_outlined), ); - expect(saveButtonBottomLeft.dx, 800 - 89.0); + expect( + saveButtonBottomLeft.dx, + const bool.hasEnvironment('SKPARAGRAPH_REMOVE_ROUNDING_HACK') ? moreOrLessEquals(711.6, epsilon: 1e-5) : (800 - 89.0), + ); expect(saveButtonBottomLeft.dy, helpTextTopLeft.dy); expect(entryButtonBottomLeft.dx, saveButtonBottomLeft.dx - 48.0); expect(entryButtonBottomLeft.dy, helpTextTopLeft.dy);