chore: Update example
This commit is contained in:
parent
05f2d1029a
commit
41c75900c8
|
|
@ -35,6 +35,7 @@ class _MainPageState extends State<MainPage> {
|
||||||
String? _convertedFormat;
|
String? _convertedFormat;
|
||||||
int? _convertElapsedMs;
|
int? _convertElapsedMs;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
double _quality = 90;
|
||||||
|
|
||||||
Future<void> _pickImage() async {
|
Future<void> _pickImage() async {
|
||||||
final picker = ImagePicker();
|
final picker = ImagePicker();
|
||||||
|
|
@ -57,7 +58,7 @@ class _MainPageState extends State<MainPage> {
|
||||||
final converted = await ImageConverter.convert(
|
final converted = await ImageConverter.convert(
|
||||||
inputData: _originalImage!,
|
inputData: _originalImage!,
|
||||||
format: format,
|
format: format,
|
||||||
quality: 90,
|
quality: _quality.round(),
|
||||||
);
|
);
|
||||||
sw.stop();
|
sw.stop();
|
||||||
_convertedImage = converted;
|
_convertedImage = converted;
|
||||||
|
|
@ -87,6 +88,18 @@ class _MainPageState extends State<MainPage> {
|
||||||
onPressed: _pickImage,
|
onPressed: _pickImage,
|
||||||
child: const Text('Pick Image'),
|
child: const Text('Pick Image'),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text('Quality: ${_quality.round()}%'),
|
||||||
|
Slider(
|
||||||
|
value: _quality,
|
||||||
|
min: 1,
|
||||||
|
max: 100,
|
||||||
|
divisions: 99,
|
||||||
|
label: _quality.round().toString(),
|
||||||
|
onChanged: _isLoading
|
||||||
|
? null
|
||||||
|
: (v) => setState(() => _quality = v),
|
||||||
|
),
|
||||||
if (_originalImage != null) ...[
|
if (_originalImage != null) ...[
|
||||||
Text('Original Image ($_originalName): '),
|
Text('Original Image ($_originalName): '),
|
||||||
Image.memory(_originalImage!, height: 180),
|
Image.memory(_originalImage!, height: 180),
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,5 @@ dev_dependencies:
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
config:
|
||||||
|
enable-swift-package-manager: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue