Calendar shows what sport, and little box for games with more than 1 game
This commit is contained in:
@@ -208,14 +208,20 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
markersBuilder: (context, date, events, holidays) {
|
markersBuilder: (context, date, events, holidays) {
|
||||||
final miniBox = <Widget>[];
|
final miniBox = <Widget>[];
|
||||||
|
|
||||||
if (events.isNotEmpty) {
|
if (events.isNotEmpty) {
|
||||||
miniBox.add(
|
miniBox.add(
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 0,top: 0, left: 0, bottom: 0,
|
right: 0,top: 0, left: 0, bottom: 0,
|
||||||
child: _buildEventsMarker(date, events[0].location_indicator),
|
child: _buildEventsMarker(date, events[0].location_indicator, true, events),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
if (events.length > 1)
|
||||||
|
miniBox.add(
|
||||||
|
Positioned(
|
||||||
|
right: 1, bottom: 1,
|
||||||
|
child: _buildEventsMarker(date, events[0].location_indicator, false, events),
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return miniBox;
|
return miniBox;
|
||||||
@@ -234,7 +240,10 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----- Creates event box display (mini box) -----
|
//----- Creates event box display (mini box) -----
|
||||||
Widget _buildEventsMarker(DateTime date, String location) {
|
Widget _buildEventsMarker(DateTime date, String location, bool main, events) {
|
||||||
|
String s;
|
||||||
|
if (main) {s = "${date.day}";} else {s = "${events.length}";}
|
||||||
|
|
||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
|
|
||||||
@@ -253,7 +262,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
//if selected date && home game / else away game
|
//if selected date && home game / else away game
|
||||||
color: _calController.isSelected(date)
|
color: _calController.isSelected(date)
|
||||||
? Colors.blue[400]
|
? Colors.blue[400]
|
||||||
: _homeAwayColor(location), //UNCC Green
|
: _homeAwayColor(location, main), //UNCC Green
|
||||||
//: Colors.grey,
|
//: Colors.grey,
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -262,7 +271,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'${date.day}',
|
s,
|
||||||
style: TextStyle().copyWith(
|
style: TextStyle().copyWith(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 12.0,
|
fontSize: 12.0,
|
||||||
@@ -272,7 +281,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Color _homeAwayColor(String location){
|
Color _homeAwayColor(String location, bool main){
|
||||||
//TODO: Here should be the logic on if Home or Away return the colors
|
//TODO: Here should be the logic on if Home or Away return the colors
|
||||||
// Do whatever you need to do to check home/away
|
// Do whatever you need to do to check home/away
|
||||||
// my guess is if the game says vs its home
|
// my guess is if the game says vs its home
|
||||||
@@ -285,6 +294,9 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
|
|||||||
} else {
|
} else {
|
||||||
c = Colors.grey;
|
c = Colors.grey;
|
||||||
}
|
}
|
||||||
|
if (!main){
|
||||||
|
c = Colors.black45;//Color.fromRGBO(179, 163, 105, 1);
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,17 @@ import '../monthly_calendar.dart';
|
|||||||
import '../screens/sport.dart' as globals;
|
import '../screens/sport.dart' as globals;
|
||||||
class Schedule extends StatelessWidget{
|
class Schedule extends StatelessWidget{
|
||||||
|
|
||||||
final int sportID;
|
final List sport;
|
||||||
Schedule(this.sportID);
|
Schedule(this.sport);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var calendar = Calendar(sportID);
|
var calendar = Calendar(sport[0]);
|
||||||
return StatefulBuilder(
|
return StatefulBuilder(
|
||||||
builder: (context, StateSetter setState) => Scaffold(
|
builder: (context, StateSetter setState) => Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
title: Text("49ers"),
|
title: Text("${sport[1]}"),
|
||||||
backgroundColor: Colors.green,
|
backgroundColor: Colors.green,
|
||||||
),
|
),
|
||||||
body: Container (
|
body: Container (
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class Sport extends StatelessWidget {
|
|||||||
ListTile(
|
ListTile(
|
||||||
title: IconButton(
|
title: IconButton(
|
||||||
icon: Icon(Icons.calendar_today),
|
icon: Icon(Icons.calendar_today),
|
||||||
onPressed: () => Navigator.pushNamed(context, '/Schedule',arguments: sport_ID),
|
onPressed: () => Navigator.pushNamed(context, '/Schedule',arguments: [sport_ID, _curSport.name],),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user