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