96 lines
2.7 KiB
Dart
96 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mensaappbackend/modules/ratingCard.dart';
|
|
|
|
class BuilderToday {
|
|
static Widget build (var context, var snapshot, var ratingNames) {
|
|
var data = snapshot.data;
|
|
List<Widget> cards = [];
|
|
|
|
if (data == null) {
|
|
return const Center();
|
|
}
|
|
|
|
var i = 0;
|
|
for (var map in data) {
|
|
var ratings = map["ratings"];
|
|
|
|
List<Widget> children = [
|
|
];
|
|
for (var key in ratings.keys) {
|
|
var rating = ratings[key];
|
|
|
|
if (rating["q1"] != 0) {
|
|
Widget card = RatingCard(
|
|
rating1: rating["q1"],
|
|
rating2: rating["q2"],
|
|
text: rating["t1"],
|
|
title: ratingNames[key]!["title"]! + (key == "page1" ? ": ${rating["food"]}" : ""),
|
|
rating1Title: ratingNames[key]!["q1"]!,
|
|
rating2Title: ratingNames[key]!["q2"]!,
|
|
);
|
|
children.add(card);
|
|
children.add(const SizedBox(
|
|
width: 10,
|
|
));
|
|
}
|
|
}
|
|
|
|
cards.add(Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(15),
|
|
decoration: BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 5,
|
|
blurRadius: 7,
|
|
offset: const Offset(0, 3))
|
|
],
|
|
borderRadius: BorderRadius.circular(15),
|
|
color: Theme.of(context).colorScheme.surface.withOpacity(0.8)),
|
|
child: Column(
|
|
children: [
|
|
Text("Bewertung $i", style: const TextStyle(fontSize: 20),),
|
|
const SizedBox(height: 10,),
|
|
Wrap(
|
|
runSpacing: 10,
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
alignment: WrapAlignment.center,
|
|
children: children,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 15,
|
|
),
|
|
],
|
|
));
|
|
i++;
|
|
}
|
|
|
|
return SingleChildScrollView(
|
|
child: Center(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
const SizedBox(
|
|
height: 20,
|
|
),
|
|
const Text(
|
|
"Heute - Alle",
|
|
style: TextStyle(fontSize: 25),
|
|
),
|
|
const SizedBox(
|
|
height: 20,
|
|
),
|
|
for (var card in cards) card
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |