Skip to content

Commit cea5202

Browse files
Made the suggested chages
1 parent 29af6a1 commit cea5202

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

lib/constants.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,7 @@ List<String> connectWithUs = [
133133
'Developers'
134134
];
135135
String softwareLicenses = 'Software Licenses';
136+
String tryDifferentSearchSuggestion = 'Try a different search term';
137+
String noInstrumentsFoundMessage = 'No instruments found';
138+
String searchInstrumentsHint = 'Search instruments...';
139+
String instrumentsTitle = 'Instruments';

lib/view/instruments_screen.dart

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,11 @@ class _InstrumentsScreenState extends State<InstrumentsScreen> {
4141
_filteredIndices =
4242
List<int>.generate(instrumentHeadings.length, (index) => index);
4343
} else {
44-
_filteredIndices = [];
45-
for (int i = 0; i < instrumentHeadings.length; i++) {
46-
if (instrumentHeadings[i]
47-
.toLowerCase()
48-
.contains(query.toLowerCase())) {
49-
_filteredIndices.add(i);
50-
}
51-
}
44+
_filteredIndices = List.generate(instrumentHeadings.length, (i) => i)
45+
.where((i) => instrumentHeadings[i]
46+
.toLowerCase()
47+
.contains(query.toLowerCase()))
48+
.toList();
5249
}
5350
});
5451
}
@@ -82,12 +79,12 @@ class _InstrumentsScreenState extends State<InstrumentsScreen> {
8279
Widget build(BuildContext context) {
8380
return MainScaffold(
8481
index: 0,
85-
title: 'Instruments',
82+
title: instrumentsTitle,
8683
body: SafeArea(
8784
child: Column(
8885
children: <Widget>[
8986
Padding(
90-
padding: const EdgeInsets.all(16.0),
87+
padding: const EdgeInsets.symmetric(vertical: 8.0,horizontal: 16.0),
9188
child: Container(
9289
decoration: BoxDecoration(
9390
borderRadius: BorderRadius.circular(30.0),
@@ -103,7 +100,7 @@ class _InstrumentsScreenState extends State<InstrumentsScreen> {
103100
controller: _searchController,
104101
onChanged: _filterInstruments,
105102
decoration: InputDecoration(
106-
hintText: 'Search instruments...',
103+
hintText: searchInstrumentsHint,
107104
hintStyle: TextStyle(
108105
color: Theme.of(context)
109106
.colorScheme
@@ -176,7 +173,7 @@ class _InstrumentsScreenState extends State<InstrumentsScreen> {
176173
),
177174
const SizedBox(height: 16),
178175
Text(
179-
'No instruments found',
176+
noInstrumentsFoundMessage,
180177
style: Theme.of(context)
181178
.textTheme
182179
.titleMedium
@@ -189,7 +186,7 @@ class _InstrumentsScreenState extends State<InstrumentsScreen> {
189186
),
190187
const SizedBox(height: 8),
191188
Text(
192-
'Try a different search term',
189+
tryDifferentSearchSuggestion,
193190
style: Theme.of(context)
194191
.textTheme
195192
.bodyMedium

0 commit comments

Comments
 (0)