패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.0.4

icons_helper

특정 아이콘이 컴파일 시점에 알려지지 않았을 때 런타임에 전체 아이콘 라이브러리 및 FontAwesomeIcons에 액세스할 수 있도록 제공합니다.

30일 다운로드
88
좋아요
27
Pub 점수
40

패키지 설치

flutter pub add icons_helper

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

IconsHelper는 표준 아이콘과 FontAwesomeIcons를 포함한 포괄적인 아이콘 라이브러리에 런타임으로 접근할 수 있도록 해주는 Flutter/Dart 패키지입니다. 필요한 아이콘이 컴파일 시점에 알려져 있지 않고 앱 실행 중에 동적으로 결정될 때 특히 유용합니다. 이러한 유연성은 테마화된 아이콘 선택기나 사용자 입력에 따라 동적으로 아이콘을 렌더링하는 등의 더 적응력 있는 UI를 구축할 수 있게 해줍니다. 이 패키지는 각각의 아이콘 세트를 별도로 가져올 필요 없이 다양한 아이콘 세트에 통합된 인터페이스로 접근할 수 있도록 하여 아이콘 관리를 간소화합니다.

사용 사례

  • 다이나믹 아이콘 선택
  • 테마 기반 아이콘 렌더링
  • 런타임 아이콘 검색
  • 사용자 지정 아이콘 선택기 컴포넌트
  • 확장 가능한 아이콘 관리

주요 기능

  • 아이콘 및 FontAwesomeIcons에 대한 완전한 액세스
  • 런타임 아이콘 해상도
  • 정적 가져오기 필요 없음
  • 동적 사용을 위한 간단한 API
  • 여러 아이콘 라이브러리를 지원합니다

적합한 대상

  • 동적 UI를 가진 앱
  • 아이콘 선택기 인터페이스
  • 테마 사용자 지정 기능
  • 유연한 아이콘 처리가 필요한 개발자
  • 컴파일 시 아이콘 선언을 피하는 프로젝트

고려 사항

  • 통합되지 않은 경우 FontAwesomeIcons는 인터넷이 필요합니다
  • 동적 해석으로 인한 약간의 오버헤드
  • 성능 중심의 아이콘 렌더링에 적합하지 않음
  • 사전 정의된 아이콘 세트에 한정
  • 패키지 크기가 약간 증가할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

icons_helper

This package's use case is to provide access to the full library of Icons and FontAwesomeIcons (currently FontAwesome 9 for the most part, although a few new icons need some addition/changes) at runtime when the specific icons needed are not known at compile time. As such, all Tree Shaking is totally worked around/defeated for Icons and FontAwesomeIcons, so know that before you use the library. But since in our application, for example, the icon names come in from our backend and we don't want to have to re-release each time it specifies a new icon, we are GOOD with that. This is intentional so we can specify a new icon to be displayed just by sending that new text string in our push notification/record. This is a convenience package that provides bracket notiation access to Material Design Icons and Font Awesome Flutter icons (via @brianegan's font_awesome_flutter package). For now, I have just statically generated the Map to map string names to member names. This means any new icons won't be automatically discovered. There's a way to use codegen and mirror in a non-flutter dart app to generate this and then output/maintain them, but just using a google sheet and cut and pasting was faster for something I personally don't need to update often. That sheet is here at https://docs.google.com/spreadsheets/d/1IpWJytpkrJI9_9hwPKY5oXJLRLGjQuG3pUP7eUIqHn4/edit?usp=sharing. I started writing such a utility but gave up because it wasn't worth the time.

Thanks & Contributions

Many thanks to Dennis Bappert (@dennisbappert) and S McDowall (@sjmcdowall) for updates to this and sourcing back their changes publicly and in the true spirit of open source. This includes their fixes.

Using

The methods you may want to consider using include:

getIconUsingPrefix(name: "PREFIX.ICON_NAME") - if PREFIX is "fa" or "fontawesome" the icon_name after the "." will be resolved against the font awesome icons first, if that fails, it'll go to Material Design Icons. If there is no PREFIX.ICON_NAME, it'll fail over to just trying to resolve Material First, then Font Awesome.

getIconGuessFavorFA(name:"ICON_NAME") - if there is an icon named ICON_NAME in FA, return that, otherwise, try Material

getIconGuessFavorMaterial(name:"ICON_NAME") - if there is an icon named ICON_NAME in Material Design, return that, otherwise, try FA

All methods will return null if icon doesn't exist.

Yes, this is a quick and dirty library that could use tons of improvement and does a lot of things poorly or doesn't do things. If you want to change/fix/help, submit a PR and I'll def accept all help that I think improves this lib.

I basically wrote this as a hack/work around to https://github.com/flutter/flutter/issues/16189.

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.