returnReadDataCard method
A function that should return a read-only data card
Implementation
@override
Widget returnReadDataCard() {
List<Widget> children = [];
// Checks if the user has selected any options.
if (selectedOptions == null) {
var blankItem = const BlankScreenComponent(
cardTitle: "No options selected.",
cardBody: "Press the details button to add options.");
children.add(blankItem);
} else {
// If they do, build a scrolling row with the cards that contain
// their selection.
List<Widget> selectedChildren = [];
var allCards = returnLedger();
for (var item in allCards.entries) {
var itemCard = item.value;
if (itemCard.isCardSelected == true) {
itemCard.isEnabled = false;
var card = Padding(
padding: const EdgeInsets.all(8.0),
child: itemCard,
);
selectedChildren.add(card);
}
} // end of for-loop
var scrollWrapper = SizedBox(
width: size.layoutItemWidth(1, size.logicalScreenSize()),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: selectedChildren,
)),
);
children = [
scrollWrapper,
];
}
return BaseDataDetailCard(
isBeingEdited: true,
detailLabel: dataLabel,
detailChildren: children,
);
}