Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8245ea4
changes
Komet20 Nov 13, 2022
101c08f
Added setters and getters to the Trick Generator class
Komet20 Nov 14, 2022
8463c9c
Merge pull request #2 from blf885/TrickGenerator_setters/getters
blf885 Nov 14, 2022
74ab4ba
Added Functional Generation Based on Vehicle Choice
LogicLogin Nov 16, 2022
7ee16f5
Merge branch 'main' of https://github.com/blf885/CS3141-sectionR02-te…
LogicLogin Nov 16, 2022
83d597a
Revert "Merge branch 'main' of https://github.com/blf885/CS3141-secti…
LogicLogin Nov 16, 2022
d92b70e
Updated Trick class unit tests slightly
blf885 Nov 16, 2022
7cd8d8d
Merge branch 'main' of https://github.com/blf885/CS3141-sectionR02-te…
blf885 Nov 16, 2022
43f8ff0
Merge pull request #1 from blf885/new_Trick_List
blf885 Nov 16, 2022
71d2eb8
Added the line divide between tests
blf885 Nov 16, 2022
52165fd
Various Stylized Changes and View Function
LogicLogin Nov 17, 2022
65e104b
Merge branch 'main' of https://github.com/blf885/CS3141-sectionR02-te…
LogicLogin Nov 17, 2022
831f1e2
Fixed the trick class tests
blf885 Nov 18, 2022
62a6798
Merge branch 'main' of https://github.com/blf885/CS3141-sectionR02-te…
blf885 Nov 18, 2022
ac48356
Updated the report and changed its name
blf885 Dec 2, 2022
d724759
Delete Project assignment2-the Project report_Team_11.docx
blf885 Dec 2, 2022
637c43a
Fully functional TrickList class and tests
blf885 Dec 2, 2022
46968f7
Changed the trickListScooter to use TrickList clas
blf885 Dec 3, 2022
c51e9c1
Removed extra junk
blf885 Dec 3, 2022
eea47e2
added additional tricklist tests
blf885 Dec 3, 2022
2168f43
Further test updates
blf885 Dec 3, 2022
10236d6
Test Commit
blf885 Dec 5, 2022
1f37794
Difficulty Generator & View Trick Pages
LogicLogin Dec 6, 2022
ffaeaec
Video Player
LogicLogin Dec 7, 2022
ad4b98b
Cleaned up some code for resume
blf885 Jan 28, 2023
43a28dc
Merge branch 'main' of https://github.com/blf885/CS3141-sectionR02-te…
blf885 Jan 28, 2023
9cef52a
Update README.md
blf885 Jan 28, 2023
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
270 changes: 164 additions & 106 deletions project_knievel/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,27 @@ void main() {
));
}

int vehicleChoice = 0;
var textTrickController = TextEditingController();
String vehicleText = '';

class ChooseVehicle extends StatelessWidget {
const ChooseVehicle({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xff220901),
appBar: AppBar(
title: const Text('Project Knievel'),
centerTitle: true,
backgroundColor: const Color(0xff941B0C),
title: const Text(
'Project Knievel',
style: TextStyle(
color: Color(0xffffffff),
fontWeight: FontWeight.bold),
),
),
body: Padding(
padding: const EdgeInsets.all(15),
Expand All @@ -35,7 +47,13 @@ class ChooseVehicle extends StatelessWidget {
const TextStyle(fontSize: 20, color: Colors.black),
),
onPressed: null,
child: const Text('Choose a Vehicle'),
child: const Text(
'Choose a Vehicle',
style: TextStyle(
color: Color(0xffBC3908),
fontWeight: FontWeight.bold,
),
),
),
Container(
margin: const EdgeInsets.all(25),
Expand All @@ -44,9 +62,20 @@ class ChooseVehicle extends StatelessWidget {
elevation: 25,
minimumSize: const Size(200, 50),
maximumSize: const Size(200, 50),
backgroundColor: const Color(0xff941B0C),
),
child: const Text(
"Skateboard",
style: TextStyle(
color: Color(0xffffffff),
fontWeight: FontWeight.bold,
),
),
child: const Text("Skateboard"),
onPressed: () {
vehicleChoice = 1;
vehicleText = "Skateboard";
textTrickController.text = "";

Navigator.push(
context,
MaterialPageRoute(
Expand All @@ -62,9 +91,20 @@ class ChooseVehicle extends StatelessWidget {
elevation: 25,
minimumSize: const Size(200, 50),
maximumSize: const Size(200, 50),
backgroundColor: const Color(0xff941B0C),
),
child: const Text(
"Scooter",
style: TextStyle(
color: Color(0xffffffff),
fontWeight: FontWeight.bold,
),
),
child: const Text("Scooter"),
onPressed: () {
vehicleChoice = 2;
vehicleText = "Scooter";
textTrickController.text = "";

Navigator.push(
context,
MaterialPageRoute(
Expand All @@ -80,9 +120,20 @@ class ChooseVehicle extends StatelessWidget {
elevation: 25,
minimumSize: const Size(200, 50),
maximumSize: const Size(200, 50),
backgroundColor: const Color(0xff941B0C),
),
child: const Text(
"Bike",
style: TextStyle(
color: Color(0xffffffff),
fontWeight: FontWeight.bold,
),
),
child: const Text("Bike"),
onPressed: () {
vehicleChoice = 3;
vehicleText = "Bike";
textTrickController.text = "";

Navigator.push(
context,
MaterialPageRoute(
Expand Down Expand Up @@ -205,11 +256,38 @@ final List<String> difficulty = [
'Hard',
];

var trickList = ['A', 'B', 'C', 'D', 'C'];
var trickListSkateboard = ['Manual', 'Switch', 'Ollie', 'Kickflip', 'Schuvvit', 'Nose Stall', 'Tray Flip', 'Hard Flip', 'Backside 180'];
var trickListScooter = ['Tail Whip', 'Bar Spin', 'Heal Whip', 'Finger Whip', 'Tail Whip Rewind', 'Turn Down', 'Bri Flip', 'Inward Bri Flip', 'Back Flip'];
var trickListBike = ['Bunny Hop', 'Manual', 'Air', 'Bar Spin', '360', 'Crank Flip', 'Toboggan', 'X-Up', 'Tail Whip'];

class ViewTrickWidget extends StatefulWidget {
const ViewTrickWidget({super.key});

//final TextEditingController _controller = TextEditingController();
@override
// ignore: library_private_types_in_public_api
_ViewTrick createState() => _ViewTrick();
}

var textTrickController = new TextEditingController();
class _ViewTrick extends State<ViewTrickWidget> {
String viewTrickName = textTrickController.text;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xff220901),
appBar: AppBar(
centerTitle: true,
backgroundColor: const Color(0xff941B0C),
title: Text(
'View Trick: $viewTrickName',
style: const TextStyle(
color: Color(0xffffffff),
fontWeight: FontWeight.bold,
),
),
),
);
}
}

class TrickGenWidget extends StatefulWidget {
const TrickGenWidget({super.key});
Expand All @@ -223,21 +301,61 @@ class _TrickGen extends State<TrickGenWidget> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xff220901),
appBar: AppBar(
title: const Text('Trick Generator'),
centerTitle: true,
backgroundColor: const Color(0xff941B0C),
title: const Text(
'Trick Generator',
style: TextStyle(color: Color(0xffffffff)),
),
),
body: Padding(
padding: const EdgeInsets.all(15),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [

Container(
margin: const EdgeInsets.all(25),
child: TextField(
controller: textTrickController,
textAlign: TextAlign.center,
child: Text(
vehicleText,
style: const TextStyle(
color: Color(0xffBC3908),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),

Container(
margin: const EdgeInsets.all(25),
child: OutlinedButton(
style: OutlinedButton.styleFrom(
minimumSize: const Size(200, 50),
maximumSize: const Size(200, 50),
backgroundColor: const Color(0xff941B0C),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ViewTrickWidget()),
);
},
child: TextField(
enabled: false,
controller: textTrickController,
textAlign: TextAlign.center,
decoration: const InputDecoration(
border: InputBorder.none,
),
style: const TextStyle(
color: Color(0xffffffff),
fontWeight: FontWeight.bold,
),
),
),
),

Expand All @@ -248,33 +366,58 @@ class _TrickGen extends State<TrickGenWidget> {
elevation: 25,
minimumSize: const Size(200, 50),
maximumSize: const Size(200, 50),
backgroundColor: const Color(0xff941B0C),
),
onPressed: () {

textTrickController.text = (trickList..shuffle()).first;

if (vehicleChoice == 1) {
textTrickController.text = (trickListSkateboard..shuffle()).first;
}
else if (vehicleChoice == 2) {
textTrickController.text = (trickListScooter..shuffle()).first;
}
else if (vehicleChoice == 3) {
textTrickController.text = (trickListBike..shuffle()).first;
}

},
child: const Text('Generate Trick'),
child: const Text(
'Generate Trick',
style: TextStyle(
color: Color(0xffffffff),
fontWeight: FontWeight.bold,
),
),
),
),

DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: const Color(0xff941B0C),
// ignore: prefer_const_constructors
hint: Text(
'Select Difficulty',
style: TextStyle(
style: const TextStyle(
color: Color(0xffffffff),
fontSize: 14,
color: Theme.of(context).hintColor,
fontWeight: FontWeight.bold,
),
),
// ignore: prefer_const_constructors
icon: Icon(
Icons.arrow_drop_down,
color: const Color(0xffffffff),
),
items: difficulty
.map((item) => DropdownMenuItem<String>(
value: item,
alignment: AlignmentDirectional.centerStart,
child: Text(
item,
style: const TextStyle(
color: Color(0xffffffff),
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
))
Expand All @@ -290,92 +433,7 @@ class _TrickGen extends State<TrickGenWidget> {
],
),
),
));
)
);
}
}
/*
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

final String title;

@override
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;

void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}

@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
*/
}
Loading