@@ -77,6 +77,25 @@ class _DialogContentsState extends ConsumerState<DialogContents> {
7777 return sduiCode['STAC' ].toString ();
7878 }
7979
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+
8099 @override
81100 Widget build (BuildContext context) {
82101 return IndexedStack (
@@ -98,24 +117,19 @@ class _DialogContentsState extends ConsumerState<DialogContents> {
98117 child: Center (
99118 child: Padding (
100119 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 ,
112125 ),
113126 ),
114127 ),
115128 ),
116129 ),
117130 SDUIPreviewPage (
118- onNext: () {},
131+ key: ValueKey (generatedSDUI.hashCode),
132+ onModificationRequestMade: modifySDUICode,
119133 sduiCode: generatedSDUI,
120134 )
121135 ],
@@ -241,16 +255,20 @@ class _FrameWorkSelectorPageState extends State<FrameWorkSelectorPage> {
241255
242256class SDUIPreviewPage extends ConsumerStatefulWidget {
243257 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+ });
247264
248265 @override
249266 ConsumerState <SDUIPreviewPage > createState () => _SDUIPreviewPageState ();
250267}
251268
252269class _SDUIPreviewPageState extends ConsumerState <SDUIPreviewPage > {
253270 bool exportingCode = false ;
271+ String modificationRequest = "" ;
254272
255273 @override
256274 Widget build (BuildContext context) {
@@ -296,6 +314,11 @@ class _SDUIPreviewPageState extends ConsumerState<SDUIPreviewPage> {
296314 ),
297315 ),
298316 child: TextField (
317+ onChanged: (z) {
318+ setState (() {
319+ modificationRequest = z;
320+ });
321+ },
299322 maxLines: 3 , // Makes the text box taller
300323 style: TextStyle (color: Colors .white), // White text
301324 decoration: InputDecoration (
@@ -364,7 +387,9 @@ class _SDUIPreviewPageState extends ConsumerState<SDUIPreviewPage> {
364387 minimumSize: const Size (44 , 44 ),
365388 ),
366389 onPressed: () {
367- widget.onNext ();
390+ if (modificationRequest.isNotEmpty) {
391+ widget.onModificationRequestMade (modificationRequest);
392+ }
368393 },
369394 icon: Icon (
370395 Icons .generating_tokens,
0 commit comments