Hi Guys Welcome to Proto Coders Point, This project is a Beginner starting point for a Flutter application, Here we will see how can we implement webview in flutter web app development using webview plugin.
Demo on Flutter Webview
Video Tutorial – Convert Website to app
Introduction on Flutter WebView
Presenting a web view is pretty common in mobile apps. In Flutter, this is done by using the webview_flutter package.
Use this package Webview_Flutter as a library
If you want to use flutter webview widget you need to add some dependencies
Add this to your package’s pubspec.yamlfile:
dependencies:
webview_flutter: ^0.3.15+1
Then make sure with this indentation, sight empty space in pubspec.yaml file might give you error.
Import flutter webview widget package
Now in your Dart code (main.dart), you need to import widget packages, so that you can use flutter webview in you class file.
Let’s start implementing webview in your flutter application.
Create a new Flutter project in android studio.
creating-new-flutter-project-in-android-studio
Give a name to your flutter application. in my case i have name it as flutter_webview. you can name it anything it left to you.
So our flutter project is build and ready to implement our flutter code.
But then are flutter default code added into our flutter dart code. you can delete all the code from main.dart class and copy paste the code i provide you below.
First, the key parameter allows the Flutter widget tree to refer to this widget easily using a unique key created via Flutter’s UniqueKey() method you’ll soon see in the full example below.
javascriptMode simply allows us to control what kind of Javascript can be run in our web view.
Finally, initialUrl is the URL we want to display.
The important gotcha here is that we’ll need to use a StatefulWidget because it appears that if we use a StatelessWidget, the WebView will not load properly.
We pass in a url parameter to this widget, which is used in the state of our StatefulWidget.
In the app bar I have used 2 icons that will function as a back and forword button when we navigate to some other url in out webview onWebView controller will take care of this process.
Here there is also a reload button i.e floatingActionButton that will reload the initial url of the application.
Check Out Here’s How To Get Instagram Dark Mode Android Which makes Easier for Eye At Night
Facebook has followed the latest trend which is to introduce the Dark mode theme on Instagram too. Users with iOS and Android devices who are been using Instagram so far with normal instagram theme will now be able to experience the Dark mode of instagram. But as an update in official instagram, The feature may not be available to all users right away since it is being rolled out in phases.
Instagram automatically syncs your device and change it to the dark mode. The dark mode on Instagram will work only on iOS 13 and Android 10 devices. So before you go for it make sure that you have downloaded the latest version of Instagram.
How to put instagram dark mode android on Android phones
This is not a complicated process, but it may be a while until your Android phone has this feature. Why? Well, you need to have Android 10, the latest Android OS, to access Dark Mode on your phone.
Check if you already have Android 10 or if you can upgrade to it. To see if there is an upgrade available, go to Settings > System > System Update.
Once you’ve updated to Android 10, turn on your Dark Mode by going to Settings > Display > Dark Theme.
You can also turn on Dark Mode via Battery Saving Mode by going to Settings > Battery > Battery Saver. The two are connected now, as Dark Mode saves battery life, so if you switch on Battery Saver, you’ll automatically go to Dark Mode.
Open the Instagram app.
Dark Mode will be active in your Instagram app when you have it turned on in your phone settings, and you’ll be able to scroll with it until you turn of Dark Mode on your phone.
How to Get instagram dark mode on IOS Devices
Instagram automatically syncs your device and change it to the dark mode. The dark mode on Instagram will work only on iOS 13 and Android 10 devices. So before you go for it make sure that you have downloaded the latest version of Instagram.
iPhone iOS 13
Make Sure you iphone device is Updated the latest version of iOS 13.
Open the setting app on your device. Settings
Scroll down to the display and brightness option. Display & Brightness
There you will see the option of light mode and dark mode
Click on the dark mode option
Your iPhone will turn into the dark mode.
You can also click on the automatic option. The automatic option will automatically change the mode during daytime and night time.
Now you can enjoy the darkness!
Steps to change Iphone Instagram theme to dark mode.
Step 1 : Open Settings.
ios 13 setting screenshot
Step 2 : Go to Display & brightness
IOS dark mode theme Display and brightness
Step 3 : change as you need light mode or dark mode and per your requirement.
Flutter ListView
Long List
Memory Efficient
Dynamically
This Flutter Dart tutorial, Learn How to build an application with memory efficient Listview in dart by using ListView.Builder constructor. And dynamically inflate ListTile as the List element.
Steps to implement Flutter listview long list with memory efficient
1. Prepare a data source.
You need to prepare a data source which you want to inflate in each of the list item within your listview.
2. Convert data source into Widgets.
Then you need to convert the data source you have created or fetched from some out source into Widget because in the end, the flutter listview expects the array of widgets.
3. Use widgets as a children of a listview.
Finally you have to use all the widget as a children of the listview.
So let us follow the above steps & implement flutter listview dynamically.
1. Preparing a data source for flutter listview
Snippet code
List<String> getListElements() {
var items = List<String>.generate(1000, (counter) => "Item $counter"); // generate iten from 0 to 999
return items;
}
The above snippet code will simple generate list of items, which will be 1000 in number
Eg: item 0, item item 1 ,item 2,…………..item 999.
2. Converting data source into widget
Once your data source is ready you need to wrap it into your widget, so that i will define a method that will return the list view.
Where will genetare a listview, here is am using a constructor callede listview.builder,here one of the parameter of this builder constructor is a itemBuilder. Which helps us in creating items in our listview,here we have 2 parameter(context,index).
Right now i want all of the item to be inListTile,
There we are customizing title we are fetching from data source we have created above in steps 1.
Our Application has lots of Items to be displayed on the device screen but still out app is memory efficient just because Listview.builder function simply calls onlt for those elements that can be visible on the screen Therefore element which are hiding behind the screen are not been loaded into the memory thus it is memory efficient.
if you need to add further customize your listitems by using lending attribute like Icons,it is totally up to your wish what extra customization you want to make to your Flutter ListView application.
In this flutter tutorial we will implement flutter listview widget that simply displays list of items in a form of listview.
Also we will explore basic feature of flutter list view like onTap anonymous Event handler, add some of basic properties like leading icon, title to listview, subtitle.
Here is demo of how final listview will look
Flutter ListView Tutorial
Application final UI Demo
flutter listview UI Design
How to Create a Flutter listview?
Dart is the programming language used to code Flutter apps. Dart is another product by Google. So
main class function
snippet code
void main() {
runApp(MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Flutter List View Tutorial"), // title of appbar
),
body: getListView(), //list widget function is been called
),
));
}
Here we have used scaffold widget because all the content should be visible inside the device screen size i.e if we don’t use Scaffold you may get error “ListTile widget require a Material widget ancestor” some think like below screenshot
Error: ListTile widget require a Material widget ancestor
Inside Scaffold we have AppBar widget that show a app bar at the top of device screen with some Title to it.
and a body of Application which calls a function getListView(); that display listview in the body tag.
ListView is the most commonly used scrolling widget. It displays its children one after another in the scroll direction. In the cross axis, the children are required to fill the ListView.
ListTile contains one to three lines of widget, such as checked box, leading icons and trailing icons, Title with is main text of listviews, subtitle which is basically a meta derscription of title.
Full Source Code of Flutter listview UI Design
main.dart
Final Full Source : Copy paste this code into main.dart file of your flutter project, and you are done the app will run successfully
Adding Image Steps Resources Images ID in java or Kotlin file
Java Code to implement Image steps library
ImageSteps imageSteps = (ImageSteps)findViewById(R.id.imageSteps); // for identifing image steps ID
imageSteps.setScaleUp(4.0f); // setting size if active image steps
imageSteps.setAnimationDuration(1000); // animitation Duration to show image steps images
imageSteps.setSteps(R.drawable.image_one,R.drawable.image_two,R.drawable.image_three); // setting images from drawable
In this above lines of codes we are initialsing image steps by using FindViewById.
setScaleUp() is used to set the size of active image.
setAnimationDuration() is used just to show some animation effect for 1 sec, Here 1000 = 1 sec.
setSteps() is used to set a images for each steps of images, here the number of resources images you will add will be total numbers of steps been added.
OR
Kotlin Code to implement the same as above
imageSteps.setSteps(R.drawable.ic_welcome,R.drawable.icon_users,R.drawable.ic_check)
imageSteps.scaleUp = 2.0f
imageSteps.animationDuration = 500
previous.setOnClickListener { imageSteps.previous() } // button click to change next image steps.
next.setOnClickListener { imageSteps.next() } // button click to change image to previous one.
Android Studio Application - Send SMS using text local an SMS GATEWAY
Hi, Guys Welcome to Proto Coders Point.
This Article will learn how to develop an android application that can send SMS or bulk SMS to mobiles number.
In this Aritcle, we are going to make use https://textlocal.in/ to send SMS from our android app.
What is Textlocal?
India’s No. 1 Bulk SMS Platform Increase sales and customer satisfaction with smarter SMS campaigns, instant OTPs, notifications, two-way interactions & other award-winning bulk SMS services. this SMS sender android application can we used to send promotional SMS, bill SMS, and much more SMS services in India.
What is SMS GATEWAY Services ?
An SMS Gateway enables a computer to send and receive SMS text messages to and from a SMS capable device over the global telecomunications network (normally to a mobile phone).
The SMS Gateway translates the message sent, and makes it compatible for delivery over the network to be able to reach the recipient.
Android App development to send SMS using text local an SMS GATEWAY || with source code
Android studio send sms to mobile number implementation video.
Developing an android application to send message to mobile number
So let’s begin implementation of android application development with TEXTLOCAL SMS GATEWAY SERVICES API.
Step by Step integration of android codes.
Textlocal Account
Creating a account in TextLocal.in
Creating and getting a SMS API key in textlocal.
Android implementation Codes
Creating a New Android Studio Project.
Design a layout in main_activity.xml.
writing java code in Main_Activity.java class.
Creating a account in TextLocal.in
To be able to send sms through textlocal.in SMS Gateway services you need to create an account under textlocal.in
Creating an account in textlocaldashboard of textlocal a sms gateway
Creating and getting a SMS API key in textlocal.
When you are in textlocal dashboard navigate Towards – > Settings -> API KEY.
Create a new SMS API key
creating a new SMS API KEY
You need to keep a note of the SMS API KEY you have generated just now, so that you can easily copy cost the sms api key in android studio project.
All set in textlocal website, we have now successfully created a account under textlocal and generated a API key.
Android Studio Implementation of SMS GATEWAY SERVICES
Complete project Source code is been listed down below, so that you can download the SMS sending project.
Now Let is begin implementation the source code in android studio.
Creating a SMS sending project in android studio.
File -> New -> New Project ->select a empty activity
EditText1 is with ID number and EditText2 is with ID msg, that holds respectively mobile number and sms message to be sent.
Button is with ID Submit that fetch text from editext and send data to SMS gateway through SMS API key,
Writing java code in Main_Activity.java class
Main_Activity.java
package protocoderspoint.com.smsapi;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
Button submit;
EditText number,msg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
submit=(Button)findViewById(R.id.submit);
number=(EditText)findViewById(R.id.number);
msg=(EditText)findViewById(R.id.msg);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String phono = number.getText().toString();
String msgtext = msg.getText().toString();
try {
// Construct data
String apiKey = "apikey=" + "Replace with your API KEY";
String message = "&message=" + msgtext;
String sender = "&sender=" + "TXTLCL";
String numbers = "&numbers=" + phono;
// Send data
HttpURLConnection conn = (HttpURLConnection) new URL("https://api.textlocal.in/send/?").openConnection();
String data = apiKey + numbers + message + sender;
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Length", Integer.toString(data.length()));
conn.getOutputStream().write(data.getBytes("UTF-8"));
final BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
final StringBuffer stringBuffer = new StringBuffer();
String line;
while ((line = rd.readLine()) != null) {
stringBuffer.append(line);
Toast.makeText(MainActivity.this,line,Toast.LENGTH_LONG).show();
}
rd.close();
} catch (Exception e) {
System.out.println("Error SMS "+e);
}
}
});
StrictMode.ThreadPolicy st = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(st);
}
}
In the above java class code we have four parameter that should be passed to textlocal gateway service.
SMS API KEY.
MESSAGE ( Fetched from EditText box ).
SENDER ( It should be ‘TXTLCL’).
Numbers ( Fetched from EditText box ).
Numbers can be seperated with commas (,) Eg: 875877XXX,548848xxx,66652xxx4454. So that we can send bulk sms at a time.
Conclusion :
In this Article, we have developled an android application that is capable to send bulk sms with some message like promotional sms, bill sms or any kind of message to your customer using SMS gateway service by Textlocal.