Skip to content

Commit

Permalink
It works...
Browse files Browse the repository at this point in the history
  • Loading branch information
MADMAN-Modding committed Apr 27, 2024
1 parent 89193ef commit d025002
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 41 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
148 changes: 110 additions & 38 deletions app/lib/pages/controls.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: prefer_const_literals_to_create_immutables, prefer_const_constructors

import 'package:flutter/material.dart';
import 'package:falcons_esports_overlays_controller/handlers/json_handler.dart';
import 'package:flutter/widgets.dart';
Expand Down Expand Up @@ -32,9 +34,57 @@ class _ControlsPage extends State<ControlsPage> {
leftTeamName.text = jsonHandler.readOverlay('teamNameLeft');
rightTeamName.text = jsonHandler.readOverlay('teamNameRight');
week.text = jsonHandler.readOverlay('week');
teamColorRight.text = jsonHandler.readOverlay('teamColorRight');
return Column(
children: [
const Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
),
onPressed: () {
jsonHandler.writeOverlay("overlay", "ssbu");
},
child: Image.asset(
'images/SSBU.png',
width: 200,
height: 200,
),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
),
onPressed: () {
jsonHandler.writeOverlay("overlay", "kart");
},
child: Image.asset(
'images/Kart.png',
width: 200,
height: 200,
),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
),
onPressed: () {
jsonHandler.writeOverlay("overlay", "rocketLeague");
},
child: Image.asset(
'images/RL.png',
width: 200,
height: 200,
),
)
],
),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
// Left Team Wins
Padding(
padding: EdgeInsets.all(16.0),
Expand All @@ -46,37 +96,37 @@ class _ControlsPage extends State<ControlsPage> {
]),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Padding(
padding: const EdgeInsets.only(right: 4),
padding: EdgeInsets.only(right: 4),
child: ElevatedButton(
onPressed: () {
jsonHandler.writeOverlay('winsLeft', '0');
},
child: const Text("0")),
child: Text("0")),
),
Padding(
padding: const EdgeInsets.only(right: 4),
padding: EdgeInsets.only(right: 4),
child: ElevatedButton(
onPressed: () {
jsonHandler.writeOverlay('winsLeft', '1');
},
child: const Text('1')),
child: Text('1')),
),
Padding(
padding: const EdgeInsets.only(right: 4),
padding: EdgeInsets.only(right: 4),
child: ElevatedButton(
onPressed: () {
jsonHandler.writeOverlay('winsLeft', '2');
},
child: const Text('2')),
child: Text('2')),
),
ElevatedButton(
onPressed: () {
jsonHandler.writeOverlay('winsLeft', '3');
},
child: const Text('3')),
child: Text('3')),
]),
// Right Team Wins
const Row(
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
Expand All @@ -92,37 +142,37 @@ class _ControlsPage extends State<ControlsPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(right: 4),
padding: EdgeInsets.only(right: 4),
child: ElevatedButton(
onPressed: () {
jsonHandler.writeOverlay('winsRight', '0');
},
child: const Text('0')),
child: Text('0')),
),
Padding(
padding: const EdgeInsets.only(right: 4),
padding: EdgeInsets.only(right: 4),
child: ElevatedButton(
onPressed: () {
jsonHandler.writeOverlay('winsRight', '1');
},
child: const Text("1")),
child: Text("1")),
),
Padding(
padding: const EdgeInsets.only(right: 4),
padding: EdgeInsets.only(right: 4),
child: ElevatedButton(
onPressed: () {
jsonHandler.writeOverlay('winsRight', '2');
},
child: const Text('2')),
child: Text('2')),
),
ElevatedButton(
onPressed: () {
jsonHandler.writeOverlay('winsRight', '3');
},
child: const Text('3')),
child: Text('3')),
],
),
const Padding(
Padding(
padding: EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -143,7 +193,7 @@ class _ControlsPage extends State<ControlsPage> {
width: 35,
child: TextField(
controller: leftScore,
decoration: const InputDecoration(
decoration: InputDecoration(
border: UnderlineInputBorder(),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2.0),
Expand All @@ -154,21 +204,21 @@ class _ControlsPage extends State<ControlsPage> {
hintText: 'Left Score',
hintStyle: TextStyle(color: Colors.white),
),
style: const TextStyle(color: Colors.white),
style: TextStyle(color: Colors.white),
onChanged: (value) =>
jsonHandler.writeOverlay('scoreLeft', value),
textAlign: TextAlign.center,
),
),
// Right Score
Padding(
padding: const EdgeInsets.only(left: 8),
padding: EdgeInsets.only(left: 8),
child: SizedBox(
height: 50,
width: 35,
child: TextField(
controller: rightScore,
decoration: const InputDecoration(
decoration: InputDecoration(
border: UnderlineInputBorder(),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2.0),
Expand All @@ -179,7 +229,7 @@ class _ControlsPage extends State<ControlsPage> {
hintText: 'Right Score',
hintStyle: TextStyle(color: Colors.white),
),
style: const TextStyle(color: Colors.white),
style: TextStyle(color: Colors.white),
onChanged: (value) =>
jsonHandler.writeOverlay('scoreRight', value),
textAlign: TextAlign.center,
Expand All @@ -188,7 +238,7 @@ class _ControlsPage extends State<ControlsPage> {
)
],
),
const Padding(
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -208,7 +258,7 @@ class _ControlsPage extends State<ControlsPage> {
height: 50,
child: TextField(
controller: leftTeamName,
decoration: const InputDecoration(
decoration: InputDecoration(
border: UnderlineInputBorder(),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2.0),
Expand All @@ -219,20 +269,20 @@ class _ControlsPage extends State<ControlsPage> {
hintText: 'Left Team Name',
hintStyle: TextStyle(color: Colors.white),
),
style: const TextStyle(color: Colors.white),
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
onChanged: (value) =>
jsonHandler.writeOverlay('teamNameLeft', value),
),
),
Padding(
padding: const EdgeInsets.only(left: 8),
padding: EdgeInsets.only(left: 8),
child: SizedBox(
width: 200,
height: 50,
child: TextField(
controller: rightTeamName,
decoration: const InputDecoration(
decoration: InputDecoration(
border: UnderlineInputBorder(),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2.0),
Expand All @@ -243,7 +293,7 @@ class _ControlsPage extends State<ControlsPage> {
hintText: 'Right Team Name',
hintStyle: TextStyle(color: Colors.white),
),
style: const TextStyle(color: Colors.white),
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
onChanged: (value) =>
jsonHandler.writeOverlay('teamNameRight', value),
Expand All @@ -252,7 +302,7 @@ class _ControlsPage extends State<ControlsPage> {
),
],
),
const Padding(
Padding(
padding: EdgeInsets.only(top: 19.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -272,7 +322,7 @@ class _ControlsPage extends State<ControlsPage> {
height: 50,
child: TextField(
controller: week,
decoration: const InputDecoration(
decoration: InputDecoration(
border: UnderlineInputBorder(),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2.0),
Expand All @@ -283,14 +333,14 @@ class _ControlsPage extends State<ControlsPage> {
hintText: 'Week',
hintStyle: TextStyle(color: Colors.white),
),
style: const TextStyle(color: Colors.white),
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
onChanged: (value) => jsonHandler.writeOverlay('week', value),
),
)
],
),
const Padding(
Padding(
padding: EdgeInsets.only(top: 19.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -309,16 +359,38 @@ class _ControlsPage extends State<ControlsPage> {
pickerColor: HexColor(jsonHandler.readOverlay('teamColorRight')),
onColorChanged: (Color color) {
jsonHandler.writeOverlay('teamColorRight',
"$color".replaceAll("Color(0xff", "").replaceAll(")", ""));
"#$color".replaceAll("Color(0xff", "").replaceAll(")", ""));
teamColorRight.text =
"#$color".replaceAll("Color(0xff", "").replaceAll(")", "");
},
enableAlpha: false,
colorPickerWidth: 100,
labelTypes: const [],
hexInputBar: true,
hexInputController: teamColorRight,
)
labelTypes: [],
),
SizedBox(
width: 80,
height: 50,
child: TextField(
controller: teamColorRight,
decoration: InputDecoration(
border: UnderlineInputBorder(),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2.0),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 2.0),
),
hintText: 'Team Color Right',
hintStyle: TextStyle(color: Colors.white),
),
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
onChanged: (value) =>
jsonHandler.writeOverlay('teamColorRight', value),
),
),
],
)
),
],
);
}
Expand Down
9 changes: 6 additions & 3 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ flutter:
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
assets:
- images/Kart.png
- images/RL.png
- images/SPLAT.png
- images/SSBU.png
- images/VAL.png

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
Expand Down

0 comments on commit d025002

Please sign in to comment.