@@ -8,6 +8,7 @@ struct CalculatorWidgetPreviewView: View {
88
99 // TODO: revert to 0 to re-enable the compact widget preview
1010 @State private var carouselPage : Int = 1
11+ @State private var previewActiveInput : CalculatorMoneyType ?
1112 @State private var showDeleteAlert = false
1213 @State private var values = CalculatorWidgetValues ( )
1314
@@ -60,6 +61,9 @@ struct CalculatorWidgetPreviewView: View {
6061 . onChange ( of: currency. rates) {
6162 hydrateValues ( )
6263 }
64+ . onDisappear {
65+ previewActiveInput = nil
66+ }
6367 . alert (
6468 t ( " widgets__delete__title " ) ,
6569 isPresented: $showDeleteAlert,
@@ -96,11 +100,15 @@ struct CalculatorWidgetPreviewView: View {
96100 private var widePage : some View {
97101 VStack {
98102 Spacer ( minLength: 0 )
99- CalculatorWidgetWideContent ( values: values)
100- . padding ( 16 )
101- . background ( Color . gray6)
102- . cornerRadius ( 16 )
103- . frame ( maxWidth: . infinity)
103+ CalculatorWidgetWideContent (
104+ values: values,
105+ activeInput: previewActiveInput,
106+ onSelectInput: selectInput
107+ )
108+ . padding ( 16 )
109+ . background ( Color . gray6)
110+ . cornerRadius ( 16 )
111+ . frame ( maxWidth: . infinity)
104112 Spacer ( minLength: 0 )
105113 }
106114 }
@@ -192,6 +200,10 @@ struct CalculatorWidgetPreviewView: View {
192200 return CalculatorWidgetFormatter . fiatRawValue ( from: converted. value)
193201 }
194202
203+ private func selectInput( _ input: CalculatorMoneyType ) {
204+ previewActiveInput = input
205+ }
206+
195207 private func onSave( ) {
196208 widgets. saveWidget ( widgetType)
197209 navigation. reset ( )
0 commit comments