From 5f647aebfcac00f2c5cb289a2ec13769c2f426f6 Mon Sep 17 00:00:00 2001 From: kechankrisna Date: Thu, 29 Jul 2021 23:48:18 +0700 Subject: [PATCH] add isDialog --- lib/country_code_picker.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index c979e12b..f5684fdc 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -28,6 +28,9 @@ class CountryCodePicker extends StatefulWidget { final TextOverflow textOverflow; final Icon closeIcon; + // allow user to keep showing dialog instead of bottom sheet for their own login + final bool isDialog; + /// Barrier color of ModalBottomSheet final Color? barrierColor; @@ -117,6 +120,7 @@ class CountryCodePicker extends StatefulWidget { this.dialogSize, this.dialogBackgroundColor, this.closeIcon = const Icon(Icons.close), + this.isDialog = false, this.countryList = codes, Key? key, }) : super(key: key); @@ -282,7 +286,8 @@ class CountryCodePickerState extends State { } void showCountryCodePickerDialog() { - if (!UniversalPlatform.isAndroid && !UniversalPlatform.isIOS) { + if ((!UniversalPlatform.isAndroid && !UniversalPlatform.isIOS) || + widget.isDialog) { showDialog( barrierColor: widget.barrierColor ?? Colors.grey.withOpacity(0.5), // backgroundColor: widget.backgroundColor ?? Colors.transparent,