mirror of
https://github.com/flutter/holobooth.git
synced 2025-05-17 21:36:00 +08:00

<!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Description Changes: - Bump min dart SDK to 2.19.0 - Bump Flutter version to 3.7.12 - Used Very Good Analysis 4.0.0 - Corrected new analyzer issues - Dart format ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ ] ✨ New feature (non-breaking change which adds functionality) - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [X] 🗑️ Chore
42 lines
940 B
Dart
42 lines
940 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// {@template preview_image}
|
|
/// A wrapper around [Image.memory]
|
|
/// {@endtemplate}
|
|
class PreviewImage extends StatelessWidget {
|
|
/// {@macro preview_image}
|
|
const PreviewImage({
|
|
required this.data,
|
|
this.height,
|
|
this.width,
|
|
super.key,
|
|
});
|
|
|
|
/// Data URI representing the data of the image
|
|
final String data;
|
|
|
|
/// [double?] representing the height of the image
|
|
final double? height;
|
|
|
|
/// [double?] representing the width of the image
|
|
final double? width;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Image.network(
|
|
data,
|
|
filterQuality: FilterQuality.high,
|
|
isAntiAlias: true,
|
|
fit: BoxFit.cover,
|
|
height: height,
|
|
width: width,
|
|
errorBuilder: (context, error, stackTrace) {
|
|
return Text(
|
|
'$error, $stackTrace',
|
|
key: const Key('previewImage_errorText'),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|