Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
workflow_dispatch:

env:
FLUTTER_VERSION: 3.24.4
FLUTTER_VERSION: 3.27.4

jobs:
formatting-analysis:
Expand Down
94 changes: 35 additions & 59 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/scheduler.dart';

// Project imports:
import 'package:scouting_site/pages/login_page.dart';
import 'package:scouting_site/pages/summation/averages/averages_page.dart';
import 'package:scouting_site/services/formatters/text_formatter_builder.dart';
import 'package:scouting_site/services/localstorage.dart';
import 'package:scouting_site/services/scouting/scouting.dart';
Expand Down Expand Up @@ -107,6 +106,7 @@ class _HomePageState extends State<HomePage> {

return Scaffold(
appBar: getScoutAppBar("Ionic-Scout"),
drawer: getScoutHamburgerMenu(context),
body: Container(
color: GlobalColors.backgroundColor,
child: SingleChildScrollView(
Expand Down Expand Up @@ -152,68 +152,44 @@ class _HomePageState extends State<HomePage> {
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
const SizedBox(
width: 5,
),
FloatingActionButton(
tooltip: "Entries",
child: const Icon(Icons.summarize),
onPressed: () async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AveragesPage(),
),
);
},
),
SizedBox(
width: (MediaQuery.of(context).size.width - 140),
),
FloatingActionButton(
heroTag: 1,
tooltip: "Scout",
child: const Icon(Icons.login_outlined),
onPressed: () async {
final scouterName = _scouterController.text.trim();
final gameNumber = _gameController.text.trim();
FloatingActionButton(
tooltip: "Scout",
child: const Icon(Icons.login_outlined),
onPressed: () async {
final scouterName = _scouterController.text.trim();
final gameNumber = _gameController.text.trim();

if (scouterName.isEmpty ||
_selectedTeam == null ||
(_teams.isNotEmpty && !_teams.contains(_selectedTeam)) ||
(_selectedTeam?.isEmpty ?? true)) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Validation Error'),
content:
const Text('Please fill in all required fields.'),
actions: [
TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
if (scouterName.isEmpty ||
_selectedTeam == null ||
(_teams.isNotEmpty && !_teams.contains(_selectedTeam)) ||
(_selectedTeam?.isEmpty ?? true)) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Validation Error'),
content:
const Text('Please fill in all required fields.'),
actions: [
TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
return;
}
},
);
return;
}

localStorage?.setInt("game", int.parse(gameNumber));
localStorage?.setString("scouter", scouterName);
localStorage?.setString("scoutedTeam", _selectedTeam ?? "");
localStorage?.setInt("game", int.parse(gameNumber));
localStorage?.setString("scouter", scouterName);
localStorage?.setString("scoutedTeam", _selectedTeam ?? "");

Scouting.advance(context);
},
),
],
Scouting.advance(context);
},
),
],
),
Expand Down
12 changes: 2 additions & 10 deletions lib/pages/summation/averages/averages_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:scouting_site/services/scouting/form_page_data.dart';
import 'package:scouting_site/services/scouting/question.dart';
import 'package:scouting_site/services/scouting/scouting.dart';
import 'package:scouting_site/theme.dart';
import 'package:scouting_site/widgets/scout_app_bar.dart';

class AveragesPage extends StatefulWidget {
List<FormData>? formsData;
Expand All @@ -36,13 +37,8 @@ class _AveragesPageState extends State<AveragesPage> {
return DefaultTabController(
length: 1 /* was previously 2 */,
child: Scaffold(
drawer: getScoutHamburgerMenu(context),
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: _handleBackButton,
tooltip: "Back",
color: GlobalColors.backButtonColor,
),
backgroundColor: GlobalColors.appBarColor,
title: const Text(
"Averages",
Expand Down Expand Up @@ -143,10 +139,6 @@ class _AveragesPageState extends State<AveragesPage> {
});
}

void _handleBackButton() {
Navigator.of(context).pop();
}

void getDocuments() async {
QuerySnapshot<Map<String, dynamic>>? snapshot = await DatabaseAPI
.instance.firestore
Expand Down
30 changes: 8 additions & 22 deletions lib/pages/summation/scouting_entries_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:scouting_site/services/scouting/scouting.dart';
import 'package:scouting_site/services/title_case.dart';
import 'package:scouting_site/theme.dart';
import 'package:scouting_site/widgets/dialog_widgets/dialog_text_input.dart';
import 'package:scouting_site/widgets/scout_app_bar.dart';

class ScoutingEntriesPage extends StatefulWidget {
const ScoutingEntriesPage({super.key});
Expand Down Expand Up @@ -66,13 +67,8 @@ class _ScoutingEntriesPageState extends State<ScoutingEntriesPage> {
}

return Scaffold(
drawer: getScoutHamburgerMenu(context),
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: _handleBackButton,
tooltip: "Back",
color: GlobalColors.backButtonColor,
),
backgroundColor: GlobalColors.appBarColor,
title: const Text(
"Scouting Entries",
Expand Down Expand Up @@ -199,26 +195,16 @@ class _ScoutingEntriesPageState extends State<ScoutingEntriesPage> {
),
),
),
floatingActionButton: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
onPressed: () {
getDocuments();
},
tooltip: "Re-Fetch Documents",
icon: const Icon(Icons.refresh_outlined),
),
const SizedBox(width: 12),
],
floatingActionButton: IconButton(
onPressed: () {
getDocuments();
},
tooltip: "Re-Fetch Documents",
icon: const Icon(Icons.refresh_outlined),
),
);
}

void _handleBackButton() {
Navigator.of(context).pop();
}

void getDocuments() async {
QuerySnapshot<Map<String, dynamic>>? snapshot = await DatabaseAPI
.instance.firestore
Expand Down
25 changes: 18 additions & 7 deletions lib/pages/summation/team_overview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/services.dart';

// Package imports:
import 'package:geekyants_flutter_gauges/geekyants_flutter_gauges.dart';
import 'package:geekyants_flutter_gauges/geekyants_flutter_gauges.dart';

// Project imports:
import 'package:scouting_site/services/cast.dart';
Expand Down Expand Up @@ -250,7 +251,8 @@ class _TeamOverviewPageState extends State<TeamOverviewPage> {
currPageGauges = [];
gauges.add(Text(
pageName,
textScaler: const TextScaler.linear(1.2),
textScaler: const TextScaler.linear(1.8),
style: const TextStyle(fontWeight: FontWeight.bold),
));

gauges.add(Row(
Expand All @@ -263,6 +265,7 @@ class _TeamOverviewPageState extends State<TeamOverviewPage> {
if (start == end) {
end = 10;
}
Color precentileColor = getColorByPrecentile(entry.value, end);
currPageGauges.add(
Column(
mainAxisSize: MainAxisSize.min,
Expand All @@ -277,22 +280,30 @@ class _TeamOverviewPageState extends State<TeamOverviewPage> {
hideLabels: false,
steps: 1,
color: Colors.black,
thickness: 40,
trackStyle: const TrackStyle(
labelStyle:
TextStyle(color: GlobalColors.teamColor)),
labelStyle: TextStyle(
color: GlobalColors.teamColor,
fontWeight: FontWeight.bold,
)),
trackLabelFormater: (double value) {
return value.toStringAsFixed(2);
},
),
valueBar: [
RadialValueBar(
valueBarThickness: 20,
valueBarThickness: 40,
value: entry.value,
color: getColorByPrecentile(entry.value, end),
color: precentileColor,
)
],
),
Text(entry.value.toStringAsFixed(2)),
Text(
entry.value.toStringAsFixed(2),
style: TextStyle(
color: precentileColor, fontWeight: FontWeight.bold),
textScaler: const TextScaler.linear(2),
),
],
),
Transform.translate(
Expand All @@ -302,7 +313,7 @@ class _TeamOverviewPageState extends State<TeamOverviewPage> {
],
),
);
currPageGauges.add(const SizedBox(width: 15));
currPageGauges.add(const SizedBox(width: 20));
}
}
}
Expand Down
80 changes: 74 additions & 6 deletions lib/widgets/scout_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,86 @@
import 'package:flutter/material.dart';

// Project imports:
import 'package:scouting_site/pages/home_page.dart';
import 'package:scouting_site/pages/summation/averages/averages_page.dart';
import 'package:scouting_site/pages/summation/scouting_entries_page.dart';
import 'package:scouting_site/theme.dart';

AppBar getScoutAppBar(String title) {
return AppBar(
backgroundColor: GlobalColors.appBarColor,
leading: Image.asset("images/team_logo.png"),
title: Text(
title,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: GlobalColors.teamColor,
leading: SizedBox(
child: Row(
children: [
Builder(
builder: (context) => IconButton(
icon: const Icon(Icons.menu),
onPressed: () {
Scaffold.of(context).openDrawer();
},
),
),
],
),
),
titleSpacing: 10,
title: Row(children: [
Image.asset(
"images/team_logo.png",
width: 44,
height: 44,
),
const SizedBox(width: 15),
Text(
title,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: GlobalColors.teamColor,
),
)
]),
);
}

void navigateTo(BuildContext context, Widget page) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => page,
),
);
}

Drawer getScoutHamburgerMenu(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
const DrawerHeader(
child: Text(""),
),
ListTile(
leading: const Icon(Icons.biotech_rounded),
title: const Text("Scout"),
onTap: () {
navigateTo(context, const HomePage());
},
),
ListTile(
leading: const Icon(Icons.summarize_rounded),
title: const Text("Avgs."),
onTap: () {
navigateTo(context, AveragesPage());
},
),
ListTile(
leading: const Icon(Icons.dataset_rounded),
title: const Text("Entries"),
onTap: () {
navigateTo(context, const ScoutingEntriesPage());
},
)
],
),
);
}
Loading
Loading