From b518de31934ee6eaf1441a9da590590564c03444 Mon Sep 17 00:00:00 2001 From: noah-nm Date: Wed, 15 Jan 2025 10:34:24 -0500 Subject: [PATCH 1/4] Fix button positions --- lib/routes/auto/AutonomousDataRoute.dart | 2 + .../comments/fields/CommentsFields.dart | 97 ++++------ .../prematch/fields/PrematchFields.dart | 25 --- .../prematch/labels/PrematchLabels.dart | 25 ++- lib/routes/qrcode/QRCodeRoute.dart | 31 +++- lib/routes/settings/SettingsRoute.dart | 24 +-- lib/routes/teleop/TeleopRoute.dart | 171 ++++++------------ lib/utils/data/values/SettingValues.dart | 2 +- 8 files changed, 142 insertions(+), 235 deletions(-) diff --git a/lib/routes/auto/AutonomousDataRoute.dart b/lib/routes/auto/AutonomousDataRoute.dart index a1a4990..929d5cb 100644 --- a/lib/routes/auto/AutonomousDataRoute.dart +++ b/lib/routes/auto/AutonomousDataRoute.dart @@ -88,6 +88,7 @@ class _DataRouteState extends State { style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), backgroundColor: AppStyle.textInputColor, + padding: const EdgeInsets.all(15), ), onPressed: () { Navigator.push(context, @@ -112,6 +113,7 @@ class _DataRouteState extends State { style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), backgroundColor: AppStyle.textInputColor, + padding: const EdgeInsets.all(15), ), onPressed: () { Navigator.push(context, diff --git a/lib/routes/comments/fields/CommentsFields.dart b/lib/routes/comments/fields/CommentsFields.dart index 69d6010..661aed3 100644 --- a/lib/routes/comments/fields/CommentsFields.dart +++ b/lib/routes/comments/fields/CommentsFields.dart @@ -33,47 +33,45 @@ class _CommentsFields extends State { Align( alignment: Alignment.bottomRight, child: Container( - padding: EdgeInsets.only(right: 10), - height: 30.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppStyle - .textInputColorLight, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const TeleopRoute(title: "Teleop/Endgame"); - })); - }, - child: const Text("< Teleop/Endgame", - style: TextStyle( - fontSize: 12.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), + padding: const EdgeInsets.all(3.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: const EdgeInsets.all(15), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const TeleopRoute(title: "Teleop"); + })); + }, + child: const Text("< Teleop", + style: + TextStyle(fontSize: 16.0, color: Colors.white)), + ), + )), Align( alignment: Alignment.bottomRight, child: Container( - padding: EdgeInsets.only(right: 60), - height: 30.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppStyle - .textInputColorLight, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const QRCodeRoute(title: "QR Code"); - })); - }, - child: const Text("Current QR Code >", - style: TextStyle( - fontSize: 12.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), + padding: const EdgeInsets.all(3.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: const EdgeInsets.all(15), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const QRCodeRoute(title: "QR Code"); + })); + }, + child: const Text("Current QR Code >", + style: + TextStyle(fontSize: 16.0, color: Colors.white)), + ), + )), ]), ], ), @@ -128,29 +126,6 @@ class _CommentsFields extends State { height: 90.0, maxLines: 10, ), - Align( - alignment: Alignment.bottomRight, - child: Container( - padding: const EdgeInsets.only( - top: 4.0, right: 40, left: 80.0, bottom: 20.0), - height: 80.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppStyle - .textInputColorLight, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const QRCodeRoute(title: "QR Code"); - })); - }, - child: const Text("Current QR Code >", - style: TextStyle( - fontSize: 24.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), ], ); } diff --git a/lib/routes/prematch/fields/PrematchFields.dart b/lib/routes/prematch/fields/PrematchFields.dart index 72c3280..4ba2278 100644 --- a/lib/routes/prematch/fields/PrematchFields.dart +++ b/lib/routes/prematch/fields/PrematchFields.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import 'package:scouting_platform/builders/bases/NumberInputField.dart'; import 'package:scouting_platform/builders/bases/TextInputField.dart'; -import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; -import 'package:scouting_platform/styles/AppStyle.dart'; import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; @@ -140,29 +138,6 @@ class _PrematchFieldsState extends State { controller: PrematchValues.teamNumber, hintText: "Team Number", ), - Align( - alignment: Alignment.bottomRight, - child: Container( - padding: - const EdgeInsets.only(top: 4.0, right: 13, left: 100.0), - height: 47.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppStyle - .textInputColor, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const AutonomousDataRoute(title: "Auto"); - })); - }, - child: const Text("Auto >", - style: TextStyle( - fontSize: 16.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))) ], ); } diff --git a/lib/routes/prematch/labels/PrematchLabels.dart b/lib/routes/prematch/labels/PrematchLabels.dart index 4134f75..2940830 100644 --- a/lib/routes/prematch/labels/PrematchLabels.dart +++ b/lib/routes/prematch/labels/PrematchLabels.dart @@ -1,4 +1,6 @@ // ignore_for_file: file_names +import 'package:scouting_platform/styles/AppStyle.dart'; +import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; import 'package:flutter/material.dart'; class PrematchLabels extends StatefulWidget { @@ -20,8 +22,7 @@ class _PrematchLabelsState extends State { alignment: Alignment.centerLeft, child: Container( width: 170.0, - padding: - const EdgeInsets.only(left: 20.0, top: 20.0, right: 30.0), + padding: const EdgeInsets.only(left: 20.0, top: 20.0, right: 5.0), child: const Text( "Initials", textAlign: TextAlign.left, @@ -62,8 +63,24 @@ class _PrematchLabelsState extends State { fontSize: 15.0), ), )), - - const Divider(), + const SizedBox(width: 598.0), + Container( + padding: const EdgeInsets.all(5.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: const EdgeInsets.all(15), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (context) { + return const AutonomousDataRoute(title: "Auto"); + })); + }, + child: const Text("Auto >", + style: TextStyle(fontSize: 16.0, color: Colors.white)), + ), + ) ], ); } diff --git a/lib/routes/qrcode/QRCodeRoute.dart b/lib/routes/qrcode/QRCodeRoute.dart index 3bbbf70..a368839 100644 --- a/lib/routes/qrcode/QRCodeRoute.dart +++ b/lib/routes/qrcode/QRCodeRoute.dart @@ -10,6 +10,7 @@ import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/styles/AppStyle.dart'; +import 'package:scouting_platform/routes/comments/CommentsRoute.dart'; class QRCodeRoute extends StatefulWidget { const QRCodeRoute({super.key, required this.title}); @@ -40,11 +41,36 @@ class _QRCodeRouteState extends State { ), ), Positioned( - top: 16.0, - right: 16.0, + top: 5.0, + left: 5.0, child: ElevatedButton( style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), + padding: EdgeInsets.all(15.0), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (context) { + return const CommentsRoute(title: "Comments"); + })); + }, + child: const Text( + "< Comments", + style: TextStyle( + fontSize: 16.0, + fontFamily: "Helvetica", + color: Colors.white, + ), + ), + ), + ), + Positioned( + top: 5.0, + right: 5.0, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: EdgeInsets.all(15.0), backgroundColor: AppStyle.textInputColor, ), onPressed: () { @@ -117,4 +143,3 @@ class _QRCodeRouteState extends State { ); } } - diff --git a/lib/routes/settings/SettingsRoute.dart b/lib/routes/settings/SettingsRoute.dart index 3bdf75c..340aab8 100644 --- a/lib/routes/settings/SettingsRoute.dart +++ b/lib/routes/settings/SettingsRoute.dart @@ -113,28 +113,6 @@ class _SettingsRoute extends State { margin: const EdgeInsets.only(left: 40, top: 10)), ], ), - Column( - children: [ - const TitleStyle( - text: "File Name", - padding: EdgeInsets.only(left: 30, top: 10)), - TextInputField( - onChanged: (value) { - setState(() { - SettingValues.fileName.text = value; - }); - }, - textAlign: TextAlign.left, - hintText: "File Name", - controller: SettingValues.fileName, - margin: const EdgeInsets.only(left: 45, top: 10), - ), - ], - ) - ], - ), - Row( - children: [ Column( children: [ const TitleStyle( @@ -161,7 +139,7 @@ class _SettingsRoute extends State { ], ) ], - ) + ), ], ))); } diff --git a/lib/routes/teleop/TeleopRoute.dart b/lib/routes/teleop/TeleopRoute.dart index 463a038..2e2d2da 100644 --- a/lib/routes/teleop/TeleopRoute.dart +++ b/lib/routes/teleop/TeleopRoute.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:scouting_platform/builders/PlatformRoute.dart'; import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; import 'package:scouting_platform/routes/comments/CommentsRoute.dart'; -import 'package:scouting_platform/routes/prematch/PrematchRoute.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields2.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields3.dart'; @@ -15,8 +14,6 @@ import 'package:scouting_platform/routes/teleop/labels/TeleoperatedLabels4.dart' import 'package:scouting_platform/styles/AppStyle.dart'; import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; import 'package:scouting_platform/utils/data/values/SettingValues.dart'; -import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; -import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/utils/helpers/UIHelper.dart'; class TeleopRoute extends StatefulWidget { @@ -34,64 +31,56 @@ class _TeleopRouteState extends State { UIHelper.setBrightness(0.3); } - @override Widget build(BuildContext context) { return PlatformRoute( title: widget.title, body: SingleChildScrollView( physics: const AlwaysScrollableScrollPhysics(), child: Column(children: [ + // Top-right aligned buttons Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Align( - alignment: Alignment.bottomRight, - child: Container( - padding: const EdgeInsets.only(top: 4.0, right: 10), - // height: 47.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 40.0), - backgroundColor: AppStyle - .textInputColor, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const AutonomousDataRoute(title: "Auto"); - })); - }, - child: const Text("< Auto", - style: TextStyle( - fontSize: 14.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), - Align( - alignment: Alignment.bottomRight, - child: Container( - padding: const EdgeInsets.only(top: 4.0, right: 60), - // height: 47.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 40.0), - backgroundColor: AppStyle - .textInputColor, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const CommentsRoute(title: "Comments"); - })); - }, - child: const Text("Comments >", - style: TextStyle( - fontSize: 14.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), + Container( + padding: const EdgeInsets.all(5.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: const EdgeInsets.all(15), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const AutonomousDataRoute(title: "Auto"); + })); + }, + child: const Text("< Auto", + style: TextStyle(fontSize: 16.0, color: Colors.white)), + ), + ), + const SizedBox(width: 8), + Container( + padding: const EdgeInsets.all(5.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + backgroundColor: AppStyle.textInputColor, + padding: EdgeInsets.all(15), + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const CommentsRoute(title: "Comments"); + })); + }, + child: const Text("Comments >", + style: TextStyle(fontSize: 16.0, color: Colors.white)), + ), + ), ], ), + // Other content const TeleoperatedLabels4(), const TeleoperatedFields4(), const TeleoperatedLabels3(), @@ -100,77 +89,23 @@ class _TeleopRouteState extends State { const TeleoperatedFields2(), const TeleoperatedLabels(), const TeleoperatedFields(), - // robot info Align( - alignment: Alignment.centerLeft, - child: Container( - width: 400.0, - padding: const EdgeInsets.only(top: 20.0, left: 20.0), - child: Text( - "Driver Station: ${SettingValues.selectedDriverStation.text}, Match #${PrematchValues.matchNumber.text}, Team #${PrematchValues.teamNumber.text}", - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15.0), - ), - )), + alignment: Alignment.centerLeft, + child: Container( + width: 400.0, + padding: const EdgeInsets.only(top: 20.0, left: 20.0), + child: Text( + "Driver Station: ${SettingValues.selectedDriverStation.text}, Match #${PrematchValues.matchNumber.text}, Team #${PrematchValues.teamNumber.text}", + textAlign: TextAlign.left, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15.0), + ), + ), + ), ]), ), ); } - - showConformationDialog(BuildContext context) { - // set up the buttons - Widget cancelButton = TextButton( - child: const Text("No"), - onPressed: () { - Navigator.of(context, rootNavigator: true).pop('dialog'); - }, - ); - Widget continueButton = TextButton( - child: const Text("Yes"), - onPressed: () { - // Increment the match number - if (PrematchValues.matchNumber.text != "") { - PrematchValues.matchNumber.text = - (int.parse(PrematchValues.matchNumber.text) + 1).toString(); - } else { - PrematchValues.matchNumber.text = (2).toString(); - } - - if (SettingValues.isTeamNumberReadOnly) { - // Get the team number from the schedule and set the team number field to that - Schedulehelper.getTeamNumberFromSchedule( - int.parse(// Get the team number from the schedule - PrematchValues.matchNumber.text)) - .then((teamNumber) => - PrematchValues.teamNumber.text = teamNumber.toString()); - } - - setState(() { - AppDataHelper.resetStates(); - }); - Navigator.of(context, rootNavigator: true).pop('dialog'); - Navigator.push(context, MaterialPageRoute(builder: (context) { - return const PrematchRoute(title: "Prematch Data"); - })); - }, - ); // set up the AlertDialog - AlertDialog alert = AlertDialog( - title: const Text("Confirmation: Reset ALL Fields"), - content: const Text( - "Would you like to reset all of the fields current inputted?"), - actions: [ - cancelButton, - continueButton, - ], - ); // show the dialog - showDialog( - context: context, - builder: (BuildContext context) { - return alert; - }, - ); - } } diff --git a/lib/utils/data/values/SettingValues.dart b/lib/utils/data/values/SettingValues.dart index be8583e..51f21b5 100644 --- a/lib/utils/data/values/SettingValues.dart +++ b/lib/utils/data/values/SettingValues.dart @@ -16,6 +16,6 @@ class SettingValues { /// Gets the saving spreadhseet name based on the current filename static String getCurrentSavingSpreadsheetName() { - return "${fileName.text}.csv"; + return "${eventID.text}.csv"; } } From ba6d46bfaa3898af0af09fe5e92b21d6afb79c90 Mon Sep 17 00:00:00 2001 From: noah-nm Date: Wed, 15 Jan 2025 10:41:00 -0500 Subject: [PATCH 2/4] Remove file name entry and fix buttons --- lib/routes/auto/AutonomousDataRoute.dart | 2 - .../comments/fields/CommentsFields.dart | 97 ++++++---- .../prematch/fields/PrematchFields.dart | 25 +++ .../prematch/labels/PrematchLabels.dart | 25 +-- lib/routes/qrcode/QRCodeRoute.dart | 31 +--- lib/routes/settings/SettingsRoute.dart | 24 ++- lib/routes/teleop/TeleopRoute.dart | 171 ++++++++++++------ lib/utils/data/values/SettingValues.dart | 2 +- 8 files changed, 235 insertions(+), 142 deletions(-) diff --git a/lib/routes/auto/AutonomousDataRoute.dart b/lib/routes/auto/AutonomousDataRoute.dart index 929d5cb..a1a4990 100644 --- a/lib/routes/auto/AutonomousDataRoute.dart +++ b/lib/routes/auto/AutonomousDataRoute.dart @@ -88,7 +88,6 @@ class _DataRouteState extends State { style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), backgroundColor: AppStyle.textInputColor, - padding: const EdgeInsets.all(15), ), onPressed: () { Navigator.push(context, @@ -113,7 +112,6 @@ class _DataRouteState extends State { style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), backgroundColor: AppStyle.textInputColor, - padding: const EdgeInsets.all(15), ), onPressed: () { Navigator.push(context, diff --git a/lib/routes/comments/fields/CommentsFields.dart b/lib/routes/comments/fields/CommentsFields.dart index 661aed3..69d6010 100644 --- a/lib/routes/comments/fields/CommentsFields.dart +++ b/lib/routes/comments/fields/CommentsFields.dart @@ -33,45 +33,47 @@ class _CommentsFields extends State { Align( alignment: Alignment.bottomRight, child: Container( - padding: const EdgeInsets.all(3.0), - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 37.0), - padding: const EdgeInsets.all(15), - backgroundColor: AppStyle.textInputColor, - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const TeleopRoute(title: "Teleop"); - })); - }, - child: const Text("< Teleop", - style: - TextStyle(fontSize: 16.0, color: Colors.white)), - ), - )), + padding: EdgeInsets.only(right: 10), + height: 30.0, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: AppStyle + .textInputColorLight, // Set the background color here + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const TeleopRoute(title: "Teleop/Endgame"); + })); + }, + child: const Text("< Teleop/Endgame", + style: TextStyle( + fontSize: 12.0, + fontFamily: "Helvetica", + color: Colors.white)), + ))), Align( alignment: Alignment.bottomRight, child: Container( - padding: const EdgeInsets.all(3.0), - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 37.0), - padding: const EdgeInsets.all(15), - backgroundColor: AppStyle.textInputColor, - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const QRCodeRoute(title: "QR Code"); - })); - }, - child: const Text("Current QR Code >", - style: - TextStyle(fontSize: 16.0, color: Colors.white)), - ), - )), + padding: EdgeInsets.only(right: 60), + height: 30.0, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: AppStyle + .textInputColorLight, // Set the background color here + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const QRCodeRoute(title: "QR Code"); + })); + }, + child: const Text("Current QR Code >", + style: TextStyle( + fontSize: 12.0, + fontFamily: "Helvetica", + color: Colors.white)), + ))), ]), ], ), @@ -126,6 +128,29 @@ class _CommentsFields extends State { height: 90.0, maxLines: 10, ), + Align( + alignment: Alignment.bottomRight, + child: Container( + padding: const EdgeInsets.only( + top: 4.0, right: 40, left: 80.0, bottom: 20.0), + height: 80.0, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: AppStyle + .textInputColorLight, // Set the background color here + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const QRCodeRoute(title: "QR Code"); + })); + }, + child: const Text("Current QR Code >", + style: TextStyle( + fontSize: 24.0, + fontFamily: "Helvetica", + color: Colors.white)), + ))), ], ); } diff --git a/lib/routes/prematch/fields/PrematchFields.dart b/lib/routes/prematch/fields/PrematchFields.dart index 4ba2278..72c3280 100644 --- a/lib/routes/prematch/fields/PrematchFields.dart +++ b/lib/routes/prematch/fields/PrematchFields.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:scouting_platform/builders/bases/NumberInputField.dart'; import 'package:scouting_platform/builders/bases/TextInputField.dart'; +import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; +import 'package:scouting_platform/styles/AppStyle.dart'; import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; @@ -138,6 +140,29 @@ class _PrematchFieldsState extends State { controller: PrematchValues.teamNumber, hintText: "Team Number", ), + Align( + alignment: Alignment.bottomRight, + child: Container( + padding: + const EdgeInsets.only(top: 4.0, right: 13, left: 100.0), + height: 47.0, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: AppStyle + .textInputColor, // Set the background color here + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const AutonomousDataRoute(title: "Auto"); + })); + }, + child: const Text("Auto >", + style: TextStyle( + fontSize: 16.0, + fontFamily: "Helvetica", + color: Colors.white)), + ))) ], ); } diff --git a/lib/routes/prematch/labels/PrematchLabels.dart b/lib/routes/prematch/labels/PrematchLabels.dart index 2940830..4134f75 100644 --- a/lib/routes/prematch/labels/PrematchLabels.dart +++ b/lib/routes/prematch/labels/PrematchLabels.dart @@ -1,6 +1,4 @@ // ignore_for_file: file_names -import 'package:scouting_platform/styles/AppStyle.dart'; -import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; import 'package:flutter/material.dart'; class PrematchLabels extends StatefulWidget { @@ -22,7 +20,8 @@ class _PrematchLabelsState extends State { alignment: Alignment.centerLeft, child: Container( width: 170.0, - padding: const EdgeInsets.only(left: 20.0, top: 20.0, right: 5.0), + padding: + const EdgeInsets.only(left: 20.0, top: 20.0, right: 30.0), child: const Text( "Initials", textAlign: TextAlign.left, @@ -63,24 +62,8 @@ class _PrematchLabelsState extends State { fontSize: 15.0), ), )), - const SizedBox(width: 598.0), - Container( - padding: const EdgeInsets.all(5.0), - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 37.0), - padding: const EdgeInsets.all(15), - backgroundColor: AppStyle.textInputColor, - ), - onPressed: () { - Navigator.push(context, MaterialPageRoute(builder: (context) { - return const AutonomousDataRoute(title: "Auto"); - })); - }, - child: const Text("Auto >", - style: TextStyle(fontSize: 16.0, color: Colors.white)), - ), - ) + + const Divider(), ], ); } diff --git a/lib/routes/qrcode/QRCodeRoute.dart b/lib/routes/qrcode/QRCodeRoute.dart index a368839..3bbbf70 100644 --- a/lib/routes/qrcode/QRCodeRoute.dart +++ b/lib/routes/qrcode/QRCodeRoute.dart @@ -10,7 +10,6 @@ import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/styles/AppStyle.dart'; -import 'package:scouting_platform/routes/comments/CommentsRoute.dart'; class QRCodeRoute extends StatefulWidget { const QRCodeRoute({super.key, required this.title}); @@ -41,36 +40,11 @@ class _QRCodeRouteState extends State { ), ), Positioned( - top: 5.0, - left: 5.0, + top: 16.0, + right: 16.0, child: ElevatedButton( style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), - padding: EdgeInsets.all(15.0), - backgroundColor: AppStyle.textInputColor, - ), - onPressed: () { - Navigator.push(context, MaterialPageRoute(builder: (context) { - return const CommentsRoute(title: "Comments"); - })); - }, - child: const Text( - "< Comments", - style: TextStyle( - fontSize: 16.0, - fontFamily: "Helvetica", - color: Colors.white, - ), - ), - ), - ), - Positioned( - top: 5.0, - right: 5.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 37.0), - padding: EdgeInsets.all(15.0), backgroundColor: AppStyle.textInputColor, ), onPressed: () { @@ -143,3 +117,4 @@ class _QRCodeRouteState extends State { ); } } + diff --git a/lib/routes/settings/SettingsRoute.dart b/lib/routes/settings/SettingsRoute.dart index 340aab8..3bdf75c 100644 --- a/lib/routes/settings/SettingsRoute.dart +++ b/lib/routes/settings/SettingsRoute.dart @@ -113,6 +113,28 @@ class _SettingsRoute extends State { margin: const EdgeInsets.only(left: 40, top: 10)), ], ), + Column( + children: [ + const TitleStyle( + text: "File Name", + padding: EdgeInsets.only(left: 30, top: 10)), + TextInputField( + onChanged: (value) { + setState(() { + SettingValues.fileName.text = value; + }); + }, + textAlign: TextAlign.left, + hintText: "File Name", + controller: SettingValues.fileName, + margin: const EdgeInsets.only(left: 45, top: 10), + ), + ], + ) + ], + ), + Row( + children: [ Column( children: [ const TitleStyle( @@ -139,7 +161,7 @@ class _SettingsRoute extends State { ], ) ], - ), + ) ], ))); } diff --git a/lib/routes/teleop/TeleopRoute.dart b/lib/routes/teleop/TeleopRoute.dart index 2e2d2da..463a038 100644 --- a/lib/routes/teleop/TeleopRoute.dart +++ b/lib/routes/teleop/TeleopRoute.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:scouting_platform/builders/PlatformRoute.dart'; import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; import 'package:scouting_platform/routes/comments/CommentsRoute.dart'; +import 'package:scouting_platform/routes/prematch/PrematchRoute.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields2.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields3.dart'; @@ -14,6 +15,8 @@ import 'package:scouting_platform/routes/teleop/labels/TeleoperatedLabels4.dart' import 'package:scouting_platform/styles/AppStyle.dart'; import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; import 'package:scouting_platform/utils/data/values/SettingValues.dart'; +import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; +import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/utils/helpers/UIHelper.dart'; class TeleopRoute extends StatefulWidget { @@ -31,56 +34,64 @@ class _TeleopRouteState extends State { UIHelper.setBrightness(0.3); } + @override Widget build(BuildContext context) { return PlatformRoute( title: widget.title, body: SingleChildScrollView( physics: const AlwaysScrollableScrollPhysics(), child: Column(children: [ - // Top-right aligned buttons Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Container( - padding: const EdgeInsets.all(5.0), - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 37.0), - padding: const EdgeInsets.all(15), - backgroundColor: AppStyle.textInputColor, - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const AutonomousDataRoute(title: "Auto"); - })); - }, - child: const Text("< Auto", - style: TextStyle(fontSize: 16.0, color: Colors.white)), - ), - ), - const SizedBox(width: 8), - Container( - padding: const EdgeInsets.all(5.0), - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 37.0), - backgroundColor: AppStyle.textInputColor, - padding: EdgeInsets.all(15), - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const CommentsRoute(title: "Comments"); - })); - }, - child: const Text("Comments >", - style: TextStyle(fontSize: 16.0, color: Colors.white)), - ), - ), + Align( + alignment: Alignment.bottomRight, + child: Container( + padding: const EdgeInsets.only(top: 4.0, right: 10), + // height: 47.0, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 40.0), + backgroundColor: AppStyle + .textInputColor, // Set the background color here + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const AutonomousDataRoute(title: "Auto"); + })); + }, + child: const Text("< Auto", + style: TextStyle( + fontSize: 14.0, + fontFamily: "Helvetica", + color: Colors.white)), + ))), + Align( + alignment: Alignment.bottomRight, + child: Container( + padding: const EdgeInsets.only(top: 4.0, right: 60), + // height: 47.0, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 40.0), + backgroundColor: AppStyle + .textInputColor, // Set the background color here + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const CommentsRoute(title: "Comments"); + })); + }, + child: const Text("Comments >", + style: TextStyle( + fontSize: 14.0, + fontFamily: "Helvetica", + color: Colors.white)), + ))), ], ), - // Other content const TeleoperatedLabels4(), const TeleoperatedFields4(), const TeleoperatedLabels3(), @@ -89,23 +100,77 @@ class _TeleopRouteState extends State { const TeleoperatedFields2(), const TeleoperatedLabels(), const TeleoperatedFields(), + // robot info Align( - alignment: Alignment.centerLeft, - child: Container( - width: 400.0, - padding: const EdgeInsets.only(top: 20.0, left: 20.0), - child: Text( - "Driver Station: ${SettingValues.selectedDriverStation.text}, Match #${PrematchValues.matchNumber.text}, Team #${PrematchValues.teamNumber.text}", - textAlign: TextAlign.left, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15.0), - ), - ), - ), + alignment: Alignment.centerLeft, + child: Container( + width: 400.0, + padding: const EdgeInsets.only(top: 20.0, left: 20.0), + child: Text( + "Driver Station: ${SettingValues.selectedDriverStation.text}, Match #${PrematchValues.matchNumber.text}, Team #${PrematchValues.teamNumber.text}", + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15.0), + ), + )), ]), ), ); } + + showConformationDialog(BuildContext context) { + // set up the buttons + Widget cancelButton = TextButton( + child: const Text("No"), + onPressed: () { + Navigator.of(context, rootNavigator: true).pop('dialog'); + }, + ); + Widget continueButton = TextButton( + child: const Text("Yes"), + onPressed: () { + // Increment the match number + if (PrematchValues.matchNumber.text != "") { + PrematchValues.matchNumber.text = + (int.parse(PrematchValues.matchNumber.text) + 1).toString(); + } else { + PrematchValues.matchNumber.text = (2).toString(); + } + + if (SettingValues.isTeamNumberReadOnly) { + // Get the team number from the schedule and set the team number field to that + Schedulehelper.getTeamNumberFromSchedule( + int.parse(// Get the team number from the schedule + PrematchValues.matchNumber.text)) + .then((teamNumber) => + PrematchValues.teamNumber.text = teamNumber.toString()); + } + + setState(() { + AppDataHelper.resetStates(); + }); + Navigator.of(context, rootNavigator: true).pop('dialog'); + Navigator.push(context, MaterialPageRoute(builder: (context) { + return const PrematchRoute(title: "Prematch Data"); + })); + }, + ); // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: const Text("Confirmation: Reset ALL Fields"), + content: const Text( + "Would you like to reset all of the fields current inputted?"), + actions: [ + cancelButton, + continueButton, + ], + ); // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } } diff --git a/lib/utils/data/values/SettingValues.dart b/lib/utils/data/values/SettingValues.dart index 51f21b5..be8583e 100644 --- a/lib/utils/data/values/SettingValues.dart +++ b/lib/utils/data/values/SettingValues.dart @@ -16,6 +16,6 @@ class SettingValues { /// Gets the saving spreadhseet name based on the current filename static String getCurrentSavingSpreadsheetName() { - return "${eventID.text}.csv"; + return "${fileName.text}.csv"; } } From 3eb6aeadf44a2423b9babf3bfeaf0af40d3b00e9 Mon Sep 17 00:00:00 2001 From: noah-nm Date: Fri, 17 Jan 2025 19:47:16 -0500 Subject: [PATCH 3/4] Revert "Remove file name entry and fix buttons" This reverts commit ba6d46bfaa3898af0af09fe5e92b21d6afb79c90. --- lib/routes/auto/AutonomousDataRoute.dart | 2 + .../comments/fields/CommentsFields.dart | 97 ++++------ .../prematch/fields/PrematchFields.dart | 25 --- .../prematch/labels/PrematchLabels.dart | 25 ++- lib/routes/qrcode/QRCodeRoute.dart | 31 +++- lib/routes/settings/SettingsRoute.dart | 24 +-- lib/routes/teleop/TeleopRoute.dart | 171 ++++++------------ lib/utils/data/values/SettingValues.dart | 2 +- 8 files changed, 142 insertions(+), 235 deletions(-) diff --git a/lib/routes/auto/AutonomousDataRoute.dart b/lib/routes/auto/AutonomousDataRoute.dart index a1a4990..929d5cb 100644 --- a/lib/routes/auto/AutonomousDataRoute.dart +++ b/lib/routes/auto/AutonomousDataRoute.dart @@ -88,6 +88,7 @@ class _DataRouteState extends State { style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), backgroundColor: AppStyle.textInputColor, + padding: const EdgeInsets.all(15), ), onPressed: () { Navigator.push(context, @@ -112,6 +113,7 @@ class _DataRouteState extends State { style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), backgroundColor: AppStyle.textInputColor, + padding: const EdgeInsets.all(15), ), onPressed: () { Navigator.push(context, diff --git a/lib/routes/comments/fields/CommentsFields.dart b/lib/routes/comments/fields/CommentsFields.dart index 69d6010..661aed3 100644 --- a/lib/routes/comments/fields/CommentsFields.dart +++ b/lib/routes/comments/fields/CommentsFields.dart @@ -33,47 +33,45 @@ class _CommentsFields extends State { Align( alignment: Alignment.bottomRight, child: Container( - padding: EdgeInsets.only(right: 10), - height: 30.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppStyle - .textInputColorLight, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const TeleopRoute(title: "Teleop/Endgame"); - })); - }, - child: const Text("< Teleop/Endgame", - style: TextStyle( - fontSize: 12.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), + padding: const EdgeInsets.all(3.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: const EdgeInsets.all(15), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const TeleopRoute(title: "Teleop"); + })); + }, + child: const Text("< Teleop", + style: + TextStyle(fontSize: 16.0, color: Colors.white)), + ), + )), Align( alignment: Alignment.bottomRight, child: Container( - padding: EdgeInsets.only(right: 60), - height: 30.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppStyle - .textInputColorLight, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const QRCodeRoute(title: "QR Code"); - })); - }, - child: const Text("Current QR Code >", - style: TextStyle( - fontSize: 12.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), + padding: const EdgeInsets.all(3.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: const EdgeInsets.all(15), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const QRCodeRoute(title: "QR Code"); + })); + }, + child: const Text("Current QR Code >", + style: + TextStyle(fontSize: 16.0, color: Colors.white)), + ), + )), ]), ], ), @@ -128,29 +126,6 @@ class _CommentsFields extends State { height: 90.0, maxLines: 10, ), - Align( - alignment: Alignment.bottomRight, - child: Container( - padding: const EdgeInsets.only( - top: 4.0, right: 40, left: 80.0, bottom: 20.0), - height: 80.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppStyle - .textInputColorLight, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const QRCodeRoute(title: "QR Code"); - })); - }, - child: const Text("Current QR Code >", - style: TextStyle( - fontSize: 24.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), ], ); } diff --git a/lib/routes/prematch/fields/PrematchFields.dart b/lib/routes/prematch/fields/PrematchFields.dart index 72c3280..4ba2278 100644 --- a/lib/routes/prematch/fields/PrematchFields.dart +++ b/lib/routes/prematch/fields/PrematchFields.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import 'package:scouting_platform/builders/bases/NumberInputField.dart'; import 'package:scouting_platform/builders/bases/TextInputField.dart'; -import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; -import 'package:scouting_platform/styles/AppStyle.dart'; import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; @@ -140,29 +138,6 @@ class _PrematchFieldsState extends State { controller: PrematchValues.teamNumber, hintText: "Team Number", ), - Align( - alignment: Alignment.bottomRight, - child: Container( - padding: - const EdgeInsets.only(top: 4.0, right: 13, left: 100.0), - height: 47.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppStyle - .textInputColor, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const AutonomousDataRoute(title: "Auto"); - })); - }, - child: const Text("Auto >", - style: TextStyle( - fontSize: 16.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))) ], ); } diff --git a/lib/routes/prematch/labels/PrematchLabels.dart b/lib/routes/prematch/labels/PrematchLabels.dart index 4134f75..2940830 100644 --- a/lib/routes/prematch/labels/PrematchLabels.dart +++ b/lib/routes/prematch/labels/PrematchLabels.dart @@ -1,4 +1,6 @@ // ignore_for_file: file_names +import 'package:scouting_platform/styles/AppStyle.dart'; +import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; import 'package:flutter/material.dart'; class PrematchLabels extends StatefulWidget { @@ -20,8 +22,7 @@ class _PrematchLabelsState extends State { alignment: Alignment.centerLeft, child: Container( width: 170.0, - padding: - const EdgeInsets.only(left: 20.0, top: 20.0, right: 30.0), + padding: const EdgeInsets.only(left: 20.0, top: 20.0, right: 5.0), child: const Text( "Initials", textAlign: TextAlign.left, @@ -62,8 +63,24 @@ class _PrematchLabelsState extends State { fontSize: 15.0), ), )), - - const Divider(), + const SizedBox(width: 598.0), + Container( + padding: const EdgeInsets.all(5.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: const EdgeInsets.all(15), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (context) { + return const AutonomousDataRoute(title: "Auto"); + })); + }, + child: const Text("Auto >", + style: TextStyle(fontSize: 16.0, color: Colors.white)), + ), + ) ], ); } diff --git a/lib/routes/qrcode/QRCodeRoute.dart b/lib/routes/qrcode/QRCodeRoute.dart index 3bbbf70..a368839 100644 --- a/lib/routes/qrcode/QRCodeRoute.dart +++ b/lib/routes/qrcode/QRCodeRoute.dart @@ -10,6 +10,7 @@ import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/styles/AppStyle.dart'; +import 'package:scouting_platform/routes/comments/CommentsRoute.dart'; class QRCodeRoute extends StatefulWidget { const QRCodeRoute({super.key, required this.title}); @@ -40,11 +41,36 @@ class _QRCodeRouteState extends State { ), ), Positioned( - top: 16.0, - right: 16.0, + top: 5.0, + left: 5.0, child: ElevatedButton( style: ElevatedButton.styleFrom( minimumSize: const Size(150.0, 37.0), + padding: EdgeInsets.all(15.0), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (context) { + return const CommentsRoute(title: "Comments"); + })); + }, + child: const Text( + "< Comments", + style: TextStyle( + fontSize: 16.0, + fontFamily: "Helvetica", + color: Colors.white, + ), + ), + ), + ), + Positioned( + top: 5.0, + right: 5.0, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: EdgeInsets.all(15.0), backgroundColor: AppStyle.textInputColor, ), onPressed: () { @@ -117,4 +143,3 @@ class _QRCodeRouteState extends State { ); } } - diff --git a/lib/routes/settings/SettingsRoute.dart b/lib/routes/settings/SettingsRoute.dart index 3bdf75c..340aab8 100644 --- a/lib/routes/settings/SettingsRoute.dart +++ b/lib/routes/settings/SettingsRoute.dart @@ -113,28 +113,6 @@ class _SettingsRoute extends State { margin: const EdgeInsets.only(left: 40, top: 10)), ], ), - Column( - children: [ - const TitleStyle( - text: "File Name", - padding: EdgeInsets.only(left: 30, top: 10)), - TextInputField( - onChanged: (value) { - setState(() { - SettingValues.fileName.text = value; - }); - }, - textAlign: TextAlign.left, - hintText: "File Name", - controller: SettingValues.fileName, - margin: const EdgeInsets.only(left: 45, top: 10), - ), - ], - ) - ], - ), - Row( - children: [ Column( children: [ const TitleStyle( @@ -161,7 +139,7 @@ class _SettingsRoute extends State { ], ) ], - ) + ), ], ))); } diff --git a/lib/routes/teleop/TeleopRoute.dart b/lib/routes/teleop/TeleopRoute.dart index 463a038..2e2d2da 100644 --- a/lib/routes/teleop/TeleopRoute.dart +++ b/lib/routes/teleop/TeleopRoute.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:scouting_platform/builders/PlatformRoute.dart'; import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart'; import 'package:scouting_platform/routes/comments/CommentsRoute.dart'; -import 'package:scouting_platform/routes/prematch/PrematchRoute.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields2.dart'; import 'package:scouting_platform/routes/teleop/fields/TeleoperatedFields3.dart'; @@ -15,8 +14,6 @@ import 'package:scouting_platform/routes/teleop/labels/TeleoperatedLabels4.dart' import 'package:scouting_platform/styles/AppStyle.dart'; import 'package:scouting_platform/utils/data/values/PrematchValues.dart'; import 'package:scouting_platform/utils/data/values/SettingValues.dart'; -import 'package:scouting_platform/utils/helpers/AppDataHelper.dart'; -import 'package:scouting_platform/utils/helpers/ScheduleHelper.dart'; import 'package:scouting_platform/utils/helpers/UIHelper.dart'; class TeleopRoute extends StatefulWidget { @@ -34,64 +31,56 @@ class _TeleopRouteState extends State { UIHelper.setBrightness(0.3); } - @override Widget build(BuildContext context) { return PlatformRoute( title: widget.title, body: SingleChildScrollView( physics: const AlwaysScrollableScrollPhysics(), child: Column(children: [ + // Top-right aligned buttons Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Align( - alignment: Alignment.bottomRight, - child: Container( - padding: const EdgeInsets.only(top: 4.0, right: 10), - // height: 47.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 40.0), - backgroundColor: AppStyle - .textInputColor, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const AutonomousDataRoute(title: "Auto"); - })); - }, - child: const Text("< Auto", - style: TextStyle( - fontSize: 14.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), - Align( - alignment: Alignment.bottomRight, - child: Container( - padding: const EdgeInsets.only(top: 4.0, right: 60), - // height: 47.0, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - minimumSize: const Size(150.0, 40.0), - backgroundColor: AppStyle - .textInputColor, // Set the background color here - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const CommentsRoute(title: "Comments"); - })); - }, - child: const Text("Comments >", - style: TextStyle( - fontSize: 14.0, - fontFamily: "Helvetica", - color: Colors.white)), - ))), + Container( + padding: const EdgeInsets.all(5.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + padding: const EdgeInsets.all(15), + backgroundColor: AppStyle.textInputColor, + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const AutonomousDataRoute(title: "Auto"); + })); + }, + child: const Text("< Auto", + style: TextStyle(fontSize: 16.0, color: Colors.white)), + ), + ), + const SizedBox(width: 8), + Container( + padding: const EdgeInsets.all(5.0), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size(150.0, 37.0), + backgroundColor: AppStyle.textInputColor, + padding: EdgeInsets.all(15), + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const CommentsRoute(title: "Comments"); + })); + }, + child: const Text("Comments >", + style: TextStyle(fontSize: 16.0, color: Colors.white)), + ), + ), ], ), + // Other content const TeleoperatedLabels4(), const TeleoperatedFields4(), const TeleoperatedLabels3(), @@ -100,77 +89,23 @@ class _TeleopRouteState extends State { const TeleoperatedFields2(), const TeleoperatedLabels(), const TeleoperatedFields(), - // robot info Align( - alignment: Alignment.centerLeft, - child: Container( - width: 400.0, - padding: const EdgeInsets.only(top: 20.0, left: 20.0), - child: Text( - "Driver Station: ${SettingValues.selectedDriverStation.text}, Match #${PrematchValues.matchNumber.text}, Team #${PrematchValues.teamNumber.text}", - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15.0), - ), - )), + alignment: Alignment.centerLeft, + child: Container( + width: 400.0, + padding: const EdgeInsets.only(top: 20.0, left: 20.0), + child: Text( + "Driver Station: ${SettingValues.selectedDriverStation.text}, Match #${PrematchValues.matchNumber.text}, Team #${PrematchValues.teamNumber.text}", + textAlign: TextAlign.left, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15.0), + ), + ), + ), ]), ), ); } - - showConformationDialog(BuildContext context) { - // set up the buttons - Widget cancelButton = TextButton( - child: const Text("No"), - onPressed: () { - Navigator.of(context, rootNavigator: true).pop('dialog'); - }, - ); - Widget continueButton = TextButton( - child: const Text("Yes"), - onPressed: () { - // Increment the match number - if (PrematchValues.matchNumber.text != "") { - PrematchValues.matchNumber.text = - (int.parse(PrematchValues.matchNumber.text) + 1).toString(); - } else { - PrematchValues.matchNumber.text = (2).toString(); - } - - if (SettingValues.isTeamNumberReadOnly) { - // Get the team number from the schedule and set the team number field to that - Schedulehelper.getTeamNumberFromSchedule( - int.parse(// Get the team number from the schedule - PrematchValues.matchNumber.text)) - .then((teamNumber) => - PrematchValues.teamNumber.text = teamNumber.toString()); - } - - setState(() { - AppDataHelper.resetStates(); - }); - Navigator.of(context, rootNavigator: true).pop('dialog'); - Navigator.push(context, MaterialPageRoute(builder: (context) { - return const PrematchRoute(title: "Prematch Data"); - })); - }, - ); // set up the AlertDialog - AlertDialog alert = AlertDialog( - title: const Text("Confirmation: Reset ALL Fields"), - content: const Text( - "Would you like to reset all of the fields current inputted?"), - actions: [ - cancelButton, - continueButton, - ], - ); // show the dialog - showDialog( - context: context, - builder: (BuildContext context) { - return alert; - }, - ); - } } diff --git a/lib/utils/data/values/SettingValues.dart b/lib/utils/data/values/SettingValues.dart index be8583e..51f21b5 100644 --- a/lib/utils/data/values/SettingValues.dart +++ b/lib/utils/data/values/SettingValues.dart @@ -16,6 +16,6 @@ class SettingValues { /// Gets the saving spreadhseet name based on the current filename static String getCurrentSavingSpreadsheetName() { - return "${fileName.text}.csv"; + return "${eventID.text}.csv"; } } From 77a36e1c453f24fd50ca68e8eff207033db6132e Mon Sep 17 00:00:00 2001 From: noah-nm Date: Fri, 17 Jan 2025 20:11:10 -0500 Subject: [PATCH 4/4] Add missing override tag --- lib/routes/teleop/TeleopRoute.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/routes/teleop/TeleopRoute.dart b/lib/routes/teleop/TeleopRoute.dart index 2e2d2da..38661d6 100644 --- a/lib/routes/teleop/TeleopRoute.dart +++ b/lib/routes/teleop/TeleopRoute.dart @@ -31,6 +31,7 @@ class _TeleopRouteState extends State { UIHelper.setBrightness(0.3); } + @override Widget build(BuildContext context) { return PlatformRoute( title: widget.title,