TIP
-
[Flutter] @override 란?함께 공부하는 Flutter 2023. 4. 9. 16:43
Flutter에서 override 키워드는 상위 클래스에서 정의된 메서드, 변수 또는 getter / setter를 하위 클래스에서 재정의할 때 사용됩니다. 즉, 하위 클래스에서 상위 클래스의 기본 구현을 재정의하여 자신만의 동작을 추가하거나 수정할 수 있습니다. 예를 들어, 다음과 같이 상위 클래스 Animal이 있습니다. class Animal { void makeSound() { print('Animal sound'); } } 하위 클래스 Cat은 Animal의 makeSound 메서드를 재정의하여 고양이 특유의 소리를 만들 수 있습니다. class Cat extends Animal { @override void makeSound() { print('Meow'); } } 여기서 @override 키..
-
[Flutter] 모든 페이지에 theme 을 설정하는 방법함께 공부하는 Flutter 2023. 4. 9. 14:17
main.dart에서 theme: ThemeData 설정하기 main.dart 의 theme 에서 모든 테마를 세팅해주면, 개발할때마다 페이지 내부에서 동일핝 세팅을 해줄 필요가 없습니다. 예시 Widget build(BuildContext context) { return MaterialApp( title: 'TestApp', theme: ThemeData( primaryColor: const Color(0xFFE9435A), scaffoldBackgroundColor: Colors.white, appBarTheme: const AppBarTheme( foregroundColor: Colors.black, backgroundColor: Colors.white, elevation: 0, titleTextS..