11import 'package:flutter/material.dart' ;
22import 'package:material_symbols_icons/symbols.dart' ;
33import '../../l10n/app_localizations.dart' ;
4+ import '../../widgets/app_alert_dialog.dart' ;
45import './talker_log_screen.dart' ;
56
67class DebugOptionsScreen extends StatelessWidget {
78 const DebugOptionsScreen ({super .key});
89
10+ Future <void > _showInfoDialogPreview (BuildContext context) async {
11+ final l10n = AppLocalizations .of (context)! ;
12+ final materialL10n = MaterialLocalizations .of (context);
13+ final result = await showTouchFishInfoDialog <String >(
14+ context,
15+ title: l10n.debugInfoDialogDemoTitle,
16+ message: l10n.debugInfoDialogDemoMessage,
17+ actions: [
18+ TouchFishDialogAction <String >(
19+ label: materialL10n.cancelButtonLabel,
20+ result: materialL10n.cancelButtonLabel,
21+ ),
22+ TouchFishDialogAction <String >(
23+ label: l10n.settingsTitle,
24+ result: l10n.settingsTitle,
25+ isPrimary: true ,
26+ ),
27+ ],
28+ );
29+
30+ if (! context.mounted || result == null ) return ;
31+ _showDialogSelectionSnackBar (context, result);
32+ }
33+
34+ Future <void > _showErrorDialogPreview (BuildContext context) async {
35+ final l10n = AppLocalizations .of (context)! ;
36+ final result = await showTouchFishErrorDialog <String >(
37+ context,
38+ title: l10n.debugErrorDialogDemoTitle,
39+ message: l10n.debugErrorDialogDemoMessage,
40+ barrierDismissible: false ,
41+ actions: [
42+ TouchFishDialogAction <String >(label: l10n.cancel, result: l10n.cancel),
43+ TouchFishDialogAction <String >(
44+ label: l10n.settingsTitle,
45+ result: l10n.settingsTitle,
46+ ),
47+ TouchFishDialogAction <String >(
48+ label: l10n.retry,
49+ result: l10n.retry,
50+ isPrimary: true ,
51+ ),
52+ ],
53+ );
54+
55+ if (! context.mounted || result == null ) return ;
56+ _showDialogSelectionSnackBar (context, result);
57+ }
58+
59+ void _showDialogSelectionSnackBar (BuildContext context, String action) {
60+ final l10n = AppLocalizations .of (context)! ;
61+ final messenger = ScaffoldMessenger .of (context);
62+ messenger
63+ ..hideCurrentSnackBar ()
64+ ..showSnackBar (
65+ SnackBar (content: Text (l10n.debugDialogSelectedAction (action))),
66+ );
67+ }
68+
969 @override
1070 Widget build (BuildContext context) {
1171 final l10n = AppLocalizations .of (context)! ;
1272 final colorScheme = Theme .of (context).colorScheme;
1373
1474 return Scaffold (
15- appBar: AppBar (
16- title: Text (l10n.accountDebugOptions),
17- ),
75+ appBar: AppBar (title: Text (l10n.accountDebugOptions)),
1876 body: ListView (
1977 children: [
2078 const SizedBox (height: 8 ),
2179 ListTile (
22- leading: Icon (
23- Symbols .terminal,
24- color: colorScheme.primary,
25- ),
80+ leading: Icon (Symbols .terminal, color: colorScheme.primary),
2681 trailing: const Icon (Symbols .chevron_right),
2782 contentPadding: const EdgeInsets .symmetric (horizontal: 24 ),
2883 title: Text (l10n.debugLogs),
@@ -36,6 +91,24 @@ class DebugOptionsScreen extends StatelessWidget {
3691 },
3792 ),
3893 const Divider (height: 1 ),
94+ ListTile (
95+ leading: Icon (Symbols .info_rounded, color: colorScheme.primary),
96+ trailing: const Icon (Symbols .chevron_right),
97+ contentPadding: const EdgeInsets .symmetric (horizontal: 24 ),
98+ title: Text (l10n.debugCustomInfoDialog),
99+ subtitle: Text (l10n.debugCustomInfoDialogDescription),
100+ onTap: () => _showInfoDialogPreview (context),
101+ ),
102+ const Divider (height: 1 ),
103+ ListTile (
104+ leading: Icon (Symbols .error, color: colorScheme.error),
105+ trailing: const Icon (Symbols .chevron_right),
106+ contentPadding: const EdgeInsets .symmetric (horizontal: 24 ),
107+ title: Text (l10n.debugCustomErrorDialog),
108+ subtitle: Text (l10n.debugCustomErrorDialogDescription),
109+ onTap: () => _showErrorDialogPreview (context),
110+ ),
111+ const Divider (height: 1 ),
39112 ],
40113 ),
41114 );
0 commit comments