Files
le-kiosque-flutter/lib/ui/custom/item_mag_small.dart
T
2021-03-22 16:49:24 +02:00

44 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:le_kiosque_by_gcs/model/magazine.dart';
import 'package:le_kiosque_by_gcs/ui/view/pdf_reader.dart';
class ItemMagSmall extends StatelessWidget {
const ItemMagSmall({Key key, this.magazine}) : super(key: key);
final Magazine magazine;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
showPdfReader(context, magazine.magazineUrl);
},
child: Container(
height: 167,
width: 119,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(5)),
image: DecorationImage(
image: NetworkImage(magazine.urlCover),
fit: BoxFit.cover,
),
),
),
);
}
void showPdfReader(BuildContext context, String magazineUrl) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
return PdfReader(
pdfUrl: magazine.magazineUrl,
);
},
),
);
}
}