A Flutter is a development framework/Kit, created by Google and its team. By using flutter as an app development kit you can develop applications for Android, iOS and Web that too from a single codebase (Code once and build installation setup for the various platforms).
Flutter Dart is an Object-Oriented Programming system concept (oops), which helps in the compilation of code to native code with no additional bridge. Thus it also helps in accelerating the start-up time of an application to a great extent.
Here are some points why flutter app development is trending in 2021
It has a high-performance flutter rendering engine. They are pretty fast in loading widgets and customizable.
Due to awesome Widget speed in loading UI, Flutter provides you smooth and easy-to-use feel.
Same Business logic and UI design in all Platforms.
Flutter reduce code development time/ faster code development
The Flutter has its own rendering engine (Google’s Skia).
Flutter works almost on any platform.
Why Flutter Mobile App Development? – Pros of Flutter
Google-like company is a flutter backbone.
The main reason why flutter is trending rapidly in 2021 because flutter is been introduced by google, Google Flutter SDK that helps you in building a native application that works for mobile, Web, and also Desktop that too with the help of a single code
Customized Design & Impressive UI Design.
Flutter existing widgets can easily be customized & designed as per your Page UI Design. Flutter app developers can build super awesome app IU with less effort.
Super Productive
As you know that Flutter comes with the best Feature that is Hot Reload Due to its stateFul development tools. Flutter allows for a very fast iterative coding style.
Perfect for Minimum Viable Product (MVP).
Flutter dart framework that supplies MVP plan that requires limited time such as the project costing will be mininum.
Save lots of time.
As Flutter is a cross platform development framework, code one and distrubute app in several platform, this will save lots of time compaired to native application development.
Hot Reload feature of Flutter a functionality for instantaneous updates on any change in UI or Dart code, Furthermore. the Hot reload option in flutter allows developer to test the UI loading quickly.
Ready to use the widget.
it has a number of “ready to use” widgets in which most of the widgets help in material design UI concepts.
Community Support & Documentation
The Flutter Community Support is bit small as commpared to react or Ionic application. But Flutter Support is growing very fast now a days.
What is the future scope of Flutter?
I guess that the future scope is to become a successful cross-platform environment flutter for building great mobile apps for iOS, Android.
however, the Flutter community is quite energetic and new packages are added every day to Dart Package and I expect the frequency to grow loads when Flutter 1.0 will be released in all likelihood inside the no longer too far destiny.
Hi, Guys Welcome to Proto Coders Point, In this android studio tutorial article we will build a material component i.e custom bottom navigation bar android.
Bottom Navigation bar is a material component that help user to switch between screen or pages.
Here is how our final BottomNavigationView looks
custom bottom navigation bar with fab button.
Video Tutorial on Custom Navigation Bar android
So now let’s begin Implementing the same.
Custom Bottom Navigation Bar android with Fab Button at center
Step 1: Create a new Android Project
Ofcourse you need to create a new Android Project or Open your existing Android Project where you want to add Bottom Navigation View.
In your Android Studio IDE go to, File > New > New Project ( a window will open select Empty Activity Next) > Give a name & package to your Android application & Finish (Android project will get created).
In your Android IDE Project section look for Gradle Script> build.gradle (app level) open it and add below 3 dependencies under the dependencies section if they don’t exist.
A Dropdown in Flutter helps app user to select an item from a drop-down menu item. This widget will show the selected item on drop-down button and icon to indicate user it has a list of item to select.
A Flutter Drop Down Button is a generic type flutter widget which means you can pass any datatype as per your requirement, In flutter drop down menu list item string are been used most of the time.
Create a list of items to show them in Drop down spinner in flutter
Snippet Code
The Flutter DropDownButton contain several properties that you can use to create a customized dropdown list.
Here i above snippet code screenshot, i am using only 4 properties
value: A selected value from the drop-down will be shown in the drop-down button.
icon: to show a drop icon next to the button.
onChanged: when the user selects an option from the drop-down, the value on dropdownbutton changed.
items: where you need to pass your list of items that you want to show in DropDownMenuItem.
Then, I have used a map function that simply iterates to a list of items (items – Array list), so the map function in the first iteration will set item[0] to the drop-down, then in the second iteration, the second item will be set and so on up to the end of the array string.
android floating action button animation menu example
Hi Guys, Welcome to Proto Coders Point, In this Android Tutorial Article, we will learn How to Implement the Floating action button with an animation pop-up menu example.
What is Floating Action Button ?
The floating action button is a speical and different as compared to normal button. They are in circle or round button in android that will be floating above the UI. This Floating Button is known as primary action used by users to perform main task.
For Example: Using Floating Button a user can perform action like adding a new item to an existing list.
So in this article, we will learn how to implement Floating Action Button in android with menu pop-up animation example.
NOTE: we are going to implement this project using kotlin android language.
then let’s begin with the tutorial.
Steps for Creating Extended Floating Action Button with Animation
Step 1: Create new Project
Just Create a new Android Project in your android studio IDE
Step 2: check for material design dependencies
If you are using latest version of android studio IDE (4.1.1) then material design dependencies will automatically been added in your project while creating new project. To check that, open build.gradle(Module:app) under dependencies section check if material dependencies is there if not then add it.
// material design
implementation 'com.google.android.material:material:1.3.0'
After adding any new dependencies, a button/text “Sync Now” will appear on the top right corner of your android Studio IDE just click on it.
Make user you are connected to Internet before hiting Sync Now button. It will download all the files of the depencencies into your project.
We need Material dependencies because FloatingActionButton library exist in it.
Step 3 : Create Vector Images Icon
Now In Drawable folder create some vector Icon Image, to display icons on fab buttons.
To create new vector images in the project right-click on the drawable folder -> New -> Vector Asset.
A new pop window will be opened and choose any vector you want by clicking on the Clip Art button.
Please refer below images.
click on clip art to select vector image icons.
Step 4: Create fab animation files
Here is How my animation xml file structure looks.
So as you can see in above screenshot, you need to create 4 animation files.
firstly under res folder create Android Resource directory(anim), res(right click) > New > Android Resource Directory > a dialog open’s under resource type select anim.
Then, anim directory is been created, now under anim folder create 4 android resource files.
res > anim(right click) > New > Animation Resources File
Kindly refer the comment in below xml code for easy understanding
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!--This is a parent Floating Action Button-->
<!-- When this FAB Button is been pressed/clicked the following two button will get pop-up with animation -->
<!-- the Functionality is been done in MainActivity.java file -->
<!-- The other two FAB button is been set to InVisible so when user click on this button those 2 will get visible-->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginBottom="24dp"
android:clickable="true"
android:focusable="true"
android:tint="@android:color/white"
android:backgroundTint="#0038FF"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/ic_android"
tools:ignore="VectorDrawableCompat" />
<!--This act a child Floating Action Button-->
<!-- The visibility is been set to INVISIBLE -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/edit_f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:clickable="true"
android:visibility="invisible"
android:focusable="true"
android:tint="@color/white"
app:layout_constraintBottom_toTopOf="@+id/add_f"
app:layout_constraintEnd_toEndOf="@+id/add_f"
app:srcCompat="@drawable/ic_edit_24" />
<!--This act a child Floating Action Button-->
<!-- The visibility is been set to INVISIBLE -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/setting_f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:clickable="true"
android:focusable="true"
android:visibility="invisible"
android:tint="@color/white"
app:layout_constraintBottom_toTopOf="@+id/edit_f"
app:layout_constraintEnd_toEndOf="@+id/edit_f"
app:srcCompat="@drawable/ic_settings_24" />
</androidx.constraintlayout.widget.ConstraintLayout>
In you want to change floating action button color then you can user
android:backgroundTint="@color/white"
and you easily change floating action button icon size then use
app:maxImageSize="45dp"
Step 6: Handling Floating Action Button Animation in MainActivity.java
package com.example.expandablefloatingactionbutton
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.view.animation.Animation
import android.view.animation.AnimationUtils
import android.widget.Toast
import com.example.expandablefloatingactionbutton.R
import com.google.android.material.floatingactionbutton.FloatingActionButton
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
// creating variable that handles Animations loading
// and initializing it with animation files that we have created
private val rotateOpen : Animation by lazy { AnimationUtils.loadAnimation(this,R.anim.rotate_open_anim) }
private val rotateClose : Animation by lazy { AnimationUtils.loadAnimation(this,R.anim.rotate_close_anim) }
private val fromBottom: Animation by lazy { AnimationUtils.loadAnimation(this,R.anim.from_bottom_anim) }
private val toBottom : Animation by lazy { AnimationUtils.loadAnimation(this,R.anim.to_bottom_anim) }
//used to check if fab menu are opened or closed
private var closed = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//add fab button
add_f.setOnClickListener {
OnAddButtonClick()
}
//edit fab button on click
edit_f.setOnClickListener {
Toast.makeText(this,"Edit",Toast.LENGTH_SHORT).show();
}
//setting fab button on click
setting_f.setOnClickListener {
Toast.makeText(this,"Search",Toast.LENGTH_SHORT).show();
}
}
private fun OnAddButtonClick() {
setVisibility(closed)
setAnimation(closed)
closed = !closed;
}
// A Function used to set the Animation effect
private fun setAnimation(closed:Boolean) {
if(!closed){
edit_f.startAnimation(fromBottom)
setting_f.startAnimation(fromBottom)
add_f.startAnimation(rotateOpen)
}else{
edit_f.startAnimation(toBottom)
setting_f.startAnimation(toBottom)
add_f.startAnimation(rotateClose)
}
}
// used to set visibility to VISIBLE / INVISIBLE
private fun setVisibility(closed:Boolean) {
if(!closed)
{
edit_f.visibility = View.VISIBLE
setting_f.visibility = View.VISIBLE
}else{
edit_f.visibility = View.INVISIBLE
setting_f.visibility = View.INVISIBLE
}
}
}
So you are here to know the best flutter package/plugins, That means you might be having a great and awesome cross-platform project idea in your mind using flutter? am I right? then you are in the right place to make research on the best plugins for a flutter app development.
Bro, Don’t miss this is simple yet easy-to-use and awesome flutter packages to include in your project that makes app development much faster and easier.
//Easy Navigation to Flutter Pages
Get.to(Page2());
// Display Snackbar messages
Get.snackbar("Hi", "message");
//Easy to display a dialog pop
Get.defaultDialog(title: "THIS IS DIALOG BOX USING FLUTTER GET X ",middleText: "GET x made Easy");
And much more Event is easily possible using Flutter GetX.
Using Equatable you can compare between objects, and thus save lots of time in writing boiler plate codes.
Equatable easily override == & hashcode with flutter equatable there is no need to generate code, you can keep your focus of writing amazing flutter application. To learn more visit official sire here
Snippet Code Flutter Equatable Example
import 'package:equatable/equatable.dart';
class Fruits extends Equatable{
final String FruitName;
Fruits(this.FruitName);
@override
// TODO: implement props
List<Object> get props => throw UnimplementedError();
}
// inside main or class
Fruits fruits1 = Fruits("Apple");
Fruits fruits2 = Fruits("Banana");
print(fruit1 == fruit2); //return false
Fruits fruits3=Fruits("Banana");
print(fruit1 == fruit2); //return true
This Flutter storage package will work the same as SHARED PREFERENCES but in a secured form, This flutter storage plugin will store data in a secured way with AES Encryption.
So, Once your flutter project is ready to be distributed publicly, then it’s time to add-on an awesome functionality, such as share, where your app user can easily share flutter app URL with his friends & family to download your awesome flutter application.
What is Flutter Share plugin?
The flutter share plugin is very useful when the user wants to share contents from the flutter app with any of his friends via the platform share dialog box.
This plugin is wraped with ACTION_VIEW INTENT as in android and UIActivityViewController as on iOS devices.
whenever the flutter app user wants to share any contents he can just click on the share button which simply pop-up a share dialog using which he/she can easily share contents.
snippet code flutter share
//on share button pressed
onPressed: () {
Share.share(
'check out my website https://protocoderspoint.com/');
},
Recyclerview user entered – array list send to database
Ok So let’s begin,
Database Setup
My database is hosted with my website hosting protocoderspoint.com, so in my hosting i have created a new database special for this tutorial.
Create a new table in your phpmyadmin database
How a look at database, it has a table by name : ‘ExpenseTable’ which has 3 column
id : type int auto Increment.
ExpenseName : type varchar(50).
ExpenseAmt : type varchar(50).
command to create table in your database
CREATE TABLE `ExpenseTable` (
`id` int(11) NOT NULL,
`ExpenseName` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`ExpenseAmt` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
So now we are done with create the database table now let’s go with php code that helps us in getting connected with database and store the array list data into the table.
Php code – connect database – storing array list to data table
Here are 2 php files/code
connect.php: Help us in getting connected with our database.
save_expense.php: Helps us in storing/inserting data into our database.
The connect.php is a common php code that help in getting connected with our database, I have created connect.php file separate so that in my other php code i can simply include connect.php code that’s it, whenever i hit or call other php code where connet.php is included it automatically get connected to out database.
Here the PHP code is receiving ArrayList in the form of JSON ARRAY, that is been decoded using the json_decode function.
After that we are using for loop to iterate the total number of data present in the array list using count($expname) this will return a number, for example, suppose your array is [‘0’, ‘1’, ‘2’, ‘3’] then count will return 4, so the for loop will run for 4 times. Then in for loop, we have a SQL query then will insert the data into our database using mysqli_query.
Ok so now we are done with our php script that will insert data into our database, now let’s go to android coding.
Android Coding –
Recyclerview EditText Entered data store in an array and send to database
android project structure
Have a look at my android project structure for easy understanding of the android tutorial on Recyclerview with editText Field.
So as we are making internet call to send data to our database, we need to specify which domain or IP we are using to send/receive data, so for that, you need to create a networksecurityconfig.xml file in res>xml>
create a directory “XML” inside res then create an XML resource file networksecurityconfig.xml under that directory and copy-paste the below code.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">protocoderspoint.com</domain> // Here replace with your domain/IP
</domain-config>
</network-security-config>
Then go to your AndroidManifest.xml and add the network SecurityConfig file under <application> tag