Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto screen #43

Merged
merged 16 commits into from
Jan 13, 2025
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions lib/builders/bases/CustomCheckbox.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// ignore_for_file: file_names
import 'package:flutter/material.dart';

class CustomCheckbox extends StatefulWidget {
final TextEditingController controller;
final String label;
final EdgeInsets margin;
final Color backgroundColor;
final Color checkColor;
final Color labelColor;

const CustomCheckbox({
super.key,
required this.controller,
this.label = "",
this.margin = const EdgeInsets.all(2.0),
this.backgroundColor = Colors.grey,
this.checkColor = Colors.white,
this.labelColor = Colors.white,
});

@override
State<CustomCheckbox> createState() => _CustomCheckboxState();
}

class _CustomCheckboxState extends State<CustomCheckbox> {
late bool isChecked;

@override
void initState() {
super.initState();
isChecked = widget.controller.text == "1";
widget.controller.addListener(_updateStateFromController);
}

@override
void dispose() {
widget.controller.removeListener(_updateStateFromController);
super.dispose();
}

void _updateStateFromController() {
setState(() {
isChecked = widget.controller.text == "1";
});
}

@override
Widget build(BuildContext context) {
return Container(
height: 30,
width: 50,
padding: const EdgeInsets.all(0),
margin: widget.margin,
color: widget.backgroundColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Checkbox(
value: isChecked,
onChanged: (bool? value) {
setState(() {
isChecked = value ?? false;
widget.controller.text = isChecked ? "1" : "0";
});
},
checkColor: widget.checkColor,
activeColor: Colors.blue,
),
if (widget.label.isNotEmpty)
Text(
widget.label,
style: TextStyle(
color: widget.labelColor,
fontSize: 16.0,
),
),
],
),
);
}
}
4 changes: 2 additions & 2 deletions lib/components/navigation/NavigationSidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:scouting_platform/components/navigation/components/SidebarItem.dart';
import 'package:scouting_platform/routes/auto/AutonomousDataRoute.dart';
import 'package:scouting_platform/routes/comments/CommentsRoute.dart';
import 'package:scouting_platform/routes/auto/AutoRoute.dart';
import 'package:scouting_platform/routes/qrcode/QRCodeRoute.dart';
import 'package:scouting_platform/routes/settings/SettingsRoute.dart';
import 'package:scouting_platform/routes/prematch/PrematchRoute.dart';
Expand Down Expand Up @@ -35,7 +35,7 @@ class NavigationSidebar extends StatelessWidget {
const SidebarItem(
icon: Icon(Icons.auto_awesome),
itemName: "Auto Data",
route: AutoRoute(title: 'Auto Input')),
route: AutonomousDataRoute(title: 'Auto Input')),
const SidebarItem(
icon: Icon(Icons.gamepad),
itemName: "Teleop Data",
Expand Down
177 changes: 0 additions & 177 deletions lib/routes/auto/AutoRoute.dart

This file was deleted.

Loading
Loading