@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
22import 'package:flutter_riverpod/flutter_riverpod.dart' ;
33import 'package:file_picker/file_picker.dart' ;
44import 'package:go_router/go_router.dart' ;
5- import '../../../quest/domain/models/quest_models.dart' ;
65import '../../../quest/application/providers/quest_provider.dart' ;
76
87/// Quest upload screen - upload files and start quest
@@ -41,9 +40,9 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
4140 }
4241 } catch (e) {
4342 if (mounted) {
44- ScaffoldMessenger .of (context). showSnackBar (
45- SnackBar (content : Text ( 'Error picking files: $ e ' )) ,
46- );
43+ ScaffoldMessenger .of (
44+ context ,
45+ ). showSnackBar ( SnackBar (content : Text ( 'Error picking files: $ e ' ))) ;
4746 }
4847 }
4948 }
@@ -67,9 +66,7 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
6766 // Upload files if selected
6867 for (final file in _selectedFiles) {
6968 if (file.path != null ) {
70- await ref.read (
71- uploadFileProvider ((quest.id, file.path! )).future,
72- );
69+ await ref.read (uploadFileProvider ((quest.id, file.path! )).future);
7370 }
7471 }
7572
@@ -79,9 +76,9 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
7976 }
8077 } catch (e) {
8178 if (mounted) {
82- ScaffoldMessenger .of (context). showSnackBar (
83- SnackBar (content : Text ( 'Error creating quest: $ e ' )) ,
84- );
79+ ScaffoldMessenger .of (
80+ context ,
81+ ). showSnackBar ( SnackBar (content : Text ( 'Error creating quest: $ e ' ))) ;
8582 }
8683 } finally {
8784 setState (() => _isLoading = false );
@@ -91,10 +88,7 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
9188 @override
9289 Widget build (BuildContext context) {
9390 return Scaffold (
94- appBar: AppBar (
95- title: const Text ('New Quest' ),
96- centerTitle: true ,
97- ),
91+ appBar: AppBar (title: const Text ('New Quest' ), centerTitle: true ),
9892 body: SingleChildScrollView (
9993 padding: const EdgeInsets .all (16 ),
10094 child: Column (
@@ -103,16 +97,16 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
10397 // Title section
10498 Text (
10599 'Create a New Quest' ,
106- style: Theme .of (context).textTheme.headlineSmall ? . copyWith (
107- fontWeight : FontWeight .bold ,
108- ),
100+ style: Theme .of (
101+ context ,
102+ ).textTheme.headlineSmall ? . copyWith (fontWeight : FontWeight .bold) ,
109103 ),
110104 const SizedBox (height: 8 ),
111105 Text (
112106 'Upload files and ask AI questions about them' ,
113- style: Theme .of (context).textTheme.bodyMedium ? . copyWith (
114- color : Colors .grey ,
115- ),
107+ style: Theme .of (
108+ context ,
109+ ).textTheme.bodyMedium ? . copyWith (color : Colors .grey) ,
116110 ),
117111 const SizedBox (height: 24 ),
118112
@@ -148,9 +142,9 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
148142 // File upload section
149143 Text (
150144 'Upload Files' ,
151- style: Theme .of (context).textTheme.titleMedium ? . copyWith (
152- fontWeight : FontWeight .bold ,
153- ),
145+ style: Theme .of (
146+ context ,
147+ ).textTheme.titleMedium ? . copyWith (fontWeight : FontWeight .bold) ,
154148 ),
155149 const SizedBox (height: 12 ),
156150
@@ -160,7 +154,10 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
160154 icon: const Icon (Icons .upload_file),
161155 label: const Text ('Select Files' ),
162156 style: ElevatedButton .styleFrom (
163- padding: const EdgeInsets .symmetric (vertical: 12 , horizontal: 16 ),
157+ padding: const EdgeInsets .symmetric (
158+ vertical: 12 ,
159+ horizontal: 16 ,
160+ ),
164161 ),
165162 ),
166163 const SizedBox (height: 16 ),
@@ -180,47 +177,47 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
180177 ),
181178 ),
182179 const SizedBox (height: 8 ),
183- ...List .generate (
184- _selectedFiles.length,
185- (index) {
186- final file = _selectedFiles[index];
187- return Padding (
188- padding: const EdgeInsets .symmetric (vertical: 4 ),
189- child: Row (
190- children: [
191- const Icon (Icons .insert_drive_file, size: 20 ),
192- const SizedBox (width: 8 ),
193- Expanded (
194- child: Column (
195- crossAxisAlignment: CrossAxisAlignment .start,
196- children: [
197- Text (
198- file.name,
199- overflow: TextOverflow .ellipsis,
200- style: Theme .of (context).textTheme.bodySmall,
201- ),
202- Text (
203- '${(file .size / 1024 ).toStringAsFixed (2 )} KB' ,
204- style: Theme .of (context).textTheme.bodySmall? .copyWith (
205- color: Colors .grey,
206- ),
207- ),
208- ],
209- ),
210- ),
211- IconButton (
212- icon: const Icon (Icons .close, size: 20 ),
213- onPressed: () {
214- setState (() {
215- _selectedFiles.removeAt (index);
216- });
217- },
180+ ...List .generate (_selectedFiles.length, (index) {
181+ final file = _selectedFiles[index];
182+ return Padding (
183+ padding: const EdgeInsets .symmetric (vertical: 4 ),
184+ child: Row (
185+ children: [
186+ const Icon (Icons .insert_drive_file, size: 20 ),
187+ const SizedBox (width: 8 ),
188+ Expanded (
189+ child: Column (
190+ crossAxisAlignment: CrossAxisAlignment .start,
191+ children: [
192+ Text (
193+ file.name,
194+ overflow: TextOverflow .ellipsis,
195+ style: Theme .of (
196+ context,
197+ ).textTheme.bodySmall,
198+ ),
199+ Text (
200+ '${(file .size / 1024 ).toStringAsFixed (2 )} KB' ,
201+ style: Theme .of (context)
202+ .textTheme
203+ .bodySmall
204+ ? .copyWith (color: Colors .grey),
205+ ),
206+ ],
218207 ),
219- ],
220- ),
221- );
222- },
223- ),
208+ ),
209+ IconButton (
210+ icon: const Icon (Icons .close, size: 20 ),
211+ onPressed: () {
212+ setState (() {
213+ _selectedFiles.removeAt (index);
214+ });
215+ },
216+ ),
217+ ],
218+ ),
219+ );
220+ }),
224221 ],
225222 ),
226223 ),
@@ -237,10 +234,10 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
237234 ),
238235 child: _isLoading
239236 ? const SizedBox (
240- height: 20 ,
241- width: 20 ,
242- child: CircularProgressIndicator (strokeWidth: 2 ),
243- )
237+ height: 20 ,
238+ width: 20 ,
239+ child: CircularProgressIndicator (strokeWidth: 2 ),
240+ )
244241 : const Text ('Create Quest' ),
245242 ),
246243 ),
@@ -250,4 +247,3 @@ class _QuestUploadScreenState extends ConsumerState<QuestUploadScreen> {
250247 );
251248 }
252249}
253-
0 commit comments