launchInsightView static method
- BuildContext context,
- HollisticMatchScoutingData match
Implementation
static void launchInsightView(
BuildContext context, HollisticMatchScoutingData match) {
Navigator.of(context)
.push(MaterialPageRoute<Widget>(builder: (BuildContext _) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(
parent: BouncingScrollPhysics()),
child: Padding(
padding: const EdgeInsets.all(14),
child: Column(children: <Widget>[
const Row(children: <Widget>[
Icon(Icons.info_rounded),
SizedBox(width: 8),
Text("Preliminary",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20)),
]),
const SizedBox(height: 8),
Row(
children: <Widget>[
Flexible(
child: Text.rich(
TextSpan(children: <InlineSpan>[
const TextSpan(
text: "Scouter: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(text: match.preliminary.scouter),
const TextSpan(
text: "\nTime: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: DateFormat(
Shared.GENERAL_TIME_FORMAT)
.format(DateTime
.fromMillisecondsSinceEpoch(
match.preliminary
.timeStamp))),
const TextSpan(
text: "\nMatch: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text:
"${match.preliminary.matchType.name.formalize} #${match.preliminary.matchNumber}"),
const TextSpan(
text: "\nTeam: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text:
"${match.preliminary.teamNumber}"),
const TextSpan(
text: "\nAlliance: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.preliminary.alliance.name
.formalize,
style: TextStyle(
color: match.preliminary.alliance
.toColor(),
backgroundColor: Colors.black)),
const TextSpan(
text: "\nStarting Position: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.preliminary
.startingPosition.name.formalize),
]),
style: const TextStyle(fontSize: 16)),
),
const Spacer() // more scuffed solutions XD (see above)
],
),
const SizedBox(height: 16),
const Row(children: <Widget>[
Icon(CommunityMaterialIcons.robot),
SizedBox(width: 8),
Text("Auto",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20)),
]),
const SizedBox(height: 8),
Row(
children: <Widget>[
Flexible(
child: Text.rich(
TextSpan(children: <InlineSpan>[
const TextSpan(
text: "Taxi: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.auto.taxi ? "Yes" : "No"),
const TextSpan(
text: "\nScored Speaker: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.auto.scoredSpeaker
.toString()),
const TextSpan(
text: "\nScored Amp: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text:
match.auto.scoredAmp.toString()),
const TextSpan(
text: "\nNotes Preloaded: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.auto.notePreloaded
? "Yes"
: "No",
),
const TextSpan(
text: "\nAMP Missed: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text:
match.auto.missedAmp.toString()),
const TextSpan(
text: "\nSpeaker Missed: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.auto.missedSpeaker
.toString()),
]),
style: const TextStyle(fontSize: 16)),
),
const Spacer()
],
),
const SizedBox(height: 16),
const Row(children: <Widget>[
Icon(Icons.group_rounded),
SizedBox(width: 8),
Text("Tele-Op",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20)),
]),
const SizedBox(height: 8),
Row(
children: <Widget>[
Flexible(
child: Text.rich(
TextSpan(children: <InlineSpan>[
const TextSpan(
text: "Scored Speaker: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.teleop.scoredSpeaker
.toString()),
const TextSpan(
text: "\nScored Amp: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.teleop.scoredAmp
.toString()),
const TextSpan(
text: "\nPieces Scored: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: (match.teleop.scoredAmp +
match.teleop.scoredSpeaker)
.toString()),
const TextSpan(
text: "\nUnder Stage: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.teleop.underStage
? "Yes"
: "No"),
const TextSpan(
text: "\nLobs: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text:
match.teleop.lobs ? "Yes" : "No"),
const TextSpan(
text: "\nMissed Amp: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.teleop.missedAmp
.toString()),
const TextSpan(
text: "\nMissed Speaker: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.teleop.missedSpeaker
.toString()),
]),
style: const TextStyle(fontSize: 16)),
),
const Spacer()
],
),
const SizedBox(height: 16),
const Row(children: <Widget>[
Icon(Icons.commit_rounded),
SizedBox(width: 8),
Text("Endgame",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20)),
]),
const SizedBox(height: 8),
Row(
children: <Widget>[
Flexible(
child: Text.rich(
TextSpan(children: <InlineSpan>[
const TextSpan(
text: "End State: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match
.endgame.endState.name.formalize),
const TextSpan(
text: "\nHarmony: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match
.endgame.harmony.name.formalize),
const TextSpan(
text: "\nHarmony Attempted: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.endgame.harmonyAttempted
? "Yes"
: "No"),
const TextSpan(
text: "\nTrap Scored: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.endgame.trapScored.name
.formalize),
const TextSpan(
text: "\nCoopertition: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.misc.coopertition
.toString()),
const TextSpan(
text: "\nMatch Result: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: match.endgame.matchResult.name
.formalize),
]),
style: const TextStyle(fontSize: 16)),
),
const Spacer()
],
),
const SizedBox(height: 16),
const Row(children: <Widget>[
Icon(Icons.miscellaneous_services_rounded),
SizedBox(width: 8),
Text("Misc",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20)),
]),
const SizedBox(height: 8),
Row(
children: <Widget>[
Flexible(
child: Text.rich(
TextSpan(children: <InlineSpan>[
TextSpan(
text: "Comments:\n",
style: const TextStyle(
fontWeight: FontWeight.bold),
children: <InlineSpan>[
WidgetSpan(
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: ThemeProvider
.themeOf(
context)
.data
.iconTheme
.color!),
borderRadius:
BorderRadius
.circular(2)),
child: Padding(
padding:
const EdgeInsets.all(
2),
child: Text(
match.comments
.comment ??
"None",
style:
const TextStyle(
fontSize: 16),
softWrap: true),
))),
]),
const TextSpan(
text: "\nID: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(text: match.id),
const TextSpan(
text: "\nTimestamp: ",
style: TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: DateFormat(
Shared.GENERAL_TIME_FORMAT)
.format(DateTime
.fromMillisecondsSinceEpoch(
match.preliminary
.timeStamp))),
]),
style: const TextStyle(fontSize: 16)),
),
const Spacer()
],
),
const SizedBox(height: 40)
]),
)),
appBar: AppBar(
title: Row(
children: <Widget>[
const Icon(Icons.insights_rounded),
const SizedBox(width: 8),
Text(
"Insights for match ${match.preliminary.matchNumber} of team ${match.preliminary.teamNumber}"),
],
)),
);
}));
}