|
|
@ -20,7 +20,16 @@ import 'buttonPostComponent.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class EditablePostComponent extends StatefulWidget {
|
|
|
|
class EditablePostComponent extends StatefulWidget {
|
|
|
|
final Music? music;
|
|
|
|
final Music? music;
|
|
|
|
const EditablePostComponent({Key? key, this.music}) : super(key: key);
|
|
|
|
final Function callBackImage;
|
|
|
|
|
|
|
|
final Function callBackCity;
|
|
|
|
|
|
|
|
final Function callBackDescription;
|
|
|
|
|
|
|
|
const EditablePostComponent(
|
|
|
|
|
|
|
|
{Key? key,
|
|
|
|
|
|
|
|
this.music,
|
|
|
|
|
|
|
|
required this.callBackImage,
|
|
|
|
|
|
|
|
required this.callBackCity,
|
|
|
|
|
|
|
|
required this.callBackDescription})
|
|
|
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
State<EditablePostComponent> createState() => _EditablePostComponentState();
|
|
|
|
State<EditablePostComponent> createState() => _EditablePostComponentState();
|
|
|
@ -60,16 +69,24 @@ class _EditablePostComponentState extends State<EditablePostComponent>
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
final imageTemp = File(image.path);
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
this.image = imageTemp;
|
|
|
|
this.image = imageTemp;
|
|
|
|
|
|
|
|
widget.callBackImage(imageTemp);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
print('Failed to pick image: $e');
|
|
|
|
print('Failed to pick image: $e');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _updateDescription(String text) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
widget.callBackDescription(text);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _selectLocation(Tuple2<String, String> location) {
|
|
|
|
void _selectLocation(Tuple2<String, String> location) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context);
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
selectedCity = location;
|
|
|
|
selectedCity = location;
|
|
|
|
|
|
|
|
widget.callBackCity(location);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -96,6 +113,13 @@ class _EditablePostComponentState extends State<EditablePostComponent>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
|
|
_controller.dispose();
|
|
|
|
|
|
|
|
animationController.dispose();
|
|
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ClipRRect(
|
|
|
|
return ClipRRect(
|
|
|
@ -276,6 +300,9 @@ class _EditablePostComponentState extends State<EditablePostComponent>
|
|
|
|
child: SizedBox(
|
|
|
|
child: SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
child: TextFormField(
|
|
|
|
child: TextFormField(
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
_updateDescription(value);
|
|
|
|
|
|
|
|
},
|
|
|
|
keyboardAppearance: Brightness.dark,
|
|
|
|
keyboardAppearance: Brightness.dark,
|
|
|
|
minLines: 1,
|
|
|
|
minLines: 1,
|
|
|
|
cursorColor: primaryColor,
|
|
|
|
cursorColor: primaryColor,
|
|
|
|