This repository has been archived on 2026-05-22. You can view files and clone it, but cannot push or open issues or pull requests.
Files
ITCS-4155/lib/twitter_assets/tweet.dart

70 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
class Tweet {
final int id;
final String text;
final String userName;
final String userImgUrl;
final String url;
Tweet(
this.id,
this.text,
this.userName,
this.userImgUrl,
this.url,
);
/*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'],
);
}
Commenting out till we figure out the API
*/
}
class TwitterCard extends StatelessWidget{
const TwitterCard({
Key key,
@required this.tweet,
}) : super(key: key);
final Tweet tweet;
@override
Widget build(BuildContext context) {
return Card(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 0),
child: ListTile(
leading: SizedBox(
height: 150,
width: 75,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage('${tweet.userImgUrl}'),
),
),
),
),
title: Text('${tweet.userName}'),
subtitle: Text('${tweet.text}'),
),
),
);
}
}