diff --git a/Sources/justMUSIC/lib/components/editable_post_component.dart b/Sources/justMUSIC/lib/components/editable_post_component.dart index 64c7b74..eb38b8c 100644 --- a/Sources/justMUSIC/lib/components/editable_post_component.dart +++ b/Sources/justMUSIC/lib/components/editable_post_component.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:animated_appear/animated_appear.dart'; import 'package:auto_size_text/auto_size_text.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; @@ -40,7 +39,6 @@ class _EditablePostComponentState extends State with Tick late AnimationController animationController; late AnimationController _controller; File? image; - Uint8List webImage = Uint8List(8); Tuple2? selectedCity; @override @@ -61,32 +59,21 @@ class _EditablePostComponentState extends State with Tick super.initState(); } - Future pickImage(ImageSource source) async { + Future pickImage(ImageSource source) async { try { - final image = await ImagePicker().pickImage(source: source, imageQuality: 20); + final image = await ImagePicker().pickImage(source: source, imageQuality: 20); if (image == null) return; - - if (!kIsWeb) { - final imageTemp = File(image.path); - setState(() { - this.image = imageTemp; - widget.callBackImage(imageTemp); - }); - } else { - final imageBytes = await image.readAsBytes(); - setState(() { - webImage = imageBytes; - - widget.callBackImage(File("/tmp").writeAsBytes(webImage)); - }); - } + final imageTemp = File(image.path); + setState(() { + this.image = imageTemp; + widget.callBackImage(imageTemp); + }); } on PlatformException catch (e) { print('Failed to pick image: $e'); } } - void _updateDescription(String text) { setState(() { widget.callBackDescription(text); @@ -173,34 +160,14 @@ class _EditablePostComponentState extends State with Tick ), ), ), - webImage != null + image != null ? Positioned( top: 10, right: 10, child: AnimatedAppear( delay: Duration(milliseconds: 500), duration: Duration(milliseconds: 400), - child: kIsWeb? Container( - width: 110, - height: 110, - decoration: BoxDecoration( - image: DecorationImage( - image: MemoryImage(webImage), - fit: BoxFit.cover, - ), - color: grayColor, - borderRadius: BorderRadius.circular(20), - border: Border.all(style: BorderStyle.solid, color: Colors.white, width: 4)), - child: ClipRRect( - borderRadius: BorderRadius.circular(20), - child: InstaImageViewer( - backgroundIsTransparent: true, - child: Image.memory( - Uint8List.fromList(webImage!), - fit: BoxFit.cover, - )), - ), - ):Container( + child: Container( width: 110, height: 110, decoration: BoxDecoration(