Adding TopNews
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/news.dart';
|
||||
|
||||
class ItemRegularNews extends StatelessWidget {
|
||||
const ItemRegularNews({Key key, this.news}) : super(key: key);
|
||||
|
||||
final News news;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 12, right: 12),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
_showDetailNews(context);
|
||||
},
|
||||
child: Card(
|
||||
elevation: 4,
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Container(
|
||||
height: 90,
|
||||
width: 90,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(news.previewUrl),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10),
|
||||
child: Text(
|
||||
news.title,
|
||||
textAlign: TextAlign.justify,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 3,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 14),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
child: Image.network(news.sourceUrl),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
_showDetailNews(context);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: Card(
|
||||
elevation: 4,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 120,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 100,
|
||||
width: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(news.previewUrl),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
news.title,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 4,
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Image.network(news.sourceUrl),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showDetailNews(BuildContext context) {}
|
||||
}
|
||||
Reference in New Issue
Block a user