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

Fix/style/layout responsiveness/set up #93

Closed
wants to merge 2 commits into from

Conversation

francelu
Copy link
Contributor

@francelu francelu commented Oct 30, 2024

Set Up Responsive Dimensions and Typography for All Screens

Description

This PR establishes a foundation for responsive design by setting up scalable dimensions and typography that adapt to different screen sizes. This setup allows screens to adjust automatically, ensuring consistency across devices. Subtask from #82.

Changes

  • Defined responsive dimensions and typography settings.
  • Established scalable padding, font sizes, and layout parameters according to screen size for use across all screens.

Files

Added

  • To be determined.

Dependencies Added

  • androidx.compose.material3:material3-window-size-class:1.3.0 for window size class handling to support responsive layouts.

Testing

  • Verified that dimensions and typography scale correctly across various screen sizes without issues on existing screens.

Screenshots (if applicable)

Include examples of the scalable elements in action if needed.

@francelu francelu linked an issue Oct 30, 2024 that may be closed by this pull request
2 tasks
@francelu francelu marked this pull request as draft October 30, 2024 10:14
@francelu francelu changed the title Fix/style/layout-responsiveness/sign-in Fix/style/layout responsiveness/sign in Oct 30, 2024
@francelu francelu added the enhancement New feature or request label Oct 30, 2024
@francelu francelu marked this pull request as ready for review October 30, 2024 10:45
Copy link
Contributor

@charliemangano charliemangano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Nice work on this! I tested it on my own device (pup-up window to resize) and it works seamlessly on most window sizes, with some exceptions.
I noticed you used LazyColumns instead of normal Columns, more on this in code comment.

Important

Code Quality

The code is generally unchanged, with modifications made to the padding values and Column changes to LazyColumn. Out of the scope of this issue but we'll need to clean it up a bit.

I believe padding management should be relegated to the Theme.kt, where you put default values for XS to XL-size padding and apply them everywhere. This 9min video explains it pretty well, but sadly it does not go Jetpack Compose into implementation detail.
This would make it easier to standardize across screens as well, so I think any work you'd put into it now is time gained later on.

Functionality

Because the emulator doesn't work on my device, I ran the app directly on my phone and used the pop-up and split-screen view to try and resize it. It works very well on all full-width sized windows (where it touches both left and right borders), but when resizing it with small width, the layout is still shaky:
At ~3/4 of normal width:
3/4 width layout bug
At ~1/2 of normal witdh:
1/2 width layout bug
For reference, my device screen size is a Samsung A32 (size: 6.4 inches, resolution: 1080 x 2400 pixels, ratio: 20:9).

Testing

All UI tests still pass

Documentation

Not applicable (not the scope of this issue but will need reworking)

Suggestions

I believe either setting a minimum width for the app or having dynamically resized text would solve the layout issue with small widths, but I have not done any further research on the subject.

Steps before PR approved

  • Fix layout with small widths
  • Standardize padding using Theme.kt

@@ -79,124 +80,132 @@ fun SignInScreen(authViewModel: AuthViewModel, navigationActions: NavigationActi
// Purple-ish background
GradedBackground(Purple80, Pink40, PurpleGrey80, "signInBackground")

Column(
modifier = Modifier.fillMaxSize().padding(padding).padding(60.dp),
LazyColumn(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use LazyColumns and not just use Modifier.verticalScroll(rememberScrollState()) instead?
From what I understand, LazyColumns are most useful when there are a lot of elements on the page and we don't want to load all of them if they're not displayed.

@francelu francelu marked this pull request as draft October 30, 2024 13:16
@francelu
Copy link
Contributor Author

@charliemangano
I've found a great video "The Ultimate guide to supporting all screen sizes in Jetpack Compose using Material 3 design" on YouTube.
However, then I would have to also change all the typography. We should choose a font too.

@charliemangano
Copy link
Contributor

@francelu there is already a default font defined in Type.kt. I believe we can use that one until we work on a more precise theme

@francelu francelu changed the title Fix/style/layout responsiveness/sign in Fix/style/layout responsiveness/set up Oct 31, 2024
@francelu francelu mentioned this pull request Oct 31, 2024
16 tasks
@francelu francelu closed this Oct 31, 2024
@francelu francelu deleted the fix/style/layout-responsiveness/sign-in branch October 31, 2024 12:48
@francelu francelu linked an issue Nov 4, 2024 that may be closed by this pull request
2 tasks
@francelu francelu linked an issue Nov 4, 2024 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants