Skip to content

Add a controller to SelectionArea #127025

@cgutierr-zgz

Description

@cgutierr-zgz

Is there an existing issue for this?

Use case

I want to request a controller for the SelectionArea Widget.
Right now I find it almost impossible to select al items under a SelectionArea by default programmatically, the only way is after a user input the selectableRegionState is created.

This is a current implementation

SelectionArea(
                        onSelectionChanged: (value) => print(value?.plainText),
                        contextMenuBuilder: (context, selectableRegionState) {
                          this.selectableRegionState = selectableRegionState; // <- This is when i initialize the state

                          return Text('....'); // your context menu
                        },
                        child: Stack(
                          alignment: Alignment.center,
                          children: ...state.result.map(TextQuad.new), // A widget with text's
                        ),
),

Proposal

SelectionArea(
                       controller: controller, // <- new
                        onSelectionChanged: (value) => print(value?.plainText),
                        child: Stack(
                          alignment: Alignment.center,
                          children: ...state.result.map(TextQuad.new), // A widget with text's
                        ),
                      ),

And use it like:

controller.selectAll();

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.f: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsframeworkflutter/packages/flutter repository. See also f: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy