-
Couldn't load subscription status.
- Fork 1.5k
Refactor the UI layout of ImagenScreen to solve the navigation flicker #1719
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
Changes from 1 commit
f60ea50
0a3b325
27f2c16
e105b4d
4e96db2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ struct ImagenScreen: View { | |
| var focusedField: FocusedField? | ||
|
|
||
| var body: some View { | ||
| ZStack { | ||
| ScrollView { | ||
| VStack { | ||
| InputField("Enter a prompt to generate an image", text: $viewModel.userInput) { | ||
| Image( | ||
|
|
@@ -44,28 +44,24 @@ struct ImagenScreen: View { | |
| .focused($focusedField, equals: .message) | ||
| .onSubmit { sendOrStop() } | ||
|
|
||
| ScrollView { | ||
| let spacing: CGFloat = 10 | ||
| LazyVGrid(columns: [ | ||
| GridItem(.fixed(UIScreen.main.bounds.width / 2 - spacing), spacing: spacing), | ||
| GridItem(.fixed(UIScreen.main.bounds.width / 2 - spacing), spacing: spacing), | ||
| ], spacing: spacing) { | ||
| ForEach(viewModel.images, id: \.self) { image in | ||
| Image(uiImage: image) | ||
| .resizable() | ||
| .aspectRatio(contentMode: .fill) | ||
| .frame(width: UIScreen.main.bounds.width / 2 - spacing, | ||
| height: UIScreen.main.bounds.width / 2 - spacing) | ||
| .cornerRadius(12) | ||
| .clipped() | ||
| } | ||
| let spacing: CGFloat = 10 | ||
| LazyVGrid(columns: [ | ||
| GridItem(.fixed(UIScreen.main.bounds.width / 2 - spacing), spacing: spacing), | ||
| GridItem(.fixed(UIScreen.main.bounds.width / 2 - spacing), spacing: spacing), | ||
| ], spacing: spacing) { | ||
| ForEach(viewModel.images, id: \.self) { image in | ||
|
||
| Image(uiImage: image) | ||
| .resizable() | ||
| .aspectRatio(contentMode: .fill) | ||
| .frame(width: UIScreen.main.bounds.width / 2 - spacing, | ||
| height: UIScreen.main.bounds.width / 2 - spacing) | ||
YoungHypo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| .cornerRadius(12) | ||
| .clipped() | ||
| } | ||
| .padding(.horizontal, spacing) | ||
| } | ||
| .padding(.horizontal, spacing) | ||
| } | ||
| if viewModel.inProgress { | ||
| ProgressOverlay() | ||
| } | ||
| .overlay(viewModel.inProgress ? ProgressOverlay() : nil) | ||
|
||
| } | ||
| .navigationTitle("Imagen example") | ||
| .onAppear { | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.