Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Snapshot
- snackbar
- changenotifier
- user
- reference
- runTransaction
- Firebase
- Swift
- consumer
- permission
- divider
- platformexception
- Stream
- swift 문법
- ListView.builder
- setstate
- transform
- enum
- multiprovider
- controller
- Camera
- signout
- datetime
- 문법
- Navigator
- borderRadius
- switch
- globalkey
- changenotifierprovider
- provider
Archives
- Today
- Total
코딩하는 제리
[Flutter/Project](Instagram Clone) 화면 띄우기, 카메라 레이아웃 본문
Flutter/Project_InstaClone(완)
[Flutter/Project](Instagram Clone) 화면 띄우기, 카메라 레이아웃
JerryCho 2021. 1. 26. 11:45.push
새로운 화면을 띄움
소스코드 및 pubspec.yaml
// screens/camera_screen.dart
import 'package:flutter/material.dart';
class CameraScreen extends StatefulWidget {
@override
_CameraScreenState createState() => _CameraScreenState();
}
class _CameraScreenState extends State<CameraScreen> {
// 페이지 기본값
int _currentIndex = 1;
// initialPage: 1 -> index 1 에 해당하는 페이지를 기본으로함.
PageController _pageController = PageController(initialPage: 1);
@override
void dispose() {
_pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
controller: _pageController,
children: [
Container(
color: Colors.cyanAccent,
),
Container(
color: Colors.amberAccent,
),
Container(
color: Colors.greenAccent,
),
],
onPageChanged: (index) {
// 페이지 변경에 따른 설정
setState(() {
_currentIndex = index;
});
},
),
bottomNavigationBar: BottomNavigationBar(
iconSize: 0,
selectedItemColor: Colors.black,
unselectedItemColor: Colors.black54,
selectedLabelStyle: TextStyle(fontWeight: FontWeight.bold),
items: [
BottomNavigationBarItem(
icon: Icon(Icons.radio_button_checked), label: 'GALLERY'),
BottomNavigationBarItem(
icon: Icon(Icons.radio_button_checked), label: 'PHOTO'),
BottomNavigationBarItem(
icon: Icon(Icons.radio_button_checked), label: 'VIDEO'),
],
currentIndex: _currentIndex,
onTap: _onItemTabbed,
),
);
}
void _onItemTabbed(index) {
setState(() {
_currentIndex = index;
_pageController.animateToPage(
_currentIndex,
duration: Duration(milliseconds: 200),
curve: Curves.fastOutSlowIn,
);
});
}
}
'Flutter > Project_InstaClone(완)' 카테고리의 다른 글
[Flutter/Project](Instagram Clone) 카메라 마이크, 유저 퍼미션 (0) | 2021.01.27 |
---|---|
[Flutter/Project](Instagram Clone) 카메라 레이아웃 및 촬영 버튼 (0) | 2021.01.26 |
[Flutter/Project](Instagram Clone) 로그인 화면, Align() (0) | 2021.01.26 |
[Flutter/Project](Instagram Clone) custom Divider, Flatbutton.icon() (0) | 2021.01.26 |
[Flutter/Project](Instagram Clone) 화면 이동 (0) | 2021.01.25 |
Comments