Flutter: is it worth starting

image
As an avid fan of new products in IT, it was decided to try Flutter from the very first news about a promising platform from Google, and even more so after the conference about flutter .

There will be IMHO, which will give thought, and whether to spend free man-hours.

What I wanted to see / try:

  1. Hot reload
  2. Everything is a widget
  3. Cross platform
  4. Beautiful animation, which was presented here - Flutter 1.0 presentation

But each new product has flaws. It’s possible that what I’m going to describe, is being set up or “so specially done”, but I was touched by these things and forced to think again and evaluate whether it was worth rewriting all my Android projects right now so that they could be “easily launched” on iOs . How to start writing on Dart, what to install to run flutter, how to start the “hot reload” was written in many places. Here I will share IMHO, which is built on the basis of experience in Android development and analysis of the first "hell world" "out of the box."

For those who do not know what the essence of "Helow World" is "out of the box" from flutter.

One active, floating button with a plus sign, which when pressed increases the counter.

image

IMHO number 1. Internet access


To write an Android application and not to look in the manifest file, it means not to write it at all.
Opening the manifesto, the first thing strikes the line
<uses-permissionandroid:name="android.permission.INTERNET"/>

(for non-androids, this line gives the application access to the Internet).

“What is it like? Why would a simple counter go online? ”- the first thing that flashed through my head. Then a picture about information leakage, Google’s total surveillance of everyone quickly spread into my head, and then if users also start complaining ... And right next to the caring authors of the example, they attributed the example to the debugging, don’t worry.

<!-- The INTERNET permission is required for development. Specifically,
         flutter needs it to communicate with the running application
         to allow setting breakpoints, to provide hot reload, etc.
    -->

Of course, I still read why and why such permission is needed, but the fact that even an ordinary counter asks for access to the Internet made me wonder if the nearest vacuum cleaner is watching my movement (exaggerated of course, but I think you understand what I mean).

IMHO number 2. Topics


Rejoicing at the really working “hot reload”, which was tested on changing the color of the theme (the colors of the title bar and the floating button changed), the next in line was “change the text color”. In general, the color of the text, after an hour of analysis of this example, remained dark gray. This is because all widgets in the application already have default themes by default (in Android, this is a design material). And, if you want to change the text color, go change the theme \ styles. And where they are described it is necessary to find more ... And here again the caring authors of the example have been attributed.

Do not reach into the original topics, inherit from the base and rewrite your style.
  /// Rather than creating a new text theme, consider using [Typography.black]
  /// or [Typography.white], which implement the typography styles in the
  /// material design specification:
  ///
  /// <https://material.google.com/style/typography.html#typography-styles>
  ///
  /// If you do decide to create your own text theme, consider using one of
  /// those predefined themes as a starting point for [copyWith] or [apply].


Okay, common sense is the same in native Android, there is an example in the comments how to do it:

classTitleColorThemeCopyextendsStatelessWidget{
   TitleColorThemeCopy({Key key, this.child, this.titleColor}) : super(key: key);
   final Color titleColor;
   final Widget child;
   @overrideWidget build(BuildContext context){
     final ThemeData theme = Theme.of(context);
     return Theme(
       data: theme.copyWith(
         textTheme: theme.textTheme.copyWith(
           title: theme.textTheme.title.copyWith(
             color: titleColor,
           ),
         ),
       ),
       child: child,
     );
   }
 }

... I just need to change the text color in only one field ... why write so much ...

IMHO number 3. Size of application


Let me remind you, the essence of the application is the counter . No pictures, no translations into other languages, no consideration of different screen sizes, no database, no NDK, which takes into account different device architectures.

Go to the phone settings - Applications - MyFirstFlutterApp - Size: 40.68 Mb. (For comparison, for example, the Facebook application weighs about 53 Mb).

Then my free from work and household chores over an hour to see something else. But even these IMHO pushed back a bit the date of the creation of pet projects on flutter.

Also popular now: