토글 버튼 : Togglebuttons 위젯 / onPressed
toggle_switch | Flutter Package
Toggle Switch - A simple toggle switch widget. It can be fully customized with desired icons, width, colors, text, corner radius etc. It also maintains selection state.
pub.dev
[Flutter] 10. 토글 버튼 만들기(ToggleButtons)
지난포스트에서 StatefulWidget에 대해 알아보고 StatefulWidget 클래스를 만들었습니다. 지금 부터 bmi_scrren.dart파일에 체질량 계산기 화면을 만들려고 합니다. 체질량 계산기의 화면 UI는 미터
nayotutorial.tistory.com
-> Toggle
→ Togglebuttons 위젯, DropdownButton , vertical toggle switch with active border
//With radius style
ToggleSwitch(
minWidth: 90.0,
cornerRadius: 20.0,
activeBgColors: [[Colors.green[800]!], [Colors.red[800]!]],
activeFgColor: Colors.white,
inactiveBgColor: Colors.grey,
inactiveFgColor: Colors.white,
initialLabelIndex: 1,
totalSwitches: 2,
labels: ['True', 'False'],
radiusStyle: true,
onToggle: (index) {
print('switched to: $index');
},
),
//vertical toggle switch with active border
ToggleSwitch(
activeBorders: [
Border.all(
color: Colors.purple,
width: 3.0,
),
Border.all(
color: Colors.yellow.shade700,
width: 3.0,
),
Border.all(
color: Colors.deepOrangeAccent,
width: 3.0,
),
Border.all(
color: Colors.blue.shade500,
width: 3.0,
),
],
activeFgColor: Colors.black54,
isVertical: true,
minWidth: 150.0,
radiusStyle: true,
cornerRadius: 20.0,
initialLabelIndex: 2,
activeBgColors: [
[Colors.purpleAccent],
[Colors.yellow],
[Colors.orange],
[Colors.lightBlueAccent]
],
labels: ['Spring', 'Summer', 'Fall', 'Winter'],
onToggle: (index) {
print('switched to: $index');
},
),
'23G > 일기' 카테고리의 다른 글
구글 생성형 AI 한국 1등해서 싱가포르 가따와써염 (0) | 2025.03.08 |
---|---|
다시 시작..🥺💦 (1) | 2024.09.06 |
[TIL] 새로운 업무 | Jira, Confluence (0) | 2022.08.18 |
[TIL] TabBar, TabBarView, PageView | PageView in TabBar | 색깔, 사이즈 변경 | 탭 내에 페이지 만들기 (0) | 2022.08.17 |
[TIL] TabBar 만들기, Tab 내에서 페이지 넘어가기, Indicator&label, PreferredSize, Color, Assets 추가 규칙, etc... (0) | 2022.08.16 |