Experimental solution for web-like text selection across widgets

Overview

Better Selection

Experimental solution for web-like text selection across widgets (text, images, et cetera).

Demo Video

Better selection is dependent on, and is heavily inspired by super_editor. It uses super_editor's SuperSelectableText which allows a text selection to be passed in as an argument, as well as TapSequenceGestureRecognizer for tripple click support.

This package is nowhere near stable, and many APIs may change in the near future.

Limitations

  • Limited scrollable support. Nested scrollviews and multiple scrollviews in a scope may behave unnaturally.
  • No "multiple column layout" support. Using a scope on a Row behaves very differently from how it would on web.
  • No mobile support

Installation

To get started, add the git dependency to your pubspec.yaml.

better_selection:
  git:
    url: git://github.com/wilsonowilson/better_selection.git
    ref: main

Usage

Add the SelectableScope widget

Before doing anything, you must insert the SelectableScope widget in your widget tree. You can place this widget wherever you want multiple text selection to take place.

class Screen extends StatelessWidget {
  const Screen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SelectableScope(
      child: Scaffold(
        body: Column(
          children: [
             ...
          ],
        ),
      ),
    );
  }
}

All child widgets that implement SelectableWidget can now be selected accross the scope.

Default Selectable Widgets

By default, better_selection comes with two selectable widgets out of the box.

TextSelectable

A plain text widget. Also supports rich text.

 TextSelectable.plain('Lorem ipsum')

BoxSelectable

A SelectableWidget that allows its child to be selected. Example use cases would be copying images and icons. You can specify the copied text using the text parameter.

', child: Image.network(imageLink), ),">
BoxSelectable(
  // Making the copyable text html enables 
  // inter-application image pasting.
  text: 'imageLink">',
  child: Image.network(imageLink),
),
You might also like...

An advanced switch widget, that can be fully customized with size, text, color, radius of corners.

An advanced switch widget, that can be fully customized with size, text, color, radius of corners.

flutter_advanced_switch An advanced switch widget, that can be fully customized with size, text, color, radius of corners. Switch Light Switch Dark Ge

Dec 15, 2022

Flutter widget to show text in popup or overlay container

Flutter widget to show text in popup or overlay container

flutter_show_more_text_popup Flutter widget to show text in popup or overlay container Installation Add this to your package's pubspec.yaml file depen

Jul 5, 2022

Flutter Custom, Text, 3D, Social media button's package

Flutter Custom, Text, 3D, Social media button's package

Flutter Button flutter_button, which is a flutter package, contains animated, cool and awesome buttons. That you may like, thanks to this package you

Dec 29, 2022

A Flutter widget to show a text form field to display a date or clock dialog

A Flutter widget to show a text form field to display a date or clock dialog

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.

Jan 6, 2023

A Flutter widget that scrolls text infinitely

⏩ A Flutter widget that scrolls text infinitely. Provides many customizations including custom scroll directions, durations, curves as well as pauses after every round.

Dec 29, 2022

Listview builder with image and text

listview_builder_with_image_and_text A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resource

May 4, 2022

iOS-like proof of concept reorderable list with animations

iOS-like proof of concept reorderable list with animations

Reorderable List in Flutter iOS-like proof of concept reorderable list with animations Preview Getting Started See example/lib/main.dart for example u

Jan 2, 2023

A Facebook & Twitter Like Card Loading Shimmer Skeleton Library.

A Facebook & Twitter Like Card Loading Shimmer Skeleton Library.

PKSkeleton A Facebook & Twitter Like Card Loading Shimmer Skeleton Library. The source code is 100% Dart, and everything resides in the /lib folder. S

Nov 26, 2022

Donation/Support buttons to allow you to add your favorite support buttons like: Paypal, Ko-fi or Patreon and more.

Donation/Support buttons to allow you to add your favorite support buttons like: Paypal, Ko-fi or Patreon and more.

flutter_donation_buttons Donation/Support buttons to allow you to add your favorite support buttons like: Paypal, Ko-fi or Patreon and more. Getting S

Dec 10, 2022
Comments
  • Fixed compilation issue

    Fixed compilation issue

    The library used to depend on a Github repository that has since been published on pub.dev I changed the pub.yaml to use the latest version that can be used to compile without significant changes the library

    opened by Auties00 0
Owner
Wilson Wilson
Flutter Enthusiast @ turtle.dev. Currently writing at wilsonwilson.dev. Learning French 🇫🇷 and occasionally dreaming in Dart.
Wilson Wilson
A button that looks like a Cupertino text button

Cupertino Text Button A button that looks like a Cupertino text button! Text Button A simple text button can be created like this: CupertinoTextButton

Nick Sirovsky 0 Nov 24, 2022
This repo is for anything that can be reusable in flutter like custom widgets 🟥, animations 🌟and more

Flutter Shortcuts This repo is for anything that can be reusable in flutter like custom widgets ?? , animations ?? and more. How to Use Just get the f

Abdelrahman Mostafa Elmarakby 91 Dec 3, 2022
A basic Flutter app that includes some native Widgets like alerts, cards, avatars, animated container, inputs, etc.

Flutter components This project was created with Flutter and some native Widgets like alerts, cards, avatars, animated container, inputs, etc. Getting

Paúl 4 Nov 15, 2021
The complete solution for Dart command-line interfaces

The complete solution for Dart command-line interfaces, inspired by node commander.js which created by tj.

Axetroy 6 Feb 21, 2020
Custom widgets and utils using Flutter framework widgets and Dart language

reuse_widgets_and_utils The custom widgets and utils using Flutter framework widgets and Dart programming language. Getting Started This project is a

null 1 Oct 29, 2021
Flutter package: Assorted layout widgets that boldly go where no native Flutter widgets have gone before.

assorted_layout_widgets I will slowly but surely add interesting widgets, classes and methods to this package. Despite the package name, they are not

Marcelo Glasberg 122 Dec 22, 2022
Flutter-useful-widgets - Flutter Useful Widgets

useful_widgets This package makes it easy to build apps by providing a list of simple and useful widgets. import 'package:useful_widgets/useful_widget

Ricardo Crescenti 6 Jun 20, 2022
Widgets beginner - Widgets beginner with flutter

Widgets beginner - Widgets beginner with flutter

Tukhtamurodov Sardorbek 2 Feb 6, 2022
A Flutter Text widget support word break for CJK

word_break_text Text widget with word break support for CJK sentence. Installation Add flutter_map to your pubspec: dependencies: word_break_text:

ChangJoo Park(박창주) 5 Nov 11, 2022
Flutter package: Define a theme (colors, text styles etc.) as static const values which can be changed dynamically.

Flutter package: Define a theme (colors, text styles etc.) as static const values which can be changed dynamically. Also comes with useful extensions to create text styles by composition.

Marcelo Glasberg 21 Jan 2, 2023