Skip to content

Commit

Permalink
added backgroundColor property to BottomSheet, DraggableModalSheet, M…
Browse files Browse the repository at this point in the history
…odalSheet, Dialog. (#280)

* added background color parameter

* pubspec update

* Update CHANGELOG.md

* Update main.dart

* Update main.dart

* Update main.dart
  • Loading branch information
AbdallahElhanafy authored Jan 20, 2025
1 parent 150f5e8 commit 20983d8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [10.0.4]

- added backgroundColor property to BottomSheet, DraggableModalSheet, ModalSheet, Dialog

## [10.0.3]

- added Catalan localization
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
14 changes: 14 additions & 0 deletions lib/src/country_selector_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ abstract class CountrySelectorNavigator {
final Color? searchBoxIconColor;
final ScrollPhysics? scrollPhysics;
final double flagSize;
final Color? backgroundColor;
final bool useRootNavigator;

const CountrySelectorNavigator({
Expand All @@ -33,6 +34,7 @@ abstract class CountrySelectorNavigator {
this.searchBoxDecoration,
this.searchBoxTextStyle,
this.searchBoxIconColor,
this.backgroundColor,
this.scrollPhysics,
this.flagSize = 40,
this.useRootNavigator = true,
Expand Down Expand Up @@ -86,6 +88,7 @@ abstract class CountrySelectorNavigator {
bool? showDialCode,
bool sortCountries,
String? noResultMessage,
Color? backgroundColor,
bool searchAutofocus,
TextStyle? subtitleStyle,
TextStyle? titleStyle,
Expand Down Expand Up @@ -124,6 +127,7 @@ abstract class CountrySelectorNavigator {
bool sortCountries,
String? noResultMessage,
bool searchAutofocus,
Color? backgroundColor,
TextStyle? subtitleStyle,
TextStyle? titleStyle,
InputDecoration? searchBoxDecoration,
Expand All @@ -143,6 +147,7 @@ abstract class CountrySelectorNavigator {
bool sortCountries,
String? noResultMessage,
bool searchAutofocus,
Color? backgroundColor,
TextStyle? subtitleStyle,
TextStyle? titleStyle,
InputDecoration? searchBoxDecoration,
Expand All @@ -165,6 +170,7 @@ abstract class CountrySelectorNavigator {
double flagSize,
bool sortCountries,
String? noResultMessage,
Color? backgroundColor,
bool searchAutofocus,
TextStyle? subtitleStyle,
TextStyle? titleStyle,
Expand Down Expand Up @@ -197,13 +203,15 @@ class DialogNavigator extends CountrySelectorNavigator {
super.searchBoxTextStyle,
super.searchBoxIconColor,
super.scrollPhysics,
super.backgroundColor,
});

@override
Future<IsoCode?> show(BuildContext context) {
return showDialog(
context: context,
builder: (_) => Dialog(
backgroundColor: backgroundColor,
child: SizedBox(
width: width,
height: height,
Expand Down Expand Up @@ -296,6 +304,7 @@ class BottomSheetNavigator extends CountrySelectorNavigator {
super.searchBoxTextStyle,
super.searchBoxIconColor,
super.scrollPhysics,
super.backgroundColor,
});

@override
Expand All @@ -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)),
Expand Down Expand Up @@ -341,13 +351,15 @@ class ModalBottomSheetNavigator extends CountrySelectorNavigator {
super.searchBoxTextStyle,
super.searchBoxIconColor,
super.scrollPhysics,
super.backgroundColor,
});

@override
Future<IsoCode?> show(
BuildContext context,
) {
return showModalBottomSheet<IsoCode>(
backgroundColor: backgroundColor,
context: context,
builder: (_) => SizedBox(
height: height ?? MediaQuery.of(context).size.height - 90,
Expand Down Expand Up @@ -387,6 +399,7 @@ class DraggableModalBottomSheetNavigator extends CountrySelectorNavigator {
super.searchBoxTextStyle,
super.searchBoxIconColor,
super.scrollPhysics,
super.backgroundColor,
bool useRootNavigator = true,
});

Expand All @@ -399,6 +412,7 @@ class DraggableModalBottomSheetNavigator extends CountrySelectorNavigator {
);

return showModalBottomSheet<IsoCode>(
backgroundColor: backgroundColor,
context: context,
shape: RoundedRectangleBorder(
borderRadius: effectiveBorderRadius,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 20983d8

Please sign in to comment.