import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'show_img.dart';

typedef OnFile = void Function(File);

class ImageUrl extends StatefulWidget {
  final String title;
  final String url;

  const ImageUrl({Key key, this.title, this.url}) : super(key: key);
  @override
  _ImageUrlState createState() => _ImageUrlState();
}

class _ImageUrlState extends State<ImageUrl> {
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () => {
        Navigator.push(
          context,
          MaterialPageRoute(
              builder: (context) =>
                  ShowImage(url: widget.url, fileName: widget.title)),
        )
      },
      child: Chip(
        avatar: Icon(Icons.image),
        label: Text(widget.title),
      ),
    );
  }
}
