Reputation: 43
i used this this package to have an autocomplete text field with this code
AutoCompleteTextField<Item>(
key: key,
clearOnSubmit: false,
suggestions: items,
style: TextStyle(color: Colors.blue, fontSize: 16.0),
decoration: InputDecoration(
contentPadding:
EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
hintText: "المنتج",
border: InputBorder.none,
hintStyle:
TextStyle(color: Colors.blue, fontSize: 16.0),
),
itemFilter: (s, query) {
// print(query.toLowerCase());
return s.Name.toLowerCase()
.startsWith(query.toLowerCase());
},
itemSorter: (a, b) {
return a.Name.compareTo(b.Name);
},
itemSubmitted: (s) {
String n = s.Name;
String p = s.Price.toString();
setState(() {
searchAutoCompleteTextField
.textField.controller.text = n;
txt.text = p;
});
},
itemBuilder: (context, item) {
return row(item);
},
)
and it works fine but i need to have the text in the right alignment and don't know how to do this anyone could help??
Upvotes: 3
Views: 422
Reputation: 14315
Wrap your AutoCompleteTextField
inside Directionality
widget
Directionality( // add this
textDirection: TextDirection.rtl, // set this property
child: AutoCompleteTextField(),
)
Upvotes: 1