-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listf: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- select 'FlutterCandies'
- right click with mouse
Expected results
no error, toolbar show
Actual results
assert error
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// TRY THIS: Try running your application with "flutter run". You'll see
// the application has a blue toolbar. Then, without quitting the app,
// try changing the seedColor in the colorScheme below to Colors.green
// and then invoke "hot reload" (save your changes or press the "hot
// reload" button in a Flutter-supported IDE, or press "r" if you used
// the command line to start the app).
//
// Notice that the counter didn't reset back to zero; the application
// state is not lost during the reload. To reset the state, use hot
// restart instead.
//
// This works for code too, not just values: Most code changes can be
// tested with just a hot reload.
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// TRY THIS: Try changing the color here to a specific color (to
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
// change color while the other colors stay the same.
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: SelectionArea(
child: Text.rich(TextSpan(children: <InlineSpan>[
TextSpan(
text:
'[love]Extended text help you to build rich text quickly. any special text you will have with extended text. '
'It\'s my pleasure to invite you to join ',
),
WidgetSpan(child: SizedBox.shrink()),
TextSpan(
text: 'FlutterCandies',
style: TextStyle(fontSize: 16),
),
WidgetSpan(child: SizedBox.shrink()),
TextSpan(
text: ' if you want to improve flutter .[love]'
'if you meet any problem, please let me know @zmtzawqlp .[sun_glasses]',
),
])),
)),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}Screenshots or Video
Screenshots / Video demonstration
1.mp4
Logs
Logs
The following assertion was thrown while handling a gesture:
'package:flutter/src/rendering/paragraph.dart': Failed assertion: line 1512 pos 12: 'word.start >= range.start && word.end <= range.end': is not true.
paragraph.dart:1512
2
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
When the exception was thrown, this was the stack
#2 _SelectableFragment._handleSelectWord
paragraph.dart:1512
#3 _SelectableFragment.dispatchSelectionEvent
paragraph.dart:1401
#4 MultiSelectableSelectionContainerDelegate.dispatchSelectionEventToChild
selectable_region.dart:2068
#5 _SelectableRegionContainerDelegate.dispatchSelectionEventToChild
selectable_region.dart:1393
#6 MultiSelectableSelectionContainerDelegate.handleSelectWord
selectable_region.dart:1882
#7 _SelectableRegionContainerDelegate.handleSelectWord
selectable_region.dart:1334
#8 MultiSelectableSelectionContainerDelegate.dispatchSelectionEvent
selectable_region.dart:2029
#9 _SelectionContainerState.dispatchSelectionEvent
selection_container.dart:186
#10 SelectableRegionState._selectWordAt
selectable_region.dart:863
#11 SelectableRegionState._handleRightClickDown
selectable_region.dart:494
#12 TapGestureRecognizer.handleTapDown.<anonymous closure>
tap.dart:630
#13 GestureRecognizer.invokeCallback
recognizer.dart:275
#14 TapGestureRecognizer.handleTapDown
tap.dart:630
#15 BaseTapGestureRecognizer._checkDown
tap.dart:302
#16 BaseTapGestureRecognizer.acceptGesture
tap.dart:279
#17 GestureArenaManager._resolveByDefault
arena.dart:268
#18 GestureArenaManager._tryToResolveArena.<anonymous closure>
arena.dart:248
(elided 4 frames from class _AssertionError and dart:async)
Handler: "onSecondaryTapDown"
Recognizer: TapGestureRecognizer#8f0dd
debugOwner: SelectableRegionState#db27a
state: possible
button: 2Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.10.0, on macOS 12.6 21G115 darwin-x64, locale zh-Hans-CN)
• Flutter version 3.10.0 on channel stable at /Users/zmtzawqlp/Documents/flutter/3.10.0
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 84a1e904f4 (6 days ago), 2023-05-09 07:41:44 -0700
• Engine revision d44b5a94c9
• Dart version 3.0.0
• DevTools version 2.23.1
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/zmtzawqlp/Library/Android/sdk
• Platform android-33, build-tools 30.0.3
• ANDROID_HOME = /Users/zmtzawqlp/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.78.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (3 available)
• iPhone 14 Pro Max (mobile) • 12E31781-40FE-4E3D-8D33-40C1A1E49BAD • ios •
com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 12.6 21G115 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listf: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on