반응형
패키지 정보
- 패키지 설치
flutter pub add settings_ui
- 코드 예시
import 'package:settings_ui/settings_ui.dart';
import 'package:flutter/material.dart';
bool vibration = false;
class ExamplePage extends StatefulWidget {
const ExamplePage({Key? key}) : super(key: key);
@override
State<ExamplePage> createState() => _ExamplePageState();
}
class _ExamplePageState extends State<ExamplePage> {
Widget build(BuildContext context) {
return Scaffold(
body: SettingsList(
sections: [
SettingsSection(
title: Text(
'공통',
),
tiles: <SettingsTile>[
SettingsTile.navigation(
leading: Icon(Icons.language),
title: Text('언어'),
value: Text('한국어'),
onPressed: ((context) {}),
),
SettingsTile.switchTile(
title: Text('진동'),
initialValue: vibration,
onToggle: (value) {
setState(() {
vibration = !vibration;
});
},
leading: Icon(Icons.vibration),
),
],
),
SettingsSection(
title: Text('계정'),
tiles: <SettingsTile>[
SettingsTile.navigation(
leading: Icon(Icons.logout),
title: Text('로그아웃'),
onPressed: ((context) {}),
),
],
),
SettingsSection(
title: Text('기타'),
tiles: <SettingsTile>[
SettingsTile.navigation(
leading: Icon(Icons.star),
title: Text('앱 평가하기'),
onPressed: ((context) {}),
),
],
),
],
),
);
}
}
반응형
'개발 > Flutter' 카테고리의 다른 글
Flutter 플러터 백 버튼 무시하기 WillPopScope (0) | 2022.12.25 |
---|---|
Flutter 플러터 랜덤 숫자 간단 사용법 Random (0) | 2022.12.24 |
Flutter 플러터 앱 상태 확인하기 AppLifecycleState (0) | 2022.12.24 |
Flutter 플러터 진동 간단 사용법 vibration (0) | 2022.12.24 |
Flutter 플러터 다이얼로그 Dialog 대화 상자 간단 사용법 (0) | 2022.12.24 |
Flutter 플러터 스낵바 SnackBar 간단 사용법 (0) | 2022.12.24 |
Flutter 플러터 화면 전환 Navigator.push 간단 사용법 (0) | 2022.12.24 |
Flutter 플러터 Text 크기 변경, 정렬, 색깔 변경 간단 사용법 (0) | 2022.12.24 |
댓글