Restore marketplace - #229
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restores/introduces a “marketplace”-style section on the Settings screen by adding horizontally scrollable Premium and Donate widgets, including helper logic to auto-scroll the slider so a tapped card is brought into view before executing its action.
Changes:
- Added Premium/Donate widgets to
SettingsScreenvia a new horizontal slider section. - Introduced horizontal
ScrollControllerplus visibility/auto-scroll helpers to support “tap to reveal then act”. - Adjusted vertical spacing around the header/settings content to accommodate the new section.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+100
to
+120
| final size = renderBox.size; | ||
| final offset = renderBox.localToGlobal(Offset.zero); | ||
|
|
||
| // Get the scroll position | ||
| final scrollOffset = _horizontalSliderScrollController.offset; | ||
|
|
||
| // The widget's center in content coordinates | ||
| final widgetCenterInContent = offset.dx + scrollOffset + (size.width / 2); | ||
|
|
||
| // Get the viewport bounds | ||
| final viewportLeft = scrollOffset; | ||
| final viewportRight = | ||
| scrollOffset + | ||
| _horizontalSliderScrollController.position.viewportDimension; | ||
|
|
||
| // Check if widget's CENTER is within viewport (more lenient, allows partial visibility) | ||
| final isVisible = | ||
| widgetCenterInContent >= viewportLeft && | ||
| widgetCenterInContent <= viewportRight; | ||
|
|
||
| return isVisible; |
Comment on lines
+276
to
+296
| final size = renderBox.size; | ||
| final offset = renderBox.localToGlobal(Offset.zero); | ||
| final scrollOffset = _horizontalSliderScrollController.offset; | ||
| final viewportWidth = | ||
| _horizontalSliderScrollController.position.viewportDimension; | ||
|
|
||
| // Widget's position in content coordinates | ||
| final widgetLeftInContent = offset.dx + scrollOffset; | ||
| final widgetCenterInContent = widgetLeftInContent + (size.width / 2); | ||
|
|
||
| // Calculate scroll offset to center the widget | ||
| final newScrollOffset = widgetCenterInContent - (viewportWidth / 2); | ||
|
|
||
| _horizontalSliderScrollController.animateTo( | ||
| newScrollOffset.clamp( | ||
| _horizontalSliderScrollController.position.minScrollExtent, | ||
| _horizontalSliderScrollController.position.maxScrollExtent, | ||
| ), | ||
| duration: const Duration(milliseconds: 300), | ||
| curve: Curves.easeInOut, | ||
| ); |
Comment on lines
+321
to
+327
| return Listener( | ||
| onPointerMove: (event) {}, | ||
| onPointerSignal: (event) {}, | ||
| child: NotificationListener<ScrollUpdateNotification>( | ||
| onNotification: (notification) { | ||
| return false; | ||
| }, |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Change Description
Briefly describe what this PR does and why. Keep it short and clear.
Related Platforms
Verification Checklist
Optional (for bigger changes)
Related Links
Closes #ID.