import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:gap/gap.dart'; import '../../../../app/app_providers.dart'; import '../../../../core/utils/extensions.dart'; class SystemSettingsScreen extends ConsumerWidget { const SystemSettingsScreen({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final themeMode = ref.watch(themeModeNotifierProvider); return SingleChildScrollView( padding: const EdgeInsets.all(24), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '시스템 설정', style: context.textTheme.headlineMedium?.copyWith( fontWeight: FontWeight.bold, ), ), const Gap(8), Text( '시스템 환경을 설정하세요', style: context.textTheme.bodyLarge?.copyWith( color: context.colorScheme.onSurfaceVariant, ), ), const Gap(24), // 일반 설정 Center( child: ConstrainedBox( constraints: const BoxConstraints(maxWidth: 800), child: Column( children: [ _SettingsSection( title: '일반', children: [ _SettingsTile( icon: Icons.brightness_6, title: '테마', subtitle: _themeLabel(themeMode), trailing: SegmentedButton( segments: const [ ButtonSegment( value: ThemeMode.light, icon: Icon(Icons.light_mode), label: Text('라이트'), ), ButtonSegment( value: ThemeMode.system, icon: Icon(Icons.brightness_auto), label: Text('시스템'), ), ButtonSegment( value: ThemeMode.dark, icon: Icon(Icons.dark_mode), label: Text('다크'), ), ], selected: {themeMode}, onSelectionChanged: (modes) { ref .read(themeModeNotifierProvider.notifier) .setThemeMode(modes.first); }, ), ), _SettingsTile( icon: Icons.language, title: '언어', subtitle: '한국어', trailing: const Icon(Icons.chevron_right), onTap: () { // TODO: 언어 설정 }, ), ], ), const Gap(16), _SettingsSection( title: '알림', children: [ _SettingsTile( icon: Icons.notifications, title: '푸시 알림', subtitle: '활성화됨', trailing: Switch( value: true, onChanged: (value) { // TODO: 알림 설정 }, ), ), _SettingsTile( icon: Icons.email, title: '이메일 알림', subtitle: '활성화됨', trailing: Switch( value: true, onChanged: (value) { // TODO: 이메일 알림 설정 }, ), ), ], ), const Gap(16), _SettingsSection( title: 'API 설정', children: [ _SettingsTile( icon: Icons.link, title: 'API Base URL', subtitle: 'http://localhost:8000/api/v1', trailing: const Icon(Icons.chevron_right), onTap: () { // TODO: API URL 설정 }, ), _SettingsTile( icon: Icons.timer, title: '요청 타임아웃', subtitle: '15초', trailing: const Icon(Icons.chevron_right), onTap: () { // TODO: 타임아웃 설정 }, ), ], ), const Gap(16), _SettingsSection( title: '정보', children: [ const _SettingsTile( icon: Icons.info_outline, title: '앱 버전', subtitle: '1.0.0', ), const _SettingsTile( icon: Icons.code, title: 'Flutter', subtitle: 'SDK 3.8.0', ), ], ), ], ), ), ), ], ), ); } String _themeLabel(ThemeMode mode) { return switch (mode) { ThemeMode.light => '라이트 모드', ThemeMode.dark => '다크 모드', ThemeMode.system => '시스템 설정', }; } } class _SettingsSection extends StatelessWidget { const _SettingsSection({ required this.title, required this.children, }); final String title; final List children; @override Widget build(BuildContext context) { return Card( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.fromLTRB(20, 16, 20, 8), child: Text( title, style: Theme.of(context).textTheme.titleSmall?.copyWith( color: Theme.of(context).colorScheme.primary, fontWeight: FontWeight.bold, ), ), ), ...children, ], ), ); } } class _SettingsTile extends StatelessWidget { const _SettingsTile({ required this.icon, required this.title, required this.subtitle, this.trailing, this.onTap, }); final IconData icon; final String title; final String subtitle; final Widget? trailing; final VoidCallback? onTap; @override Widget build(BuildContext context) { return ListTile( leading: Icon(icon), title: Text(title), subtitle: Text(subtitle), trailing: trailing, onTap: onTap, ); } }