Encoder events in EEZ studio

Description

Hi, My first post here so apologise in advance if i missed something
So im working on this project with EEZ studio and M5Dial, where i want to use rotary encoder for navigation between multiple screens. i have included on-screen buttons for navigation as well which are working fine.
i have used a work around to do the encoder based navigation as mentioned in the code snippet below but i dont think its workable as i advance in development of this UI.

i wish i had the LV_EVENT type of flags ig to give me more control
i read online and found that a encoder group is to be made and got lost in docs.

What MCU/Processor/Board and compiler are you using?

I am using a M5Dial with esp32s3

What LVGL version are you using?

8.3.2 because a some online resources i refered to had raise issues with 9 version

What do you want to achieve?

I want help regarding the encoder implementation in lvgl

What have you tried so far?

i have found a work around and few reference on github but i would be grateful if i had a clear instruction or help

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*void encoder_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
    long newPosition = M5Dial.Encoder.read() / 4; // Normalize encoder position
    if (newPosition != oldPosition) {
        int enc_diff = newPosition - oldPosition; // Calculate the difference
        oldPosition = newPosition; // Update the old position
        data->state = LV_INDEV_STATE_PR; // Mark as pressed state

        Serial.println(newPosition); // Debug: print the encoder position

        if (enc_diff > 0) {
            // Encoder turned clockwise
            current_menu_page = (current_menu_page + 1) % max_menu_pages; // Increment and wrap around
            loadScreen(get_screen_enum(current_menu_page)); // Navigate to the next screen
        } else if (enc_diff < 0) {
            // Encoder turned counterclockwise
            current_menu_page = (current_menu_page + max_menu_pages - 1) % max_menu_pages; // Decrement and wrap around
            loadScreen(get_screen_enum(current_menu_page)); // Navigate to the previous screen
        }
    } else {
        data->state = LV_INDEV_STATE_REL; // Mark as released state
    }
}*/ // this is the work around that im using 
#include "ui.h"

static int current_menu_page = 0;
static const int max_menu_pages = 4;

void action_prev_scr(lv_event_t *e) {
    if(current_menu_page > 0) {
        current_menu_page--;
        loadScreen(current_menu_page);
    }
}


void action_next_scr(lv_event_t *e) {
    if(current_menu_page < max_menu_pages) {
        current_menu_page++;
        loadScreen(current_menu_page);
    }
}

``` this is the actions.c file for action handling 

Thankk you for your help, if any other info is needed please comment down