diff --git a/lib/models/game_details.dart b/lib/models/game_details.dart new file mode 100644 index 0000000..206e5d3 --- /dev/null +++ b/lib/models/game_details.dart @@ -0,0 +1,177 @@ +import 'package:capstone_hungry_hippos/screens/sport_schedule.dart'; +import 'package:flutter/material.dart'; + + +//This will mode to Kalebs +class GameDetailsWidget extends StatelessWidget { + final sport_schedule gameCard; + + const GameDetailsWidget(this.gameCard); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("VS. ${gameCard.opponentTitle}"), + ), + body: ListView( + physics: const NeverScrollableScrollPhysics(), + children: [ + GameDetailsHeader(gameCard), + EasyAccess(), + ], + ), + ); + } +} //Move to Kalebs ^^^^ + +class GameDetailsHeader extends StatelessWidget { + final sport_schedule gameCard; + + const GameDetailsHeader( + this.gameCard, + ); + + Text _pastGameScore( + String homeAway, String winLoss, String uncc, String opponent) { + if (homeAway == "H" || homeAway == "T") { + return (Text('$uncc - $opponent')); + } else { + return (Text('$opponent - $uncc')); + } + } + + Image _homeAwayImageOrder( + String h, String opposingTeam, bool l, BuildContext ctx) { + if ((h == "H") == l) { + return (Image.network( + 'https://fiusports.com/images/logos/UNC-Charlotte.png?width=80&height=80&mode=max', + )); + } else { + return (Image.network( + 'https://charlotte49ers.com' + opposingTeam, + )); + } + } + + @override + Widget build(BuildContext context) { + var _months = { + 1: 'JAN', + 2: 'FEB', + 3: 'MAR', + 4: 'APR', + 5: 'MAY', + 6: 'JUN', + 7: 'JUL', + 8: 'AUG', + 9: 'SEP', + 10: 'OCT', + 11: 'NOV', + 12: 'DEC' + }; + var size = MediaQuery.of(context).size; + return SizedBox( + height: size.height / 7, + child: Container( + color: Colors.black26, + width: size.width, + child: Center( + child: ListTile( + leading: SizedBox( + width: size.width / 3, + child: _homeAwayImageOrder(gameCard.location_indicator, + gameCard.image, true, context)), + 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: size.width / 3, + child: _homeAwayImageOrder(gameCard.location_indicator, + gameCard.image, false, context)), + ), + )), + ); + } +} + +class EasyAccess extends StatelessWidget { + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + + return SizedBox( + height: size.height / 15, + child: Container( + color: Colors.black12, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + _button(context, "Play-by-Play"), + _button(context, "Chat") + ], + ), + ), + ); + } + + Widget _button(BuildContext context, String label) { + var size = MediaQuery.of(context).size; + label = (label == "Standings") ? "Standing" : label; + print(label); + var decoration = BoxDecoration( + border: Border.all( + color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green + ), + borderRadius: BorderRadius.circular(5) + ); + return Container( + child: GestureDetector( + onTap: () => print("clicked"), + //Navigator.pushNamed(context, "/$label"), + child: Card( + child: SizedBox( + width: size.width / 2.5, + child: Container( + decoration: decoration, + child:Container( + color: Colors.black12, + child: FittedBox( + fit: BoxFit.contain, + child: Text(label), + ))), + ), + ), + ), + ); + } +} + +//Class for pbp \ No newline at end of file diff --git a/lib/route_generator.dart b/lib/route_generator.dart index e0caca6..b36cc0f 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -1,12 +1,13 @@ -import 'package:capstone_hungry_hippos/screens/chat.dart'; -import 'package:capstone_hungry_hippos/screens/schedule.dart'; -import 'package:capstone_hungry_hippos/screens/standing.dart'; +import 'models/game_details.dart'; +import 'screens/chat.dart'; +import 'screens/schedule.dart'; +import 'screens/standing.dart'; import 'package:flutter/material.dart'; -import 'package:capstone_hungry_hippos/screens/home_widget.dart'; -import 'package:capstone_hungry_hippos/screens/sport.dart'; -import 'package:capstone_hungry_hippos/screens/twitter_widget.dart'; -import 'package:capstone_hungry_hippos/screens/favorites_reorder.dart'; -import 'package:capstone_hungry_hippos/screens/game_details.dart'; +import 'screens/home_widget.dart'; +import 'screens/sport.dart'; +import 'screens/twitter_widget.dart'; +import 'screens/favorites_reorder.dart'; + class RouteGenerator { static Route generateRoute(RouteSettings settings) { @@ -26,7 +27,7 @@ class RouteGenerator { case '/Chat': return MaterialPageRoute(builder: (_) => Chat()); case '/Details': - return MaterialPageRoute(builder: (_) => Details()); + return MaterialPageRoute(builder: (_) => GameDetailsWidget(args)); case '/Favorites': return MaterialPageRoute(builder: (_) => FavoritesManager()); case '/Twitter': diff --git a/lib/screens/home_widget.dart b/lib/screens/home_widget.dart index a9c919f..4d198d5 100644 --- a/lib/screens/home_widget.dart +++ b/lib/screens/home_widget.dart @@ -48,13 +48,7 @@ class _HomeState extends State { onPressed: () => Navigator.pushNamed(context, '/Chat'), ), ), - ListTile( //added by Kaleb to test details page. Will update path / delete when we have game tiles implemented. - title: IconButton( - icon: Icon(Icons.book), - onPressed: () => Navigator.pushNamed(context, '/Details'), - ), - ), - ListTile( + ListTile( title: IconButton( icon: Icon(Icons.voice_chat), onPressed: () => Navigator.pushNamed(context, '/Twitter'), diff --git a/lib/screens/sport_schedule.dart b/lib/screens/sport_schedule.dart index 71a93a5..a9c33f0 100644 --- a/lib/screens/sport_schedule.dart +++ b/lib/screens/sport_schedule.dart @@ -180,13 +180,16 @@ class GameCard extends StatelessWidget { gameCard.location_indicator, gameCard.image, false, ctx)), - onTap: () => print('${gameCard.date} ${gameCard.status}'), + onTap: () { + print(gameCard.idSport); + + Navigator.pushNamed(ctx, '/Details', arguments: gameCard); + }, ), ), ], ); - return SizedBox( width: widthIn(ctx), child: Card( diff --git a/pubspec.lock b/pubspec.lock index b39c496..76f0d96 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,21 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.13" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.4.1" bloc: dependency: transitive description: @@ -35,21 +35,21 @@ packages: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.14.12" convert: dependency: transitive description: @@ -63,7 +63,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.4" cupertino_icons: dependency: "direct main" description: @@ -113,7 +113,7 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.12" intl: dependency: transitive description: @@ -176,7 +176,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.3" rxdart: dependency: transitive description: @@ -230,7 +230,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.7.0" stack_trace: dependency: transitive description: @@ -279,7 +279,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.15" typed_data: dependency: transitive description: @@ -300,7 +300,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.6.1" sdks: dart: ">=2.6.0 <3.0.0" flutter: ">=1.12.13+hotfix.4 <2.0.0"