Why Flutter Is the Best Platform to Make Hybrid Apps?

If you’re looking to make a hybrid app, chances are your typical choices lead to devs building apps from scratch that can be pretty costly. If you want to build multiple views of an application, share code with other teams and start gaining traction sooner, then Flutter is the platform for you.

This blog post will cover why Flutter is the best platform to make a hybrid app and give some examples of where you might use it. It’ll explore how it can be integrated into iOS and Android codebases easily, allowing for quick prototyping exercises with low overhead costs than comparable alternatives.

The easiest way to learn a new technology is through example, so this article will be broken into several different use cases.

A few important things you should know before we get started: Flutter is an SDK that runs on top of both the iOS and Android platforms. Flutter has its own UI widgets that can be created using the framework, but it’s not limited to just those and can mix with existing platform SDKs. Finally, Dart is the programming language used to build Flutter apps.

Now that we’ve covered what we’ll be building and what tools are at our disposal, let’s dive into an example of how Flutter works.

The Scenario

This example will be based on the “Cleaner” application that was released last year. I’m sure you all remember this one. It’s an app that helps you keep track of transactions for your credit cards by getting things organized and reducing the clutter of old receipts. It’s a good fit for Flutter due to its simplicity and relative ease to build with a view to reuse code later on. The app has two main sections: a “List of Cards” which shows all the cards, and “Overview” which shows you a summary of all your transactions. Our goal is to build the two sections in separate views, but with sharing code across them so that both are easier to manage and collaborate on.

The Scenario Checklist

We need to be able to add, edit and remove cards in one view. We need a view for each section in the app. There are some views that we would like to re-use, hence the sharing code – there’s only one top overlay that goes across both sections, with a “Done” button on hover state for when all cards have been added. The app has fairly simple navigation logic where you can scroll between the two sections. Nothing too fancy (e.g., page transition animations) since we’re building it on Flutter so performance is always a factor. The app should have some nice animations or transitions. This one is a bit tricky because both views also need to be able to scale based on your device’s display size, give the different sections different sizes and avoid jagged edges when resizing between screens.

The first thing we’re going to do is create a new Flutter project with no code or dependencies installed. This will save us the headache of having to add them later on, and it’ll allow us to focus all of our attention on the code for our iOS app while working in Flutter.

Once you’ve created your project, import the following three packages. This will help us add our shared code easily:

import ‘package:flutter/material.dart’; import ‘package:flutter/widgets.dart’; import ‘package:jquery_ui/jquery.ui.widget.js’;

With all of this done, we can move onto the iOS side of things and build our view for adding, editing and removing cards from the “List of Cards” section in our app. We need to have a radial button that will let us toggle between “Add” and “Edit” states for a card, so we’ll make one with these two states in it as well as an image to represent the card being added to the list.

We’re also going to make a table view controller that will hold our list of cards for this section, and a layout manager that will help us add the card button to it. We’ll also make our top overlay view in code so we can use it across both sections.

import UIKit import Flutter import MaterialApp class ViewController: UIViewController { @IBOutlet var tableView: UITableView! override func loadView() { let radialButton = RadialButton(frame: CGRect(x: 150, y: 150, width: 120, height: 40), child: Image(named: “card_add”), style: .rounded) radialButton.backgroundColor = UIColor.clear radialButton.layer.cornerRadius = 80.0 radialButton.layer.masksToBounds = true addCardButtonLayout(radialButton) let addCell = UITableViewCell() addCell?.textLabel?.text = “Add” addCell?.imageView?.image = UIImage(named: “card”) tableView?.register(UITableViewCell(), forCellReuseIdentifier: “addCardTableView”) } func addCardButtonLayout(_ button: RadialButton) { button ? .setBackgroundColorUIColor(UIColor(white: 0, alpha: 0)) .

Leave a comment

Your email address will not be published. Required fields are marked *