Skip to content

Commit fde6d8a

Browse files
open_wearable/lib/widgets/sensors/configuration/save_config_row.dart: improved textbox behavior
1 parent 5a717ec commit fde6d8a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

open_wearable/lib/widgets/sensors/configuration/save_config_row.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ class _SaveConfigRowState extends State<SaveConfigRow> {
2222
Widget build(BuildContext context) {
2323
return PlatformListTile(
2424
title: PlatformTextField(
25-
onSubmitted: (value) async {
25+
onChanged: (value) {
2626
setState(() {
2727
_configName = value;
2828
});
2929
},
30+
onSubmitted: (value) async {
31+
setState(() {
32+
_configName = value.trim();
33+
});
34+
},
35+
onTapOutside: (event) => FocusScope.of(context).unfocus(),
36+
hintText: "Save as...",
3037
),
3138
trailing: PlatformElevatedButton(
3239
onPressed: () async {
@@ -37,7 +44,7 @@ class _SaveConfigRowState extends State<SaveConfigRow> {
3744
_logger.d("Saving configuration: $_configName with data: $config");
3845

3946
if (_configName.isNotEmpty) {
40-
await SensorConfigurationStorage.saveConfiguration(_configName, config);
47+
await SensorConfigurationStorage.saveConfiguration(_configName.trim(), config);
4148
} else {
4249
showPlatformDialog(
4350
context: context,

0 commit comments

Comments
 (0)