|
|
@ -1,12 +1,16 @@
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'dart:html' as html;
|
|
|
|
import 'package:animated_appear/animated_appear.dart';
|
|
|
|
import 'package:animated_appear/animated_appear.dart';
|
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
|
|
|
|
|
|
|
import 'package:firebase_storage/firebase_storage.dart';
|
|
|
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
|
|
|
|
|
import 'package:image_picker_for_web/image_picker_for_web.dart';
|
|
|
|
import 'package:insta_image_viewer/insta_image_viewer.dart';
|
|
|
|
import 'package:insta_image_viewer/insta_image_viewer.dart';
|
|
|
|
import 'package:justmusic/values/constants.dart';
|
|
|
|
import 'package:justmusic/values/constants.dart';
|
|
|
|
import 'package:text_scroll/text_scroll.dart';
|
|
|
|
import 'package:text_scroll/text_scroll.dart';
|
|
|
@ -60,8 +64,22 @@ class _EditablePostComponentState extends State<EditablePostComponent> with Tick
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future pickImage(ImageSource source) async {
|
|
|
|
Future pickImage(ImageSource source) async {
|
|
|
|
|
|
|
|
if(kIsWeb){
|
|
|
|
|
|
|
|
print('you are on web');
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
final image = await ImagePicker().pickImage(source: source, imageQuality: 20);
|
|
|
|
|
|
|
|
if (image == null) return;
|
|
|
|
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
this.image = imageTemp;
|
|
|
|
|
|
|
|
widget.callBackImage(imageTemp);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
|
|
|
|
print('Failed to pick image: $e');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
final image = await ImagePicker().pickImage(source: source, imageQuality: 20);
|
|
|
|
final image = await ImagePicker().pickImage(source: source, imageQuality: 20);
|
|
|
|
if (image == null) return;
|
|
|
|
if (image == null) return;
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
final imageTemp = File(image.path);
|
|
|
@ -74,6 +92,8 @@ class _EditablePostComponentState extends State<EditablePostComponent> with Tick
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _updateDescription(String text) {
|
|
|
|
void _updateDescription(String text) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
widget.callBackDescription(text);
|
|
|
|
widget.callBackDescription(text);
|
|
|
@ -182,7 +202,10 @@ class _EditablePostComponentState extends State<EditablePostComponent> with Tick
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
child: InstaImageViewer(
|
|
|
|
child: InstaImageViewer(
|
|
|
|
backgroundIsTransparent: true,
|
|
|
|
backgroundIsTransparent: true,
|
|
|
|
child: Image(
|
|
|
|
child: kIsWeb?InstaImageViewer(
|
|
|
|
|
|
|
|
backgroundIsTransparent: true,
|
|
|
|
|
|
|
|
child: Image.network(image!.path)
|
|
|
|
|
|
|
|
):Image(
|
|
|
|
image: FileImage(image!),
|
|
|
|
image: FileImage(image!),
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -250,8 +273,8 @@ class _EditablePostComponentState extends State<EditablePostComponent> with Tick
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
children: [ kIsWeb?Container()
|
|
|
|
Expanded(
|
|
|
|
:Expanded(
|
|
|
|
flex: 5,
|
|
|
|
flex: 5,
|
|
|
|
child: GestureDetector(
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
@ -262,7 +285,7 @@ class _EditablePostComponentState extends State<EditablePostComponent> with Tick
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
kIsWeb?Container():SizedBox(
|
|
|
|
width: 15,
|
|
|
|
width: 15,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|