Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

coding etude

[widget] IndexedStack 본문

Flutter(Dart)

[widget] IndexedStack

코코리니 2022. 9. 29. 11:32

https://api.flutter.dev/flutter/widgets/IndexedStack-class.html

 

IndexedStack class - widgets library - Dart API

A Stack that shows a single child from a list of children. The displayed child is the one with the given index. The stack is always as big as the largest child. If value is null, then nothing is displayed. This example shows a IndexedStack widget being use

api.flutter.dev

bottomNavigationBar 를 사용하여 페이지를 전환하면 페이지가 Re-build 되면서 기존의 내용이 초기화 된다.

이런 상황에서 데이터의 초기화를 막기위해 IndexedStack 위젯을 사용하면 된다.

 

body: IndexedStack(
		index: 0,  // 첫페이지의 index
    	children: [
    		// 페이지들
    	]
    ),
	bottomNavigationBar: Container(); // 네비게이션바 작성

 

'Flutter(Dart)' 카테고리의 다른 글

[plugin] DotsIndicator(슬라이더 표시)  (0) 2022.10.05
[plugin] GetX (flutter 상태관리)  (0) 2022.09.29
[Error] No TabController for TabBar  (0) 2022.09.29
[flutter] elevation  (0) 2022.09.29
[flutter]flutter란?  (0) 2021.03.23