//
|
// TitleBarView.swift
|
// aones
|
//
|
// Created by 倪路朋 on 2/16/23.
|
//
|
|
import SwiftUI
|
|
struct TitleBarView: View {
|
|
@Environment(\.presentationMode) var presentationMode
|
|
var title = ""
|
var iconBack = Icons.BACK;
|
var imgRight = "";
|
var titleColor = Color.colorText
|
|
var body: some View {
|
|
HStack(spacing: 0){
|
Spacer().frame(width: 16)
|
Button(action: {
|
print("Click back button")
|
self.presentationMode.wrappedValue.dismiss()
|
}) {
|
Image(systemName: iconBack.name)
|
.resizable()
|
.frame(width: iconBack.size.width, height: iconBack.size.height)
|
.aspectRatio(contentMode: .fit)
|
.foregroundColor(Color.white)
|
}
|
Spacer()
|
Text(title).foregroundColor(titleColor)
|
.bold().font(Font.system(size: 16))
|
Spacer()
|
Image(imgRight).frame(width: 28,height: 28)
|
Spacer().frame(width: 16)
|
}.frame(height: 48)
|
}
|
}
|
|
struct TitleBarView_Previews: PreviewProvider {
|
static var previews: some View {
|
TitleBarView(title: "标题")
|
}
|
}
|