Improve appearance of settings views between platforms

This commit is contained in:
Angelo Stavrow 2020-08-10 14:30:23 -04:00
parent 8f9d1746fb
commit 35f4762b35
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
4 changed files with 33 additions and 9 deletions

View File

@ -16,17 +16,40 @@ struct AccountLoginView: View {
HStack {
Image(systemName: "person.circle")
.foregroundColor(.gray)
#if os(iOS)
TextField("Username", text: $username)
.keyboardType(.emailAddress)
.autocapitalization(.none)
.disableAutocorrection(true)
.textFieldStyle(RoundedBorderTextFieldStyle())
#else
TextField("Username", text: $username)
#endif
}
HStack {
Image(systemName: "lock.circle")
.foregroundColor(.gray)
#if os(iOS)
SecureField("Password", text: $password)
.autocapitalization(.none)
.disableAutocorrection(true)
.textFieldStyle(RoundedBorderTextFieldStyle())
#else
SecureField("Password", text: $password)
#endif
}
HStack {
Image(systemName: "link.circle")
.foregroundColor(.gray)
#if os(iOS)
TextField("Server URL", text: $server)
.keyboardType(.URL)
.autocapitalization(.none)
.disableAutocorrection(true)
.textFieldStyle(RoundedBorderTextFieldStyle())
#else
TextField("Server URL", text: $server)
#endif
}
Spacer()
if isLoggingIn {

View File

@ -7,7 +7,11 @@ struct AccountView: View {
var body: some View {
if isLoggedIn {
AccountLogoutView(accountModel: $accountModel, isLoggedIn: $isLoggedIn, isLoggingIn: $isLoggingIn)
HStack {
Spacer()
AccountLogoutView(accountModel: $accountModel, isLoggedIn: $isLoggedIn, isLoggingIn: $isLoggingIn)
Spacer()
}
} else {
AccountLoginView(accountModel: $accountModel, isLoggedIn: $isLoggedIn, isLoggingIn: $isLoggingIn)
}

View File

@ -12,12 +12,11 @@ struct PreferencesView: View {
}
.pickerStyle(SegmentedPickerStyle())
#elseif os(macOS)
Picker(selection: $appearance, label: EmptyView()) {
Picker(selection: $appearance, label: Text("Appearance")) {
Text("System").tag(0)
Text("Light Mode").tag(1)
Text("Dark Mode").tag(2)
}
.pickerStyle(RadioGroupPickerStyle())
#endif
}
}

View File

@ -6,7 +6,7 @@ struct SettingsView: View {
var body: some View {
TabView(selection: $selectedView) {
Form {
Section(header: Text("Log in to your account")) {
Section(header: Text("Login Details")) {
AccountView()
}
}
@ -15,11 +15,9 @@ struct SettingsView: View {
Text("Account")
}
.tag(0)
Form {
Section(header: Text("Appearance")) {
PreferencesView()
Spacer()
}
VStack {
PreferencesView()
Spacer()
}
.tabItem {
Image(systemName: "gear")