fluttercandies / extended_text

A powerful extended official text for Flutter, which supports Speical Text(Image,@somebody), Custom Background, Custom overFlow, Text Selection.
MIT License
664 stars 134 forks source link

Old Handles and Old Toolbars persist when switching to another ExtendedText #114

Closed jajiedu closed 3 years ago

jajiedu commented 3 years ago

On one screen I use multiple ExtendedText with 'selectEnabled: true'. However when selecting and then switching to select in another location, the old Handle and the old Toolbar still exist. Is there a way to get rid of them when switching to another ExtendedText?

Current status image

Desire: removed when switching to another ExtendedText image

import 'package:extended_text/extended_text.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo Admin',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ExtendedText(
              'selecting and then switching to select in another location',
              selectionEnabled: true,
            ),
            ExtendedText(
              'selecting and then switching to select in another location',
              selectionEnabled: true,
            ),
            ExtendedText(
              'selecting and then switching to select in another location',
              selectionEnabled: true,
            ),
          ],
        ),
      ),
    );
  }
}
zmtzawqlp commented 3 years ago

https://github.com/fluttercandies/extended_text/blob/eca3d38190a729b6041adf376bb9e47182671234/example/lib/pages/text_selection_demo.dart#L93