본문 바로가기

전체 글

(12)
expandable fab https://docs.flutter.dev/cookbook/effects/expandable-fab Create an expandable FAB How to implement a FAB that expands to multiple buttons when tapped. docs.flutter.dev 1. create an expandable fab @immutable class ExpandableFab extends StatefulWidget { const ExpandableFab({ super.key, this.initialOpen, required this.distance, required this.children, }); final bool? initialOpen; final double dista..
singleton 1. 싱글톤 개념 객체의 인스턴스가 오직 하나만 생성되는 것, 즉 여러개의 생성자를 호출 하더라도 실제로 생성되는 인스턴스는 하나이다. 2. 싱글톤 형태 class Singleton { static final Singleton _instance = Singleton._internal(); // _instance 값을 반환한다. // 값이 있으면 원래 값을 반환한다. factory Singleton() => _instance; Singleton._internal(){ // 클래스가 최초 생성될 때, 1회 발생 // 초기화 코드 } } 3. 싱글톤 클래스, 일반 클래스 비교 class Singleton { late int count; static final Singleton _instance = Single..
flutter 해당 위젯 코드 쉽게 찾기 이 기능의 경우 Debug 실행 시에 가능하다. 안드로이드 스튜디오, 인텔리제이 우측에 보면 Flutter Inspector가 있다. Flutter Inspector에 들어가서 좌측 상단에 보면 toggle select widget mode 라는 Icon이 있다. 클릭을 하여 모드 활성화를 하고 에뮬레이터 화면에서 위젯을 클릭하면 쉽게 위젯 코드가 어디에 있는지 찾을 수 있다.