Skip to content

Commit

Permalink
doc alert conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
aprosail committed May 16, 2024
2 parents 5c39ad2 + 93fff9a commit eeee180
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 3 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 24 additions & 0 deletions lib/src/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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),
Expand All @@ -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<String> fontFamilyFallback,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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"}

Expand Down

0 comments on commit eeee180

Please sign in to comment.