Art

This an Flutter App. Calculina.

Calculina App. It is used to make a quick calculation of the corresponding insulin units for each meal, for people who suffer from diabetes, and need to calculate the units of rapid insulin. With its elegant design, easy and understandable, people can interact with Calculina and understand very quickly how to use the App to get the calculation they need. You can also share this result on the social networks that the device has installed.

 

 

 

  • GetX has 3 basic principles. This means that these are the priority for all resources in the library: PRODUCTIVITY, PERFORMANCE AND ORGANIZATION.

Well, the first concept that we have to keep on mind is  WE DON’T CARE ABOUT THE CONTEXT!!, why??? because getX manages that for us!!…

You do not need context to navigate between routes, so you are not dependent on the widget tree (visualization) for this. You don’t need context to access your controllers/blocs through an inheritedWidget, so you completely decouple your presentation logic and business logic from your visualization layer. You do not need to inject your Controllers/Models/Blocs classes into your widget tree through MultiProviders. For this, GetX uses its own dependency injection feature.

Go to official documentation

Before, I want to show , how this project is structured,

Well , today we are going to explain in detail the first, part of this video, Showing an snackbar using GetX.

1.Step install dependencies :

(Go to  your pubspec.yaml file, in your flutter project)

In this example we are going to need two additional dependencies: folding cell, google_fonts, awesome packages!!

2.Change file Main.dart

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widgetbuild(BuildContextcontext) {
return GetMaterialApp(
title:’Flutter GetX’,
debugShowCheckedModeBanner :false,
theme:  ThemeData(primarySwatch:Colors.blue,),
home: FoldingCell(),
initialBinding: MyBindings(),);}}

Our Main.dart file should return Get MaterialApp instead of traditional MaterialApp

3.Create a file  call folding_main.dart.

( Now is the time to use the pack folding cell Go to package )In this point, we are going to build , two main widgets, that we need frontWidget and innerWidget to fold and unfold. (see details on github…. https://github.com/Liliana99/my_getx)

Now we need to create our only controller , it so amazing, only for one controller !! ok , let’s go:

4.Create a folder call controllers, into their create a file call main controller.dart. path : lib/controlllers/main_controller.dart

Our controller needs to extends GetxController, it comes from Getx library. We create the get to have access in different places. So it is all, we’ve already injected our controller in the UI.  Goal accomplished, show that GetX does not need to call context to display snackbar!! . In my next articles, we are going to deep will the access with controllers and binding