Calendar - Finished
This commit is contained in:
@@ -13,8 +13,7 @@ class Calendar extends StatefulWidget {
|
|||||||
_Calendar createState() => _Calendar(sportID);
|
_Calendar createState() => _Calendar(sportID);
|
||||||
}
|
}
|
||||||
|
|
||||||
//List<sport_schedule> _selectedEvents; //original that makes events work
|
List _selectedEvents;
|
||||||
List _selectedEvents; //Removing the <sport_schedule> allows it to still work. Proceed with caution
|
|
||||||
DateTime selectedDay;
|
DateTime selectedDay;
|
||||||
Map<DateTime, List<sport_schedule>> _events;
|
Map<DateTime, List<sport_schedule>> _events;
|
||||||
|
|
||||||
@@ -36,7 +35,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
Iterable games = json.decode(response.body);
|
Iterable games = json.decode(response.body);
|
||||||
|
|
||||||
return games.map<sport_schedule>((json) => sport_schedule.fromJson(json)).toList();
|
return games.map<sport_schedule>((json) => sport_schedule.fromJson(json)).toList();
|
||||||
//return games.map((e) => sport_schedule.fromJson(e)).toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<DateTime, List<sport_schedule>>> getGames() async {
|
Future<Map<DateTime, List<sport_schedule>>> getGames() async {
|
||||||
@@ -63,9 +61,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
//final _selectedDay = DateTime.now();
|
|
||||||
|
|
||||||
//_selectedEvents = _events[_selectedDay] ?? [];
|
|
||||||
_selectedEvents = [];
|
_selectedEvents = [];
|
||||||
_calController = CalendarController();
|
_calController = CalendarController();
|
||||||
|
|
||||||
@@ -92,8 +87,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void _DaySelected(DateTime day, List<sport_schedule> events) { //original that makes events work
|
void _DaySelected(DateTime day, List events) {
|
||||||
void _DaySelected(DateTime day, List events) { //Removing the <sport_schedule> allows it to still work. Proceed with caution
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedEvents = events;
|
_selectedEvents = events;
|
||||||
selectedDay = DateTime(day.year, day.month, day.day);
|
selectedDay = DateTime(day.year, day.month, day.day);
|
||||||
@@ -128,7 +122,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
calendarController: _calController,
|
calendarController: _calController,
|
||||||
initialCalendarFormat: CalendarFormat.month,
|
initialCalendarFormat: CalendarFormat.month,
|
||||||
startingDayOfWeek: StartingDayOfWeek.sunday,
|
startingDayOfWeek: StartingDayOfWeek.sunday,
|
||||||
//availableGestures: AvailableGestures.all,
|
|
||||||
events: _events,
|
events: _events,
|
||||||
|
|
||||||
availableCalendarFormats: const {
|
availableCalendarFormats: const {
|
||||||
@@ -240,8 +233,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
Widget _buildEventsMarker(DateTime date, String gameType, bool main, events) {
|
Widget _buildEventsMarker(DateTime date, String gameType, bool main, events) {
|
||||||
String eventNum;
|
String eventNum;
|
||||||
if (main) {eventNum = "${date.day}";} else {eventNum = "${events.length}";}
|
if (main) {eventNum = "${date.day}";} else {eventNum = "${events.length}";}
|
||||||
|
|
||||||
//return Container(
|
|
||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
|
|
||||||
@@ -249,10 +240,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
/*border: Border.all(
|
|
||||||
color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
|
|
||||||
//color: Colors.black,
|
|
||||||
),*/
|
|
||||||
color: _calController.isSelected(date)
|
color: _calController.isSelected(date)
|
||||||
? Color.fromRGBO(179, 163, 105, 1) //UNCC Gold
|
? Color.fromRGBO(179, 163, 105, 1) //UNCC Gold
|
||||||
: _gameTypeColor(gameType, main), //UNCC Green
|
: _gameTypeColor(gameType, main), //UNCC Green
|
||||||
@@ -344,8 +331,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
|
|
||||||
trailing: Wrap(
|
trailing: Wrap(
|
||||||
//mainAxisSize: MainAxisSize.min,
|
|
||||||
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
//---Score---
|
//---Score---
|
||||||
//Game hasn't occured
|
//Game hasn't occured
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../monthly_calendar.dart';
|
import '../monthly_calendar.dart';
|
||||||
import '../screens/sport.dart' as globals;
|
|
||||||
class Schedule extends StatelessWidget{
|
class Schedule extends StatelessWidget{
|
||||||
|
|
||||||
final List sport;
|
final List sport;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class Sport extends StatelessWidget {
|
|||||||
title: buildDropdownButton(selectedSport, setState),
|
title: buildDropdownButton(selectedSport, setState),
|
||||||
backgroundColor: _curSport.color,
|
backgroundColor: _curSport.color,
|
||||||
|
|
||||||
//--Gender Switch-- Need to make condition to determine gender
|
//--Gender Switch--
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
if (genderSportSwitch)
|
if (genderSportSwitch)
|
||||||
Switch(
|
Switch(
|
||||||
|
|||||||
Reference in New Issue
Block a user