-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat syntax highlight request body #358
base: main
Are you sure you want to change the base?
Feat syntax highlight request body #358
Conversation
We already have dark & light syntax highlighting themes for API Dash which is used in codegens here - Line 160 in f3a7865
|
@animator I missed it 😅, I've pushed a fix to address this: |
You need to go through the relevant issue #22 which talks about the deliverables and the past work & the issues in the WIP PR that was merged. |
@animator As per the issue, I believe syntax highlight is taken care of through this PR. I should be able to add formatting relatively easily(using I added a "format JSON" elevated button. It looks like this: And, where do I keep the validation error? I'm thinking of simply adding a check to the OnChanged hook that will check if JSON is valid or not. If not then it would show an error. But not sure where to place this widget in the UI Also, do I create a new file inside utils folder ( |
@animator This is what I've come up with. Haven't added any new packages, simply using the json function from record-2024.03.26-18.08.23.mp4 |
@animator pushed the new changes, made it look pretty as much as I could 😅. |
The original text editor is perfectly fine. Why was it modified? |
Yeah,
@animator If you believe this isn't what we should do, then I can go ahead and revert the changes for that. |
4912f71
to
17ca893
Compare
PR Description
This PR Introduces syntax highlighting for JSON type request body.
We had a comment referencing the incomplete
JsonTextFieldEditor
implementation. Instead of hacking together our own, I've used a third-party package code_field.This package provides syntax highlighting as well as inserts tab characters at appropriate positions.
We can also use this same package in the future for other request bodies such as Graphql, protobuf, etc. Once we support them.
I've also changed the default
TextFieldEditor
widget using theplaintext
theme, as the name suggests, it doesn't provide any syntax highlighting but does provide simple tab character insertion wherever needed.Here is a list of currently supported languages and themes that are supported: languages, themes
Lastly Here are some screenshots:
I've decided to use
monokaiSublimeTheme
for dark mode anddefaultTheme
for light mode since they look the most natural for our colorscheme.If unsatisfied with the current choice please tell me any other theme from the list above, The developer has also created a nice site to figure out a theme: Here
Checklist
main
branch before making this PRflutter test
) and all tests are passingAdded/updated tests?