import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import '../../../providers/labels.dart'; class LabelSearchBox extends StatelessWidget { const LabelSearchBox({ 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 searchVal; return TextField( onEditingComplete: () { FocusScope.of(context).unfocus(); }, onChanged: (value) async { searchVal = value; }, controller: searchCTRL, decoration: InputDecoration( icon: Icon( FontAwesomeIcons.search, size: 6 * _deviceBlockSize, ), labelStyle: TextStyle( fontWeight: FontWeight.w100, fontSize: 4 * _deviceBlockSize, ), labelText: 'Search by package name', isDense: true, contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3), suffixIcon: InkWell( onTap: () async { var labels = await Provider.of( 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, ); } }