@@ -16,13 +16,15 @@ class NoCodesScreen extends StatefulWidget {
1616
1717class _NoCodesScreenState extends State <NoCodesScreen > {
1818 final _contextKeyController = TextEditingController (text: 'kamo_test' );
19+ final _localeController = TextEditingController ();
1920
2021 NoCodesPresentationStyle _presentationStyle = NoCodesPresentationStyle .fullScreen;
2122 bool _animated = true ;
2223
2324 @override
2425 void dispose () {
2526 _contextKeyController.dispose ();
27+ _localeController.dispose ();
2628 super .dispose ();
2729 }
2830
@@ -53,6 +55,8 @@ class _NoCodesScreenState extends State<NoCodesScreen> {
5355 const SizedBox (height: 16 ),
5456 _buildPresentationConfigSection (),
5557 const SizedBox (height: 16 ),
58+ _buildLocaleSection (),
59+ const SizedBox (height: 16 ),
5660 _buildActionsSection (),
5761 const SizedBox (height: 16 ),
5862 _buildEventsSection (appState),
@@ -149,6 +153,36 @@ class _NoCodesScreenState extends State<NoCodesScreen> {
149153 );
150154 }
151155
156+ Widget _buildLocaleSection () {
157+ return SectionCard (
158+ title: 'Locale' ,
159+ child: Column (
160+ crossAxisAlignment: CrossAxisAlignment .stretch,
161+ children: [
162+ TextField (
163+ controller: _localeController,
164+ decoration: const InputDecoration (
165+ hintText: 'e.g. en, de, fr' ,
166+ labelText: 'Locale code' ,
167+ ),
168+ ),
169+ const SizedBox (height: 12 ),
170+ ElevatedButton .icon (
171+ onPressed: _setLocale,
172+ icon: const Icon (Icons .language),
173+ label: const Text ('Set Locale' ),
174+ ),
175+ const SizedBox (height: 8 ),
176+ OutlinedButton .icon (
177+ onPressed: _resetLocale,
178+ icon: const Icon (Icons .refresh),
179+ label: const Text ('Reset to Device Default' ),
180+ ),
181+ ],
182+ ),
183+ );
184+ }
185+
152186 Widget _buildActionsSection () {
153187 return SectionCard (
154188 title: 'Actions' ,
@@ -246,6 +280,34 @@ class _NoCodesScreenState extends State<NoCodesScreen> {
246280 }
247281 }
248282
283+ void _setLocale () async {
284+ final locale = _localeController.text.trim ();
285+ final localeValue = locale.isEmpty ? null : locale;
286+
287+ try {
288+ debugPrint ('🔄 [NoCodes] Setting locale: $localeValue ' );
289+ await NoCodes .getSharedInstance ().setLocale (localeValue);
290+ debugPrint ('✅ [NoCodes] Locale set' );
291+ _showSuccess (localeValue != null ? 'Locale set to: $localeValue ' : 'Locale reset to device default' );
292+ } catch (e) {
293+ debugPrint ('❌ [NoCodes] Failed to set locale: $e ' );
294+ _showError ('Failed to set locale: $e ' );
295+ }
296+ }
297+
298+ void _resetLocale () async {
299+ try {
300+ debugPrint ('🔄 [NoCodes] Resetting locale to device default...' );
301+ await NoCodes .getSharedInstance ().setLocale (null );
302+ _localeController.clear ();
303+ debugPrint ('✅ [NoCodes] Locale reset' );
304+ _showSuccess ('Locale reset to device default' );
305+ } catch (e) {
306+ debugPrint ('❌ [NoCodes] Failed to reset locale: $e ' );
307+ _showError ('Failed to reset locale: $e ' );
308+ }
309+ }
310+
249311 void _showSuccess (String message) {
250312 ScaffoldMessenger .of (context).showSnackBar (
251313 SnackBar (content: Text (message), backgroundColor: AppTheme .successColor),
0 commit comments