Skip to content

Instantly share code, notes, and snippets.

@stofte
Last active March 1, 2024 14:31
Show Gist options
  • Save stofte/77c52eea94e1327ace29c61dc000efa2 to your computer and use it in GitHub Desktop.
Save stofte/77c52eea94e1327ace29c61dc000efa2 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Column(
children: [
SelectableText.rich(
TextSpan(
text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
),
),
SelectableText.rich(
TextSpan(
text: 'XXXXXXXXXXXXXXXXXXXX',
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
baseline: TextBaseline.alphabetic,
child: Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
border: Border(
left: BorderSide(width: 5.2, color: Colors.yellow),
),
),
child: Text('X'),
),
),
TextSpan(
text: 'XXXXXXXXXXXXXXXXXXX',
),
],
),
),
SelectableText.rich(
TextSpan(
text: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
),
),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment