mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-31 13:25:40 +00:00 
			
		
		
		
	Toggle part star status
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | ## 0.1.3 - February 2021 | ||||||
|  | --- | ||||||
|  |  | ||||||
|  | - Adds ability to toggle "star" status for Part | ||||||
|  |  | ||||||
| ## 0.1.2 - February 2021 | ## 0.1.2 - February 2021 | ||||||
| --- | --- | ||||||
|  |  | ||||||
|   | |||||||
| @@ -304,12 +304,6 @@ class InvenTreePart extends InvenTreeModel { | |||||||
|     // Return the "starred" status of this part |     // Return the "starred" status of this part | ||||||
|     bool get starred => jsondata['starred'] as bool ?? false; |     bool get starred => jsondata['starred'] as bool ?? false; | ||||||
|  |  | ||||||
|     // Toggle the starred status |  | ||||||
|     Future<void> setStarred(BuildContext context, bool status) async { |  | ||||||
|       // TODO - Toggle the "starred" status of the part using the API |  | ||||||
|       return; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     InvenTreePart() : super(); |     InvenTreePart() : super(); | ||||||
|  |  | ||||||
|   InvenTreePart.fromJson(Map<String, dynamic> json) : super.fromJson(json) { |   InvenTreePart.fromJson(Map<String, dynamic> json) : super.fromJson(json) { | ||||||
|   | |||||||
| @@ -82,7 +82,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   void _toggleStar() async { |   void _toggleStar() async { | ||||||
|     await part.setStarred(context, !part.starred); |     await part.update(context, values: {"starred": "${!part.starred}"}); | ||||||
|     refresh(); |     refresh(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -158,8 +158,10 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> { | |||||||
|           title: Text("${part.fullname}"), |           title: Text("${part.fullname}"), | ||||||
|           subtitle: Text("${part.description}"), |           subtitle: Text("${part.description}"), | ||||||
|           trailing: IconButton( |           trailing: IconButton( | ||||||
|             icon: FaIcon(part.starred ? FontAwesomeIcons.solidStar : FontAwesomeIcons.star), |             icon: FaIcon(part.starred ? FontAwesomeIcons.solidStar : FontAwesomeIcons.star, | ||||||
|             onPressed: null, // TODO: _toggleStar, |               color: part.starred ? Color.fromRGBO(250, 250, 100, 1) : null, | ||||||
|  |             ), | ||||||
|  |             onPressed: _toggleStar, | ||||||
|           ), |           ), | ||||||
|           leading: GestureDetector( |           leading: GestureDetector( | ||||||
|             child: InvenTreeAPI().getImage(part.thumbnail), |             child: InvenTreeAPI().getImage(part.thumbnail), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user