@@ -77,6 +77,25 @@ class _DialogContentsState extends ConsumerState<DialogContents> {
77
77
return sduiCode['STAC' ].toString ();
78
78
}
79
79
80
+ Future <void > modifySDUICode (String modificationRequest) async {
81
+ setState (() {
82
+ index = 1 ; //Induce Loading
83
+ });
84
+ final res = await APIDashAgentCaller .instance.stacModifer (
85
+ ref,
86
+ input: AgentInputs (variables: {
87
+ 'VAR_CODE' : generatedSDUI,
88
+ 'VAR_CLIENT_REQUEST' : modificationRequest,
89
+ }),
90
+ );
91
+
92
+ final SDUI = res['STAC' ];
93
+ setState (() {
94
+ generatedSDUI = SDUI ;
95
+ index = 2 ;
96
+ });
97
+ }
98
+
80
99
@override
81
100
Widget build (BuildContext context) {
82
101
return IndexedStack (
@@ -98,24 +117,19 @@ class _DialogContentsState extends ConsumerState<DialogContents> {
98
117
child: Center (
99
118
child: Padding (
100
119
padding: const EdgeInsets .only (top: 40.0 ),
101
- child: GestureDetector (
102
- onTap: () {
103
- // setState(() {
104
- // index = 2;
105
- // });
106
- },
107
- child: Container (
108
- height: 500 ,
109
- child: SendingWidget (
110
- startSendingTime: DateTime .now (),
111
- ),
120
+ child: Container (
121
+ height: 500 ,
122
+ child: SendingWidget (
123
+ startSendingTime: DateTime .now (),
124
+ showTimeElapsed: false ,
112
125
),
113
126
),
114
127
),
115
128
),
116
129
),
117
130
SDUIPreviewPage (
118
- onNext: () {},
131
+ key: ValueKey (generatedSDUI.hashCode),
132
+ onModificationRequestMade: modifySDUICode,
119
133
sduiCode: generatedSDUI,
120
134
)
121
135
],
@@ -241,16 +255,20 @@ class _FrameWorkSelectorPageState extends State<FrameWorkSelectorPage> {
241
255
242
256
class SDUIPreviewPage extends ConsumerStatefulWidget {
243
257
final String sduiCode;
244
- final Function () onNext;
245
- const SDUIPreviewPage (
246
- {super .key, required this .onNext, required this .sduiCode});
258
+ final Function (String ) onModificationRequestMade;
259
+ const SDUIPreviewPage ({
260
+ super .key,
261
+ required this .onModificationRequestMade,
262
+ required this .sduiCode,
263
+ });
247
264
248
265
@override
249
266
ConsumerState <SDUIPreviewPage > createState () => _SDUIPreviewPageState ();
250
267
}
251
268
252
269
class _SDUIPreviewPageState extends ConsumerState <SDUIPreviewPage > {
253
270
bool exportingCode = false ;
271
+ String modificationRequest = "" ;
254
272
255
273
@override
256
274
Widget build (BuildContext context) {
@@ -296,6 +314,11 @@ class _SDUIPreviewPageState extends ConsumerState<SDUIPreviewPage> {
296
314
),
297
315
),
298
316
child: TextField (
317
+ onChanged: (z) {
318
+ setState (() {
319
+ modificationRequest = z;
320
+ });
321
+ },
299
322
maxLines: 3 , // Makes the text box taller
300
323
style: TextStyle (color: Colors .white), // White text
301
324
decoration: InputDecoration (
@@ -364,7 +387,9 @@ class _SDUIPreviewPageState extends ConsumerState<SDUIPreviewPage> {
364
387
minimumSize: const Size (44 , 44 ),
365
388
),
366
389
onPressed: () {
367
- widget.onNext ();
390
+ if (modificationRequest.isNotEmpty) {
391
+ widget.onModificationRequestMade (modificationRequest);
392
+ }
368
393
},
369
394
icon: Icon (
370
395
Icons .generating_tokens,
0 commit comments