import 'dart:io'; import 'package:flutter/material.dart'; class FeedbackImageWidget extends StatelessWidget { final File file; final VoidCallback onDelete; const FeedbackImageWidget({Key key, this.file, this.onDelete}) : super(key: key); @override Widget build(BuildContext context) { return Stack( alignment: Alignment.topRight, children: [ Container( width: double.infinity, height: double.infinity, child: Image.file( file, fit: BoxFit.cover, ), ), GestureDetector( onTap: onDelete, child: Transform.translate( offset: Offset(4, -4), child: Container( width: 16, height: 16, decoration: BoxDecoration( color: Colors.redAccent, borderRadius: BorderRadius.circular(8)), child: Icon( Icons.remove, color: Colors.white, size: 10, ), ), ), ) ], ); } }