diff --git a/Dashboard/android/app/src/debug/AndroidManifest.xml b/Dashboard/android/app/src/debug/AndroidManifest.xml index 1c29788..e4c8571 100644 --- a/Dashboard/android/app/src/debug/AndroidManifest.xml +++ b/Dashboard/android/app/src/debug/AndroidManifest.xml @@ -1,7 +1,7 @@ + package="com.example.CelloRoom"> diff --git a/Dashboard/android/app/src/main/AndroidManifest.xml b/Dashboard/android/app/src/main/AndroidManifest.xml index 9b6d8f0..de3ee17 100644 --- a/Dashboard/android/app/src/main/AndroidManifest.xml +++ b/Dashboard/android/app/src/main/AndroidManifest.xml @@ -1,47 +1,47 @@ + package="com.example.CelloRoom"> diff --git a/Dashboard/android/app/src/main/kotlin/com/example/flutter_covid_dashboard_ui/MainActivity.kt b/Dashboard/android/app/src/main/kotlin/com/example/CelloRoom/MainActivity.kt similarity index 67% rename from Dashboard/android/app/src/main/kotlin/com/example/flutter_covid_dashboard_ui/MainActivity.kt rename to Dashboard/android/app/src/main/kotlin/com/example/CelloRoom/MainActivity.kt index 1327fb1..3f2ac33 100644 --- a/Dashboard/android/app/src/main/kotlin/com/example/flutter_covid_dashboard_ui/MainActivity.kt +++ b/Dashboard/android/app/src/main/kotlin/com/example/CelloRoom/MainActivity.kt @@ -1,6 +1,6 @@ -package com.example.flutter_covid_dashboard_ui +package com.example.CelloRoom import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { } diff --git a/Dashboard/android/app/src/profile/AndroidManifest.xml b/Dashboard/android/app/src/profile/AndroidManifest.xml index 1c29788..e4c8571 100644 --- a/Dashboard/android/app/src/profile/AndroidManifest.xml +++ b/Dashboard/android/app/src/profile/AndroidManifest.xml @@ -1,7 +1,7 @@ + package="com.example.CelloRoom"> diff --git a/Dashboard/lib/screens/Monitoring.Dart b/Dashboard/lib/screens/Monitoring.Dart index 511f49e..4ec4203 100644 --- a/Dashboard/lib/screens/Monitoring.Dart +++ b/Dashboard/lib/screens/Monitoring.Dart @@ -1,475 +1,475 @@ 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:Teacher_Dashboard/model/activities/activity.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:syncfusion_flutter_gauges/gauges.dart'; import 'package:provider/provider.dart'; import 'package:material_segmented_control/material_segmented_control.dart'; import 'package:Teacher_Dashboard/widgets/showAlertDialog.Dart'; //import 'package:syncfusion_flutter_gauges/gauges.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 Monitoring extends StatefulWidget { @override MonitoringState createState() => MonitoringState(); } class MonitoringState extends State { bool mistakesSwitch = false; bool rankingSwitch = false; bool robotPatternSwitch = false; int numofgroups = thisClass.groups.length; int _currentSelection = 0; int currentstepActivation = 0; String pauseButtonText = 'Pause All'; List mistakesList = [ 'Mistakes in Finding Slope', 'Mistakes in Finding Intercept', 'Mistakes in Finding Intercept', - 'Mistakes in Moving the Robot' + 'Mistakes in Moving the Joint Robot', ]; Map _children = { 0: Text(acListD[0]), 1: Text(acListD[1]), 2: Text(acListD[2]), 3: Text(acListD[3]), 4: Text(acListD[4]), 5: Text(acListD[5]), 6: Text(acListD[6]), 7: Text(acListD[7]), }; final FirebaseDatabase _database = FirebaseDatabase.instance; @override void initState() { print(thisClass.finishedGroupsNum); super.initState(); } @override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { // final productProvider = Provider.of(context); return Scaffold( backgroundColor: Colors.white, appBar: AppBar( backgroundColor: Palette.primaryColor, elevation: 0.0, title: Text('Monitor your class'), leading: IconButton( icon: const Icon(Icons.search), iconSize: 28.0, onPressed: () {}, ), // actions: [ // IconButton( // icon: const Icon(Icons.notifications_none), // iconSize: 28.0, // onPressed: () {}, // ), // ], ), body: Column(children: [ Padding( padding: EdgeInsets.all(16.0), child: Text( "Control the current class activities:", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), )), MaterialSegmentedControl( children: _children, selectionIndex: _currentSelection, borderColor: Colors.grey, selectedColor: Colors.blue, unselectedColor: Colors.white, borderRadius: 32.0, disabledChildren: [ // 3, ], onSegmentChosen: (index) { showAlertDialog(context, 'Pay Attention', 'Are you sure you want to change the activity for all teams?'); setState(() { _currentSelection = index; thisClass.finishedGroupsNum[index] = 0; for (int i = 0; i < thisClass.groups.length; i++) { _database .reference() .child(thisClass.sessionID) .child('groups') .child(thisClass.groupIDs[i]) .child('currentActivity') .set( acList[index], ); } }); }, ), Row( // mainAxisSize: MainAxisSize.min, children: [ Center( 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), ), ), ), ), ], ), SizedBox(height: 20), Text( "Monitor the class progress :", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), Consumer( builder: (context, model, child) => Row(children: [ SizedBox( height: 150, width: 400, child: ListView.builder( itemCount: 3, itemBuilder: (context, int position) { return Card( child: Row(children: [ SizedBox(width: 17), Text( mistakesList[position], style: TextStyle( fontWeight: FontWeight.bold, fontSize: 13), ), SizedBox(width: 25), StepProgressIndicator( currentStep: thisClass.aggregatedMistakes[position], totalSteps: 100, padding: 0, size: 10, // currentStep: // thisClass.groups[position].activities[0].progress, // width: 100, /* customColor: (index) => thisClass .groups[position] .activities[acList.indexOf(thisClass .groups[position] .currentActivity)] .progress[index] > -2 ? (thisClass .groups[position] .activities[acList.indexOf( thisClass.groups[position] .currentActivity)] .progress[index] > -1 ? (thisClass .groups[position] .activities[acList.indexOf(thisClass.groups[position].currentActivity)] .progress[index] > 0 ? Colors.green : Colors.blue) : Colors.red) : Colors.grey, */ ), ]), ); }, )), SizedBox( width: 50, ), Column( children: [ CircularStepProgressIndicator( totalSteps: 4, width: 150, height: 150, - // padding: 10, + padding: 10, // currentStep: 1, customColor: (index) => (thisClass.groups.length > 0) ? (thisClass.finishedGroupsNum[ _currentSelection] / thisClass.groups.length >= (index + 1) * 0.25 ? Colors.green : Colors.grey) : Colors.grey, ), SizedBox( height: 10, ), Text( thisClass.finishedGroupsNum[_currentSelection] .toString() + ' groups have finihsed the activity', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16), ), ], ), ])), SizedBox(height: 50), Text( "Monitor All groups progress:", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), SizedBox( height: 450, child: Consumer( builder: (context, model, child) => Container( child: ListView.builder( itemCount: thisClass.groups.length, itemBuilder: (context, int position) { return Card( child: ListTile( onLongPress: () { Navigator.push( context, MaterialPageRoute( builder: (context) => GroupDashboard(currentgroupID: position))); }, title: Row(children: [ Stack(children: [ CustomPaint( size: Size(100, 100), painter: HexagonPainter( Offset(50, 50), 40.0, (thisClass.groups[position].cellulox.status == 2 && thisClass.groups[position].celluloy .status == 2 && thisClass.groups[position] .tabletStatus == 'YES') ? Colors.green : Colors.green), ), CustomPaint( size: Size(100, 100), painter: HexagonPainter( Offset(50, 50), 30.0, Colors.white), ), Container( width: 100, height: 100, child: Center( child: Text( thisClass.groups[position].id, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 13), ))), ]), SizedBox(width: 17), Container( width: 100, height: 100, child: Stack(children: [ CircularStepProgressIndicator( totalSteps: 3, // currentStep: // thisClass.groups[position].activities[0].progress, width: 100, customColor: (index) => thisClass .groups[position] .activities[acList.indexOf(thisClass .groups[position] .currentActivity)] .progress[index] > -2 ? (thisClass .groups[position] .activities[acList.indexOf( thisClass.groups[position] .currentActivity)] .progress[index] > -1 ? (thisClass .groups[position] .activities[acList.indexOf(thisClass.groups[position].currentActivity)] .progress[index] > 0 ? Colors.green : Colors.blue) : Colors.red) : Colors.grey, ), Center(child: Text('Progress')), ])), SizedBox(width: 25), SizedBox( width: 25, ), Column( children: [ Container( width: 100, height: 100, child: SfRadialGauge(axes: [ RadialAxis( minimum: 0, maximum: 150, ranges: [ GaugeRange( startValue: 0, endValue: 50, color: Colors.orange, startWidth: 10, endWidth: 10), GaugeRange( startValue: 50, endValue: 100, color: Colors.green, startWidth: 10, endWidth: 10), GaugeRange( startValue: 100, endValue: 150, color: Colors.red, startWidth: 10, endWidth: 10) ], pointers: [ NeedlePointer( value: thisClass .groups[position].engagement) ], annotations: [ GaugeAnnotation( angle: 90, positionFactor: 0.5) ]) ])), Text('Total Engagement') ], ), SizedBox( width: 25, ), Column( children: [ Container( width: 100, height: 100, child: SfRadialGauge( axes: [ RadialAxis( showAxisLine: false, // ticksPosition: ElementsPosition.outside, // labelsPosition: ElementsPosition.outside, startAngle: 270, endAngle: 270, useRangeColorForAxis: true, interval: 10, axisLabelStyle: GaugeTextStyle( fontWeight: FontWeight.w500, fontSize: 2), majorTickStyle: MajorTickStyle( length: 0.15, lengthUnit: GaugeSizeUnit.factor, thickness: 1), minorTicksPerInterval: 4, labelOffset: 15, minorTickStyle: MinorTickStyle( length: 0.04, lengthUnit: GaugeSizeUnit.factor, thickness: 1), ranges: [ GaugeRange( startValue: 0, endValue: 50.0 + 10 * position, color: Color(0xFFF8B195), sizeUnit: GaugeSizeUnit.factor, rangeOffset: 0.06, startWidth: 0.05, endWidth: 0.25), GaugeRange( startValue: 51 - position * 3.8, endValue: 100, rangeOffset: 0.06, sizeUnit: GaugeSizeUnit.factor, color: Color(0xFF355C7D), startWidth: 0.05, endWidth: 0.25), ]) ], ), ), Text('Realtive Engagement '), ], ), ]), trailing: Icon(Icons.more_vert), )); }, )), )), ])); } } diff --git a/Dashboard/lib/screens/home_screen.dart b/Dashboard/lib/screens/home_screen.dart index 2ec4827..d636eca 100644 --- a/Dashboard/lib/screens/home_screen.dart +++ b/Dashboard/lib/screens/home_screen.dart @@ -1,424 +1,430 @@ import 'package:Teacher_Dashboard/model/Class.dart'; import 'package:Teacher_Dashboard/screens/screens.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'; import 'package:Teacher_Dashboard/widgets/showAlertDialog.Dart'; class HomeScreen extends StatefulWidget { @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State with SingleTickerProviderStateMixin { var isallgroupsconnected = false; bool joinEnabled = false; Animation animation; AnimationController _controller; String numConnectedGroups = '0'; 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: AppBar( backgroundColor: Palette.primaryColor, elevation: 0.0, title: Text('Setup your class'), leading: IconButton( icon: const Icon(Icons.settings), iconSize: 28.0, onPressed: () {}, ), // actions: [ // IconButton( // icon: const Icon(Icons.notifications_none), // iconSize: 28.0, // onPressed: () {}, // ), // ], ), 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: () { if (thisClass.groups.length > 0) { thisClass.groups.clear(); thisClass.groupIDs = new List(); thisClass.desetupDatabse(); } if (controllerSessionID.text != '') { thisClass.sessionID = controllerSessionID.text; // locator.registerLazySingleton(() => Api(Firestore.instance.collection('sessions').doc(controllerSessionID.text) thisClass.sessionID)); thisClass.setupDatabse(); showAlertDialog( context, '', 'Your class has been set up to session' + thisClass.sessionID); } else { showAlertDialog( context, '', 'Please specify a session ID'); } }, ), )), SizedBox( height: 50, ), Padding( padding: EdgeInsets.symmetric(horizontal: 32), child: Container( width: 500, child: DropdownButton( hint: Text('Students start the session with activity: '), value: startAcdropdownValue, icon: Icon(Icons.arrow_downward), iconSize: 24, elevation: 16, style: TextStyle(color: Colors.deepPurple), onChanged: (String newValue) { setState(() { startAcdropdownValue = newValue; }); }, items: acListD .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( - acList[acListD.indexOf(startAcdropdownValue)], - ); + if (startAcdropdownValue != '') { + for (int i = 0; i < thisClass.groups.length; i++) { + _database + .reference() + .child(thisClass.sessionID) + .child('groups') + .child(thisClass.groupIDs[i]) + .child('currentActivity') + .set( + acList[acListD.indexOf(startAcdropdownValue)], + ); + } + + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => BottomNavScreen())); + } else { + showAlertDialog( + context, '', 'Please specify an activity'); } - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => BottomNavScreen())); }, ), )), ]), ), // _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/cellulo.png')), const SizedBox(height: 20.0), Row(mainAxisAlignment: MainAxisAlignment.center, 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, ) ], ) ], ), ]), ], ), ), ); } 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/arrow.dart b/Dashboard/lib/widgets/arrow.dart new file mode 100644 index 0000000..28a2e90 --- /dev/null +++ b/Dashboard/lib/widgets/arrow.dart @@ -0,0 +1,91 @@ +import 'package:flutter/material.dart'; +import 'package:arrow_path/arrow_path.dart'; +import 'package:student/model/Cellulo.dart'; +import "dart:math" as math; + +class Arrow extends CustomPainter { + // <-- CustomPainter class + + var celluloxPosition; + var celluloyPosition; + var coeffScreenMapWidth; + var coeffScreenMapHeight; + double directionx; + double directiony; + Offset celluloyM; + Offset celluloxM; + Arrow(this.celluloxPosition, this.celluloyPosition, this.coeffScreenMapWidth, + this.coeffScreenMapHeight, this.directionx, this.directiony) { + celluloxM = Offset(celluloxPosition[0] * coeffScreenMapWidth, + celluloxPosition[1] * coeffScreenMapHeight); + celluloyM = Offset(celluloyPosition[0] * coeffScreenMapWidth, + celluloyPosition[1] * coeffScreenMapHeight); +/* + directionx = 0; + directiony = 0; + if (math.sqrt(math.pow(directionx, 2) + math.pow(directiony, 2)) < 80) + directionx = 0; + else if (directionx > 40) + directionx = 1; + else if (directionx < -40) { + directionx = -1; + } else { + directionx = 0; + } + if (math.sqrt(math.pow(directionx, 2) + math.pow(directiony, 2)) < 80) + directiony = 0; + else if (directiony > 40) + directiony = 1; + else if (directiony < -40) { + directiony = -1; + } else { + directiony = 0; + } + */ + + if (directionx > 40) directionx = 40; + if (directionx < -40) directionx = -40; + + if (directiony > 40) directiony = 40; + if (directiony < -40) directiony = -40; + } + + @override + void paint(Canvas canvas, Size size) { + // print('ddddd' + directiony.toString()); + Path path; + Path path2; + Paint paintblue = Paint() + ..color = Colors.blue + ..style = PaintingStyle.stroke + ..strokeCap = StrokeCap.round + ..strokeJoin = StrokeJoin.round + ..strokeWidth = 3.0; + Paint paintRed = Paint() + ..color = Colors.red + ..style = PaintingStyle.stroke + ..strokeCap = StrokeCap.round + ..strokeJoin = StrokeJoin.round + ..strokeWidth = 3.0; + if (directionx.abs() > 20) { + path = Path(); + path.moveTo(celluloxM.dx - 10, celluloxM.dy - 10); + path.relativeCubicTo(0, 0, 0, 0, directionx, 0); + path = ArrowPath.make(path: path); + canvas.drawPath(path, paintRed); + } + if (directiony.abs() > 20) { + path2 = Path(); + path2.moveTo(celluloyM.dx + 20, celluloyM.dy + 15); + path2.relativeCubicTo(0, 0, 0, 0, 0, directiony); + path2 = ArrowPath.make(path: path2); + canvas.drawPath(path2, paintblue); + } + //canvas.drawLine(p1, p2, paint); + } + + @override + bool shouldRepaint(CustomPainter old) { + return false; + } +} diff --git a/Dashboard/pubspec.lock b/Dashboard/pubspec.lock index 0dceddb..ca9f1f6 100644 --- a/Dashboard/pubspec.lock +++ b/Dashboard/pubspec.lock @@ -1,474 +1,481 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted version: "2.0.13" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted version: "1.6.0" + arrow_path: + dependency: "direct main" + description: + name: arrow_path + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted version: "2.4.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted version: "2.0.0" bubble_tab_indicator: dependency: "direct main" description: name: bubble_tab_indicator url: "https://pub.dartlang.org" source: hosted version: "0.1.4" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted version: "1.1.3" cloud_firestore: dependency: "direct main" description: name: cloud_firestore url: "https://pub.dartlang.org" source: hosted version: "0.13.7" cloud_firestore_platform_interface: dependency: transitive description: name: cloud_firestore_platform_interface url: "https://pub.dartlang.org" source: hosted version: "1.1.2" cloud_firestore_web: dependency: transitive description: name: cloud_firestore_web url: "https://pub.dartlang.org" source: hosted version: "0.1.1+2" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted version: "1.14.12" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted version: "2.1.1" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted version: "2.1.4" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted version: "0.1.3" equatable: dependency: transitive description: name: equatable url: "https://pub.dartlang.org" source: hosted version: "1.2.0" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted version: "5.2.1" firebase: dependency: transitive description: name: firebase url: "https://pub.dartlang.org" source: hosted version: "7.3.0" firebase_core: dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted version: "0.4.5" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted version: "1.0.4" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted version: "0.1.1+2" firebase_database: dependency: "direct main" description: name: firebase_database url: "https://pub.dartlang.org" source: hosted version: "3.1.6" fl_chart: dependency: "direct main" description: name: fl_chart url: "https://pub.dartlang.org" source: hosted version: "0.9.4" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" flutter_screen_recording: dependency: "direct main" description: name: flutter_screen_recording url: "https://pub.dartlang.org" source: hosted version: "1.0.10" flutter_staggered_grid_view: dependency: "direct main" description: name: flutter_staggered_grid_view url: "https://pub.dartlang.org" source: hosted version: "0.2.7" flutter_svg: dependency: "direct main" description: name: flutter_svg url: "https://pub.dartlang.org" source: hosted version: "0.17.4" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" flutter_web_plugins: dependency: transitive description: flutter source: sdk version: "0.0.0" font_awesome_flutter: dependency: "direct main" description: name: font_awesome_flutter url: "https://pub.dartlang.org" source: hosted version: "8.8.1" get_it: dependency: "direct main" description: name: get_it url: "https://pub.dartlang.org" source: hosted version: "4.0.4" google_fonts: dependency: "direct main" description: name: google_fonts url: "https://pub.dartlang.org" source: hosted version: "1.1.0" http: dependency: transitive description: name: http url: "https://pub.dartlang.org" source: hosted version: "0.12.2" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted version: "3.1.4" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted version: "2.1.12" intl: dependency: transitive description: name: intl url: "https://pub.dartlang.org" source: hosted version: "0.16.1" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted version: "0.6.2" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted version: "0.12.6" material_segmented_control: dependency: "direct main" description: name: material_segmented_control url: "https://pub.dartlang.org" source: hosted version: "2.1.0+1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted version: "1.1.8" nested: dependency: transitive description: name: nested url: "https://pub.dartlang.org" source: hosted version: "0.0.4" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted version: "1.6.4" path_drawing: dependency: transitive description: name: path_drawing url: "https://pub.dartlang.org" source: hosted version: "0.4.1" path_parsing: dependency: transitive description: name: path_parsing url: "https://pub.dartlang.org" source: hosted version: "0.1.4" path_provider: dependency: transitive description: name: path_provider url: "https://pub.dartlang.org" source: hosted version: "1.6.11" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted version: "0.0.1+2" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted version: "0.0.4+3" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted version: "1.0.2" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted version: "1.9.0" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted version: "2.4.0" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted version: "2.2.1" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted version: "1.0.2" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted version: "3.0.13" provider: dependency: "direct main" description: name: provider url: "https://pub.dartlang.org" source: hosted version: "4.3.2" quiver: dependency: transitive description: name: quiver url: "https://pub.dartlang.org" source: hosted version: "2.1.3" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted version: "1.7.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted version: "1.9.3" step_progress_indicator: dependency: "direct main" description: name: step_progress_indicator url: "https://pub.dartlang.org" source: hosted version: "0.2.3+6" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted version: "1.0.5" syncfusion_flutter_core: dependency: transitive description: name: syncfusion_flutter_core url: "https://pub.dartlang.org" source: hosted version: "18.3.40" syncfusion_flutter_gauges: dependency: "direct main" description: name: syncfusion_flutter_gauges url: "https://pub.dartlang.org" source: hosted version: "18.3.40" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted version: "1.1.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted version: "0.2.15" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted version: "1.1.6" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted version: "2.0.8" web_socket_channel: dependency: "direct main" description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted version: "1.1.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted version: "0.1.0" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted version: "3.6.1" sdks: dart: ">=2.7.0 <3.0.0" flutter: ">=1.17.0 <2.0.0" diff --git a/Dashboard/pubspec.yaml b/Dashboard/pubspec.yaml index ef4271b..e787174 100644 --- a/Dashboard/pubspec.yaml +++ b/Dashboard/pubspec.yaml @@ -1,83 +1,84 @@ name: Teacher_Dashboard description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `pub publish`. This is preferred for private packages. publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 # followed by an optional build number separated by a +. # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # In Android, build-name is used as versionName while build-number used as versionCode. # Read more about Android versioning at https://developer.android.com/studio/publish/versioning # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+1 environment: sdk: ">=2.7.0 <3.0.0" dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.3 bubble_tab_indicator: ^0.1.4 fl_chart: ^0.9.4 flutter_staggered_grid_view: "^0.2.7" web_socket_channel: "^1.0.8" font_awesome_flutter: ^8.8.1 cloud_firestore: ^0.13.7 firebase_core: ^0.4.4 firebase_database: ^3.1.6 flutter_svg: ^0.17.1 step_progress_indicator: ^0.2.3+6 provider: ^4.3.2 google_fonts: ^1.1.0 get_it: ^4.0.4 flutter_screen_recording: ^1.0.10 syncfusion_flutter_gauges: ^18.3.40 material_segmented_control: ^2.1.0+1 + arrow_path: ^1.0.0 dev_dependencies: flutter_test: sdk: flutter # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: assets: - assets/images/ # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. # For details regarding adding assets from package dependencies, see # https://flutter.dev/assets-and-images/#from-packages # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # fonts: # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf # - asset: fonts/Schyler-Italic.ttf # style: italic # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf # - asset: fonts/TrajanPro_Bold.ttf # weight: 700 # # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages