Development/Flutter Development

1. 체크박스 Checkbox라는 함수를 통해 구현해 낼 수 있다. 말 그대로 체크를 할 수 있는 네모박스이며 bool 값으로 클릭 시 체크, 체크해제를 할 수 있다. void main() { runApp(MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Flutter의 입력'), ), body: Body(), ), )); } class Body extends StatelessWidget { const Body({super.key}); @override Widget build(BuildContext context) { return Column( children: [ TestCheckBox(), ], ); } } class TestCheckBox ext..
Stateless vs Stateful 빌드 후에 변하지 않아도 되는 위젯의 경우에는 Stateelss 계속해서 변해야하는 위젯의 경우에는 Stateful void main() { runApp(MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Stateless vs Stateful'), ), body: Body(), ))); } class Body extends StatelessWidget { const Body({super.key}); @override Widget build(BuildContext context) { return Column(children: [ ExampleStateless(), ExampleStateful(), ]); } } /..
1. 상하로 배치 void main() { runApp(MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Widget을 상하로 배치'), ), body: Body(), ), )); } class Body extends StatelessWidget { const Body({super.key}); @override Widget build(BuildContext context) { return Container( height: 300, width: double.infinity, color: Colors.black12, child: Column( mainAxisAlignment: MainAxisAlignment.center, //상하좌우로 중앙 crossAx..
1. Container container은 말그대로 무언가를 담는 그릇 정도로 생각하면 될 것 같다. 예시코드에서는 Text를 담았다. 그리고 container를 통해 그릇의 틀 모양도 만들어줄 수 있다. 여러가지 기능들을 통해서도 가능하고, decoration이라는 옵션을 만들어서 container를 디자인할 수도 있다. void main() { runApp(MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Study to Container'), ), body: CustomContainer(), ))); } class CustomContainer extends StatelessWidget { const CustomContainer({super.key..
기능 MaterialApp : 가장 기본이 되는 위젯트리의 최상위 앱 Scaffold : 가장 기본이 되는 도화지, 기본 빈 화면을 만들기 좋을 기능 stless : 상속 위젯을 만들 수 있음, return으로 위젯 정보 넣기 단축키 Ctrl + Alt + l : 보기좋게 정렬 Alt + Enter : 감싸기 (Wrap) , ex) 위젯으로 감싸기 Shift + F6 : refactor 변수명, 객체명을 한번에 바꾼다. 예시 import 'package:flutter/material.dart'; void main() { runApp(MaterialApp( home: Scaffold( appBar: AppBar(//상단 표시 바 생성 actions: [ IconButton(//아이콘을 만든다 icon: I..
HwanewKing
'Development/Flutter Development' 카테고리의 글 목록