Mercurial > public > lazybear
changeset 245:14f2f6ea69f8
Fix bug PlainButtonStyle
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sun, 07 Mar 2021 12:45:53 +0100 |
parents | 724916624385 |
children | 35be981ccb31 |
files | LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate LazyBear/UI/InsiderSum.swift LazyBear/UI/InsiderTrans.swift LazyBear/UI/NewsRow.swift LazyBear/UI/TransRow.swift |
diffstat | 5 files changed, 18 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/LazyBear/UI/InsiderSum.swift Sun Mar 07 11:25:42 2021 +0100 +++ b/LazyBear/UI/InsiderSum.swift Sun Mar 07 12:45:53 2021 +0100 @@ -23,7 +23,7 @@ .renderingMode(.original) .imageScale(.large) - Text("Top 10 insiders") + Text("Top insiders") .font(.title2) .fontWeight(.semibold) @@ -56,16 +56,20 @@ request(url: getUrl(), model: [TopInsiderModel].self) { topInsiders in let theme = userSettings.first?.theme?.lowercased() ?? "default" // Loop over the response + var insiderNumber = 0 for insider in topInsiders { - if let net = insider.position { - let index = topInsiders.firstIndex(of: insider) // Get number (indice) of the item in the list - let rowNumber = index! % 5 // Get row color name - let color = Color("\(theme)Row\(rowNumber)") // Define color - let label = LocalizedStringKey(insider.entityName.capitalized) // Define label - let legend = Legend(color: color, label: label) // Define legend SwiftUICharts - let dataPoint = DataPoint(value: Double(net), label: LocalizedStringKey(String(net)), legend: legend) - - dataPoints.append(dataPoint) + insiderNumber += 1 + if insiderNumber < 5 { + if let net = insider.position { + let index = topInsiders.firstIndex(of: insider) // Get number (indice) of the item in the list + let rowNumber = index! % 5 // Get row color name + let color = Color("\(theme)Row\(rowNumber)") // Define color + let label = LocalizedStringKey(insider.entityName.capitalized) // Define label + let legend = Legend(color: color, label: label) // Define legend SwiftUICharts + let dataPoint = DataPoint(value: Double(net), label: LocalizedStringKey(String(net)), legend: legend) + + dataPoints.append(dataPoint) + } } } }
--- a/LazyBear/UI/InsiderTrans.swift Sun Mar 07 11:25:42 2021 +0100 +++ b/LazyBear/UI/InsiderTrans.swift Sun Mar 07 12:45:53 2021 +0100 @@ -29,8 +29,6 @@ .padding(.horizontal) } - Divider() - ForEach(transactions.reversed(), id: \.self) { trans in TransRow(transaction: trans) .padding(.horizontal)
--- a/LazyBear/UI/NewsRow.swift Sun Mar 07 11:25:42 2021 +0100 +++ b/LazyBear/UI/NewsRow.swift Sun Mar 07 12:45:53 2021 +0100 @@ -10,6 +10,7 @@ struct NewsRow: View { var new: NewsModel @State var showingDetail = false + @Environment(\.colorScheme) var colorScheme // Detect dark mode var body: some View { @@ -46,7 +47,7 @@ } } } - .buttonStyle(PlainButtonStyle()) + .foregroundColor(colorScheme == .dark ? .white: .black) .padding(.horizontal) .sheet(isPresented: $showingDetail) { DetailNew(new: new)
--- a/LazyBear/UI/TransRow.swift Sun Mar 07 11:25:42 2021 +0100 +++ b/LazyBear/UI/TransRow.swift Sun Mar 07 12:45:53 2021 +0100 @@ -10,6 +10,7 @@ struct TransRow: View { var transaction: InsiderTranModel @State private var showingDetail = false + @Environment(\.colorScheme) var colorScheme // Detect dark mode var body: some View { Button(action: { self.showingDetail = true }) { @@ -31,7 +32,7 @@ } } } - .buttonStyle(PlainButtonStyle()) + .foregroundColor(colorScheme == .dark ? .white: .black) .sheet(isPresented: $showingDetail) { TranDetail(transaction: transaction) }