Skip to content

Commit 00ee2ed

Browse files
Add Snackbar in luxmeter_screen.dart
1 parent a8da819 commit 00ee2ed

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

lib/view/luxmeter_screen.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class _LuxMeterScreenState extends State<LuxMeterScreen> {
160160
return AlertDialog(
161161
title: Text(appLocalizations.saveRecording),
162162
content: TextField(
163+
maxLength: 200,
163164
controller: filenameController,
164165
decoration: InputDecoration(
165166
hintText: appLocalizations.enterFileName,
@@ -169,11 +170,22 @@ class _LuxMeterScreenState extends State<LuxMeterScreen> {
169170
actions: [
170171
TextButton(
171172
onPressed: () => Navigator.pop(context),
172-
child: Text(appLocalizations.cancel.toUpperCase()),
173+
child: Text(appLocalizations.cancel),
173174
),
174175
ElevatedButton(
175176
onPressed: () {
176-
Navigator.pop(context, filenameController.text);
177+
final text = filenameController.text.trim();
178+
if (text.length > 200) {
179+
ScaffoldMessenger.of(context).showSnackBar(
180+
const SnackBar(
181+
content: Text(
182+
'File name must be less than 200 characters.',
183+
),
184+
),
185+
);
186+
return;
187+
}
188+
Navigator.pop(context, text);
177189
},
178190
child: Text(appLocalizations.save),
179191
),

0 commit comments

Comments
 (0)