-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keyboard issue while closing #190
Comments
Hi @sabari7320,
It would be great if you can try to modify the below code sample and provide a reproducible code sample with steps to reproduce the issue. 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() {
suggestions = [
'United States',
'Germany',
'Canada',
'United Kingdom',
'France',
'Italy',
'Spain',
'Australia',
'India',
'China',
'Japan',
'Brazil',
'South Africa',
'Mexico',
'Argentina',
'Russia',
'Indonesia',
'Turkey',
'Saudi Arabia',
'Nigeria',
'Egypt',
];
selected = suggestions[0];
super.initState();
}
int suggestionsCount = 12;
final _otherTextFieldFocusNode = FocusNode();
final TextEditingController searchController = TextEditingController();
var suggestions = <String>[];
int counter = 0;
var selected = '';
@override
Widget build(BuildContext context) {
Widget searchChild(x, {bool isSelected = false}) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(x,
style: TextStyle(
fontSize: 18,
color: isSelected ? Colors.green : Colors.black)),
);
return Scaffold(
appBar: AppBar(title: Text('Searchfield Demo')),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Spacer(),
SearchField(
autovalidateMode: AutovalidateMode.onUserInteraction,
onTapOutside: null,
focusNode: _otherTextFieldFocusNode,
suggestionStyle: TextStyle(decoration: TextDecoration.none),
searchInputDecoration: SearchInputDecoration(
border: InputBorder.none,
labelText: 'State',
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(10)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(10)),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(10)),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red),
borderRadius: BorderRadius.circular(10)),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red),
borderRadius: BorderRadius.circular(10)),
hintStyle: TextStyle(color: Colors.black),
contentPadding:
const EdgeInsets.symmetric(vertical: 1.0, horizontal: 15),
),
onSuggestionTap: (selectedValue) {},
suggestions: suggestions.isEmpty
? [
SearchFieldListItem("No state available",
child: Text("No state available"))
]
: suggestions
.map((state) => SearchFieldListItem(
state,
item: state,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(state),
),
))
.toList(),
itemHeight: 55,
maxSuggestionsInViewPort: 4,
validator: (selectedValue) {
if (selectedValue == null ||
!suggestions.contains(selectedValue)) {
return 'Please select State';
}
return null;
},
),
SizedBox(height: 100),
],
),
));
}
}
|
i am facing same issue |
@sunilpandit2 Can you provide the information requested above? It will help me investigate the issue |
if i click the back button again the same values appear |
@sabari7320 can you provide this info ? |
@sabari7320 Can you try the latest release v1.1.9 |
Describe the bug
When I select a value from the dropdown and then close the keyboard, the selected value disappears, and the dropdown list resets to its initial state
media_20241105_152647_3776325864368482703.mp4
The text was updated successfully, but these errors were encountered: