23 lines
		
	
	
		
			950 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			950 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:oc_front/main.dart';
 | |
| import 'package:flutter/material.dart';
 | |
| import 'package:oc_front/widgets/items/item_row.dart';
 | |
| import 'package:oc_front/models/resources/resources.dart';
 | |
| import 'package:oc_front/core/models/workspace_local.dart';
 | |
| 
 | |
| // ignore: must_be_immutable
 | |
| class CatalogWidget extends StatefulWidget {
 | |
|   double? itemWidth;
 | |
|   bool readOnly = false;
 | |
|   final List<AbstractItem>? items;
 | |
|   CatalogWidget ({ super.key, this.items, this.itemWidth, this.readOnly = false });
 | |
|   @override CatalogWidgetState createState() => CatalogWidgetState();
 | |
| }
 | |
| class CatalogWidgetState extends State<CatalogWidget> {
 | |
|   @override Widget build(BuildContext context) {
 | |
|     var items = widget.items ?? WorkspaceLocal.items;
 | |
|     List<ItemRowWidget> itemRows = items.map((e) => ItemRowWidget(
 | |
|       readOnly: widget.readOnly,
 | |
|       contextWidth: widget.itemWidth ?? getMainWidth(context), item: e)).toList();
 | |
|     return Column( children: itemRows);
 | |
|   }
 | |
| } |