Skip to content

Commit

Permalink
Fix category push product
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed Dec 21, 2023
1 parent 833153a commit 14bd005
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion example/lib/src/feature/shop/widget/category_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class _ProductTile extends StatelessWidget {
highlightColor: theme.highlightColor,
onTap: () => onTap == null
? Octopus.of(context).setState((state) => state
..findByName('basket-tab')?.add(Routes.product.node(
..findByName('catalog-tab')?.add(Routes.product.node(
arguments: <String, String>{
'id': product.id.toString()
})))
Expand Down
5 changes: 3 additions & 2 deletions lib/src/controller/information_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ class OctopusInformationProvider extends RouteInformationProvider
}

// If the route is different from the current route, then update the engine.
//if (!kIsWeb || routeInformation.uri != _value.uri) {
/* if (kIsWeb && routeInformation.uri == _value.uri) {
config('Uri: ${routeInformation.uri}');
} */
SystemNavigator.selectMultiEntryHistory(); // selectSingleEntryHistory
SystemNavigator.routeInformationUpdated(
uri: routeInformation.uri,
state: routeInformation.state,
replace: replace,
);
//}
_value = _valueInEngine = routeInformation;
}

Expand Down
4 changes: 3 additions & 1 deletion lib/src/util/state_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ abstract final class StateUtil {
for (final node in state.children) {
encodeNode(node, 0);
}

return Uri(
/* path: segments.join('/'), */
pathSegments: segments,
queryParameters: state.arguments.isEmpty ? null : state.arguments,
//fragment: ,
Expand Down Expand Up @@ -162,7 +164,7 @@ abstract final class StateUtil {
arguments: kMeasureEnabled ? {'uri': uri.toString()} : null,
);

/// Represent state as string.
/// Represent state as string tree.
/// {@nodoc}
@internal
static String stateToString(OctopusState state) =>
Expand Down
4 changes: 1 addition & 3 deletions lib/src/widget/navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,7 @@ class _OctopusNestedNavigatorBuilderState
parent.children.add(
OctopusNode.immutable(
bucket,
children: <OctopusNode>[
widget.defaultRoute.node(),
],
children: <OctopusNode>[widget.defaultRoute.node()],
),
);
return state;
Expand Down

0 comments on commit 14bd005

Please sign in to comment.