user search TextField horizontal align and case insensitive

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-09-23 10:03:09 +08:00
parent 462fa5999f
commit 55b43f4612

View File

@ -120,6 +120,7 @@ class _MyGroupState extends State<MyGroup> {
}
Widget _buildLeftHeader() {
final fontSize = 14.0;
return Row(
children: [
Expanded(
@ -128,16 +129,16 @@ class _MyGroupState extends State<MyGroup> {
onChanged: (value) {
searchUserText.value = value;
},
textAlignVertical: TextAlignVertical.center,
style: TextStyle(fontSize: fontSize),
decoration: InputDecoration(
filled: false,
prefixIcon: Icon(
Icons.search_rounded,
color: Theme.of(context).hintColor,
),
contentPadding: const EdgeInsets.symmetric(vertical: 10),
).paddingOnly(top: 2),
hintText: translate("Search"),
hintStyle:
TextStyle(fontSize: 14, color: Theme.of(context).hintColor),
hintStyle: TextStyle(fontSize: fontSize),
border: InputBorder.none,
isDense: true,
),
@ -150,7 +151,9 @@ class _MyGroupState extends State<MyGroup> {
return Obx(() {
final items = gFFI.groupModel.users.where((p0) {
if (searchUserText.isNotEmpty) {
return p0.name.contains(searchUserText.value);
return p0.name
.toLowerCase()
.contains(searchUserText.value.toLowerCase());
}
return true;
}).toList();