@@ -585,7 +585,7 @@ class SemanticsFlag {
585585/// spell out the string character by character when announcing the string.
586586/// * [LocaleStringAttribute] , which causes the assistive technologies to
587587/// treat the string in the specific language.
588- abstract class StringAttribute extends NativeFieldWrapperClass1 {
588+ abstract base class StringAttribute extends NativeFieldWrapperClass1 {
589589 StringAttribute ._({
590590 required this .range,
591591 });
@@ -611,7 +611,7 @@ abstract class StringAttribute extends NativeFieldWrapperClass1 {
611611/// * [AttributedString] , where the string attributes are used.
612612/// * [LocaleStringAttribute] , which causes the assistive technologies to
613613/// treat the string in the specific language.
614- class SpellOutStringAttribute extends StringAttribute {
614+ base class SpellOutStringAttribute extends StringAttribute {
615615 /// Creates a string attribute that denotes the text in [range] must be
616616 /// spell out when the assistive technologies announce the string.
617617 SpellOutStringAttribute ({
@@ -642,7 +642,7 @@ class SpellOutStringAttribute extends StringAttribute {
642642/// * [AttributedString] , where the string attributes are used.
643643/// * [SpellOutStringAttribute] , which causes the assistive technologies to
644644/// spell out the string character by character when announcing the string.
645- class LocaleStringAttribute extends StringAttribute {
645+ base class LocaleStringAttribute extends StringAttribute {
646646 /// Creates a string attribute that denotes the text in [range] must be
647647 /// treated as the language specified by the [locale] when the assistive
648648 /// technologies announce the string.
@@ -675,14 +675,9 @@ class LocaleStringAttribute extends StringAttribute {
675675/// Once created, the [SemanticsUpdate] objects can be passed to
676676/// [PlatformDispatcher.updateSemantics] to update the semantics conveyed to the
677677/// user.
678- @pragma ('vm:entry-point' )
679- class SemanticsUpdateBuilder extends NativeFieldWrapperClass1 {
678+ abstract class SemanticsUpdateBuilder {
680679 /// Creates an empty [SemanticsUpdateBuilder] object.
681- @pragma ('vm:entry-point' )
682- SemanticsUpdateBuilder () { _constructor (); }
683-
684- @Native < Void Function (Handle )> (symbol: 'SemanticsUpdateBuilder::Create' )
685- external void _constructor ();
680+ factory SemanticsUpdateBuilder () = _NativeSemanticsUpdateBuilder ;
686681
687682 /// Update the information associated with the node with the given `id` .
688683 ///
@@ -765,6 +760,77 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass1 {
765760 /// z-direction starting at `elevation` . Basically, in the z-direction the
766761 /// node starts at `elevation` above the parent and ends at `elevation` +
767762 /// `thickness` above the parent.
763+ void updateNode ({
764+ required int id,
765+ required int flags,
766+ required int actions,
767+ required int maxValueLength,
768+ required int currentValueLength,
769+ required int textSelectionBase,
770+ required int textSelectionExtent,
771+ required int platformViewId,
772+ required int scrollChildren,
773+ required int scrollIndex,
774+ required double scrollPosition,
775+ required double scrollExtentMax,
776+ required double scrollExtentMin,
777+ required double elevation,
778+ required double thickness,
779+ required Rect rect,
780+ required String label,
781+ required List <StringAttribute > labelAttributes,
782+ required String value,
783+ required List <StringAttribute > valueAttributes,
784+ required String increasedValue,
785+ required List <StringAttribute > increasedValueAttributes,
786+ required String decreasedValue,
787+ required List <StringAttribute > decreasedValueAttributes,
788+ required String hint,
789+ required List <StringAttribute > hintAttributes,
790+ String ? tooltip,
791+ TextDirection ? textDirection,
792+ required Float64List transform,
793+ required Int32List childrenInTraversalOrder,
794+ required Int32List childrenInHitTestOrder,
795+ required Int32List additionalActions,
796+ });
797+
798+ /// Update the custom semantics action associated with the given `id` .
799+ ///
800+ /// The name of the action exposed to the user is the `label` . For overridden
801+ /// standard actions this value is ignored.
802+ ///
803+ /// The `hint` should describe what happens when an action occurs, not the
804+ /// manner in which a tap is accomplished. For example, use "delete" instead
805+ /// of "double tap to delete".
806+ ///
807+ /// The text direction of the `hint` and `label` is the same as the global
808+ /// window.
809+ ///
810+ /// For overridden standard actions, `overrideId` corresponds with a
811+ /// [SemanticsAction.index] value. For custom actions this argument should not be
812+ /// provided.
813+ void updateCustomAction ({required int id, String ? label, String ? hint, int overrideId = - 1 });
814+
815+ /// Creates a [SemanticsUpdate] object that encapsulates the updates recorded
816+ /// by this object.
817+ ///
818+ /// The returned object can be passed to [PlatformDispatcher.updateSemantics]
819+ /// to actually update the semantics retained by the system.
820+ ///
821+ /// This object is unusable after calling build.
822+ SemanticsUpdate build ();
823+ }
824+
825+ @pragma ('vm:entry-point' )
826+ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1 implements SemanticsUpdateBuilder {
827+ @pragma ('vm:entry-point' )
828+ _NativeSemanticsUpdateBuilder () { _constructor (); }
829+
830+ @Native < Void Function (Handle )> (symbol: 'SemanticsUpdateBuilder::Create' )
831+ external void _constructor ();
832+
833+ @override
768834 void updateNode ({
769835 required int id,
770836 required int flags,
@@ -913,41 +979,21 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass1 {
913979 Int32List childrenInHitTestOrder,
914980 Int32List additionalActions);
915981
916- /// Update the custom semantics action associated with the given `id` .
917- ///
918- /// The name of the action exposed to the user is the `label` . For overridden
919- /// standard actions this value is ignored.
920- ///
921- /// The `hint` should describe what happens when an action occurs, not the
922- /// manner in which a tap is accomplished. For example, use "delete" instead
923- /// of "double tap to delete".
924- ///
925- /// The text direction of the `hint` and `label` is the same as the global
926- /// window.
927- ///
928- /// For overridden standard actions, `overrideId` corresponds with a
929- /// [SemanticsAction.index] value. For custom actions this argument should not be
930- /// provided.
982+ @override
931983 void updateCustomAction ({required int id, String ? label, String ? hint, int overrideId = - 1 }) {
932984 _updateCustomAction (id, label ?? '' , hint ?? '' , overrideId);
933985 }
934986 @Native < Void Function (Pointer <Void >, Int32 , Handle , Handle , Int32 )> (symbol: 'SemanticsUpdateBuilder::updateCustomAction' )
935987 external void _updateCustomAction (int id, String label, String hint, int overrideId);
936988
937- /// Creates a [SemanticsUpdate] object that encapsulates the updates recorded
938- /// by this object.
939- ///
940- /// The returned object can be passed to [PlatformDispatcher.updateSemantics]
941- /// to actually update the semantics retained by the system.
942- ///
943- /// This object is unusable after calling build.
989+ @override
944990 SemanticsUpdate build () {
945- final SemanticsUpdate semanticsUpdate = SemanticsUpdate ._();
991+ final _NativeSemanticsUpdate semanticsUpdate = _NativeSemanticsUpdate ._();
946992 _build (semanticsUpdate);
947993 return semanticsUpdate;
948994 }
949995 @Native < Void Function (Pointer <Void >, Handle )> (symbol: 'SemanticsUpdateBuilder::build' )
950- external void _build (SemanticsUpdate outSemanticsUpdate);
996+ external void _build (_NativeSemanticsUpdate outSemanticsUpdate);
951997}
952998
953999/// An opaque object representing a batch of semantics updates.
@@ -956,22 +1002,27 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass1 {
9561002///
9571003/// Semantics updates can be applied to the system's retained semantics tree
9581004/// using the [PlatformDispatcher.updateSemantics] method.
959- @pragma ('vm:entry-point' )
960- class SemanticsUpdate extends NativeFieldWrapperClass1 {
961- /// This class is created by the engine, and should not be instantiated
962- /// or extended directly.
963- ///
964- /// To create a SemanticsUpdate object, use a [SemanticsUpdateBuilder] .
965- @pragma ('vm:entry-point' )
966- SemanticsUpdate ._();
967-
1005+ abstract class SemanticsUpdate {
9681006 /// Releases the resources used by this semantics update.
9691007 ///
9701008 /// After calling this function, the semantics update is cannot be used
9711009 /// further.
9721010 ///
9731011 /// This can't be a leaf call because the native function calls Dart API
9741012 /// (Dart_SetNativeInstanceField).
1013+ void dispose ();
1014+ }
1015+
1016+ @pragma ('vm:entry-point' )
1017+ base class _NativeSemanticsUpdate extends NativeFieldWrapperClass1 implements SemanticsUpdate {
1018+ /// This class is created by the engine, and should not be instantiated
1019+ /// or extended directly.
1020+ ///
1021+ /// To create a SemanticsUpdate object, use a [SemanticsUpdateBuilder] .
1022+ @pragma ('vm:entry-point' )
1023+ _NativeSemanticsUpdate ._();
1024+
1025+ @override
9751026 @Native < Void Function (Pointer <Void >)> (symbol: 'SemanticsUpdate::dispose' )
9761027 external void dispose ();
9771028}
0 commit comments