Sunday, December 29, 2019

Flutter - Propagate information with InheritedWidget.

flutter inherited widget example
As we know, a Flutter application manages a tree of widgets that sometimes become a very deep tree of widgets. In this big tree, if you want to pass parameters from root to lower widget. You can do it with the help of the constructor that is perfectly fine for accessing data one level down, maybe even two. But if you're widget tree level is deep and you suddenly need the data from an object in your code from root to lower widget. It'll become complex and lead to a lot of boilerplate code for passing context around, as shown below: 
class RootWidget extends StatelessWidget {                                            Level - 1
  final int postId;
  final int scopeId;
  RootWidget(this.postId, this.scopeId);
  Widget build(BuildContext context) {
    ...To DO
    return PostItemWidget(postId, scopeId);
  }
}

class PostItemWidget extends StatelessWidget {                                     Level - 2
  final int postId;
  final int scopeId;
  PostItem(this.postId, this.scopeId);
  Widget build(BuildContext context) {
     ...To DO
    return PostMenuWidget(postId, scopeId);
  }
}

class PostMenuWidget extends StatelessWidget {                                   Level - 3
  final int postId;
  final int scopeId;
  PostMenuWidget(this.postId, this.scopeId);
  Widget build(BuildContext context) {
    //  repeat
    ...                                                                                                          Levels - n



In order to provide a solution for this situation, Flutter provides a special widget called InheritedWidget that defines a context at the root of a sub-tree. It can efficiently deliver this context to every widget in that sub-tree. This widget is specially designed to hold data and to provide it throughout the widget tree, irrespective of its depth. InheritedWidget is the base class for widgets that efficiently propagate information down the widgets tree. All widgets part of that sub-tree will have to ability to interact with the data which is exposed by that InheritedWidget.
Share:

Sunday, December 15, 2019

Flutter - Lifecycle of Widgets.

flutter widget lifecycle diagram
Flutter is a mobile UI framework that helps us to create modern mobile apps for iOS and Android using a single(almost) codebase. A Flutter application is just a combination of Stateful and  Stateless Widgets. In this post, we going to explain basic behavior of the Flutter widget and it's lifecycle.
Share:

Sunday, November 17, 2019

Flutter vs React Native - What’s best for cross plateform mobile Application.

Today, all the companies creating Android and iOS platforms application to reach maximum end users. To create a native Android and iOS app, they have to maintain two source code that creates a gap between the applications as they are made by different teams. To resolve this, they have to move on the cross-platform apps that have a lot of pros and cons:


                                       
Share:

Sunday, October 6, 2019

Flutter - Don’t use ‘/’ to prefix with navigation routes

A mobile apps usually have multiple screens or pages. The end-user is presented one screen at a time. The Flutter framework provides us page navigation and routes to manage multiple screens.

We have published a post to manage multiple screens in Flutter application.  Flutter- Screen push and pop with Navigator. You can learn complete guidelines to manage routes, push and pop methods of  Flutter Framework.

flutter route without slashes The Flutter frameworks can help you to understand page navigation and manage conditional logic to determine which page to show first for things such as login and onboarding. If you’re using the MaterialApp widget, then you typically set the initialRoute property to specify where you want the app to start as shown below:


Share:

Sunday, September 29, 2019

Flutter - Drop down menu list with example

The dropdown is a toggleable menu that shows all the available option when we click on it to choose one option from predefined options. 

flutter dropdown button and list demo
In Flutter, the dropdownbutton is a widget that we can use to select one value from a set of values. In the default state, a dropdownbutton shows its currently selected value. After clicking on the dropdownbutton it displays a drop-down menu with all other available values, from which the user can select a new one.
Share:

Wednesday, September 25, 2019

Flutter - Pros and Cons of using Flutter for Mobile App Development

Are you thinking to create a mobile app?. Are you confused when it comes to selecting the right framework for your app? We are aware of the huge impact of mobile apps surrounding us but still, the road to mobile app development is not as easy as it seems. It is not only about developing the mobile app but also satisfies the customers.

pros and cons of flutter

Share:

Sunday, August 25, 2019

Flutter - Playing local, network and youtube videos with video player plugin.

If you're creating an application that supports videos feature then you have to use a video player. The Flutter team have created a Video Player widget to display a video in Flutter application.

flutter video player example
The Video Player widget can play multiple types of videos that may be stored in the mobile, as an asset, and from the internet. This plugin allows flutter to interface with the platform's native video players. In iOS, the video player widget uses AVPlayer to handle playback and it does not work on iOS simulators. So, you have to test videos on real iOS devices. In Android, the video player widget uses ExoPlayer to play a video. 

Share:

Sunday, August 4, 2019

Flutter - Draw custom shaps with clip path.

As we know, Flutter is a Mobile UI framework by Google which allows developers to create beautiful apps for both iOS and Android with a single codebase. 

flutter clip path exampleApart from inbuilt widgets that is Flutter framework provides us, we can draw a custom shape that is called Clipping. In a Flutter application, we use clipping to create awesome looking, custom user interfaces with special effects. A widget that clips its child using a path and calling a callback on a delegate whenever the widget is to be painted. The callback returns a path and the widget prevents the child from painting outside the path.


Share:

Saturday, July 27, 2019

Android - Configuring SonarQube with Android Studio project.

CI/CD (Continuous Integration/Continuous Deployment) is the backbone of the organizations to build a good quality products. The CI/CD bridges the gap between development and operations teams by automating build, test, and deployment of applications. It helps the development team to find code smells in the projects.

sonar qube installation in Android Studio project
Code smells are bugs in your code that produce the performance issue of the Application. We can find this smell with the help of the various tool. The tool can help you define custom rules, in addition to the common code smell patterns, externalize these rules and have the flexibility to apply them to the code at the project level, department level and at the enterprise level.  

The SonarQube is an open-source service that can scan code in 25+ languages and generates reports of smells, vulnerabilities, and bugs. It provides a beautiful dashboard scanning data where we can analyze our code quality. SonarQube is a big step toward automating development operations as it enables continuous code inspection that will improve code quality and ensures clean code.  It can easily be integrated right into the CI/CD process, which will enable continuous inspection of code for bugs, vulnerabilities, and smells, and can be extended. SonarQube can also be extended by using plugins. For example, we can use the CodeAnalyzer plugin to measure cyclomatic complexity.
Share:

Sunday, July 21, 2019

Flutter - Web view widget and progress bar.

WebView in a mobile application allows us to integrate a web page as a part of the app. It comes with all the features for managing history, cookies, HTML5 support and lot more. 

flutter web view url loading example with progress bar
Using webview, you can build very cool apps like integrating HTML5 games, show text, audio, video, animation and more in the mobile app. The web page can be loaded from the same application by using a url address. It is the responsibility of a web browser to interpret text and commands that contained in the web page.
Share:

Get it on Google Play

React Native - Start Development with Typescript

React Native is a popular framework for building mobile apps for both Android and iOS. It allows developers to write JavaScript code that ca...