SlidingSwitch는 Flutter용 사용자 정의 가능한 스위치 위젯으로, 사용자가 슬라이딩 동작을 통해 두 가지 상태를 전환할 수 있게 해줍니다. 너비, 색상, 텍스트 레이블 및 애니메이션에 대한 완전한 커스터마이징을 지원합니다. 재구성 시 선택 상태를 유지하여 일관된 사용자 경험을 보장합니다. 간단함과 유연성을 고려해 설계되었으며, Android, iOS, Web, macOS, Windows, Linux 플랫폼에서 원활하게 작동합니다. 앱의 설정, 선호 사항 및 케이스 전환에 이상적입니다.
사용 사례
사용자 선호 설정 전환
설정 패널
on/off 스위치
폼 컨트롤
다크 모드 전환기
주요 기능
완전히 사용자 정의 가능한 외관
상태 지속성
크로스 플랫폼 지원
부드러운 슬라이딩 애니메이션
텍스트 레이블 지원
사용자 지정 가능한 너비 및 색상
적합한 대상
간단한 토글 UI
사용자 정의 가능한 폼 요소
다중 플랫폼 앱
선호 설정
경량 스위치 컴포넌트
고려 사항
이중 상태 전환에 제한됨
내장된 접근성 기능 없음
복잡한 시나리오에서는 상태를 수동으로 처리해야 합니다
다중 선택에 적합하지 않음
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
sliding_switch
Sliding Switch - A simple switch widget. It can be fully customized with desired width, colors, text etc. It also maintains selection state.
Live Demo (Codeapprun)
Getting Started
In the pubspec.yaml of your flutter project, add the following dependency:
If iconOn or iconOff are not null, they will be displayed in lieu of the respective textOn and textOff. The values for textOn and textOff are used as semantic labels for the icons for accessibility. The icons in the example are not in the default material icon set, but are from [Material Design Icons] (https://materialdesignicons.com/), available on pub.dev here.
contentSize drives the height of the text or icons.