oc-front/lib/widgets/catalog.dart

22 lines
924 B
Dart
Raw Normal View History

import 'package:flutter/material.dart';
2024-07-17 13:28:02 +02:00
import 'package:oc_front/core/models/workspace_local.dart';
2024-11-08 13:59:22 +01:00
import 'package:oc_front/main.dart';
import 'package:oc_front/models/search.dart';
import 'package:oc_front/widgets/items/item_row.dart';
class CatalogWidget extends StatefulWidget {
2024-08-30 12:52:32 +02:00
double? itemWidth;
bool readOnly = false;
final List<AbstractItem>? items;
2024-08-30 12:52:32 +02:00
CatalogWidget ({ Key? key, this.items, this.itemWidth, this.readOnly = false }): super(key: key);
@override CatalogWidgetState createState() => CatalogWidgetState();
}
class CatalogWidgetState extends State<CatalogWidget> {
@override Widget build(BuildContext context) {
var items = widget.items ?? WorkspaceLocal.items;
2024-08-30 12:52:32 +02:00
List<ItemRowWidget> itemRows = items.map((e) => ItemRowWidget(
readOnly: widget.readOnly,
2024-11-08 13:59:22 +01:00
contextWidth: widget.itemWidth ?? getMainWidth(context), item: e)).toList();
2024-08-30 12:52:32 +02:00
return Column( children: itemRows);
}
}