개발/플러터
[플러터] PageView 에 대해서
핸디(Handy)
2020. 5. 2. 01:18
PageView 란 여러 페이지를 좌우로 슬라이드하여 넘길 수 있도록 해주는 위젯입니다.
class MyFirstWidget extends StatelessWidget {
MyFirstWidget({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('PageView Example'),
),
body: PageView(
children: <Widget>[
Container(
width: 100,
height: 100,
color: Colors.green,
),
Container(
width: 100,
height: 100,
color: Colors.red,
),
Container(
width: 100,
height: 100,
color: Colors.blue,
),
],
)
);
}
}
선언해주는 위젯부터 순서대로 들어갑니다. 위젯 1 - 페이지 1 씩입니다.