Improve search boxes ui

This commit is contained in:
hanie.khodkari
2025-05-12 18:42:20 +03:30
parent 839821e72f
commit 7e4b9a383e
3 changed files with 124 additions and 91 deletions
+32 -19
View File
@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@@ -24,17 +25,21 @@ class ResultSearchBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
return TextField(
return Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: 3,
),
Expanded(
child: TextField(
onEditingComplete: () {
FocusScope.of(context).unfocus();
},
controller: searchCTRL,
onChanged: onChanged,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.search,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
@@ -42,26 +47,34 @@ class ResultSearchBox extends StatelessWidget {
labelText: 'Search by $text $text2',
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
suffixIcon: InkWell(
onTap: onTap,
child: Container(
margin: EdgeInsets.all(5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.input,
color: Colors.white,
),
),
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: textInputType,
),
),
InkWell(
onTap: onTap,
child: Container(
padding: EdgeInsets.all(7),
width: 8 * _deviceBlockSize,
margin: EdgeInsets.only(left: 5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Center(
child: Icon(
Icons.search,
size: 4 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
);
}
}
+37 -28
View File
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../../providers/labels.dart';
@@ -18,19 +17,23 @@ class LabelSearchBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
var searchVal;
return TextField(
return Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: 3,
),
Expanded(
child: TextField(
onEditingComplete: () {
FocusScope.of(context).unfocus();
},
controller: searchCTRL,
onChanged: (value) async {
searchVal = value;
},
controller: searchCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.search,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
@@ -38,33 +41,39 @@ class LabelSearchBox extends StatelessWidget {
labelText: 'Search by package name',
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
suffixIcon: InkWell(
onTap: () async {
var labels = await Provider.of<LabelsProvider>(
context,
listen: false);
labels.setLoading();
await labels.search(searchVal);
},
child: Container(
margin: EdgeInsets.all(5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.input,
color: Colors.white,
),
),
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
),
),
InkWell(
onTap: () async {
var labels =
await Provider.of<LabelsProvider>(context, listen: false);
labels.setLoading();
await labels.search(searchVal);
},
child: Container(
padding: EdgeInsets.all(7),
width: 8 * _deviceBlockSize,
margin: EdgeInsets.only(left: 5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Center(
child: Icon(
Icons.search,
size: 4 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
);
}
}
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
@@ -18,19 +17,23 @@ class TestResultSearchBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
var textVal;
return TextField(
return Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: 3,
),
Expanded(
child: TextField(
onEditingComplete: () {
FocusScope.of(context).unfocus();
},
controller: searchCTRL,
onChanged: (value) async {
textVal = value;
},
controller: searchCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.search,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
@@ -38,7 +41,15 @@ class TestResultSearchBox extends StatelessWidget {
labelText: 'Search by test name',
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
suffixIcon: InkWell(
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
),
),
InkWell(
onTap: () async {
var testResults =
await Provider.of<TestResultsProvider>(context, listen: false);
@@ -46,23 +57,23 @@ class TestResultSearchBox extends StatelessWidget {
await testResults.search(textVal);
},
child: Container(
margin: EdgeInsets.all(5),
padding: EdgeInsets.all(7),
width: 8 * _deviceBlockSize,
margin: EdgeInsets.only(left: 5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Center(
child: Icon(
Icons.input,
Icons.search,
size: 4 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.visiblePassword,
],
);
}
}