Files

81 lines
2.3 KiB
Dart
Executable File

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class ResultSearchBox extends StatelessWidget {
const ResultSearchBox({
Key? key,
required this.searchCTRL,
required double deviceBlockSize,
required this.text,
required this.onChanged,
required this.onTap,
this.text2 = 'ID',
this.textInputType = TextInputType.number,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final TextEditingController searchCTRL;
final double _deviceBlockSize;
final String text;
final String text2;
final dynamic onChanged;
final dynamic onTap;
final TextInputType textInputType;
@override
Widget build(BuildContext context) {
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(
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Search by $text $text2',
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
),
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,
),
),
),
),
],
);
}
}