Skip to content

Commit

Permalink
Fix can't open settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and hoangdat committed Sep 27, 2023
1 parent ac8fc30 commit ed2b146
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/widgets/layouts/adaptive_layout/adaptive_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:fluffychat/widgets/layouts/adaptive_layout/adaptive_scaffold_vie
import 'package:fluffychat/widgets/layouts/enum/adaptive_destinations_enum.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart';

typedef OnOpenSearchPage = Function();
Expand Down Expand Up @@ -61,11 +60,9 @@ class AdaptiveScaffoldAppController extends State<AdaptiveScaffoldApp> {
if (object is SettingsAction) {
switch (object) {
case SettingsAction.settings:
context.go('/rooms/settings');
_onOpenSettingsPage();
break;
case SettingsAction.archive:
context.go('/rooms/archive');
break;
case SettingsAction.addAccount:
case SettingsAction.newStory:
case SettingsAction.newSpace:
Expand All @@ -78,14 +75,23 @@ class AdaptiveScaffoldAppController extends State<AdaptiveScaffoldApp> {
}
}

void _onOpenSettingsPage() {
activeNavigationBar.value = AdaptiveDestinationEnum.settings;
_jumpToPageByIndex();
}

void _onOpenSearchPage() {
activeNavigationBar.value = AdaptiveDestinationEnum.search;
pageController.jumpToPage(3);
_jumpToPageByIndex();
}

void _onCloseSearchPage() {
activeNavigationBar.value = AdaptiveDestinationEnum.rooms;
pageController.jumpToPage(1);
_jumpToPageByIndex();
}

void _jumpToPageByIndex() {
pageController.jumpToPage(activeNavigationBar.value.index);
}

MatrixState get matrix => Matrix.of(context);
Expand Down

0 comments on commit ed2b146

Please sign in to comment.