Skip to content

Commit bef13fc

Browse files
Add snackbar in soundmeter_screen.dart
1 parent ac5cb3b commit bef13fc

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lib/view/soundmeter_screen.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class _SoundMeterScreenState extends State<SoundMeterScreen> {
147147
return AlertDialog(
148148
title: Text(appLocalizations.saveRecording),
149149
content: TextField(
150+
maxLength: 200,
150151
controller: filenameController,
151152
decoration: InputDecoration(
152153
hintText: appLocalizations.enterFileName,
@@ -160,7 +161,18 @@ class _SoundMeterScreenState extends State<SoundMeterScreen> {
160161
),
161162
ElevatedButton(
162163
onPressed: () {
163-
Navigator.pop(context, filenameController.text);
164+
final text = filenameController.text.trim();
165+
if (text.length > 200) {
166+
ScaffoldMessenger.of(context).showSnackBar(
167+
const SnackBar(
168+
content: Text(
169+
'File name must be less than 200 characters.',
170+
),
171+
),
172+
);
173+
return;
174+
}
175+
Navigator.pop(context, text);
164176
},
165177
child: Text(appLocalizations.save),
166178
),

0 commit comments

Comments
 (0)