SelectionArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Flutter',
style: TextStyle(fontSize: 36, fontWeight: FontWeight.bold),
),
const SizedBox(height: 40),
const Text(
'Flutter version >= 3.3 Selectable texts',
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
const Text(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {},
child: const Text('Button'),
),
],
),
)
2条答案
按热度按时间acruukt91#
Web与您的应用程序的行为相同,为了使文本可选择,您将其 Package 在
SelectableText
小部件中。例如:
更新Flutter版本>= 3.3
引入了一个新的小部件
SelectionArea
。该小部件自动使其子代文本小部件成为可选择的。例如:
tyu7yeag2#
Flutter 3.3版本中有一个新的小部件
SelectionArea
。它允许在其中选择多个文本小部件。https://api.flutter.dev/flutter/material/SelectionArea-class.html