From f821869e1c523486d446877e1a06c83cdb136016 Mon Sep 17 00:00:00 2001 From: Marco <64715619+musiolmarco@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:50:57 +0100 Subject: [PATCH 1/2] Added custom colors for text --- lib/error_text_widget.dart | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/error_text_widget.dart b/lib/error_text_widget.dart index 89e6d7c..01cff32 100644 --- a/lib/error_text_widget.dart +++ b/lib/error_text_widget.dart @@ -60,6 +60,12 @@ class ErrorTextWidget extends StatelessWidget { /// [TextOverflow] for the title text widget final TextOverflow? titleTextOverflow; + /// [Color] that will overwrite the title [TextStyle] color + final Color? titleColor; + + /// [Color] that will overwrite the description [TextStyle] color + final Color? descriptionColor; + const ErrorTextWidget({ super.key, this.titleText, @@ -70,6 +76,8 @@ class ErrorTextWidget extends StatelessWidget { this.onRefreshIcon, this.titleTextOverflow, this.descriptionTextOverflow, + this.descriptionColor, + this.titleColor, }); /// This method can be used to setup default values for the widget @@ -115,7 +123,12 @@ class ErrorTextWidget extends StatelessWidget { Flexible( child: Text( titleText ?? _defaultTitleText, - style: titleTextStyle ?? _defaultTitleTextStyle, + style: titleTextStyle?.copyWith( + color: titleColor, + ) ?? + _defaultTitleTextStyle.copyWith( + color: titleColor, + ), textAlign: TextAlign.center, overflow: _defaultTitleTextOverflow ?? titleTextOverflow, ), @@ -127,7 +140,10 @@ class ErrorTextWidget extends StatelessWidget { child: Text( descriptionText ?? _defaultDescriptionText, textAlign: TextAlign.center, - style: descriptionTextStyle ?? _defaultDescriptionTextStyle, + style: descriptionTextStyle?.copyWith(color: descriptionColor) ?? + _defaultDescriptionTextStyle?.copyWith( + color: descriptionColor, + ), overflow: _defaultDescriptionTextOverflow ?? descriptionTextOverflow, ), From f8461a9db6c9f09574e27861d762fdc67938deaa Mon Sep 17 00:00:00 2001 From: Marco <64715619+musiolmarco@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:53:06 +0100 Subject: [PATCH 2/2] Increased app- and some package versions --- example/error_text_widget_example/pubspec.lock | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/error_text_widget_example/pubspec.lock b/example/error_text_widget_example/pubspec.lock index 51e78d6..3d7d1fa 100644 --- a/example/error_text_widget_example/pubspec.lock +++ b/example/error_text_widget_example/pubspec.lock @@ -55,7 +55,7 @@ packages: path: "../.." relative: true source: path - version: "3.0.0" + version: "3.0.2" fake_async: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5e8ba11..90b0d6b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: error_text_widget description: Displaying errors easy in Flutter -version: 3.0.1 +version: 3.0.2 homepage: https://github.com/musiolmarco/error_text_widget environment: