Skip to content

Commit

Permalink
Public PaneItemKeys for support custom PaneItem (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa authored Aug 8, 2022
2 parents 9f273a6 + 9f7cad3 commit ddd1061
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/src/controls/navigation/navigation_view/body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ class InheritedNavigationView extends InheritedWidget {
}

/// Makes the [GlobalKey]s for [PaneItem]s accesible on the scope.
class _PaneItemKeys extends InheritedWidget {
const _PaneItemKeys({
class PaneItemKeys extends InheritedWidget {
const PaneItemKeys({
Key? key,
required Widget child,
required this.keys,
Expand All @@ -267,12 +267,12 @@ class _PaneItemKeys extends InheritedWidget {
/// Gets the item global key based on the index
static GlobalKey of(int index, BuildContext context) {
final reference =
context.dependOnInheritedWidgetOfExactType<_PaneItemKeys>()!;
context.dependOnInheritedWidgetOfExactType<PaneItemKeys>()!;
return reference.keys[index]!;
}

@override
bool updateShouldNotify(_PaneItemKeys oldWidget) {
bool updateShouldNotify(PaneItemKeys oldWidget) {
return keys != oldWidget.keys;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class PaneItem extends NavigationPaneItem {
if (maybeBody?.pane?.indicator != null &&
index != null &&
!index.isNegative) {
final key = _PaneItemKeys.of(index, context);
final key = PaneItemKeys.of(index, context);

return Stack(children: [
button,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/controls/navigation/navigation_view/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ class NavigationViewState extends State<NavigationView> {
minimalPaneOpen: _minimalPaneOpen,
pane: widget.pane,
oldIndex: oldIndex,
child: _PaneItemKeys(keys: _itemKeys, child: paneResult),
child: PaneItemKeys(keys: _itemKeys, child: paneResult),
),
);
});
Expand Down

0 comments on commit ddd1061

Please sign in to comment.