Merge branch 'master' into feature/flag-decorations
This commit is contained in:
@@ -4,24 +4,24 @@ import 'package:flutter/material.dart';
|
||||
/// selection dialog used for selection of the country code
|
||||
class SelectionDialog extends StatefulWidget {
|
||||
final List<CountryCode> elements;
|
||||
final bool showCountryOnly;
|
||||
final bool? showCountryOnly;
|
||||
final InputDecoration searchDecoration;
|
||||
final TextStyle searchStyle;
|
||||
final TextStyle textStyle;
|
||||
final BoxDecoration boxDecoration;
|
||||
final WidgetBuilder emptySearchBuilder;
|
||||
final bool showFlag;
|
||||
final TextStyle? searchStyle;
|
||||
final TextStyle? textStyle;
|
||||
final BoxDecoration? boxDecoration;
|
||||
final WidgetBuilder? emptySearchBuilder;
|
||||
final bool? showFlag;
|
||||
final double flagWidth;
|
||||
final Decoration flagDecoration;
|
||||
final Size size;
|
||||
final Decoration? flagDecoration;
|
||||
final Size? size;
|
||||
final bool hideSearch;
|
||||
final Icon closeIcon;
|
||||
final Icon? closeIcon;
|
||||
|
||||
/// Background color of SelectionDialog
|
||||
final Color backgroundColor;
|
||||
final Color? backgroundColor;
|
||||
|
||||
/// Boxshaow color of SelectionDialog that matches CountryCodePicker barrier color
|
||||
final Color barrierColor;
|
||||
final Color? barrierColor;
|
||||
|
||||
/// elements passed as favorite
|
||||
final List<CountryCode> favoriteElements;
|
||||
@@ -29,7 +29,7 @@ class SelectionDialog extends StatefulWidget {
|
||||
SelectionDialog(
|
||||
this.elements,
|
||||
this.favoriteElements, {
|
||||
Key key,
|
||||
Key? key,
|
||||
this.showCountryOnly,
|
||||
this.emptySearchBuilder,
|
||||
InputDecoration searchDecoration = const InputDecoration(),
|
||||
@@ -56,11 +56,11 @@ class SelectionDialog extends StatefulWidget {
|
||||
|
||||
class _SelectionDialogState extends State<SelectionDialog> {
|
||||
/// this is useful for filtering purpose
|
||||
List<CountryCode> filteredElements;
|
||||
late List<CountryCode> filteredElements;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
padding: const EdgeInsets.all(0.0),
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
width: widget.size?.width ?? MediaQuery.of(context).size.width,
|
||||
@@ -69,7 +69,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
decoration: widget.boxDecoration ??
|
||||
BoxDecoration(
|
||||
color: widget.backgroundColor ?? Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(25.0)),
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: widget.barrierColor ?? Colors.grey.withOpacity(1),
|
||||
@@ -86,7 +86,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
IconButton(
|
||||
padding: const EdgeInsets.all(0),
|
||||
iconSize: 20,
|
||||
icon: widget.closeIcon,
|
||||
icon: widget.closeIcon!,
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
if (!widget.hideSearch)
|
||||
@@ -142,7 +142,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
child: Flex(
|
||||
direction: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
if (widget.showFlag)
|
||||
if (widget.showFlag!)
|
||||
Flexible(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(right: 16.0),
|
||||
@@ -150,7 +150,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
clipBehavior:
|
||||
widget.flagDecoration == null ? Clip.none : Clip.hardEdge,
|
||||
child: Image.asset(
|
||||
e.flagUri,
|
||||
e.flagUri!,
|
||||
package: 'country_code_picker',
|
||||
width: widget.flagWidth,
|
||||
),
|
||||
@@ -159,7 +159,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
widget.showCountryOnly
|
||||
widget.showCountryOnly!
|
||||
? e.toCountryStringOnly()
|
||||
: e.toLongString(),
|
||||
overflow: TextOverflow.fade,
|
||||
@@ -173,7 +173,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
|
||||
Widget _buildEmptySearchWidget(BuildContext context) {
|
||||
if (widget.emptySearchBuilder != null) {
|
||||
return widget.emptySearchBuilder(context);
|
||||
return widget.emptySearchBuilder!(context);
|
||||
}
|
||||
|
||||
return Center(
|
||||
@@ -192,9 +192,9 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
setState(() {
|
||||
filteredElements = widget.elements
|
||||
.where((e) =>
|
||||
e.code.contains(s) ||
|
||||
e.dialCode.contains(s) ||
|
||||
e.name.toUpperCase().contains(s))
|
||||
e.code!.contains(s) ||
|
||||
e.dialCode!.contains(s) ||
|
||||
e.name!.toUpperCase().contains(s))
|
||||
.toList();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user