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

[FluentList] Set environment variable for styling so child views can utilize it #2023

Conversation

alexanderboswell
Copy link
Contributor

@alexanderboswell alexanderboswell commented May 17, 2024

Platforms Impacted

  • iOS
  • visionOS
  • macOS

Description of changes

The FluentList and FluentItem are designed to be used together but there will need to be some coordination between them for styling. This is so that the item can be styled to match the type of list.

To achieve this, it seemed to make sense to use an environment variable so the list can set the list style and pass it to any child views that want to use it, like a ListItem view. This way implementors don't need to set a matching style on every ListItem to be the same as the style of the wrapping FluentList. We will be able to also use this value for FluentListSection, FluentListSectionHeader, and FluentListSectionFooter.

If an implementor for some reason still wanted to specify a different style on ListItem, we respect that value over the environment variable.

Updated both the background color and the spacing for the insetGrouped list style.

Binary change

Total increase: 36,016 bytes
Total decrease: 0 bytes

File Before After Delta
Total 30,968,016 bytes 31,004,032 bytes ⚠️ 36,016 bytes
Full breakdown
File Before After Delta
FluentList.o 49,288 bytes 70,896 bytes ⚠️ 21,608 bytes
ListItem.o 319,352 bytes 325,840 bytes ⚠️ 6,488 bytes
__.SYMDEF 4,750,168 bytes 4,756,024 bytes ⚠️ 5,856 bytes
IndeterminateProgressBar.o 231,256 bytes 232,400 bytes ⚠️ 1,144 bytes
FocusRingView.o 831,480 bytes 832,400 bytes ⚠️ 920 bytes

Verification

Visual Verification
Before After
header height and spacing (with a header string, with an empty string, and with no header provided) image image

With .grouped style specified for ListItem

With .plain style specified for ListItem

Pull request checklist

This PR has considered:

  • Light and Dark appearances
  • iOS supported versions (all major versions greater than or equal current target deployment version)
  • VoiceOver and Keyboard Accessibility
  • Internationalization and Right to Left layouts
  • Different resolutions (1x, 2x, 3x)
  • Size classes and window sizes (iPhone vs iPad, notched devices, multitasking, different window sizes, etc)
  • iPad Pointer interaction
  • SwiftUI consumption (validation or new demo scenarios needed)
  • Objective-C exposure (provide it only if needed)
Microsoft Reviewers: Open in CodeFlow

@alexanderboswell alexanderboswell requested a review from a team as a code owner May 17, 2024 16:46
ios/FluentUI/List/ListItem.swift Outdated Show resolved Hide resolved
ios/FluentUI/List/ListItem.swift Show resolved Hide resolved
ios/FluentUI/List/ListItem.swift Outdated Show resolved Hide resolved
@alexanderboswell alexanderboswell enabled auto-merge (squash) May 17, 2024 18:43
@alexanderboswell alexanderboswell merged commit 490d7df into microsoft:main May 17, 2024
7 checks passed
@joannaquu joannaquu mentioned this pull request May 23, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants