4 Commits

Author SHA1 Message Date
kwainright
f819278368 api kicking my ass :( I tried 3 different attempts for authorization but no luck 2020-05-03 14:54:57 -04:00
kwainright
68c7b5c5b3 api trouble shooting 2020-05-02 21:51:19 -04:00
kwainright
764dda9ea6 Twitter Page - set up with api - Testing to get response from api 2020-04-22 17:28:09 -04:00
kwainright
c874d2d5c3 Twitter Page - set up with api - not sure that I'm getting a response 2020-04-21 18:59:25 -04:00
25 changed files with 493 additions and 1494 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -1,90 +0,0 @@
# 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

View File

@@ -1,34 +0,0 @@
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

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

View File

@@ -1,16 +1,7 @@
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() async {
var c = globals.client;
await c.setGuestUser(
User(id: 'You'),
);
runApp(App());
}
void main() => runApp(App());
class App extends StatelessWidget {
@override
@@ -21,4 +12,4 @@ class App extends StatelessWidget {
onGenerateRoute: RouteGenerator.generateRoute,
);
}
}
}

View File

@@ -1,97 +0,0 @@
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

@@ -1,255 +0,0 @@
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,14 +3,12 @@ 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(sportID);
_Calendar createState() => _Calendar();
}
//List<sport_schedule> _selectedEvents; //original that makes events work
@@ -19,19 +17,15 @@ 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);
@@ -53,8 +47,10 @@ 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]]);
}
}
@@ -63,7 +59,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
@override
void initState() {
//final _selectedDay = DateTime.now();
final _selectedDay = DateTime.now();
//_selectedEvents = _events[_selectedDay] ?? [];
_selectedEvents = [];
@@ -205,20 +201,15 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
markersBuilder: (context, date, events, holidays) {
final miniBox = <Widget>[];
if (events.isNotEmpty) {
miniBox.add(
Positioned(
right: 0,top: 0, left: 0, bottom: 0,
child: _buildEventsMarker(date, events[0].location_indicator, true, events),
right: 1,
bottom: 1,
child: _buildEventsMarker(date, events),
),
);
if (events.length > 1)
miniBox.add(
Positioned(
right: 1, bottom: 1,
child: _buildEventsMarker(date, events[0].location_indicator, false, events),
)
);
}
return miniBox;
@@ -237,26 +228,27 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
}
//----- Creates event box display (mini box) -----
Widget _buildEventsMarker(DateTime date, String gameType, bool main, events) {
String eventNum;
if (main) {eventNum = "${date.day}";} else {eventNum = "${events.length}";}
//return Container(
Widget _buildEventsMarker(DateTime date, List events) {
return AnimatedContainer(
duration: const Duration(milliseconds: 300),
margin: const EdgeInsets.all(4.0),
alignment: Alignment.center,
decoration: BoxDecoration(
/*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)
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,
),
width: 16.0,
@@ -264,7 +256,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
child: Center(
child: Text(
eventNum,
'${events.length}',
style: TextStyle().copyWith(
color: Colors.white,
fontSize: 12.0,
@@ -274,20 +266,6 @@ 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(
@@ -307,7 +285,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
child: ListTile(
leading: Image.network(
'https://charlotte49ers.com' + event.image.toString(),
width: 35.0,
width: 50.0,
),
title: Wrap(
children: <Widget>[
@@ -339,7 +317,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
subtitle: Text(
event.sportTitle.toString() + " - " + event.location.toString(),
style: TextStyle(
fontSize: 9.9, //10.3
fontSize: 10.3,
),
),

View File

@@ -90,59 +90,3 @@ 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,25 +18,22 @@ class Feed {
class HorizontalNewsFeed extends StatelessWidget {
final Feed newsFeed;
final Text title;
final Widget 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(
@@ -46,7 +43,8 @@ class HorizontalNewsFeed extends StatelessWidget {
title: title,
trailing: IconButton(
icon: Icon(Icons.navigate_next),
onPressed: () => Navigator.of(context).pushNamed('/Sport', arguments: title.data),
onPressed: () => Navigator.of(context).pushNamed('/Sport'),
/*onPressed: () { //changed
Navigator.of(context).pushNamed('/Sport');
@@ -57,14 +55,13 @@ class HorizontalNewsFeed extends StatelessWidget {
),
Expanded(
child: FutureBuilder(
future: page,
future: newsFeed.getPage(1),
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) {
@@ -82,43 +79,3 @@ 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 'models/game_details.dart';
import 'screens/chat.dart';
import 'screens/schedule.dart';
import 'screens/standing.dart';
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 'package:flutter/material.dart';
import 'screens/home_widget.dart';
import 'screens/sport.dart';
import 'screens/twitter_widget.dart';
import 'screens/favorites_reorder.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';
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(args));
return MaterialPageRoute(builder: (_) => Sport());
case '/Schedule':
return MaterialPageRoute(builder: (_) => Schedule(args));
return MaterialPageRoute(builder: (_) => Schedule());
case '/Standing':
return MaterialPageRoute(builder: (_) => Standing(args));
return MaterialPageRoute(builder: (_) => Standing());
case '/Chat':
return MaterialPageRoute(builder: (_) => Chat(args));
return MaterialPageRoute(builder: (_) => Chat());
case '/Details':
return MaterialPageRoute(builder: (_) => GameDetailsWidget(args));
return MaterialPageRoute(builder: (_) => Details());
case '/Favorites':
return MaterialPageRoute(builder: (_) => FavoritesManager());
case '/Twitter':
@@ -35,6 +35,7 @@ class RouteGenerator {
return _errorRoute();
}
}
static Route _errorRoute() {
return MaterialPageRoute(builder: (_) {
return Scaffold(
@@ -59,5 +60,4 @@ class RouteGenerator {
);
});
}
}

View File

@@ -1,65 +1,40 @@
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 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,
),
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("49ers"),
backgroundColor: Colors.green,
),
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(),
),
);
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, '/'),
),
),
],
),
)
));
}
}

View File

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

View File

@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:io';
class Details extends StatelessWidget {
@@ -10,8 +11,13 @@ 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(
@@ -122,32 +128,26 @@ class Details extends StatelessWidget {
child: Row(
children: <Widget>[
Container(
child: GestureDetector(
onTap: () => Navigator.pushNamed(context, '/Standing'),
child: Card(
child: SizedBox(
width: 90,
height: 30,
child: Center(
child: Text('Standings',
style: TextStyle(fontSize: 16),
),
child: Card(
child: SizedBox(
width: 90,
height: 30,
child: Center(
child: Text('Standings',
style: TextStyle(fontSize: 16),
),
),
),
),
),
Container(
child: GestureDetector(
onTap: () => Navigator.pushNamed(context, '/Schedule'),
child: Card(
child: SizedBox(
width: 90,
height: 30,
child: Center(
child: Text('Schedule',
style: TextStyle(fontSize: 16),
),
child: Card(
child: SizedBox(
width: 90,
height: 30,
child: Center(
child: Text('Schedule',
style: TextStyle(fontSize: 16),
),
),
),
@@ -171,16 +171,13 @@ class Details extends StatelessWidget {
),
Container(
color: Colors.black12,
child: GestureDetector(
onTap: () => Navigator.pushNamed(context, '/Chat'),
child: Card(
child: SizedBox(
width: 50,
height: 30,
child: Center(
child: Text('Chat',
style: TextStyle(fontSize: 16),
),
child: Card(
child: SizedBox(
width: 50,
height: 30,
child: Center(
child: Text('Chat',
style: TextStyle(fontSize: 16),
),
),
),
@@ -258,6 +255,7 @@ 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');
@@ -276,7 +274,7 @@ class GameUpdates extends StatelessWidget{
@override
Widget build(BuildContext context) {
List<Play> myList = [];
var myStream = Stream<int>.periodic(Duration(seconds:5), (x) => x).take(15);
myList.add(test1);
myList.add(test2);
myList.add(test3);

View File

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

View File

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

View File

@@ -1,63 +1,53 @@
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',[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]),
const Item('FootBall', Colors.green),
const Item("BasketBall", Colors.red),
const Item("Soccer", Colors.pinkAccent),
const Item('Baseball', Colors.orange),
];
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: Colors.green,
centerTitle: false,
title: buildDropdownButton(selectedSport, setState),
backgroundColor: _curSport.color,
//--Gender Switch-- Need to make condition to determine gender
actions: <Widget>[
if (genderSportSwitch)
if (genderSportSwitch == true)
Switch(
value: genderSport,
onChanged: (value) {
setState(() {
genderSport = value;
_genderSwitcherCheck();
if (value == false) {
genderSport = false;
}
else {
genderSport = true;
}
print("value: " + value.toString());
print("gender: " + genderSport.toString());
});
},
inactiveThumbColor: Colors.lightBlue,
@@ -68,7 +58,14 @@ class Sport extends StatelessWidget {
),
]
),
body: bodyBuilder(),
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)),
],
),
drawer: Drawer(
child: ListView(
children: <Widget>[
@@ -93,21 +90,15 @@ class Sport extends StatelessWidget {
ListTile(
title: IconButton(
icon: Icon(Icons.table_chart),
onPressed: () => Navigator.pushNamed(context, '/Standing', arguments: [sport_ID, _curSport.name]),
onPressed: () => Navigator.pushNamed(context, '/Standing'),
),
),
ListTile(
title: IconButton(
icon: Icon(Icons.calendar_today),
onPressed: () => Navigator.pushNamed(context, '/Schedule',arguments: [sport_ID, _curSport.name],),
onPressed: () => Navigator.pushNamed(context, '/Schedule'),
),
),
ListTile(
title: IconButton(
icon: Icon(Icons.message),
onPressed: () => Navigator.pushNamed(context, '/Chat',arguments: [_curSport.name,sport_ID]),
),
)
],
),
),
@@ -115,19 +106,8 @@ class Sport extends StatelessWidget {
);
}
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) {
DropdownButtonHideUnderline buildDropdownButton(
Item selectedSport, StateSetter setState) {
return DropdownButtonHideUnderline(
child: DropdownButton<Item>(
value: selectedSport,
@@ -143,8 +123,45 @@ class Sport extends StatelessWidget {
onChanged: (Item value) {
setState(() {
_curSport = value;
_genderSwitcherCheck();
//print(sport_ID);
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);
});
},
items: colorList.map<DropdownMenuItem<Item>>((Item item) {
@@ -159,21 +176,11 @@ 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.sportID);
const Item(this.name, this.color);
final String name;
final List<int> sportID;
}
final Color color;
}

View File

@@ -62,145 +62,3 @@ 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,54 +1,171 @@
import 'package:capstone_hungry_hippos/models/School.dart';
import 'package:flutter/material.dart';
import '../team_standings.dart';
class Standing extends StatelessWidget {
final int sport_id;
final String sport_name;
Standing(List args)
: sport_id = args[0],
sport_name = args[1];
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),
];
@override
Widget build(BuildContext context) {
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("$sport_name Standings"),
backgroundColor: Colors.green,
),
body: ListView(
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("49ers"),
backgroundColor: Colors.green,
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
HorizontalStandings(sportName: sport_name,),
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,
),
],
),
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;
}
}

View File

@@ -3,25 +3,10 @@ import 'package:flutter/material.dart';
import '../twitter_assets/tweet.dart';
class TwitterFeed extends StatelessWidget{
List<Tweet> fuck = [];
final test = new Tweet(1, "We'll get through this together, Niner Nation. #WeAreAllNiners", "@unccharlotte", "https://pbs.twimg.com/profile_images/1175214096280629249/QC79Xju2_400x400.jpg", "test");
final test2 = new Tweet(2, "Let's test your UNC Charlotte knowledge...do you know why we became the 49ers? Here's the full history on the pioneering spirit that shaped our trajectory http://bit.ly/UNCC-1949", "@unccharlotte", "https://pbs.twimg.com/profile_images/1175214096280629249/QC79Xju2_400x400.jpg", "test");
final test3 = new Tweet(3, "Niner Nation means uplifting each other. This 4/9 Day, let's show our students why #WeAreAllNiners by supporting the Student Emergency Relief Fund http://bit.ly/UNCC-SER", "@unccharlotte", "https://pbs.twimg.com/profile_images/1175214096280629249/QC79Xju2_400x400.jpg", "test");
final test4 = new Tweet(4, "Niner Nation: Chancellor Dubois shares that UNC Charlotte will be able to apply our established parking refund procedures with special considerations for the impact of COVID-19.", "@unccharlotte", "https://pbs.twimg.com/profile_images/1175214096280629249/QC79Xju2_400x400.jpg", "test");
final test5 = new Tweet(5, "4/9 Day is just for us, Niner Nation. From wherever you are, you're family #WeAreAllNiners", "@unccharlotte", "https://pbs.twimg.com/profile_images/1175214096280629249/QC79Xju2_400x400.jpg", "test");
final test6= new Tweet(6, "Niner Nation, #49erAlumni Gene Johnson 73 is getting us excited for 4/9 Day tomorrow! Put on your Niner gear, call your friends and lets celebrate together virtually \n Were all in this together! ", "@unccharlotte", "https://pbs.twimg.com/profile_images/1175214096280629249/QC79Xju2_400x400.jpg", "test");
final test7 = new Tweet(7, "From virtual events to one-on-one sessions with counselors, it's easy to stay connected with @UNCCAdmissions", "@unccharlotte", "https://pbs.twimg.com/profile_images/1175214096280629249/QC79Xju2_400x400.jpg", "test");
@override
Widget build(BuildContext context) {
fuck.add(test);
fuck.add(test2);
fuck.add(test3);
fuck.add(test4);
fuck.add(test5);
fuck.add(test6);
fuck.add(test7);
return StatefulBuilder(
builder: (context, StateSetter setState) => Scaffold(
@@ -33,7 +18,16 @@ class TwitterFeed extends StatelessWidget{
body: Container(
color: Colors.black12,
child:
VerticalTwitterFeed(twitterFeed: fuck),
FutureBuilder(
future: _buildTwitter(),
builder: (ctx, snapshot){
if(!snapshot.hasData){
return Center(child: CircularProgressIndicator());
}else{
return snapshot.data;
}
},
),
),
drawer: Drawer(
child: ListView(
@@ -63,3 +57,7 @@ class TwitterFeed extends StatelessWidget{
}
}
Future<VerticalTwitterFeed> _buildTwitter() async {
final feed = TwitterFeedCreation();
return VerticalTwitterFeed(twitterFeed: feed);
}

View File

@@ -1,122 +0,0 @@
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

@@ -3,29 +3,29 @@ import 'package:flutter/material.dart';
class Tweet {
final int id;
final String text;
final String userName;
final String userImgUrl;
final String url;
//final String userName;
//final String userImgUrl;
//final String url;
Tweet(
this.id,
this.id, {
this.text,
this.userName,
this.userImgUrl,
this.url,
// this.userName,
// this.userImgUrl,
// this.url,
}
);
/*factory Tweet.fromJson(Map<String, dynamic> json) {
factory Tweet.fromJson(Map<String, dynamic> json) {
return Tweet(
json['id_str'],
text: json['text'],
userName: json['user']['name'],
userImgUrl: json['user']['profile_image_url_https'],
url: json['urls']['expanded_url'],
text: json['full_text'],
//userName: json['user']['name'],
//userImgUrl: json['user']['profile_image_url_https'],
//url: json['urls']['expanded_url'],
);
}
Commenting out till we figure out the API
*/
@@ -46,7 +46,7 @@ class TwitterCard extends StatelessWidget{
child: Padding(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 0),
child: ListTile(
leading: SizedBox(
/* leading: SizedBox(
height: 150,
width: 75,
child: Container(
@@ -58,9 +58,9 @@ class TwitterCard extends StatelessWidget{
),
),
),
),
title: Text('${tweet.userName}'),
subtitle: Text('${tweet.text}'),
), */
// title: Text('${tweet.userName}'),
title: Text('${tweet.text}'),
),
),
);

View File

@@ -3,44 +3,85 @@ import 'dart:io';
import 'package:capstone_hungry_hippos/screens/twitter_widget.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:twitter_api/twitter_api.dart';
import'package:crypto/crypto.dart';
import 'dart:convert';
import 'tweet.dart';
final twitterBase = 'https://api.twitter.com/1.1/search';
final _twitterOauth = new twitterApi(
consumerKey: "gsa3eHPVGK90dt6fgUC2ZSbTE",
consumerSecret: "rwEjykGOfapPLTVkWgedSCU8Eld130EEHFyu3W0Ye3fDcKj5V",
token: "910563313108574211-WynoAeUKJrnE6uXPv8vJGx4ITGS1ggG",
tokenSecret: "dWFYYbn6J1QTyV86femOdriX7MfMSANSjH3m48ZtEZUNW",
);
class TwitterFeedCreation {
static final twitterBase = 'https://api.twitter.com/1.1/search';
static final apiKey = 'AFBfOqx8uXIUBZMxAFoQyO3zA';
static final apiSecret = '48Gp7nczz9SqExorwYuWpA6Nmviuox6Beq83kjH1XtYtunorym';
getToken() async {
http.Response response = await http.get('https://api.twitter.com/oauth2/token',);
}
Future<List<Tweet>> getPage() async {
/*Future<List<Tweet>> getPage({int size = 10}) async {
var url = '$twitterBase/tweets.json?q=from%3ACharlotteFTBL&result_type=mixed&count=$size';
http.Response response = await http.get(url,
headers: <String, String> {'authorization': apiKey,}
var response = await _twitterOauth.getTwitterRequest(
"GET",
"/statuses/user_timeline.json",
options: {
"user_id": "19025957",
"screen_name": "TTCnotices",
"count": "20",
"trim_user": "true",
"tweet_mode": "extended",
}
);
Iterable tweets = json.decode(response.body);
print(tweets);
return tweets.map((e) => Tweet.fromJson(e)).toList();
} */
}
}
String _getSig(String method, String base, List<String> sortedItems){
String param = '';
for (int i = 0; i < sortedItems.length; i++) {
if (i == 0) {
param = sortedItems[i];
} else {
param += '%${sortedItems[i]}';
}
}
String sig = '$method&${Uri.encodeComponent(base)}&${Uri.encodeComponent(param)}';
String key = '${Uri.encodeComponent("gsa3eHPVGK90dt6fgUC2ZSbTE")}&${Uri.encodeComponent("rwEjykGOfapPLTVkWgedSCU8Eld130EEHFyu3W0Ye3fDcKj5V")}';
var digest = Hmac(sha1, utf8.encode(key)).convert(utf8.encode(sig));
return base64.encode(digest.bytes);
}
class VerticalTwitterFeed extends StatelessWidget{
final List<Tweet> twitterFeed;
final TwitterFeedCreation twitterFeed;
const VerticalTwitterFeed({
Key key,
@required this.twitterFeed,
}) : super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {
/*
return Container(
child: ListView.builder(
scrollDirection: Axis.vertical,
@@ -51,9 +92,9 @@ class VerticalTwitterFeed extends StatelessWidget{
);
},
),
);
); */
/* return Container(
return Container(
child: FutureBuilder(
future: twitterFeed.getPage(),
builder: (ctx, snapshot){
@@ -73,6 +114,8 @@ class VerticalTwitterFeed extends StatelessWidget{
}
},
),
); */
);
}
}

View File

@@ -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,42 +35,21 @@ packages:
name: boolean_selector
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"
version: "1.0.5"
charcode:
dependency: transitive
description:
name: charcode
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"
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:
@@ -79,12 +58,12 @@ packages:
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
dependency: "direct main"
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.3"
cupertino_icons:
dependency: "direct main"
description:
@@ -92,27 +71,6 @@ 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
@@ -125,34 +83,6 @@ 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
@@ -169,7 +99,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.1"
version: "0.12.0+4"
http_parser:
dependency: transitive
description:
@@ -183,14 +113,7 @@ packages:
name: image
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"
version: "2.1.4"
intl:
dependency: transitive
description:
@@ -198,41 +121,6 @@ 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:
@@ -247,13 +135,6 @@ 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:
@@ -261,13 +142,6 @@ 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:
@@ -275,34 +149,13 @@ 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.9.0"
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
@@ -310,34 +163,20 @@ 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.5+1"
version: "4.0.4"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.0.5"
rxdart:
dependency: transitive
description:
@@ -351,14 +190,14 @@ packages:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.7"
version: "0.5.6+3"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+7"
version: "0.0.1+6"
shared_preferences_platform_interface:
dependency: transitive
description:
@@ -391,21 +230,7 @@ packages:
name: source_span
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"
version: "1.5.5"
stack_trace:
dependency: transitive
description:
@@ -420,20 +245,6 @@ 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:
@@ -441,13 +252,6 @@ 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:
@@ -455,13 +259,6 @@ 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:
@@ -475,7 +272,14 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
version: "0.2.11"
twitter_api:
dependency: "direct main"
description:
name: twitter_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
typed_data:
dependency: transitive
description:
@@ -483,41 +287,6 @@ 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:
@@ -525,55 +294,13 @@ 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:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
version: "3.5.0"
sdks:
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
dart: ">=2.6.0 <3.0.0"
flutter: ">=1.12.13+hotfix.4 <2.0.0"

View File

@@ -21,15 +21,16 @@ 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
twitter_api: ^0.1.2
crypto:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
table_calendar:
table_sticky_headers:
dev_dependencies:
flutter_test: