Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/framework/utils/flutter_type_converters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,13 @@ abstract class To {

static AlignmentDirectional stackChildAlignment(String? fit) => switch (fit) {
'center' => AlignmentDirectional.center,
'topEnd' => AlignmentDirectional.topEnd,
'topEnd' || 'topRight' => AlignmentDirectional.topEnd,
'topCenter' => AlignmentDirectional.topCenter,
'centerEnd' => AlignmentDirectional.centerEnd,
'centerStart' => AlignmentDirectional.centerStart,
'bottomStart' => AlignmentDirectional.bottomStart,
'bottomCenter' => AlignmentDirectional.bottomCenter,
'bottomEnd' => AlignmentDirectional.bottomEnd,
'bottomEnd' || 'bottomRight' => AlignmentDirectional.bottomEnd,
_ => AlignmentDirectional.topStart
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class NavigationBarCustomProps {
final ExprOr<String>? overlayColor;
final ExprOr<String>? indicatorColor;
final ExprOr<String>? indicatorShape;
final ExprOr<bool>? rebuildOnEveryLoad;
final List<Object?>? shadow;
final String? borderRadius;

Expand All @@ -23,6 +24,7 @@ class NavigationBarCustomProps {
this.overlayColor,
this.indicatorColor,
this.indicatorShape,
this.rebuildOnEveryLoad,
});

factory NavigationBarCustomProps.fromJson(JsonLike json) {
Expand All @@ -34,6 +36,7 @@ class NavigationBarCustomProps {
overlayColor: ExprOr.fromJson<String>(json['overlayColor']),
indicatorColor: ExprOr.fromJson<String>(json['indicatorColor']),
indicatorShape: ExprOr.fromJson<String>(json['indicatorShape']),
rebuildOnEveryLoad: ExprOr.fromJson<bool>(json['rebuildOnEveryLoad']),
borderRadius: as$<String>(json['borderRadius']),
shadow: as$<List<Object?>?>(json['shadow']),
);
Expand Down
3 changes: 3 additions & 0 deletions lib/src/framework/widget_props/navigation_bar_props.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class NavigationBarProps {
final ExprOr<String>? indicatorColor;
final ExprOr<String>? indicatorShape;
final ExprOr<bool>? showLabels;
final ExprOr<bool>? rebuildOnEveryLoad;
final List<Object?>? shadow;
final String? borderRadius;

Expand All @@ -27,6 +28,7 @@ class NavigationBarProps {
this.indicatorColor,
this.indicatorShape,
this.showLabels,
this.rebuildOnEveryLoad,
});

factory NavigationBarProps.fromJson(JsonLike json) {
Expand All @@ -40,6 +42,7 @@ class NavigationBarProps {
indicatorColor: ExprOr.fromJson<String>(json['indicatorColor']),
indicatorShape: ExprOr.fromJson<String>(json['indicatorShape']),
showLabels: ExprOr.fromJson<bool>(json['showLabels']),
rebuildOnEveryLoad: ExprOr.fromJson<bool>(json['rebuildOnEveryLoad']),
borderRadius: as$<String>(json['borderRadius']),
shadow: as$<List<Object?>?>(json['shadow']),
);
Expand Down
12 changes: 0 additions & 12 deletions lib/src/framework/widgets/navigation_bar.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';

import '../actions/base/action_flow.dart';
import '../base/virtual_stateless_widget.dart';
import '../internal_widgets/bottom_navigation_bar/bottom_navigation_bar.dart'
as internal;
Expand All @@ -26,17 +25,6 @@ class VWNavigationBar extends VirtualStatelessWidget<NavigationBarProps> {
});

void handleDestinationSelected(int index, RenderPayload payload) {
final selectedChild = children?.elementAt(index);
if (selectedChild is VWNavigationBarItemDefault) {
final onPageSelected = selectedChild.props.onSelect;
final onPageSelectedAction = onPageSelected?['action'];
if (onPageSelectedAction != null) {
payload.executeAction(
ActionFlow.fromJson(onPageSelectedAction),
triggerType: 'onPageSelected',
);
}
}
onDestinationSelected?.call(index);
}

Expand Down
17 changes: 5 additions & 12 deletions lib/src/framework/widgets/navigation_bar_custom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ class VWNavigationBarCustom
});

void handleDestinationSelected(int index, RenderPayload payload) {
final selectedChild = children?.elementAt(index);
if (selectedChild is VWNavigationBarItemCustom) {
final onPageSelected = selectedChild.props.onSelect;
final onPageSelectedAction = onPageSelected?['action'];
if (onPageSelectedAction != null) {
payload.executeAction(
ActionFlow.fromJson(onPageSelectedAction),
triggerType: 'onPageSelected',
);
}
}
onDestinationSelected?.call(index);
}

Expand All @@ -51,7 +40,11 @@ class VWNavigationBarCustom
destinations.add(
InheritedNavigationBarController(
itemIndex: i,
child: navItems[i].toWidget(payload),
child: Builder(builder: (navItemContext) {
return navItems[i].toWidget(payload.copyWith(
buildContext: navItemContext,
));
}),
),
);
}
Expand Down
Loading
Loading