Skip to content

Commit 7302dc5

Browse files
ci: bump version to v0.4.13
1 parent 8668843 commit 7302dc5

5 files changed

Lines changed: 62 additions & 32 deletions

File tree

lib/src/prioritized_indexed_stack/prioritized_indexed_stack.dart

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class PrioritizedIndexedStack extends StatelessWidget {
3636

3737
@override
3838
Widget build(BuildContext context) {
39-
final effectiveIndices = indices.map((index) => index == -1 ? null : index).toList();
39+
final effectiveIndices = indices
40+
.map((index) => index == -1 ? null : index)
41+
.toList();
4042

4143
final childOriginalIndexToStackingOrder = <int, int>{};
4244
if (children.isNotEmpty) {
@@ -92,7 +94,8 @@ class _RawPrioritizedIndexedStack extends Stack {
9294
context,
9395
alignment: alignment,
9496
textDirection: textDirection,
95-
why: () => 'to resolve $alignment for this PrioritizedIndexedStack widget',
97+
why: () =>
98+
'to resolve $alignment for this PrioritizedIndexedStack widget',
9699
),
97100
);
98101
return RenderPrioritizedIndexedStack(
@@ -115,7 +118,8 @@ class _RawPrioritizedIndexedStack extends Stack {
115118
context,
116119
alignment: alignment,
117120
textDirection: textDirection,
118-
why: () => 'to resolve $alignment for this PrioritizedIndexedStack widget',
121+
why: () =>
122+
'to resolve $alignment for this PrioritizedIndexedStack widget',
119123
),
120124
);
121125
renderObject
@@ -144,8 +148,8 @@ class RenderPrioritizedIndexedStack extends RenderStack {
144148
super.textDirection,
145149
super.fit,
146150
super.clipBehavior,
147-
}) : _indices = indices,
148-
_layerEffects = layerEffects;
151+
}) : _indices = indices,
152+
_layerEffects = layerEffects;
149153

150154
List<int?> _indices;
151155
List<int?> get indices => _indices;
@@ -185,15 +189,20 @@ class RenderPrioritizedIndexedStack extends RenderStack {
185189
return;
186190
}
187191

188-
for (var stackingOrder = _indices.length - 1; stackingOrder >= 0; stackingOrder--) {
192+
for (
193+
var stackingOrder = _indices.length - 1;
194+
stackingOrder >= 0;
195+
stackingOrder--
196+
) {
189197
final childOriginalIndex = _indices[stackingOrder];
190198
if (childOriginalIndex == null) continue;
191199

192200
final childToPaint = _getChildRenderBox(childOriginalIndex);
193201
if (childToPaint == null) continue;
194202

195203
final childParentData = childToPaint.parentData! as StackParentData;
196-
final effectData = (_layerEffects != null && stackingOrder < _layerEffects!.length)
204+
final effectData =
205+
(_layerEffects != null && stackingOrder < _layerEffects!.length)
197206
? _layerEffects![stackingOrder]
198207
: null;
199208

@@ -209,7 +218,8 @@ class RenderPrioritizedIndexedStack extends RenderStack {
209218
var needsSaveLayer = false;
210219
if (effectData != null) {
211220
// Check if effectData itself is non-null
212-
needsSaveLayer = (currentOpacity != null && currentOpacity < 1.0) ||
221+
needsSaveLayer =
222+
(currentOpacity != null && currentOpacity < 1.0) ||
213223
currentColorFilter != null ||
214224
currentImageFilter != null;
215225
}
@@ -237,7 +247,9 @@ class RenderPrioritizedIndexedStack extends RenderStack {
237247
);
238248
}
239249

240-
final offsetForPainter = needsSaveLayer ? Offset.zero : absoluteChildPaintOrigin;
250+
final offsetForPainter = needsSaveLayer
251+
? Offset.zero
252+
: absoluteChildPaintOrigin;
241253

242254
if (animationTransform != null && !animationTransform.isIdentity()) {
243255
context.pushTransform(
@@ -350,14 +362,19 @@ class RenderPrioritizedIndexedStack extends RenderStack {
350362
return false;
351363
}
352364

353-
for (var stackingOrder = 0; stackingOrder < _indices.length; stackingOrder++) {
365+
for (
366+
var stackingOrder = 0;
367+
stackingOrder < _indices.length;
368+
stackingOrder++
369+
) {
354370
final childOriginalIndex = _indices[stackingOrder];
355371
if (childOriginalIndex == null) continue;
356372

357373
final childToTest = _getChildRenderBox(childOriginalIndex);
358374
if (childToTest == null) continue;
359375

360-
final effectData = (_layerEffects != null && stackingOrder < _layerEffects!.length)
376+
final effectData =
377+
(_layerEffects != null && stackingOrder < _layerEffects!.length)
361378
? _layerEffects![stackingOrder]
362379
: null;
363380

@@ -379,15 +396,16 @@ class RenderPrioritizedIndexedStack extends RenderStack {
379396
hitted = result.addWithPaintTransform(
380397
transform: currentTransform,
381398
position: position - childStackOffset,
382-
hitTest: (
383-
BoxHitTestResult hitTestResult,
384-
Offset transformedLocalPosition,
385-
) {
386-
return childToTest.hitTest(
387-
hitTestResult,
388-
position: transformedLocalPosition,
389-
);
390-
},
399+
hitTest:
400+
(
401+
BoxHitTestResult hitTestResult,
402+
Offset transformedLocalPosition,
403+
) {
404+
return childToTest.hitTest(
405+
hitTestResult,
406+
position: transformedLocalPosition,
407+
);
408+
},
391409
);
392410
} else {
393411
hitted = result.addWithPaintOffset(
@@ -479,7 +497,8 @@ class RenderPrioritizedIndexedStack extends RenderStack {
479497
class _PrioritizedIndexedStackElement extends MultiChildRenderObjectElement {
480498
_PrioritizedIndexedStackElement(_RawPrioritizedIndexedStack super.widget);
481499
@override
482-
_RawPrioritizedIndexedStack get widget => super.widget as _RawPrioritizedIndexedStack;
500+
_RawPrioritizedIndexedStack get widget =>
501+
super.widget as _RawPrioritizedIndexedStack;
483502
// ... (debugVisitOnstageChildren remains the same) ...
484503
@override
485504
void debugVisitOnstageChildren(ElementVisitor visitor) {
@@ -493,7 +512,9 @@ class _PrioritizedIndexedStackElement extends MultiChildRenderObjectElement {
493512
// ignore: prefer_collection_literals
494513
final visitedChildIndices = LinkedHashSet<int>();
495514
for (final targetIndex in effectiveIndices) {
496-
if (targetIndex != null && targetIndex >= 0 && targetIndex < children.length) {
515+
if (targetIndex != null &&
516+
targetIndex >= 0 &&
517+
targetIndex < children.length) {
497518
if (visitedChildIndices.add(targetIndex)) {
498519
visitor(children.elementAt(targetIndex));
499520
}

lib/src/route_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class RouteBuilder<TExtra extends Object?> {
4242
routeState: routeState ?? this.routeState,
4343
shouldPreserve: shouldPreserve ?? this.shouldPreserve,
4444
shouldPrebuild: shouldPrebuild ?? this.shouldPrebuild,
45-
builder: builder ?? this.builder as TRouteWidgetBuilder<TExtra>,
45+
builder: builder ?? this.builder,
4646
condition: condition ?? this.condition,
4747
);
4848
}

lib/src/route_controller.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class RouteController {
4848
RouteState Function()? initialRouteState,
4949
this.errorRouteState,
5050
required this.fallbackRouteState,
51-
required List<RouteBuilder> builders, // Changed: parameter name, not assigned to a field
51+
required List<RouteBuilder>
52+
builders, // Changed: parameter name, not assigned to a field
5253
}) {
5354
// Initialize the _builderMap from the `builders` parameter
5455
_builderMap = {
@@ -59,15 +60,17 @@ class RouteController {
5960
// Set all the builder output to SizedBox.shrink.
6061
resetState();
6162
_requested = current;
62-
final routeState = initialRouteState?.call() ?? _requested ?? fallbackRouteState();
63+
final routeState =
64+
initialRouteState?.call() ?? _requested ?? fallbackRouteState();
6365
push(routeState);
6466
}
6567

6668
//
6769
//
6870
//
6971

70-
RouteState getNavigatorOrFallbackRouteState() => _requested ?? fallbackRouteState();
72+
RouteState getNavigatorOrFallbackRouteState() =>
73+
_requested ?? fallbackRouteState();
7174

7275
//
7376
//
@@ -140,8 +143,9 @@ class RouteController {
140143
void resetState() {
141144
clearCache();
142145
// Now iterates over _builderMap.values.
143-
final routeStates =
144-
_builderMap.values.where((builder) => builder.shouldPrebuild).map((e) => e.routeState);
146+
final routeStates = _builderMap.values
147+
.where((builder) => builder.shouldPrebuild)
148+
.map((e) => e.routeState);
145149
addToCache(routeStates);
146150
}
147151

@@ -344,7 +348,8 @@ class RouteController {
344348
//
345349

346350
static RouteController of(BuildContext context) {
347-
final provider = context.dependOnInheritedWidgetOfExactType<RouteControllerProvider>();
351+
final provider = context
352+
.dependOnInheritedWidgetOfExactType<RouteControllerProvider>();
348353
if (provider == null) {
349354
throw Log.err('No RouteStateControllerProvider found in context');
350355
}

lib/src/route_state.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ class RouteState<TExtra extends Object?> {
7979
queryParameters: queryParameters ? this.uri.queryParameters : null,
8080
extra: extra ? this.extra : null,
8181
skipCurrent: skipCurrent ? this.skipCurrent : true,
82-
animationEffect: animationEffect ? const NoEffect() : this.animationEffect,
82+
animationEffect: animationEffect
83+
? const NoEffect()
84+
: this.animationEffect,
8385
condition: condition ? this.condition : null,
8486
);
8587
}
8688

87-
RouteState<X?> cast<X extends Object?>() => RouteState<X?>(uri, extra: extra as X?);
89+
RouteState<X?> cast<X extends Object?>() =>
90+
RouteState<X?>(uri, extra: extra as X?);
8891

8992
bool matchPath(RouteState other) => uri.path == other.uri.path;
9093

lib/src/route_widget_builder.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class RouteWidgetBuilder<TExtra extends Object?> extends StatelessWidget
1818
with RouteWidgetMixin<TExtra> {
1919
@override
2020
final RouteState<TExtra?>? routeState;
21-
final Widget Function(BuildContext context, RouteState<TExtra?>? routeState) builder;
21+
final Widget Function(BuildContext context, RouteState<TExtra?>? routeState)
22+
builder;
2223

2324
const RouteWidgetBuilder({super.key, this.routeState, required this.builder});
2425

0 commit comments

Comments
 (0)