CharacterController IsGrounded switching

I am having an issue with the CharacterController.isGrounded. When my player is idle, the isGrounded is switching back and forth between true and false. The code is in the FixedUpdate function. I have looked this up and none of the other posts have solved my issue.

if (_controller.isGrounded == true)
{
_moveDirection = Vector3.zero;
_airVel = 0;
_animator.SetBool(AnimConditions.Grounded, true);

_horitzontal = Input.GetAxis(PlayerInput.Horizontal);
_vertical = Input.GetAxis(PlayerInput.Vertical);

_animator.SetFloat(AnimConditions.Direction, _horitzontal);
_animator.SetFloat(AnimConditions.Speed, _vertical);

if (Input.GetButtonDown(PlayerInput.Jump))
{
Jump();
}
}
else
{
_moveDirection.x = Input.GetAxis(PlayerInput.Horizontal) * _moveSpeed;
_moveDirection.z = Input.GetAxis(PlayerInput.Vertical) * _moveSpeed;
_moveDirection = _xForm.TransformDirection(_moveDirection);
_animator.SetBool(AnimConditions.Grounded, false);
}

_moveDirection.y -= gravity * Time.deltaTime;
_controller.Move(_moveDirection * Time.deltaTime);

Please use code tags when posting code. Without looking into the code to much you should probably move a lot of that code into the Update as input shouldn’t be gathered in fixedUpdate. Not sure if that is causing the problem, it’s just good practice.

ref: CharacterController.Move in FixedUpdate vs. Update - Unity Engine - Unity Discussions

I think you should only be doing:
_moveDirection.y += gravity * Time.deltaTime;

Because most likely the gravity is negative in the physics setting. IF so, the code you have is moving the player upwards, not downwards