mirror of
https://bitbucket.org/FransoletThomas/tablet-app.git
synced 2025-12-06 00:21:19 +00:00
Final quizz result
This commit is contained in:
parent
0dd47e3076
commit
53d8d05408
@ -4,35 +4,71 @@ import 'package:tablet_app/constants.dart';
|
||||
class RoundedButton extends StatelessWidget {
|
||||
final String text;
|
||||
final Function press;
|
||||
final IconData icon;
|
||||
final Color color, textColor;
|
||||
final double fontSize;
|
||||
final double vertical;
|
||||
final double horizontal;
|
||||
|
||||
const RoundedButton({
|
||||
Key key,
|
||||
this.text,
|
||||
this.press,
|
||||
this.icon,
|
||||
this.color = kMainRed,
|
||||
this.textColor = Colors.white,
|
||||
this.fontSize
|
||||
this.fontSize,
|
||||
this.vertical,
|
||||
this.horizontal
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
return FlatButton(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(35.0),
|
||||
//side: BorderSide(color: kSubTitleColor)
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 25),
|
||||
color: color,
|
||||
onPressed: () => {
|
||||
press()
|
||||
},
|
||||
child: Text(
|
||||
text,
|
||||
style: new TextStyle(color: textColor, fontSize: fontSize, fontWeight: FontWeight.w400),
|
||||
),
|
||||
//Size size = MediaQuery.of(context).size;
|
||||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.resolveWith((states) => EdgeInsets.symmetric(vertical: this.vertical != null ? this.vertical : 25, horizontal: this.horizontal != null ? this.horizontal : (icon == null ? 85 : 30))),
|
||||
backgroundColor: MaterialStateColor.resolveWith((states) => color),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
onPressed: () => {
|
||||
press()
|
||||
},
|
||||
child: getValue(icon)
|
||||
);
|
||||
}
|
||||
|
||||
getValue(icon) {
|
||||
if (icon != null) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
text,
|
||||
style: new TextStyle(color: textColor, fontSize: fontSize, fontWeight: FontWeight.w400),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10
|
||||
),
|
||||
Icon(
|
||||
icon,
|
||||
color: textColor,
|
||||
size: fontSize + 8,
|
||||
)
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Text(
|
||||
text,
|
||||
style: new TextStyle(color: textColor, fontSize: fontSize, fontWeight: FontWeight.w400),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
lib/Screens/Quizz/drawStrawberry.dart
Normal file
122
lib/Screens/Quizz/drawStrawberry.dart
Normal file
@ -0,0 +1,122 @@
|
||||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
|
||||
Path drawStrawberry(Size size) {
|
||||
// Method to convert degree to radians
|
||||
double degToRad(double deg) => deg * (pi / 180.0);
|
||||
|
||||
const numberOfPoints = 5;
|
||||
final halfWidth = size.width / 2;
|
||||
final externalRadius = halfWidth;
|
||||
final internalRadius = halfWidth / 2.5;
|
||||
final degreesPerStep = degToRad(360 / numberOfPoints);
|
||||
final halfDegreesPerStep = degreesPerStep / 2;
|
||||
/*final path = Path();
|
||||
final fullAngle = degToRad(360);
|
||||
path.moveTo(size.width, halfWidth);
|
||||
|
||||
for (double step = 0; step < fullAngle; step += degreesPerStep) {
|
||||
path.lineTo(halfWidth + externalRadius * cos(step),
|
||||
halfWidth + externalRadius * sin(step));
|
||||
path.lineTo(halfWidth + internalRadius * cos(step + halfDegreesPerStep),
|
||||
halfWidth + internalRadius * sin(step + halfDegreesPerStep));
|
||||
}*/
|
||||
|
||||
var path = Path();
|
||||
path.lineTo(size.width * 0.57, size.height);
|
||||
path.cubicTo(size.width * 0.56, size.height, size.width * 0.53, size.height * 0.97, size.width * 0.51, size.height * 0.96);
|
||||
path.cubicTo(size.width * 0.49, size.height * 0.94, size.width * 0.47, size.height * 0.89, size.width * 0.47, size.height * 0.85);
|
||||
path.cubicTo(size.width * 0.47, size.height * 0.85, size.width * 0.46, size.height * 0.84, size.width * 0.46, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.46, size.height * 0.84, size.width * 0.44, size.height * 0.85, size.width * 0.44, size.height * 0.85);
|
||||
path.cubicTo(size.width * 0.4, size.height * 0.88, size.width * 0.38, size.height * 0.89, size.width * 0.34, size.height * 0.91);
|
||||
path.cubicTo(size.width * 0.28, size.height * 0.93, size.width * 0.22, size.height * 0.94, size.width * 0.15, size.height * 0.93);
|
||||
path.cubicTo(size.width * 0.11, size.height * 0.93, size.width * 0.09, size.height * 0.93, size.width * 0.07, size.height * 0.93);
|
||||
path.cubicTo(size.width * 0.02, size.height * 0.92, size.width * 0.02, size.height * 0.91, size.width * 0.03, size.height * 0.89);
|
||||
path.cubicTo(size.width * 0.05, size.height * 0.84, size.width * 0.09, size.height * 0.79, size.width * 0.15, size.height * 0.76);
|
||||
path.cubicTo(size.width * 0.17, size.height * 0.75, size.width * 0.19, size.height * 0.74, size.width / 5, size.height * 0.74);
|
||||
path.cubicTo(size.width * 0.22, size.height * 0.73, size.width * 0.22, size.height * 0.73, size.width * 0.22, size.height * 0.73);
|
||||
path.cubicTo(size.width * 0.22, size.height * 0.73, size.width * 0.22, size.height * 0.73, size.width * 0.22, size.height * 0.73);
|
||||
path.cubicTo(size.width / 5, size.height * 0.73, size.width * 0.16, size.height * 0.71, size.width * 0.14, size.height * 0.7);
|
||||
path.cubicTo(size.width * 0.13, size.height * 0.7, size.width * 0.12, size.height * 0.69, size.width * 0.11, size.height * 0.69);
|
||||
path.cubicTo(size.width * 0.1, size.height * 0.68, size.width * 0.07, size.height * 0.66, size.width * 0.06, size.height * 0.65);
|
||||
path.cubicTo(0, size.height * 0.6, -0.01, size.height * 0.54, size.width * 0.02, size.height * 0.45);
|
||||
path.cubicTo(size.width * 0.03, size.height * 0.4, size.width * 0.06, size.height * 0.35, size.width * 0.1, size.height * 0.29);
|
||||
path.cubicTo(size.width * 0.13, size.height / 4, size.width * 0.15, size.height * 0.23, size.width * 0.18, size.height * 0.19);
|
||||
path.cubicTo(size.width * 0.24, size.height * 0.14, size.width * 0.28, size.height * 0.1, size.width * 0.35, size.height * 0.06);
|
||||
path.cubicTo(size.width * 0.42, size.height * 0.01, size.width * 0.47, 0, size.width * 0.51, 0);
|
||||
path.cubicTo(size.width * 0.58, size.height * 0.01, size.width * 0.66, size.height * 0.06, size.width * 0.75, size.height * 0.14);
|
||||
path.cubicTo(size.width * 0.87, size.height * 0.24, size.width * 0.97, size.height * 0.37, size.width, size.height * 0.46);
|
||||
path.cubicTo(size.width, size.height * 0.52, size.width, size.height * 0.56, size.width * 0.97, size.height * 0.6);
|
||||
path.cubicTo(size.width * 0.95, size.height * 0.62, size.width * 0.93, size.height * 0.64, size.width * 0.9, size.height * 0.66);
|
||||
path.cubicTo(size.width * 0.89, size.height * 0.67, size.width * 0.88, size.height * 0.68, size.width * 0.84, size.height * 0.7);
|
||||
path.cubicTo(size.width * 0.84, size.height * 0.7, size.width * 0.83, size.height * 0.7, size.width * 0.83, size.height * 0.7);
|
||||
path.cubicTo(size.width * 0.83, size.height * 0.7, size.width * 0.84, size.height * 0.71, size.width * 0.85, size.height * 0.72);
|
||||
path.cubicTo(size.width * 0.9, size.height * 0.75, size.width * 0.93, size.height * 0.78, size.width * 0.97, size.height * 0.82);
|
||||
path.cubicTo(size.width * 0.98, size.height * 0.84, size.width, size.height * 0.85, size.width, size.height * 0.85);
|
||||
path.cubicTo(size.width, size.height * 0.86, size.width * 0.98, size.height * 0.87, size.width * 0.97, size.height * 0.87);
|
||||
path.cubicTo(size.width * 0.95, size.height * 0.88, size.width * 0.85, size.height * 0.88, size.width * 0.77, size.height * 0.88);
|
||||
path.cubicTo(size.width * 0.7, size.height * 0.88, size.width * 0.67, size.height * 0.88, size.width * 0.61, size.height * 0.86);
|
||||
path.cubicTo(size.width * 0.6, size.height * 0.86, size.width * 0.59, size.height * 0.86, size.width * 0.59, size.height * 0.86);
|
||||
path.cubicTo(size.width * 0.59, size.height * 0.86, size.width * 0.61, size.height * 0.88, size.width * 0.62, size.height * 0.9);
|
||||
path.cubicTo(size.width * 0.64, size.height * 0.93, size.width * 0.65, size.height * 0.93, size.width * 0.65, size.height * 0.95);
|
||||
path.cubicTo(size.width * 0.65, size.height * 0.96, size.width * 0.64, size.height * 0.97, size.width * 0.63, size.height * 0.97);
|
||||
path.cubicTo(size.width * 0.62, size.height * 0.97, size.width * 0.62, size.height * 0.98, size.width * 0.62, size.height * 0.98);
|
||||
path.cubicTo(size.width * 0.62, size.height, size.width * 0.61, size.height, size.width * 0.6, size.height);
|
||||
path.cubicTo(size.width * 0.59, size.height, size.width * 0.58, size.height, size.width * 0.57, size.height);
|
||||
path.cubicTo(size.width * 0.57, size.height, size.width * 0.57, size.height, size.width * 0.57, size.height);
|
||||
path.lineTo(size.width * 0.58, size.height * 0.94);
|
||||
path.cubicTo(size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.93);
|
||||
path.cubicTo(size.width * 0.57, size.height * 0.93, size.width * 0.54, size.height * 0.89, size.width * 0.54, size.height * 0.88);
|
||||
path.cubicTo(size.width * 0.53, size.height * 0.88, size.width * 0.53, size.height * 0.88, size.width * 0.54, size.height * 0.89);
|
||||
path.cubicTo(size.width * 0.55, size.height * 0.91, size.width * 0.56, size.height * 0.93, size.width * 0.57, size.height * 0.94);
|
||||
path.cubicTo(size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94);
|
||||
path.cubicTo(size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94);
|
||||
path.lineTo(size.width * 0.19, size.height * 0.89);
|
||||
path.cubicTo(size.width / 4, size.height * 0.89, size.width * 0.3, size.height * 0.88, size.width * 0.34, size.height * 0.86);
|
||||
path.cubicTo(size.width * 0.39, size.height * 0.84, size.width * 0.43, size.height * 0.8, size.width * 0.45, size.height * 0.77);
|
||||
path.cubicTo(size.width * 0.46, size.height * 0.76, size.width * 0.46, size.height * 0.75, size.width * 0.45, size.height * 0.75);
|
||||
path.cubicTo(size.width * 0.44, size.height * 0.75, size.width * 0.37, size.height * 0.75, size.width / 3, size.height * 0.75);
|
||||
path.cubicTo(size.width * 0.29, size.height * 0.75, size.width * 0.24, size.height * 0.77, size.width / 5, size.height * 0.79);
|
||||
path.cubicTo(size.width * 0.18, size.height * 0.8, size.width * 0.15, size.height * 0.82, size.width * 0.13, size.height * 0.83);
|
||||
path.cubicTo(size.width * 0.12, size.height * 0.85, size.width * 0.1, size.height * 0.87, size.width * 0.09, size.height * 0.88);
|
||||
path.cubicTo(size.width * 0.09, size.height * 0.89, size.width * 0.09, size.height * 0.89, size.width * 0.11, size.height * 0.89);
|
||||
path.cubicTo(size.width * 0.15, size.height * 0.9, size.width * 0.17, size.height * 0.9, size.width * 0.19, size.height * 0.89);
|
||||
path.cubicTo(size.width * 0.19, size.height * 0.89, size.width * 0.19, size.height * 0.89, size.width * 0.19, size.height * 0.89);
|
||||
path.lineTo(size.width * 0.87, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.9, size.height * 0.84, size.width * 0.91, size.height * 0.84, size.width * 0.91, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.91, size.height * 0.83, size.width * 0.9, size.height * 0.83, size.width * 0.9, size.height * 0.82);
|
||||
path.cubicTo(size.width * 0.85, size.height * 0.77, size.width * 0.79, size.height * 0.73, size.width * 0.73, size.height * 0.72);
|
||||
path.cubicTo(size.width * 0.71, size.height * 0.71, size.width * 0.7, size.height * 0.71, size.width * 0.67, size.height * 0.71);
|
||||
path.cubicTo(size.width * 0.66, size.height * 0.71, size.width * 0.65, size.height * 0.71, size.width * 0.64, size.height * 0.71);
|
||||
path.cubicTo(size.width * 0.61, size.height * 0.72, size.width * 0.57, size.height * 0.73, size.width * 0.55, size.height * 0.74);
|
||||
path.cubicTo(size.width * 0.54, size.height * 0.74, size.width * 0.53, size.height * 0.75, size.width * 0.53, size.height * 0.75);
|
||||
path.cubicTo(size.width * 0.53, size.height * 0.75, size.width * 0.54, size.height * 0.77, size.width * 0.54, size.height * 0.77);
|
||||
path.cubicTo(size.width * 0.56, size.height * 0.8, size.width * 0.59, size.height * 0.81, size.width * 0.63, size.height * 0.82);
|
||||
path.cubicTo(size.width * 0.66, size.height * 0.83, size.width * 0.7, size.height * 0.84, size.width * 0.74, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.76, size.height * 0.84, size.width * 0.84, size.height * 0.84, size.width * 0.87, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.87, size.height * 0.84, size.width * 0.87, size.height * 0.84, size.width * 0.87, size.height * 0.84);
|
||||
path.lineTo(size.width / 2, size.height * 0.71);
|
||||
path.cubicTo(size.width / 2, size.height * 0.71, size.width * 0.51, size.height * 0.71, size.width * 0.51, size.height * 0.7);
|
||||
path.cubicTo(size.width * 0.55, size.height * 0.69, size.width * 0.59, size.height * 0.68, size.width * 0.63, size.height * 0.67);
|
||||
path.cubicTo(size.width * 0.63, size.height * 0.67, size.width * 0.65, size.height * 0.67, size.width * 0.67, size.height * 0.67);
|
||||
path.cubicTo(size.width * 0.67, size.height * 0.67, size.width * 0.71, size.height * 0.67, size.width * 0.71, size.height * 0.67);
|
||||
path.cubicTo(size.width * 0.71, size.height * 0.67, size.width * 0.74, size.height * 0.68, size.width * 0.74, size.height * 0.68);
|
||||
path.cubicTo(size.width * 0.74, size.height * 0.68, size.width * 0.76, size.height * 0.68, size.width * 0.76, size.height * 0.68);
|
||||
path.cubicTo(size.width * 0.76, size.height * 0.68, size.width * 0.77, size.height * 0.67, size.width * 0.77, size.height * 0.67);
|
||||
path.cubicTo(size.width * 0.82, size.height * 0.66, size.width * 0.87, size.height * 0.63, size.width * 0.89, size.height * 0.61);
|
||||
path.cubicTo(size.width * 0.94, size.height * 0.57, size.width * 0.95, size.height * 0.51, size.width * 0.93, size.height * 0.44);
|
||||
path.cubicTo(size.width * 0.88, size.height * 0.31, size.width * 0.7, size.height * 0.12, size.width * 0.56, size.height * 0.06);
|
||||
path.cubicTo(size.width * 0.52, size.height * 0.04, size.width / 2, size.height * 0.04, size.width * 0.47, size.height * 0.05);
|
||||
path.cubicTo(size.width * 0.4, size.height * 0.06, size.width * 0.29, size.height * 0.14, size.width / 5, size.height * 0.24);
|
||||
path.cubicTo(size.width * 0.13, size.height / 3, size.width * 0.08, size.height * 0.41, size.width * 0.07, size.height * 0.49);
|
||||
path.cubicTo(size.width * 0.06, size.height * 0.51, size.width * 0.06, size.height * 0.55, size.width * 0.07, size.height * 0.57);
|
||||
path.cubicTo(size.width * 0.07, size.height * 0.58, size.width * 0.08, size.height * 0.59, size.width * 0.09, size.height * 0.6);
|
||||
path.cubicTo(size.width * 0.1, size.height * 0.62, size.width * 0.11, size.height * 0.63, size.width * 0.12, size.height * 0.64);
|
||||
path.cubicTo(size.width * 0.16, size.height * 0.67, size.width * 0.22, size.height * 0.69, size.width * 0.3, size.height * 0.7);
|
||||
path.cubicTo(size.width / 3, size.height * 0.7, size.width / 3, size.height * 0.71, size.width * 0.41, size.height * 0.71);
|
||||
path.cubicTo(size.width * 0.44, size.height * 0.71, size.width * 0.45, size.height * 0.71, size.width * 0.46, size.height * 0.71);
|
||||
path.cubicTo(size.width * 0.48, size.height * 0.71, size.width * 0.49, size.height * 0.71, size.width / 2, size.height * 0.71);
|
||||
path.cubicTo(size.width / 2, size.height * 0.71, size.width / 2, size.height * 0.71, size.width / 2, size.height * 0.71);
|
||||
|
||||
return path;
|
||||
}
|
||||
@ -1,16 +1,18 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'dart:developer';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:confetti/confetti.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:managerapi/api.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tablet_app/Components/Buttons/rounded_button.dart';
|
||||
import 'package:tablet_app/Models/ResponseSubDTO.dart';
|
||||
import 'package:tablet_app/app_context.dart';
|
||||
import 'package:tablet_app/constants.dart';
|
||||
|
||||
import 'drawStrawberry.dart';
|
||||
|
||||
|
||||
class QuizzViewWidget extends StatefulWidget {
|
||||
final SectionDTO section;
|
||||
@ -48,163 +50,146 @@ class _QuizzViewWidget extends State<QuizzViewWidget> {
|
||||
@override
|
||||
void dispose() {
|
||||
sliderController = null;
|
||||
currentIndex = 1;
|
||||
_controllerCenter.dispose();
|
||||
_questionsSubDTO = QuestionSubDTO().fromJSON(quizzDTO.questions);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// A custom Path to paint stars.
|
||||
Path drawStar(Size size) {
|
||||
// Method to convert degree to radians
|
||||
double degToRad(double deg) => deg * (pi / 180.0);
|
||||
|
||||
const numberOfPoints = 5;
|
||||
final halfWidth = size.width / 2;
|
||||
final externalRadius = halfWidth;
|
||||
final internalRadius = halfWidth / 2.5;
|
||||
final degreesPerStep = degToRad(360 / numberOfPoints);
|
||||
final halfDegreesPerStep = degreesPerStep / 2;
|
||||
/*final path = Path();
|
||||
final fullAngle = degToRad(360);
|
||||
path.moveTo(size.width, halfWidth);
|
||||
|
||||
for (double step = 0; step < fullAngle; step += degreesPerStep) {
|
||||
path.lineTo(halfWidth + externalRadius * cos(step),
|
||||
halfWidth + externalRadius * sin(step));
|
||||
path.lineTo(halfWidth + internalRadius * cos(step + halfDegreesPerStep),
|
||||
halfWidth + internalRadius * sin(step + halfDegreesPerStep));
|
||||
}*/
|
||||
|
||||
var path = Path();
|
||||
path.lineTo(size.width * 0.57, size.height);
|
||||
path.cubicTo(size.width * 0.56, size.height, size.width * 0.53, size.height * 0.97, size.width * 0.51, size.height * 0.96);
|
||||
path.cubicTo(size.width * 0.49, size.height * 0.94, size.width * 0.47, size.height * 0.89, size.width * 0.47, size.height * 0.85);
|
||||
path.cubicTo(size.width * 0.47, size.height * 0.85, size.width * 0.46, size.height * 0.84, size.width * 0.46, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.46, size.height * 0.84, size.width * 0.44, size.height * 0.85, size.width * 0.44, size.height * 0.85);
|
||||
path.cubicTo(size.width * 0.4, size.height * 0.88, size.width * 0.38, size.height * 0.89, size.width * 0.34, size.height * 0.91);
|
||||
path.cubicTo(size.width * 0.28, size.height * 0.93, size.width * 0.22, size.height * 0.94, size.width * 0.15, size.height * 0.93);
|
||||
path.cubicTo(size.width * 0.11, size.height * 0.93, size.width * 0.09, size.height * 0.93, size.width * 0.07, size.height * 0.93);
|
||||
path.cubicTo(size.width * 0.02, size.height * 0.92, size.width * 0.02, size.height * 0.91, size.width * 0.03, size.height * 0.89);
|
||||
path.cubicTo(size.width * 0.05, size.height * 0.84, size.width * 0.09, size.height * 0.79, size.width * 0.15, size.height * 0.76);
|
||||
path.cubicTo(size.width * 0.17, size.height * 0.75, size.width * 0.19, size.height * 0.74, size.width / 5, size.height * 0.74);
|
||||
path.cubicTo(size.width * 0.22, size.height * 0.73, size.width * 0.22, size.height * 0.73, size.width * 0.22, size.height * 0.73);
|
||||
path.cubicTo(size.width * 0.22, size.height * 0.73, size.width * 0.22, size.height * 0.73, size.width * 0.22, size.height * 0.73);
|
||||
path.cubicTo(size.width / 5, size.height * 0.73, size.width * 0.16, size.height * 0.71, size.width * 0.14, size.height * 0.7);
|
||||
path.cubicTo(size.width * 0.13, size.height * 0.7, size.width * 0.12, size.height * 0.69, size.width * 0.11, size.height * 0.69);
|
||||
path.cubicTo(size.width * 0.1, size.height * 0.68, size.width * 0.07, size.height * 0.66, size.width * 0.06, size.height * 0.65);
|
||||
path.cubicTo(0, size.height * 0.6, -0.01, size.height * 0.54, size.width * 0.02, size.height * 0.45);
|
||||
path.cubicTo(size.width * 0.03, size.height * 0.4, size.width * 0.06, size.height * 0.35, size.width * 0.1, size.height * 0.29);
|
||||
path.cubicTo(size.width * 0.13, size.height / 4, size.width * 0.15, size.height * 0.23, size.width * 0.18, size.height * 0.19);
|
||||
path.cubicTo(size.width * 0.24, size.height * 0.14, size.width * 0.28, size.height * 0.1, size.width * 0.35, size.height * 0.06);
|
||||
path.cubicTo(size.width * 0.42, size.height * 0.01, size.width * 0.47, 0, size.width * 0.51, 0);
|
||||
path.cubicTo(size.width * 0.58, size.height * 0.01, size.width * 0.66, size.height * 0.06, size.width * 0.75, size.height * 0.14);
|
||||
path.cubicTo(size.width * 0.87, size.height * 0.24, size.width * 0.97, size.height * 0.37, size.width, size.height * 0.46);
|
||||
path.cubicTo(size.width, size.height * 0.52, size.width, size.height * 0.56, size.width * 0.97, size.height * 0.6);
|
||||
path.cubicTo(size.width * 0.95, size.height * 0.62, size.width * 0.93, size.height * 0.64, size.width * 0.9, size.height * 0.66);
|
||||
path.cubicTo(size.width * 0.89, size.height * 0.67, size.width * 0.88, size.height * 0.68, size.width * 0.84, size.height * 0.7);
|
||||
path.cubicTo(size.width * 0.84, size.height * 0.7, size.width * 0.83, size.height * 0.7, size.width * 0.83, size.height * 0.7);
|
||||
path.cubicTo(size.width * 0.83, size.height * 0.7, size.width * 0.84, size.height * 0.71, size.width * 0.85, size.height * 0.72);
|
||||
path.cubicTo(size.width * 0.9, size.height * 0.75, size.width * 0.93, size.height * 0.78, size.width * 0.97, size.height * 0.82);
|
||||
path.cubicTo(size.width * 0.98, size.height * 0.84, size.width, size.height * 0.85, size.width, size.height * 0.85);
|
||||
path.cubicTo(size.width, size.height * 0.86, size.width * 0.98, size.height * 0.87, size.width * 0.97, size.height * 0.87);
|
||||
path.cubicTo(size.width * 0.95, size.height * 0.88, size.width * 0.85, size.height * 0.88, size.width * 0.77, size.height * 0.88);
|
||||
path.cubicTo(size.width * 0.7, size.height * 0.88, size.width * 0.67, size.height * 0.88, size.width * 0.61, size.height * 0.86);
|
||||
path.cubicTo(size.width * 0.6, size.height * 0.86, size.width * 0.59, size.height * 0.86, size.width * 0.59, size.height * 0.86);
|
||||
path.cubicTo(size.width * 0.59, size.height * 0.86, size.width * 0.61, size.height * 0.88, size.width * 0.62, size.height * 0.9);
|
||||
path.cubicTo(size.width * 0.64, size.height * 0.93, size.width * 0.65, size.height * 0.93, size.width * 0.65, size.height * 0.95);
|
||||
path.cubicTo(size.width * 0.65, size.height * 0.96, size.width * 0.64, size.height * 0.97, size.width * 0.63, size.height * 0.97);
|
||||
path.cubicTo(size.width * 0.62, size.height * 0.97, size.width * 0.62, size.height * 0.98, size.width * 0.62, size.height * 0.98);
|
||||
path.cubicTo(size.width * 0.62, size.height, size.width * 0.61, size.height, size.width * 0.6, size.height);
|
||||
path.cubicTo(size.width * 0.59, size.height, size.width * 0.58, size.height, size.width * 0.57, size.height);
|
||||
path.cubicTo(size.width * 0.57, size.height, size.width * 0.57, size.height, size.width * 0.57, size.height);
|
||||
path.lineTo(size.width * 0.58, size.height * 0.94);
|
||||
path.cubicTo(size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.93);
|
||||
path.cubicTo(size.width * 0.57, size.height * 0.93, size.width * 0.54, size.height * 0.89, size.width * 0.54, size.height * 0.88);
|
||||
path.cubicTo(size.width * 0.53, size.height * 0.88, size.width * 0.53, size.height * 0.88, size.width * 0.54, size.height * 0.89);
|
||||
path.cubicTo(size.width * 0.55, size.height * 0.91, size.width * 0.56, size.height * 0.93, size.width * 0.57, size.height * 0.94);
|
||||
path.cubicTo(size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94);
|
||||
path.cubicTo(size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94, size.width * 0.58, size.height * 0.94);
|
||||
path.lineTo(size.width * 0.19, size.height * 0.89);
|
||||
path.cubicTo(size.width / 4, size.height * 0.89, size.width * 0.3, size.height * 0.88, size.width * 0.34, size.height * 0.86);
|
||||
path.cubicTo(size.width * 0.39, size.height * 0.84, size.width * 0.43, size.height * 0.8, size.width * 0.45, size.height * 0.77);
|
||||
path.cubicTo(size.width * 0.46, size.height * 0.76, size.width * 0.46, size.height * 0.75, size.width * 0.45, size.height * 0.75);
|
||||
path.cubicTo(size.width * 0.44, size.height * 0.75, size.width * 0.37, size.height * 0.75, size.width / 3, size.height * 0.75);
|
||||
path.cubicTo(size.width * 0.29, size.height * 0.75, size.width * 0.24, size.height * 0.77, size.width / 5, size.height * 0.79);
|
||||
path.cubicTo(size.width * 0.18, size.height * 0.8, size.width * 0.15, size.height * 0.82, size.width * 0.13, size.height * 0.83);
|
||||
path.cubicTo(size.width * 0.12, size.height * 0.85, size.width * 0.1, size.height * 0.87, size.width * 0.09, size.height * 0.88);
|
||||
path.cubicTo(size.width * 0.09, size.height * 0.89, size.width * 0.09, size.height * 0.89, size.width * 0.11, size.height * 0.89);
|
||||
path.cubicTo(size.width * 0.15, size.height * 0.9, size.width * 0.17, size.height * 0.9, size.width * 0.19, size.height * 0.89);
|
||||
path.cubicTo(size.width * 0.19, size.height * 0.89, size.width * 0.19, size.height * 0.89, size.width * 0.19, size.height * 0.89);
|
||||
path.lineTo(size.width * 0.87, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.9, size.height * 0.84, size.width * 0.91, size.height * 0.84, size.width * 0.91, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.91, size.height * 0.83, size.width * 0.9, size.height * 0.83, size.width * 0.9, size.height * 0.82);
|
||||
path.cubicTo(size.width * 0.85, size.height * 0.77, size.width * 0.79, size.height * 0.73, size.width * 0.73, size.height * 0.72);
|
||||
path.cubicTo(size.width * 0.71, size.height * 0.71, size.width * 0.7, size.height * 0.71, size.width * 0.67, size.height * 0.71);
|
||||
path.cubicTo(size.width * 0.66, size.height * 0.71, size.width * 0.65, size.height * 0.71, size.width * 0.64, size.height * 0.71);
|
||||
path.cubicTo(size.width * 0.61, size.height * 0.72, size.width * 0.57, size.height * 0.73, size.width * 0.55, size.height * 0.74);
|
||||
path.cubicTo(size.width * 0.54, size.height * 0.74, size.width * 0.53, size.height * 0.75, size.width * 0.53, size.height * 0.75);
|
||||
path.cubicTo(size.width * 0.53, size.height * 0.75, size.width * 0.54, size.height * 0.77, size.width * 0.54, size.height * 0.77);
|
||||
path.cubicTo(size.width * 0.56, size.height * 0.8, size.width * 0.59, size.height * 0.81, size.width * 0.63, size.height * 0.82);
|
||||
path.cubicTo(size.width * 0.66, size.height * 0.83, size.width * 0.7, size.height * 0.84, size.width * 0.74, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.76, size.height * 0.84, size.width * 0.84, size.height * 0.84, size.width * 0.87, size.height * 0.84);
|
||||
path.cubicTo(size.width * 0.87, size.height * 0.84, size.width * 0.87, size.height * 0.84, size.width * 0.87, size.height * 0.84);
|
||||
path.lineTo(size.width / 2, size.height * 0.71);
|
||||
path.cubicTo(size.width / 2, size.height * 0.71, size.width * 0.51, size.height * 0.71, size.width * 0.51, size.height * 0.7);
|
||||
path.cubicTo(size.width * 0.55, size.height * 0.69, size.width * 0.59, size.height * 0.68, size.width * 0.63, size.height * 0.67);
|
||||
path.cubicTo(size.width * 0.63, size.height * 0.67, size.width * 0.65, size.height * 0.67, size.width * 0.67, size.height * 0.67);
|
||||
path.cubicTo(size.width * 0.67, size.height * 0.67, size.width * 0.71, size.height * 0.67, size.width * 0.71, size.height * 0.67);
|
||||
path.cubicTo(size.width * 0.71, size.height * 0.67, size.width * 0.74, size.height * 0.68, size.width * 0.74, size.height * 0.68);
|
||||
path.cubicTo(size.width * 0.74, size.height * 0.68, size.width * 0.76, size.height * 0.68, size.width * 0.76, size.height * 0.68);
|
||||
path.cubicTo(size.width * 0.76, size.height * 0.68, size.width * 0.77, size.height * 0.67, size.width * 0.77, size.height * 0.67);
|
||||
path.cubicTo(size.width * 0.82, size.height * 0.66, size.width * 0.87, size.height * 0.63, size.width * 0.89, size.height * 0.61);
|
||||
path.cubicTo(size.width * 0.94, size.height * 0.57, size.width * 0.95, size.height * 0.51, size.width * 0.93, size.height * 0.44);
|
||||
path.cubicTo(size.width * 0.88, size.height * 0.31, size.width * 0.7, size.height * 0.12, size.width * 0.56, size.height * 0.06);
|
||||
path.cubicTo(size.width * 0.52, size.height * 0.04, size.width / 2, size.height * 0.04, size.width * 0.47, size.height * 0.05);
|
||||
path.cubicTo(size.width * 0.4, size.height * 0.06, size.width * 0.29, size.height * 0.14, size.width / 5, size.height * 0.24);
|
||||
path.cubicTo(size.width * 0.13, size.height / 3, size.width * 0.08, size.height * 0.41, size.width * 0.07, size.height * 0.49);
|
||||
path.cubicTo(size.width * 0.06, size.height * 0.51, size.width * 0.06, size.height * 0.55, size.width * 0.07, size.height * 0.57);
|
||||
path.cubicTo(size.width * 0.07, size.height * 0.58, size.width * 0.08, size.height * 0.59, size.width * 0.09, size.height * 0.6);
|
||||
path.cubicTo(size.width * 0.1, size.height * 0.62, size.width * 0.11, size.height * 0.63, size.width * 0.12, size.height * 0.64);
|
||||
path.cubicTo(size.width * 0.16, size.height * 0.67, size.width * 0.22, size.height * 0.69, size.width * 0.3, size.height * 0.7);
|
||||
path.cubicTo(size.width / 3, size.height * 0.7, size.width / 3, size.height * 0.71, size.width * 0.41, size.height * 0.71);
|
||||
path.cubicTo(size.width * 0.44, size.height * 0.71, size.width * 0.45, size.height * 0.71, size.width * 0.46, size.height * 0.71);
|
||||
path.cubicTo(size.width * 0.48, size.height * 0.71, size.width * 0.49, size.height * 0.71, size.width / 2, size.height * 0.71);
|
||||
path.cubicTo(size.width / 2, size.height * 0.71, size.width / 2, size.height * 0.71, size.width / 2, size.height * 0.71);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
final appContext = Provider.of<AppContext>(context);
|
||||
|
||||
if(showResult)
|
||||
return Column(
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
height: 250,
|
||||
color: Colors.green,
|
||||
child: ConfettiWidget(
|
||||
confettiController: _controllerCenter,
|
||||
blastDirectionality: BlastDirectionality
|
||||
.explosive, // don't specify a direction, blast randomly
|
||||
shouldLoop: true, // start again as soon as the animation is finished
|
||||
colors: const [
|
||||
Colors.red,
|
||||
//Colors.pink,
|
||||
//Colors.orange,
|
||||
//Colors.purple
|
||||
], // manually specify the colors to be used
|
||||
createParticlePath: drawStar, // define a custom shape/path.
|
||||
{
|
||||
var goodResponses = 0;
|
||||
_questionsSubDTO.forEach((question) {
|
||||
if(question.chosen == question.responsesSubDTO.indexWhere((response) => response.isGood))
|
||||
goodResponses +=1;
|
||||
});
|
||||
log("goodResponses =" + goodResponses.toString());
|
||||
var levelToShow;
|
||||
var test = goodResponses/quizzDTO.questions.length;
|
||||
log("test" + test.toString());
|
||||
|
||||
if(0 == test && test < 0.25)
|
||||
levelToShow = quizzDTO.badLevel;
|
||||
if(test>=0.25 && test < 0.5)
|
||||
levelToShow = quizzDTO.mediumLevel;
|
||||
if(test>=0.5 && test < 0.75)
|
||||
levelToShow = quizzDTO.goodLevel;
|
||||
if(test>=0.75 && test <= 1)
|
||||
levelToShow = quizzDTO.greatLevel;
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 5,
|
||||
height: 5,
|
||||
child: ConfettiWidget(
|
||||
confettiController: _controllerCenter,
|
||||
blastDirectionality: BlastDirectionality.explosive,
|
||||
shouldLoop: false, // start again as soon as the animation is finished
|
||||
colors: const [
|
||||
Colors.red,
|
||||
kMainRed,
|
||||
kSecondRed
|
||||
//Colors.pink,
|
||||
//Colors.orange,
|
||||
//Colors.purple
|
||||
], // manually specify the colors to be used
|
||||
createParticlePath: drawStrawberry, // define a custom shape/path.
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text("RESULT TODO"),
|
||||
],
|
||||
);
|
||||
if (levelToShow.source_ != null)
|
||||
Container(
|
||||
height: size.height * 0.2,
|
||||
width: size.width * 0.25,
|
||||
margin: EdgeInsets.symmetric(horizontal: 5.0),
|
||||
decoration: BoxDecoration(
|
||||
color: kBackgroundLight,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
image: levelToShow.source_ != null ? new DecorationImage(
|
||||
fit: BoxFit.contain,
|
||||
opacity: 0.85,
|
||||
image: new NetworkImage(
|
||||
levelToShow.source_,
|
||||
),
|
||||
): null,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Text('$goodResponses/${quizzDTO.questions.length}', textAlign: TextAlign.center, style: TextStyle(fontSize: 150, color: kBackgroundSecondGrey )),
|
||||
),
|
||||
Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width *0.65,
|
||||
height: MediaQuery.of(context).size.height *0.25,
|
||||
decoration: BoxDecoration(
|
||||
color: kBackgroundLight,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: kBackgroundSecondGrey,
|
||||
spreadRadius: 0.3,
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Text(levelToShow.label.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? levelToShow.label.firstWhere((translation) => translation.language == appContext.getContext().language).value : "", textAlign: TextAlign.center, style: TextStyle(fontSize: kDescriptionSize)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Buttons
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 85,
|
||||
child: RoundedButton(
|
||||
text: "Recommencer",
|
||||
color: kBackgroundSecondGrey,
|
||||
textColor: kBackgroundLight,
|
||||
icon: Icons.undo,
|
||||
press: () {
|
||||
setState(() {
|
||||
showResult = false;
|
||||
currentIndex = 1;
|
||||
_questionsSubDTO = QuestionSubDTO().fromJSON(quizzDTO.questions);
|
||||
});
|
||||
},
|
||||
fontSize: 30,
|
||||
horizontal: 30,
|
||||
vertical: 10
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
else
|
||||
return Stack(
|
||||
children: [
|
||||
@ -367,7 +352,7 @@ class _QuizzViewWidget extends State<QuizzViewWidget> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if(_questionsSubDTO != null && _questionsSubDTO.length > 1 && currentIndex != _questionsSubDTO.length)
|
||||
if(_questionsSubDTO != null && _questionsSubDTO.length > 1 && currentIndex != _questionsSubDTO.length && _questionsSubDTO[currentIndex-1].chosen != null && quizzDTO.questions.length > 0)
|
||||
Positioned(
|
||||
top: MediaQuery.of(context).size.height * 0.35,
|
||||
right: 60,
|
||||
@ -375,8 +360,7 @@ class _QuizzViewWidget extends State<QuizzViewWidget> {
|
||||
onTap: () {
|
||||
if(_questionsSubDTO[currentIndex-1].chosen != null && quizzDTO.questions.length > 0) {
|
||||
sliderController.nextPage(duration: new Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
|
||||
} else {
|
||||
Fluttertoast.showToast(
|
||||
/*Fluttertoast.showToast(
|
||||
msg: "Vous n'avez pas répondu à cette question",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
@ -384,7 +368,7 @@ class _QuizzViewWidget extends State<QuizzViewWidget> {
|
||||
backgroundColor: kMainRed,
|
||||
textColor: Colors.white,
|
||||
fontSize: 35.0
|
||||
);
|
||||
);*/
|
||||
}
|
||||
},
|
||||
child: Icon(
|
||||
|
||||
@ -138,34 +138,34 @@ class _SliderViewWidget extends State<SliderViewWidget> {
|
||||
),/**/
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width *0.65,
|
||||
height: MediaQuery.of(context).size.height *0.25,
|
||||
decoration: BoxDecoration(
|
||||
color: kBackgroundLight,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: kBackgroundSecondGrey,
|
||||
spreadRadius: 0.3,
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Text(i.description.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.description.firstWhere((translation) => translation.language == appContext.getContext().language).value : "", textAlign: TextAlign.center, style: TextStyle(fontSize: kDescriptionSize)),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width *0.65,
|
||||
height: MediaQuery.of(context).size.height *0.25,
|
||||
decoration: BoxDecoration(
|
||||
color: kBackgroundLight,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: kBackgroundSecondGrey,
|
||||
spreadRadius: 0.3,
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Text(i.description.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? i.description.firstWhere((translation) => translation.language == appContext.getContext().language).value : "", textAlign: TextAlign.center, style: TextStyle(fontSize: kDescriptionSize)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user