Skip to content

Commit 22a9165

Browse files
Add snackbar in gyroscope_screen.dart
1 parent bef13fc commit 22a9165

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

lib/view/gyroscope_screen.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class _GyroscopeScreenState extends State<GyroscopeScreen> {
175175
return AlertDialog(
176176
title: Text(appLocalizations.saveRecording),
177177
content: TextField(
178+
maxLength: 200,
178179
controller: filenameController,
179180
decoration: InputDecoration(
180181
hintText: appLocalizations.enterFileName,
@@ -184,11 +185,22 @@ class _GyroscopeScreenState extends State<GyroscopeScreen> {
184185
actions: [
185186
TextButton(
186187
onPressed: () => Navigator.pop(context),
187-
child: Text(appLocalizations.cancel.toUpperCase()),
188+
child: Text(appLocalizations.cancel),
188189
),
189190
ElevatedButton(
190191
onPressed: () {
191-
Navigator.pop(context, filenameController.text);
192+
final text = filenameController.text.trim();
193+
if (text.length > 200) {
194+
ScaffoldMessenger.of(context).showSnackBar(
195+
const SnackBar(
196+
content: Text(
197+
'File name must be less than 200 characters.',
198+
),
199+
),
200+
);
201+
return;
202+
}
203+
Navigator.pop(context, text);
192204
},
193205
child: Text(appLocalizations.save),
194206
),

0 commit comments

Comments
 (0)