From 20983d81a7726459e5aa7eb9d248d75fe9130ff0 Mon Sep 17 00:00:00 2001 From: Abdullah Osama Elhanafy Date: Mon, 20 Jan 2025 17:12:11 +0200 Subject: [PATCH] added backgroundColor property to BottomSheet, DraggableModalSheet, ModalSheet, Dialog. (#280) * added background color parameter * pubspec update * Update CHANGELOG.md * Update main.dart * Update main.dart * Update main.dart --- CHANGELOG.md | 4 ++++ example/ios/Runner/AppDelegate.swift | 2 +- lib/src/country_selector_navigator.dart | 14 ++++++++++++++ pubspec.yaml | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 792d3463..20c89742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [10.0.4] + +- added backgroundColor property to BottomSheet, DraggableModalSheet, ModalSheet, Dialog + ## [10.0.3] - added Catalan localization diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift index 70693e4a..b6363034 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/example/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/lib/src/country_selector_navigator.dart b/lib/src/country_selector_navigator.dart index c47f3bbd..6989fafb 100644 --- a/lib/src/country_selector_navigator.dart +++ b/lib/src/country_selector_navigator.dart @@ -16,6 +16,7 @@ abstract class CountrySelectorNavigator { final Color? searchBoxIconColor; final ScrollPhysics? scrollPhysics; final double flagSize; + final Color? backgroundColor; final bool useRootNavigator; const CountrySelectorNavigator({ @@ -33,6 +34,7 @@ abstract class CountrySelectorNavigator { this.searchBoxDecoration, this.searchBoxTextStyle, this.searchBoxIconColor, + this.backgroundColor, this.scrollPhysics, this.flagSize = 40, this.useRootNavigator = true, @@ -86,6 +88,7 @@ abstract class CountrySelectorNavigator { bool? showDialCode, bool sortCountries, String? noResultMessage, + Color? backgroundColor, bool searchAutofocus, TextStyle? subtitleStyle, TextStyle? titleStyle, @@ -124,6 +127,7 @@ abstract class CountrySelectorNavigator { bool sortCountries, String? noResultMessage, bool searchAutofocus, + Color? backgroundColor, TextStyle? subtitleStyle, TextStyle? titleStyle, InputDecoration? searchBoxDecoration, @@ -143,6 +147,7 @@ abstract class CountrySelectorNavigator { bool sortCountries, String? noResultMessage, bool searchAutofocus, + Color? backgroundColor, TextStyle? subtitleStyle, TextStyle? titleStyle, InputDecoration? searchBoxDecoration, @@ -165,6 +170,7 @@ abstract class CountrySelectorNavigator { double flagSize, bool sortCountries, String? noResultMessage, + Color? backgroundColor, bool searchAutofocus, TextStyle? subtitleStyle, TextStyle? titleStyle, @@ -197,6 +203,7 @@ class DialogNavigator extends CountrySelectorNavigator { super.searchBoxTextStyle, super.searchBoxIconColor, super.scrollPhysics, + super.backgroundColor, }); @override @@ -204,6 +211,7 @@ class DialogNavigator extends CountrySelectorNavigator { return showDialog( context: context, builder: (_) => Dialog( + backgroundColor: backgroundColor, child: SizedBox( width: width, height: height, @@ -296,6 +304,7 @@ class BottomSheetNavigator extends CountrySelectorNavigator { super.searchBoxTextStyle, super.searchBoxIconColor, super.scrollPhysics, + super.backgroundColor, }); @override @@ -304,6 +313,7 @@ class BottomSheetNavigator extends CountrySelectorNavigator { ) { IsoCode? selected; final ctrl = showBottomSheet( + backgroundColor: backgroundColor, context: context, builder: (_) => MediaQuery( data: MediaQueryData.fromView(View.of(context)), @@ -341,6 +351,7 @@ class ModalBottomSheetNavigator extends CountrySelectorNavigator { super.searchBoxTextStyle, super.searchBoxIconColor, super.scrollPhysics, + super.backgroundColor, }); @override @@ -348,6 +359,7 @@ class ModalBottomSheetNavigator extends CountrySelectorNavigator { BuildContext context, ) { return showModalBottomSheet( + backgroundColor: backgroundColor, context: context, builder: (_) => SizedBox( height: height ?? MediaQuery.of(context).size.height - 90, @@ -387,6 +399,7 @@ class DraggableModalBottomSheetNavigator extends CountrySelectorNavigator { super.searchBoxTextStyle, super.searchBoxIconColor, super.scrollPhysics, + super.backgroundColor, bool useRootNavigator = true, }); @@ -399,6 +412,7 @@ class DraggableModalBottomSheetNavigator extends CountrySelectorNavigator { ); return showModalBottomSheet( + backgroundColor: backgroundColor, context: context, shape: RoundedRectangleBorder( borderRadius: effectiveBorderRadius, diff --git a/pubspec.yaml b/pubspec.yaml index bdabf18a..24fa9b39 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: phone_form_field description: Flutter phone input integrated with flutter internationalization -version: 10.0.3 +version: 10.0.4 homepage: https://github.com/cedvdb/phone_form_field environment: