If you’re new to Flutter or a Pro we know how much of the Text Widget we use… Some large in size, some small, some bold and the list goes on. Having uniform text sizes and attributes across the app is very important for the UI/UX. So I just decided to share a small tip for new devs on who can they do it.
We’re are simply going to create a Text widget in our project that we can then call across our app.
Create a new file called text.dart
Usage
Now in any file of you project simply call AppText widget. e.g:
Share with us below on how you have been solving this problem. 🙂
Hope it helps.
Recently while working on a project, I was assigned a task to implement text recognition also called OCR(Optical Character Recognition). For this task I chose Firebase ML.
Firebase ML
Firebase ML provides us:
Text recognition
Image labeling
Object detection and tracking
Face detection and contour tracing
Barcode scanning
Language identification
Translation
Smart Reply
For more info:
https://firebase.google.com/docs/ml
Text recognition
In this tutorial we’ll be doing a very basic implementaion of Text Recognition.
Importing Package
In pubspec.yaml import Image Picker and ML Vision packages. pubspec will then look something like this:
In this article, we’ll set up our Flutter App with basic Firebase Configuration.
Create Firebase Account
1- Browse https://firebase.google.com and click ‘Go To Console’ after you’ve signed in.
2- Click Add Project.
3- Name your Project and click next.
4- Enable Google analytics in the next step if you want and then continue.
5- Create or select an Analytics account and create your project.
Android Firebase Setup
1- In your Project Overview screen add an Android App.
2- Register your App’s package name e.g com.solobits.firebase_app, Enter your App’s name, Signing Certificate is optional but if you need to add it follow this URL https://developers.google.com/android/guides/client-auth, Once done click Register App.
3- Download the google-services.json file and paste it in your project/android/app directory. When done, click next.
4- Paste the code in you app-level gradle and project-level gradle as defined in the step.
5- Done!! You can skip the last step.
For in-depth article visit: https://firebase.google.com/docs/flutter/setup?platform=android
iOS Firebase Setup
For iOS setup, you need to have XCode on your Mac.
1- In your Project Overview screen add an iOS App.
2- Register your App’s package name e.g com.solobits.firebaseapp, Enter your App’s name, App Store ID is optional for now, Once done click Register App.
3- Download the GoogleService-Info.plist file. Now using XCode and paste it in your Runner/Runner directory.
4- Done!! You can skip the last step.
For in-depth article visit: https://firebase.google.com/docs/flutter/setup?platform=ios
Routing in Flutter can be easy for small apps, but when you have quite a few pages you know that you need to manage them properly. Flutter gives you quite a few ways to do that, you might be doing it by using named routes or a package like auto_route. For this article, we’ll be using GET.
GET, Router
GET is not just a simple Routing solution but a Micro-Framework for Flutter. It has quite a lot that we can do with it like Dependency Management, State Management, Utils/Helpers and more.
Routing
We’ll start by creating a new Flutter project.
Importing Package
In pubspec.yaml import GET package. pubspec will then look something like this:
Base Setup
In your main.dart rename MaterialApp to GetMaterialApp.
Create a routes.dart file
Now simply call Get.toNamed to navigate to a page or Get.offNamed to push to new page and replace current page.
The following article assumes you are already aware of State Management Basics. We’ll be using a package called GET for this article.
If you want to learn about the basics follow the official Flutter documentation which explains State Management very good: https://flutter.dev/docs/development/data-and-backend/state-mgmt
GET, Juiced State Manager
We do have multiple options to achieve this namingly InheritedWidgets, ScopedModel, Provider, Bloc, MobX etc. But we’ll be using GET which is not just a simple State Management solution but a Micro-Framework for Flutter. It has quite a lot that we can do with it like Dependency Management, Router, Utils/Helpers and more.
So basically GET is on Steroids. We’ll start by talking about how it can help us manage our state.
State Management
We’ll start by creating a new Flutter project. We’ll use the default counter app and modify it using GET.
Importing Package
In pubspec.yaml import GET package. pubspec will then look something like this:
Base Setup
In your main.dart rename MaterialApp to GetMaterialApp.
Create your ViewModel/Controller
Our ViewModel will have our business logic. Create getters and setters for the counter variable.
Wrap the widget you want to update in GetBuilder
To trigger an increment we’ll do something like this
Run your app and Voila!. That’s all you need.
Upcoming Articles
I’ll be writing a list of Articles that will cover almost everything that we can do with GET namingly:
Dependency Management
Router
Other Fun Helpers/Utilities (SnackBars, Dialog, BottomSheet etc)