diff --git a/lib/screens/sport_schedule.dart b/lib/screens/sport_schedule.dart index a9c33f0..4b7539a 100644 --- a/lib/screens/sport_schedule.dart +++ b/lib/screens/sport_schedule.dart @@ -97,7 +97,7 @@ class GameCard extends StatelessWidget { )); } } - + Color winLoss(String wl){ if (wl == "W") { return Colors.green; @@ -132,64 +132,7 @@ class GameCard extends StatelessWidget { borderRadius: BorderRadius.circular(2), ); var logoWidth = 4.5; - var body = Column( - verticalDirection: VerticalDirection.up, - children: [ - Container( - color: Colors.white, - child: ListTile( - leading: SizedBox( - width: widthIn(ctx)/logoWidth, - child: _homeAwayImageOrder( - gameCard.location_indicator, - gameCard.image, - true, ctx)), - title: FittedBox( - fit: BoxFit.contain, - child: Wrap( - children: [ - if (gameCard.status == null) // no game yet - Text( - '${_months[gameCard.date.month]} ${gameCard.date.day}' - ) - else - _pastGameScore( - gameCard.location_indicator, - gameCard.status, - gameCard.team_score, - gameCard.opponent_score,), - ], - ) - ), - subtitle: FittedBox( - fit: BoxFit.contain, - child: Wrap( - children: [ - if (gameCard.status != null) // no game yet - Text( - '${_months[gameCard.date.month]} ${gameCard.date.day}', textAlign: TextAlign.center, - ) - else - Text('${gameCard.date.hour}:${gameCard.date.minute} PM'), - ], - ) - ), - trailing: SizedBox( - width: widthIn(ctx)/logoWidth, - child: _homeAwayImageOrder( - gameCard.location_indicator, - gameCard.image, - false, ctx)), - onTap: () { - print(gameCard.idSport); - - Navigator.pushNamed(ctx, '/Details', arguments: gameCard); - }, - ), - ), - ], - ); - + var body = buildCard(ctx, logoWidth, _months); return SizedBox( width: widthIn(ctx), child: Card( @@ -202,4 +145,102 @@ class GameCard extends StatelessWidget { ), ); } + + Widget buildCard(BuildContext ctx, double logoWidth, Map _months) { + + return Container( + color: Colors.green, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: _homeAwayImageOrder( + gameCard.location_indicator, + gameCard.image, + true, ctx), + ), + Container( + child: Wrap( + children: [ + if (gameCard.status == null) // no game yet + Text( + '${_months[gameCard.date.month]} ${gameCard.date.day}' + ) + else + _pastGameScore( + gameCard.location_indicator, + gameCard.status, + gameCard.team_score, + gameCard.opponent_score,), + ], + ) + ), + Expanded( + child: _homeAwayImageOrder( + gameCard.location_indicator, + gameCard.image, + false, ctx), + ) + ], + ), + ); +// return Column( +// verticalDirection: VerticalDirection.up, +// children: [ +// Container( +// color: Colors.white, +// child: ListTile( +// leading: SizedBox( +// width: widthIn(ctx)/logoWidth, +// child: _homeAwayImageOrder( +// gameCard.location_indicator, +// gameCard.image, +// true, ctx)), +// title: FittedBox( +// fit: BoxFit.contain, +// child: Wrap( +// children: [ +// if (gameCard.status == null) // no game yet +// Text( +// '${_months[gameCard.date.month]} ${gameCard.date.day}' +// ) +// else +// _pastGameScore( +// gameCard.location_indicator, +// gameCard.status, +// gameCard.team_score, +// gameCard.opponent_score,), +// ], +// ) +// ), +// subtitle: FittedBox( +// fit: BoxFit.contain, +// child: Wrap( +// children: [ +// if (gameCard.status != null) // no game yet +// Text( +// '${_months[gameCard.date.month]} ${gameCard.date.day}', textAlign: TextAlign.center, +// ) +// else +// Text('${gameCard.date.hour}:${gameCard.date.minute} PM'), +// ], +// ) +// ), +// trailing: SizedBox( +// width: widthIn(ctx)/logoWidth, +// child: _homeAwayImageOrder( +// gameCard.location_indicator, +// gameCard.image, +// false, ctx)), +// onTap: () { +// print(gameCard.idSport); +// +// Navigator.pushNamed(ctx, '/Details', arguments: gameCard); +// }, +// ), +// ), +// ], +// ); + } }