Skip to content

Commit

Permalink
make edit downloaded languages button float to bottom of scroll view
Browse files Browse the repository at this point in the history
  • Loading branch information
rachaelblue committed Feb 1, 2024
1 parent 1dd6e1f commit 6ab7386
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class GetDownloadedLanguagesListRepository: GetDownloadedLanguagesListRepository
return DownloadedLanguageListItemDomainModel(
languageId: language.id,
languageCode: language.code,
languageNameInOwnLanguage: languageNameInAppLanguage,
languageNameInOwnLanguage: languageNameInOwnLanguage,
languageNameInAppLanguage: languageNameInAppLanguage
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,15 @@ struct ToolLanguageAvailableOfflineLanguageView: View {

VStack(alignment: .leading, spacing: 0) {

HStack(alignment: .center, spacing: 0) {
HStack(alignment: .center, spacing: 11) {

HStack(alignment: .center, spacing: 11) {

Text(downloadedLanguage.languageNameInOwnLanguage)
.font(FontLibrary.sfProTextRegular.font(size: 17))
.foregroundColor(ColorPalette.gtGrey.color)
.multilineTextAlignment(.leading)

Text(downloadedLanguage.languageNameInAppLanguage)
.font(FontLibrary.sfProTextRegular.font(size: 17))
.foregroundColor(Color.getColorWithRGB(red: 151, green: 151, blue: 151, opacity: 1))
.multilineTextAlignment(.leading)
}

Spacer()
Text(downloadedLanguage.languageNameInOwnLanguage)
.font(FontLibrary.sfProTextRegular.font(size: 17))
.foregroundColor(ColorPalette.gtGrey.color)
.multilineTextAlignment(.leading)

Text("108.3 MB")
.font(FontLibrary.sfProTextRegular.font(size: 14))
Text(downloadedLanguage.languageNameInAppLanguage)
.font(FontLibrary.sfProTextRegular.font(size: 17))
.foregroundColor(Color.getColorWithRGB(red: 151, green: 151, blue: 151, opacity: 1))
.multilineTextAlignment(.leading)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,40 @@ struct ToolLanguagesAvailableOfflineView: View {
SeparatorView()
.padding([.top], 11)

ScrollView(.vertical, showsIndicators: true) {
GeometryReader { scrollViewGeometry in

VStack(alignment: .leading, spacing: 0) {
let buttonHeight: CGFloat = 50
let spaceBelowScrollView: CGFloat = 25
let scrollViewMaxHeight: CGFloat = scrollViewGeometry.size.height - buttonHeight - spaceBelowScrollView

VStack(alignment: .leading, spacing: spaceBelowScrollView) {

ForEach(viewModel.downloadedLanguages) { downloadedLanguage in
ScrollView(.vertical, showsIndicators: true) {

ToolLanguageAvailableOfflineLanguageView(downloadedLanguage: downloadedLanguage)
VStack(alignment: .leading, spacing: 0) {

ForEach(viewModel.downloadedLanguages) { downloadedLanguage in

ToolLanguageAvailableOfflineLanguageView(downloadedLanguage: downloadedLanguage)
}
}
}
.frame(maxHeight: scrollViewMaxHeight)
.fixedSize(horizontal: false, vertical: true)

GTBlueButton(
title: viewModel.editDownloadedLanguagesButtonTitle,
font: FontLibrary.sfProTextRegular.font(size: 14),
width: geometry.size.width - (contentHorizontalInsets * 2),
height: buttonHeight,
action: {

viewModel.editDownloadedLanguagesTapped()
}
)
}
}

GTBlueButton(
title: viewModel.editDownloadedLanguagesButtonTitle,
font: FontLibrary.sfProTextRegular.font(size: 14),
width: geometry.size.width - (contentHorizontalInsets * 2),
height: 50,
action: {

viewModel.editDownloadedLanguagesTapped()
}
)
.padding([.top], 25)
}
.padding([.leading, .trailing], contentHorizontalInsets)
}
Expand Down

0 comments on commit 6ab7386

Please sign in to comment.