Skip to content

Commit

Permalink
🔖 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
g-apparence committed Jun 20, 2024
1 parent 758c1b1 commit 1a22b1e
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 40 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A set of amazing onboarding widgets for your flutter applications.
## Install package
add in your pubspec.yaml dependencies

```pal-widgets: 0.2.0```
```pal-widgets: 0.3.0```

----

Expand Down Expand Up @@ -56,7 +56,6 @@ Text(
You can now show an anchored helper using
```dart
final helper = AnchoredHelper(
anchorKeyId: 'text1',
title: const Text('Title lorem pitume'),
description: const Text('Lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum'),,
bgColor: Colors.blue,
Expand All @@ -78,7 +77,6 @@ HelperOrchestrator.of(context).showAnchoredHelper('text1', helper);

| Property | description | Required |
|--------------------|----------------------------------------------|-------------|
| anchorKeyId | The reference to the [Key] created by [HelperOrchestrator] |:white_check_mark:|
| title | A Text widget to show as title | |
| description | A Text widget to show as description | |
| bgColor | A Color as Overlayed background | :white_check_mark: |
Expand All @@ -97,4 +95,4 @@ There is two Hole Anchor widget factories :
- ```AnchoredRectHoleHelper.anchorFactory``` : creates a rectangle hole on strict widget bounds

## Any question?
Contact us on [our twitter](https://twitter.com/PalFlutter) or email gautier[@@]pal-plugin.tech
Contact us on [our twitter](https://twitter.com/PalFlutter)
4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ packages:
dependency: "direct main"
description:
name: cupertino_icons
sha256: "486b7bc707424572cdf7bd7e812a0c146de3fd47ecadf070254cc60383f21dd8"
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
url: "https://pub.dev"
source: hosted
version: "1.0.3"
version: "1.0.8"
fake_async:
dependency: transitive
description:
Expand Down
11 changes: 4 additions & 7 deletions lib/anchored/anchored_helper_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class AnchorHelperWrapper extends InheritedWidget {
/// You are free to add a positiv button / negativ button or an onTap function
/// on the anchor.
class AnchoredHelper extends StatefulWidget {

/// A [Text] widget to show as title
final Text? title;

Expand Down Expand Up @@ -157,7 +156,7 @@ class _AnchoredHelperState extends State<AnchoredHelper>
// print("anchor: ${anchor.offset} ${anchor.size}: ${anchor.rect}");
return GestureDetector(
onTap: () async {
if(widget.onTapBackground != null) {
if (widget.onTapBackground != null) {
HapticFeedback.selectionClick();
await fadeAnimController.reverse();
widget.onTapBackground!.call();
Expand Down Expand Up @@ -190,9 +189,7 @@ class _AnchoredHelperState extends State<AnchoredHelper>
child: LayoutBuilder(
builder: (context, constraints) => Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 8.0
),
horizontal: 16.0, vertical: 8.0),
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
Expand All @@ -202,7 +199,7 @@ class _AnchoredHelperState extends State<AnchoredHelper>
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
if(widget.title != null)
if (widget.title != null)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
child: PopAnimation(
Expand All @@ -212,7 +209,7 @@ class _AnchoredHelperState extends State<AnchoredHelper>
child: widget.title!,
),
),
if(widget.description != null)
if (widget.description != null)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
child: PopAnimation(
Expand Down
19 changes: 13 additions & 6 deletions lib/helper_orchestrator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class HelperOrchestrator extends StatefulWidget {
final GlobalKey<NavigatorState>? navigatorKey;

const HelperOrchestrator({
Key? key,
required this.child,
Key? key,
required this.child,
this.navigatorKey,
}) : super(key: key);

Expand Down Expand Up @@ -89,7 +89,7 @@ class HelperOrchestratorState extends State<HelperOrchestrator> {
@override
void didChangeDependencies() {
super.didChangeDependencies();
if(widget.navigatorKey != null) {
if (widget.navigatorKey != null) {
_elementFinder = ElementFinder(navigatorKey: widget.navigatorKey);
} else {
_elementFinder = ElementFinder(buildContext: context);
Expand Down Expand Up @@ -123,7 +123,11 @@ class HelperOrchestratorState extends State<HelperOrchestrator> {
/// ```dart
/// HelperOrchestrator.of(context).generateKey('myKeyId')
/// ```
Future showAnchoredHelper(String anchorKeyId, AnchoredHelper helper, {HelperAlignment? align,}) async {
Future showAnchoredHelper(
String anchorKeyId,
AnchoredHelper helper, {
HelperAlignment? align,
}) async {
try {
//final key = getAnchorKey(anchorKeyId) as ValueKey<String>;
final anchor = await findAnchor(anchorKeyId, align: align);
Expand All @@ -147,7 +151,10 @@ class HelperOrchestratorState extends State<HelperOrchestrator> {
/// containing the key.
///
/// this requires an [anchorKeyId] to search within our keys
Future<Anchor?> findAnchor(String anchorKeyId, {HelperAlignment? align,}) async {
Future<Anchor?> findAnchor(
String anchorKeyId, {
HelperAlignment? align,
}) async {
final element = _elementFinder! //
.searchChildElementByKey(getAnchorKey(anchorKeyId));
if (element == null || element.bounds == null) {
Expand All @@ -156,7 +163,7 @@ class HelperOrchestratorState extends State<HelperOrchestrator> {
}
final anchorSize = element.bounds!.size;
final currentPos = element.offset!;
if(align != null) {
if (align != null) {
return Anchor(
size: anchorSize,
offset: currentPos,
Expand Down
8 changes: 4 additions & 4 deletions lib/services/element_finder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ElementFinder {
// this method scan all child recursively to find a widget having a key == searchedKey
ElementModel? searchChildElement(String? key) {
ElementModel? result;
context.visitChildElements((element) => result =
_searchChildElement(context.findRenderObject(), element, key));
context.visitChildElements((element) =>
result = _searchChildElement(context.findRenderObject(), element, key));
if (result == null) {
return ElementModel.empty();
}
Expand Down Expand Up @@ -77,8 +77,8 @@ class ElementFinder {
case HelperAlignment.left:
return Rect.fromLTWH(0, 0, objectX, layerRect.height);
case HelperAlignment.right:
return Rect.fromLTWH(objectEndX, 0, layerRect.width - objectEndX,
layerRect.height);
return Rect.fromLTWH(
objectEndX, 0, layerRect.width - objectEndX, layerRect.height);
}
}

Expand Down
28 changes: 14 additions & 14 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.1"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -119,10 +119,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.12.0"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -180,10 +180,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.0"
vector_math:
dependency: transitive
description:
Expand All @@ -196,10 +196,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "13.0.0"
version: "14.2.1"
sdks:
dart: ">=3.2.0-0 <4.0.0"
flutter: ">=1.17.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pal_widgets
description: A set of amazing onboarding widgets for your flutter applications.
version: 0.2.0
version: 0.3.0
repository: https://github.com/Apparence-io/pal-widgets

environment:
Expand Down
7 changes: 5 additions & 2 deletions test/screen_variants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ extension ScreenSizeManager on WidgetTester {
double pixelDensity = 1}) async {
final size = Size(width, height);
await binding.setSurfaceSize(size);
binding.window.physicalSizeTestValue = size;
binding.window.devicePixelRatioTestValue = pixelDensity;
view.physicalSize = size;
view.devicePixelRatio = pixelDensity;
// Old code
// binding.window.physicalSizeTestValue = size;
// binding.window.devicePixelRatioTestValue = pixelDensity;
}
}

0 comments on commit 1a22b1e

Please sign in to comment.