Figma 설명 프레임 반영 — 로그인·온보딩·스플래시 · HOME · GALAXY · 퀘스트·이클립스·알림
This commit is contained in:
@@ -263,12 +263,21 @@ class AppShell extends StatelessWidget {
|
||||
selectedIndex: selected < 0 ? 0 : selected,
|
||||
onDestinationSelected: (i) {
|
||||
// 다른 탭에서 HOME 으로 돌아오면 다시 읽는다(HOME 은 탭 전환으로 다시 만들어지지 않는다).
|
||||
if (branches[i] == 0 && shell.currentIndex != 0) homeRefreshSignal.value++;
|
||||
if (branches[i] == 0 && shell.currentIndex != 0)
|
||||
homeRefreshSignal.value++;
|
||||
final again = branches[i] == shell.currentIndex;
|
||||
shell.goBranch(
|
||||
branches[i],
|
||||
// initialLocation: true 를 주면 이미 열려 있는 탭을 다시 누를 때 루트로 되돌아간다.
|
||||
initialLocation: branches[i] == shell.currentIndex,
|
||||
initialLocation: again,
|
||||
);
|
||||
// 설명 프레임 `2097:16427` 「HOME 화면에서 클릭 시, Y스크롤값 초기화」(INSIDE · GALAXY ·
|
||||
// MY 동일) — 열려 있는 탭을 다시 누르면 그 탭 루트 화면을 맨 위로 올린다.
|
||||
if (again) {
|
||||
scrollTabToTop(
|
||||
shell.route.branches[branches[i]].navigatorKey,
|
||||
);
|
||||
}
|
||||
},
|
||||
destinations: [
|
||||
for (final tab in tabs)
|
||||
@@ -287,3 +296,35 @@ class AppShell extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 탭 루트 화면의 세로 목록을 맨 위로. 루트 라우트의 [PrimaryScrollController] 를 쓴다 —
|
||||
/// 각 탭 화면이 따로 컨트롤러를 들고 있지 않아도 된다. 다시 누름으로 위에 쌓인 화면이 닫힌
|
||||
/// 다음 프레임에 움직인다.
|
||||
void scrollTabToTop(GlobalKey<NavigatorState> navigatorKey) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
ScrollController? found;
|
||||
void visit(Element e) {
|
||||
if (found != null) return;
|
||||
final w = e.widget;
|
||||
// 컨트롤러 없는 칸(`PrimaryScrollController.none`)과 붙은 목록이 없는 라우트는 건너뛴다.
|
||||
if (w is PrimaryScrollController && (w.controller?.hasClients ?? false)) {
|
||||
found = w.controller;
|
||||
return;
|
||||
}
|
||||
e.visitChildElements(visit);
|
||||
}
|
||||
|
||||
navigatorKey.currentContext?.visitChildElements(visit);
|
||||
for (final p in found?.positions.toList() ?? const <ScrollPosition>[]) {
|
||||
if (p.axis == Axis.vertical && p.pixels != p.minScrollExtent) {
|
||||
p.animateTo(
|
||||
p.minScrollExtent,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeOut,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
// 탭이 이미 루트면 다시 그릴 일이 없어 위 콜백이 돌지 않는다 — 한 프레임을 청한다.
|
||||
WidgetsBinding.instance.ensureVisualUpdate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user