awaitFromSelectScreen method

void awaitFromSelectScreen(
  1. BuildContext context,
  2. PreferredSizeWidget? appBar,
  3. CountryTheme? theme
)

Implementation

void awaitFromSelectScreen(BuildContext context, PreferredSizeWidget? appBar,
    CountryTheme? theme) async {
  final result = await Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => SelectionList(
          elements,
          selectedItem,
          appBar: widget.appBar ??
              AppBar(
                backgroundColor:
                    Theme.of(context).appBarTheme.backgroundColor,
                title: Text("Select Country"),
              ),
          theme: theme,
          countryBuilder: widget.countryBuilder,
          useUiOverlay: widget.useUiOverlay,
          useSafeArea: widget.useSafeArea,
          backgroundColor: widget.backgroundColor,
        ),
      ));

  setState(() {
    selectedItem = result ?? selectedItem;
    widget.onChanged!(result ?? selectedItem);
  });
}