Sports page passes game ID to Schedule/Calendar properly and generates correct calendar
This commit is contained in:
@@ -7,8 +7,11 @@ import 'screens/sport.dart' as globals;
|
||||
import 'dart:convert';
|
||||
|
||||
class Calendar extends StatefulWidget {
|
||||
final int sportID;
|
||||
Calendar(this.sportID);
|
||||
|
||||
@override
|
||||
_Calendar createState() => _Calendar();
|
||||
_Calendar createState() => _Calendar(sportID);
|
||||
}
|
||||
|
||||
//List<sport_schedule> _selectedEvents; //original that makes events work
|
||||
@@ -17,12 +20,15 @@ DateTime selectedDay;
|
||||
Map<DateTime, List<sport_schedule>> _events;
|
||||
|
||||
class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
||||
int sportID;
|
||||
_Calendar(this. sportID);
|
||||
|
||||
AnimationController _animationController;
|
||||
CalendarController _calController;
|
||||
|
||||
int sportID = globals.Sport.sport_ID;
|
||||
static final sportUrl = 'https://charlotte49ers.com/services/adaptive_components.ashx?type=scoreboard&start=0&count=80';
|
||||
|
||||
|
||||
Future<List<sport_schedule>> getEvents() async {
|
||||
var url = '$sportUrl&sport_id=$sportID&name=&extra=%7B%7D';
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class RouteGenerator {
|
||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||
final args = settings
|
||||
.arguments; //This is how we pass arguments and can be used in case
|
||||
|
||||
print("args $args");
|
||||
switch (settings.name) {
|
||||
case '/':
|
||||
return MaterialPageRoute(builder: (_) => Home());
|
||||
@@ -20,7 +20,7 @@ class RouteGenerator {
|
||||
//We can put logic and stuff here for checking if logged in
|
||||
return MaterialPageRoute(builder: (_) => Sport(args));
|
||||
case '/Schedule':
|
||||
return MaterialPageRoute(builder: (_) => Schedule());
|
||||
return MaterialPageRoute(builder: (_) => Schedule(args));
|
||||
case '/Standing':
|
||||
return MaterialPageRoute(builder: (_) => Standing());
|
||||
case '/Chat':
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../monthly_calendar.dart';
|
||||
|
||||
import '../screens/sport.dart' as globals;
|
||||
class Schedule extends StatelessWidget{
|
||||
|
||||
final calendar = Calendar();
|
||||
final int sportID;
|
||||
Schedule(this.sportID);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var calendar = Calendar(sportID);
|
||||
return StatefulBuilder(
|
||||
builder: (context, StateSetter setState) => Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -38,7 +38,7 @@ class Sport extends StatelessWidget {
|
||||
return _curSport;
|
||||
}
|
||||
_curSport = _setDefault();
|
||||
int sport_ID = _curSport.sportID[0];
|
||||
sport_ID = _curSport.sportID[0];
|
||||
Item selectedSport;
|
||||
_genderSwitcherCheck();
|
||||
return StatefulBuilder(
|
||||
@@ -56,9 +56,7 @@ class Sport extends StatelessWidget {
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
genderSport = value;
|
||||
if (_curSport.sportID.length > 1){
|
||||
sport_ID = genderSport ? _curSport.sportID[1] : _curSport.sportID[0];
|
||||
}
|
||||
_genderSwitcherCheck();
|
||||
});
|
||||
},
|
||||
inactiveThumbColor: Colors.lightBlue,
|
||||
@@ -101,13 +99,13 @@ class Sport extends StatelessWidget {
|
||||
ListTile(
|
||||
title: IconButton(
|
||||
icon: Icon(Icons.table_chart),
|
||||
onPressed: () => Navigator.pushNamed(context, '/Standing'),
|
||||
onPressed: () => Navigator.pushNamed(context, '/Standing', arguments: sport_ID),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: IconButton(
|
||||
icon: Icon(Icons.calendar_today),
|
||||
onPressed: () => Navigator.pushNamed(context, '/Schedule'),
|
||||
onPressed: () => Navigator.pushNamed(context, '/Schedule',arguments: sport_ID),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -135,6 +133,7 @@ class Sport extends StatelessWidget {
|
||||
setState(() {
|
||||
_curSport = value;
|
||||
_genderSwitcherCheck();
|
||||
print(sport_ID);
|
||||
});
|
||||
},
|
||||
items: colorList.map<DropdownMenuItem<Item>>((Item item) {
|
||||
|
||||
Reference in New Issue
Block a user