12 Commits

Author SHA1 Message Date
kconnel7
ac6306dca1 Calendar - Finished 2020-04-30 21:17:59 -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
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
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
12 changed files with 280 additions and 212 deletions

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

@@ -3,34 +3,38 @@ 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
List _selectedEvents; //Removing the <sport_schedule> allows it to still work. Proceed with caution
List _selectedEvents;
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);
return games.map<sport_schedule>((json) => sport_schedule.fromJson(json)).toList();
//return games.map((e) => sport_schedule.fromJson(e)).toList();
}
Future<Map<DateTime, List<sport_schedule>>> getGames() async {
@@ -47,10 +51,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,9 +61,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
@override
void initState() {
final _selectedDay = DateTime.now();
//_selectedEvents = _events[_selectedDay] ?? [];
_selectedEvents = [];
_calController = CalendarController();
@@ -88,8 +87,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
super.dispose();
}
//void _DaySelected(DateTime day, List<sport_schedule> events) { //original that makes events work
void _DaySelected(DateTime day, List events) { //Removing the <sport_schedule> allows it to still work. Proceed with caution
void _DaySelected(DateTime day, List events) {
setState(() {
_selectedEvents = events;
selectedDay = DateTime(day.year, day.month, day.day);
@@ -124,7 +122,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
calendarController: _calController,
initialCalendarFormat: CalendarFormat.month,
startingDayOfWeek: StartingDayOfWeek.sunday,
//availableGestures: AvailableGestures.all,
events: _events,
availableCalendarFormats: const {
@@ -201,15 +198,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 +230,20 @@ 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 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,
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 +251,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 +261,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 +294,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,13 +326,11 @@ 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
),
),
trailing: Wrap(
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
//---Score---
//Game hasn't occured

View File

@@ -18,7 +18,7 @@ class Feed {
class HorizontalNewsFeed extends StatelessWidget {
final Feed newsFeed;
final Widget title;
final Text title;
final double numCards;
const HorizontalNewsFeed({
@@ -31,9 +31,9 @@ class HorizontalNewsFeed extends StatelessWidget {
double heightIn(BuildContext context) {
return MediaQuery.of(context).size.height / numCards;
}
@override
Widget build(BuildContext context) {
//print(title.data);
return SizedBox(
height: heightIn(context),
child: Column(
@@ -43,8 +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');

View File

@@ -12,15 +12,15 @@ 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());
case '/Chat':

View File

@@ -3,15 +3,17 @@ import '../monthly_calendar.dart';
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

@@ -4,27 +4,43 @@ import '../news/feed.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', Colors.green,[3]),
const Item("Basketball", Colors.red,[5,13]),
const Item("Soccer", Colors.pinkAccent,[9,17]),
const Item('Baseball', Colors.orange,[1]),
const Item('Softball', Colors.yellow,[12]),
const Item('Volleyball', Colors.blue,[20]),
const Item('Tennis', Colors.yellowAccent,[10,18]),
];
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;
final String sport;
Sport(this.sport);
Item _curSport = colorList[0];
@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(
@@ -32,22 +48,15 @@ class Sport extends StatelessWidget {
title: buildDropdownButton(selectedSport, setState),
backgroundColor: _curSport.color,
//--Gender Switch-- Need to make condition to determine gender
//--Gender Switch--
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,
@@ -90,13 +99,13 @@ 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),
),
),
ListTile(
title: IconButton(
icon: Icon(Icons.calendar_today),
onPressed: () => Navigator.pushNamed(context, '/Schedule'),
onPressed: () => Navigator.pushNamed(context, '/Schedule',arguments: [sport_ID, _curSport.name],),
),
),
],
@@ -106,8 +115,7 @@ class Sport extends StatelessWidget {
);
}
DropdownButtonHideUnderline buildDropdownButton(
Item selectedSport, StateSetter setState) {
DropdownButtonHideUnderline buildDropdownButton(Item selectedSport, StateSetter setState) {
return DropdownButtonHideUnderline(
child: DropdownButton<Item>(
value: selectedSport,
@@ -123,44 +131,7 @@ 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;
}
_genderSwitcherCheck();
print(sport_ID);
});
},
@@ -176,11 +147,25 @@ 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.color, this.sportID);
final String name;
final Color color;
}
final List<int> sportID;
}

View File

@@ -3,10 +3,25 @@ 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(
@@ -18,16 +33,7 @@ class TwitterFeed extends StatelessWidget{
body: Container(
color: Colors.black12,
child:
FutureBuilder(
future: _buildTwitter(),
builder: (ctx, snapshot){
if(!snapshot.hasData){
return Center(child: CircularProgressIndicator());
}else{
return snapshot.data;
}
},
),
VerticalTwitterFeed(twitterFeed: fuck),
),
drawer: Drawer(
child: ListView(
@@ -57,7 +63,3 @@ class TwitterFeed extends StatelessWidget{
}
}
Future<VerticalTwitterFeed> _buildTwitter() async {
final feed = TwitterFeedCreation();
return VerticalTwitterFeed(twitterFeed: feed);
}

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['full_text'],
//userName: json['user']['name'],
//userImgUrl: json['user']['profile_image_url_https'],
//url: json['urls']['expanded_url'],
text: json['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}'),
title: Text('${tweet.text}'),
),
title: Text('${tweet.userName}'),
subtitle: Text('${tweet.text}'),
),
),
);

View File

@@ -3,85 +3,44 @@ 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';
Future<List<Tweet>> getPage() async {
getToken() async {
http.Response response = await http.get('https://api.twitter.com/oauth2/token',);
}
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",
}
/*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,}
);
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 TwitterFeedCreation twitterFeed;
final List<Tweet> 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,
@@ -92,9 +51,9 @@ class VerticalTwitterFeed extends StatelessWidget{
);
},
),
); */
);
return Container(
/* return Container(
child: FutureBuilder(
future: twitterFeed.getPage(),
builder: (ctx, snapshot){
@@ -114,8 +73,6 @@ class VerticalTwitterFeed extends StatelessWidget{
}
},
),
);
); */
}
}

View File

@@ -58,7 +58,7 @@ packages:
source: hosted
version: "2.1.1"
crypto:
dependency: "direct main"
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
@@ -273,13 +273,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:

View File

@@ -24,8 +24,6 @@ dependencies:
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.