diff --git a/lib/news/feed.dart b/lib/news/feed.dart index f1938c6..18702f8 100644 --- a/lib/news/feed.dart +++ b/lib/news/feed.dart @@ -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')); diff --git a/lib/route_generator.dart b/lib/route_generator.dart index 3af16f5..e0caca6 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -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': diff --git a/lib/screens/sport.dart b/lib/screens/sport.dart index 52e33a0..8a1bbba 100644 --- a/lib/screens/sport.dart +++ b/lib/screens/sport.dart @@ -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 { diff --git a/lib/screens/standing.dart b/lib/screens/standing.dart index fb1c0c6..cfd614f 100644 --- a/lib/screens/standing.dart +++ b/lib/screens/standing.dart @@ -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: [ + Container( + child: standings, + alignment: Alignment(.85, 0), + height: 20, + color: Colors.grey, + ), + ], + ), + ),*/ + + drawer: Drawer( + child: ListView( + children: [ + 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; } -} +}*/ diff --git a/lib/team_standings.dart b/lib/team_standings.dart index cd7c434..4f31a03 100644 --- a/lib/team_standings.dart +++ b/lib/team_standings.dart @@ -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 { +class _Standings extends State { int sportID; String sportUrl; _Standings(this.sportID); - Future> getEvents() async { + Future> getTeams() async { print(sportID); switch(sportID.toString()) { @@ -41,13 +41,60 @@ class _Standings extends State { http.Response response = await http.get(sportUrl); Iterable games = json.decode(response.body); - return games.map((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: [ + _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 ** ], ),