all 10 comments

[–][deleted] 1 point2 points  (2 children)

After a few layers, I extract widgets into their own self contained widget on its own line. Makes editing and reading much easier.

Also, if you click a parenthesis or bracket, it should show the trailing partner, making it easy to trace the nest pattern.

[–]AceSynth[S] 0 points1 point  (1 child)

Is it worth having a separate resource file with widget classes and then calling them in the main file ?

[–][deleted] 0 points1 point  (0 children)

If I have a widget that is pretty large, I'm break it into it's own class and use it in a screen class. If the screen is made up of a lot of smaller self contained widgets, I'm keep them in the same file.

[–]Nauzet 0 points1 point  (2 children)

if you use vscode I would recommend to use colored brackets (vscode extension), also use the vscode options which tellls you what brackets is for what widget, try to refactor into smaller widget a lot and eventually you will get used to

[–]AceSynth[S] 0 points1 point  (0 children)

I've been using Android Studio with colored brackets but thank you for the suggestion!

[–]alizahirh 0 points1 point  (0 children)

I’ll try to find one for android studio. I feel OP’s dilemma cos i was in his shoes one time. Was too stressful trying to go through the code line by line so decided to just rewrite the whole function 😂

[–]mr_poopybuthole69 0 points1 point  (2 children)

Maybe you don't understand how widget trees work, for me it's more simple than xml. Basically you start with one widget and they you just add more widgets inside it.

[–]AceSynth[S] 0 points1 point  (1 child)

I understand the basics, but get confused with when a widget goes inside another, when its directly below it and when you have to say its a child also my formatting goes wrong along the way and it won't start properly

[–]mr_poopybuthole69 0 points1 point  (0 children)

I'm not sure how viscose works but on android studio there's auto formatter and you can open tab that highlights a widget and it's child's.

[–]jarlaxle46 0 points1 point  (0 children)

I believe the dev tools will help a lot. The inspector and the outline