diff --git a/CHANGELOG.md b/CHANGELOG.md index 7849502..9e9ca4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.4.1 + +- Doc alert value modify cover in the same context. +- Update example code. + ## 0.4.0 - Wrap string into text widget. diff --git a/example/lib/main.dart b/example/lib/main.dart index e0b5ffe..5821011 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -9,8 +9,10 @@ class App extends StatelessWidget { const App({super.key}); @override - Widget build(BuildContext context) => const Text('app root') + Widget build(BuildContext context) => 'app root' + .textWidget .wrapCenter + .wrap((context, child) => child.wrapFontSize(context, 50)) .wrapForeground(context, const Color(0xffdedcda)) .wrapBackground(const Color(0xff804044)) .ensureTextEnvironment(context); diff --git a/lib/src/text.dart b/lib/src/text.dart index df3b19f..b61d972 100644 --- a/lib/src/text.dart +++ b/lib/src/text.dart @@ -70,7 +70,9 @@ extension WrapTextStyle on Widget { /// When you are going to modify more than one property, /// you should use [modifyTextStyle] or [wrapTextStyle] instead, /// which is more effective. + /// /// Calling those methods more than once might waste performance. + /// And calling them in the same context will cover the previous value. Widget wrapFontSize(BuildContext context, double size) { assert(size > 0); return DefaultTextStyle( @@ -81,7 +83,14 @@ extension WrapTextStyle on Widget { /// Same as copy and modify the font family of [DefaultTextStyle.style] /// and wrap this widget with such data. + /// + /// This method will only modify one property. + /// When you are going to modify more than one property, + /// you should use [modifyTextStyle] or [wrapTextStyle] instead, + /// which is more effective. + /// /// Calling those methods more than once might waste performance. + /// And calling them in the same context will cover the previous value. Widget wrapFontFamily(BuildContext context, String family) => DefaultTextStyle( style: DefaultTextStyle.of(context).style.copyWith(fontFamily: family), @@ -91,7 +100,14 @@ extension WrapTextStyle on Widget { /// Same as copy and modify the font family fallback /// of [DefaultTextStyle.style] /// and wrap this widget with such data. + /// + /// This method will only modify one property. + /// When you are going to modify more than one property, + /// you should use [modifyTextStyle] or [wrapTextStyle] instead, + /// which is more effective. + /// /// Calling those methods more than once might waste performance. + /// And calling them in the same context will cover the previous value. Widget wrapFontFamilyFallback( BuildContext context, List fontFamilyFallback, @@ -105,6 +121,14 @@ extension WrapTextStyle on Widget { /// Same as copy and modify the color of [DefaultTextStyle.style] /// and wrap this widget with such data. + /// + /// This method will only modify one property. + /// When you are going to modify more than one property, + /// you should use [modifyTextStyle] or [wrapTextStyle] instead, + /// which is more effective. + /// + /// Calling those methods more than once might waste performance. + /// And calling them in the same context will cover the previous value. Widget wrapFontColor(BuildContext context, Color color) => DefaultTextStyle( style: DefaultTextStyle.of(context).style.copyWith(color: color), child: this, diff --git a/pubspec.yaml b/pubspec.yaml index 1003f77..b727218 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: wrap description: Chain style programming syntax sugar utilities for flutter widgets. -version: 0.4.0 +version: 0.4.1 repository: https://github.com/aprosail/wrap environment: {sdk: ">=3.3.4 <4.0.0", flutter: ">=3.19.6"}