diff --git a/student/assets/images/Ac8_function2.svg b/Dashboard/assets/images/Ac7_function1.svg similarity index 94% copy from student/assets/images/Ac8_function2.svg copy to Dashboard/assets/images/Ac7_function1.svg index 565e084..6e15a67 100644 --- a/student/assets/images/Ac8_function2.svg +++ b/Dashboard/assets/images/Ac7_function1.svg @@ -1,205 +1,205 @@ + sodipodi:docname="function1.svg"> image/svg+xml - + diff --git a/Dashboard/assets/images/Ac7_function2.svg b/Dashboard/assets/images/Ac7_function2.svg new file mode 100644 index 0000000..8ff326b --- /dev/null +++ b/Dashboard/assets/images/Ac7_function2.svg @@ -0,0 +1,99 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/student/assets/images/Ac8_function2.svg b/Dashboard/assets/images/Ac7_function3.svg similarity index 75% copy from student/assets/images/Ac8_function2.svg copy to Dashboard/assets/images/Ac7_function3.svg index 565e084..b3475da 100644 --- a/student/assets/images/Ac8_function2.svg +++ b/Dashboard/assets/images/Ac7_function3.svg @@ -1,205 +1,205 @@ + id="svg8" + version="1.1" + viewBox="0 0 860 860" + height="860mm" + width="860mm"> + id="marker7634" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path7632" /> + id="Arrow1Sstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Sstart"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path2354" /> + id="marker4372" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4370" /> + id="marker4318" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4316" /> + id="marker4282" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4280" /> + id="Arrow2Sstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path2372" /> + id="Arrow1Lstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lstart"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path2342" /> + inkscape:window-y="0" + inkscape:window-x="0" + inkscape:window-height="1012" + inkscape:window-width="1853" + inkscape:snap-to-guides="false" + inkscape:snap-grids="true" + showgrid="false" + inkscape:current-layer="layer1" + inkscape:document-units="mm" + inkscape:cy="2018.5582" + inkscape:cx="2298.8853" + inkscape:zoom="0.24748738" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base"> + empcolor="#000000" + opacity="1" + color="#000000" + snapvisiblegridlinesonly="true" + visible="true" + units="mm" + spacingy="99.999997" + spacingx="99.999997" + originy="7.3436625e-18" + id="grid2319" + type="xygrid" /> image/svg+xml - + + inkscape:groupmode="layer" + inkscape:label="Layer 1"> - + + cy="46.999992" + cx="400" + id="path4643" + style="stroke-width:20;stroke-miterlimit:4;stroke-dasharray:none" /> + x="315.23215" + style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583" + xml:space="preserve" /> + id="path2321" + d="M 577.77181,-283.91733 488.92535,-109.29579 397.17349,77.579901 152.66071,562.15811" + style="fill:none;fill-opacity:1;stroke:#ff475c;stroke-width:17.2404;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.870588" /> diff --git a/student/assets/images/Ac8_function2.svg b/Dashboard/assets/images/Ac8_function1.svg similarity index 74% copy from student/assets/images/Ac8_function2.svg copy to Dashboard/assets/images/Ac8_function1.svg index 565e084..c973d43 100644 --- a/student/assets/images/Ac8_function2.svg +++ b/Dashboard/assets/images/Ac8_function1.svg @@ -1,205 +1,205 @@ + id="svg8" + version="1.1" + viewBox="0 0 1100 1100" + height="1100mm" + width="1100mm"> + id="marker7634" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path7632" /> + id="Arrow1Sstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Sstart"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path2354" /> + id="marker4372" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4370" /> + id="marker4318" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4316" /> + id="marker4282" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4280" /> + id="Arrow2Sstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path2372" /> + id="Arrow1Lstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lstart"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path2342" /> + inkscape:snap-grids="true" + showgrid="false" + inkscape:current-layer="layer1" + inkscape:document-units="mm" + inkscape:cy="1048.8118" + inkscape:cx="1609.9613" + inkscape:zoom="0.24748738" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base"> + empcolor="#000000" + opacity="1" + color="#000000" + snapvisiblegridlinesonly="true" + visible="true" + units="mm" + spacingy="99.999997" + spacingx="99.999997" + originy="7.3436625e-18" + id="grid2319" + type="xygrid" /> image/svg+xml - + + inkscape:groupmode="layer" + inkscape:label="Layer 1"> - + + cy="46.999992" + cx="400" + id="path4643" + style="stroke-width:20;stroke-miterlimit:4;stroke-dasharray:none" /> + x="315.23215" + style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583" + xml:space="preserve" /> + id="path2321" + d="M 996.41076,-238.21722 789.96474,-31.661201 576.76757,189.38997 8.6110033,762.58692" + style="fill:none;fill-opacity:1;stroke:#ff475c;stroke-width:28.5826;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.870588" /> diff --git a/student/assets/images/Ac8_function2.svg b/Dashboard/assets/images/Ac8_function2.svg similarity index 100% copy from student/assets/images/Ac8_function2.svg copy to Dashboard/assets/images/Ac8_function2.svg diff --git a/student/assets/images/Ac8_function2.svg b/Dashboard/assets/images/Ac8_function3.svg similarity index 96% copy from student/assets/images/Ac8_function2.svg copy to Dashboard/assets/images/Ac8_function3.svg index 565e084..642b6ac 100644 --- a/student/assets/images/Ac8_function2.svg +++ b/Dashboard/assets/images/Ac8_function3.svg @@ -1,205 +1,205 @@ + sodipodi:docname="Ac8_function3.svg"> image/svg+xml - + diff --git a/student/assets/images/Grid.svg b/Dashboard/assets/images/Grid.svg similarity index 94% copy from student/assets/images/Grid.svg copy to Dashboard/assets/images/Grid.svg index 599bc5f..9a09b1e 100644 --- a/student/assets/images/Grid.svg +++ b/Dashboard/assets/images/Grid.svg @@ -1,1658 +1,1658 @@ + id="svg8" + version="1.1" + viewBox="0 0 1100 1100" + height="1100mm" + width="1100mm"> + width="45.10173" + height="53.474785" + id="rect3418" /> - + lpeversion="1" /> + lpeversion="1" /> - + steps="2" + helper_size="0" + apply_no_weight="true" + apply_with_weight="true" + only_selected="false" /> - + weight="33.333333" + steps="2" + helper_size="0" + apply_no_weight="true" + apply_with_weight="true" + only_selected="false" /> + + lpeversion="1" + weight="33.333333" + steps="2" + helper_size="0" + apply_no_weight="true" + apply_with_weight="true" + only_selected="false" /> + + + is_visible="true" + lpeversion="1" + bendpath="m 313.38107,64.111026 c -24.8903,64.503644 -27.50981,135.403974 -7.43253,201.170844 20.07728,65.76693 62.77436,126.14817 121.14764,171.32433 56.09688,43.41443 127.38417,72.86809 202.13978,78.19212 74.7556,5.32409 152.53199,-14.59109 208.53378,-58.09874 43.95679,-34.14986 73.12488,-81.13422 89.30611,-130.49311 16.18123,-49.35894 20.03653,-101.20753 19.12988,-152.53749 -1.81321,-102.65992 -22.14247,-206.677996 2.30177,-307.11312 24.53532,-100.80935 95.4363,-192.44179 193.4533,-250.01921" + prop_scale="1" + scale_y_rel="false" + vertical="false" + hide_knot="false" /> + id="marker7634" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path7632" /> + id="Arrow1Sstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Sstart"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path2354" /> + id="marker4372" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4370" /> + id="marker4318" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4316" /> + id="marker4282" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4280" /> + id="Arrow2Sstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path2372" /> + id="Arrow1Lstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lstart"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path2342" /> - - - + inkscape:window-y="0" + inkscape:window-x="0" + inkscape:window-height="1012" + inkscape:window-width="1853" + inkscape:snap-to-guides="false" + inkscape:snap-grids="true" + showgrid="false" + inkscape:current-layer="g2152" + inkscape:document-units="mm" + inkscape:cy="2253.7616" + inkscape:cx="2314.8772" + inkscape:zoom="0.175" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base"> + + + image/svg+xml + inkscape:groupmode="layer" + inkscape:label="Layer 1"> - + + cy="46.999992" + cx="400" + id="path4643" + style="stroke-width:20;stroke-miterlimit:4;stroke-dasharray:none" /> + x="315.23215" + style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583" + xml:space="preserve" /> - + + id="path7630" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> - + y="161.849" + x="504.26477" + height="100" + width="100" + id="use2198" + style="opacity:0.291054;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.161032" /> + + ry="1.2154196e-06" + y="161.849" + x="704.26477" + height="100.00722" + width="98.55394" + id="use2224" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.75889009" /> + height="377.95276" + x="1511.811" + y="1111.181" + style="line-height:228.66159058px;text-align:start;text-anchor:start;stroke:#000000;stroke-opacity:0.68925112;" /> - + + id="path4675-6" + inkscape:connector-curvature="0" /> + d="m 1003.0904,259.81976 c -31.32209,16.78453 -31.32209,16.78453 -31.32209,16.78453" + style="fill:none;stroke:#000000;stroke-width:8.61552;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.939116" /> + d="M 3.0903039,259.81974 C 32.759293,278.72639 32.759293,278.72639 32.759293,278.72639" + style="fill:none;stroke:#000000;stroke-width:8.89939;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path4675-6-3-6" + inkscape:connector-curvature="0" /> + id="path4692-75" + inkscape:connector-curvature="0" /> + d="M 522.60434,720.80354 C 503.46106,754.9004 503.46106,754.9004 503.46106,754.9004" + style="opacity:0.982015;fill:none;stroke:#000000;stroke-width:9.33193;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - - - + y="-38.165436" + x="504.2648" + height="100" + width="100" + id="use2198-2-9" + style="opacity:0.291054;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.68379575" /> + ry="1.2153318e-06" + y="-38.165436" + x="604.26477" + height="100" + width="100" + id="use2220-9-3" + style="opacity:0.291054;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.51697201" /> - + ry="1.2153318e-06" + y="-138.17267" + x="504.26477" + height="100" + width="100" + id="use2198-2-2" + style="opacity:0.291054;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.65907866" /> + + + + id="use2198-2-92" + style="opacity:0.291054;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.58292925" /> + id="use2220-9-0" + style="opacity:0.291054;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.51697201" /> + id="use2224-1-2" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.51697201" /> + id="use2224-6-2" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.161032" /> - - + inkscape:tile-y0="-6.4999998" /> - + ry="1.2154196e-06" + y="-38.172661" + x="307.15686" + height="100.00722" + width="98.55394" + id="use2224-5-7-0-8" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.5554508" /> + id="use2224-6-0-6-6" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.70352912" /> + - + ry="1.2154196e-06" + y="-138.17989" + x="307.15686" + height="100.00722" + width="98.55394" + id="use2224-5-7-8-3" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.5554508" /> + id="use2224-6-0-7-1" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.67306483" /> + + + + id="use2224-6-4" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.69757998" /> + + height="100" + x="108.60284" + y="461.84903" + ry="1.2153318e-06" + inkscape:tile-x0="-0.49999999" + inkscape:tile-y0="-6.4999998" /> + inkscape:tile-y0="-6.4999998" /> + + - - - + id="use2224-5-7-8-8" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.52108026" /> + id="use2224-6-0-7-5" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.62219381" /> + id="use2224-5-7-3-3" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.5554508" /> + height="100.00722" + x="405.71075" + y="261.83456" + ry="1.2154196e-06" + inkscape:tile-x0="-0.49999999" + inkscape:tile-y0="-6.4999998" /> + id="use2198-8-9" + style="opacity:0.291054;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.70519036" /> + + + ry="1.2154196e-06" + y="461.86343" + x="704.26477" + height="100.00722" + width="98.55394" + id="use2224-1-6-1-8" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.58248025" /> + x="504.2648" + height="100" + width="100" + id="use2198-2-2-5-7" + style="opacity:0.291054;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.62219381" /> + + + id="use2224-1-2-5-9" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.66491556" /> + id="use2224-5-7-3-3-8-5" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.69059807" /> - + + + width="98.55394" + height="100.00722" + x="504.79398" + y="161.849" + ry="1.2154196e-06" + inkscape:tile-x0="-0.49999999" + inkscape:tile-y0="-6.4999998" /> + style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect3418);fill:#000000;fill-opacity:1;stroke:none;" /> 1 + 1 + y="307.1564" + x="693.13141" + id="tspan3426-8" + sodipodi:role="line">2 2 + x="788.12659" + id="tspan3426-86" + sodipodi:role="line">3 3 + id="tspan3426-86-5" + x="887.8913" + y="306.44519" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.8px;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono Bold';stroke-width:0.264583">4 4 + x="1016.739" + y="275.39517" + id="text3428-2-3" + inkscape:transform-center-x="14.248806" + inkscape:transform-center-y="3.2072342">X X - Y + x="484.06076" + id="tspan3426-86-4-0" + sodipodi:role="line">Y 5 + x="987.67584" + id="tspan3426-86-5-0" + sodipodi:role="line">5 1 - 2 - 3 - 4 - 5 - -1 + y="174.3089" + x="460.3602" + id="tspan3426-86-5-8" + sodipodi:role="line">1 -2 + y="72.579445" + x="460.32321" + id="tspan3426-86-5-6" + sodipodi:role="line">2 -3 + y="-27.479586" + x="460.60321" + id="tspan3426-86-5-2" + sodipodi:role="line">3 -4 + y="-123.27065" + x="460.54419" + id="tspan3426-86-5-4" + sodipodi:role="line">4 -5 + y="-223.62201" + x="460.67041" + id="tspan3426-86-5-84" + sodipodi:role="line">5 -1 -2 -3 -4 -5 + -1 + -2 + -3 + -4 + -5 - + + ry="1.2154196e-06" + y="261.8562" + x="504.79395" + height="100.00722" + width="98.55394" + id="use2224-5-7-4-6" + style="opacity:0.302589;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.99278;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.555451" /> diff --git a/Dashboard/lib/model/Class.dart b/Dashboard/lib/model/Class.dart index 68484cb..92fc630 100644 --- a/Dashboard/lib/model/Class.dart +++ b/Dashboard/lib/model/Class.dart @@ -1,187 +1,194 @@ import 'package:firebase_database/firebase_database.dart'; import 'package:Teacher_Dashboard/model/Group.dart'; import 'package:flutter/widgets.dart'; import 'package:Teacher_Dashboard/model/Group.dart'; import 'package:Teacher_Dashboard/model/activities/activity.Dart'; import 'dart:async'; import 'dart:convert'; Classroom thisClass = new Classroom("1"); class Classroom extends ChangeNotifier { int inactivity; String sessionID = 'SPIA'; String teacherName; int numGroups = 0; List groups = new List(); List groupIDs = new List(); Classroom(this.sessionID); final FirebaseDatabase _database = FirebaseDatabase.instance; StreamSubscription _ongroupAddedSubscription; StreamSubscription _ongroupChangedSubscription; StreamSubscription _onattemptAddedSubscription; StreamSubscription _oninactivityAddedSubscription; StreamSubscription _onrobotpositionAddedSubscription; void toAggregate() {} void setupDatabse() { _ongroupAddedSubscription = _database .reference() .child(thisClass.sessionID) .child("groups") .onChildAdded .listen(onGroupAdded); _ongroupChangedSubscription = _database .reference() .child(thisClass.sessionID) .child("groups") .onChildChanged .listen(onGroupChanged); _onattemptAddedSubscription = _database .reference() .child(thisClass.sessionID) .child("attempts") .onChildAdded .listen(onAttemptAdded); _oninactivityAddedSubscription = _database .reference() .child(thisClass.sessionID) .child("celluloPosition") .onChildAdded .listen(oncelluloPositionAdded); //Query _todoQuery; } onGroupAdded(Event event) { Group newgroup = new Group(event.snapshot.value['id']); newgroup.member1name = event.snapshot.value['member1name']; newgroup.member2name = event.snapshot.value['member2name']; newgroup.member3name = event.snapshot.value['member3name']; thisClass.groups.add(newgroup); thisClass.groupIDs.add(event.snapshot.value['id']); notifyListeners(); } onGroupChanged(Event event) { //thisClass.groups.add(Group.fromSnapshot(event.snapshot)); int currentGroup = thisClass.groupIDs.indexOf(event.snapshot.key); // print("group" + currentGroup.toString().toString()); thisClass.groups[currentGroup].currentActivity = (event.snapshot.value)['currentActivity'].toString(); thisClass.groups[currentGroup].tabletStatus = (event.snapshot.value)['tabletStatus'].toString(); // setState(() {}); notifyListeners(); //print(thisClass.groups[currentGroup].currentActivity.toString()); } onAttemptAdded(Event event) { // print(jsonDecode(event.snapshot.value)['acID'].toString()); int currentGroup = thisClass.groupIDs.indexOf(jsonDecode(event.snapshot.value)['groupID']); int currentActivity = acList.indexOf(jsonDecode(event.snapshot.value)['acID'].toString()); + thisClass.groups[currentGroup].currentActivity = acList[currentActivity]; int currentTurn = (jsonDecode(event.snapshot.value)['currentTurn']); thisClass .groups[currentGroup] .activities[currentActivity] .turns[currentTurn - 1] .numAttempts = jsonDecode(event.snapshot.value)['numAttempts']; thisClass.groups[currentGroup].activities[currentActivity].elapsedTime = jsonDecode(event.snapshot.value)['elpasedTime']; thisClass .groups[currentGroup] .activities[currentActivity] .turns[currentTurn - 1] .elapsedTime = jsonDecode(event.snapshot.value)['elpasedTime']; - print(jsonDecode(event.snapshot.value)['elpasedTime']); + //print(jsonDecode(event.snapshot.value)['elpasedTime']); var progressmsg = jsonDecode((event.snapshot.value))['progress']; thisClass.groups[currentGroup].activities[currentActivity].progress[0] = progressmsg['turn1']; thisClass.groups[currentGroup].activities[currentActivity].progress[1] = progressmsg['turn2']; thisClass.groups[currentGroup].activities[currentActivity].progress[2] = progressmsg['turn3']; var mistakemsg = jsonDecode(event.snapshot.value)['mistakes']; var mistakemsgturn1 = (mistakemsg['turn1']); var mistakemsgturn2 = (mistakemsg['turn2']); var mistakemsgturn3 = (mistakemsg['turn3']); thisClass.groups[currentGroup].activities[currentActivity].mistakes['slope'] [0] = mistakemsgturn1['slope']; thisClass.groups[currentGroup].activities[currentActivity] .mistakes['initialPoint'][0] = mistakemsgturn1['initialPoint']; thisClass.groups[currentGroup].activities[currentActivity].mistakes['slope'] [1] = mistakemsgturn2['slope']; thisClass.groups[currentGroup].activities[currentActivity] .mistakes['initialPoint'][1] = mistakemsgturn2['initialPoint']; thisClass.groups[currentGroup].activities[currentActivity].mistakes['slope'] [2] = mistakemsgturn3['slope']; thisClass.groups[currentGroup].activities[currentActivity] .mistakes['initialPoint'][2] = mistakemsgturn3['initialPoint']; thisClass.groups[currentGroup].activities[currentActivity].turns[0] .mistakes['slope'] = mistakemsgturn1['slope']; thisClass.groups[currentGroup].activities[currentActivity].turns[0] .mistakes['initialPoint'] = mistakemsgturn1['initialPoint']; + thisClass.groups[currentGroup].activities[currentActivity].turns[0] + .mistakes['intercept'] = mistakemsgturn1['intercept']; thisClass.groups[currentGroup].activities[currentActivity].turns[1] .mistakes['slope'] = mistakemsgturn2['slope']; thisClass.groups[currentGroup].activities[currentActivity].turns[1] .mistakes['initialPoint'] = mistakemsgturn2['initialPoint']; + thisClass.groups[currentGroup].activities[currentActivity].turns[1] + .mistakes['intercept'] = mistakemsgturn2['intercept']; thisClass.groups[currentGroup].activities[currentActivity].turns[2] .mistakes['slope'] = mistakemsgturn3['slope']; thisClass.groups[currentGroup].activities[currentActivity].turns[2] .mistakes['initialPoint'] = mistakemsgturn3['initialPoint']; + thisClass.groups[currentGroup].activities[currentActivity].turns[2] + .mistakes['intercept'] = mistakemsgturn3['intercept']; notifyListeners(); } onInactivityAdded(Event event) { // print(jsonDecode(event.snapshot.value)['acID'].toString()); - int currentGroup = - thisClass.groupIDs.indexOf(jsonDecode(event.snapshot.value)['groupID']); + // int currentGroup = + // thisClass.groupIDs.indexOf(jsonDecode(event.snapshot.value)['groupID']); // int currentActivity = // acList.indexOf(jsonDecode(event.snapshot.value)['acID'].toString()); //thisClass.groups[currentGroup].inactivity[currentstepActivation] = // (jsonDecode(event.snapshot.value)['inactivity']); //print(thisClass.groups[currentGroup].inactivity); //currentstepActivation = currentstepActivation + 1; notifyListeners(); } oncelluloPositionAdded(Event event) { int currentGroup = thisClass.groupIDs.indexOf(jsonDecode(event.snapshot.value)['groupID']); int currentActivity = acList.indexOf(jsonDecode(event.snapshot.value)['acID'].toString()); int currentTurn = 0; - print(currentGroup.toString()); + // print(currentGroup.toString()); if (jsonDecode(event.snapshot.value)['turn'].toString() == '1') currentTurn = 1; if (jsonDecode(event.snapshot.value)['turn'].toString() == '2') currentTurn = 2; if (jsonDecode(event.snapshot.value)['turn'].toString() == '3') currentTurn = 3; // print(currentTurn); // int currentActivity = // acList.indexOf(jsonDecode(event.snapshot.value)['acID'].toString()); // print((jsonDecode(event.snapshot.value)['x'])); thisClass.groups[currentGroup].activities[currentActivity] .turns[currentTurn - 1].cellulox.x .add((jsonDecode(event.snapshot.value)['x'] * 90 / 860)); // print((jsonDecode(event.snapshot.value)['y'])); thisClass.groups[currentGroup].activities[currentActivity] .turns[currentTurn - 1].celluloy.y .add((jsonDecode(event.snapshot.value)['y'] * 90 / 860)); // thisClass.groups[currentGroup].celluloy.y // .add((jsonDecode(event.snapshot.value)['y'] / 40)) // setState(() {}); notifyListeners(); } } diff --git a/Dashboard/lib/model/Group.dart b/Dashboard/lib/model/Group.dart index 48c557b..308d103 100644 --- a/Dashboard/lib/model/Group.dart +++ b/Dashboard/lib/model/Group.dart @@ -1,56 +1,56 @@ import 'package:Teacher_Dashboard/model/cellulo.dart'; import 'package:firebase_database/firebase_database.dart'; import 'package:flutter/rendering.dart'; import 'package:Teacher_Dashboard/model/activities/activity.Dart'; Group group = new Group("1"); class Group { String id = "1"; var skills = { "slope": [0, 0, 0], "initialPoint": [0, 0, 0], }; // String _title; // String _description; int curinactivity; Cellulo cellulox = new Cellulo(); Cellulo celluloy = new Cellulo(); List inactivity = new List.generate(50, (index) => -1); String member1name = ''; String member2name = ''; String member3name = ''; String robot1code; String robot2code; String tabletStatus; String robotStatus; bool ispaused; bool canChangeActivity = false; int numAttempts; List progress = [-2, -2, -2]; - String currentActivity = ''; + String currentActivity = 'Ac7'; List activities = [new Activity("Ac7"), new Activity("Ac8")]; Group(this.id); toJson() { return { "userId": member1name, "subject": member1name, "completed": member1name, }; } Group.fromSnapshot(DataSnapshot snapshot) { // _id = snapshot.key; member1name = snapshot.value['member1name']; member2name = snapshot.value['member2name']; member3name = snapshot.value['member3name']; id = snapshot.value['id']; // numCurrentActivity = snapshot.value['numCurrentActivity']; numAttempts = snapshot.value['numAttempts']; // member3name = snapshot.value['inactivity']; } } diff --git a/Dashboard/lib/screens/Debriefing.dart b/Dashboard/lib/screens/Debriefing.dart index b52e899..eba6fc9 100644 --- a/Dashboard/lib/screens/Debriefing.dart +++ b/Dashboard/lib/screens/Debriefing.dart @@ -1,337 +1,359 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:Teacher_Dashboard/widgets/custom_app_bar.dart'; import 'dart:convert'; import 'package:Teacher_Dashboard/config/palette.dart'; import 'package:Teacher_Dashboard/config/styles.dart'; import 'dart:async'; import './screens.dart'; import 'package:Teacher_Dashboard/model/Class.dart'; import 'package:Teacher_Dashboard/model/Group.dart'; import 'package:firebase_database/firebase_database.dart'; import 'package:Teacher_Dashboard/model/activities/activity.Dart'; import 'package:step_progress_indicator/step_progress_indicator.dart'; import 'package:Teacher_Dashboard/widgets/hexagonPainter.Dart'; import 'package:Teacher_Dashboard/widgets/celluloMap.Dart'; import 'package:provider/provider.dart'; //import 'package:Teacher_Dashboard/model/core/models/productModel.dart'; //import 'package:Teacher_Dashboard/model/core/viewmodels/CRUDModel.dart'; //import 'package:provider/provider.dart'; class Debriefing extends StatefulWidget { @override DebriefingState createState() => DebriefingState(); } class DebriefingState extends State { bool mistakesSwitch = false; bool rankingSwitch = false; bool robotPatternSwitch = false; int numofgroups = thisClass.groups.length; + int currentstepActivation = 0; String pauseButtonText = 'Pause All'; + final FirebaseDatabase _database = FirebaseDatabase.instance; @override void initState() { super.initState(); } @override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { // final productProvider = Provider.of(context); return Scaffold( backgroundColor: Colors.white, appBar: CustomAppBar(), body: Column(children: [ SizedBox( height: 720, child: Consumer( builder: (context, model, child) => Container( child: ListView.builder( itemCount: thisClass.groups.length, itemBuilder: (context, int position) { return Card( child: ListTile( onLongPress: () { + print(thisClass + .groups[position] + .activities[acList.indexOf( + thisClass.groups[position].currentActivity)] + .progress + .toString()); Navigator.push( context, MaterialPageRoute( builder: (context) => GroupDashboard(currentgroupID: position))); }, title: Column(children: [ Row(children: [ Container( width: 100, height: 100, child: Stack(children: [ CustomPaint( painter: HexagonPainter( Offset(50, 50), 50, thisClass.groups[position].tabletStatus == 'YES' ? Colors.green : Colors.red), ), CustomPaint( painter: HexagonPainter( Offset(50, 50), 40, Colors.white), ), Center( child: Text( thisClass.groups[position].id, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 13), )), ]), ), SizedBox(width: 17), Stack(children: [ CircularStepProgressIndicator( totalSteps: 3, // currentStep: // thisClass.groups[position].activities[0].progress, width: 100, - customColor: (index) => thisClass.groups[position] - .activities[0].progress[index] > + customColor: (index) => thisClass + .groups[position] + .activities[acList.indexOf(thisClass + .groups[position] + .currentActivity)] + .progress[index] > -2 - ? (thisClass.groups[position].activities[0] + ? (thisClass + .groups[position] + .activities[acList.indexOf( + thisClass.groups[position] + .currentActivity)] .progress[index] > -1 ? (thisClass .groups[position] - .activities[0] + .activities[acList.indexOf(thisClass.groups[position].currentActivity)] .progress[index] > 0 ? Colors.green : Colors.blue) : Colors.red) : Colors.grey, ), Positioned( bottom: 45, right: 18, child: Text( thisClass.groups[position].currentActivity, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 15), )), ]), SizedBox(width: 25), minituare(position, 1, mistakesSwitch, rankingSwitch, robotPatternSwitch), SizedBox( width: 25, ), minituare(position, 2, mistakesSwitch, rankingSwitch, robotPatternSwitch), SizedBox( width: 25, ), minituare(position, 3, mistakesSwitch, rankingSwitch, robotPatternSwitch), ]), SizedBox(height: 20), ]), trailing: Icon(Icons.more_vert), )); }, )), )), Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Show Students Mistakes', style: TextStyle( fontSize: 15.0, // color: Colors.white, fontWeight: FontWeight.bold), ), SizedBox(width: 5), Checkbox( //title: const Text('Animate Slowly'), value: mistakesSwitch, onChanged: (bool value) { setState(() { mistakesSwitch = value; }); }, // secondary: const Icon(Icons.hourglass_empty), ), SizedBox(width: 300), Text( 'Show Students robot pattern', style: TextStyle( fontSize: 15.0, // color: Colors.white, fontWeight: FontWeight.bold), ), SizedBox(width: 5), Checkbox( value: robotPatternSwitch, onChanged: (bool value) { setState(() { robotPatternSwitch = value; }); }, // secondary: const Icon(Icons.hourglass_empty), ), ]), Row( // mainAxisSize: MainAxisSize.min, children: [ Expanded( child: MaterialButton( color: Colors.red, elevation: 0, onPressed: () { setState(() { if (pauseButtonText == 'Pause All') pauseButtonText = 'Resume All'; else pauseButtonText = 'Pause All'; }); for (int groupID = 0; groupID < thisClass.groups.length; groupID++) { if (pauseButtonText == 'Pause All') _database .reference() .child(thisClass.sessionID) .child('groups') .child(thisClass.groupIDs[groupID]) .child('isPaused') .set(false); if (pauseButtonText == 'Resume All') _database .reference() .child(thisClass.sessionID) .child('groups') .child(thisClass.groupIDs[groupID]) .child('isPaused') .set(true); } }, child: Container( padding: EdgeInsets.all(15.0), child: Text( pauseButtonText, textAlign: TextAlign.center, style: TextStyle( fontSize: 20.0, color: Colors.white, fontWeight: FontWeight.w500), ), ), ), ), Expanded( child: MaterialButton( color: Colors.blue, elevation: 0, onPressed: () { for (int groupID = 0; groupID < thisClass.groups.length; groupID++) { _database .reference() .child(thisClass.sessionID) .child('groups') .child(thisClass.groupIDs[groupID]) .child('currentActivity') .set('Ac8'); } }, child: Container( padding: EdgeInsets.all(15.0), child: Text( "Next Activity", textAlign: TextAlign.center, style: TextStyle( fontSize: 20.0, color: Colors.white, fontWeight: FontWeight.w500), ), ), ), ), ], ), ])); } } Widget minituare(int position, int turn, bool mistakesSwitch, bool rankingSwitch, bool robotpatternSwitch) { var colors = [Colors.grey, Colors.red, Colors.blue, Colors.green]; + List gridAcsPath = [ + 'assets/images/GridOnlyPositive.svg', + 'assets/images/Grid.svg' + ]; return Container( width: 130, height: 180, decoration: BoxDecoration( border: Border.all( width: 0.5, color: colors[ thisClass.groups[position].activities[0].progress[turn - 1] + 2])), child: Stack(children: [ Positioned( bottom: 65, right: 30, width: 90, height: 90, child: celluloMap( + gridAcsPath[ + acList.indexOf(thisClass.groups[position].currentActivity)], turn, robotpatternSwitch, thisClass .groups[position].activities[0].turns[turn - 1].cellulox.x, thisClass.groups[position].activities[0].turns[turn - 1] .celluloy.y)), Positioned( bottom: 155, right: 27, child: Text( ((turn > 1) ? ((turn > 2) ? 'Third ' : 'Second ') : 'First ') + "Turn ", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14), )), Positioned(bottom: 4, right: 50, child: Text(rankingSwitch ? "" : "")), Positioned( bottom: 25, right: 6, child: Text( mistakesSwitch ? (thisClass.groups[position].activities[0].progress[turn - 1] > -2 ? (thisClass.groups[position].activities[0].mistakes['slope'][turn - 1] == 0 && thisClass.groups[position].activities[0].mistakes['initialPoint'][turn - 1] == 0 ? 'No Mistakes' : (thisClass.groups[position].activities[0].mistakes['slope'][turn - 1] > 0 && thisClass.groups[position].activities[0] .mistakes['initialPoint'][turn - 1] > 0 ? 'Mistakes in finding\n Slope and\n Initial Points' : (thisClass.groups[position].activities[0].mistakes['slope'][turn - 1] > 0 && thisClass.groups[position].activities[0] .mistakes['initialPoint'][turn - 1] == 0 ? 'Mistakes in finding\n slope' : 'Mistakes in finding\n initial points'))) : '') : '', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14), ), ) ])); } diff --git a/Dashboard/lib/screens/groupDashboard.Dart b/Dashboard/lib/screens/groupDashboard.Dart index 7d28f20..764cced 100644 --- a/Dashboard/lib/screens/groupDashboard.Dart +++ b/Dashboard/lib/screens/groupDashboard.Dart @@ -1,551 +1,574 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:Teacher_Dashboard/widgets/custom_app_bar.dart'; import 'package:Teacher_Dashboard/widgets/celluloMap.Dart'; import 'dart:convert'; import 'package:Teacher_Dashboard/config/palette.dart'; import 'dart:async'; import 'package:Teacher_Dashboard/model/Class.dart'; import 'package:Teacher_Dashboard/model/Group.dart'; import 'package:Teacher_Dashboard/model/activities/activity.Dart'; import 'package:Teacher_Dashboard/config/palette.dart'; import 'package:firebase_database/firebase_database.dart'; import 'package:step_progress_indicator/step_progress_indicator.dart'; //import 'package:Teacher_Dashboard/model/core/models/productModel.dart'; //import 'package:Teacher_Dashboard/model/core/viewmodels/CRUDModel.dart'; import 'package:provider/provider.dart'; class GroupDashboard extends StatefulWidget { final int currentgroupID; GroupDashboard({Key key, this.currentgroupID}) : super(key: key); @override GroupDashboardState createState() => GroupDashboardState(); } class GroupDashboardState extends State { final TextStyle whiteText = TextStyle(color: Colors.white, fontSize: 20); Timer timer; final FirebaseDatabase _database = FirebaseDatabase.instance; var progress; int groupID = 0; int studentListIndex = 0; int activityID = 0; int activityListIndex = 0; int turnID = 0; + List gridAcsPath = [ + "assets/images/GridOnlyPositive.svg", + "assets/images/Grid.svg", + ]; double _currentSliderValue = 0; String pauseButtonText = 'Pause'; @override void initState() { super.initState(); if (widget.currentgroupID != null) groupID = widget.currentgroupID; } //@override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: CustomAppBar(), body: SingleChildScrollView( // padding: const EdgeInsets.all(10.0), child: Consumer( builder: (context, model, child) => Row(children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 200, decoration: BoxDecoration( color: Palette.primaryColor, border: Border.all(color: Colors.purple), // borderRadius: new BorderRadius.circular(25.0), ), child: Text( 'Groups', style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18), )), Container( height: 480, width: 200, // margin: const EdgeInsets.all(15.0), // padding: const EdgeInsets.all(10.0), decoration: BoxDecoration( color: Palette.primaryColor, border: Border.all(color: Colors.purple), // borderRadius: new BorderRadius.circular(25.0), ), child: ListView.builder( itemCount: thisClass.groups.length, itemBuilder: (context, int position) { return ListTile( leading: Icon( Icons.person, color: Colors.white, ), onTap: () { setState(() { studentListIndex = position; groupID = position; }); }, title: Text( thisClass.groups[position].id, style: TextStyle( color: (studentListIndex == position) ? Colors.blue : Colors.white, fontWeight: FontWeight.bold, fontSize: 18), ), ); })), Container( width: 200, decoration: BoxDecoration( color: Palette.primaryColor, border: Border.all(color: Colors.purple), // borderRadius: new BorderRadius.circular(25.0), ), child: Text( 'Activities', style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 18), )), Container( height: 350, width: 200, // margin: const EdgeInsets.all(15.0), // padding: const EdgeInsets.all(10.0), decoration: BoxDecoration( color: Palette.primaryColor, border: Border.all(color: Colors.purple), // borderRadius: new BorderRadius.circular(25.0), ), child: ListView.builder( itemCount: acList.length, itemBuilder: (context, int position) { return ListTile( leading: Icon( Icons.description, color: Colors.white, ), onTap: () { setState(() { activityListIndex = position; activityID = position; }); }, title: Text( acList[position], style: TextStyle( color: (activityListIndex == position) ? Colors.blue : Colors.white, fontWeight: FontWeight.bold, fontSize: 18), ), ); })) ]), SizedBox(width: 20), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 1, ), Row( // crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack(children: [ CircularStepProgressIndicator( totalSteps: 3, // currentStep: // thisClass.groups[position].activities[0].progress, width: 100, customColor: (index) => thisClass .groups[groupID] .activities[activityID] .progress[index] > -2 ? (thisClass .groups[groupID] .activities[activityID] .progress[index] > -1 ? (thisClass .groups[groupID] .activities[activityID] .progress[index] > 0 ? Colors.green : Colors.blue) : Colors.red) : Colors.grey, ), Positioned( bottom: 45, right: 18, child: Text( '', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 15), )), ]), SizedBox(width: 10), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon(Icons.group), Text( ' ' + thisClass.groups[groupID].id, style: TextStyle( fontSize: 30.0, color: Colors.black, fontWeight: FontWeight.w500), ), ], ), SizedBox(height: 25), Row( // crossAxisAlignment: CrossAxisAlignment.start, children: [ Row(children: [ Icon(Icons.person), Text( thisClass.groups[groupID].member1name, style: TextStyle( fontSize: 20.0, color: Colors.black, fontWeight: FontWeight.w500), ), ]), SizedBox(width: 20), Row(children: [ Icon(Icons.person), Text( thisClass.groups[groupID].member2name, style: TextStyle( fontSize: 20.0, color: Colors.black, fontWeight: FontWeight.w500), ), ]), SizedBox(width: 20), Row(children: [ Icon(Icons.person), Text( thisClass.groups[groupID].member3name, style: TextStyle( fontSize: 20.0, color: Colors.black, fontWeight: FontWeight.w500), ), ]) ]), ]), ]), SizedBox( height: 20, ), Container( width: 500, child: StepProgressIndicator( totalSteps: 50, // currentStep: thisClass.groups[position].inactivity.length, size: 10, padding: 0, customColor: (index) => Palette.primaryColor)), SizedBox( height: 20, ), Row( // mainAxisSize: MainAxisSize.min, children: [ infoTile( thisClass.groups[groupID].activities[activityID] .turns[turnID].numAttempts .toString(), 'Attempts', Colors.blue), infoTileTime( 'Performed in', thisClass.groups[groupID].activities[activityID] .turns[turnID].elapsedTime, Colors.blue), ]), Row( // mainAxisSize: MainAxisSize.min, children: [ Column( // mainAxisSize: MainAxisSize.min, children: [ Container( width: 400, height: 400, child: celluloMap( + gridAcsPath[activityID], turnID + 1, true, - thisClass.groups[groupID].activities[0] - .turns[turnID].cellulox.x, - thisClass.groups[groupID].activities[0] - .turns[turnID].celluloy.y)), + thisClass + .groups[groupID] + .activities[activityID] + .turns[turnID] + .cellulox + .x, + thisClass + .groups[groupID] + .activities[activityID] + .turns[turnID] + .celluloy + .y)), Text( ((turnID + 1 > 1) ? ((turnID + 1 > 2) ? 'Third ' : 'Second ') : 'First ') + "Turn ", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20), ), Slider( activeColor: Colors.purple, value: _currentSliderValue, min: 0, max: 200, // divisions: 5, // label: _currentSliderValue.round().toString(), onChanged: (double value) { setState(() { _currentSliderValue = value; }); }), ]), Column( // mainAxisSize: MainAxisSize.min, children: [ infoTile( thisClass .groups[groupID] .activities[activityID] .turns[turnID] .mistakes['slope'] .toString(), 'Mistakes in finding slope', Colors.blue), - infoTile( - thisClass - .groups[groupID] - .activities[activityID] - .turns[turnID] - .mistakes['initialPoint'] - .toString(), - 'Mistakes in finding initial Point', - Colors.blue), + (activityID == 0) + ? infoTile( + thisClass + .groups[groupID] + .activities[activityID] + .turns[turnID] + .mistakes['initialPoint'] + .toString(), + 'Mistakes in finding initial Point', + Colors.blue) + : infoTile( + thisClass + .groups[groupID] + .activities[activityID] + .turns[turnID] + .mistakes['intercept'] + .toString(), + 'Mistakes in finding intercept', + Colors.blue), ]) ]), Row( // mainAxisSize: MainAxisSize.min, children: [ SizedBox(width: 140), FloatingActionButton( heroTag: "prevButton", tooltip: 'Previous Turn', onPressed: () { if (turnID > 0) { print(thisClass .groups[groupID] .activities[activityID] .turns[turnID] .elapsedTime .toString()); setState(() { turnID = turnID - 1; }); } }, child: Icon(Icons.skip_previous), backgroundColor: Palette.primaryColor, ), SizedBox(width: 10), FloatingActionButton( heroTag: "nextButtton", tooltip: 'Next Turn', onPressed: () { if (turnID < 2) setState(() { turnID = turnID + 1; }); }, child: Icon(Icons.skip_next), backgroundColor: Palette.primaryColor, ), ]), SizedBox(height: 10), Row( // mainAxisSize: MainAxisSize.min, children: [ SizedBox(width: 125), Container( width: 200, child: MaterialButton( color: Colors.red, elevation: 0, onPressed: () { if (pauseButtonText == 'Pause') { pauseButtonText = 'Resume'; } else { pauseButtonText = 'Pause'; // dbRef.child("1").child("isPaused").set(true); } if (pauseButtonText == 'Pause') _database .reference() .child(thisClass.sessionID) .child('groups') .child(thisClass.groupIDs[groupID]) .child('isPaused') .set(false); if (pauseButtonText == 'Resume') _database .reference() .child(thisClass.sessionID) .child('groups') .child(thisClass.groupIDs[groupID]) .child('isPaused') .set(true); }, child: Container( padding: EdgeInsets.all(15.0), child: Text( pauseButtonText, textAlign: TextAlign.center, style: TextStyle( fontSize: 20.0, color: Colors.white, fontWeight: FontWeight.w500), ), ), ), ), SizedBox(width: 20), Container( width: 200, child: MaterialButton( color: Colors.blue, elevation: 0, onPressed: () { _database .reference() .child(thisClass.sessionID) .child('groups') .child(thisClass.groupIDs[groupID]) .child('currentActivity') .set('Ac8'); }, child: Container( padding: EdgeInsets.all(15.0), child: Text( "Next Activity", textAlign: TextAlign.center, style: TextStyle( fontSize: 20.0, color: Colors.white, fontWeight: FontWeight.w500), ), ), ), ), ], ) ], ), ]), // _progressBar(), ), )); } Container infoTile(String title, String count, MaterialColor color) { return Container( width: 120, // margin: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(10.0), decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(10.0), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: const TextStyle( color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold, ), ), Text( count, style: const TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.w600, ), ), ], ), ); } Container infoTileTime(String title, int count, MaterialColor color) { return Container( width: 220, // margin: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(10.0), decoration: BoxDecoration( color: color, // borderRadius: BorderRadius.circular(10.0), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: const TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.bold, ), ), Text( ((count > 60000) ? ((count / 60000).round().toString() + ' miutes') : '') + ' ' + ((count % 60000) / 1000).round().toString() + ' Seconds', style: const TextStyle( color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w600, ), ), ], ), ); } } diff --git a/Dashboard/lib/screens/home_screen.dart b/Dashboard/lib/screens/home_screen.dart index 938e30a..2bb85de 100644 --- a/Dashboard/lib/screens/home_screen.dart +++ b/Dashboard/lib/screens/home_screen.dart @@ -1,416 +1,416 @@ import 'package:Teacher_Dashboard/model/Class.dart'; import 'package:flutter/material.dart'; import 'package:Teacher_Dashboard/model/activities/activity.Dart'; import 'package:Teacher_Dashboard/model/core/services/api.dart'; import 'package:Teacher_Dashboard/config/palette.dart'; import 'package:Teacher_Dashboard/config/styles.dart'; import 'package:firebase_database/firebase_database.dart'; import 'package:Teacher_Dashboard/widgets/widgets.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'dart:convert'; import 'package:provider/provider.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_svg/flutter_svg.dart'; class HomeScreen extends StatefulWidget { @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State with SingleTickerProviderStateMixin { var isallgroupsconnected = false; Animation animation; AnimationController _controller; String numConnectedGroups = '0'; - String dropdownValue; + String startAcdropdownValue; final FirebaseDatabase _database = FirebaseDatabase.instance; // List products; @override void initState() { super.initState(); } Widget _title() { return RichText( textAlign: TextAlign.center, text: TextSpan( text: 'C', style: GoogleFonts.portLligatSans( textStyle: Theme.of(context).textTheme.display1, fontSize: 30, fontWeight: FontWeight.w700, color: Colors.white, ), children: [ TextSpan( text: 'ell', style: TextStyle(color: Colors.black, fontSize: 30), ), TextSpan( text: 'ulo', style: TextStyle(color: Colors.white, fontSize: 30), ), ]), ); } @override Widget build(BuildContext context) { // final productProvider = Provider.of(context); final screenHeight = MediaQuery.of(context).size.height; TextEditingController controllerSessionID = TextEditingController(); return Scaffold( appBar: CustomAppBar(), body: CustomScrollView( physics: ClampingScrollPhysics(), slivers: [ _overalClass(screenHeight), SliverToBoxAdapter( child: Column(children: [ SizedBox( height: 50, ), Padding( padding: EdgeInsets.symmetric(horizontal: 32), child: Material( elevation: 2.0, borderRadius: BorderRadius.all(Radius.circular(30)), child: TextField( controller: controllerSessionID, onChanged: (String value) {}, cursorColor: Colors.deepOrange, decoration: InputDecoration( hintText: "Session ID", prefixIcon: Material( elevation: 0, borderRadius: BorderRadius.all(Radius.circular(30)), child: Icon( Icons.lock, color: Palette.primaryColor, ), ), border: InputBorder.none, contentPadding: EdgeInsets.symmetric(horizontal: 25, vertical: 13)), ), ), ), SizedBox( height: 25, ), Padding( padding: EdgeInsets.symmetric(horizontal: 32), child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(100)), color: Palette.primaryColor), child: FlatButton( child: Text( "Join", style: TextStyle( color: Colors.white, fontWeight: FontWeight.w700, fontSize: 18), ), onPressed: () { thisClass.sessionID = controllerSessionID.text; thisClass.groups.clear(); // locator.registerLazySingleton(() => Api(Firestore.instance.collection('sessions').doc(controllerSessionID.text) thisClass.sessionID)); thisClass.setupDatabse(); }, ), )), SizedBox( height: 50, ), Padding( padding: EdgeInsets.symmetric(horizontal: 32), child: Container( width: 500, child: DropdownButton( hint: Text('Students start the session with activity: '), - value: dropdownValue, + value: startAcdropdownValue, icon: Icon(Icons.arrow_downward), iconSize: 24, elevation: 16, style: TextStyle(color: Colors.deepPurple), onChanged: (String newValue) { setState(() { - dropdownValue = newValue; + startAcdropdownValue = newValue; }); }, items: acList .map>((String value) { return DropdownMenuItem( value: value, child: Text(value), ); }).toList(), ))), SizedBox( height: 25, ), Padding( padding: EdgeInsets.symmetric(horizontal: 32), child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(100)), color: Palette.primaryColor), child: FlatButton( child: Text( "Start the session", style: TextStyle( color: Colors.white, fontWeight: FontWeight.w700, fontSize: 18), ), onPressed: () { for (int i = 0; i < thisClass.groups.length; i++) { _database .reference() .child(thisClass.sessionID) .child('groups') .child(thisClass.groupIDs[i]) .child('currentActivity') - .set('Ac7'); + .set(startAcdropdownValue); } }, ), )), ]), ), // _controlClass(screenHeight), // _recentAc(screenHeight), // _alarms(screenHeight), ], ), ); } SliverToBoxAdapter _controlClass(double screenHeight) { Color color1 = Color(0xffFC5CF0); Color color2 = Color(0xffFE8852); return SliverToBoxAdapter( child: Container( child: Stack( children: [ Container( padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 16.0), margin: const EdgeInsets.only( top: 30, left: 20.0, right: 20.0, bottom: 20.0), decoration: BoxDecoration( gradient: LinearGradient( colors: [color1, color2], ), borderRadius: BorderRadius.circular(30.0)), child: Row( children: [ Spacer(), ], ), ), Center( child: IconButton( color: Colors.white, icon: Icon(FontAwesomeIcons.pause), onPressed: () {}, tooltip: "Pause the student", )), ], ), )); } SliverToBoxAdapter _overalClass(double screenHeight) { return SliverToBoxAdapter( child: Container( padding: const EdgeInsets.all(20.0), decoration: BoxDecoration( gradient: LinearGradient( colors: [Color(0xFFAD9FE4), Palette.primaryColor], ), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(40.0), bottomRight: Radius.circular(40.0), ), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Center(child: Image.asset('assets/images/googleclass.png')), const SizedBox(height: 20.0), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ Consumer( builder: (context, model, child) => Text( thisClass.groups.length.toString(), style: const TextStyle( color: Colors.white, fontSize: 60.0, fontWeight: FontWeight.w500, ), textAlign: TextAlign.center, )), SizedBox(height: screenHeight * 0.015), Row( children: [ Icon(Icons.group, color: Colors.white), Text( " Connected Groups", style: const TextStyle( color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500, ), textAlign: TextAlign.center, ) ], ) ], ), Column( children: [ Text( '0', style: const TextStyle( color: Colors.white, fontSize: 60.0, fontWeight: FontWeight.w500, ), textAlign: TextAlign.center, ), SizedBox(height: screenHeight * 0.015), Row( children: [ SvgPicture.asset("assets/images/celluloWhite.svg", height: 30, width: 30), Text( " Connected Robots", style: const TextStyle( fontSize: 16.0, color: Colors.white, fontWeight: FontWeight.w500, ), textAlign: TextAlign.center, ) ], ), ], ), ].toList(), ), ], ), ), ); } SliverToBoxAdapter _recentAc(double screenHeight) { return SliverToBoxAdapter( child: Container( margin: const EdgeInsets.symmetric( vertical: 10.0, horizontal: 20.0, ), padding: const EdgeInsets.all(10.0), height: screenHeight * 0.15, decoration: BoxDecoration( gradient: LinearGradient( colors: [Color(0xFFAD9FE4), Palette.primaryColor], ), borderRadius: BorderRadius.circular(20.0), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Image.asset('assets/images/cellulo.png'), Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Do you want to see how many robots are working?', style: const TextStyle( color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold, ), ), SizedBox(height: screenHeight * 0.03), Text( 'Click on the button below', style: const TextStyle( color: Colors.white, fontSize: 16.0, ), maxLines: 2, ), ], ) ], ), ), ); } SliverToBoxAdapter _alarms(double screenHeight) { return SliverToBoxAdapter( child: Container( margin: const EdgeInsets.symmetric( vertical: 10.0, horizontal: 20.0, ), padding: const EdgeInsets.all(10.0), height: screenHeight * 0.15, decoration: BoxDecoration( gradient: LinearGradient( colors: [Color(0xFFAD9FE4), Palette.primaryColor], ), borderRadius: BorderRadius.circular(20.0), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Icon( Icons.alarm, color: Colors.red, size: 94.0, semanticLabel: 'Text to announce in accessibility modes', ), Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'One group has problem with robot', style: const TextStyle( color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold, ), ), SizedBox(height: screenHeight * 0.03), Text( 'One group is not progressing..For details press here', style: const TextStyle( color: Colors.white, fontSize: 16.0, ), maxLines: 2, ), ], ) ], ), ), ); } } diff --git a/Dashboard/lib/widgets/celluloMap.Dart b/Dashboard/lib/widgets/celluloMap.Dart index ded98bc..19279a9 100644 --- a/Dashboard/lib/widgets/celluloMap.Dart +++ b/Dashboard/lib/widgets/celluloMap.Dart @@ -1,33 +1,34 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:Teacher_Dashboard/widgets/linePainter.Dart'; Widget celluloMap( + String gridPath, int turn, bool robotpatternSwitch, List celluloxPositiontopaint, List celluloyPositiontopaint) { var imagespath = [ 'assets/images/function1.svg', 'assets/images/function2.svg', 'assets/images/function3.svg', 'assets/images/GridOnlyPositive.svg', ]; final double mapSizeWidth = 860; final double mapSizeHeight = 860; final double mapSizeScreenWidth = 90; final double mapSizeScreenHeight = 90; final double scaleWidth = mapSizeScreenWidth / mapSizeWidth; final double scaleHeight = mapSizeScreenHeight / mapSizeHeight; return Stack(children: [ SvgPicture.asset(imagespath[turn - 1]), - SvgPicture.asset("assets/images/GridOnlyPositive.svg"), + SvgPicture.asset(gridPath), robotpatternSwitch ? CustomPaint( size: Size(mapSizeScreenWidth, mapSizeScreenHeight), painter: LinePainter2(celluloxPositiontopaint, celluloyPositiontopaint), ) : Text(''), ]); } diff --git a/student/assets/images/Ac8_function2.svg b/student/assets/images/Ac8_function2.svg index 565e084..1cc6ef9 100644 --- a/student/assets/images/Ac8_function2.svg +++ b/student/assets/images/Ac8_function2.svg @@ -1,205 +1,205 @@ + id="svg8" + version="1.1" + viewBox="0 0 1100 1100" + height="1100mm" + width="1100mm"> + id="marker7634" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path7632" /> + id="Arrow1Sstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Sstart"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path2354" /> + id="marker4372" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4370" /> + id="marker4318" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4316" /> + id="marker4282" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4280" /> + id="Arrow2Sstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Sstart"> + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path2372" /> + id="Arrow1Lstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lstart"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path2342" /> + inkscape:snap-grids="true" + showgrid="false" + inkscape:current-layer="layer1" + inkscape:document-units="mm" + inkscape:cy="2341.807" + inkscape:cx="1829.563" + inkscape:zoom="0.24748738" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base"> + empcolor="#000000" + opacity="1" + color="#000000" + snapvisiblegridlinesonly="true" + visible="true" + units="mm" + spacingy="99.999997" + spacingx="99.999997" + originy="7.3436625e-18" + id="grid2319" + type="xygrid" /> image/svg+xml + inkscape:groupmode="layer" + inkscape:label="Layer 1"> - + + cy="46.999992" + cx="400" + id="path4643" + style="stroke-width:20;stroke-miterlimit:4;stroke-dasharray:none" /> + x="315.23215" + style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583" + xml:space="preserve" /> + id="path2321" + d="M 802.82699,-238.10528 636.8337,-72.761921 465.41212,104.18448 8.5848012,563.01552" + style="fill:none;fill-opacity:1;stroke:#ff475c;stroke-width:22.9309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.870588" /> diff --git a/student/assets/images/Grid.svg b/student/assets/images/Grid.svg index 599bc5f..cbe84c1 100644 --- a/student/assets/images/Grid.svg +++ b/student/assets/images/Grid.svg @@ -1,1658 +1,1658 @@ image/svg+xml 1 2 3 4 X Y 5 1 2 3 4 5 -1 -2 -3 -4 -5 -1 -2 -3 -4 -5 diff --git a/student/lib/Activities/Ac7.Dart b/student/lib/Activities/Ac7.Dart index 9eca692..976ddd3 100644 --- a/student/lib/Activities/Ac7.Dart +++ b/student/lib/Activities/Ac7.Dart @@ -1,794 +1,768 @@ import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:student/widgets/onlineRobotMap.Dart'; import 'dart:async'; import 'dart:convert'; import 'package:student/Database.dart'; import 'package:student/model/Group.dart'; import 'package:student/model/Cellulo.dart'; import 'package:student/widgets/showAlertDialog.Dart'; import 'package:student/widgets/membersBar.Dart'; import 'package:student/widgets/inactivityDetector.Dart'; import 'package:flutter_appavailability/flutter_appavailability.dart'; class Ac7 extends StatefulWidget { Ac7({Key key}) : super(key: key); @override _Ac7State createState() => _Ac7State(); } class _Ac7State extends State with SingleTickerProviderStateMixin, WidgetsBindingObserver { +// Timers + Timer timerCelluloPosition; Timer timerslopedetection; Timer timercleartracking; Timer timerprevCelluloPosition; Timer timerInactivityDetector; Timer timerprevCelluloPositiontoserver; final acID = 7; + + // UI parameters bool celluloxSwitch1 = true; bool celluloySwitch1 = false; bool celluloxSwitch2 = true; bool celluloySwitch2 = false; var onStop = false; bool mode = false; int wrongcounts = 0; double _progress = 0.0; final celluloSize = 60; final ScrollController _scrollController = ScrollController(); final functionFormulas = ['X ⟼ Y', 'X+1 ⟼ Y', 'X+2 ⟼ Y', '2*X ⟼ Y', '-X ⟼ Y']; Offset beginpath = Offset(0, 0); Offset endpath = Offset(10, 100); AnimationController controller; Animation animation; TextEditingController controllerinitialX = TextEditingController(); TextEditingController controllerinitialY = TextEditingController(); TextEditingController controllerXslope = TextEditingController(); TextEditingController controllerYslope = TextEditingController(); var counterfunctionImage = 0; var imagespath = [ 'assets/images/Ac7_function1.svg', 'assets/images/Ac7_function2.svg', 'assets/images/Ac7_function3.svg', 'assets/images/GridOnlyPositive.svg', ]; var onTap = [false, false, false, false, false]; // var onTap=[false,false,false,false,false]; final double mapSizeWidth = 860; final double mapSizeHeight = 860; var currentTurn = 1; var currentTap = 0; var tapCounter = 0; +// Learning + List progress = [0, -2, -2]; // zero: undergoing, -1: not accomplished, 1: accomplished bool waitforanimation = false; List mistakesSlope = [0, 0, 0]; List mistakesIntrepet = [0, 0, 0]; List mistakesInitialPosition = [0, 0, 0]; List progressElpasedTime = [0, 0, 0]; var inactivity = 0; var prevcelluloxPositionSlope = 0.0; var prevcelluloyPositionSlope = 0.0; // robot related var elapseTimer = new Stopwatch(); bool setRun = false; var celluloxPosition = [0.0, 0.0]; var celluloyPosition = [0.0, 0.0]; List celluloxPositiontopaint = [0.0, 0.0]; List celluloyPositiontopaint = [0.0, 0.0]; var prevcelluloxPosition = [0.0, 0.0]; var prevcelluloyPosition = [0.0, 0.0]; var initialPositionCellulox = [0.0, 0.0]; var initialPositionCelluloy = [0.0, 0.0]; // screen-related var originCoordinates = [303.08, 563.08]; var avgActivation = 0; int prevtotalTaps = 0; var correctAnswer = [ {"initialPointX": 0, "initialPointY": 0, "slope": 1}, {"initialPointX": 0, "initialPointY": 1, "slope": 1}, {"initialPointX": 0, "initialPointY": 0, "slope": 2} ]; Future getApps() async { List> _installedApps; _installedApps = await AppAvailability.getInstalledApps(); print(await AppAvailability.checkAvailability("com.android.chrome")); // Returns: Map{app_name: Chrome, package_name: com.android.chrome, versionCode: null, version_name: 55.0.2883.91} print(await AppAvailability.isAppEnabled("com.android.chrome")); // Returns: true } @override void initState() { WidgetsBinding.instance.addObserver(this); dbRef.child('groups').child(group.id).child('tabletStatus').set("YES"); dbRef.child('groups').child(group.id).child('currentActivity').set("Ac7"); elapseTimer.start(); onDataSend(); // getApps(); super.initState(); // group.numCurrentActivity = 7; cellulox.resetrobot(); celluloy.resetrobot(); timerCelluloPosition = new Timer.periodic(new Duration(milliseconds: 500), (time) { - cellulox.getrobotx().then((val) => setState(() { - celluloxPosition[0] = val; - if (setRun == true) celluloxPositiontopaint.add(val * 500 / 860); - - // print(setRun.toString()); - })); - cellulox.getroboty().then((val) => setState(() { - celluloxPosition[1] = val; - if (setRun == true) prevcelluloxPosition[1] = celluloxPosition[1]; - })); - celluloy.getrobotx().then((val) => setState(() { - celluloyPosition[0] = val; - if (setRun == true) prevcelluloyPosition[0] = celluloyPosition[0]; - })); - celluloy.getroboty().then((val) => setState(() { - celluloyPosition[1] = val; - if (setRun == true) celluloyPositiontopaint.add(val * 500 / 860); - })); - if (celluloxPosition[0] > 800 || celluloyPosition[1] > 800) { - cellulox.resetrobot(); - celluloy.resetrobot(); - } + if (totalRobots() > 1) { + cellulox.getrobotx().then((val) => setState(() { + celluloxPosition[0] = val; + if (setRun == true) celluloxPositiontopaint.add(val * 500 / 860); + + // print(setRun.toString()); + })); + cellulox.getroboty().then((val) => setState(() { + celluloxPosition[1] = val; + if (setRun == true) prevcelluloxPosition[1] = celluloxPosition[1]; + })); + celluloy.getrobotx().then((val) => setState(() { + celluloyPosition[0] = val; + if (setRun == true) prevcelluloyPosition[0] = celluloyPosition[0]; + })); + celluloy.getroboty().then((val) => setState(() { + celluloyPosition[1] = val; + if (setRun == true) celluloyPositiontopaint.add(val * 500 / 860); + })); + if (celluloxPosition[0] > 800 || celluloyPosition[1] > 800) { + cellulox.resetrobot(); + celluloy.resetrobot(); + } + } /* dbRef .child(group.id) .child("activity 8") .child("inactivity") .push() .set(inactivity); dbRef .child(group.id) .child("cellulox") .child("x") .push() .set(celluloxPosition); dbRef .child(group.id) .child("cellulox") .child("y") .push() .set(celluloxPosition); dbRef .child(group.id) .child("celluloy") .child("x") .push() .set(celluloyPosition); dbRef .child(group.id) .child("celluloy") .child("y") .push() .set(celluloyPosition); */ }); timerprevCelluloPositiontoserver = new Timer.periodic(new Duration(milliseconds: 400), (time) { if (setRun == true) { dbRef.child("celluloPosition").push().set(json.encode({ "x": celluloxPosition[0], "y": celluloyPosition[1], "acID": "Ac7", "turn": currentTurn, "groupID": group.id, })); } }); timerprevCelluloPosition = new Timer.periodic(new Duration(seconds: 40), (time) { setState(() { if (setRun == true) { prevcelluloxPosition[0] = celluloxPosition[0]; prevcelluloxPosition[1] = celluloxPosition[1]; prevcelluloyPosition[0] = celluloyPosition[0]; prevcelluloyPosition[1] = celluloyPosition[1]; } }); -/* - dbRef - .child(group.id) - .child("activity 8") - .child("inactivity") - .push() - .set(inactivity); - - dbRef - .child(group.id) - .child("cellulox") - .child("x") - .push() - .set(celluloxPosition); - - dbRef - .child(group.id) - .child("cellulox") - .child("y") - .push() - .set(celluloxPosition); - - dbRef - .child(group.id) - .child("celluloy") - .child("x") - .push() - .set(celluloyPosition); - - dbRef - .child(group.id) - .child("celluloy") - .child("y") - .push() - .set(celluloyPosition); - */ }); timerInactivityDetector = new Timer.periodic(new Duration(seconds: 60), (time) { onInactivityTimer(); }); controller = AnimationController( duration: Duration(milliseconds: 10000), vsync: this); /// /// Ask to be notified when messages related to the game /// are sent by the server /// } AppLifecycleState _notification; @override void didChangeAppLifecycleState(AppLifecycleState state) { print(state); if (state == AppLifecycleState.resumed) { dbRef.child('groups').child(group.id).child('tabletStatus').set("YES"); } else { dbRef.child('groups').child(group.id).child('tabletStatus').set("NO"); } setState(() { _notification = state; }); } void onDataSend() { dbRef.child('attempts').push().set(json.encode({ "numAttempts": tapCounter, "groupID": group.id, "acID": "Ac7", "elpasedTime": elapseTimer.elapsedMilliseconds - progressElpasedTime[currentTurn - 1], "progress": { "turn1": progress[0], "turn2": progress[1], "turn3": progress[2] }, "progressElpasedTime": { "turn1": progressElpasedTime[0], "turn2": progressElpasedTime[1], "turn3": progressElpasedTime[2], }, "currentTurn": currentTurn, "inactivity": inactivity, "mistakes": { "turn1": { "slope": mistakesSlope[0], "initialPoint": mistakesInitialPosition[0] }, "turn2": { "slope": mistakesSlope[1], "initialPoint": mistakesInitialPosition[1] }, "turn3": { "slope": mistakesSlope[2], "initialPoint": mistakesInitialPosition[2] }, } })); } void slopeDtectionTimer() { timerslopedetection = new Timer.periodic(new Duration(seconds: 1), (time) { print("prev" + (((celluloxPosition[0] - prevcelluloxPositionSlope).roundToDouble() > 0) .toString())); // print("currwnt" + celluloxPosition[0].toString()); controllerXslope.text = 1.0.toString(); if ((celluloxPosition[0] - prevcelluloxPositionSlope).abs() < 10) { controllerYslope.text = "You sould move the RED robot faster"; } else { controllerYslope.text = (((prevcelluloyPositionSlope - celluloyPosition[1])) / (celluloxPosition[0] - prevcelluloxPositionSlope)) .roundToDouble() .toString(); } prevcelluloxPositionSlope = celluloxPosition[0]; prevcelluloyPositionSlope = celluloyPosition[1]; // print(int.parse(controllerXslope.text) > 0); print("cur" + (((celluloxPosition[0] - prevcelluloxPositionSlope).roundToDouble() > 0) .toString())); if ((celluloxPosition[0] - prevcelluloxPositionSlope).roundToDouble() > 1) { setState(() { celluloxSwitch2 = true; print(celluloxSwitch2); }); } if (((celluloxPosition[0] - prevcelluloxPositionSlope) / 100) .roundToDouble() < -1) { setState(() { celluloxSwitch2 = false; print(celluloxSwitch2); }); } if (celluloyPosition[1] - prevcelluloyPositionSlope > 0) { setState(() { celluloySwitch2 = true; print(celluloySwitch2); }); } if (celluloyPosition[1] - prevcelluloyPositionSlope < 1.0) { setState(() { celluloySwitch2 = false; print(celluloySwitch2); }); } }); } void clearTrackingTimer() { timercleartracking = new Timer.periodic(new Duration(seconds: 5), (time) { cellulox.resetrobot(); celluloy.resetrobot(); setState(() { setRun = true; }); timercleartracking.cancel(); }); } void onInactivityTimer() { group.inactivity = group.inactivity + 1; dbRef.child('activation').push().set(json.encode({ "groupID": group.id, "acID": "Ac7", "elpasedTime": elapseTimer.elapsedMilliseconds, "inactivity": tapCounter - prevtotalTaps, })); prevtotalTaps = tapCounter; } @override void dispose() { WidgetsBinding.instance.removeObserver(this); timer.cancel(); super.dispose(); } void nextPLayer() { setState(() { currentTurn = currentTurn + 1; // celluloyPositiontopaint = [0.0, 0.0]; // celluloxPositiontopaint = [0.0, 0.0]; }); } void animationRunner(progress) { print(progress); if (progress < 0.4) { cellulox.setGoalPosition( originCoordinates[0] + 100 * int.parse(controllerinitialX.text), 600); celluloy.setGoalPosition( 100, originCoordinates[1] - 100 * int.parse(controllerinitialY.text)); } setState(() { setRun = true; }); if (progress > 0.6) { cellulox.setGoalPosition( originCoordinates[0] + 100 * int.parse(controllerinitialX.text) + 500, 600); celluloy.setGoalPosition( 100, originCoordinates[1] - 100 * int.parse(controllerinitialY.text) - 500); } if (celluloxPosition[0] > 800 || celluloyPosition[1] > 800) { cellulox.resetrobot(); celluloy.resetrobot(); } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Activity 7: Semi-Mathematical Control'), ), backgroundColor: Colors.white, body: SingleChildScrollView( child: Column(children: [ Card( child: ListTile( title: Text( 'Choose the two points that your robots start from there and also how much the blue robot should move. '), ), ), Container( margin: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(10.0), decoration: BoxDecoration( border: Border.all(color: Colors.blueAccent), borderRadius: new BorderRadius.circular(25.0), ), height: 230.0, child: Column(children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( width: 250, child: new TextFormField( controller: controllerinitialX, decoration: new InputDecoration( labelText: "RED starts at this position:", fillColor: Colors.red, border: new OutlineInputBorder( borderRadius: new BorderRadius.circular(25.0), borderSide: new BorderSide(), ), //fillColor: Colors.green ), validator: (val) { if (val.length == 0) { return "Email cannot be empty"; } else { return null; } }, keyboardType: TextInputType.text, style: new TextStyle( fontFamily: "Poppins", ), ), ), SizedBox(height: 10), Row(children: [ Container( width: 250, child: new TextFormField( enabled: false, // controller: controllerXslope, decoration: new InputDecoration( labelText: "When RED moves by 1", fillColor: Colors.red, border: new OutlineInputBorder( borderRadius: new BorderRadius.circular(25.0), borderSide: new BorderSide(), ), //fillColor: Colors.green ), validator: (val) { if (val.length == 0) { return "Email cannot be empty"; } else { return null; } }, keyboardType: TextInputType.text, style: new TextStyle( fontFamily: "Poppins", ), ), ), Column(children: [ Container( child: Switch( value: celluloxSwitch1, onChanged: (value) { setState(() { // celluloxSwitch1 = value; }); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, inactiveTrackColor: Colors.lightGreenAccent, inactiveThumbColor: Colors.green, )), Text(celluloxSwitch1 ? 'Right' : 'Left') ]), ]), ]), SizedBox( width: 8, ), Column( // mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: 250, child: new TextFormField( controller: controllerinitialY, decoration: new InputDecoration( labelText: "BLUE starts at this position:", fillColor: Colors.blue, border: new OutlineInputBorder( borderRadius: new BorderRadius.circular(25.0), borderSide: new BorderSide(), ), //fillColor: Colors.green ), validator: (val) { if (val.length == 0) { return "Email cannot be empty"; } else { return null; } }, keyboardType: TextInputType.text, style: new TextStyle( fontFamily: "Poppins", ), ), ), SizedBox(height: 10), Row(children: [ Container( width: 250, child: new TextFormField( controller: controllerYslope, decoration: new InputDecoration( labelText: "Then Blue should move by:", fillColor: Colors.blue, border: new OutlineInputBorder( borderRadius: new BorderRadius.circular(25.0), borderSide: new BorderSide(), ), //fillColor: Colors.green ), validator: (val) { if (val.length == 0) { return "Email cannot be empty"; } else { return null; } }, keyboardType: TextInputType.text, style: new TextStyle( fontFamily: "Poppins", ), )), Column(children: [ RotatedBox( quarterTurns: 1, child: Switch( value: celluloySwitch1, onChanged: (value) { setState(() { celluloySwitch1 = value; }); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, inactiveTrackColor: Colors.lightGreenAccent, inactiveThumbColor: Colors.green, )), Text(celluloySwitch1 ? 'Down' : 'Up') ]), ]) ]), ]), SizedBox( height: 5, ), Row(mainAxisAlignment: MainAxisAlignment.center, children: < Widget>[ FloatingActionButton( heroTag: "btn2", tooltip: 'Run the Robots', onPressed: () => { tapCounter = tapCounter + 1, // avgActivation= if (controllerinitialX.text != correctAnswer[currentTurn - 1]['initialPointX'] .toString() || controllerinitialY.text != correctAnswer[currentTurn - 1]['initialPointY'] .toString()) { mistakesInitialPosition[currentTurn - 1] = mistakesInitialPosition[currentTurn - 1] + 1, }, if (controllerYslope.text != correctAnswer[currentTurn - 1]['slope'].toString()) { mistakesSlope[currentTurn - 1] = mistakesSlope[currentTurn - 1] + 1, }, if (controllerinitialX.text == correctAnswer[currentTurn - 1] ['initialPointX'] .toString() && controllerinitialY.text == correctAnswer[currentTurn - 1]['initialPointY'] .toString() && controllerYslope.text == correctAnswer[currentTurn - 1]['slope'] .toString()) { progress[currentTurn - 1] = 1, }, onDataSend(), controller.reset(), animation = Tween(begin: 0.0, end: 1.0).animate( controller) ..addListener(() { _progress = animation.value; if (_progress < 0.4) { cellulox.setGoalPosition( originCoordinates[0] + 100 * int.parse(controllerinitialX.text), 600); celluloy.setGoalPosition( 100, originCoordinates[1] - 100 * int.parse(controllerinitialY.text)); } if (_progress > 0.6) { setState(() { setRun = true; }); cellulox.setGoalPosition( originCoordinates[0] + 100 * int.parse(controllerinitialX.text) + 300, 600); celluloy.setGoalPosition( 100, originCoordinates[1] - 100 * int.parse(controllerinitialY.text) - 150); } if (celluloxPosition[0] > 800 || celluloyPosition[1] > 800) { cellulox.resetrobot(); celluloy.resetrobot(); } }), controller.forward(), }, child: Icon(Icons.play_circle_outline), ), SizedBox(width: 20), FloatingActionButton( heroTag: "btn1", tooltip: 'Next Turn', onPressed: () => { setState(() { tapCounter = 0; currentTurn = currentTurn + 1; if (currentTurn == 2) { progressElpasedTime[0] = elapseTimer.elapsedMilliseconds; } else { progressElpasedTime[currentTurn - 2] = elapseTimer.elapsedMilliseconds - progressElpasedTime[currentTurn - 3]; } }), if (progress[currentTurn - 2] == 0) progress[currentTurn - 2] = -1, if (currentTurn < 4) { celluloxPositiontopaint = [0, 0], celluloyPositiontopaint = [0, 0], controller.reset(), setRun = false, progress[currentTurn - 1] = 0, onDataSend(), } // _ackAlert, // showAlertDialog(context, '', 'Now its next player turn'), }, child: Icon(Icons.navigate_next), ), ]), ])), SizedBox( height: 5, ), celluloMap(context), SizedBox( height: 15, ), - MembersBar(), + MembersBar( + curTurn: currentTurn, + ), ]))); } Widget celluloMap(BuildContext context) { final double mapSizeScreenWidth = 500; final double mapSizeScreenHeight = 500; final double scaleWidth = mapSizeScreenWidth / mapSizeWidth; final double scaleHeight = mapSizeScreenHeight / mapSizeHeight; return Container( height: mapSizeScreenWidth, width: mapSizeScreenHeight, decoration: BoxDecoration(border: Border.all(color: Colors.blueAccent)), child: Stack(children: [ Container( height: mapSizeScreenWidth, width: mapSizeScreenHeight, child: SvgPicture.asset(imagespath[currentTurn - 1])), Container( height: mapSizeScreenWidth, width: mapSizeScreenHeight, child: SvgPicture.asset("assets/images/GridOnlyPositive.svg")), Align( alignment: Alignment( 2 * (celluloxPosition[0] * scaleWidth / mapSizeScreenWidth) - 1, 1), child: Card( child: SvgPicture.asset("assets/images/cellulox.svg", height: 60, width: 60), ), ), Align( alignment: Alignment( -1, 2 * (celluloyPosition[1] * scaleHeight / mapSizeScreenHeight) - 1), child: Card( child: SvgPicture.asset("assets/images/celluloy.svg", height: 60, width: 60), ), ), CustomPaint( size: Size(mapSizeScreenWidth, mapSizeScreenHeight), painter: LinePainter2(celluloxPositiontopaint, celluloyPositiontopaint), ), ])); } } diff --git a/student/lib/Activities/Ac8.Dart b/student/lib/Activities/Ac8.Dart index 4385cff..ecf84ec 100644 --- a/student/lib/Activities/Ac8.Dart +++ b/student/lib/Activities/Ac8.Dart @@ -1,664 +1,376 @@ import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; -import 'package:student/SoCKet.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'dart:convert'; import 'dart:core'; import 'package:student/widgets/linePainter.Dart'; import 'dart:async'; import 'package:student/Data/data.dart'; import 'package:student/Database.dart'; import 'package:student/model/Group.dart'; import 'package:student/widgets/showAlertDialog.Dart'; +import 'package:student/widgets/membersBar.Dart'; class Ac8 extends StatefulWidget { Ac8({Key key}) : super(key: key); @override _Ac8State createState() => _Ac8State(); } class _Ac8State extends State with SingleTickerProviderStateMixin { + //Learning Parameters + + // UI parameters + + // Cellulo Simulation Parameters + Timer timer; final acID = 8; + final acIDstring = 'Ac8'; var onStop = false; int wrongcounts = 0; double _progress = 0.0; final celluloSize = 60; final ScrollController _scrollController = ScrollController(); final functionFormulas = ['X ⟼ Y', 'X+1 ⟼ Y', 'X+2 ⟼ Y', '2*X ⟼ Y', '-X ⟼ Y']; Offset beginpath = Offset(0, 0); Offset endpath = Offset(10, 100); + List beginpathlist = [ + Offset(150, 430), + Offset(100, 432), + Offset(100, 390), + Offset(215, 490), + Offset(110, 50), + ]; + List endpathlist = [ + Offset(540, 40), + Offset(480, 52), + Offset(480, 10), + Offset(425, 40), + Offset(500, 430), + ]; AnimationController controller; Animation animation; TextEditingController controller1 = TextEditingController(); TextEditingController controller2 = TextEditingController(); TextEditingController controller3 = TextEditingController(); - + List mistakesSlope = [0, 0, 0]; + List mistakesIntrepet = [0, 0, 0]; + List mistakesInitialPosition = [0, 0, 0]; + List progressElpasedTime = [0, 0, 0]; var counterfunctionImage = 0; var imagespath = [ 'assets/images/Ac8_function1.svg', 'assets/images/Ac8_function2.svg', 'assets/images/Ac8_function3.svg', 'assets/images/Grid.svg', ]; var correctAnswer = [ 1, 3, 4, 1, ]; var onTap = [false, false, false, false, false]; // var onTap=[false,false,false,false,false]; var currentTurn = 1; var currentTap = 0; var tapCounter = 0; - var progress = 0; + List progress = [0, -2, -2]; bool waitforanimation = false; var mistakesSlopematrix = [ [0, 0, 0, 1, 1], [0, 0, 0, 1, 1], [1, 1, 1, 0, 1] ]; var mistakesIntrepetmatrix = [ [0, 1, 1, 0, 0], [1, 1, 0, 1, 1], [0, 1, 1, 0, 0] ]; - var mistakesSlope = 0; - var mistakesIntrepet = 0; + var inactivity = 0; var elapseTimer = new Stopwatch(); @override void initState() { elapseTimer.start(); - + dbRef.child('groups').child(group.id).child('tabletStatus').set("YES"); + dbRef.child('groups').child(group.id).child('currentActivity').set("Ac8"); super.initState(); // group.numCurrentActivity = 8; controller = AnimationController( duration: Duration(milliseconds: 10000), vsync: this); /// /// Ask to be notified when messages related to the game /// are sent by the server /// inactivityDtectionTimer(); } @override void dispose() { elapseTimer.stop(); timer.cancel(); super.dispose(); } + void onDataSend() { + print(mistakesSlope); + dbRef.child('attempts').push().set(json.encode({ + "numAttempts": tapCounter, + "groupID": group.id, + "acID": acIDstring, + "elpasedTime": elapseTimer.elapsedMilliseconds - + progressElpasedTime[currentTurn - 1], + "progress": { + "turn1": progress[0], + "turn2": progress[1], + "turn3": progress[2] + }, + "progressElpasedTime": { + "turn1": progressElpasedTime[0], + "turn2": progressElpasedTime[1], + "turn3": progressElpasedTime[2], + }, + "currentTurn": currentTurn, + "mistakes": { + "turn1": { + "slope": mistakesSlope[0], + "initialPoint": mistakesInitialPosition[0], + "intercept": mistakesIntrepet[0] + }, + "turn2": { + "slope": mistakesSlope[1], + "initialPoint": mistakesInitialPosition[1], + "intercept": mistakesIntrepet[1] + }, + "turn3": { + "slope": mistakesSlope[2], + "initialPoint": mistakesInitialPosition[2], + "intercept": mistakesIntrepet[2] + }, + } + })); + } + _onCorrectAnswer(BuildContext context) { if (currentTurn <= 2) { showAlertDialog(context, 'Congrats', 'your answer was correct. Now its next player turn'); } + progress[currentTurn - 1] = 1; + progress[currentTurn] = 0; currentTurn = currentTurn + 1; if (currentTurn >= 4) { - showAlertDialog(context, 'The Game Finished', ''); + showAlertDialog(context, 'The Game has Finished', ''); - Navigator.pushNamed(context, '/second'); + // Navigator.pushNamed(context, '/second'); } onTap = [false, false, false, false, false]; } _onWrongAnswer(BuildContext context) { // _onCorrectAnswer(); // play the animation // go to next player debugPrint("wroganswer"); wrongcounts = 0; // debugPrint(currentTurn.toString()); // currentTurn = currentTurn + 1; if (currentTurn >= 4) { //currentTurn = 1; } // debugPrint(currentTurn.toString()); } - void onDataSend() { - dbRef.child('attempts').push().set(json.encode({ - "numAttempts": tapCounter, - "groupID": group.id, - "acID": "Ac8", - "elpasedTime": elapseTimer.elapsedMilliseconds, - "progress": progress, - "inactivity": inactivity - })); - } - void inactivityDtectionTimer() { timer = new Timer.periodic(new Duration(seconds: 10), (time) { inactivity = inactivity + 1; // dbRefonTapAll // .child(group.id) // .child("activity 8") //.child("inactivity") // .push() // .set(inactivity); }); // Start the periodic timer which prints something every 1 seconds } Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Cellulo Game'), ), backgroundColor: Colors.white, body: Builder( builder: (context) => Column(children: [ + Card( + child: ListTile( + title: Text( + 'Choose the option that describes the red line, you have only THREE attempts:'), + ), + ), Container( margin: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(3.0), decoration: BoxDecoration( border: Border.all(color: Colors.blueAccent)), height: 250.0, child: Scrollbar( controller: _scrollController, isAlwaysShown: true, - child: ListView( + child: Container( + child: ListView.builder( controller: _scrollController, - children: [ - Card( - child: ListTile( - title: Text( - 'Choose the option that describes the red line, you have only THREE attempts:'), - ), - ), - Card( + itemCount: 5, + itemBuilder: (context, int position) { + return Card( child: ListTile( onTap: () { if (!waitforanimation) { // Find the Scaffold in the widget tree and use // it to show a SnackBar. - timer.cancel(); - inactivityDtectionTimer(); - currentTap = 1; - inactivity = inactivity - 1; + // timer.cancel(); + // inactivityDtectionTimer(); + currentTap = position + 1; + //inactivity = inactivity - 1; onTap[currentTap - 1] = true; - beginpath = Offset(150, 430); - endpath = Offset(540, 40); + beginpath = beginpathlist[position]; + endpath = endpathlist[position]; controller.reset(); tapCounter = tapCounter + 1; - onDataSend(); - if (currentTap == - correctAnswer[currentTurn - 1]) { - wrongcounts = wrongcounts + 1; - } - if (wrongcounts == 3) { - _onWrongAnswer(context); - } - animation = Tween(begin: 0.0, end: 1.0) - .animate(controller) - ..addListener(() { - setState(() { - _progress = animation.value; - }); - }) - ..addStatusListener( - (AnimationStatus status) { - if (status == - AnimationStatus.completed) { - waitforanimation = false; - if (currentTap == - correctAnswer[ - currentTurn - 1]) { - _onCorrectAnswer(context); - // controller.reverse(); - endpath = beginpath; - } - //print('completed'); - } else { - waitforanimation = true; - } - }); - controller.forward(); - mistakesSlope = mistakesSlope + - mistakesSlopematrix[currentTurn - 1] - [currentTap - 1]; - mistakesIntrepet = mistakesIntrepet + - mistakesIntrepetmatrix[currentTurn - 1] - [currentTap - 1]; - - setState(() {}); - } - }, - leading: (currentTap == 1) - ? (_progress > 0 && _progress < 1) - ? Icon(Icons.pause_circle_filled) - : Icon(Icons.play_circle_filled) - : Icon(Icons.play_circle_filled), - title: Text(functionFormulas[0], - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - )), - trailing: onTap[0] - ? (currentTurn == 1) - ? Icon(Icons.check_circle) - : Icon(Icons.cancel) - : Icon(Icons.more_vert), - ), - ), - Card( - child: ListTile( - onTap: () { - if (!waitforanimation) { - currentTap = 2; - inactivity = inactivity - 1; - timer.cancel(); - inactivityDtectionTimer(); - onTap[currentTap - 1] = true; - beginpath = Offset(100, 432); - endpath = Offset(480, 52); - tapCounter = tapCounter + 1; - onDataSend(); if (currentTap == correctAnswer[currentTurn - 1]) { wrongcounts = wrongcounts + 1; } - if (wrongcounts == 3) { _onWrongAnswer(context); } - controller.reset(); animation = Tween(begin: 0.0, end: 1.0) .animate(controller) ..addListener(() { setState(() { _progress = animation.value; }); }) ..addStatusListener( (AnimationStatus status) { if (status == AnimationStatus.completed) { waitforanimation = false; if (currentTap == correctAnswer[ currentTurn - 1]) { _onCorrectAnswer(context); // controller.reverse(); endpath = beginpath; } //print('completed'); } else { waitforanimation = true; } }); - controller.forward(); - mistakesSlope = mistakesSlope + - mistakesSlopematrix[currentTurn - 1] - [currentTap - 1]; - mistakesIntrepet = mistakesIntrepet + - mistakesIntrepetmatrix[currentTurn - 1] - [currentTap - 1]; + mistakesSlope[currentTurn - 1] = + mistakesSlope[currentTurn - 1] + + mistakesSlopematrix[currentTurn - 1] + [currentTap - 1]; + mistakesIntrepet[currentTurn - 1] = + mistakesIntrepet[currentTurn - 1] + + mistakesIntrepetmatrix[currentTurn - + 1][currentTap - 1]; setState(() {}); - } - }, - leading: (currentTap == 2) - ? (_progress > 0 && _progress < 1) - ? Icon(Icons.pause_circle_filled) - : Icon(Icons.play_circle_filled) - : Icon(Icons.play_circle_filled), - title: Text(functionFormulas[1], - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - )), - trailing: onTap[1] - ? (true - ? Icon(Icons.cancel) - : Icon(Icons.cancel)) - : Icon(Icons.more_vert), - ), - ), - Card( - child: ListTile( - onTap: () { - if (!waitforanimation) { - currentTap = 3; - timer.cancel(); - inactivityDtectionTimer(); - inactivity = inactivity - 1; - onTap[currentTap - 1] = true; - beginpath = Offset(100, 390); - endpath = Offset(480, 10); - controller.reset(); - tapCounter = tapCounter + 1; onDataSend(); - if (currentTap == - correctAnswer[currentTurn - 1]) { - wrongcounts = wrongcounts + 1; - } - - if (wrongcounts == 3) { - _onWrongAnswer(context); - } - animation = Tween(begin: 0.0, end: 1.0) - .animate(controller) - ..addListener(() { - setState(() { - _progress = animation.value; - }); - }) - ..addStatusListener( - (AnimationStatus status) { - if (status == - AnimationStatus.completed) { - waitforanimation = false; - if (currentTap == - correctAnswer[ - currentTurn - 1]) { - _onCorrectAnswer(context); - // controller.reverse(); - endpath = beginpath; - } - //print('completed'); - } else { - waitforanimation = true; - } - }); - controller.forward(); - mistakesSlope = mistakesSlope + - mistakesSlopematrix[currentTurn - 1] - [currentTap - 1]; - mistakesIntrepet = mistakesIntrepet + - mistakesIntrepetmatrix[currentTurn - 1] - [currentTap - 1]; - - setState(() {}); - /* react to the tile being tapped */ } }, - leading: (currentTap == 3) + leading: (currentTap == position + 1) ? (_progress > 0 && _progress < 1) ? Icon(Icons.pause_circle_filled) : Icon(Icons.play_circle_filled) : Icon(Icons.play_circle_filled), - title: Text(functionFormulas[2], + title: Text(functionFormulas[position], style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20, )), - trailing: onTap[2] - ? (currentTurn == 2) + trailing: onTap[position] + ? (currentTap == + correctAnswer[currentTurn - 1]) ? Icon(Icons.check_circle) : Icon(Icons.cancel) : Icon(Icons.more_vert), ), - ), - Card( - child: ListTile( - onTap: () { - if (!waitforanimation) { - currentTap = 4; - timer.cancel(); - tapCounter = tapCounter + 1; - onDataSend(); - if (currentTap == - correctAnswer[currentTurn - 1]) { - wrongcounts = wrongcounts + 1; - } - - if (wrongcounts == 3) { - _onWrongAnswer(context); - } - inactivityDtectionTimer(); - inactivity = inactivity - 1; - onTap[currentTap - 1] = true; - beginpath = Offset(215, 490); - endpath = Offset(425, 40); - controller.reset(); - animation = Tween(begin: 0.0, end: 1.0) - .animate(controller) - ..addListener(() { - setState(() { - _progress = animation.value; - }); - }) - ..addStatusListener( - (AnimationStatus status) { - if (status == - AnimationStatus.completed) { - waitforanimation = false; - if (currentTap == - correctAnswer[ - currentTurn - 1]) { - _onCorrectAnswer(context); - // controller.reverse(); - endpath = beginpath; - } - //print('completed'); - } else { - waitforanimation = true; - } - }); - controller.forward(); - mistakesSlope = mistakesSlope + - mistakesSlopematrix[currentTurn - 1] - [currentTap - 1]; - mistakesIntrepet = mistakesIntrepet + - mistakesIntrepetmatrix[currentTurn - 1] - [currentTap - 1]; - - setState(() {}); - /* react to the tile being tapped */ - } - }, - leading: (currentTap == 4) - ? (_progress > 0 && _progress < 1) - ? Icon(Icons.pause_circle_filled) - : Icon(Icons.play_circle_filled) - : Icon(Icons.play_circle_filled), - title: Text(functionFormulas[3], - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - )), - trailing: onTap[3] - ? ((currentTurn == 3) - ? Icon(Icons.check_circle) - : Icon(Icons.cancel)) - : Icon(Icons.more_vert), - ), - ), - Card( - child: ListTile( - onTap: () { - if (!waitforanimation) { - currentTap = 5; - inactivity = inactivity - 1; - timer.cancel(); - inactivityDtectionTimer(); - onTap[currentTap - 1] = true; - beginpath = Offset(110, 50); - endpath = Offset(500, 430); - controller.reset(); - tapCounter = tapCounter + 1; - onDataSend(); - if (currentTap == - correctAnswer[currentTurn - 1]) { - wrongcounts = wrongcounts + 1; - } - - if (wrongcounts == 3) { - _onWrongAnswer(context); - } - animation = Tween(begin: 0.0, end: 1.0) - .animate(controller) - ..addListener(() { - setState(() { - _progress = animation.value; - }); - }) - ..addStatusListener( - (AnimationStatus status) { - if (status == - AnimationStatus.completed) { - waitforanimation = false; - - if (currentTap == - correctAnswer[ - currentTurn - 1]) { - _onCorrectAnswer(context); - // controller.reverse(); - endpath = beginpath; - } - //print('completed'); - } else { - waitforanimation = true; - } - }); - controller.forward(); - /* react to the tile being tapped */ - - mistakesSlope = mistakesSlope + - mistakesSlopematrix[currentTurn - 1] - [currentTap - 1]; - mistakesIntrepet = mistakesIntrepet + - mistakesIntrepetmatrix[currentTurn - 1] - [currentTap - 1]; - - setState(() {}); - } - }, - leading: (currentTap == 5) - ? (_progress > 0 && _progress < 1) - ? Icon(Icons.pause_circle_filled) - : Icon(Icons.play_circle_filled) - : Icon(Icons.play_circle_filled), - title: Text(functionFormulas[4], - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - )), - trailing: onTap[4] - ? (true - ? Icon(Icons.cancel) - : Icon(Icons.cancel)) - : Icon(Icons.more_vert), - ), - ), - ], - )), + ); + }, + ))), ), SizedBox( height: 20, ), Container( height: 500, width: 700, decoration: BoxDecoration( border: Border.all(color: Colors.blueAccent)), child: Stack(children: [ Container( height: 500, width: 700, child: SvgPicture.asset(imagespath[currentTurn - 1])), Container( height: 500, width: 700, child: SvgPicture.asset("assets/images/Grid.svg")), Align( alignment: Alignment( 2 * (beginpath.dx + _progress * (endpath.dx - beginpath.dx)) / 700 - 1, 0), child: Card( child: SvgPicture.asset( "assets/images/cellulox.svg", height: 60, width: 60), ), ), Align( alignment: Alignment( -0.07, 2 * (beginpath.dy + _progress * (endpath.dy - beginpath.dy)) / 500 - 1), child: Card( child: SvgPicture.asset( "assets/images/celluloy.svg", height: 60, width: 60), ), ), CustomPaint( size: Size(300, 500), painter: LinePainter(_progress, beginpath, endpath), ), ])), SizedBox( height: 20, ), - Container( - height: 50, - width: 700, - decoration: BoxDecoration( - border: Border.all(color: Colors.blueAccent)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Icon(Icons.person), - Text( - groupsNames[0]['mem1'], - style: const TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.w600, - ), - ), - SizedBox(width: 20), - Icon(Icons.person), - Text( - groupsNames[0]['mem2'], - style: const TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.w600, - ), - ), - SizedBox(width: 20), - Icon(Icons.person), - Text( - groupsNames[0]['mem3'], - style: const TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.w600, - ), - ), - Text( - '', - style: const TextStyle( - color: Colors.white70, - fontSize: 15.0, - ), - ), - SizedBox(height: 40), - ], - ), + MembersBar( + curTurn: currentTurn, ), ]))); } } diff --git a/student/lib/Activities/templateAc.Dart b/student/lib/Activities/templateAc.Dart index ffa50c7..47eaf3a 100644 --- a/student/lib/Activities/templateAc.Dart +++ b/student/lib/Activities/templateAc.Dart @@ -1,35 +1,53 @@ import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:student/widgets/onlineRobotMap.Dart'; import 'dart:async'; import 'dart:convert'; import 'package:student/Database.dart'; import 'package:student/model/Group.dart'; import 'package:student/model/Cellulo.dart'; import 'package:student/widgets/showAlertDialog.Dart'; import 'package:student/widgets/membersBar.Dart'; import 'package:student/widgets/inactivityDetector.Dart'; import 'package:flutter_appavailability/flutter_appavailability.dart'; class TempAc extends StatefulWidget { TempAc({Key key}) : super(key: key); @override _TempAcState createState() => _TempAcState(); } class _TempAcState extends State { + var elapseTimer = new Stopwatch(); + @override void initState() { - // elapseTimer.start(); + dbRef.child('groups').child(group.id).child('tabletStatus').set("YES"); + dbRef.child('groups').child(group.id).child('currentActivity').set("Ac7"); + elapseTimer.start(); } @override void dispose() { + elapseTimer.stop(); super.dispose(); } @override - Widget build(BuildContext context) {} + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Activity 7: Semi-Mathematical Control'), + ), + backgroundColor: Colors.white, + body: SingleChildScrollView( + child: Column(children: [ + SizedBox( + height: 15, + ), + MembersBar(), + ]))); + } } diff --git a/student/lib/model/Group.dart b/student/lib/model/Group.dart index 9662a78..efa92b2 100644 --- a/student/lib/model/Group.dart +++ b/student/lib/model/Group.dart @@ -1,95 +1,106 @@ import 'package:firebase_database/firebase_database.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:student/model/Cellulo.dart'; import 'package:provider/provider.dart'; import 'dart:async'; import 'dart:convert'; +import 'package:student/widgets/showAlertDialog.Dart'; Group group = new Group("1", "", "", ""); class Group extends ChangeNotifier { String sessionID = 'test'; String id = "1"; String tabletStatus = 'YES'; // String _title; // String _description; int inactivity = 0; String member1name; String member2name; String member3name; int robot1code = 0; int robot2code = 0; bool ispaused = false; Cellulo cellulox; Cellulo celluloy; String currentActivity = 'Ac7'; String robotName = "Cellulo"; final GlobalKey navigatorKeygame = new GlobalKey(); final FirebaseDatabase _database = FirebaseDatabase.instance; StreamSubscription _ongroupChangedSubscription; StreamSubscription _onattemptAddedSubscription; // Time timeJoined; Group(this.id, this.member1name, this.member2name, this.member3name); void switchactivity() { - navigatorKeygame.currentState.pushNamed(group.currentActivity); + navigatorKeygame.currentState.pushReplacementNamed(group.currentActivity); } void setupDatabse() { _ongroupChangedSubscription = _database .reference() .child(group.sessionID) .child("groups") .child(group.id) .onChildChanged .listen(onGroupChanged); //Query _todoQuery; } onGroupChanged(Event event) { //thisClass.groups.add(Group.fromSnapshot(event.snapshot)); // group.ispaused = (event.snapshot.value)[ // 'isPaused']; // print("group" + currentGroup.toString().toString()); if (event.snapshot.key == 'currentActivity') group.currentActivity = ((event.snapshot.value)); - if (event.snapshot.key == 'isPaused') + if (event.snapshot.key == 'isPaused') { + // navigatorKeygame.currentState.pushReplacementNamed(group.currentActivity); group.ispaused = ((event.snapshot.value)); + if (group.ispaused == true) { + showPauseDialog(navigatorKeygame.currentState.context); + } + // if (group.ispaused == false) { + // Navigator.of(navigatorKeygame.currentState.overlay.context, + // rootNavigator: true) + // .pop(); + // } + } // setState(() {}); notifyListeners(); group.switchactivity(); } toJson() { return { "member1name": member1name, "member2name": member2name, "member3name": member3name, "robotName": robotName, "robot1code": robot1code, "robot2code": robot2code, "currentActivity": currentActivity, "tabletStatus": tabletStatus, "isPaused": ispaused, //"inactivity": inactivity, "id": id, //"Ac8": {"progress": 0, "mistaesSlope": 0, "mistaesIntercept": 0}, //"Ac7": {"progress": 0, "mistaesSlope": 0, "mistaesIntercept": 0}, //"cellulox": {"x": 0, "y": 0, "tetha": 0}, //"celluloy": {"x": 0, "y": 0, "tetha": 0} }; } Group.fromSnapshot(DataSnapshot snapshot) { // _id = snapshot.key; member1name = snapshot.value['member1name']; member2name = snapshot.value['member2name']; member3name = snapshot.value['member3name']; } } diff --git a/student/lib/ui/router.dart b/student/lib/ui/router.dart index 10a9b13..80ab4a8 100644 --- a/student/lib/ui/router.dart +++ b/student/lib/ui/router.dart @@ -1,28 +1,27 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:student/ui/router.dart'; import 'package:student/Activities/Ac7.Dart'; import 'package:student/Activities/Ac8.Dart'; import 'package:student/model/Group.dart'; //import 'package:Teacher_Dashboard/screens/bottom_nav_screen.dart'; class Router { static Route generateRoute(RouteSettings settings) { switch (group.currentActivity) { case 'Ac7': return MaterialPageRoute(builder: (_) => Ac7()); case 'Ac8': { - print('ffff'); return MaterialPageRoute(builder: (_) => Ac8()); } default: return MaterialPageRoute( builder: (_) => Scaffold( body: Center( child: Text('No route defined for '), ), )); } } } diff --git a/student/lib/widgets/membersBar.Dart b/student/lib/widgets/membersBar.Dart index 91b20e2..046f4af 100644 --- a/student/lib/widgets/membersBar.Dart +++ b/student/lib/widgets/membersBar.Dart @@ -1,61 +1,68 @@ import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:student/model/Group.dart'; class MembersBar extends StatefulWidget { - MembersBar({Key key}) : super(key: key); + final int curTurn; + MembersBar({Key key, this.curTurn}) : super(key: key); @override _MembersBarState createState() => _MembersBarState(); } class _MembersBarState extends State { Widget build(BuildContext context) { return Container( height: 50, width: 700, decoration: BoxDecoration(border: Border.all(color: Colors.blueAccent)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Icon(Icons.person), - Text( - group.member1name, - style: const TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.w600, - ), - ), + Container( + color: (widget.curTurn == 1) ? Colors.blueAccent : Colors.white, + child: Text( + group.member1name, + style: const TextStyle( + color: Colors.black, + fontSize: 22.0, + fontWeight: FontWeight.w600, + ), + )), SizedBox(width: 20), Icon(Icons.person), - Text( - group.member2name, - style: const TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.w600, - ), - ), + Container( + color: (widget.curTurn == 2) ? Colors.blueAccent : Colors.white, + child: Text( + group.member2name, + style: const TextStyle( + color: Colors.black, + fontSize: 22.0, + fontWeight: FontWeight.w600, + ), + )), SizedBox(width: 20), Icon(Icons.person), - Text( - group.member3name, - style: const TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.w600, - ), - ), + Container( + color: (widget.curTurn == 3) ? Colors.blueAccent : Colors.white, + child: Text( + group.member3name, + style: const TextStyle( + color: Colors.black, + fontSize: 22.0, + fontWeight: FontWeight.w600, + ), + )), Text( '', style: const TextStyle( color: Colors.white70, fontSize: 15.0, ), ), SizedBox(height: 40), ], )); } } diff --git a/student/lib/widgets/showAlertDialog.Dart b/student/lib/widgets/showAlertDialog.Dart index 6933ccc..22061c3 100644 --- a/student/lib/widgets/showAlertDialog.Dart +++ b/student/lib/widgets/showAlertDialog.Dart @@ -1,28 +1,50 @@ import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; +import 'package:student/model/Group.dart'; +import 'package:provider/provider.dart'; showAlertDialog(BuildContext context, String title, String content) { // set up the button // set up the AlertDialog AlertDialog alert = AlertDialog( title: Text(title), content: Text(content), - backgroundColor: Colors.blue, + backgroundColor: Colors.white, actions: [ FlatButton( + color: Colors.deepPurple, child: Text('Ok'), onPressed: () { - Navigator.of(context).pop(); + Navigator.of(context, rootNavigator: true).pop(); }, ) ]); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return alert; + }, + ); +} + +showPauseDialog(BuildContext context) { + AlertDialog alert = AlertDialog( + title: Text('Pay Atttention'), + content: Text('Wait until teacher continues the activity'), + backgroundColor: Colors.white, + ); // show the dialog showDialog( + barrierDismissible: false, context: context, builder: (BuildContext context) { + final provider = Provider.of(context); + if (provider.ispaused == false) + Navigator.of(context, rootNavigator: true).pop(); return alert; }, ); }