Compare commits
4 Commits
master
...
Twitter_ap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f819278368 | ||
|
|
68c7b5c5b3 | ||
|
|
764dda9ea6 | ||
|
|
c874d2d5c3 |
@@ -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;
|
||||
|
||||
@@ -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 let’s celebrate together virtually \n We’re 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);
|
||||
}
|
||||
|
||||
@@ -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}'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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{
|
||||
}
|
||||
},
|
||||
),
|
||||
); */
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
33
pubspec.lock
33
pubspec.lock
@@ -7,21 +7,21 @@ packages:
|
||||
name: archive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.13"
|
||||
version: "2.0.11"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
version: "1.5.2"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
version: "2.4.0"
|
||||
bloc:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -35,21 +35,21 @@ packages:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "1.0.5"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
version: "1.1.2"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.14.12"
|
||||
version: "1.14.11"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -58,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:
|
||||
@@ -113,7 +113,7 @@ packages:
|
||||
name: image
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.12"
|
||||
version: "2.1.4"
|
||||
intl:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -176,7 +176,7 @@ packages:
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
version: "2.0.5"
|
||||
rxdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -230,7 +230,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.5.5"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -272,7 +272,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:
|
||||
@@ -293,7 +300,7 @@ packages:
|
||||
name: xml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.6.1"
|
||||
version: "3.5.0"
|
||||
sdks:
|
||||
dart: ">=2.6.0 <3.0.0"
|
||||
flutter: ">=1.12.13+hotfix.4 <2.0.0"
|
||||
|
||||
@@ -24,6 +24,8 @@ 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.
|
||||
|
||||
Reference in New Issue
Block a user