12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import 'package:cached_network_image/cached_network_image.dart';
- import 'package:flutter/material.dart';
- import 'package:video/model/video.dart';
- import 'package:video/utils/screen.dart';
- class FavoriteCard extends StatelessWidget {
- final Video video;
- const FavoriteCard({this.video});
- @override
- Widget build(BuildContext context) {
- return InkWell(
- child: Column(
- children: <Widget>[
- CachedNetworkImage(
- imageUrl: video.imageUrl,
- placeholder: _loader,
- errorWidget: _error,
- height: Screen.bottomSafeHeight + 170,
- width: Screen.width,
- ),
- Text(video.title),
- ],
- ),
- onTap: () {
- Navigator.pushNamed(
- context,
- 'detail',
- arguments: {"url": video.url, "video": video},
- );
- },
- );
- }
- Widget _loader(BuildContext context, String url) {
- return const Center(
- child: CircularProgressIndicator(),
- );
- }
- Widget _error(BuildContext context, String url, dynamic error) {
- print(error);
- return const Center(child: Icon(Icons.error));
- }
- }
|