Skip to content

Commit 00cd153

Browse files
noah-nmHoodieRocks
andauthored
Auto screen (#43)
* Diagram test * Full diagram test * Finshed auto screen * Better comments and removed unused imports * folder renames * revert folder names * Ignore stupid flutter snakecase naming * Updated default state * fix merging oversights * reorder teleop, move reset state * fix endgame options, add additional scout data * remove unused imports * formatting and commenting * update index comments for QR code * move reset methods to respective value file --------- Co-authored-by: HoodieRocks <[email protected]>
1 parent fdd92d3 commit 00cd153

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1904
-527
lines changed
Loading
Loading
Loading
Loading
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// ignore_for_file: file_names
2+
import 'package:flutter/material.dart';
3+
4+
class CustomCheckbox extends StatefulWidget {
5+
final TextEditingController controller;
6+
final String label;
7+
final EdgeInsets margin;
8+
final Color backgroundColor;
9+
final Color checkColor;
10+
final Color labelColor;
11+
12+
const CustomCheckbox({
13+
super.key,
14+
required this.controller,
15+
this.label = "",
16+
this.margin = const EdgeInsets.all(2.0),
17+
this.backgroundColor = Colors.grey,
18+
this.checkColor = Colors.white,
19+
this.labelColor = Colors.white,
20+
});
21+
22+
@override
23+
State<CustomCheckbox> createState() => _CustomCheckboxState();
24+
}
25+
26+
class _CustomCheckboxState extends State<CustomCheckbox> {
27+
late bool isChecked;
28+
29+
@override
30+
void initState() {
31+
super.initState();
32+
isChecked = widget.controller.text == "1";
33+
widget.controller.addListener(_updateStateFromController);
34+
}
35+
36+
@override
37+
void dispose() {
38+
widget.controller.removeListener(_updateStateFromController);
39+
super.dispose();
40+
}
41+
42+
void _updateStateFromController() {
43+
setState(() {
44+
isChecked = widget.controller.text == "1";
45+
});
46+
}
47+
48+
@override
49+
Widget build(BuildContext context) {
50+
return Container(
51+
height: 30,
52+
width: 50,
53+
padding: const EdgeInsets.all(0),
54+
margin: widget.margin,
55+
color: widget.backgroundColor,
56+
child: Row(
57+
mainAxisAlignment: MainAxisAlignment.start,
58+
crossAxisAlignment: CrossAxisAlignment.center,
59+
children: [
60+
Checkbox(
61+
value: isChecked,
62+
onChanged: (bool? value) {
63+
setState(() {
64+
isChecked = value ?? false;
65+
widget.controller.text = isChecked ? "1" : "0";
66+
});
67+
},
68+
checkColor: widget.checkColor,
69+
activeColor: Colors.blue,
70+
),
71+
if (widget.label.isNotEmpty)
72+
Text(
73+
widget.label,
74+
style: TextStyle(
75+
color: widget.labelColor,
76+
fontSize: 16.0,
77+
),
78+
),
79+
],
80+
),
81+
);
82+
}
83+
}

lib/components/navigation/NavigationSidebar.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import 'package:flutter/material.dart';
33
import 'package:flutter/services.dart';
44
import 'package:scouting_platform/components/navigation/components/SidebarItem.dart';
5+
import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart';
56
import 'package:scouting_platform/routes/comments/CommentsRoute.dart';
6-
import 'package:scouting_platform/routes/auto/AutoRoute.dart';
77
import 'package:scouting_platform/routes/qrcode/QRCodeRoute.dart';
88
import 'package:scouting_platform/routes/settings/SettingsRoute.dart';
99
import 'package:scouting_platform/routes/prematch/PrematchRoute.dart';
@@ -35,7 +35,7 @@ class NavigationSidebar extends StatelessWidget {
3535
const SidebarItem(
3636
icon: Icon(Icons.auto_awesome),
3737
itemName: "Auto Data",
38-
route: AutoRoute(title: 'Auto Input')),
38+
route: AutonomousDataRoute(title: 'Auto Input')),
3939
const SidebarItem(
4040
icon: Icon(Icons.gamepad),
4141
itemName: "Teleop Data",

lib/routes/auto/AutoRoute.dart

Lines changed: 0 additions & 177 deletions
This file was deleted.

0 commit comments

Comments
 (0)