pub struct TextMagnifier {
pub key: Option<KeyRef>,
pub magnifier_info: Ref<ValueNotifier<MagnifierInfo>>,
}Expand description
A Magnifier positioned by rules dictated by the native Android magnifier.
The positioning rules are based on magnifier_info, as follows:
-
The loupe tracks the gesture’s x coordinate, clamping to the beginning and end of the currently editing line.
-
The focal point never contains anything out of the bounds of the text field or other widget being magnified (the
MagnifierInfo::field_bounds). -
The focal point always remains aligned with the y coordinate of the touch.
-
The loupe always remains on the screen.
-
When the line targeted by the touch’s y coordinate changes, the position is animated over
JUMP_BETWEEN_LINES_ANIMATION_DURATION.
This behavior was based on the Android 12 source code, where possible, and on eyeballing a Pixel 6 running Android 12 otherwise.
Fields§
§key: Option<KeyRef>§magnifier_info: Ref<ValueNotifier<MagnifierInfo>>The current status of the user’s touch.
As the value of the magnifier_info changes, the position of the
loupe is adjusted automatically, according to the rules described in the
TextMagnifier class description.
Implementations§
Source§impl TextMagnifier
impl TextMagnifier
Sourcepub const JUMP_BETWEEN_LINES_ANIMATION_DURATION: Duration
pub const JUMP_BETWEEN_LINES_ANIMATION_DURATION: Duration
The duration that the position is animated if TextMagnifier just switched
between lines.
Sourcepub fn new(magnifier_info: Ref<ValueNotifier<MagnifierInfo>>) -> TextMagnifier
pub fn new(magnifier_info: Ref<ValueNotifier<MagnifierInfo>>) -> TextMagnifier
Creates a TextMagnifier.
The magnifier_info must be provided, and must be updated with new values
as the user’s touch changes.
Sourcepub fn key(self, key: KeyRef) -> TextMagnifier
pub fn key(self, key: KeyRef) -> TextMagnifier
Dart TextMagnifier(key:).
Sourcepub fn adaptive_magnifier_configuration(app: &App) -> TextMagnifierConfiguration
pub fn adaptive_magnifier_configuration(app: &App) -> TextMagnifierConfiguration
Dart’s adaptiveMagnifierConfiguration: a TextMagnifierConfiguration that returns a
CupertinoTextMagnifier on iOS, TextMagnifier on Android, and None on all other
platforms, and shows the editing handles only on iOS.
Every call returns a configuration with the same builder, so two of them are the same configuration to a widget that compares them.
Trait Implementations§
Source§impl Debug for TextMagnifier
impl Debug for TextMagnifier
Source§impl StatefulWidget for TextMagnifier
impl StatefulWidget for TextMagnifier
Source§type State = TextMagnifierState
type State = TextMagnifierState
Source§fn create_state(&self) -> TextMagnifierState
fn create_state(&self) -> TextMagnifierState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Widget::type_name. A stateful form another widget kind becomes (an animated or
status transition widget) names the widget it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for TextMagnifier
impl !Send for TextMagnifier
impl !Sync for TextMagnifier
impl !UnwindSafe for TextMagnifier
impl Forget for TextMagnifier
impl Freeze for TextMagnifierwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
NonZero<u32>: Freeze,
PhantomData<fn() -> ValueNotifier<MagnifierInfo>>: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
impl Move for TextMagnifier
impl Unpin for TextMagnifier
impl UnsafeUnpin for TextMagnifierwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
PhantomData<fn() -> ValueNotifier<MagnifierInfo>>: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.