75 lines
2.1 KiB
Dart
75 lines
2.1 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
|
import 'package:le_kiosque_by_gcs/model/news.dart';
|
|
import 'package:le_kiosque_by_gcs/ui/view/news/item_regular_news.dart';
|
|
import 'package:le_kiosque_by_gcs/ui/view/news/item_top_news.dart';
|
|
|
|
class NewsView extends StatelessWidget {
|
|
const NewsView({
|
|
Key key,
|
|
@required this.newsList,
|
|
}) : super(key: key);
|
|
|
|
final List<News> newsList;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CustomScrollView(
|
|
slivers: [
|
|
SliverPadding(
|
|
padding: EdgeInsets.all(16),
|
|
sliver: SliverToBoxAdapter(
|
|
child: Text(
|
|
"Top actualité",
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xFF3B3B3B),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SliverToBoxAdapter(
|
|
child: Container(
|
|
height: 280,
|
|
child: ListView.builder(
|
|
scrollDirection: Axis.horizontal,
|
|
itemCount: magazinesTest.length,
|
|
itemBuilder: (context, index) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 16,
|
|
bottom: 16,
|
|
),
|
|
child: ItemTopNews(
|
|
news: newsList[index],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
SliverPadding(
|
|
padding: EdgeInsets.all(16),
|
|
sliver: SliverToBoxAdapter(
|
|
child: Text(
|
|
"Actualité de la semaine",
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xFF3B3B3B),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SliverList(
|
|
delegate: SliverChildBuilderDelegate((context, index) {
|
|
return ItemRegularNews(news: newsList[index]);
|
|
}, childCount: newsList.length),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|