관리 메뉴

막내의 막무가내 프로그래밍 & 일상

[Flutter] 플러터 폰트 적용 안 되는 에러 본문

플러터(Flutter) & Dart

[Flutter] 플러터 폰트 적용 안 되는 에러

막무가내막내 2021. 9. 10. 22:27
728x90

 

 

[문제점]

플러터 학습을 하던 도중 분명 문서와 강의에서 하라는대로 커스텀 폰트를 다운받아 fonts/ 디렉토리에 추가하고 

pubsepc.yaml 에서 pub get 해주었는데도 폰트가 적용이 안되는 문제점일 발생하였습니다.

핫 리로드 뿐만 아니라 Run 시에도 안되었습니다.

 

pubspec.yaml

name: mi_card
description: A new Flutter application.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - images/

  fonts:
    - family: Pacifico
      fonts:
        - asset: fonts/Pacifico-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.io/custom-fonts/#from-packages

 

 

 

[해결책]

앱을 껏다 키고 다시 run 했더니 해결되었습니다. 

 

 

 

댓글과 공감은 큰 힘이 됩니다. 감사합니다. !!!

 

 

 

 

728x90
Comments