v0.0.2+1switch_up
원하는 너비, 색상, 텍스트, 모서리 반경, 애니메이션 등으로 완전히 사용자 정의할 수 있는 애니메이티드 토글 스위치입니다. 선택 상태도 유지합니다.
23좋아요 330일 다운로드70Pub 점수
플랫폼 정보 없음
ketan-glitch/switch_up open-source repository details.
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
An animated toggle switch which can be fully customized with desired width, colors, text, corner radius, animation etc. It also maintains selection state.
In the pubspec.yaml of your flutter project, add the following dependency:
dependencies: ... switch_up: latest_version
Import it:
import 'package:switch_up/switch_up.dart';
// Here, default theme color are used for selected item.
SwitchUp<String>(
backgroundColor: Colors.grey.shade200,
items: const <String>['Home', 'Chat', 'Settings'],
onChanged: (String value) {
print(value);
},
value: 'Settings',
),
ezgif.com-gif-maker(3).gif
SwitchUp(
backgroundColor: Colors.grey.shade200,
color: Colors.amber,
radius: 0,
height: 50,
curves: Curves.easeInOutBack,
items: const ['Active', 'Pending'],
onChanged: (value) {
print(value);
},
value: 'Pending',
),
ezgif.com-gif-maker(4).gif
SwitchUp(
gradient: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF941F37),
Color(0xFF590012),
],
),
curves: Curves.bounceOut,
backgroundColor: Colors.grey.shade200,
items: const ['Male', 'Female', 'Other'],
onChanged: (value) {
print(value);
},
value: 'Female',
),
ezgif.com-gif-maker(5).gif
SwitchUp(
backgroundColor: Colors.grey.shade200,
radius: 40,
gradient: const RadialGradient(
radius: 10,
colors: [
Color(0xFF941F37),
Color(0xFF590012),
],
),
curves: Curves.easeInOutQuart,
items: const ['Normal', 'Bold', 'Italic'],
onChanged: (value) {
log(value);
},
value: 'Bold',
),
ezgif.com-gif-maker(6).gif
Switch Up with Custom Models
// Add toString() to your Custom model class
// @override
// String toString() {
// return name;
// }
SwitchUp<States>(
backgroundColor: Colors.pink.withOpacity(.1),
radius: 10,
height: 60,`
gradient: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFFFC466B),
Color(0xFF3F5EFB),
],
),
curves: Curves.easeInOutQuart,
items: states,
onChanged: (States value) {
if (kDebugMode) {
print(value);
}
},
value: states[2],
),
ezgif.com-gif-maker(7).gif
With icons, text and different active background colors