add app icon, starting to do card views
This commit is contained in:
parent
63eacbb378
commit
d7c99b5ac5
BIN
Gastrack_icon.png
Normal file
BIN
Gastrack_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
BIN
Gastrack_icon.pxd
Normal file
BIN
Gastrack_icon.pxd
Normal file
Binary file not shown.
BIN
Gastrack_icon_bw.png
Normal file
BIN
Gastrack_icon_bw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
Gastrack_icon_transparent.png
Normal file
BIN
Gastrack_icon_transparent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@ -1,6 +1,7 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Gastrack_icon.png",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
@ -12,6 +13,7 @@
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"filename" : "Gastrack_icon_transparent.png",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
@ -23,6 +25,7 @@
|
||||
"value" : "tinted"
|
||||
}
|
||||
],
|
||||
"filename" : "Gastrack_icon_bw.png",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
|
BIN
gastrack/Assets.xcassets/AppIcon.appiconset/Gastrack_icon.png
Normal file
BIN
gastrack/Assets.xcassets/AppIcon.appiconset/Gastrack_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
BIN
gastrack/Assets.xcassets/AppIcon.appiconset/Gastrack_icon_bw.png
Normal file
BIN
gastrack/Assets.xcassets/AppIcon.appiconset/Gastrack_icon_bw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@ -16,9 +16,9 @@ struct ContentView: View {
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView {
|
||||
List {
|
||||
ScrollView {
|
||||
ForEach(entries) { e in
|
||||
Text("Entry: \(e.odo)")
|
||||
EntryCardView(entry: e)
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $addEntry) {
|
||||
@ -28,14 +28,16 @@ struct ContentView: View {
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .bottomBar) {
|
||||
Text("")
|
||||
Button(action: addItem) {
|
||||
Label("Add Item", systemImage: "plus.circle.fill")
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .status) {
|
||||
Text("Placeholder")
|
||||
.frame(alignment: .center)
|
||||
}
|
||||
ToolbarItem(placement: .bottomBar) {
|
||||
Button(action: addItem) {
|
||||
Button(action: { addEntry.toggle() }) {
|
||||
Label("Add Item", systemImage: "plus")
|
||||
}
|
||||
}
|
||||
@ -46,12 +48,11 @@ struct ContentView: View {
|
||||
}
|
||||
|
||||
private func addItem() {
|
||||
addEntry.toggle()
|
||||
// withAnimation {
|
||||
// let newItem = Entry(odo: 75239, cost: 92.19, quantity: 36.34, fuelType: "91")
|
||||
// modelContext.insert(newItem)
|
||||
// try? modelContext.save()
|
||||
// }
|
||||
withAnimation {
|
||||
let newItem = Entry(odo: 75239, cost: 92.19, quantity: 36.34, fuelType: "91")
|
||||
modelContext.insert(newItem)
|
||||
try? modelContext.save()
|
||||
}
|
||||
}
|
||||
|
||||
private func deleteItems(offsets: IndexSet) {
|
||||
|
@ -12,16 +12,22 @@ import SwiftData
|
||||
final class Entry {
|
||||
var id: UUID
|
||||
|
||||
var date: Date
|
||||
var odo: Int
|
||||
var cost: Double
|
||||
var quantity: Double
|
||||
var fuelType: String
|
||||
|
||||
public init(odo: Int, cost: Double, quantity: Double, fuelType: String) {
|
||||
public init(date: Date = Date(), odo: Int, cost: Double, quantity: Double, fuelType: String) {
|
||||
self.id = UUID()
|
||||
self.date = date
|
||||
self.odo = odo
|
||||
self.cost = cost
|
||||
self.quantity = quantity
|
||||
self.fuelType = fuelType
|
||||
}
|
||||
|
||||
public func getFormattedDate() -> String {
|
||||
return self.date.formatted(date: .numeric, time: .omitted)
|
||||
}
|
||||
}
|
||||
|
34
gastrack/EntryCardView.swift
Normal file
34
gastrack/EntryCardView.swift
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// EntryCardView.swift
|
||||
// gastrack
|
||||
//
|
||||
// Created by Pradyun Setti on 24/02/2025.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct EntryCardView: View {
|
||||
let entry: Entry
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
VStack(alignment: .leading) {
|
||||
Text(entry.getFormattedDate())
|
||||
.font(.system(.caption, design: .default, weight: .medium))
|
||||
Text(String(format: "$%.2f", entry.cost))
|
||||
.font(.system(.headline, design: .default, weight: .bold))
|
||||
.foregroundStyle(.green)
|
||||
Text(String(format: "%.3f L", entry.quantity))
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
.background(Color.secondary.opacity(0.3))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 12))
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
|
||||
//#Preview {
|
||||
// EntryCardView()
|
||||
//}
|
Loading…
x
Reference in New Issue
Block a user