Skip to content

Instantly share code, notes, and snippets.

@JOSHIMOH
Last active November 22, 2019 08:08
Show Gist options
  • Select an option

  • Save JOSHIMOH/e9d07bae44dc9872beb364313f942081 to your computer and use it in GitHub Desktop.

Select an option

Save JOSHIMOH/e9d07bae44dc9872beb364313f942081 to your computer and use it in GitHub Desktop.
selectable text
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: MyHomePage(title: 'Flutter Demo Selectable Text'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, 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>[
Padding(
padding: const EdgeInsets.all(20.0),
child: SelectableText(
"Flutter is an open-source UI software development kit created by Google."
,
style: TextStyle(
color: Colors.deepPurple,
fontSize: 15,
fontWeight: FontWeight.bold),
showCursor: true,
cursorWidth: 2,
cursorRadius: Radius.circular(10.0),
cursorColor: Colors.red,
enableInteractiveSelection: true,
toolbarOptions: ToolbarOptions(
copy: true, cut: true, paste: true, selectAll: true),
scrollPhysics: BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
),
)
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment