Flutter Application To run Docker Commands.

How Flutter Works: Widget Strategy and Dart Programming Language

The framework of Flutter, written in the Dart programming language, has the Flutter engine, Foundation library, and widgets. The approach to development in Flutter differs from others by its declarative UI writing. Here, there is a need to start from the end, meaning before starting the development of some element, the user needs to have in mind a complete picture of what kind of UI it will be. Many developers distinguish this UI writing as a more clear one, but it also causes certain difficulties for developers at first.

The main idea of Flutter is that developers can build the entire user interface by simply combining different widgets. The application interface consists of various nested widgets, which can be any object. This applies to anything from buttons to padding, and by combining widgets, the developer can customize the application radically. Widgets can influence each other and use built-in functions to respond to external changes in the state. Widgets are important elements of the user interface and comply with the design specifications of Android, iOS and conventional web applications.

With Flutter, developers can create custom widgets, which can be easily combined with existing ones. Note that there are no OEM widgets, but Flutter Gallery provides developers with their own ready-made widgets — a set of application examples that show how to use standard widgets — which look like native Android and iOS design languages (Material and Cupertino).

Flutter also provides developers the ability to view widgets in a reactive style. For the record, Flutter isn’t the first one to do this but Flutter is the only mobile SDK that offers a reactive look without the need for a JavaScript bridge. Moreover, Dart comes with a repository of software packages to enhance the capabilities of applications. For example, it offers several packages that help to access Firebase so that developers can create serverless applications. Another package allows access to the Redux data warehouse or facilitates access to platform services and equipment such as cameras.

Quick code development

Flutter creators wanted to invent a technology with the quickest opportunity to deliver a great-performing, cross-platform mobile application. The following features allow this:

  • Hot reload. Flutter’s hot reloading helps save time while developing by letting the developer see the applied changes in real-time. This capability helps developers be significantly more efficient and productive. Flutter’s hot reload works better than competitors’ similar features. It allows the developer to pause code execution, make changes to the code, and continue the code from the same place. This greatly speeds up development and allows more experimenting.

Hot Reload Operation

  • Widgets. One of the most significant benefits of Flutter is how it uses ready-made widgets. This ensures that Flutter offers a consistent model for development and design. Widgets are Google-based, so they are high code quality and perform better than other open-source frameworks. As most of them are extremely customizable, they save developers’ time like no other framework. In addition to the major layout widgets, Flutter widgets follow both the Material and Cupertino looks, which is a huge advantage.
  • Minimal code and access to native features. Flutter lets developers use Dart, which is compiled directly into the ARM code of mobile devices and helps not only to speed up applications, it allows them to launch quicker also.
  • Flutter helps make developers’ lives easier through its third-party integrations and native codebase. With Flutter, developers can access native features.

That’s what makes quick code development possible, thus the whole process faster, easier and less disturbing.

Creating an app which will help the user to run all the docker commands like:

🎯docker images
🎯docker ps
🎯docker run
🎯docker rm -f
🎯docker start
🎯docker stop

Pre-requisite:

  1. Install HTTPD software and enable it’s service.
  2. Install Docker-ce and enable it’s service.
  3. Internet connectivity

Steps to be followed:

  1. Enable httpd service: “systemctl start httpd”
  2. Stop firewalld service: “systemctl stop firewalld”
  3. Stopping Selinux services using: “setenforce 0”
  4. Add Docker to apache’s groups for permission as we need to run it as a Backend server.
  5. Add Apache to sudoer’s config file
  6. Adding python backend CGI-code to the “/var/www/cgi-bin”
  7. Make the python file executable: “chmod +x <filename>”
  8. Finally accessing your Flutter App

Now let’s get started:

Step-1: Starting the httpd, Stopping the firewall and disabling the selinux:

>> systemctl stop firewalld
>> systemctl start httpd
>> setenforce 0

Step-2: Add the apache to docker group.

>> vim /etc/group
>> docker:x:<someumber>:apache
Above is Important for permission purpose.

Step-3: Adding the apache to Sudoers config file.

>> vim /etc/sudoers
>> apache ALL:(ALL) NOPASSWD : ALL

Step-4: Add the Back-end code to the webserver.

>> Go to /var/www/cgi-bin
>> Create a file name “dockerps.py”
And Add the following code to it!!

Step-5: Copy paste the main.dart into your Flutter Project

>> Go to Github
>> Download main.dart and pubsec.yaml
>> Place the Downloaded file into your project
And Enjoy the app

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rishabh

Rishabh

Student from B.tech 2nd Year, A proud ARTH learner, love new technologies, Curious about many thing, likes to explore places, love eating pizza and much more.