Created
October 9, 2020 23:27
-
-
Save pedromassango/ffb51990892580e43c925f881884ea02 to your computer and use it in GitHub Desktop.
Text selection issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
final _controller = TextEditingController(text: 'Please select me!'); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Bug', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
visualDensity: VisualDensity.adaptivePlatformDensity, | |
), | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text("Flutter Bug"), | |
actions: [ | |
IconButton( | |
icon: Icon(Icons.select_all_rounded), | |
onPressed: () { | |
_controller.selection = TextSelection(baseOffset: 7, extentOffset: 13); | |
}, | |
) | |
], | |
), | |
body: Center( | |
child: TextField( | |
controller: _controller, | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @justin,
While working on this proposal for text selection, I found out that this piece of code does not show the selection handler, I fear it is a bug. If it is a bug let me know to fix it!