Created
February 21, 2020 09:35
-
-
Save ericorruption/3ce20c83ed6f1738d3989c543a4ab2e8 to your computer and use it in GitHub Desktop.
readOnly textField - cannot copy text
This file contains hidden or 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 { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: Scaffold( | |
body: Padding( | |
padding: EdgeInsets.all(24), | |
child: Center( | |
child: TextField( | |
readOnly: true, | |
controller: TextEditingController(text: | |
'line 1\n' | |
'\n' | |
'\n' | |
'line last' | |
), | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment