mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-30 21:13:28 +01:00 
			
		
		
		
	GeneratedFormSubForm UI improvements
This commit is contained in:
		| @@ -510,9 +510,10 @@ class _GeneratedFormState extends State<GeneratedForm> { | |||||||
|           ]); |           ]); | ||||||
|         } else if (widget.items[r][e] is GeneratedFormSubForm) { |         } else if (widget.items[r][e] is GeneratedFormSubForm) { | ||||||
|           List<Widget> subformColumn = []; |           List<Widget> subformColumn = []; | ||||||
|  |           var formItems = (widget.items[r][e] as GeneratedFormSubForm).items; | ||||||
|  |           var compact = formItems.length == 1 && formItems[0].length == 1; | ||||||
|           for (int i = 0; i < values[fieldKey].length; i++) { |           for (int i = 0; i < values[fieldKey].length; i++) { | ||||||
|             var items = (widget.items[r][e] as GeneratedFormSubForm) |             var items = formItems | ||||||
|                 .items |  | ||||||
|                 .map((x) => x.map((y) { |                 .map((x) => x.map((y) { | ||||||
|                       y.defaultValue = values[fieldKey]?[i]?[y.key]; |                       y.defaultValue = values[fieldKey]?[i]?[y.key]; | ||||||
|                       return y; |                       return y; | ||||||
| @@ -525,10 +526,11 @@ class _GeneratedFormState extends State<GeneratedForm> { | |||||||
|             subformColumn.add(Column( |             subformColumn.add(Column( | ||||||
|               crossAxisAlignment: CrossAxisAlignment.start, |               crossAxisAlignment: CrossAxisAlignment.start, | ||||||
|               children: [ |               children: [ | ||||||
|                 const Divider(), |                 if (!compact) | ||||||
|                   const SizedBox( |                   const SizedBox( | ||||||
|                     height: 16, |                     height: 16, | ||||||
|                   ), |                   ), | ||||||
|  |                 if (!compact) | ||||||
|                   Text( |                   Text( | ||||||
|                     '${(widget.items[r][e] as GeneratedFormSubForm).label} (${i + 1})', |                     '${(widget.items[r][e] as GeneratedFormSubForm).label} (${i + 1})', | ||||||
|                     style: const TextStyle(fontWeight: FontWeight.bold), |                     style: const TextStyle(fontWeight: FontWeight.bold), | ||||||
| @@ -567,13 +569,12 @@ class _GeneratedFormState extends State<GeneratedForm> { | |||||||
|                           Icons.delete_outline_rounded, |                           Icons.delete_outline_rounded, | ||||||
|                         )) |                         )) | ||||||
|                   ], |                   ], | ||||||
|                 ), |                 ) | ||||||
|               ], |               ], | ||||||
|             )); |             )); | ||||||
|           } |           } | ||||||
|           subformColumn.add(Padding( |           subformColumn.add(Padding( | ||||||
|             padding: EdgeInsets.only( |             padding: const EdgeInsets.only(bottom: 0, top: 8), | ||||||
|                 bottom: values[fieldKey].length > 0 ? 24 : 0, top: 8), |  | ||||||
|             child: Row( |             child: Row( | ||||||
|               children: [ |               children: [ | ||||||
|                 Expanded( |                 Expanded( | ||||||
| @@ -591,9 +592,6 @@ class _GeneratedFormState extends State<GeneratedForm> { | |||||||
|               ], |               ], | ||||||
|             ), |             ), | ||||||
|           )); |           )); | ||||||
|           if (values[fieldKey].length > 0) { |  | ||||||
|             subformColumn.add(const Divider()); |  | ||||||
|           } |  | ||||||
|           formInputs[r][e] = Column(children: subformColumn); |           formInputs[r][e] = Column(children: subformColumn); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user