wx_text 1.0.0 wx_text: ^1.0.0 copied to clipboard
A powerful widget that builds upon the familiar Flutter Text widget, offering additional functionalities for a richer text display experience.
/* spell-checker: disable */
import 'package:flutter/material.dart';
import 'package:wx_text/wx_text.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Wx Text Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Wx Text Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: 500,
),
child: const Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ColoredBox(
color: Colors.black12,
child: WxText.headlineMedium(
'Text with a minimum of 3 lines',
minLines: 3,
),
),
SizedBox(height: 20),
WxText.bodyLarge(
'Highlighted 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',
highlight: 'dolor',
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
SizedBox(height: 20),
WxTextStyler(
variant: WxTextVariant.headlineLarge,
child: Wrap(
spacing: 5,
children: [
WxText('Apply'),
WxText('styles'),
WxText('to multiple'),
WxText('text'),
WxText('widgets'),
],
),
),
],
),
),
),
),
);
}
}