import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import '../../../providers/test_results.dart'; class TestResultSearchBox extends StatelessWidget { const TestResultSearchBox({ Key? key, required this.searchCTRL, required double deviceBlockSize, }) : _deviceBlockSize = deviceBlockSize, super(key: key); final TextEditingController searchCTRL; final double _deviceBlockSize; @override Widget build(BuildContext context) { var textVal; return TextField( onEditingComplete: () { FocusScope.of(context).unfocus(); }, onChanged: (value) async { textVal = value; }, controller: searchCTRL, decoration: InputDecoration( icon: Icon( FontAwesomeIcons.search, size: 6 * _deviceBlockSize, ), labelStyle: TextStyle( fontWeight: FontWeight.w100, fontSize: 4 * _deviceBlockSize, ), labelText: 'Search by test name', isDense: true, contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3), suffixIcon: InkWell( onTap: () async { var testResults = await Provider.of(context, listen: false); testResults.setLoading(); await testResults.search(textVal); }, 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.visiblePassword, ); } }