Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PartialCustomTabsConfiguration to allow nullable activityHeightResizeBehavior #206

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ extension PartialCustomTabsConfigurationConverter
Map<String, Object> toMessage() {
return {
'initialHeight': initialHeight,
'activityHeightResizeBehavior': activityHeightResizeBehavior.rawValue,
if (activityHeightResizeBehavior != null)
'activityHeightResizeBehavior': activityHeightResizeBehavior!.rawValue,
if (cornerRadius != null) 'cornerRadius': min(cornerRadius!, 16)
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import 'package:meta/meta.dart';
class PartialCustomTabsConfiguration {
const PartialCustomTabsConfiguration({
required this.initialHeight,
this.activityHeightResizeBehavior =
CustomTabsActivityHeightResizeBehavior.defaultBehavior,
this.activityHeightResizeBehavior,
this.cornerRadius,
});

Expand All @@ -16,7 +15,7 @@ class PartialCustomTabsConfiguration {
final double initialHeight;

/// The Custom Tab Activity's desired resize behavior.
final CustomTabsActivityHeightResizeBehavior activityHeightResizeBehavior;
final CustomTabsActivityHeightResizeBehavior? activityHeightResizeBehavior;

/// The toolbar's top corner radius.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import 'package:flutter_test/flutter_test.dart';

void main() {
group('PartialCustomTabsConfiguration', () {
test('toMessage() returns expected message with default values', () {
test('toMessage() returns expected message with minimum values', () {
const configuration = PartialCustomTabsConfiguration(
initialHeight: 200,
);
final actual = configuration.toMessage();
expect(actual, <String, Object>{
'initialHeight': configuration.initialHeight,
'activityHeightResizeBehavior':
configuration.activityHeightResizeBehavior.rawValue,
});
});

Expand All @@ -29,7 +27,7 @@ void main() {
expect(actual, <String, Object?>{
'initialHeight': configuration.initialHeight,
'activityHeightResizeBehavior':
configuration.activityHeightResizeBehavior.rawValue,
configuration.activityHeightResizeBehavior!.rawValue,
'cornerRadius': configuration.cornerRadius,
});
});
Expand Down