Search

Scaffold

Scalffold

기본적인 μ•±μ˜ ν™”λ©΄ ꡬ성 μš”μ†Œ λ‹΄λŠ” μ»¨ν…Œμ΄λ„ˆ μœ„μ ―

Scalffold κ΅¬μ„±μš”μ†Œ

β€’
AppBar
β€’
Body
β€’
FloatingActionsButton
β€’
Drawer
β€’
BottomNavitaionBar
β€’
BottomSheet

AppBar (μ•± λ°”):

β€’
AppBarλŠ” ν™”λ©΄ 상단에 μœ„μΉ˜ν•˜λ©°, μ•±μ˜ 제λͺ©μ΄λ‚˜ λ‹€μ–‘ν•œ μ•‘μ…˜λ“€μ„ 포함할 수 μžˆλŠ” 상단 λ°”μž…λ‹ˆλ‹€.

Body (λ°”λ””):

β€’
BodyλŠ” μ•±μ˜ λ³Έλ¬Έ λ‚΄μš©μ„ λ‹΄λŠ” λΆ€λΆ„μž…λ‹ˆλ‹€. 주둜 ν…μŠ€νŠΈ, 이미지, 리슀트, 폼 λ“±μ˜ UI μš”μ†Œλ“€μ΄ λ°°μΉ˜λ©λ‹ˆλ‹€.

FloatingActionButton (ν”Œλ‘œνŒ… μ•‘μ…˜ λ²„νŠΌ):

β€’
FloatingActionButton은 일반적으둜 μ•±μ—μ„œ 자주 μ‚¬μš©λ˜λŠ” μ£Όμš” λ™μž‘μ„ μˆ˜ν–‰ν•˜λŠ” λ²„νŠΌμž…λ‹ˆλ‹€. 주둜 ν™”λ©΄ ν•˜λ‹¨μ— μœ„μΉ˜ν•˜λ©°, λˆŒλ €μ„ λ•Œ νŠΉμ • λ™μž‘μ΄ μ‹€ν–‰λ©λ‹ˆλ‹€.

Drawer (λ“œλ‘œμ–΄):

β€’
DrawerλŠ” ν™”λ©΄ μ’ŒμΈ‘μ—μ„œ 우츑으둜 λ‚˜νƒ€λ‚˜λŠ” μ‚¬μ΄λ“œ 메뉴λ₯Ό μ œκ³΅ν•©λ‹ˆλ‹€. 주둜 λ„€λΉ„κ²Œμ΄μ…˜ λ©”λ‰΄λ‚˜ μ„€μ • 메뉴 등을 λ‹΄μŠ΅λ‹ˆλ‹€.

BottomNavigationBar (ν•˜λ‹¨ λ„€λΉ„κ²Œμ΄μ…˜ λ°”):

β€’
BottomNavigationBarλŠ” ν™”λ©΄ ν•˜λ‹¨μ— μœ„μΉ˜ν•˜λ©°, μ—¬λŸ¬ 개의 ν™”λ©΄μœΌλ‘œ μ΄λ™ν•˜λŠ” 탭을 μ œκ³΅ν•©λ‹ˆλ‹€.

BottomSheet (ν•˜λ‹¨ μ‹œνŠΈ):

β€’
BottomSheetλŠ” ν™”λ©΄ ν•˜λ‹¨μ—μ„œ λ‚˜νƒ€λ‚˜λŠ” 뢀가적인 정보λ₯Ό λ‹΄λŠ” UI μš”μ†Œμž…λ‹ˆλ‹€.

Scaffold μ˜ˆμ‹œ

main.dart

import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: MyHomePage(), ); } } class MyHomePage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( // App Bar appBar: AppBar( title: Text('My App'), ), // Body body: const Center( child: Text('Hello Flutter~!'), ), // floatingActionsButton floatingActionButton: FloatingActionButton( onPressed: () { print('click!'); }, child: const Icon(Icons.person), ), // drawer (μ‚¬μ΄λ“œλ°”) drawer: Drawer( child: ListView( children: [ const DrawerHeader( decoration: BoxDecoration( color: Colors.blue, ), child: Text("메뉴 λͺ©λ‘"), ), ListTile( title: const Text('메뉴 1'), onTap: () { print('click menu1!'); }, ), ListTile( title: const Text('메뉴 2'), onTap: () { print('click menu2!'); }, ), ], ), ), // BottomNavitaionBar bottomNavigationBar: BottomNavigationBar( // μ•„μ΄ν…œ 2개 이상 items: const [ BottomNavigationBarItem( icon: Icon(Icons.home), label: 'Home', ), BottomNavigationBarItem( icon: Icon(Icons.search), label: 'Search', ), BottomNavigationBarItem( icon: Icon(Icons.person), label: 'user', ), ], ), // BottomSheet bottomSheet: Container( height: 20, color: Colors.grey, child: const Center(child: Text('Bottom')), ), ); } }
Dart
볡사