基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.1 KiB

  1. import 'dart:io';
  2. import 'package:flutter/material.dart';
  3. class FeedbackImageWidget extends StatelessWidget {
  4. final File file;
  5. final VoidCallback onDelete;
  6. const FeedbackImageWidget({Key key, this.file, this.onDelete})
  7. : super(key: key);
  8. @override
  9. Widget build(BuildContext context) {
  10. return Stack(
  11. alignment: Alignment.topRight,
  12. children: <Widget>[
  13. Container(
  14. width: double.infinity,
  15. height: double.infinity,
  16. child: Image.file(
  17. file,
  18. fit: BoxFit.cover,
  19. ),
  20. ),
  21. GestureDetector(
  22. onTap: onDelete,
  23. child: Transform.translate(
  24. offset: Offset(4, -4),
  25. child: Container(
  26. width: 16,
  27. height: 16,
  28. decoration: BoxDecoration(
  29. color: Colors.redAccent,
  30. borderRadius: BorderRadius.circular(8)),
  31. child: Icon(
  32. Icons.remove,
  33. color: Colors.white,
  34. size: 10,
  35. ),
  36. ),
  37. ),
  38. )
  39. ],
  40. );
  41. }
  42. }