diff --git a/packages/wyatt_ui_components/example/lib/main.dart b/packages/wyatt_ui_components/example/lib/main.dart
index 2ee31aeb..d49b551b 100644
--- a/packages/wyatt_ui_components/example/lib/main.dart
+++ b/packages/wyatt_ui_components/example/lib/main.dart
@@ -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(
diff --git a/packages/wyatt_ui_components/lib/src/core/core.dart b/packages/wyatt_ui_components/lib/src/core/core.dart
index dd4b140f..079c0687 100644
--- a/packages/wyatt_ui_components/lib/src/core/core.dart
+++ b/packages/wyatt_ui_components/lib/src/core/core.dart
@@ -15,5 +15,6 @@
// along with this program. If not, see .
export 'extensions/build_context_extensions.dart';
+export 'extensions/string_extension.dart';
export 'mixins/copy_with_mixin.dart';
export 'utils/text_wrapper.dart';
diff --git a/packages/wyatt_ui_components/lib/src/core/extensions/string_extension.dart b/packages/wyatt_ui_components/lib/src/core/extensions/string_extension.dart
new file mode 100644
index 00000000..d0e7817e
--- /dev/null
+++ b/packages/wyatt_ui_components/lib/src/core/extensions/string_extension.dart
@@ -0,0 +1,23 @@
+// Copyright (C) 2023 WYATT GROUP
+// Please see the AUTHORS file for details.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+import 'package:flutter/widgets.dart';
+import 'package:wyatt_ui_components/src/core/utils/text_wrapper.dart';
+
+extension StringExtension on String? {
+ TextWrapper? wrap({TextStyle? style}) =>
+ this != null ? TextWrapper(this!, style: style) : null;
+}