Unverified Commit 5be898a3 authored by Tomasz Gucio's avatar Tomasz Gucio Committed by GitHub

Move MagnifierBuilder, MagnifierOverlayInfoBearer from text_selection.dart (#108956)

parent b89580fb
......@@ -20,7 +20,7 @@ import 'package:flutter/widgets.dart';
/// - has some vertical drag resistance; i.e. if a gesture is detected k units below the field,
/// then has vertical offset [dragResistance] * k.
class CupertinoTextMagnifier extends StatefulWidget {
/// Construct a [RawMagnifier] in the Cupertino style, positioning with respect to
/// Constructs a [RawMagnifier] in the Cupertino style, positioning with respect to
/// [magnifierOverlayInfoBearer].
///
/// The default constructor parameters and constants were eyeballed on
......
......@@ -786,11 +786,11 @@ class CupertinoTextField extends StatefulWidget {
/// {@macro flutter.services.TextInputConfiguration.enableIMEPersonalizedLearning}
final bool enableIMEPersonalizedLearning;
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.intro}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.intro}
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.details}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.details}
///
/// By default, builds a [CupertinoTextMagnifier] on iOS and Android nothing on all other
/// platforms. If it is desired to supress the magnifier, consider passing
......
......@@ -149,8 +149,8 @@ class _TextMagnifierState extends State<TextMagnifier> {
// to always stay between line start and end.
final double magnifierX = clampDouble(
selectionInfo.globalGesturePosition.dx,
selectionInfo.currentLineBoundries.left,
selectionInfo.currentLineBoundries.right);
selectionInfo.currentLineBoundaries.left,
selectionInfo.currentLineBoundaries.right);
// Place the magnifier at the previously calculated X, and the Y should be
// exactly at the center of the handle.
......@@ -160,7 +160,7 @@ class _TextMagnifierState extends State<TextMagnifier> {
// Shift the magnifier so that, if we are ever out of the screen, we become in bounds.
// This probably won't have much of an effect on the X, since it is already bound
// to the currentLineBoundries, but will shift vertically if the magnifier is out of bounds.
// to the currentLineBoundaries, but will shift vertically if the magnifier is out of bounds.
final Rect screenBoundsAdjustedMagnifierRect =
MagnifierController.shiftWithinBounds(
bounds: screenRect, rect: unadjustedMagnifierRect);
......
......@@ -430,11 +430,11 @@ class SelectableText extends StatefulWidget {
/// {@macro flutter.widgets.editableText.onSelectionChanged}
final SelectionChangedCallback? onSelectionChanged;
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.intro}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.intro}
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.details}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.details}
///
/// By default, builds a [CupertinoTextMagnifier] on iOS and [TextMagnifier] on
/// Android, and builds nothing on all other platforms. If it is desired to supress
......
......@@ -39,11 +39,11 @@ class SelectionArea extends StatefulWidget {
required this.child,
});
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.intro}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.intro}
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.details}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.details}
///
/// By default, builds a [CupertinoTextMagnifier] on iOS and [TextMagnifier] on
/// Android, and builds nothing on all other platforms. If it is desired to supress
......
......@@ -393,11 +393,11 @@ class TextField extends StatefulWidget {
paste: true,
)));
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.intro}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.intro}
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.details}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.details}
///
/// By default, builds a [CupertinoTextMagnifier] on iOS and [TextMagnifier] on
/// Android, and builds nothing on all other platforms. If it is desired to supress
......
......@@ -27,6 +27,7 @@ import 'focus_scope.dart';
import 'focus_traversal.dart';
import 'framework.dart';
import 'localizations.dart';
import 'magnifier.dart';
import 'media_query.dart';
import 'scroll_configuration.dart';
import 'scroll_controller.dart';
......@@ -1549,11 +1550,11 @@ class EditableText extends StatefulWidget {
/// {@macro flutter.services.TextInputConfiguration.enableIMEPersonalizedLearning}
final bool enableIMEPersonalizedLearning;
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.intro}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.intro}
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.details}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.details}
final TextMagnifierConfiguration magnifierConfiguration;
bool get _userSelectionEnabled => enableInteractiveSelection && (!readOnly || !obscureText);
......
......@@ -15,6 +15,122 @@ import 'inherited_theme.dart';
import 'navigator.dart';
import 'overlay.dart';
/// {@template flutter.widgets.magnifier.MagnifierBuilder}
/// Signature for a builder that builds a [Widget] with a [MagnifierController].
///
/// Consuming [MagnifierController] or [ValueNotifier]<[MagnifierOverlayInfoBearer]> is not
/// required, although if a Widget intends to have entry or exit animations, it should take
/// [MagnifierController] and provide it an [AnimationController], so that [MagnifierController]
/// can wait before removing it from the overlay.
/// {@endtemplate}
///
/// See also:
///
/// - [MagnifierOverlayInfoBearer], the data class that updates the
/// magnifier.
typedef MagnifierBuilder = Widget? Function(
BuildContext context,
MagnifierController controller,
ValueNotifier<MagnifierOverlayInfoBearer> magnifierOverlayInfoBearer,
);
/// A data class that contains the geometry information of text layouts
/// and selection gestures, used to position magnifiers.
@immutable
class MagnifierOverlayInfoBearer {
/// Constructs a [MagnifierOverlayInfoBearer] from provided geometry values.
const MagnifierOverlayInfoBearer({
required this.globalGesturePosition,
required this.caretRect,
required this.fieldBounds,
required this.currentLineBoundaries,
});
/// Const [MagnifierOverlayInfoBearer] with all values set to 0.
static const MagnifierOverlayInfoBearer empty = MagnifierOverlayInfoBearer(
globalGesturePosition: Offset.zero,
caretRect: Rect.zero,
currentLineBoundaries: Rect.zero,
fieldBounds: Rect.zero,
);
/// The offset of the gesture position that the magnifier should be shown at.
final Offset globalGesturePosition;
/// The rect of the current line the magnifier should be shown at,
/// without taking into account any padding of the field; only the position
/// of the first and last character.
final Rect currentLineBoundaries;
/// The rect of the handle that the magnifier should follow.
final Rect caretRect;
/// The bounds of the entire text field that the magnifier is bound to.
final Rect fieldBounds;
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
return other is MagnifierOverlayInfoBearer
&& other.globalGesturePosition == globalGesturePosition
&& other.caretRect == caretRect
&& other.currentLineBoundaries == currentLineBoundaries
&& other.fieldBounds == fieldBounds;
}
@override
int get hashCode => Object.hash(
globalGesturePosition,
caretRect,
fieldBounds,
currentLineBoundaries,
);
}
/// {@template flutter.widgets.magnifier.TextMagnifierConfiguration.intro}
/// A configuration object for a magnifier.
/// {@endtemplate}
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// {@template flutter.widgets.magnifier.TextMagnifierConfiguration.details}
/// In general, most features of the magnifier can be configured through
/// [MagnifierBuilder]. [TextMagnifierConfiguration] is used to configure
/// the magnifier's behavior through the [SelectionOverlay].
/// {@endtemplate}
class TextMagnifierConfiguration {
/// Constructs a [TextMagnifierConfiguration] from parts.
///
/// If [magnifierBuilder] is null, a default [MagnifierBuilder] will be used
/// that never builds a magnifier.
const TextMagnifierConfiguration({
MagnifierBuilder? magnifierBuilder,
this.shouldDisplayHandlesInMagnifier = true
}) : _magnifierBuilder = magnifierBuilder;
/// The passed in [MagnifierBuilder].
///
/// This is nullable because [disabled] needs to be static const,
/// so that it can be used as a default parameter. If left null,
/// the [magnifierBuilder] getter will be a function that always returns
/// null.
final MagnifierBuilder? _magnifierBuilder;
/// {@macro flutter.widgets.magnifier.MagnifierBuilder}
MagnifierBuilder get magnifierBuilder => _magnifierBuilder ?? (_, __, ___) => null;
/// Determines whether a magnifier should show the text editing handles or not.
final bool shouldDisplayHandlesInMagnifier;
/// A constant for a [TextMagnifierConfiguration] that is disabled.
///
/// In particular, this [TextMagnifierConfiguration] is considered disabled
/// because it never builds anything, regardless of platform.
static const TextMagnifierConfiguration disabled = TextMagnifierConfiguration();
}
/// [MagnifierController]'s main benefit over holding a raw [OverlayEntry] is that
/// [MagnifierController] will handle logic around waiting for a magnifier to animate in or out.
///
......@@ -429,29 +545,24 @@ class _DonutClip extends CustomClipper<Path> {
}
class _Magnifier extends SingleChildRenderObjectWidget {
/// Construct a [_Magnifier].
const _Magnifier({
super.child,
required this.shape,
this.magnificationScale = 1,
this.focalPointOffset = Offset.zero,
super.child,
required this.shape,
this.magnificationScale = 1,
this.focalPointOffset = Offset.zero,
});
/// [focalPointOffset] is the area the center of the
/// [_Magnifier] points to, relative to the center of the magnifier.
///
/// {@macro flutter.widgets.magnifier.offset}
// The Offset that the center of the _Magnifier points to, relative
// to the center of the magnifier.
final Offset focalPointOffset;
/// The scale of the magnification.
///
/// A [magnificationScale] of 1 means that the content in the magnifier
/// is true to it's real size. Anything greater than one will appear bigger
/// in the magnifier, and anything less than one will appear smaller in
/// the magnifier.
// The enlarge multiplier of the magnification.
//
// If equal to 1.0, the content in the magnifier is true to its real size.
// If greater than 1.0, the content appears bigger in the magnifier.
final double magnificationScale;
/// The shape of the magnifier is dictated by [shape.getOuterPath].
// Shape of the magnifier.
final ShapeBorder shape;
@override
......
......@@ -18,6 +18,7 @@ import 'focus_manager.dart';
import 'focus_scope.dart';
import 'framework.dart';
import 'gesture_detector.dart';
import 'magnifier.dart';
import 'media_query.dart';
import 'overlay.dart';
import 'platform_selectable_region_context_menu.dart';
......@@ -184,13 +185,13 @@ class SelectableRegion extends StatefulWidget {
this.magnifierConfiguration = TextMagnifierConfiguration.disabled,
});
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.intro}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.intro}
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// By default, [SelectableRegion]'s [TextMagnifierConfiguration] is disabled.
///
/// {@macro flutter.widgets.text_selection.TextMagnifierConfiguration.details}
/// {@macro flutter.widgets.magnifier.TextMagnifierConfiguration.details}
final TextMagnifierConfiguration magnifierConfiguration;
/// {@macro flutter.widgets.Focus.focusNode}
......@@ -542,7 +543,7 @@ class _SelectableRegionState extends State<SelectableRegion> with TextSelectionD
globalGesturePosition: globalGesturePosition,
caretRect: caretRect,
fieldBounds: globalTransformAsOffset & _selectable!.size,
currentLineBoundries: globalTransformAsOffset & _selectable!.size,
currentLineBoundaries: globalTransformAsOffset & _selectable!.size,
);
}
......
......@@ -79,7 +79,7 @@ void main() {
final ValueNotifier<MagnifierOverlayInfoBearer> magnifier =
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: fakeTextFieldRect,
currentLineBoundaries: fakeTextFieldRect,
fieldBounds: fakeTextFieldRect,
caretRect: fakeTextFieldRect,
// The tap position is dragBelow units below the text field.
......@@ -112,7 +112,7 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
// The tap position is far out of the right side of the app.
......@@ -145,7 +145,7 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
// The tap position is dragBelow units below the text field.
......@@ -179,7 +179,7 @@ void main() {
final ValueNotifier<MagnifierOverlayInfoBearer> magnifierinfo =
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
// The tap position is dragBelow units below the text field.
......@@ -193,7 +193,7 @@ void main() {
// Move the gesture to one that should hide it.
magnifierinfo.value = MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition: magnifierinfo.value.globalGesturePosition + const Offset(0, 100),
......@@ -219,7 +219,7 @@ void main() {
final ValueNotifier<MagnifierOverlayInfoBearer> magnifierInfo =
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
// The tap position is dragBelow units below the text field.
......@@ -232,7 +232,7 @@ void main() {
// Move the gesture to one that should hide it.
magnifierInfo.value = MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition:
......@@ -244,7 +244,7 @@ void main() {
// Return the gesture to one that shows it.
magnifierInfo.value = MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition: Offset(MediaQuery.of(context).size.width / 2,
......
......@@ -5985,11 +5985,9 @@ void main() {
defaultCupertinoTextField.magnifierConfiguration!.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
)),
isA<Widget>().having(
(Widget widget) => widget.key, 'key', equals(customMagnifier.key)));
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
),
isA<Widget>().having((Widget widget) => widget.key, 'key', equals(customMagnifier.key)));
});
group('defaults', () {
......@@ -6005,9 +6003,8 @@ void main() {
editableText.magnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
)),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
),
isA<CupertinoTextMagnifier>());
},
variant: const TargetPlatformVariant(
......@@ -6026,9 +6023,8 @@ void main() {
editableText.magnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
)),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
),
isNull);
},
variant: TargetPlatformVariant.all(
......
......@@ -55,16 +55,12 @@ void main() {
home: Placeholder(),
));
final BuildContext context =
tester.firstElement(find.byType(Placeholder));
final BuildContext context = tester.firstElement(find.byType(Placeholder));
final Widget? builtWidget =
TextMagnifier.adaptiveMagnifierConfiguration.magnifierBuilder(
final Widget? builtWidget = TextMagnifier.adaptiveMagnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
);
expect(builtWidget, isA<TextMagnifier>());
......@@ -76,15 +72,13 @@ void main() {
home: Placeholder(),
));
final BuildContext context =
tester.firstElement(find.byType(Placeholder));
final BuildContext context = tester.firstElement(find.byType(Placeholder));
final Widget? builtWidget =
TextMagnifier.adaptiveMagnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty()));
final Widget? builtWidget = TextMagnifier.adaptiveMagnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
);
expect(builtWidget, isA<CupertinoTextMagnifier>());
}, variant: TargetPlatformVariant.only(TargetPlatform.iOS));
......@@ -95,17 +89,13 @@ void main() {
home: Placeholder(),
));
final BuildContext context =
tester.firstElement(find.byType(Placeholder));
final BuildContext context = tester.firstElement(find.byType(Placeholder));
final Widget? builtWidget =
TextMagnifier.adaptiveMagnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
),
);
final Widget? builtWidget = TextMagnifier.adaptiveMagnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
);
expect(builtWidget, isNull);
},
......@@ -157,7 +147,7 @@ void main() {
final ValueNotifier<MagnifierOverlayInfoBearer> magnifierInfo =
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: fakeTextFieldRect,
currentLineBoundaries: fakeTextFieldRect,
fieldBounds: fakeTextFieldRect,
caretRect: fakeTextFieldRect,
// The tap position is dragBelow units below the text field.
......@@ -191,9 +181,9 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
// Inflate these two to make sure we're bounding on the
// current line boundries, not anything else.
// current line boundaries, not anything else.
fieldBounds: reasonableTextField.inflate(gestureOutsideLine),
caretRect: reasonableTextField.inflate(gestureOutsideLine),
// The tap position is far out of the right side of the app.
......@@ -224,9 +214,9 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
// Inflate these two to make sure we're bounding on the
// current line boundries, not anything else.
// current line boundaries, not anything else.
fieldBounds: reasonableTextField.inflate(gestureOutsideLine),
caretRect: reasonableTextField.inflate(gestureOutsideLine),
// The tap position is far out of the left side of the app.
......@@ -252,7 +242,7 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition: reasonableTextField.center,
......@@ -279,7 +269,7 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: topOfScreenTextFieldRect,
currentLineBoundaries: topOfScreenTextFieldRect,
fieldBounds: topOfScreenTextFieldRect,
caretRect: topOfScreenTextFieldRect,
globalGesturePosition: topOfScreenTextFieldRect.topCenter,
......@@ -312,7 +302,7 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
// Gesture on the far right of the magnifier.
......@@ -343,7 +333,7 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: topOfScreenTextFieldRect,
currentLineBoundaries: topOfScreenTextFieldRect,
fieldBounds: topOfScreenTextFieldRect,
caretRect: topOfScreenTextFieldRect,
globalGesturePosition: topOfScreenTextFieldRect.topCenter,
......@@ -376,7 +366,7 @@ void main() {
tester,
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition: reasonableTextField.center,
......@@ -399,7 +389,7 @@ void main() {
final ValueNotifier<MagnifierOverlayInfoBearer> magnifierPositioner =
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition: reasonableTextField.center,
......@@ -410,7 +400,7 @@ void main() {
// New position has a horizontal shift.
magnifierPositioner.value = MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition:
......@@ -435,7 +425,7 @@ void main() {
final ValueNotifier<MagnifierOverlayInfoBearer> magnifierPositioner =
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition: reasonableTextField.center,
......@@ -446,7 +436,7 @@ void main() {
// New position has a vertical shift.
magnifierPositioner.value = MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField.shift(verticalShift),
currentLineBoundaries: reasonableTextField.shift(verticalShift),
fieldBounds: Rect.fromPoints(reasonableTextField.topLeft,
reasonableTextField.bottomRight + verticalShift),
caretRect: reasonableTextField.shift(verticalShift),
......@@ -471,7 +461,7 @@ void main() {
final ValueNotifier<MagnifierOverlayInfoBearer> magnifierPositioner =
ValueNotifier<MagnifierOverlayInfoBearer>(
MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField,
currentLineBoundaries: reasonableTextField,
fieldBounds: reasonableTextField,
caretRect: reasonableTextField,
globalGesturePosition: reasonableTextField.center,
......@@ -482,7 +472,7 @@ void main() {
// New position has a vertical shift.
magnifierPositioner.value = MagnifierOverlayInfoBearer(
currentLineBoundries: reasonableTextField.shift(verticalShift),
currentLineBoundaries: reasonableTextField.shift(verticalShift),
fieldBounds: Rect.fromPoints(reasonableTextField.topLeft,
reasonableTextField.bottomRight + verticalShift),
caretRect: reasonableTextField.shift(verticalShift),
......
......@@ -11896,9 +11896,8 @@ void main() {
textField.magnifierConfiguration!.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
)),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
),
isA<Widget>().having(
(Widget widget) => widget.key,
'built magnifier key equal to passed in magnifier key',
......@@ -11918,9 +11917,8 @@ void main() {
editableText.magnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
)),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
),
isA<TextMagnifier>());
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
......@@ -11937,9 +11935,8 @@ void main() {
editableText.magnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
)),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
),
isA<CupertinoTextMagnifier>());
}, variant: TargetPlatformVariant.only(TargetPlatform.iOS));
......@@ -11956,9 +11953,8 @@ void main() {
editableText.magnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(
const MagnifierOverlayInfoBearer.empty(),
)),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty),
),
isNull);
},
variant: TargetPlatformVariant.all(excluding: <TargetPlatform>{
......
......@@ -12667,12 +12667,12 @@ void main() {
final BuildContext context = tester.firstElement(find.byType(EditableText));
expect(
editableText.magnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(const MagnifierOverlayInfoBearer.empty())
),
isNull
editableText.magnifierConfiguration.magnifierBuilder(
context,
MagnifierController(),
ValueNotifier<MagnifierOverlayInfoBearer>(MagnifierOverlayInfoBearer.empty)
),
isNull,
);
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment