52 Commits

Author SHA1 Message Date
clopezr1
54b4279f40 Merge pull request #24 from allemangD/hotFix
small fixes
2020-05-03 16:05:12 -04:00
Carlos Lopez-Rosario
d06641ea62 small fixes 2020-05-03 16:02:13 -04:00
clopezr1
9083aadffe Merge pull request #23 from allemangD/hotFix
small fixes
2020-05-03 14:46:03 -04:00
Carlos Lopez-Rosario
3c5a8d9b4d small fixes 2020-05-03 14:42:42 -04:00
clopezr1
9fb45ee409 Merge pull request #22 from allemangD/game_details_buttons
Constant Game Daitais for fluff
2020-05-03 14:07:58 -04:00
Carlos Lopez-Rosario
27963dfc98 Constant Game Daitais for fluff 2020-05-03 14:03:33 -04:00
clopezr1
d4c4a7836c Merge pull request #21 from allemangD/Chat
Chat
2020-05-03 13:12:59 -04:00
Carlos Lopez-Rosario
f5d4da9ccd Signed in as guest 2020-05-03 12:59:17 -04:00
Carlos Lopez-Rosario
68460c8b20 CHATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 2020-05-03 03:25:59 -04:00
Carlos Lopez-Rosario
203bb03464 added args to chat, and game cards can take you there too 2020-05-02 20:36:01 -04:00
Carlos Lopez-Rosario
bd53761736 re-worked the game details page tabs 2020-05-02 19:44:46 -04:00
Carlos Lopez-Rosario
8d2477f3e7 re-worked the game details page Score section 2020-05-02 19:03:09 -04:00
Carlos Lopez-Rosario
52ef1c279a re-added route to game details page 2020-05-02 18:47:01 -04:00
Carlos Lopez-Rosario
1e9a2cf908 Changed how sports page is made to be able to scroll all the way down 2020-05-02 18:34:43 -04:00
Carlos Lopez-Rosario
2390b65922 Fixed Game Card Text 2020-05-02 18:21:41 -04:00
Carlos Lopez-Rosario
83abdf1fa1 Reworked How the Game Cards are made 2020-05-02 18:04:33 -04:00
Carlos Lopez-Rosario
5a8ab5f5e5 Each card takes you to a details page 2020-05-01 21:07:36 -04:00
Carlos Lopez-Rosario
fbd256847a Merge remote-tracking branch 'origin/master' into game_details_buttons 2020-05-01 17:37:15 -04:00
clopezr1
330604f43e Merge pull request #20 from allemangD/SportPageCards
Sport page cards
2020-05-01 15:51:09 -04:00
Carlos Lopez-Rosario
c2d376b2b5 GREEN 2020-05-01 13:59:06 -04:00
Carlos Lopez-Rosario
0d95b66960 Vertical Articles for sport Page 2020-05-01 13:25:45 -04:00
Carlos Lopez-Rosario
0c1158c27b All green 2020-05-01 11:22:55 -04:00
Carlos Lopez-Rosario
465eb96f4b logic for game card 2020-05-01 11:19:17 -04:00
Carlos Lopez-Rosario
78049ba65f Merge remote-tracking branch 'origin/master' into SportPageCards
# Conflicts:
#	lib/monthly_calendar.dart
#	lib/screens/sport.dart
2020-05-01 02:48:20 -04:00
Carlos Lopez-Rosario
a2950f6997 logic for game card 2020-05-01 02:45:54 -04:00
clopezr1
7ae5c3a3bc Merge pull request #18 from allemangD/Standings
Standings
2020-04-30 22:16:13 -04:00
Carlos Lopez-Rosario
f71bd6ad21 logic for game card 2020-04-30 21:19:23 -04:00
2209d1b992 missed a piece in the merge 2020-04-30 20:31:01 -04:00
dd0456299c Merge branch 'filter-sport-articles' into Standings 2020-04-30 20:29:45 -04:00
3e0efc8aff fix sport page articles bug 2020-04-30 20:27:17 -04:00
a21b86bf78 show standings in a table 2020-04-30 20:24:59 -04:00
clopezr1
b59f136ea0 Merge pull request #16 from allemangD/filter-sport-articles
filter article list to only contain correct sports
2020-04-30 18:53:44 -04:00
79886504ae filter article list to only contain correct sports 2020-04-30 17:18:15 -04:00
kconnel7
4d66b774fb Standings - No table currently / Future Builder works but has an error (RenderFlex children have non-zero flex but incoming height constraints are unbounded.) 2020-04-30 10:50:35 -04:00
kconnel7
b02efa9cc8 Standings - Conditioning on type of standings based on sport 2020-04-30 05:13:32 -04:00
kconnel7
9fc67ee039 Standings - Layout to standings table 2020-04-30 03:18:06 -04:00
kconnel7
015fbd9dc9 Standings - Conditioning to find sport urls 2020-04-29 23:18:09 -04:00
kconnel7
18c8ed39f4 Standings 2020-04-29 22:32:14 -04:00
kconnel7
c6d811331d Monthly Calendar - All Sports work & Changed layout to look better 2020-04-25 16:10:26 -04:00
clopezr1
7ba8fcb09c selected is gold 2020-04-23 18:22:36 -04:00
clopezr1
3a8397b89e Calendar shows what sport, and little box for games with more than 1 game 2020-04-23 17:49:34 -04:00
clopezr1
d8de898a5a Merge pull request #15 from allemangD/RoutesWithArguments
Routes with arguments
2020-04-23 16:49:08 -04:00
clopezr1
fe3b69f350 Tennis Fix 2020-04-23 16:32:29 -04:00
clopezr1
ff26f31dc8 Color of Mini indicator is Based on location 2020-04-23 16:22:33 -04:00
clopezr1
74aa580f28 says day on events 2020-04-23 15:10:14 -04:00
clopezr1
5bc25f8074 The event notification now appears over the entire date instead of mini 2020-04-23 15:08:49 -04:00
kconnel7
8cf18dec0a Monthly Calendar - Softball, Volleyball, Men/Women Tennis Works 2020-04-22 18:38:54 -04:00
kwainright
3f87598680 updated play-by-play details page to give button press functionality for the navigation buttons. 2020-04-22 18:26:54 -04:00
Carlos Lopez-Rosario
273a738fe0 no more calendar global use 2020-04-18 11:10:59 -04:00
Carlos Lopez-Rosario
39912bd37e Sports page passes game ID to Schedule/Calendar properly and generates correct calendar 2020-04-18 11:10:13 -04:00
Carlos Lopez-Rosario
9e3541c119 Gender Switch now properly appears on the correct sports and changes the sport ID properly 2020-04-18 10:37:40 -04:00
Carlos Lopez-Rosario
b3fb054c45 Route to sports takes an argument and goes to proper sport 2020-04-17 14:02:30 -04:00
23 changed files with 1431 additions and 385 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

90
ios/Podfile Normal file
View File

@@ -0,0 +1,90 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end
end
generated_key_values
end
target 'Runner' do
use_frameworks!
use_modular_headers!
# Flutter Pod
copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
# Plugin Pods
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end

34
ios/Podfile.lock Normal file
View File

@@ -0,0 +1,34 @@
PODS:
- Flutter (1.0.0)
- shared_preferences (0.0.1):
- Flutter
- shared_preferences_macos (0.0.1):
- Flutter
- shared_preferences_web (0.0.1):
- Flutter
DEPENDENCIES:
- Flutter (from `Flutter`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
EXTERNAL SOURCES:
Flutter:
:path: Flutter
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
shared_preferences_macos:
:path: ".symlinks/plugins/shared_preferences_macos/ios"
shared_preferences_web:
:path: ".symlinks/plugins/shared_preferences_web/ios"
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
PODFILE CHECKSUM: 083258d7f5e80b42ea9bfee905fe93049bc04c64
COCOAPODS: 1.7.5

View File

@@ -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;

7
lib/globals.dart Normal file
View File

@@ -0,0 +1,7 @@
library my_prj.globals;
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
Client client = Client(
'xqf4gbfwu2ec',
logLevel: Level.INFO,
);

View File

@@ -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
@@ -12,4 +21,4 @@ class App extends StatelessWidget {
onGenerateRoute: RouteGenerator.generateRoute,
);
}
}
}

View File

@@ -0,0 +1,97 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import '../screens/sport_schedule.dart';
import 'dart:convert';
class GameCardFeed{
static final sportUrl =
'https://charlotte49ers.com/services/adaptive_components.ashx?type=scoreboard&start=0&count=80';
Future<List<sport_schedule>> getEvents(int sportID) async {
var url = '$sportUrl&sport_id=$sportID&name=&extra=%7B%7D';
http.Response response = await http.get(url);
Iterable games = json.decode(response.body);
return games
.map<sport_schedule>((json) => sport_schedule.fromJson(json))
.toList();
//return games.map((e) => sport_schedule.fromJson(e)).toList();
}
Future<List<ScheduleObject>> getGames(int sportID) async {
Map<DateTime, List<sport_schedule>> mapGrab = {};
List<sport_schedule> eventInfo = await getEvents(sportID);
for (int i = 0; i < eventInfo.length; i++) {
var sportEvent = DateTime(eventInfo[i].date.year, eventInfo[i].date.month,
eventInfo[i].date.day);
var original = mapGrab[sportEvent];
if (original == null) {
//print("null");
mapGrab[sportEvent] = [eventInfo[i]];
} else {
//print(eventInfo[i].date);
mapGrab[sportEvent] = List.from(original)
..addAll([eventInfo[i]]);
}
}
List<ScheduleObject> list = [];
mapGrab.forEach((k, v) => list.add(ScheduleObject(k, v)));
return list;
}
}
class HorizontalGameCards extends StatelessWidget {
final GameCardFeed gameCard;
final double numCards;
final int sportID;
const HorizontalGameCards({
Key key,
@required this.gameCard,
this.numCards = 8,
this.sportID,
}) : super(key: key);
double heightIn(BuildContext context) {
return MediaQuery.of(context).size.height / numCards;
}
@override
Widget build(BuildContext context) {
var card = gameCard.getGames(sportID);
var events = [];
return SizedBox(
height: heightIn(context),
child: FutureBuilder(
future: card,
// ignore: missing_return
builder: (ctx, snapshot) {
//print(snapshot);
if (!snapshot.hasData) {
return Center(child: CircularProgressIndicator());
} else {
events = snapshot.data;
return ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: events.length,
itemBuilder: (context, index) {
return GameCard(
gameCard: events[index].sportSched[0],
);
},
);
}
},
),
);
}
}
class ScheduleObject {
DateTime d;
List<sport_schedule> sportSched;
ScheduleObject(this.d, this.sportSched);
}

View File

@@ -0,0 +1,255 @@
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: Column(
children: <Widget>[
GameDetailsHeader(gameCard),
EasyAccess(gameCard),
GameUpdates()
],
)
);
}
} //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) {
double fontsize = 25;
if (homeAway == "H" || homeAway == "T") {
return (Text('$uncc - $opponent',style: TextStyle(fontSize: fontsize)));
} else {
return (Text('$opponent - $uncc',style: TextStyle(fontSize: fontsize)));
}
}
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,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: _homeAwayImageOrder(
gameCard.location_indicator,
gameCard.image,
true, context),
),
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Wrap(
children: <Widget>[
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: <Widget>[
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),
)
],
),
)
);
}
}
class EasyAccess extends StatelessWidget {
final sport_schedule gameCard;
const EasyAccess(
this.gameCard,
);
@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: <Widget>[
_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);
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"),
if(label == 'Chat'){
Navigator.pushNamed(context, '/Chat', arguments: [gameCard.sportTitle, gameCard.idSport])
}
},
);
}
}
//Class for pbp
class GameUpdates extends StatelessWidget{
List<Play> myList = [];
final test1 = new Play('1st and 10 at CLT 25', '(6:12 - 4th) Aidan Swanson kickoff for 65 yds for a touchback');
final test2 = new Play('2nd & 10 at CLT 25', '(5:00 - 4th) Ishod Finger run for no gain to the Charl 25');
final test3 = new Play('3rd & 10 at CLT 25', '(4:30 - 4th) CHARLOTTE Penalty, False Start (-5 Yards) to the Charl 20');
final test4 = new Play('3rd & 15 at CLT 20', '(4:00 - 4th) Brett Kean run for 5 yds to the Charl 25');
final test5 = new Play('4th & 10 at CLT 25', '(3:31 - 4th) Connor Bowler punt for 48 yds , Will Brown returns for 13 yds to the Clem 40');
final test6 = new Play('1st & 10 at CLEM 40','(3:00 - 4th) Taisun Phommachanh pass complete to Will Brown for 8 yds to the Clem 48');
final test7 = new Play('2nd & 2 at CLEM 48','(2:40 - 4th) Chez Mellusi run for 3 yds to the Charl 49 for a 1ST down');
final test8 = new Play('1st & 10 at CLT 49','(2:25 - 4th) Chez Mellusi run for 8 yds to the Charl 41');
final test9 = new Play('2nd & 2 at CLT 41','(1:37 - 4th) Ben Batson run for 5 yds to the Charl 36 for a 1ST down');
final test10 = new Play('1st & 10 at CLT 36', '(1:30 - 4th) CLEMSON Penalty, False Start (-5 Yards) to the Charl 41');
final test11 = new Play('1st & 15 at CLT 41','(0:55 - 4th) Chez Mellusi run for 4 yds to the Charl 37');
final test12 = new Play('2nd & 11 at CLT 37','(0:25 - 4th) Patrick McClure run for 3 yds to the Charl 34');
final test13 = new Play('3rd & 8 at CLT 34','(0:05 - 4th) Chez Mellusi run for 7 yds to the Charl 27');
final test14 = new Play('4th & 1 at CLT 27','(0:00 - 4th) Patrick McClure run for 9 yds to the Charl 18 for a 1ST down');
@override
Widget build(BuildContext context) {
myList.add(test1);
myList.add(test2);
myList.add(test3);
myList.add(test4);
myList.add(test5);
myList.add(test6);
myList.add(test7);
myList.add(test8);
myList.add(test9);
myList.add(test10);
myList.add(test11);
myList.add(test12);
myList.add(test13);
myList.add(test14);
return Expanded(
child: Container(
child: ListView.builder(
scrollDirection: Axis.vertical,
itemCount: myList.length,
itemBuilder: (context, int index){
return Card(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 5,horizontal: 10),
child: ListTile(
title: Text('${myList[index].title}'),
subtitle: Padding(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
child: Text('${myList[index].action}'),
),
),
),
);
}
),
),
);
}
}
class Play {
final String title;
final String action;
Play(
this.title,
this.action,
);
}

View File

@@ -3,12 +3,14 @@ import 'package:http/http.dart' as http;
import 'package:table_calendar/table_calendar.dart';
import 'screens/sport_schedule.dart';
import 'screens/sport.dart' as globals;
import 'dart:convert';
class Calendar extends StatefulWidget {
final int sportID;
Calendar(this.sportID);
@override
_Calendar createState() => _Calendar();
_Calendar createState() => _Calendar(sportID);
}
//List<sport_schedule> _selectedEvents; //original that makes events work
@@ -17,15 +19,19 @@ DateTime selectedDay;
Map<DateTime, List<sport_schedule>> _events;
class _Calendar extends State<Calendar> with TickerProviderStateMixin {
int sportID;
_Calendar(this.sportID);
AnimationController _animationController;
CalendarController _calController;
int sportID = globals.Sport.sport_ID;
static final sportUrl = 'https://charlotte49ers.com/services/adaptive_components.ashx?type=scoreboard&start=0&count=80';
Future<List<sport_schedule>> getEvents() async {
var url = '$sportUrl&sport_id=$sportID&name=&extra=%7B%7D';
print(url.toString());
http.Response response = await http.get(url);
Iterable games = json.decode(response.body);
@@ -47,10 +53,8 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
var original = mapGrab[sportEvent];
if (original == null) {
//print("null");
mapGrab[sportEvent] = [eventInfo[i]];
} else {
//print(eventInfo[i].date);
mapGrab[sportEvent] = List.from(original)..addAll([eventInfo[i]]);
}
}
@@ -59,7 +63,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
@override
void initState() {
final _selectedDay = DateTime.now();
//final _selectedDay = DateTime.now();
//_selectedEvents = _events[_selectedDay] ?? [];
_selectedEvents = [];
@@ -201,15 +205,20 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
markersBuilder: (context, date, events, holidays) {
final miniBox = <Widget>[];
if (events.isNotEmpty) {
miniBox.add(
Positioned(
right: 1,
bottom: 1,
child: _buildEventsMarker(date, events),
right: 0,top: 0, left: 0, bottom: 0,
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;
@@ -228,27 +237,26 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
}
//----- Creates event box display (mini box) -----
Widget _buildEventsMarker(DateTime date, List events) {
Widget _buildEventsMarker(DateTime date, String gameType, bool main, events) {
String eventNum;
if (main) {eventNum = "${date.day}";} else {eventNum = "${events.length}";}
//return Container(
return AnimatedContainer(
duration: const Duration(milliseconds: 300),
margin: const EdgeInsets.all(4.0),
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
/*border: _calController.isSelected(date) //if selected date
? Border.all(color: Colors.black, width: 1.5,)
: _calController.isToday(date) //if today's date
? Border.all(color: Colors.black, width: 1.5,)
: Border.all(color: Colors.black, width: 0,),*/
//color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
//color: Colors.grey,
//if selected date && home game / else away game
color: _calController.isSelected(date)
? Colors.blue[400]
: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
//: Colors.grey,
/*border: Border.all(
color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
//color: Colors.black,
),*/
color: _calController.isSelected(date)
? Color.fromRGBO(179, 163, 105, 1) //UNCC Gold
: _gameTypeColor(gameType, main), //UNCC Green
borderRadius: BorderRadius.circular(10.0)
),
width: 16.0,
@@ -256,7 +264,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
child: Center(
child: Text(
'${events.length}',
eventNum,
style: TextStyle().copyWith(
color: Colors.white,
fontSize: 12.0,
@@ -266,6 +274,20 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
);
}
//Logic on if Home or Away return the colors
Color _gameTypeColor(String gameType, bool main){
Color c;
if (gameType == "H"){
c = Color.fromRGBO(0, 112, 60, 1); //UNCC Green
} else {
c = Colors.grey;
}
if (!main){
c = Colors.black45;//Color.fromRGBO(179, 163, 105, 1);
}
return c;
}
//----- Creates event display -----
Widget _eventLister() {
return ListView(
@@ -285,7 +307,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
child: ListTile(
leading: Image.network(
'https://charlotte49ers.com' + event.image.toString(),
width: 50.0,
width: 35.0,
),
title: Wrap(
children: <Widget>[
@@ -317,7 +339,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
subtitle: Text(
event.sportTitle.toString() + " - " + event.location.toString(),
style: TextStyle(
fontSize: 10.3,
fontSize: 9.9, //10.3
),
),

View File

@@ -90,3 +90,59 @@ class ArticleCard extends StatelessWidget {
);
}
}
class ArticleCardVert extends StatelessWidget {
const ArticleCardVert({
Key key,
@required this.article,
this.numCards = 2.1,
}) : super(key: key);
final Article article;
final double numCards;
double heightIn(BuildContext context) {
return (MediaQuery.of(context).size.height * 7/8) / numCards;
}
@override
Widget build(BuildContext context) {
var decoration = BoxDecoration(
image: DecorationImage(
image: NetworkImage(
article.thumbUrl,
),
fit: BoxFit.cover,
),
);
var body = Column(
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(
color: Colors.white,
child: ListTile(
title: Text(
article.mediumHeadline,
overflow: TextOverflow.ellipsis,
maxLines: 2,
),
),
),
],
);
return SizedBox(
height: heightIn(context),
child: Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Container(
decoration: decoration,
child: body,
),
),
);
}
}

View File

@@ -18,22 +18,25 @@ class Feed {
class HorizontalNewsFeed extends StatelessWidget {
final Feed newsFeed;
final Widget title;
final Text title;
final double numCards;
final String sportFilter;
const HorizontalNewsFeed({
Key key,
@required this.newsFeed,
@required this.title,
@required this.sportFilter,
this.numCards = 3.25,
}) : super(key: key);
double heightIn(BuildContext context) {
return MediaQuery.of(context).size.height / numCards;
}
@override
Widget build(BuildContext context) {
var page = newsFeed.getPage(1, size: 100).then((page) => page.where((article) => article.sport.toLowerCase().contains(sportFilter.toLowerCase())).toList());
return SizedBox(
height: heightIn(context),
child: Column(
@@ -43,8 +46,7 @@ class HorizontalNewsFeed extends StatelessWidget {
title: title,
trailing: IconButton(
icon: Icon(Icons.navigate_next),
onPressed: () => Navigator.of(context).pushNamed('/Sport'),
onPressed: () => Navigator.of(context).pushNamed('/Sport', arguments: title.data),
/*onPressed: () { //changed
Navigator.of(context).pushNamed('/Sport');
@@ -55,13 +57,14 @@ class HorizontalNewsFeed extends StatelessWidget {
),
Expanded(
child: FutureBuilder(
future: newsFeed.getPage(1),
future: page,
builder: (ctx, snapshot) {
if (!snapshot.hasData) {
return Center(child: CircularProgressIndicator());
} else {
List<Article> articles = snapshot.data;
return ListView.builder(
//shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: articles.length,
itemBuilder: (ctx, idx) {
@@ -79,3 +82,43 @@ class HorizontalNewsFeed extends StatelessWidget {
);
}
}
class VerticalNewsFeed extends StatelessWidget {
final Feed newsFeed;
final String sportFilter;
const VerticalNewsFeed({
Key key,
@required this.newsFeed,
@required this.sportFilter,
}) : super(key: key);
@override
Widget build(BuildContext context) {
var page = newsFeed.getPage(1, size: 100).then((page) => page.where((article) => article.sport.toLowerCase().contains(sportFilter.toLowerCase())).toList());
var size = MediaQuery.of(context).size;
return SizedBox(
height: size.height * (7/8),
child: FutureBuilder(
future: page,
builder: (ctx, snapshot) {
if (!snapshot.hasData) {
return Center(child: CircularProgressIndicator());
} else {
List<Article> articles = snapshot.data;
return ListView.builder(
//shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: articles.length,
itemBuilder: (ctx, idx) {
return ArticleCardVert(
article: articles[idx],
);
},
);
}
},
));
}
}

View File

@@ -1,32 +1,32 @@
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<dynamic> generateRoute(RouteSettings settings) {
final args = settings
.arguments; //This is how we pass arguments and can be used in case
print("args $args");
switch (settings.name) {
case '/':
return MaterialPageRoute(builder: (_) => Home());
case '/Sport':
//We can put logic and stuff here for checking if logged in
return MaterialPageRoute(builder: (_) => Sport());
return MaterialPageRoute(builder: (_) => Sport(args));
case '/Schedule':
return MaterialPageRoute(builder: (_) => Schedule());
return MaterialPageRoute(builder: (_) => Schedule(args));
case '/Standing':
return MaterialPageRoute(builder: (_) => Standing());
return MaterialPageRoute(builder: (_) => Standing(args));
case '/Chat':
return MaterialPageRoute(builder: (_) => Chat());
return MaterialPageRoute(builder: (_) => Chat(args));
case '/Details':
return MaterialPageRoute(builder: (_) => Details());
return MaterialPageRoute(builder: (_) => GameDetailsWidget(args));
case '/Favorites':
return MaterialPageRoute(builder: (_) => FavoritesManager());
case '/Twitter':
@@ -35,7 +35,6 @@ class RouteGenerator {
return _errorRoute();
}
}
static Route _errorRoute() {
return MaterialPageRoute(builder: (_) {
return Scaffold(
@@ -60,4 +59,5 @@ class RouteGenerator {
);
});
}
}

View File

@@ -1,40 +1,65 @@
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:capstone_hungry_hippos/globals.dart' as globals;
class Chat extends StatelessWidget {
final List sport;
Chat(this.sport);
class Chat extends StatelessWidget{
@override
Widget build(BuildContext context) {
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("49ers"),
backgroundColor: Colors.green,
),
body: Text("Chat Goes Here"),
drawer: Drawer(
child: ListView(
children: <Widget>[
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, '/'),
),
),
],
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text('${sport[0]} Chat'),
backgroundColor: Colors.green,
),
)
));
body: ContainerWithInterceptor(globals.client, sport[1]),
);
}
}
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Expanded(
child: MessageListView(
//messageBuilder: _messageBuilder,
),
),
MessageInput(),
],
);
}
}
class ContainerWithInterceptor extends StatefulWidget {
final Client client;
final int sport;
ContainerWithInterceptor(this.client, this.sport);
@override
State createState() => _ContainerWithInterceptorState();
}
class _ContainerWithInterceptorState extends State<ContainerWithInterceptor> {
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(),
),
);
}
}

View File

@@ -10,7 +10,6 @@ class Favorites {
'Basketball',
'Baseball',
'Soccer',
'Tennis',
'Volleyball'
];

View File

@@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:io';
class Details extends StatelessWidget {
@@ -11,13 +10,8 @@ class Details extends StatelessWidget {
const Item('Baseball', Colors.orange),
];
Item _curSport = colorList[0];
@override
Widget build(BuildContext context) {
Item selectedSport;
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
@@ -128,26 +122,32 @@ class Details extends StatelessWidget {
child: Row(
children: <Widget>[
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 +171,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),
),
),
),
),
@@ -255,7 +258,6 @@ class Play {
}
class GameUpdates extends StatelessWidget{
List<Play> myList = [];
final test1 = new Play('1st and 10 at CLT 25', '(6:12 - 4th) Aidan Swanson kickoff for 65 yds for a touchback');
final test2 = new Play('2nd & 10 at CLT 25', '(5:00 - 4th) Ishod Finger run for no gain to the Charl 25');
final test3 = new Play('3rd & 10 at CLT 25', '(4:30 - 4th) CHARLOTTE Penalty, False Start (-5 Yards) to the Charl 20');
@@ -274,7 +276,7 @@ class GameUpdates extends StatelessWidget{
@override
Widget build(BuildContext context) {
var myStream = Stream<int>.periodic(Duration(seconds:5), (x) => x).take(15);
List<Play> myList = [];
myList.add(test1);
myList.add(test2);
myList.add(test3);

View File

@@ -42,19 +42,7 @@ class _HomeState extends State<Home> {
color: Colors.green,
),
),
ListTile(
title: IconButton(
icon: Icon(Icons.message),
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'),
@@ -96,6 +84,7 @@ Future<List<HorizontalNewsFeed>> _buildList() async {
return HorizontalNewsFeed(
newsFeed: feed,
title: Text(sport),
sportFilter: sport,
);
}).toList();
}

View File

@@ -1,17 +1,19 @@
import 'package:flutter/material.dart';
import '../monthly_calendar.dart';
import '../screens/sport.dart' as globals;
class Schedule extends StatelessWidget{
final calendar = Calendar();
final List sport;
Schedule(this.sport);
@override
Widget build(BuildContext context) {
var calendar = Calendar(sport[0]);
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("49ers"),
title: Text("${sport[1]}"),
backgroundColor: Colors.green,
),
body: Container (

View File

@@ -1,53 +1,63 @@
import 'package:flutter/material.dart';
import '../news/feed.dart';
import '../models/game_cards.dart';
class Sport extends StatelessWidget {
static final List<Item> colorList = <Item>[
const Item('FootBall', Colors.green),
const Item("BasketBall", Colors.red),
const Item("Soccer", Colors.pinkAccent),
const Item('Baseball', Colors.orange),
const Item('Football',[3]),
const Item("Basketball",[5,13]),
const Item("Soccer",[9,17]),
const Item('Baseball',[1]),
const Item('Softball',[12]),
const Item('Volleyball',[20]),
const Item('Tennis',[10,18]),
];
final feed = Feed(); // was var not final
final gameCard = GameCardFeed();
final String imageMale = 'images/male.png';
final String imageFemale = 'images/female.png';
static bool genderSportSwitch = false; //determines if sport needs the gender switch
static bool genderSport = false; //determines which gender switch is set M - false / F - True
static int sport_ID;
final String sport;
Sport(this.sport);
Item _curSport = colorList[0];
final feed = Feed(); // was var not final
bool genderSportSwitch = false; //determines if sport needs the gender switch
final String imageMale = 'images/male.png';
final String imageFemale = 'images/female.png';
static bool genderSport = false; //determines which gender switch is set M - false / F - True
static int sport_ID;
@override
Widget build(BuildContext context) {
Item _setDefault(){
Item _curSport;
for (Item i in colorList){
if (i.name == sport){
_curSport = i;
break;
}
}
return _curSport;
}
_curSport = _setDefault();
sport_ID = _curSport.sportID[0];
Item selectedSport;
_genderSwitcherCheck();
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
appBar: AppBar(
centerTitle: false,
title: buildDropdownButton(selectedSport, setState),
backgroundColor: _curSport.color,
centerTitle: false,
title: buildDropdownButton(selectedSport, setState),
backgroundColor: Colors.green,
//--Gender Switch-- Need to make condition to determine gender
actions: <Widget>[
if (genderSportSwitch == true)
if (genderSportSwitch)
Switch(
value: genderSport,
onChanged: (value) {
setState(() {
if (value == false) {
genderSport = false;
}
else {
genderSport = true;
}
print("value: " + value.toString());
print("gender: " + genderSport.toString());
genderSport = value;
_genderSwitcherCheck();
});
},
inactiveThumbColor: Colors.lightBlue,
@@ -58,14 +68,7 @@ class Sport extends StatelessWidget {
),
]
),
body: ListView(
children: <Widget>[
HorizontalNewsFeed(newsFeed: feed, title: Text(_curSport.name)),
HorizontalNewsFeed(newsFeed: feed, title: Text(_curSport.name)),
HorizontalNewsFeed(newsFeed: feed, title: Text(_curSport.name)),
HorizontalNewsFeed(newsFeed: feed, title: Text(_curSport.name)),
],
),
body: bodyBuilder(),
drawer: Drawer(
child: ListView(
children: <Widget>[
@@ -90,15 +93,21 @@ class Sport extends StatelessWidget {
ListTile(
title: IconButton(
icon: Icon(Icons.table_chart),
onPressed: () => Navigator.pushNamed(context, '/Standing'),
onPressed: () => Navigator.pushNamed(context, '/Standing', arguments: [sport_ID, _curSport.name]),
),
),
ListTile(
title: IconButton(
icon: Icon(Icons.calendar_today),
onPressed: () => Navigator.pushNamed(context, '/Schedule'),
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,sport_ID]),
),
)
],
),
),
@@ -106,8 +115,19 @@ class Sport extends StatelessWidget {
);
}
DropdownButtonHideUnderline buildDropdownButton(
Item selectedSport, StateSetter setState) {
Widget bodyBuilder() {
return Column(
children: <Widget>[
HorizontalGameCards(gameCard: gameCard, sportID: sport_ID,),
Expanded(
child: VerticalNewsFeed(newsFeed: feed, sportFilter: _curSport.name),
),
],
);
}
DropdownButtonHideUnderline buildDropdownButton(Item selectedSport, StateSetter setState) {
return DropdownButtonHideUnderline(
child: DropdownButton<Item>(
value: selectedSport,
@@ -123,45 +143,8 @@ class Sport extends StatelessWidget {
onChanged: (Item value) {
setState(() {
_curSport = value;
print("genderSport: " + genderSport.toString());
//Will set the sport id / Display gender switch
switch (_curSport.name) { //prints are temp
case 'FootBall':
genderSportSwitch = false;
sport_ID = 3;
break;
case 'BasketBall':
genderSportSwitch = true;
if (genderSport == false) {
sport_ID = 5; //Male
}
else {
sport_ID = 13; //Female
}
break;
case 'Soccer':
genderSportSwitch = true;
if (genderSport == false) {
sport_ID = 9; //Male
}
else {
sport_ID = 17; //Female
}
break;
case 'Baseball':
genderSportSwitch = false;
sport_ID = 1;
break;
}
print(sport_ID);
_genderSwitcherCheck();
//print(sport_ID);
});
},
items: colorList.map<DropdownMenuItem<Item>>((Item item) {
@@ -176,11 +159,21 @@ class Sport extends StatelessWidget {
),
);
}
void _genderSwitcherCheck() {
if (_curSport.name == "Soccer" || _curSport.name == "Basketball" || _curSport.name == "Tennis" ){
genderSportSwitch = true;
sport_ID = genderSport ? _curSport.sportID[1] : _curSport.sportID[0];
} else {
genderSportSwitch = false;
sport_ID = _curSport.sportID[0];
}
//print(sport_ID);
}
}
class Item {
const Item(this.name, this.color);
const Item(this.name, this.sportID);
final String name;
final Color color;
}
final List<int> sportID;
}

View File

@@ -62,3 +62,145 @@ class sport_schedule {
);
}
}
class GameCard extends StatelessWidget {
const GameCard({
Key key,
@required this.gameCard,
this.numCards = 2.25,
}) : super(key: key);
final sport_schedule gameCard;
final double numCards;
double widthIn(BuildContext context) {
return MediaQuery.of(context).size.width / numCards;
}
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,
));
}
}
Color winLoss(String wl){
if (wl == "W") {
return Colors.green;
} else if (wl == "L") {
return Colors.red;
} else {
return Colors.grey;
}
}
@override
Widget build(BuildContext ctx) {
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 decoration = BoxDecoration(
border: Border.all(
color: winLoss(gameCard.status), //UNCC Green
width: 1.2,
),
borderRadius: BorderRadius.circular(2),
);
var logoWidth = 4.5;
return SizedBox(
width: widthIn(ctx),
child: Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: Container(
decoration: decoration,
child: buildCard(ctx, logoWidth, _months),
),
),
);
}
Widget buildCard(BuildContext ctx, double logoWidth, Map<int, String> _months) {
return InkWell(
splashColor: Colors.green,
child: Container(
color: Colors.black12,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
child: _homeAwayImageOrder(
gameCard.location_indicator,
gameCard.image,
true, ctx),
),
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Wrap(
children: <Widget>[
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: <Widget>[
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),
)
],
),
),
onTap: () => Navigator.pushNamed(ctx, '/Details', arguments: gameCard),
);
}
}

View File

@@ -1,171 +1,54 @@
import 'package:capstone_hungry_hippos/models/School.dart';
import 'package:flutter/material.dart';
import '../team_standings.dart';
class Standing extends StatelessWidget {
final _schools = [
School("North Texas Mean Green",AssetImage('assets/school_logos/NorthTexas.png'), 14, 4),
School("Louisiana Tech Bulldogs",AssetImage('assets/school_logos/LT.png'), 13, 5),
School("Western Kentucky Hilltoppers",AssetImage('assets/school_logos/wku.png'), 13, 5),
School("Charlotte 49ers",AssetImage('assets/school_logos/uncc.png'), 10, 8),
School("Marshall Thundering Herd",AssetImage('assets/school_logos/Marshall.png'), 10, 8),
School("Florida Int'L Panthers",AssetImage('assets/school_logos/FIU.png'), 9, 9),
School("UAB Blazers",AssetImage('assets/school_logos/UAB.png'), 9, 9),
School("Old Dominion Monarchs",AssetImage('assets/school_logos/ODU.png'), 9, 9),
School("Florida Atlantic Owl",AssetImage('assets/school_logos/FAU.png'), 8, 10),
School("UTEP Miners",AssetImage('assets/school_logos/UTEP.png'), 8, 10),
School("UTSA Roadrunners",AssetImage('assets/school_logos/UTSA.png'), 7, 11),
School("Rice Owls",AssetImage('assets/school_logos/RiceOwls.png'), 7, 11),
School("Southern Miss Golden Eagles",AssetImage('assets/school_logos/SouthernMiss.png'), 5, 13),
School("Middle Tennessee Blue Raiders",AssetImage('assets/school_logos/MT.png'), 4, 14),
];
final int sport_id;
final String sport_name;
Standing(List args)
: sport_id = args[0],
sport_name = args[1];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("49ers"),
backgroundColor: Colors.green,
),
body: SingleChildScrollView(
child: Column(
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("$sport_name Standings"),
backgroundColor: Colors.green,
),
body: ListView(
children: <Widget>[
Container(
child: Text(
"W L",
style: TextStyle(fontWeight: FontWeight.bold),
),
alignment: Alignment(.85, 0),
height: 20,
color: Colors.grey,
),
SportLine(
s: _schools[0],
position: 1,
),
SportLine(
s: _schools[1],
position: 2,
),
SportLine(
s: _schools[2],
position: 3,
),
SportLine(
s: _schools[3],
position: 4,
),
SportLine(
s: _schools[4],
position: 5,
),
SportLine(
s: _schools[5],
position: 6,
),
SportLine(
s: _schools[6],
position: 7,
),
SportLine(
s: _schools[7],
position: 8,
),
SportLine(
s: _schools[8],
position: 9,
),
SportLine(
s: _schools[9],
position: 10,
),
SportLine(
s: _schools[10],
position: 11,
),
SportLine(
s: _schools[11],
position: 12,
),SportLine(
s: _schools[12],
position: 13,
),SportLine(
s: _schools[13],
position: 14,
),
HorizontalStandings(sportName: sport_name,),
],
),
drawer: Drawer(
child: ListView(
children: <Widget>[
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, '/'),
),
),
],
),
),
),
);
}
}
class SportLine extends StatelessWidget {
const SportLine({
Key key,
@required
this.position,
this.s
}) : super(key: key);
final School s;
final int position;
@override
Widget build(BuildContext context) {
int w = s.win;
int l = s.loss;
return Container(
color: evenOdd(position),
height: 60,
child: Row(
children: <Widget>[
Container(
height: 55,
width: 20,
//color: Colors.orange,
child: Center(
child: Text(
"$position",
style: TextStyle(fontWeight: FontWeight.bold),
)),
),
Container(
//color: Colors.blue,
width: 55,
child: Image(
image: s.logo,
),
),
Container(
width: 5,
//color: Colors.red,
),
Container(
//color: Colors.pinkAccent,
width: 220,
child: Text(s.name),
),
Container(
//color: Colors.orange,
width: 35,
child: Text(
"$w",
style: TextStyle(fontWeight: FontWeight.bold),
)),
Container(
//color: Colors.blue,
width: 35,
child: Text(
" $l",
style: TextStyle(fontWeight: FontWeight.bold),
))
],
)
);
}
Color evenOdd(int i) {
Color c = i % 2 == 0 ? Colors.black12 : Colors.white30;
return c;
}
}

122
lib/team_standings.dart Normal file
View File

@@ -0,0 +1,122 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'screens/sport.dart';
class HorizontalStandings extends StatelessWidget {
static final standingsUrls = {
"football": [
"https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?region=us&lang=en&contentorigin=espn&group=12&sort=leaguewinpercent%3Adesc%2Cvsconf_wins%3Adesc%2Cvsconf_gamesbehind%3Aasc%2Cvsconf_playoffseed%3Aasc%2Cwins%3Adesc%2Closses%3Adesc%2Cplayoffseed%3Aasc%2Calpha%3Aasc",
],
"basketball": [
"https://site.web.api.espn.com/apis/v2/sports/basketball/mens-college-basketball/standings?region=us&lang=en&contentorigin=espn&group=11&sort=leaguewinpercent%3Adesc%2Cvsconf_wins%3Adesc%2Cvsconf_gamesbehind%3Aasc%2Cvsconf_playoffseed%3Aasc%2Cwins%3Adesc%2Closses%3Adesc%2Cplayoffseed%3Aasc%2Calpha%3Aasc",
"https://site.web.api.espn.com/apis/v2/sports/basketball/womens-college-basketball/standings?region=us&lang=en&contentorigin=espn&group=11&sort=leaguewinpercent%3Adesc%2Cvsconf_wins%3Adesc%2Cvsconf_gamesbehind%3Aasc%2Cvsconf_playoffseed%3Aasc%2Cwins%3Adesc%2Closses%3Adesc%2Cplayoffseed%3Aasc%2Calpha%3Aasc",
],
};
final String sportName;
const HorizontalStandings({Key key, this.sportName}) : super(key: key);
Future<Widget> getStandingsTable(String url) async {
var response = await http.get(url);
var body = json.decode(response.body);
if (body['children'].length == 0) body['children'] = [body];
var res = Center(
child: Column(
children: <Widget>[
Text(
"${body['name']}",
style: TextStyle(fontSize: 24),
),
Column(
children: body['children']
.map((conference) {
var teams = conference['standings']['entries'].map((team) {
var stats = {};
for (var stat in team['stats']) {
stats[stat['name']] = stat;
}
var source = team;
return {'stats': stats, 'source': source};
}).toList();
var interested = {
'football': ['vsConf', 'streak'],
'basketball': ['Season','streak']
}[sportName.toLowerCase()];
var table = Table(
defaultVerticalAlignment:
TableCellVerticalAlignment.middle,
children: teams
.map((data) {
var stats = data['stats'];
var team = data['source'];
var row = interested
.map((e) => stats[e])
.where((e) => e != null)
.map((s) => Text("${s['displayValue']}"))
.cast<Widget>()
.toList();
row.insert(0, Text(team['team']['name']));
row.insert(
0,
Image.network(team['team']['logos'][0]['href'],
height: 40));
return TableRow(children: row);
})
.cast<TableRow>()
.toList(),
);
return Column(
children: <Widget>[
Text(
conference['shortName'],
style: TextStyle(fontSize: 16),
),
table,
],
);
})
.cast<Widget>()
.toList()),
],
),
);
return res;
}
@override
Widget build(BuildContext context) {
var sportUrl = standingsUrls[sportName.toLowerCase()];
var idx = (Sport.genderSportSwitch && Sport.genderSport) ? 1 : 0;
var url = sportUrl[idx];
return Center(
child: Column(
children: <Widget>[
FutureBuilder<Widget>(
future: getStandingsTable(url),
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (!snapshot.hasData) return CircularProgressIndicator();
return snapshot.data;
},
)
],
),
);
}
}

View File

@@ -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:
@@ -259,6 +455,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
table_sticky_headers:
dependency: "direct main"
description:
name: table_sticky_headers
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
term_glyph:
dependency: transitive
description:
@@ -280,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:
@@ -287,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:
@@ -295,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"

View File

@@ -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
@@ -29,6 +29,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
table_calendar:
table_sticky_headers:
dev_dependencies:
flutter_test: