searchPlace method
Begins the search process by displaying a "wait" overlay then proceeds to fetch the autocomplete list. The bottom "dialog" is hidden so as to give more room and better experience for the autocomplete list overlay.
Implementation
void searchPlace(String place) {
clearOverlay();
setState(() => hasSearchTerm = place.isNotEmpty);
if (place.isEmpty) return;
final RenderBox renderBox = context.findRenderObject()! as RenderBox;
Size size = renderBox.size;
final RenderBox appBarBox =
appBarKey.currentContext!.findRenderObject()! as RenderBox;
overlayEntry = OverlayEntry(
builder: (context) => Positioned(
top: appBarBox.size.height,
width: size.width,
child: Material(
elevation: 1,
child: Container(
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 24),
child: Row(
children: <Widget>[
const SizedBox(
height: 24,
width: 24,
child: CircularProgressIndicator(strokeWidth: 3),
),
const SizedBox(width: 24),
Expanded(
child: Text(
S.of(context).finding_place,
style: const TextStyle(fontSize: 16),
),
)
],
),
),
),
),
);
Overlay.of(context)?.insert(overlayEntry!);
autoCompleteSearch(place);
}