DEV Community

Harun Karahan
Harun Karahan

Posted on

Utility package for web developers in Flutter

[Flutter gg example project


In this article, I will share how flutter_gg can improve your coding process and why you should prefer it in your next project.
Before we start, here are key benefits you can expect from flutter_gg.

  • Modular styling

  • Simplifying complex layouts that often involve many widgets in Flutter. ( Coding everything in one gg block as we do in web. )

  • Reducing the time required to learn widgets and to adapt the framework for new Flutter developers.


Let's break down why we need flutter_gg. If you need opacity, padding, and a click event, you'll see something like this.
List the problems we need to solve here.

 Why we need to use additional solution


  • The developer has to learn all these widgets to be able to code it.

  • Reading code becomes difficult for developers. All these widgets affect text widgets and it's not easy to realize (imagine it's a bigger widget).

  • Whenever you need to edit the styling of your widget, you have to cut/paste a lot of times.

  • To keep your code clean, you will create hundreds of widgets.


And we are going to improve the coding experience with flutter_gg.

The first thing we are going to do is unify all of our styles into one variable.

 Unify coding experience

In order to achieve modular styling, we are going to create a style file for each of our screens.

 Modular styling

And here's the result. We made the code more readable and scalable in the long term. We can even use the same styles for different widgets without having to create additional custom widgets.

 Solved issue using flutter_gg


You can find more details in the flutter_gg repo.

https://github.com/karahanharunn/flutter_gg


Check out the more detailed example I've created in Git Hub.

https://github.com/karahanharunn/flutter_gg_card


In this article, I discussed a problem I encountered and shared my alternative solution with you!

I hope you found it useful! Your insights and feedback are invaluable to me, thank you in advance for engaging with my content.

Feel free to contact me on LinkedIn if you have any questions or require assistance.

Harun Karahan | LinkedIn

https://github.com/karahanharunn/

Top comments (0)