UI Polish: Dialogs for Backup/Account, Font Alignment, Hide Future Features

This commit is contained in:
Ponshu Developer 2026-01-13 19:00:16 +09:00
parent 9d19689dbd
commit 94af953ac3
3 changed files with 56 additions and 53 deletions

View File

@ -102,40 +102,8 @@ class _SoulScreenState extends ConsumerState<SoulScreen> {
const SizedBox(height: 24), const SizedBox(height: 24),
BackupSettingsSection(), BackupSettingsSection(),
// Roadmap // Future Update (Couple Sharing) - Hidden for now
Container( // const SizedBox(height: 40),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primaryContainer.withValues(alpha: 0.1), // Lighter background
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.2),
),
),
child: Row(
children: [
Icon(LucideIcons.heartHandshake, color: Theme.of(context).colorScheme.onSurface),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Future Update',
style: Theme.of(context).textTheme.labelSmall?.copyWith(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.onSurface,
),
),
const SizedBox(height: 4),
const Text('カップル共有機能 (開発中)'),
],
),
),
],
),
),
const SizedBox(height: 40),
], ],
), ),
); );

View File

@ -23,17 +23,8 @@ class AppearanceSettingsSection extends ConsumerWidget {
leading: Icon(LucideIcons.type, color: isDark ? Colors.grey[400] : null), leading: Icon(LucideIcons.type, color: isDark ? Colors.grey[400] : null),
title: const Text('フォント'), title: const Text('フォント'),
subtitle: Text(_getFontName(fontPref)), subtitle: Text(_getFontName(fontPref)),
trailing: PopupMenuButton<String>( trailing: Icon(LucideIcons.chevronRight, color: isDark ? Colors.grey[600] : null),
icon: Icon(LucideIcons.chevronRight, color: isDark ? Colors.grey[600] : null), onTap: () => _showFontSelectionDialog(context, ref, fontPref),
onSelected: (val) {
ref.read(userProfileProvider.notifier).setFontPreference(val);
},
itemBuilder: (context) => [
const PopupMenuItem(value: 'sans', child: Text('ゴシック (標準)')),
const PopupMenuItem(value: 'serif', child: Text('明朝 (上品)')),
const PopupMenuItem(value: 'digital', child: Text('ドット (レトロ)')),
],
),
), ),
const Divider(height: 1), const Divider(height: 1),
ListTile( ListTile(
@ -92,10 +83,14 @@ class AppearanceSettingsSection extends ConsumerWidget {
); );
} }
Widget _buildThemeOption(BuildContext context, WidgetRef ref, String value, String label, String current) { Widget _buildThemeOption(BuildContext context, WidgetRef ref, String value, String label, String current, {bool isFont = false}) {
return SimpleDialogOption( return SimpleDialogOption(
onPressed: () { onPressed: () {
ref.read(userProfileProvider.notifier).setThemeMode(value); if (isFont) {
ref.read(userProfileProvider.notifier).setFontPreference(value);
} else {
ref.read(userProfileProvider.notifier).setThemeMode(value);
}
Navigator.pop(context); Navigator.pop(context);
}, },
child: Row( child: Row(
@ -105,7 +100,7 @@ class AppearanceSettingsSection extends ConsumerWidget {
color: value == current ? Theme.of(context).primaryColor : Colors.grey, color: value == current ? Theme.of(context).primaryColor : Colors.grey,
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(label), Text(label, style: isFont && value == 'digital' ? const TextStyle(fontFamily: 'DotGothic16') : null),
], ],
), ),
); );
@ -118,4 +113,18 @@ class AppearanceSettingsSection extends ConsumerWidget {
default: return 'ゴシック (標準)'; default: return 'ゴシック (標準)';
} }
} }
void _showFontSelectionDialog(BuildContext context, WidgetRef ref, String current) {
showDialog(
context: context,
builder: (context) => SimpleDialog(
title: const Text('フォント設定'),
children: [
_buildThemeOption(context, ref, 'sans', 'ゴシック (標準)', current, isFont: true),
_buildThemeOption(context, ref, 'serif', '明朝 (上品)', current, isFont: true),
_buildThemeOption(context, ref, 'digital', 'ドット (レトロ)', current, isFont: true),
],
),
);
}
} }

View File

@ -55,7 +55,7 @@ enum _BackupState { idle, signingIn, signingOut, backingUp, restoring }
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: const Text('連携解除'), title: const Text('連携解除'),
content: const Text('Googleアカウントとの連携を解除しますか'), content: const Text('Googleアカウントとの連携を解除しますか\n安全にログアウトできます。'),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.pop(context, false), onPressed: () => Navigator.pop(context, false),
@ -95,6 +95,34 @@ enum _BackupState { idle, signingIn, signingOut, backingUp, restoring }
} }
} }
Future<void> _confirmBackup() async {
final confirmed = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: const Text('バックアップ'),
content: const Text('Google Driveに最新データのみ保存過去分は上書きされます。\n本当に続行しますか?'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context, false),
child: const Text('キャンセル'),
),
ElevatedButton(
onPressed: () => Navigator.pop(context, true),
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor,
foregroundColor: Colors.white,
),
child: const Text('バックアップ'),
),
],
),
);
if (confirmed == true) {
await _createBackup();
}
}
Future<void> _restoreBackup() async { Future<void> _restoreBackup() async {
final hasBackup = await _backupService.hasBackupOnDrive(); final hasBackup = await _backupService.hasBackupOnDrive();
if (!hasBackup && mounted) { if (!hasBackup && mounted) {
@ -195,7 +223,7 @@ enum _BackupState { idle, signingIn, signingOut, backingUp, restoring }
color: currentUser != null ? Colors.green : (isDark ? Colors.orange[300] : Theme.of(context).primaryColor), color: currentUser != null ? Colors.green : (isDark ? Colors.orange[300] : Theme.of(context).primaryColor),
), ),
title: Text(currentUser == null ? 'Googleアカウント連携' : currentUser.email), title: Text(currentUser == null ? 'Googleアカウント連携' : currentUser.email),
subtitle: Text(currentUser == null ? 'バックアップを利用するには連携が必要です' : '安全にログアウトできます'), subtitle: Text(currentUser == null ? 'Google Driveと連携してバックアップ' : 'Google Driveにバックアップを保存できます'),
trailing: (_state == _BackupState.signingIn || _state == _BackupState.signingOut) trailing: (_state == _BackupState.signingIn || _state == _BackupState.signingOut)
? const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2)) ? const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2))
: ElevatedButton( : ElevatedButton(
@ -213,17 +241,15 @@ enum _BackupState { idle, signingIn, signingOut, backingUp, restoring }
ListTile( ListTile(
leading: Icon(LucideIcons.uploadCloud, color: isDark ? Colors.blue[300] : Colors.blue), leading: Icon(LucideIcons.uploadCloud, color: isDark ? Colors.blue[300] : Colors.blue),
title: const Text('バックアップ'), title: const Text('バックアップ'),
subtitle: const Text('Google Driveに最新データのみ保存過去分は上書き'),
trailing: _state == _BackupState.backingUp trailing: _state == _BackupState.backingUp
? const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2)) ? const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2))
: null, : null,
onTap: isAnyProcessing ? null : _createBackup, onTap: isAnyProcessing ? null : _confirmBackup,
), ),
const Divider(height: 1), const Divider(height: 1),
ListTile( ListTile(
leading: Icon(LucideIcons.downloadCloud, color: isDark ? Colors.red[300] : Colors.red), leading: Icon(LucideIcons.downloadCloud, color: isDark ? Colors.red[300] : Colors.red),
title: const Text('データ復元'), title: const Text('データ復元'),
subtitle: const Text('Google Driveからデータを読み込み上書き'),
trailing: _state == _BackupState.restoring trailing: _state == _BackupState.restoring
? const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2)) ? const SizedBox(width: 24, height: 24, child: CircularProgressIndicator(strokeWidth: 2))
: null, : null,