New Layout - Pro Bewertung
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
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"]!,
|
||||
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(
|
||||
"Tagesaktuell",
|
||||
style: TextStyle(fontSize: 25),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
for (var card in cards) card
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -24,17 +24,11 @@ class RatingCard extends StatelessWidget {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 5,
|
||||
blurRadius: 7,
|
||||
offset: Offset(0, 3))
|
||||
]),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(title, style: TextStyle(fontSize: 22),),
|
||||
@@ -49,9 +43,6 @@ class RatingCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user