@@ -30,13 +30,7 @@ class WoxSettingPluginTableUpdate extends StatefulWidget {
3030 final Function onUpdate;
3131 final Future <String ?> Function (Map <String , dynamic > rowValues)? onUpdateValidate;
3232
33- const WoxSettingPluginTableUpdate ({
34- super .key,
35- required this .item,
36- required this .row,
37- required this .onUpdate,
38- this .onUpdateValidate,
39- });
33+ const WoxSettingPluginTableUpdate ({super .key, required this .item, required this .row, required this .onUpdate, this .onUpdateValidate});
4034
4135 @override
4236 State <WoxSettingPluginTableUpdate > createState () => _WoxSettingPluginTableUpdateState ();
@@ -178,19 +172,12 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
178172 Container (
179173 width: 80 ,
180174 height: 80 ,
181- decoration: BoxDecoration (
182- border: Border .all (color: getThemeSubTextColor ().withAlpha (76 )),
183- borderRadius: BorderRadius .circular (8 ),
184- ),
175+ decoration: BoxDecoration (border: Border .all (color: getThemeSubTextColor ().withAlpha (76 )), borderRadius: BorderRadius .circular (8 )),
185176 child: ClipRRect (
186177 borderRadius: BorderRadius .circular (8 ),
187178 child: Center (
188179 // Center the preview content (especially emoji) in the 80x80 box
189- child: WoxImageView (
190- woxImage: currentImage,
191- width: 80 ,
192- height: 80 ,
193- ),
180+ child: WoxImageView (woxImage: currentImage, width: 80 , height: 80 ),
194181 ),
195182 ),
196183 ),
@@ -206,10 +193,7 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
206193 onPressed: () async {
207194 final emojiResult = await _showEmojiPicker (context);
208195 if (emojiResult != null && emojiResult.isNotEmpty) {
209- final newImage = WoxImage (
210- imageType: WoxImageTypeEnum .WOX_IMAGE_TYPE_EMOJI .code,
211- imageData: emojiResult,
212- );
196+ final newImage = WoxImage (imageType: WoxImageTypeEnum .WOX_IMAGE_TYPE_EMOJI .code, imageData: emojiResult);
213197 updateValue (column.key, newImage);
214198 setState (() {});
215199 }
@@ -220,10 +204,7 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
220204 icon: Icon (Icons .file_upload_outlined, size: 14 , color: getThemeTextColor ()),
221205 padding: const EdgeInsets .symmetric (horizontal: 12 , vertical: 8 ),
222206 onPressed: () async {
223- final result = await FilePicker .platform.pickFiles (
224- type: FileType .image,
225- allowMultiple: false ,
226- );
207+ final result = await FilePicker .platform.pickFiles (type: FileType .image, allowMultiple: false );
227208
228209 if (result != null && result.files.isNotEmpty && result.files.first.path != null ) {
229210 final filePath = result.files.first.path! ;
@@ -232,10 +213,7 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
232213 final bytes = await file.readAsBytes ();
233214 final base64Image = base64Encode (bytes);
234215
235- final newImage = WoxImage (
236- imageType: WoxImageTypeEnum .WOX_IMAGE_TYPE_BASE64 .code,
237- imageData: "data:image/png;base64,$base64Image " ,
238- );
216+ final newImage = WoxImage (imageType: WoxImageTypeEnum .WOX_IMAGE_TYPE_BASE64 .code, imageData: "data:image/png;base64,$base64Image " );
239217
240218 updateValue (column.key, newImage);
241219 setState (() {});
@@ -263,23 +241,15 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
263241 width: 300 ,
264242 height: 200 ,
265243 child: GridView .builder (
266- gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount (
267- crossAxisCount: 5 ,
268- childAspectRatio: 1 ,
269- ),
244+ gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount (crossAxisCount: 5 , childAspectRatio: 1 ),
270245 itemCount: commonEmojis.length,
271246 itemBuilder: (context, index) {
272247 return InkWell (
273248 onTap: () {
274249 selectedEmoji = commonEmojis[index];
275250 Navigator .pop (context);
276251 },
277- child: Center (
278- child: Text (
279- commonEmojis[index],
280- style: const TextStyle (fontSize: 24 ),
281- ),
282- ),
252+ child: Center (child: Text (commonEmojis[index], style: const TextStyle (fontSize: 24 ))),
283253 );
284254 },
285255 ),
@@ -446,32 +416,29 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
446416 );
447417 case PluginSettingValueType .pluginSettingValueTableColumnTypeSelect:
448418 return Expanded (
449- child: Builder (builder: (context) {
450- final currentValue = getValue (column.key);
451- // Ensure the current value exists in selectOptions, otherwise use first option or null
452- final valueExists = column.selectOptions.any ((e) => e.value == currentValue);
453- final effectiveValue = valueExists ? currentValue : (column.selectOptions.isNotEmpty ? column.selectOptions.first.value : null );
454-
455- return WoxDropdownButton <String >(
456- value: effectiveValue,
457- isExpanded: true ,
458- fontSize: 13 ,
459- underline: Container (
460- height: 1 ,
461- color: getThemeDividerColor ().withOpacity (0.6 ),
462- ),
463- onChanged: (value) {
464- updateValue (column.key, value);
465- setState (() {});
466- },
467- items: column.selectOptions.map ((e) {
468- return WoxDropdownItem (
469- value: e.value,
470- label: e.label,
471- );
472- }).toList (),
473- );
474- }),
419+ child: Builder (
420+ builder: (context) {
421+ final currentValue = getValue (column.key);
422+ // Ensure the current value exists in selectOptions, otherwise use first option or null
423+ final valueExists = column.selectOptions.any ((e) => e.value == currentValue);
424+ final effectiveValue = valueExists ? currentValue : (column.selectOptions.isNotEmpty ? column.selectOptions.first.value : null );
425+
426+ return WoxDropdownButton <String >(
427+ value: effectiveValue,
428+ isExpanded: true ,
429+ fontSize: 13 ,
430+ underline: Container (height: 1 , color: getThemeDividerColor ().withOpacity (0.6 )),
431+ onChanged: (value) {
432+ updateValue (column.key, value);
433+ setState (() {});
434+ },
435+ items:
436+ column.selectOptions.map ((e) {
437+ return WoxDropdownItem (value: e.value, label: e.label);
438+ }).toList (),
439+ );
440+ },
441+ ),
475442 );
476443 case PluginSettingValueType .pluginSettingValueTableColumnTypeSelectAIModel:
477444 return Expanded (
@@ -539,9 +506,7 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
539506 ),
540507 );
541508 case PluginSettingValueType .pluginSettingValueTableColumnTypeWoxImage:
542- return Expanded (
543- child: _buildWoxImageEditor (column),
544- );
509+ return Expanded (child: _buildWoxImageEditor (column));
545510 case PluginSettingValueType .pluginSettingValueTableColumnTypeTextList:
546511 var columnValues = getValue (column.key);
547512 return Expanded (
@@ -574,10 +539,7 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
574539 child: WoxTextField (
575540 controller: textboxEditingController[column.key + i.toString ()],
576541 maxLines: 1 ,
577- style: TextStyle (
578- overflow: TextOverflow .ellipsis,
579- color: getThemeTextColor (),
580- ),
542+ style: TextStyle (overflow: TextOverflow .ellipsis, color: getThemeTextColor ()),
581543 onChanged: (value) {
582544 columnValues[i] = value;
583545
@@ -666,10 +628,7 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
666628 return MaterialApp (
667629 debugShowCheckedModeBanner: false ,
668630 theme: ThemeData (
669- colorScheme: ColorScheme .fromSeed (
670- seedColor: accentColor,
671- brightness: isDarkTheme ? Brightness .dark : Brightness .light,
672- ),
631+ colorScheme: ColorScheme .fromSeed (seedColor: accentColor, brightness: isDarkTheme ? Brightness .dark : Brightness .light),
673632 scaffoldBackgroundColor: Colors .transparent,
674633 cardColor: cardColor,
675634 shadowColor: textColor.withAlpha (50 ),
@@ -686,10 +645,7 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
686645 child: AlertDialog (
687646 backgroundColor: cardColor,
688647 surfaceTintColor: Colors .transparent,
689- shape: RoundedRectangleBorder (
690- borderRadius: BorderRadius .circular (20 ),
691- side: BorderSide (color: outlineColor),
692- ),
648+ shape: RoundedRectangleBorder (borderRadius: BorderRadius .circular (20 ), side: BorderSide (color: outlineColor)),
693649 elevation: 18 ,
694650 insetPadding: const EdgeInsets .symmetric (horizontal: 32 , vertical: 28 ),
695651 contentPadding: const EdgeInsets .fromLTRB (24 , 24 , 24 , 0 ),
@@ -715,14 +671,7 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
715671 children: [
716672 SizedBox (
717673 width: maxLabelWidth,
718- child: Text (
719- tr (column.label),
720- style: TextStyle (
721- color: textColor.withOpacity (0.92 ),
722- fontSize: 14 ,
723- fontWeight: FontWeight .w600,
724- ),
725- ),
674+ child: Text (tr (column.label), style: TextStyle (color: textColor.withOpacity (0.92 ), fontSize: 14 , fontWeight: FontWeight .w600)),
726675 ),
727676 const SizedBox (width: 10 ),
728677 buildColumn (column),
@@ -731,41 +680,22 @@ class _WoxSettingPluginTableUpdateState extends State<WoxSettingPluginTableUpdat
731680 if (column.tooltip != "" )
732681 Padding (
733682 padding: EdgeInsets .only (top: 4 , left: maxLabelWidth + 10 ),
734- child: Text (
735- tr (column.tooltip),
736- style: TextStyle (
737- color: textColor.withOpacity (0.6 ),
738- fontSize: 12 ,
739- ),
740- ),
683+ child: Text (tr (column.tooltip), style: TextStyle (color: textColor.withOpacity (0.6 ), fontSize: 12 )),
741684 ),
742685 ],
743686 ),
744687 ),
745688 if (customValidationError != null )
746689 Padding (
747690 padding: const EdgeInsets .only (top: 10 ),
748- child: Row (
749- children: [
750- Expanded (
751- child: Text (
752- customValidationError! ,
753- style: const TextStyle (color: Colors .red),
754- ),
755- ),
756- ],
757- ),
691+ child: Row (children: [Expanded (child: Text (customValidationError! , style: const TextStyle (color: Colors .red)))]),
758692 ),
759693 ],
760694 ),
761695 ),
762696 ),
763697 actions: [
764- WoxButton .secondary (
765- text: tr ("ui_cancel" ),
766- padding: const EdgeInsets .symmetric (horizontal: 22 , vertical: 12 ),
767- onPressed: () => Navigator .pop (context),
768- ),
698+ WoxButton .secondary (text: tr ("ui_cancel" ), padding: const EdgeInsets .symmetric (horizontal: 22 , vertical: 12 ), onPressed: () => Navigator .pop (context)),
769699 const SizedBox (width: 12 ),
770700 WoxButton .primary (
771701 text: tr ("ui_save" ),
0 commit comments