Add badge support to TabView and refactor icon rendering#428
Open
vdkdamian wants to merge 3 commits into
Open
Conversation
Move BadgeModifier from List.swift into AdditionalViewModifiers.swift and keep its combined(for:) helper. Add badge support across TabView: import Badge/BadgedBox, add a badge property to TabContent, Tab, and TabSection, propagate badges to section children, and render tab icons inside a BadgedBox when a badge is present. Implement TabContent.badge(...) modifier overloads to set badge values instead of being unavailable, and apply the combined BadgeModifier when building tabs. Remove the duplicate BadgeModifier definition from List.swift.
Rename iconContent to renderIcon and reformat Box initializer for clarity. Import Modifier.offset and apply a small offset (8.dp, -4.dp) to Badge so the badge is positioned correctly over tab icons. Ensure badge content is rendered with a white foregroundStyle for proper contrast. Minor cleanup of render calls to use renderIcon.
|
Thank you for your pull request and welcome to the Skip community. We require contributors to sign our contributor license agreement (CLA), and we don't seem to have the user(s) @vdkdamian on file. In order for us to review and merge your code, for each noted user please add your GitHub username to Skip's .clabot file |
Replace the detailed/partial-support row for `.badge` with a simple supported indicator (✅) in README.md. Removes the expandable details noting limited support on `List` and lack of `TabView` support, simplifying the support table entry.
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.
Thank you for contributing to the Skip project! Please review the contribution guide at https://skip.dev/docs/contributing/ for advice and guidance on making high-quality PRs.
This pull request adds support for tab badges in the
TabViewcomponent, allowing badges to be displayed on tabs and sections. The implementation introduces abadgeproperty to relevant types, provides new badge modifier methods, and updates rendering logic to show badges using Material3 components on Android.Tab badge support:
badgeproperty toTab,TabSection, and theTabContentprotocol, enabling tabs and tab sections to display badge indicators.BadgedBoxandBadgefrom Material3, with proper positioning and styling.Badge modifier improvements:
TabContent, allowing users to easily add badges with different types of content (e.g., count,Text, localized strings). These methods now set thebadgeproperty appropriately.BadgeModifierclass fromList.swifttoAdditionalViewModifiers.swiftfor better organization and code reuse, and removed the old definition.Fixes #251
Skip Pull Request Checklist:
swift testAI was used to help reason about the implementation approach, Compose integration, and architectural consistency with existing SkipUI patterns (such as how List consumes BadgeModifier).
The actual implementation, integration, debugging, and validation were performed manually in Xcode and on-device/emulator builds. I manually verified: