feat(ui_component): add string extension to easely wrap text

This commit is contained in:
2023-02-09 18:08:03 +01:00
parent ac432f6dc8
commit efa7ca09dd
3 changed files with 37 additions and 12 deletions
@@ -28,17 +28,17 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) => ComponentTheme(
componentThemeWidget: AppThemeComponent.components,
child: MaterialApp(
title: 'Wyatt Ui Components Example',
theme: ThemeData(
primarySwatch: Colors.blue,
componentThemeWidget: AppThemeComponent.components,
child: MaterialApp(
title: 'Wyatt Ui Components Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const Scaffold(
body: Home(),
),
),
home: const Scaffold(
body: Home(),
),
),
);
);
}
class Home extends StatelessWidget {
@@ -48,14 +48,15 @@ class Home extends StatelessWidget {
Widget build(BuildContext context) => Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: context.components.appBar?.copyWith.title('Example title') ??
child: context.components.appBar?.copyWith
.title('Example title'.wrap()) ??
const SizedBox.shrink(),
),
body: Column(
children: [
Expanded(
child: context.components.errorWidget
?.copyWith(error: 'Example erreur') ??
?.copyWith(error: 'Example erreur'.wrap()) ??
const SizedBox.shrink(),
),
const SizedBox(