Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 93a41bc

Browse files
muditatandonCasey Hillersjonahwilliams
authored
[flutter_releases] Cherry pick flutter-2.13-candidate.7 changes (#10… (#103374)
* [flutter_releases] Cherry pick flutter-2.13-candidate.7 changes (#103206) * Revert "Fix jumping when doing long press for selecting text (#102270)" (#103142) This reverts commit 6ea4aef. * Roll engine with Cps * Fix engine hash * [flutter_releases] partial revert of repaint boundary change (#102962) (#103214) Co-authored-by: Jonah Williams <[email protected]> * [flutter_releases] remove assert on markNeedsCompositingBitsUpdate #103227 (#103225) Co-authored-by: Casey Hillers <[email protected]> Co-authored-by: Jonah Williams <[email protected]>
1 parent fba9214 commit 93a41bc

File tree

6 files changed

+17
-341
lines changed

6 files changed

+17
-341
lines changed

bin/internal/engine.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
07584c64bb7ba8d9e79214c3667cdb16cfa67923
1+
74ac1de5d4f70d6db6cc7f99f6f259a7d073c3ab

packages/flutter/lib/src/rendering/object.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,12 +2295,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
22952295
return;
22962296
}
22972297
}
2298-
assert(() {
2299-
final AbstractNode? parent = this.parent;
2300-
if (parent is RenderObject)
2301-
return parent._needsCompositing;
2302-
return true;
2303-
}());
23042298
// parent is fine (or there isn't one), but we are dirty
23052299
if (owner != null)
23062300
owner!._nodesNeedingCompositingBitsUpdate.add(this);

packages/flutter/lib/src/rendering/proxy_box.dart

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ class RenderOpacity extends RenderProxyBox {
843843
super(child);
844844

845845
@override
846-
bool get isRepaintBoundary => child != null && (_alpha > 0);
846+
bool get alwaysNeedsCompositing => child != null && (_alpha > 0);
847847

848848
@override
849849
OffsetLayer updateCompositedLayer({required covariant OpacityLayer? oldLayer}) {
@@ -871,13 +871,13 @@ class RenderOpacity extends RenderProxyBox {
871871
assert(value >= 0.0 && value <= 1.0);
872872
if (_opacity == value)
873873
return;
874-
final bool wasRepaintBoundary = isRepaintBoundary;
874+
final bool didNeedCompositing = alwaysNeedsCompositing;
875875
final bool wasVisible = _alpha != 0;
876876
_opacity = value;
877877
_alpha = ui.Color.getAlphaFromOpacity(_opacity);
878-
if (wasRepaintBoundary != isRepaintBoundary)
878+
if (didNeedCompositing != alwaysNeedsCompositing)
879879
markNeedsCompositingBitsUpdate();
880-
markNeedsCompositedLayerUpdate();
880+
markNeedsPaint();
881881
if (wasVisible != (_alpha != 0) && !alwaysIncludeSemantics)
882882
markNeedsSemanticsUpdate();
883883
}
@@ -898,10 +898,19 @@ class RenderOpacity extends RenderProxyBox {
898898

899899
@override
900900
void paint(PaintingContext context, Offset offset) {
901-
if (_alpha == 0) {
902-
return;
901+
if (child != null) {
902+
if (_alpha == 0) {
903+
// No need to keep the layer. We'll create a new one if necessary.
904+
layer = null;
905+
return;
906+
}
907+
assert(needsCompositing);
908+
layer = context.pushOpacity(offset, _alpha, super.paint, oldLayer: layer as OpacityLayer?);
909+
assert(() {
910+
layer!.debugCreator = debugCreator;
911+
return true;
912+
}());
903913
}
904-
super.paint(context, offset);
905914
}
906915

907916
@override

packages/flutter/lib/src/widgets/editable_text.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,11 +2514,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
25142514
_showCaretOnScreenScheduled = true;
25152515
SchedulerBinding.instance.addPostFrameCallback((Duration _) {
25162516
_showCaretOnScreenScheduled = false;
2517-
2518-
// if cursor is inactive, e.g. while selecting text, do not jump away
2519-
if (!_cursorActive) {
2520-
return;
2521-
}
25222517
if (_currentCaretRect == null || !_scrollController.hasClients) {
25232518
return;
25242519
}

packages/flutter/test/widgets/editable_text_test.dart

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5183,53 +5183,6 @@ void main() {
51835183
// toolbar. Until we change that, this test should remain skipped.
51845184
}, skip: kIsWeb); // [intended]
51855185

5186-
5187-
testWidgets('text selection handle visibility for long text', (WidgetTester tester) async {
5188-
// long text which is scrollable based on given box size
5189-
const String testText =
5190-
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.';
5191-
final TextEditingController controller =
5192-
TextEditingController(text: testText);
5193-
final ScrollController scrollController = ScrollController();
5194-
5195-
await tester.pumpWidget(MaterialApp(
5196-
home: Align(
5197-
alignment: Alignment.topLeft,
5198-
child: SizedBox(
5199-
width: 100,
5200-
height: 100,
5201-
child: SingleChildScrollView(
5202-
controller: scrollController,
5203-
child: EditableText(
5204-
controller: controller,
5205-
showSelectionHandles: true,
5206-
focusNode: FocusNode(),
5207-
style: Typography.material2018().black.subtitle1!,
5208-
cursorColor: Colors.blue,
5209-
backgroundCursorColor: Colors.grey,
5210-
selectionControls: materialTextSelectionControls,
5211-
keyboardType: TextInputType.multiline,
5212-
maxLines: null,
5213-
),
5214-
),
5215-
),
5216-
),
5217-
));
5218-
5219-
// scroll to a text that is outside of the inital visible rect
5220-
scrollController.jumpTo(151);
5221-
await tester.pump();
5222-
5223-
// long press on a word to trigger a select
5224-
await tester.longPressAt(const Offset(20, 15));
5225-
// wait for adjustments of scroll area
5226-
await tester.pump();
5227-
await tester.pumpAndSettle();
5228-
5229-
// assert not jumped to top
5230-
expect(scrollController.offset, equals(151));
5231-
});
5232-
52335186
const String testText = 'Now is the time for\n' // 20
52345187
'all good people\n' // 20 + 16 => 36
52355188
'to come to the aid\n' // 36 + 19 => 55

0 commit comments

Comments
 (0)