Flutter — A New Perspective

Flutter — A New PerspectivePhoto by Kristopher Roller on UnsplashDifferent angles reveal different worlds. Perspective is a choice. — Bronnie WareWe all sometimes work on problems that seem to not be solvable, we try and try different solutions, sugges…


This content originally appeared on Level Up Coding - Medium and was authored by Donald Obinna Amadi

Flutter — A New Perspective

Photo by Kristopher Roller on Unsplash
Different angles reveal different worlds. Perspective is a choice. — Bronnie Ware

We all sometimes work on problems that seem to not be solvable, we try and try different solutions, suggestions, approaches. More often than not, we solve the problem then get unto the next. Problem-solving, one of the joys of software development right? :)

I faced a similar experience for the whole of the month, trying to implement some functionality with the Flutter radio widget, which you can see how it is used here. Now the function is quite straightforward, you get some data that contains a list of questions, the questions which have a list of options of theirs and you display it as questions and answers where the user can only pick an option. I guess this is quite straightforward to implement. However, there was a twist, isn’t there always?

The radio button operates with a group value and a value which are used to determine which of the values are selected. Now, the problem was the data was very dynamic, with a dynamic number of questions and a dynamic number of options. Displaying the questions was quite easy, I made use of a for loop to iterate through the number of questions and display each of them as a text. The challenging part was displaying the options with the radio button, as the number of options was not of the same length.

Based on every solution, suggestion and code implementation I came about, they only seemed to cater for a fixed number of options. It’ll be an understatement to say I was frustrated as none of the solutions worked as expected. I ended up using the checkbox whose implementation is much more straightforward and can be read more about here, as it uses a boolean to check the state of the widget, that is, to check if it is either checked or unchecked. Using a checkbox worked very nicely, I was able to display the data as expected, life was good. Until the testers came along, with their blazing guns and their UI/UX fixes, that was one of the errors, ‘checkboxes are by default meant to be used to select more than one item, radio buttons are what we are to use, c’mon man, this is UI/UX 101, where’s your head at?’. I had to go back to work, I tried again, this time with more determination than the last, still, errors. But then, the solution came to me.

Why not create a widget that looks like a radio button but behaves like a checkbox?.

Sometimes you have to step back and look at the situation from a different angle to find a different solution — Greg S. Reid

I got straight to this and implemented this in record time and I came up with this custom Radio Button.

I was elated, not just because of the relief of finally getting that solved, although that was surely a reason, but also hitting a realization. The major realization is to look at problems, challenges, obstacles with an open mind, a very, very open mind, train your mind to be free, it’s easier for some than others, for some of us, we need constant practice to open our minds.

This brings us to the end of the article, do hit the clap button if you found this useful. Thank you and see you on the next ?


Flutter — A New Perspective was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Donald Obinna Amadi


Print Share Comment Cite Upload Translate Updates
APA

Donald Obinna Amadi | Sciencx (2021-08-29T23:22:38+00:00) Flutter — A New Perspective. Retrieved from https://www.scien.cx/2021/08/29/flutter%e2%80%8a-%e2%80%8aa-new-perspective/

MLA
" » Flutter — A New Perspective." Donald Obinna Amadi | Sciencx - Sunday August 29, 2021, https://www.scien.cx/2021/08/29/flutter%e2%80%8a-%e2%80%8aa-new-perspective/
HARVARD
Donald Obinna Amadi | Sciencx Sunday August 29, 2021 » Flutter — A New Perspective., viewed ,<https://www.scien.cx/2021/08/29/flutter%e2%80%8a-%e2%80%8aa-new-perspective/>
VANCOUVER
Donald Obinna Amadi | Sciencx - » Flutter — A New Perspective. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/29/flutter%e2%80%8a-%e2%80%8aa-new-perspective/
CHICAGO
" » Flutter — A New Perspective." Donald Obinna Amadi | Sciencx - Accessed . https://www.scien.cx/2021/08/29/flutter%e2%80%8a-%e2%80%8aa-new-perspective/
IEEE
" » Flutter — A New Perspective." Donald Obinna Amadi | Sciencx [Online]. Available: https://www.scien.cx/2021/08/29/flutter%e2%80%8a-%e2%80%8aa-new-perspective/. [Accessed: ]
rf:citation
» Flutter — A New Perspective | Donald Obinna Amadi | Sciencx | https://www.scien.cx/2021/08/29/flutter%e2%80%8a-%e2%80%8aa-new-perspective/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.