Standings - Layout to standings table

This commit is contained in:
kconnel7
2020-04-30 03:18:06 -04:00
parent 015fbd9dc9
commit 9fc67ee039
5 changed files with 119 additions and 15 deletions

View File

@@ -45,7 +45,6 @@ class HorizontalNewsFeed extends StatelessWidget {
icon: Icon(Icons.navigate_next),
onPressed: () => Navigator.of(context).pushNamed('/Sport', arguments: title.data),
/*onPressed: () { //changed
Navigator.of(context).pushNamed('/Sport');
print(Navigator.of(context).pushNamed('/Sport'));

View File

@@ -22,7 +22,7 @@ class RouteGenerator {
case '/Schedule':
return MaterialPageRoute(builder: (_) => Schedule(args));
case '/Standing':
return MaterialPageRoute(builder: (_) => Standing());
return MaterialPageRoute(builder: (_) => Standing(args));
case '/Chat':
return MaterialPageRoute(builder: (_) => Chat());
case '/Details':

View File

@@ -99,7 +99,7 @@ class Sport extends StatelessWidget {
ListTile(
title: IconButton(
icon: Icon(Icons.table_chart),
onPressed: () => Navigator.pushNamed(context, '/Standing', arguments: sport_ID),
onPressed: () => Navigator.pushNamed(context, '/Standing', arguments: [sport_ID, _curSport.name]),
),
),
ListTile(
@@ -158,8 +158,6 @@ class Sport extends StatelessWidget {
}
print(sport_ID);
}
}
class Item {

View File

@@ -1,8 +1,10 @@
import 'package:capstone_hungry_hippos/models/School.dart';
import 'package:flutter/material.dart';
import '../team_standings.dart';
class Standing extends StatelessWidget {
final _schools = [
/*final _schools = [
School("North Texas Mean Green",AssetImage('assets/school_logos/NorthTexas.png'), 14, 4),
School("Louisiana Tech Bulldogs",AssetImage('assets/school_logos/LT.png'), 13, 5),
School("Western Kentucky Hilltoppers",AssetImage('assets/school_logos/wku.png'), 13, 5),
@@ -17,11 +19,15 @@ class Standing extends StatelessWidget {
School("Rice Owls",AssetImage('assets/school_logos/RiceOwls.png'), 7, 11),
School("Southern Miss Golden Eagles",AssetImage('assets/school_logos/SouthernMiss.png'), 5, 13),
School("Middle Tennessee Blue Raiders",AssetImage('assets/school_logos/MT.png'), 4, 14),
];
];*/
final List sport;
Standing(this.sport);
@override
Widget build(BuildContext context) {
return Scaffold(
// *----- OLD CODE -------*
/*return Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("49ers"),
@@ -57,11 +63,65 @@ class Standing extends StatelessWidget {
],
),
),
);*/
// *----- Testing CODE -------*
var standings = Team_Standings(sport[0]);
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("${sport[1]}" + " Standings"),
backgroundColor: Colors.green,
),
body: Container (
child: standings,
),
/*body: SingleChildScrollView (
child: Column(
children: <Widget>[
Container(
child: standings,
alignment: Alignment(.85, 0),
height: 20,
color: Colors.grey,
),
],
),
),*/
drawer: Drawer(
child: ListView(
children: <Widget>[
DrawerHeader(
child: Text(
'Drawer Header',
style: TextStyle(
color: Colors.white,
fontSize: 24,
),
),
decoration: BoxDecoration(
color: Colors.green,
),
),
ListTile(
title: IconButton(
icon: Icon(Icons.home),
onPressed: () => Navigator.pushNamed(context, '/'),
),
),
],
),
),
),
);
}
}
class SportLine extends StatelessWidget {
/*class SportLine extends StatelessWidget {
const SportLine({
Key key,
@required
@@ -129,4 +189,4 @@ class SportLine extends StatelessWidget {
Color c = i % 2 == 0 ? Colors.black12 : Colors.white30;
return c;
}
}
}*/

View File

@@ -4,9 +4,9 @@ import 'package:http/http.dart' as http;
import 'screens/sport_standings_basketball.dart';
import 'dart:convert';
class Standings extends StatefulWidget {
class Team_Standings extends StatefulWidget {
final int sportID;
Standings(this.sportID);
Team_Standings(this.sportID);
@override
_Standings createState() => _Standings(sportID);
@@ -14,12 +14,12 @@ class Standings extends StatefulWidget {
List _selectedTeams;
class _Standings extends State<Standings> {
class _Standings extends State<Team_Standings> {
int sportID;
String sportUrl;
_Standings(this.sportID);
Future<List<sport_standings_basketball>> getEvents() async {
Future<List<sport_standings_basketball>> getTeams() async {
print(sportID);
switch(sportID.toString()) {
@@ -41,13 +41,60 @@ class _Standings extends State<Standings> {
http.Response response = await http.get(sportUrl);
Iterable games = json.decode(response.body);
return games.map<sport_standings_basketball>((json) => sport_standings_basketball.fromJson(json)).toList();
return games.map((e) => sport_standings_basketball.fromJson(e)).toList();
}
@override
void initState() {
_selectedTeams = [];
super.initState();
}
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: <Widget>[
_buildBasketballStandings(),
//Expanded(child: _eventLister()),
],
),
);
}
Widget _buildBasketballStandings() {
return Container(
margin: EdgeInsets.all(15),
child: Table(
border: TableBorder(
horizontalInside: BorderSide(
color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
),
verticalInside: BorderSide(
color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
),
top: BorderSide(
color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
),
bottom: BorderSide(
color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
),
),
columnWidths: {0: FractionColumnWidth(.3), 1: FractionColumnWidth(.3), 2: FractionColumnWidth(.5)},
children: [
TableRow( children: [
Column(children:[Text('')]),
Column(children:[Text('Conference')]),
Column(children:[Text('Overall')]),
]),
TableRow( children: [
Column(children:[Text('')]),
Column(children:[Text('W-L GB PCT')]),
Column(children:[Text('PCT HOME AWAY STRK')]),
]),
// ** Make loop based on number of teams **
],
),