mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Automatically reset post create form
This commit is contained in:
parent
414f81b32f
commit
b326507417
@ -64,9 +64,7 @@ class _PostCreateFormWidgetState extends State<PostCreateFormWidget> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_postVisibilityLevel = widget.postTarget == PostTarget.GROUP_PAGE
|
_resetForm();
|
||||||
? PostVisibilityLevel.GROUP_MEMBERS
|
|
||||||
: PostVisibilityLevel.FRIENDS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -134,6 +132,18 @@ class _PostCreateFormWidgetState extends State<PostCreateFormWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reset the form
|
||||||
|
void _resetForm() {
|
||||||
|
setState(() {
|
||||||
|
_postVisibilityLevel = widget.postTarget == PostTarget.GROUP_PAGE
|
||||||
|
? PostVisibilityLevel.GROUP_MEMBERS
|
||||||
|
: PostVisibilityLevel.FRIENDS;
|
||||||
|
|
||||||
|
_postTextController.text = "";
|
||||||
|
_resetPostSelection();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// Change post visibility level
|
/// Change post visibility level
|
||||||
Future<void> _changeVisibilityLevel() async {
|
Future<void> _changeVisibilityLevel() async {
|
||||||
final newLevel = await showPostVisibilityPicker(
|
final newLevel = await showPostVisibilityPicker(
|
||||||
@ -185,6 +195,7 @@ class _PostCreateFormWidgetState extends State<PostCreateFormWidget> {
|
|||||||
|
|
||||||
showSimpleSnack(context, tr("The post has been successfully created!"));
|
showSimpleSnack(context, tr("The post has been successfully created!"));
|
||||||
|
|
||||||
|
this._resetForm();
|
||||||
widget.onCreated();
|
widget.onCreated();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setState(() => _isCreating = false);
|
setState(() => _isCreating = false);
|
||||||
|
Loading…
Reference in New Issue
Block a user