AdvancedIcon은 그라데이션과 투명도 제어와 같은 장식 도구를 통해 강화된 아이콘 사용자 정의 기능을 제공하는 Flutter 패키지입니다. 또한 아이콘 전환에 부드러운 애니메이션 효과를 지원합니다. 개발자는 여러 플랫폼에서 동적 행동을 가진 시각적으로 풍부한 아이콘을 만들 수 있습니다. 세련된 UI 요소와 미묘하지만 강력한 애니메이션을 원하는 앱에 적합합니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux를 모두 지원하여 크로스플랫폼 개발에 매우 유연합니다. 직관적인 API는 복잡한 코드 없이 고급 시각 효과를 쉽게 통합할 수 있도록 합니다.
사용 사례
애니메이션 아이콘 전환
그라데이션으로 채워진 아이콘
투명도 제어 아이콘 효과
개선된 UI 미세 상호작용
크로스 플랫폼 아이콘 스타일링
앱 인터페이스에서의 시각적 피드백
주요 기능
그라데이션 아이콘 장식
투명도 조정 도구
부드러운 전환 애니메이션
크로스 플랫폼 호환성
간단한 API 통합
사용자 정의 가능한 애니메이션 효과
적합한 대상
시각적 완성도를 추구하는 UI 디자이너
인터랙티브 앱을 개발하는 개발자
크로스플랫폼 모바일 및 웹 프로젝트
매력적인 마이크로 인터랙션을 필요로 하는 앱
미적 사용자 경험에 집중하는 팀
고려 사항
패키지 크기가 약간 증가할 수 있습니다
애니메이션 원칙에 대한 이해 필요
아이콘 전용 개선 기능에 한정
현대적이고 디자인 중심 앱에 가장 적합
저사양 기기에서의 성능 영향
아이콘 이외의 UI 컴포넌트용이 아님
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Advanced Icon
A flutter package that contains a collection of icon decoration tools (i.e. gradient, opacity) and icon transition features with cool animation effects. See live example.
Installing
With flutter run this command
flutter pub add advanced_icon
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):
dependencies:advanced_icon:<latestversion>
Now in your Dart code, you can use:
import'package:advanced_icon/advanced_icon.dart';
Features at a Glance
An optional secondaryIcon property is available to enhance user interaction with minimal manual effort.
Cool animation effects are available to make a smooth transition between icon and secondaryIcon.
In addition to color, icons can also be painted with a gradient.
Opacity property is available to make opaque icons.
Inherits all properties of material designed Icon widget.
Icon Transition
To use the icon transition feature, secondaryIcon must not be null and when it is not null the widget will lookup for state and will show icons according to the current state. To change the icon from icon to secondaryIcon or vice-versa, let's first see about state of AdvancedIcon:
state holds the information about the current state of AdvancedIcon. AdvancedIcon can have any one of the following states:
AdvancedIconState.primary
AdvancedIconState.secondary
Whenever the state changes, it notifies AdvancedIcon and AdvancedIcon changes the current icon following the below rules:
icon will appear for AdvancedIconState.primary.
secondaryIcon will appear for AdvancedIconState.secondary.
state can be changed using any of the following methods:
setState
provider
stream
inheritedWidget
or any other methods used for state management in flutter.
Let's illustrate state management of AdvancedIcon using setState. First, create a stateful widget. In the private class of the widget, define a property that holds the current state of AdvancedIcon and define a function to change the current state on every user interaction as follows:
Then add a GestureDetector or IconButton inside build method and use AdvancedIcon as follows:
GestureDetector(
onTap: _changeState,
child: AdvancedIcon(
icon: Icons.add, //change this icon as per your requirement.
secondaryIcon: Icons.check, //change this icon as per your requirement.
state: _state,
),
)
In above case when first time _changeState will be called, state will change to AdvancedIconState.secondary and transition will happen from Icons.add to Icons.check following the default bubble animation effect in 300ms.
Let's configure it further. There are seven cool transition effects available for icon transition features.
spin
bubble
fade
flipH
flipV
spinBubble
bubbleFade
none
Change effect property to try more animation effects as follows:
AdvancedIcon(
icon: Icons.add, //change this icon as per your requirement.
secondaryIcon: Icons.check, //change this icon as per your requirement.
state: _state,
effect: AdvancedIconEffect.spin, //change effect as per your requirement.
)
To increase or decrease the transition time, change duration property as follows:
AdvancedIcon(
icon: Icons.add, //change this icon as per your requirement.
secondaryIcon: Icons.check, //change this icon as per your requirement.
state: _state,
duration: Duration(milliseconds: 700),
effect: AdvancedIconEffect.fade,
)
Give secondaryIcon a more specific color by setting secondaryColor property as follows:
AdvancedIcon(
icon: Icons.add, //change this icon as per your requirement.
secondaryIcon: Icons.check, //change this icon as per your requirement.
color: Colors.blue, //color of primary icon, change it as per your requirement
secondaryColor: Colors.green, //color of secondary icon, change it as per your requirement
effect: AdvancedIconEffect.fade,
state: _state,
)
To make icons look more appealing, use gradient to paint the icons. color and secondaryColor will be ignored if gradient is set as follows:
AdvancedIcon(
icon: Icons.photo_camera,
color: Colors.red, //color will have no effect
gradient: constLinearGradient( //change gradient as per your requirement
colors: <Color>[Colors.red, Colors.white],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
step: [0.2,0.8],
),
)
Opacity
Make opaque icons by setting opacity as follows:
AdvancedIcon(
icon: Icons.direction_bike,
color: Colors.red,
opacity: 0.5, //should be between 0 and 1 inclusive
)
Changelog
Please see the changelog to know about the latest updates.
Contributions
Contribution to this project are most welcomed.
If you find bugs or want more features, but don't know how to fix/implement them, please fill an issue.
If you fixed bugs or implemented new features, please send a pull request.