일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- scroll
- Dialog
- DART
- LifeCycle
- livedata
- viewmodel
- activity
- tabbar
- binding
- android
- Coroutines
- Compose
- intent
- 안드로이드
- Navigation
- 앱
- 계측
- Button
- Flutter
- ScrollView
- 테스트
- appbar
- Kotlin
- textview
- data
- 앱바
- TEST
- textfield
- CustomScrollView
- drift
- Today
- Total
목록Flutter (85)
Study Record
🎁 Debug 혹은 Release 판단 간단하게 kReleaseMode 혹은 kDebugMode 로 판단할 수 있다. import 'package:flutter/foundation.dart'; if (kReleaseMode) { // 릴리즈 모드 } if (kDebugMode) { // 디버그 모드 }

🎁 WillPopScope Widget 안드로이드에서 뒤로 가기 버튼을 누르거나 system back button 이 실행되면 현재 화면이 종료되거나(Route Stack Pop) 앱이 종료된다. 이러한 액션이 실행되기 전에 콜백 이벤트를 받아 액션을 실행할지 말지 정할 수 있게 해주는 위젯이 WillPopScope 이다. onWillPop 인자로 콜백 이벤트 인자를 받아 리턴값이 true 이면 액션을 그대로 실행하고 false 이면 액션을 실행하지 않는다. WillPopScope( onWillPop: () async { return true; }, child: Scaffold( body: Center(child: Text("back press test")), ), ); 😶 간단한 예시) 뒤로 가기 버튼..

🎁 SafeArea Widget 안드로이드와 아이폰에 있는 상태바나 홈버튼 부분(아이폰만 존재)을 없앨 수 있는 위젯이다. argments top: [ true / false ] : 상태바 부분을 포함하지 않는다. bottom [ true / false ] : 홈버튼 부분을 포함하지 않는다. 예시 ) void main() { runApp( MaterialApp( home: HomeScreen(); ) ); } class HomeScreen extends StatelessWidget { const HomeScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( backgroundCo..

🎁 flutter_launcher_icons 플러터 프로젝트에서 앱 로고를 설정하려면 안드로이드와 IOS 플랫폼마다 각각 따로 설정해야 한다. 각 플랫폼마다 방법을 안다면 상관없겠지만 간단하게 flutter_launcher_icons 라이브러리를 사용할 수도 있다. 😶 설치 pubspec.yaml 파일에 라이브러리를 추가해 준 뒤 pub get 버튼을 눌러 프로젝트에 적용해 준다. (작성일 기준 최신버전 v 0.13.1) dev_dependencies: flutter_launcher_icons: ^0.13.1 dev_dependencies 에 추가하기 때문에 실제로 앱을 출시했을 때 포함되지는 않는다. 개발 과정 중에만 사용한다. 😶 로고 적용 마찬가지로 pubspec.yaml 파일에 android 와 ..
🎁 android 에서 앱 이름 변경하기 안드로이드에서는 android/app/src/main/AndroidManifest.xml 파일의 android:label 에 앱 이름을 적으면 된다. ... 🎁 IOS 에서 앱 이름 변경하기 IOS 에서는 ios/Runner/Info.plist 파일에 CFBundleDisplayName 의 값으로 앱 이름을 입력해 준다. ... CFBundleDisplayName 앱 이름 ...

🎁 fluttertoast 토스트 팝업 메시지를 보여주는 간단한 라이브러리이다. 😶 설치 pubspec.yaml 파일에 fluttertoast 라이브러리를 추가해 준 뒤 pub get 버튼을 누른다. (현재 시각 최신 버전 v8) dependencies: fluttertoast: ^8.2.1 😶 사용법 아주 간단하게 토스트 팝업을 띄우는 것은 Fluttertoast.showToast() 로 띄워주면 된다. import 'package:fluttertoast/fluttertoast.dart'; Fluttertoast.showToast( msg: "토스트 팝업 메시지", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.TOP, backgroundColor: ..

🎁 Dialog 플러터에서 기본적인 다이얼로그는 showDialog 함수를 사용하여 Dialog 위젯을 띄운다. showDialog( context: context, builder: (BuildContext context) { return Dialog( alignment: Alignment.center, shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(16.0)), ), child: Container(...), ); }, ); Dialog 위젯의 child 로 다이얼로그의 화면을 직접 그릴 수 있고 alignment 인자로 다이얼로그의 화면에서의 위치를 정할 수 있다. 😶 간단한 예시) import 'package..

🎁 Appbar 플러터에서 앱바 기능을 해주는 위젯은 Appbar() 위젯이다. Scaffold() 의 appbar 인자로 사용할 수 있다. flutter api 공식 문서에 나와있는 것을 참고하면 앱바의 주요 부분들을 leading, title, actions ... 으로 불린다. 😶 간단한 앱바 Scaffold( appBar: AppBar( leading: Align( alignment: Alignment.centerLeft, child: IconButton( onPressed: () { print("leading press"); }, icon: Icon(Icons.arrow_back_rounded, color: Colors.black,), ), ), leadingWidth: 80.0, titleSp..