Skip to content

Commit 160acfa

Browse files
authored
Merge pull request #1 from fluttersdk/develop
v0.0.3
2 parents 1497eeb + e5bd696 commit 160acfa

23 files changed

+414
-121
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
# Changelog
22
This project follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html).
33

4+
## [0.0.3] - 2025-06-09
5+
6+
### Added
7+
- **Display Control (`hide`, `show`)**: Added new utility classes for responsive visibility control. Widgets now support class-based display toggling using `hide`, `show`, `lg:show`, `md:hide`, etc.
8+
- **`DisplayParser`**: New parser for handling display-related utility classes, with full support for screen breakpoints.
9+
- **New Example Page**: `/layouts/display` added to demonstrate display utilities in action (`example/lib/pages/layout/display.dart`).
10+
- **`applyBorderColor` & `applyBorderRadiusValue`**: New helper methods in `BorderParser` for parsing border color and border radius values.
11+
12+
### Changed
13+
- **Widgets Logging**: Improved debug logging via `hasDebugClassName`, now prints parsed class names and widgets (`WText`, `WFlex`, `WFlexible`, `WContainer`, etc.).
14+
- **`WFlexible`**: `child` is now nullable. Returns `Spacer` if `child` is `null`.
15+
- **`WContainer`**: Now wraps `Container` with `ClipRRect` if a `borderRadius` is specified.
16+
- **Shadow Color Logic**: Changed `BoxShadow` color alpha parsing from `.withValues(alpha: 25)` to `.withValues(alpha: 0.1)` for better consistency.
17+
18+
### Fixed
19+
- Fixed alignment mapping by adding support for `alignment-left` and `alignment-right`.
20+
- Fixed text alignment handling using `text-left`, `text-center`, etc., via `AlignmentParser.applyTextAlignment`.
21+
- Improved padding parser to return the original widget if padding is zero (prevents unnecessary widget wrapping).
22+
23+
### Removed
24+
- Deprecated custom `RenderObject` in `WGap` in favor of a simpler `StatelessWidget` using `SizedBox`.
25+
26+
This version introduces foundational support for display utilities and improves debugging and widget flexibility. It’s recommended to update to benefit from responsive visibility and streamlined layout logic.
27+
428
## [0.0.2] - 2025-02-02
529
- Added Github workflow for publishing package to pub.dev
630
- Updated README.md with installation and usage instructions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Or manually add it to your `pubspec.yaml`:
2121

2222
```yaml
2323
dependencies:
24-
fluttersdk_wind: ^0.0.2
24+
fluttersdk_wind: ^0.0.3
2525
```
2626
2727
Then, fetch dependencies:

example/lib/demo.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import 'pages/flex/gap_dynamic.dart';
2222
import 'pages/flex/justify_content.dart';
2323
import 'pages/flex/scrollable_overflow.dart';
2424
import 'pages/home.dart';
25+
import 'pages/layout/display.dart';
2526
import 'pages/sizing/height.dart';
2627
import 'pages/sizing/width.dart';
2728
import 'pages/spacing/margin.dart';
@@ -40,6 +41,7 @@ import 'pages/widgets/wflex.dart';
4041
import 'pages/widgets/wflexcontainer.dart';
4142
import 'pages/widgets/wflexible.dart';
4243
import 'pages/widgets/wtext.dart';
44+
import 'pages/example/product_grid.dart';
4345

4446
class MyApp extends StatelessWidget {
4547
final Widget Function(BuildContext) appCallback;
@@ -187,6 +189,10 @@ void main() {
187189
AppLayoutWidget(WFlexibleWidget()),
188190
'/widgets/wcontainer': (context) =>
189191
AppLayoutWidget(WContainerWidget()),
192+
'/layouts/display': (context) =>
193+
AppLayoutWidget(DisplayLayout()),
194+
'/example/product_grid': (context) =>
195+
AppLayoutWidget(ProductGrid()),
190196
},
191197
);
192198
},
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:fluttersdk_wind/fluttersdk_wind.dart';
3+
4+
class ProductGrid extends StatelessWidget {
5+
const ProductGrid({super.key});
6+
7+
@override
8+
Widget build(BuildContext context) {
9+
return Scaffold(
10+
backgroundColor: wColor('gray', shade: 200),
11+
body: WFlexContainer(
12+
className:
13+
'flex-col md:flex-row gap-4 p-4',
14+
children: [
15+
collectionCard(
16+
imageUrl: 'https://picsum.photos/400/300',
17+
title: 'Desk and Office',
18+
description: 'Work from home accessories'),
19+
collectionCard(
20+
imageUrl: 'https://picsum.photos/400/300',
21+
title: 'Self-Improvement',
22+
description: 'Journals and note-taking'),
23+
collectionCard(
24+
imageUrl: 'https://picsum.photos/400/300',
25+
title: 'Travel',
26+
description: 'Daily commute essentials')
27+
],
28+
),
29+
);
30+
}
31+
32+
Widget collectionCard({
33+
required String imageUrl,
34+
required String title,
35+
required String description,
36+
}) {
37+
return WFlexContainer(
38+
className: 'flex-1 flex-col gap-2',
39+
children: [
40+
WContainer(
41+
className: 'rounded-lg bg-white',
42+
child: Image.network(
43+
'https://picsum.photos/400/300',
44+
fit: BoxFit.cover,
45+
),
46+
),
47+
WText(title, className: 'text-base font-bold text-gray-900'),
48+
WText(description, className: 'text-sm text-gray-500'),
49+
],
50+
);
51+
}
52+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:fluttersdk_wind/fluttersdk_wind.dart';
3+
4+
class DisplayLayout extends StatelessWidget {
5+
const DisplayLayout({super.key});
6+
7+
@override
8+
Widget build(BuildContext context) {
9+
return WFlexContainer(
10+
className: 'flex-col bg-gray-100 h-64 justify-center items-center gap-4',
11+
children: [
12+
WFlexible(
13+
className: 'hide lg:show',
14+
child: WText('Visible on large and larger screens'),
15+
),
16+
WFlexible(
17+
className: 'hide md:show',
18+
child: WText('Visible on medium and larger screens'),
19+
),
20+
WFlexible(
21+
className: 'show md:hide',
22+
child: WText('Visible on only small screens'),
23+
),
24+
],
25+
);
26+
}
27+
}

example/pubspec.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ packages:
55
dependency: transitive
66
description:
77
name: async
8-
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
8+
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "2.12.0"
11+
version: "2.13.0"
1212
boolean_selector:
1313
dependency: transitive
1414
description:
@@ -61,10 +61,10 @@ packages:
6161
dependency: transitive
6262
description:
6363
name: fake_async
64-
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
64+
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
6565
url: "https://pub.dev"
6666
source: hosted
67-
version: "1.3.2"
67+
version: "1.3.3"
6868
ffi:
6969
dependency: transitive
7070
description:
@@ -149,10 +149,10 @@ packages:
149149
dependency: transitive
150150
description:
151151
name: leak_tracker
152-
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
152+
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
153153
url: "https://pub.dev"
154154
source: hosted
155-
version: "10.0.8"
155+
version: "10.0.9"
156156
leak_tracker_flutter_testing:
157157
dependency: transitive
158158
description:
@@ -370,10 +370,10 @@ packages:
370370
dependency: transitive
371371
description:
372372
name: vm_service
373-
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
373+
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
374374
url: "https://pub.dev"
375375
source: hosted
376-
version: "14.3.1"
376+
version: "15.0.0"
377377
web:
378378
dependency: transitive
379379
description:
@@ -386,10 +386,10 @@ packages:
386386
dependency: transitive
387387
description:
388388
name: webdriver
389-
sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8"
389+
sha256: "2f3a14ca026957870cfd9c635b83507e0e51d8091568e90129fbf805aba7cade"
390390
url: "https://pub.dev"
391391
source: hosted
392-
version: "3.0.4"
392+
version: "3.1.0"
393393
xdg_directories:
394394
dependency: transitive
395395
description:

lib/src/components/wcard.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
33
import '../helpers.dart';
44
import '../parsers/background_color_parser.dart';
55
import '../parsers/border_parser.dart';
6+
import '../parsers/display_parser.dart';
67
import '../parsers/flex_parser.dart';
78
import '../parsers/margin_parser.dart';
89
import '../parsers/padding_parser.dart';
@@ -75,6 +76,14 @@ class WCard extends StatelessWidget {
7576
Widget build(BuildContext context) {
7677
final String parsedClassName = classNameParser(className);
7778

79+
if (hasDebugClassName(className)) {
80+
print('WCard: $parsedClassName');
81+
}
82+
83+
if (DisplayParser.hide(context, parsedClassName)) {
84+
return const SizedBox.shrink();
85+
}
86+
7887
Widget childComponent = Card(
7988
color:
8089
color ?? BackgroundColorParser.applyColor(context, parsedClassName),

lib/src/components/wcontainer.dart

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
21
import 'package:flutter/material.dart';
32

43
import '../helpers.dart';
54
import '../parsers/alignment_parser.dart';
65
import '../parsers/background_color_parser.dart';
76
import '../parsers/border_parser.dart';
7+
import '../parsers/display_parser.dart';
88
import '../parsers/flex_parser.dart';
99
import '../parsers/margin_parser.dart';
1010
import '../parsers/padding_parser.dart';
@@ -87,30 +87,54 @@ class WContainer extends StatelessWidget {
8787
Widget build(BuildContext context) {
8888
final String parsedClassName = classNameParser(className);
8989

90-
var widget = FlexParser.applyFlexible(context, parsedClassName, Container(
91-
alignment: alignment ?? AlignmentParser.applyAlignment(context, parsedClassName),
90+
if (hasDebugClassName(className)) {
91+
print('WContainer: $parsedClassName');
92+
}
93+
94+
if (DisplayParser.hide(context, parsedClassName)) {
95+
return const SizedBox.shrink();
96+
}
97+
98+
final borderRadius =
99+
BorderParser.applyBorderRadiusGeometry(context, parsedClassName);
100+
101+
Widget widget = Container(
102+
alignment:
103+
alignment ?? AlignmentParser.applyAlignment(context, parsedClassName),
92104
padding: padding ?? PaddingParser.applyGeometry(context, parsedClassName),
93-
decoration: decoration ?? BoxDecoration(
94-
color: color ?? BackgroundColorParser.applyColor(context, parsedClassName),
95-
borderRadius: BorderParser.applyBorderRadiusGeometry(context, parsedClassName),
96-
border: BorderParser.applyBoxBorder(context, parsedClassName),
97-
boxShadow: ShadowParser.applyBoxShadows(context, parsedClassName) ?? [],
98-
),
105+
decoration: decoration ??
106+
BoxDecoration(
107+
color: color ?? BackgroundColorParser.applyColor(context, parsedClassName),
108+
border: BorderParser.applyBoxBorder(context, parsedClassName),
109+
borderRadius: borderRadius,
110+
boxShadow:
111+
ShadowParser.applyBoxShadows(context, parsedClassName) ?? [],
112+
),
99113
foregroundDecoration: foregroundDecoration,
100114
width: width ?? SizeParser.applyWidth(context, parsedClassName),
101115
height: height ?? SizeParser.applyHeight(context, parsedClassName),
102-
constraints: constraints ?? SizeParser.applyBoxConstraints(context, parsedClassName),
116+
constraints: constraints ??
117+
SizeParser.applyBoxConstraints(context, parsedClassName),
103118
margin: margin ?? MarginParser.applyGeometry(context, parsedClassName),
104119
transform: transform,
105120
transformAlignment: transformAlignment,
106121
clipBehavior: clipBehavior,
107122
child: child,
108-
));
123+
);
124+
125+
if (borderRadius != null) {
126+
widget = ClipRRect(
127+
borderRadius: borderRadius,
128+
child: widget,
129+
);
130+
}
131+
132+
widget = FlexParser.applyFlexible(context, parsedClassName, widget);
109133

110134
if (hasDebugWidgetClassName(className)) {
111135
print(widget.toStringDeep());
112136
}
113137

114138
return widget;
115139
}
116-
}
140+
}

lib/src/components/wflex.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
import '../helpers.dart';
4+
import '../parsers/display_parser.dart';
45
import '../parsers/flex_parser.dart';
56

67
/// A utility-first widget for creating flexible layouts in the Wind plugin.
@@ -66,6 +67,14 @@ class WFlex extends StatelessWidget {
6667
Widget build(BuildContext context) {
6768
final String parsedClassName = classNameParser(className);
6869

70+
if (hasDebugClassName(className)) {
71+
print('WFlex: $parsedClassName');
72+
}
73+
74+
if (DisplayParser.hide(context, parsedClassName)) {
75+
return const SizedBox.shrink();
76+
}
77+
6978
final widget = FlexParser.applyOverflow(
7079
context,
7180
parsedClassName,
@@ -86,8 +95,8 @@ class WFlex extends StatelessWidget {
8695
FlexParser.applyGapToChildren(context, parsedClassName, children),
8796
));
8897

89-
if (hasDebugWidgetClassName(className)) {
90-
print(widget.toStringDeep());
98+
if (hasDebugClassName(className)) {
99+
print('WFlex: $parsedClassName widget: ${widget.toStringDeep()}');
91100
}
92101

93102
return widget;

lib/src/components/wflex_container.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/cupertino.dart';
22

33
import '../helpers.dart';
4+
import '../parsers/display_parser.dart';
45
import '../parsers/flex_parser.dart';
56
import 'wcontainer.dart';
67
import 'wflex.dart';
@@ -106,6 +107,14 @@ class WFlexContainer extends StatelessWidget {
106107
Widget build(BuildContext context) {
107108
final parsedClassName = classNameParser(className);
108109

110+
if (hasDebugClassName(className)) {
111+
print('WFlexContainer: $parsedClassName');
112+
}
113+
114+
if (DisplayParser.hide(context, parsedClassName)) {
115+
return const SizedBox.shrink();
116+
}
117+
109118
return WContainer(
110119
className: className,
111120
alignment: alignment ?? FlexParser.applyAlignment(context, parsedClassName),

0 commit comments

Comments
 (0)