A selectable text is a widget that allows to display a text and lets the user select and copy words.
A SelectableText class is used to create a selectable text.
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: MyApp()));
class MyApp extends StatefulWidget {
  const MyApp({super.key});
  @override
  State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Selectable text')),
      body: const SelectableText(
        'Lorem Ipsum is simply dummy text.',
        style: TextStyle(fontSize: 20.0),
      ),
    );
  }
} 
             
                         
                         
                        
Leave a Comment
Cancel reply