Merge pull request #40 from ernestkoko/feature/adding-dynamic-padding-between-flag-and-countryname
Worked on the margin between flag and the country name.
This commit is contained in:
@@ -26,6 +26,6 @@ subprojects {
|
|||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register("clean", Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:flutter_localizations/flutter_localizations.dart';
|
|||||||
void main() => runApp(const MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
const MyApp({Key key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MyAppState createState() => MyAppState();
|
MyAppState createState() => MyAppState();
|
||||||
@@ -107,10 +107,12 @@ class MyAppState extends State<MyApp> {
|
|||||||
favorite: const ['+39', 'FR'],
|
favorite: const ['+39', 'FR'],
|
||||||
countryFilter: const ['IT', 'FR'],
|
countryFilter: const ['IT', 'FR'],
|
||||||
showFlagDialog: false,
|
showFlagDialog: false,
|
||||||
comparator: (a, b) => b.name.compareTo(a.name),
|
//You can set the margin between the flag and the country name to your taste.
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 6),
|
||||||
|
comparator: (a, b) => b.name!.compareTo(a.name!),
|
||||||
//Get the country information relevant to the initial selection
|
//Get the country information relevant to the initial selection
|
||||||
onInit: (code) => debugPrint(
|
onInit: (code) => debugPrint(
|
||||||
"on init ${code.name} ${code.dialCode} ${code.name}"),
|
"on init ${code?.name} ${code?.dialCode} ${code?.name}"),
|
||||||
),
|
),
|
||||||
CountryCodePicker(
|
CountryCodePicker(
|
||||||
onChanged: print,
|
onChanged: print,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ version: 1.0.0+1
|
|||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.0.0-dev.68.0 <3.0.0"
|
sdk: '>=2.17.0 <4.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
final List<String> favorite;
|
final List<String> favorite;
|
||||||
final TextStyle? textStyle;
|
final TextStyle? textStyle;
|
||||||
final EdgeInsetsGeometry padding;
|
final EdgeInsetsGeometry padding;
|
||||||
|
final EdgeInsetsGeometry? margin;
|
||||||
final bool showCountryOnly;
|
final bool showCountryOnly;
|
||||||
final InputDecoration searchDecoration;
|
final InputDecoration searchDecoration;
|
||||||
final TextStyle? searchStyle;
|
final TextStyle? searchStyle;
|
||||||
@@ -99,6 +100,7 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
this.favorite = const [],
|
this.favorite = const [],
|
||||||
this.textStyle,
|
this.textStyle,
|
||||||
this.padding = const EdgeInsets.all(8.0),
|
this.padding = const EdgeInsets.all(8.0),
|
||||||
|
this.margin,
|
||||||
this.showCountryOnly = false,
|
this.showCountryOnly = false,
|
||||||
this.searchDecoration = const InputDecoration(),
|
this.searchDecoration = const InputDecoration(),
|
||||||
this.searchStyle,
|
this.searchStyle,
|
||||||
@@ -127,7 +129,8 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
this.dialogBackgroundColor,
|
this.dialogBackgroundColor,
|
||||||
this.closeIcon = const Icon(Icons.close),
|
this.closeIcon = const Icon(Icons.close),
|
||||||
this.countryList = codes,
|
this.countryList = codes,
|
||||||
this.dialogItemPadding = const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
this.dialogItemPadding =
|
||||||
|
const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
||||||
this.searchPadding = const EdgeInsets.symmetric(horizontal: 24),
|
this.searchPadding = const EdgeInsets.symmetric(horizontal: 24),
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
@@ -194,9 +197,10 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
? Clip.none
|
? Clip.none
|
||||||
: Clip.hardEdge,
|
: Clip.hardEdge,
|
||||||
decoration: widget.flagDecoration,
|
decoration: widget.flagDecoration,
|
||||||
margin: widget.alignLeft
|
margin: widget.margin ??
|
||||||
? const EdgeInsets.only(right: 16.0, left: 8.0)
|
(widget.alignLeft
|
||||||
: const EdgeInsets.only(right: 16.0),
|
? const EdgeInsets.only(right: 16.0, left: 8.0)
|
||||||
|
: const EdgeInsets.only(right: 16.0)),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
selectedItem!.flagUri!,
|
selectedItem!.flagUri!,
|
||||||
package: 'country_code_picker',
|
package: 'country_code_picker',
|
||||||
@@ -221,9 +225,9 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
flex: widget.alignLeft ? 0 : 1,
|
flex: widget.alignLeft ? 0 : 1,
|
||||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: widget.alignLeft
|
padding: (widget.alignLeft
|
||||||
? const EdgeInsets.only(right: 16.0, left: 8.0)
|
? const EdgeInsets.only(right: 16.0, left: 8.0)
|
||||||
: const EdgeInsets.only(right: 16.0),
|
: const EdgeInsets.only(right: 16.0)),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.arrow_drop_down,
|
Icons.arrow_drop_down,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ repository: https://github.com/chandrabezzo/CountryCodePicker
|
|||||||
issue_tracker: https://github.com/imtoori/CountryCodePicker/issues
|
issue_tracker: https://github.com/imtoori/CountryCodePicker/issues
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.17.0 <4.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|||||||
Reference in New Issue
Block a user