searchfield
searchfield copied to clipboard
Getter hint and maintainHintSize not defined when i upgraded package to 1.3.2
Describe the bug I have upgrade the package to version: searchfield-1.3.2 and when i am running the project i keep getting these errors: getter or field named 'maintainHintSize' is not defined. maintainHintSize: maintainHintSize ?? this.maintainHintSize,
also, Error: The getter 'hint' isn't defined for the class 'SearchInputDecoration'. hint: hint ?? this.hint,
To Reproduce Steps to reproduce the behavior:
- Upgrade package to latest version
- And then make a build
- See error
[ ] By clicking this checkbox, I confirm I am using the latest version of the package found on pub.dev/searchfield
Hey @osmanjavaid10, Thanks for filing the issue. Can you please share the build error and the output of flutter doctor -v?
Just tried the searchfield sample app with SearchDecoration.hint on the latest stable
mahesh@MacBook-Pro-81 searchfield % flutter build apk
Target file "lib/main.dart" not found.
mahesh@MacBook-Pro-81 searchfield % cd example
mahesh@MacBook-Pro-81 example % flutter build apk
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1572 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Running Gradle task 'assembleRelease'... 127.9s
✓ Built build/app/outputs/flutter-apk/app-release.apk (20.8MB)
mahesh@MacBook-Pro-81 example %
[!] Flutter (Channel stable, 3.32.2, on macOS 15.4 24E248 darwin-arm64, locale en-US) [1,503ms]
code sample
// import 'package:example/pagination.dart';
import 'package:flutter/material.dart';
import 'package:searchfield/searchfield.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter App',
theme: ThemeData(
colorSchemeSeed: Colors.indigo,
useMaterial3: true,
brightness: Brightness.light,
),
darkTheme: ThemeData(
colorSchemeSeed: Colors.blue,
useMaterial3: true,
brightness: Brightness.dark,
),
home: SearchFieldSample(),
debugShowCheckedModeBanner: false,
);
}
}
class SearchFieldSample extends StatefulWidget {
const SearchFieldSample({Key? key}) : super(key: key);
@override
State<SearchFieldSample> createState() => _SearchFieldSampleState();
}
class _SearchFieldSampleState extends State<SearchFieldSample> {
@override
void initState() {
cities = [
City('New York', '10001'),
City('Los Angeles', '90001'),
City('Chicago', '60601'),
City('Houston', '77001'),
City('Phoenix', '85001'),
City('Philadelphia', '19101'),
City('San Antonio', '78201'),
City('San Diego', '92101'),
City('Dallas', '75201'),
City('San Jose', '95101'),
City('Austin', '73301'),
City('Jacksonville', '32099'),
City('Fort Worth', '76101'),
City('Columbus', '43201'),
City('Charlotte', '28201'),
City('San Francisco', '94101'),
City('Indianapolis', '46201'),
City('Seattle', '98101'),
City('Denver', '80201'),
City('Washington', '20001'),
City('Boston', '02101'),
].map(
(City ct) {
return SearchFieldListItem<City>(
ct.name,
value: ct.zip.toString(),
item: ct,
child: searchChild(ct, isSelected: false),
);
},
).toList();
super.initState();
}
Widget searchChild(City city, {bool isSelected = false}) => ListTile(
contentPadding: EdgeInsets.all(0),
title: Text(city.name,
style: TextStyle(color: isSelected ? Colors.green : null)),
trailing: Text('#${city.zip}'),
);
var cities = <SearchFieldListItem<City>>[];
SearchFieldListItem<City>? selectedValue;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Searchfield Demo')),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
spacing: 20,
children: [
TextField(
decoration: InputDecoration(
labelText: 'Enter username',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(8)),
),
),
),
SearchField(
suggestionsDecoration: SuggestionDecoration(
borderRadius: BorderRadius.all(Radius.circular(2)),
itemPadding: EdgeInsets.symmetric(horizontal: 16),
),
maxSuggestionBoxHeight: 300,
onSuggestionTap: (SearchFieldListItem<City> item) {
setState(() {
selectedValue = item;
});
},
searchInputDecoration: SearchInputDecoration(
// hintText: 'Search for a city or zip code',
hint: Text('Search for a city or zip code'),
prefixIcon: Icon(Icons.search),
suffix: Icon(Icons.expand_more),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(8)),
),
),
onSearchTextChanged: (searchText) {
if (searchText.isEmpty) {
return cities
.map((e) => e.copyWith(
child: searchChild(e.item!,
isSelected: e == selectedValue)))
.toList();
}
// filter the list of cities by the search text
final filter = List<SearchFieldListItem<City>>.from(cities)
.where((city) {
return city.item!.name
.toLowerCase()
.contains(searchText.toLowerCase()) ||
city.item!.zip.toString().contains(searchText);
}).toList();
return filter;
},
selectedValue: selectedValue,
suggestions: cities
.map((e) => e.copyWith(
child: searchChild(e.item!,
isSelected: e == selectedValue)))
.toList(),
suggestionState: Suggestion.expand,
),
ElevatedButton(
onPressed: () {
setState(() {
selectedValue = null;
});
},
child: Text('clear input'))
],
),
));
}
}
class City {
String name;
String zip;
City(this.name, this.zip);
}
Did you seriously remove our comments @maheshj01 ? Instead of actually approving the pull request to fix this issue? Are you seriously this bitter and un-professional?
This is clearly just a case of super.constructor parameters being deprecated by Flutter, what is there to test? I've literally manually changed the parameters on the pub-cache and was able to compile with no issues.
Osman is right, you should really consider handing this package to somebody else or consider putting this repository to archive. You aren't actively maintaining this project anymore.
Did you seriously remove our comments @maheshj01 ?
What comments are you talking about? No comment is ever deleted.
Instead of actually approving the pull request to fix this issue? Are you seriously this bitter and un-professional?
I expect people engaging in this repository or anywhere else to be respectful.
Thanks for your feedback, @utkuvrs. I understand the concern about the super.constructor issue and the package's maintenance.
First, regarding the super.constructor parameters and the "Getter hint and maintainHintSize not defined" error: While manually changing parameters might allow compilation in a specific environment, a proper fix for an open-source library requires careful consideration of backward compatibility and thorough testing. This is to ensure the stability of the package.
Second, regarding maintenance: I actively maintain this OSS project in my free time, as often as time permits. If you check previous issues, I have consistently responded within 24 hours, demonstrating my commitment.
To effectively address and resolve issues, including this one, it is essential for reporters to provide comprehensive information. This includes detailed steps to reproduce the problem, your Flutter version, and the output of flutter doctor -v. Without this information, it's very difficult for me to diagnose and prioritize fixes, especially given my limited free time.
Please provide the necessary details for issue #243 so I can investigate this particular problem thoroughly. Your cooperation helps me to help you and the community more efficiently.
Thank you for your contribution to open source library searchfield, @maheshj01 .
It allows compilation in both Android and iOS, if you simply compile the application after doing the changes that will be enough for testing. Regarding backward compatibility, I've never had any problems with backward compatibility in any other package I've used other than searchfield. I remember it causing a similar issue a couple months ago as well. And all of the other issues suggest on a technical debt on this package.
What comments are you talking about? No comment is ever deleted.
Here is an example of the deleted comment.
Android flutter doctor -v
[√] Flutter (Channel stable, 3.29.2, on Microsoft Windows [Version 10.0.26100.4946], locale en-US) [576ms]
• Flutter version 3.29.2 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c236373904 (5 months ago), 2025-03-13 16:17:06 -0400
• Engine revision 18b71d647a
• Dart version 3.7.2
• DevTools version 2.42.3
[√] Windows Version (11 Pro 64-bit, 24H2, 2009) [3.5s]
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [2.4s]
• Android SDK at C:\Users\sipsi\AppData\Local\Android\Sdk
• Platform android-36, build-tools 34.0.0
• Java binary at: C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
This JDK was found in the system PATH.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version Java(TM) SE Runtime Environment (build 17.0.5+9-LTS-191)
• All Android licenses accepted.
iOS flutter doctor -v
[✓] Flutter (Channel stable, 3.29.2, on macOS 15.3.1 24D70 darwin-x64, locale en-US) [2.3s]
• Flutter version 3.29.2 on channel stable at /Users/plot/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c236373904 (5 months ago), 2025-03-13 16:17:06 -0400
• Engine revision 18b71d647a
• Dart version 3.7.2
• DevTools version 2.42.3
[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [6.3s]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16F6
• CocoaPods version 1.16.2
https://github.com/maheshj01/searchfield/pull/249
Here is the fix I'm recommending. To remove the parameters that are now already deprecated by Flutter.
What are your recommendations to implement testing for this change? @maheshj01
These parameters (maintainHintSize, hint) do not exist anymore in Flutter’s InputDecoration class (they were removed in Flutter 3.24).
@utkuvrs Whats the source of this? the latest docs shows both the parameters exists
https://api.flutter.dev/flutter/material/InputDecoration/hint.html https://api.flutter.dev/flutter/material/InputDecoration/maintainHintSize.html
Here is the source of the deprecation for the following parameters: https://docs.flutter.dev/release/breaking-changes#released-in-flutter-3-32
Here is the link to it: https://docs.flutter.dev/release/breaking-changes/deprecate-inputdecoration-maintainhintheight
It wasn't 3.24 it was 3.32. @maheshj01
@utkuvrs
Searchfield has already deprecated maintainHintHeight in favour of maintainHintSize
https://github.com/maheshj01/searchfield/blob/c3fb57a88a1689c61606e648412b26f1749783da/lib/src/input_decoration.dart#L86-L95
and SearchInputDecoration.hint does exist as of latest version 1.3.4