mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Automatically reset post create form
This commit is contained in:
		@@ -64,9 +64,7 @@ class _PostCreateFormWidgetState extends State<PostCreateFormWidget> {
 | 
			
		||||
  void initState() {
 | 
			
		||||
    super.initState();
 | 
			
		||||
 | 
			
		||||
    _postVisibilityLevel = widget.postTarget == PostTarget.GROUP_PAGE
 | 
			
		||||
        ? PostVisibilityLevel.GROUP_MEMBERS
 | 
			
		||||
        : PostVisibilityLevel.FRIENDS;
 | 
			
		||||
    _resetForm();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @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
 | 
			
		||||
  Future<void> _changeVisibilityLevel() async {
 | 
			
		||||
    final newLevel = await showPostVisibilityPicker(
 | 
			
		||||
@@ -185,6 +195,7 @@ class _PostCreateFormWidgetState extends State<PostCreateFormWidget> {
 | 
			
		||||
 | 
			
		||||
      showSimpleSnack(context, tr("The post has been successfully created!"));
 | 
			
		||||
 | 
			
		||||
      this._resetForm();
 | 
			
		||||
      widget.onCreated();
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      setState(() => _isCreating = false);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user