-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add an optional gradient over the sticky action bar #29
Merged
ulusoyca
merged 2 commits into
main
from
issue-27-add-built-in-sticky-action-bar-gradient
Aug 8, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 0 additions & 51 deletions
51
demo_ui_components/lib/src/button/sticky_action_bar_wrapper.dart
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:wolt_modal_sheet/src/modal_page/wolt_modal_sheet_page.dart'; | ||
|
||
/// A widget that wraps the Sticky Action Bar in the [WoltModalSheetPage]. | ||
/// | ||
/// It handles the conditional rendering of the Sticky Action Bar and the | ||
/// gradient overlay above it, based on the configurations provided in the [WoltModalSheetPage]. | ||
class WoltStickyActionBarWrapper extends StatelessWidget { | ||
/// Constructs a `WoltStickyActionBarWrapper`. | ||
/// | ||
/// The [page] argument must not be null. | ||
const WoltStickyActionBarWrapper({required this.page, Key? key}) : super(key: key); | ||
|
||
/// The [WoltModalSheetPage] which provides configuration for the Sticky Action Bar | ||
/// and potentially its gradient overlay. | ||
final WoltModalSheetPage page; | ||
|
||
@visibleForTesting | ||
static const gradientWidgetKey = ValueKey("WoltStickyActionBarWrapperGradient"); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
// Fetch the sticky action bar from the provided page | ||
final stickyActionBar = page.stickyActionBar; | ||
|
||
// If there's no action bar provided, render nothing. | ||
if (stickyActionBar == null) { | ||
return const SizedBox.shrink(); | ||
} | ||
|
||
// The background color for the sticky action bar and potentially its gradient overlay. | ||
final backgroundColor = page.backgroundColor; | ||
|
||
// Render a Column widget containing the sticky action bar | ||
// and its gradient overlay if needed. | ||
return Column( | ||
children: [ | ||
// If a gradient is required, add a Container with a linear gradient decoration. | ||
if (page.hasSabGradient) | ||
Container( | ||
key: gradientWidgetKey, | ||
/// TODO(ulusoyca): get the gradient height value from the theme extensions | ||
height: 24.0, | ||
width: double.infinity, | ||
decoration: BoxDecoration( | ||
gradient: LinearGradient( | ||
begin: Alignment.bottomCenter, | ||
end: Alignment.topCenter, | ||
colors: [ | ||
backgroundColor, | ||
backgroundColor.withOpacity(0), | ||
], | ||
), | ||
), | ||
), | ||
// Render the sticky action bar with its background color. | ||
ColoredBox(color: backgroundColor, child: stickyActionBar), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point we could make this even customisable, so that the user can pass in its own gradient. That way the user can use any gradient form and color