From 3f87598680f24a92d62f90a9ced275f3180f6c81 Mon Sep 17 00:00:00 2001 From: kwainright Date: Wed, 22 Apr 2020 18:26:54 -0400 Subject: [PATCH 01/11] updated play-by-play details page to give button press functionality for the navigation buttons. --- ios/Runner.xcodeproj/project.pbxproj | 5 --- lib/screens/game_details.dart | 51 ++++++++++++++++------------ pubspec.lock | 24 ++++++------- 3 files changed, 42 insertions(+), 38 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 226967c..f91fa61 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -213,14 +213,9 @@ files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../Flutter/Flutter.framework", - "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/lib/screens/game_details.dart b/lib/screens/game_details.dart index 8af96ba..d9dbce0 100644 --- a/lib/screens/game_details.dart +++ b/lib/screens/game_details.dart @@ -128,26 +128,32 @@ class Details extends StatelessWidget { child: Row( children: [ Container( - child: Card( - child: SizedBox( - width: 90, - height: 30, - child: Center( - child: Text('Standings', - style: TextStyle(fontSize: 16), + child: GestureDetector( + onTap: () => Navigator.pushNamed(context, '/Standing'), + child: Card( + child: SizedBox( + width: 90, + height: 30, + child: Center( + child: Text('Standings', + style: TextStyle(fontSize: 16), + ), ), ), ), ), ), Container( - child: Card( - child: SizedBox( - width: 90, - height: 30, - child: Center( - child: Text('Schedule', - style: TextStyle(fontSize: 16), + child: GestureDetector( + onTap: () => Navigator.pushNamed(context, '/Schedule'), + child: Card( + child: SizedBox( + width: 90, + height: 30, + child: Center( + child: Text('Schedule', + style: TextStyle(fontSize: 16), + ), ), ), ), @@ -171,13 +177,16 @@ class Details extends StatelessWidget { ), Container( color: Colors.black12, - child: Card( - child: SizedBox( - width: 50, - height: 30, - child: Center( - child: Text('Chat', - style: TextStyle(fontSize: 16), + child: GestureDetector( + onTap: () => Navigator.pushNamed(context, '/Chat'), + child: Card( + child: SizedBox( + width: 50, + height: 30, + child: Center( + child: Text('Chat', + style: TextStyle(fontSize: 16), + ), ), ), ), diff --git a/pubspec.lock b/pubspec.lock index dd1117d..7fc9f02 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,21 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "2.0.11" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.6.0" + version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.4.0" bloc: dependency: transitive description: @@ -35,21 +35,21 @@ packages: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "1.0.5" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.1.2" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" + version: "1.14.11" convert: dependency: transitive description: @@ -63,7 +63,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.3" cupertino_icons: dependency: "direct main" description: @@ -113,7 +113,7 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.12" + version: "2.1.4" intl: dependency: transitive description: @@ -176,7 +176,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.0.5" rxdart: dependency: transitive description: @@ -230,7 +230,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.5.5" stack_trace: dependency: transitive description: @@ -272,7 +272,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.11" typed_data: dependency: transitive description: @@ -293,7 +293,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.6.1" + version: "3.5.0" sdks: dart: ">=2.6.0 <3.0.0" flutter: ">=1.12.13+hotfix.4 <2.0.0" From 5a8ab5f5e51ed7d15227e158662c94cfb270a689 Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Fri, 1 May 2020 21:07:36 -0400 Subject: [PATCH 02/11] Each card takes you to a details page --- lib/models/game_details.dart | 177 ++++++++++++++++++++++++++++++++ lib/route_generator.dart | 19 ++-- lib/screens/home_widget.dart | 8 +- lib/screens/sport_schedule.dart | 7 +- pubspec.lock | 24 ++--- 5 files changed, 205 insertions(+), 30 deletions(-) create mode 100644 lib/models/game_details.dart 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" From 83abdf1fa193ec65e8ef752c2f82113ece4f5d44 Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sat, 2 May 2020 18:04:33 -0400 Subject: [PATCH 03/11] Reworked How the Game Cards are made --- lib/screens/sport_schedule.dart | 159 ++++++++++++++++++++------------ 1 file changed, 100 insertions(+), 59 deletions(-) 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); +// }, +// ), +// ), +// ], +// ); + } } From 2390b65922b2d9645eefb8043d3b6d133accb72f Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sat, 2 May 2020 18:21:41 -0400 Subject: [PATCH 04/11] Fixed Game Card Text --- lib/screens/sport_schedule.dart | 42 +++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/screens/sport_schedule.dart b/lib/screens/sport_schedule.dart index 4b7539a..8e43875 100644 --- a/lib/screens/sport_schedule.dart +++ b/lib/screens/sport_schedule.dart @@ -149,7 +149,7 @@ class GameCard extends StatelessWidget { Widget buildCard(BuildContext ctx, double logoWidth, Map _months) { return Container( - color: Colors.green, + color: Colors.black12, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisSize: MainAxisSize.min, @@ -161,19 +161,35 @@ class GameCard extends StatelessWidget { true, ctx), ), Container( - child: Wrap( - children: [ - if (gameCard.status == null) // no game yet - Text( - '${_months[gameCard.date.month]} ${gameCard.date.day}' + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + 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,), + ], + ), + 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'), + ], ) - else - _pastGameScore( - gameCard.location_indicator, - gameCard.status, - gameCard.team_score, - gameCard.opponent_score,), - ], + + ] ) ), Expanded( From 1e9a2cf908277b3188720b07c18520ef01aa2a19 Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sat, 2 May 2020 18:34:43 -0400 Subject: [PATCH 05/11] Changed how sports page is made to be able to scroll all the way down --- lib/screens/sport.dart | 20 ++++++++---- lib/screens/sport_schedule.dart | 57 --------------------------------- 2 files changed, 13 insertions(+), 64 deletions(-) diff --git a/lib/screens/sport.dart b/lib/screens/sport.dart index cc28258..01ec00b 100644 --- a/lib/screens/sport.dart +++ b/lib/screens/sport.dart @@ -68,13 +68,7 @@ class Sport extends StatelessWidget { ), ] ), - body: ListView( - physics: const NeverScrollableScrollPhysics(), - children: [ - HorizontalGameCards(gameCard: gameCard, sportID: sport_ID,), - VerticalNewsFeed(newsFeed: feed, sportFilter: _curSport.name), - ], - ), + body: bodyBuilder(), drawer: Drawer( child: ListView( children: [ @@ -115,6 +109,18 @@ class Sport extends StatelessWidget { ); } + Widget bodyBuilder() { + return Column( + children: [ + HorizontalGameCards(gameCard: gameCard, sportID: sport_ID,), + Expanded( + child: VerticalNewsFeed(newsFeed: feed, sportFilter: _curSport.name), + ), + + ], + ); + } + DropdownButtonHideUnderline buildDropdownButton(Item selectedSport, StateSetter setState) { return DropdownButtonHideUnderline( child: DropdownButton( diff --git a/lib/screens/sport_schedule.dart b/lib/screens/sport_schedule.dart index 8e43875..2e3fe92 100644 --- a/lib/screens/sport_schedule.dart +++ b/lib/screens/sport_schedule.dart @@ -201,62 +201,5 @@ class GameCard extends StatelessWidget { ], ), ); -// 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); -// }, -// ), -// ), -// ], -// ); } } From 52ef1c279a87fa31abfadd00df7b2aa26af73fd1 Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sat, 2 May 2020 18:47:01 -0400 Subject: [PATCH 06/11] re-added route to game details page --- lib/screens/sport_schedule.dart | 103 ++++++++++++++++---------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/lib/screens/sport_schedule.dart b/lib/screens/sport_schedule.dart index 2e3fe92..42bcfea 100644 --- a/lib/screens/sport_schedule.dart +++ b/lib/screens/sport_schedule.dart @@ -132,7 +132,6 @@ class GameCard extends StatelessWidget { borderRadius: BorderRadius.circular(2), ); var logoWidth = 4.5; - var body = buildCard(ctx, logoWidth, _months); return SizedBox( width: widthIn(ctx), child: Card( @@ -140,7 +139,7 @@ class GameCard extends StatelessWidget { clipBehavior: Clip.antiAliasWithSaveLayer, child: Container( decoration: decoration, - child: body, + child: buildCard(ctx, logoWidth, _months), ), ), ); @@ -148,58 +147,60 @@ class GameCard extends StatelessWidget { Widget buildCard(BuildContext ctx, double logoWidth, Map _months) { - return Container( - color: Colors.black12, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: _homeAwayImageOrder( - gameCard.location_indicator, - gameCard.image, - true, ctx), - ), - Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Wrap( + return GestureDetector( + child: Container( + color: Colors.black12, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: _homeAwayImageOrder( + gameCard.location_indicator, + gameCard.image, + true, ctx), + ), + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, 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,), - ], + 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,), + ], + ), + 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'), + ], + ) + ] ), - 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'), - ], - ) - - ] - ) + ), + Expanded( + child: _homeAwayImageOrder( + gameCard.location_indicator, + gameCard.image, + false, ctx), + ) + ], ), - Expanded( - child: _homeAwayImageOrder( - gameCard.location_indicator, - gameCard.image, - false, ctx), - ) - ], - ), + ), + onTap: () => Navigator.pushNamed(ctx, '/Details', arguments: gameCard), ); } } From 8d2477f3e7e6342649b12406a9559fea755d315d Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sat, 2 May 2020 19:03:09 -0400 Subject: [PATCH 07/11] re-worked the game details page Score section --- lib/models/game_details.dart | 97 ++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 44 deletions(-) diff --git a/lib/models/game_details.dart b/lib/models/game_details.dart index 206e5d3..fa5c1f5 100644 --- a/lib/models/game_details.dart +++ b/lib/models/game_details.dart @@ -34,10 +34,11 @@ class GameDetailsHeader extends StatelessWidget { Text _pastGameScore( String homeAway, String winLoss, String uncc, String opponent) { + double fontsize = 25; if (homeAway == "H" || homeAway == "T") { - return (Text('$uncc - $opponent')); + return (Text('$uncc - $opponent',style: TextStyle(fontSize: fontsize))); } else { - return (Text('$opponent - $uncc')); + return (Text('$opponent - $uncc',style: TextStyle(fontSize: fontsize))); } } @@ -75,49 +76,57 @@ class GameDetailsHeader extends StatelessWidget { 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( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: _homeAwayImageOrder( + gameCard.location_indicator, + gameCard.image, + true, context), + ), + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, 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)), - ), - )), + Wrap( + children: [ + if (gameCard.status == null) // no game yet + Text( + '${_months[gameCard.date.month]} ${gameCard.date.day}', + style: TextStyle(fontSize: 25), + ) + else + _pastGameScore( + gameCard.location_indicator, + gameCard.status, + gameCard.team_score, + gameCard.opponent_score,), + ], + ), + 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'), + ], + ) + ] + ), + ), + Expanded( + child: _homeAwayImageOrder( + gameCard.location_indicator, + gameCard.image, + false, context), + ) + ], + ), + ) ); } } From bd5376173668dc25e14e31a57ae13fb0e2a1bd6b Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sat, 2 May 2020 19:44:46 -0400 Subject: [PATCH 08/11] re-worked the game details page tabs --- lib/models/game_details.dart | 42 ++++++++++++--------------------- lib/screens/sport_schedule.dart | 2 +- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/lib/models/game_details.dart b/lib/models/game_details.dart index fa5c1f5..da264c6 100644 --- a/lib/models/game_details.dart +++ b/lib/models/game_details.dart @@ -14,13 +14,12 @@ class GameDetailsWidget extends StatelessWidget { appBar: AppBar( title: Text("VS. ${gameCard.opponentTitle}"), ), - body: ListView( - physics: const NeverScrollableScrollPhysics(), + body: Column( children: [ GameDetailsHeader(gameCard), EasyAccess(), ], - ), + ) ); } } //Move to Kalebs ^^^^ @@ -139,7 +138,7 @@ class EasyAccess extends StatelessWidget { return SizedBox( height: size.height / 15, child: Container( - color: Colors.black12, + //color: Colors.black12, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ @@ -155,30 +154,19 @@ class EasyAccess extends StatelessWidget { 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), - ))), + return InkWell( + splashColor: Colors.green, + child: Container( + width: size.width/2, + height: size.height / 15, + color: label == 'Play-by-Play' ? Colors.green : Colors.black12, + child: Center( + child: Text(label, style: TextStyle(fontSize: 16),), + ), ), - ), - ), + onTap: () => { + print("Tapped $label") + }, ); } } diff --git a/lib/screens/sport_schedule.dart b/lib/screens/sport_schedule.dart index 42bcfea..f198e37 100644 --- a/lib/screens/sport_schedule.dart +++ b/lib/screens/sport_schedule.dart @@ -152,7 +152,7 @@ class GameCard extends StatelessWidget { color: Colors.black12, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, - mainAxisSize: MainAxisSize.min, + //mainAxisSize: MainAxisSize.min, children: [ Expanded( child: _homeAwayImageOrder( From 203bb0346462f28d36de636ccc8438f7f5cf9b81 Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sat, 2 May 2020 20:36:01 -0400 Subject: [PATCH 09/11] added args to chat, and game cards can take you there too --- lib/models/game_details.dart | 13 +++++++++++-- lib/route_generator.dart | 2 +- lib/screens/chat.dart | 31 +++++-------------------------- lib/screens/sport.dart | 6 ++++++ lib/screens/sport_schedule.dart | 4 ++-- 5 files changed, 25 insertions(+), 31 deletions(-) diff --git a/lib/models/game_details.dart b/lib/models/game_details.dart index da264c6..d3fcb9b 100644 --- a/lib/models/game_details.dart +++ b/lib/models/game_details.dart @@ -17,7 +17,7 @@ class GameDetailsWidget extends StatelessWidget { body: Column( children: [ GameDetailsHeader(gameCard), - EasyAccess(), + EasyAccess(gameCard), ], ) ); @@ -131,6 +131,12 @@ class GameDetailsHeader extends StatelessWidget { } class EasyAccess extends StatelessWidget { + final sport_schedule gameCard; + + const EasyAccess( + this.gameCard, + ); + @override Widget build(BuildContext context) { var size = MediaQuery.of(context).size; @@ -165,7 +171,10 @@ class EasyAccess extends StatelessWidget { ), ), onTap: () => { - print("Tapped $label") + print("Tapped $label"), + if(label == 'Chat'){ + Navigator.pushNamed(context, '/Chat', arguments: gameCard.sportTitle) + } }, ); } diff --git a/lib/route_generator.dart b/lib/route_generator.dart index b36cc0f..1f2f2e9 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -25,7 +25,7 @@ class RouteGenerator { case '/Standing': return MaterialPageRoute(builder: (_) => Standing(args)); case '/Chat': - return MaterialPageRoute(builder: (_) => Chat()); + return MaterialPageRoute(builder: (_) => Chat(args)); case '/Details': return MaterialPageRoute(builder: (_) => GameDetailsWidget(args)); case '/Favorites': diff --git a/lib/screens/chat.dart b/lib/screens/chat.dart index e987612..dd453e8 100644 --- a/lib/screens/chat.dart +++ b/lib/screens/chat.dart @@ -1,40 +1,19 @@ import 'package:flutter/material.dart'; class Chat extends StatelessWidget{ + String sport; + Chat(this.sport); + @override Widget build(BuildContext context) { return StatefulBuilder( builder: (context, StateSetter setState) => Scaffold( appBar: AppBar( centerTitle: false, - title: Text("49ers"), + title: Text('$sport Chat'), backgroundColor: Colors.green, ), - body: Text("Chat Goes Here"), - drawer: Drawer( - child: ListView( - children: [ - DrawerHeader( - child: Text( - 'Drawer Header', - style: TextStyle( - color: Colors.white, - fontSize: 24, - ), - ), - decoration: BoxDecoration( - color: Colors.green, - ), - ), - ListTile( - title: IconButton( - icon: Icon(Icons.home), - onPressed: () => Navigator.pushNamed(context, '/'), - ), - ), - ], - ), - ) + body: Center(child: Text("Chat Goes Here")), )); } } \ No newline at end of file diff --git a/lib/screens/sport.dart b/lib/screens/sport.dart index 01ec00b..34204fc 100644 --- a/lib/screens/sport.dart +++ b/lib/screens/sport.dart @@ -102,6 +102,12 @@ class Sport extends StatelessWidget { onPressed: () => Navigator.pushNamed(context, '/Schedule',arguments: [sport_ID, _curSport.name],), ), ), + ListTile( + title: IconButton( + icon: Icon(Icons.message), + onPressed: () => Navigator.pushNamed(context, '/Chat',arguments: _curSport.name), + ), + ) ], ), ), diff --git a/lib/screens/sport_schedule.dart b/lib/screens/sport_schedule.dart index f198e37..51775fb 100644 --- a/lib/screens/sport_schedule.dart +++ b/lib/screens/sport_schedule.dart @@ -147,12 +147,12 @@ class GameCard extends StatelessWidget { Widget buildCard(BuildContext ctx, double logoWidth, Map _months) { - return GestureDetector( + return InkWell( + splashColor: Colors.green, child: Container( color: Colors.black12, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, - //mainAxisSize: MainAxisSize.min, children: [ Expanded( child: _homeAwayImageOrder( From 68460c8b203645e0a769650783ad0c31973a50ee Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sun, 3 May 2020 03:25:59 -0400 Subject: [PATCH 10/11] CHATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT --- lib/main.dart | 2 +- lib/models/game_details.dart | 2 +- lib/screens/chat.dart | 102 +++++++++++-- lib/screens/sport.dart | 2 +- pubspec.lock | 287 ++++++++++++++++++++++++++++++++++- pubspec.yaml | 2 +- 6 files changed, 376 insertions(+), 21 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 0a4231b..0544d4e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,4 +12,4 @@ class App extends StatelessWidget { onGenerateRoute: RouteGenerator.generateRoute, ); } -} +} \ No newline at end of file diff --git a/lib/models/game_details.dart b/lib/models/game_details.dart index d3fcb9b..8703301 100644 --- a/lib/models/game_details.dart +++ b/lib/models/game_details.dart @@ -173,7 +173,7 @@ class EasyAccess extends StatelessWidget { onTap: () => { print("Tapped $label"), if(label == 'Chat'){ - Navigator.pushNamed(context, '/Chat', arguments: gameCard.sportTitle) + Navigator.pushNamed(context, '/Chat', arguments: [gameCard.sportTitle, gameCard.idSport]) } }, ); diff --git a/lib/screens/chat.dart b/lib/screens/chat.dart index dd453e8..13b04af 100644 --- a/lib/screens/chat.dart +++ b/lib/screens/chat.dart @@ -1,19 +1,101 @@ import 'package:flutter/material.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; -class Chat extends StatelessWidget{ - String sport; +class _Chat { + final client = Client( + 'xqf4gbfwu2ec', + logLevel: Level.INFO, + ); + + Future init() async { + await client.setGuestUser( + User(id: 'You' + ), + ); + final user = User(id: "carlos", extraData: { + "name": "John Doe", + }); + + await client.setUser( + user, + client.devToken("carlos"), + ); + + return client; + } +} + + +class Chat extends StatelessWidget { + final List sport; Chat(this.sport); @override Widget build(BuildContext context) { - return StatefulBuilder( - builder: (context, StateSetter setState) => Scaffold( - appBar: AppBar( - centerTitle: false, - title: Text('$sport Chat'), - backgroundColor: Colors.green, + _Chat c = _Chat(); + var x = c.init(); + return Scaffold( + appBar: AppBar( + centerTitle: false, + title: Text('${sport[0]} Chat'), + backgroundColor: Colors.green, + ), + body: FutureBuilder( + future: x, + builder: (context, snapshot){ + if (!snapshot.hasData) { + return Center(child: CircularProgressIndicator()); + } else { + return ContainerWithInterceptor(snapshot.data, sport[1]); + } + }, + ), + ); + } +} +class ChannelPage extends StatelessWidget { + const ChannelPage({ + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Expanded( + child: MessageListView( + // messageBuilder: _messageBuilder, + ), ), - body: Center(child: Text("Chat Goes Here")), - )); + MessageInput(), + ], + ); + } + +} + +class ContainerWithInterceptor extends StatefulWidget { + final Client client; + final int sport; + ContainerWithInterceptor(this.client, this.sport); + + @override + State createState() => _ContainerWithInterceptorState(); +} + +class _ContainerWithInterceptorState extends State { + + Widget build(BuildContext context) { + var cc = widget.client.channel("messaging", id: "${widget.sport}"); + print(widget.sport); + print("-------------------------------------------------------------"); + cc.watch(); + return StreamChat( + client: widget.client, + child: StreamChannel( + channel: cc, + child: ChannelPage(), + ), + ); } } \ No newline at end of file diff --git a/lib/screens/sport.dart b/lib/screens/sport.dart index 34204fc..3adecf1 100644 --- a/lib/screens/sport.dart +++ b/lib/screens/sport.dart @@ -105,7 +105,7 @@ class Sport extends StatelessWidget { ListTile( title: IconButton( icon: Icon(Icons.message), - onPressed: () => Navigator.pushNamed(context, '/Chat',arguments: _curSport.name), + onPressed: () => Navigator.pushNamed(context, '/Chat',arguments: [sport_ID, _curSport.name]), ), ) ], diff --git a/pubspec.lock b/pubspec.lock index 76f0d96..4fdc95d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -36,6 +36,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + cached_network_image: + dependency: transitive + description: + name: cached_network_image + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" charcode: dependency: transitive description: @@ -43,6 +50,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.3" + chewie: + dependency: transitive + description: + name: chewie + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.10" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" collection: dependency: transitive description: @@ -71,6 +92,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.3" + dio: + dependency: transitive + description: + name: dio + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.9" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.0" + file_picker: + dependency: transitive + description: + name: file_picker + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.0" flutter: dependency: "direct main" description: flutter @@ -83,6 +125,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.2.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.2" + flutter_keyboard_visibility: + dependency: transitive + description: + name: flutter_keyboard_visibility + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.0" + flutter_markdown: + dependency: transitive + description: + name: flutter_markdown + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.5" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.7" flutter_test: dependency: "direct dev" description: flutter @@ -99,7 +169,7 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.0+4" + version: "0.12.1" http_parser: dependency: transitive description: @@ -114,6 +184,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.12" + image_picker: + dependency: transitive + description: + name: image_picker + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.5+3" intl: dependency: transitive description: @@ -121,6 +198,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.16.1" + jiffy: + dependency: transitive + description: + name: jiffy + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.1+1" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.4" + markdown: + dependency: transitive + description: + name: markdown + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" matcher: dependency: transitive description: @@ -135,6 +247,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.8" + mime: + dependency: transitive + description: + name: mime + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.6+3" nested: dependency: transitive description: @@ -142,6 +261,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.4" + open_iconic_flutter: + dependency: transitive + description: + name: open_iconic_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" path: dependency: transitive description: @@ -149,13 +275,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.6.4" + path_provider: + dependency: transitive + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.7" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" + version: "1.9.0" petitparser: dependency: transitive description: @@ -163,13 +310,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.4.0" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" provider: dependency: transitive description: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.0.4" + version: "4.0.5+1" quiver: dependency: transitive description: @@ -190,14 +351,14 @@ packages: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.5.6+3" + version: "0.5.7" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+6" + version: "0.0.1+7" shared_preferences_platform_interface: dependency: transitive description: @@ -231,6 +392,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.0" + sqflite: + dependency: transitive + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0+1" stack_trace: dependency: transitive description: @@ -245,6 +420,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + stream_chat: + dependency: transitive + description: + name: stream_chat + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.26" + stream_chat_flutter: + dependency: "direct main" + description: + name: stream_chat_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.26" string_scanner: dependency: transitive description: @@ -252,6 +441,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.5" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" table_calendar: dependency: "direct main" description: @@ -287,6 +483,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" + url_launcher: + dependency: transitive + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "5.4.5" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+5" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.6" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1+2" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" vector_math: dependency: transitive description: @@ -294,6 +525,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + video_player: + dependency: transitive + description: + name: video_player + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.9+1" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + video_player_web: + dependency: transitive + description: + name: video_player_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2+1" + visibility_detector: + dependency: transitive + description: + name: visibility_detector + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" + wakelock: + dependency: transitive + description: + name: wakelock + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4+1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" xml: dependency: transitive description: @@ -302,5 +575,5 @@ packages: source: hosted version: "3.6.1" sdks: - dart: ">=2.6.0 <3.0.0" - flutter: ">=1.12.13+hotfix.4 <2.0.0" + dart: ">=2.7.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 8177a56..de97137 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: flutter: sdk: flutter flutter_bloc: ^3.2.0 - + stream_chat_flutter: ^0.1.2 http: ^0.12.0+4 shared_preferences: ^0.5.6+3 From f5d4da9ccda5c5fb51b5a6bb96e600c9f1aee0dc Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Rosario Date: Sun, 3 May 2020 12:59:17 -0400 Subject: [PATCH 11/11] Signed in as guest --- lib/globals.dart | 7 +++++++ lib/main.dart | 11 ++++++++++- lib/route_generator.dart | 3 +-- lib/screens/chat.dart | 42 +++------------------------------------- 4 files changed, 21 insertions(+), 42 deletions(-) create mode 100644 lib/globals.dart diff --git a/lib/globals.dart b/lib/globals.dart new file mode 100644 index 0000000..825dc17 --- /dev/null +++ b/lib/globals.dart @@ -0,0 +1,7 @@ +library my_prj.globals; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; + +Client client = Client( + 'xqf4gbfwu2ec', + logLevel: Level.INFO, +); \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 0544d4e..f66bc97 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,16 @@ import 'package:capstone_hungry_hippos/route_generator.dart'; import 'package:flutter/material.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'globals.dart' as globals; -void main() => runApp(App()); + +void main() async { + var c = globals.client; + await c.setGuestUser( + User(id: 'You'), + ); + runApp(App()); +} class App extends StatelessWidget { @override diff --git a/lib/route_generator.dart b/lib/route_generator.dart index 1f2f2e9..93ac0b7 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -8,7 +8,6 @@ import 'screens/sport.dart'; import 'screens/twitter_widget.dart'; import 'screens/favorites_reorder.dart'; - class RouteGenerator { static Route generateRoute(RouteSettings settings) { final args = settings @@ -36,7 +35,6 @@ class RouteGenerator { return _errorRoute(); } } - static Route _errorRoute() { return MaterialPageRoute(builder: (_) { return Scaffold( @@ -61,4 +59,5 @@ class RouteGenerator { ); }); } + } diff --git a/lib/screens/chat.dart b/lib/screens/chat.dart index 13b04af..9632ad8 100644 --- a/lib/screens/chat.dart +++ b/lib/screens/chat.dart @@ -1,30 +1,6 @@ import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -class _Chat { - final client = Client( - 'xqf4gbfwu2ec', - logLevel: Level.INFO, - ); - - Future init() async { - await client.setGuestUser( - User(id: 'You' - ), - ); - final user = User(id: "carlos", extraData: { - "name": "John Doe", - }); - - await client.setUser( - user, - client.devToken("carlos"), - ); - - return client; - } -} - +import 'package:capstone_hungry_hippos/globals.dart' as globals; class Chat extends StatelessWidget { final List sport; @@ -32,24 +8,13 @@ class Chat extends StatelessWidget { @override Widget build(BuildContext context) { - _Chat c = _Chat(); - var x = c.init(); return Scaffold( appBar: AppBar( centerTitle: false, title: Text('${sport[0]} Chat'), backgroundColor: Colors.green, ), - body: FutureBuilder( - future: x, - builder: (context, snapshot){ - if (!snapshot.hasData) { - return Center(child: CircularProgressIndicator()); - } else { - return ContainerWithInterceptor(snapshot.data, sport[1]); - } - }, - ), + body: ContainerWithInterceptor(globals.client, sport[1]), ); } } @@ -64,14 +29,13 @@ class ChannelPage extends StatelessWidget { children: [ Expanded( child: MessageListView( - // messageBuilder: _messageBuilder, + //messageBuilder: _messageBuilder, ), ), MessageInput(), ], ); } - } class ContainerWithInterceptor extends StatefulWidget {