style: small refactor in level_selection

This commit is contained in:
Orangerot 2025-01-13 15:24:58 +01:00
parent d52f60ef92
commit fc951a4df5
2 changed files with 16 additions and 11 deletions

View file

@ -78,6 +78,16 @@ class _LevelSelectionState extends State<LevelSelection> {
} }
} }
void filterLevels(String input) {
setState(() {
stepmaniaCoursesFoldersFiltered = stepmaniaCoursesFolders
.where((simfile) => simfile.tags["TITLE"]!
.toLowerCase()
.contains(input.toLowerCase()))
.toList();
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -111,15 +121,7 @@ class _LevelSelectionState extends State<LevelSelection> {
padding: padding:
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 0.0), const EdgeInsets.symmetric(horizontal: 16.0, vertical: 0.0),
child: TextField( child: TextField(
onChanged: (input) { onChanged: filterLevels,
setState(() {
stepmaniaCoursesFoldersFiltered = stepmaniaCoursesFolders
.where((simfile) => simfile.tags["TITLE"]!
.toLowerCase()
.contains(input.toLowerCase()))
.toList();
});
},
decoration: InputDecoration( decoration: InputDecoration(
// icon: Icon(Icons.search), // icon: Icon(Icons.search),
hintText: 'Search'), hintText: 'Search'),
@ -151,7 +153,10 @@ class _LevelSelectionState extends State<LevelSelection> {
} }
}), }),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
onPressed: () => {selectFolder()}, child: Icon(Icons.add)), onPressed: () {
selectFolder();
},
child: Icon(Icons.add)),
); );
} }
} }

View file

@ -40,7 +40,7 @@ class _ESenseConnectDialogState extends State<ESenseConnectDialog> {
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
onPressed: () => Navigator.pop(context, 'Cancel'), onPressed: () => Navigator.pop(context, 'Cancel'),
child: const Text('Discard'), child: const Text('Close'),
), ),
TextButton( TextButton(
onPressed: () => widget.connect(eSenseDeviceName), onPressed: () => widget.connect(eSenseDeviceName),