Google search engine
Home Blog Page 54

Serialization Of Objects In Flutter

0

Almost every mobile application in the market today has a feature to fetch data from the internet or store the user’s data in the mobile local storage. The data that we get from the internet from an API is not in a readable language or we can say that it can be understood by the application. The data thrown by the application is in JSON format so it is important to convert the JSON data. So we can display it to the users. JSON stands for JavaScript Object Notation.


Flutter uses dart:convert library to convert the JSON data. This library provides us decoder the encode and decode the JSON data.

To use these decoders we need to import it:

import 'dart:convert';

The data that we will receive in JSON format will be in a sequential manner. It will contain similar data multiple times. So now we need to create an object to use it. To create an object we need to make or define its blueprint i.e. we need to create a model class.

Creating a Model class for an Object:

We have created a Fruit class model that contains id, title, imageUrl, quantity ,also define the constructor for the class.

class Fruit {
final int id;
final String title;
final String imageUrl;
final int quantity;
//constructor
Fruit(
this.id,
this.title,
this.imageUrl,
this.quantity,
);
}

This is the base model of the data that we are going the receive from our API in JSON format. So need to convert the JSON data with our Fruit.

class Fruit {
final int id;
final String title;
final String imageUrl;
final int quantity;

Fruit(
this.id,
this.title,
this.imageUrl,
this.quantity,
);

factory Fruit.fromJson(Map<String, dynamic> json) {
return Fruit(json['id'], json['name'], json['image_url'], json['quantity']);
}
Map<String, dynamic> toJson() => {
'id' : id,
'title' : title,
'imageUrl' : imageUrl,
'quantity' : quantity
};
}

What is dynamic?

It is a keyword that we use to get unknown data. The API data that we get is not typically defined that is why dynamic is used so that whatever the data type data we get we can convert it into its datatype only if the data is a string it will be of type int. It is used when no type is declared for data.

What is factory?

It returns an instance of a class. Dart provides factory keyword to label a default or named constructor. Then it becomes our responsibility to return an instance from this constructor. A factor constructor is generally used to control the instance creation.

  • fromJson method converts the JSON data and returns a Fruit object that contains the data that came in JSON data.
  • toJson method converts the data into JSON format.

Serialize and De-Serialize Data:

Let’s assume using fromJson we get a dummy Fruit object:

Fruit fruit = Fruit(1, "title", "imageUrl", 23);

Now to convert it into JSON data we use the jsonEnode() method or json.encode() .

String toJSONFruit = jsonEncode(fruit);

Decoding Fruit:

String fromJSONFruit = jsonDecode(fruit);

Converting the decoded Fruit to Fruit object:

Fruit deCodedFruit = new Fruit(
fromJSONFruit['id'],
fromJSONFruit['name'],
fromJSONFruit['image_url'],
fromJSONFruit['quantity']);

Multiple object Serialization:

final parsed = json.decode(jsonData).cast<Map<String, dynamic>>();
return parsed.map<Fruit>((json) => Fruit.fromMap(json)).toList();

parsed variable contains all the JSON data and using the map function we can map each Fruit JSON data to a Fruit object.

you can also use fromMap function to map the JSON data or you can directly map each data with Fruit attribute like deCodedFruit.

factory Fruit.fromMap(Map<String, dynamic> json) {
return Fruit(
json['number'], json['name'], json['image_url'], json['status']);
}

Complete example:

flutter-devs/rest_API_demo
A new Flutter application. This project is a starting point for a Flutter application. A few resources to get you…github.com

🌸🌼🌸 Thank you for reading. 🌸🌼🌸🌼


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences!.

Exploring CSV In Flutter

CSV stands for Comma-Separated Values . It is a text editable file that contains text separated by commas in a series of lines called rows. CSV is used in share market, data analytics, and data visualization. The main difference between excel and CSV files is the excel file can be used to perform various data operations and data visualization can be done inside the excel file effectively.

In this blog, we shall explore how to work with CSV files in flutter.


We shall learn how to :

  • Create CSV file
  • Add data in CSV file
  • Fetch CSV file from phone storage
  • Save CSV file in phone storage

Package used :

CSV | Dart Package
Specify (at least a major) version when adding this project as dependency. Whenever the API has incompatible changes…pub.dev

path_provider | Flutter Package
A Flutter plugin for finding commonly used locations on the filesystem. Supports iOS, Android, Linux, and macOS. Not all…pub.dev

file_picker | Flutter Package
A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering…pub.dev

random_string | Dart Package
Simple library for generating random ascii strings. While this package provides random Between for convenience, as the…pub.dev

  • csv package is used to convert List data to CSV and CSV data to List.
  • path_provider is used to access the mobile directories on the filesystem.
  • file_picker is used to pick files from mobile storage.
  • random_string is used to generate random text and numeric string.

Convert List of String to CSV :

data is a List of List of strings. Now we will convert this list to a CSV file using ListToCsvConverter() that provide the use convert() method to convert data to CSV data. Get the path of the app of the application directory and create a new custom path to store all our CSV files.

final String directory = (await getApplicationSupportDirectory()).path;
final path = "$directory/csv-${DateTime.now()}.csv";

To store all the CSV data inside a file, we need to create a file on the specified path. and then write CSV data using writeAsString method.

generateCsv() async {
List<List<String>> data = [
["No.", "Name", "Roll No."],
["1", randomAlpha(3), randomNumeric(3)],
["2", randomAlpha(3), randomNumeric(3)],
["3", randomAlpha(3), randomNumeric(3)]
];
String csvData = ListToCsvConverter().convert(data);
final String directory = (await getApplicationSupportDirectory()).path;
final path = "$directory/csv-${DateTime.now()}.csv";
print(path);
final File file = File(path);
await file.writeAsString(csvData);
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) {
return LoadCsvDataScreen(path: path);
},
),
);
}

After storing CSV file in phone storage navigate to LoadCsvDataScreen to display CSV data.

Getting CSV from storage :

FilePicker is used to pick files from the storage. FilePickerResult gives us all the files chosen by the user. allowedExtensions method allows only ‘csv’ extension files. Then we will store the file path in the path variable. Finally, navigate it to LoadCsvDataScreen.

loadCsvFromStorage() async {
FilePickerResult result = await FilePicker.platform.pickFiles(
allowedExtensions: ['csv'],
type: FileType.custom,
);
String path = result.files.first.path;
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) {
return LoadCsvDataScreen(path: path);
},
),
);
}

Fetching CSV file from the phone storage :

To fetch all the CSV files we need to get the directory path

final String directory = (await getApplicationSupportDirectory()).path;
final path = "$directory/";

After getting into the directory we need to sync all the entity with a list of FileSystemEntity .

Future<List<FileSystemEntity>> _getAllCsvFiles() async {
final String directory = (await getApplicationSupportDirectory()).path;
final path = "$directory/";
final myDir = Directory(path);
List<FileSystemEntity> _csvFiles;
_csvFiles = myDir.listSync(recursive: true, followLinks: false);
_csvFiles.sort((a, b) {
return b.path.compareTo(a.path);
});
return _csvFiles;
}

Displaying CSV file :

To display the CSV data we need to convert CSV into a List using CsvToListConverter .

Future<List<List<dynamic>>> loadingCsvData(String path) async {
final csvFile = new File(path).openRead();
return await csvFile
.transform(utf8.decoder)
.transform(
CsvToListConverter(),
)
.toList();
}

Create a new dart file called loadCsvDataScreen.dart inside the lib folder:

This contains a widget that we use to display the CSV data. To fetch the data from the CSV file we need a future builder because the data that we will receive from CSV will not be changed after it is fetched. loadingCsvData returns a Future<List<List<dynamic>>> , this method opens the CSV file and convert the CSV data to String using CsvToListConverter . The future snapshot data is then mapped with a Row that will display the data stored in CSV file in rows else it will display the CircularProgressIndicator.

import 'dart:convert';
import 'dart:io';

import 'package:csv/csv.dart';
import 'package:flutter/material.dart';

class LoadCsvDataScreen extends StatelessWidget {
final String path;

LoadCsvDataScreen({this.path});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("CSV DATA"),
),
body: FutureBuilder(
future: loadingCsvData(path),
builder: (context, AsyncSnapshot<List<dynamic>> snapshot) {
print(snapshot.data.toString());
return snapshot.hasData
? Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: snapshot.data
.map(
(data) => Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
data[0].toString(),
),
Text(
data[1].toString(),
), Text(
data[2].toString(),
),
],
),
),
)
.toList(),
),
)
: Center(
child: CircularProgressIndicator(),
);
},
),
);
}

Future<List<List<dynamic>>> loadingCsvData(String path) async {
final csvFile = new File(path).openRead();
return await csvFile
.transform(utf8.decoder)
.transform(
CsvToListConverter(),
)
.toList();
}
}

Create a new dart file called allCsv.dart inside the lib folder:

It contains a widget to fetch all the files. Here we are fetching all the CSV files from our phone storage to our app. The list of CSV files from the mobile will be of FileSystemEntity type _getAllCsvFiles will return us a list of all FileSystemEntity as a Future. A list of all the CSV files will be displayed on the screen and on tapping them it will navigate us to LoadCsvDataScreen .

import 'package:flutter/material.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'loadCsvDataScreen.dart';

class AllCsvFilesScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("All CSV Files")),
body: FutureBuilder(
future: _getAllCsvFiles(),
builder: (context, AsyncSnapshot<List<FileSystemEntity>> snapshot) {
if (!snapshot.hasData || snapshot.data.isEmpty) {
return Text("empty");
}
print('${snapshot.data.length} ${snapshot.data}');
if (snapshot.data.length == 0) {
return Center(
child: Text('No Csv File found.'),
);
}
return ListView.builder(
itemBuilder: (context, index) => Card(
child: ListTile(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) =>
LoadCsvDataScreen(path: snapshot.data[index].path),
),
);
},
title: Text(
snapshot.data[index].path.substring(44),
style: TextStyle(fontWeight: FontWeight.bold),
)),
),
itemCount: snapshot.data.length,
);
},
),
);
}

Future<List<FileSystemEntity>> _getAllCsvFiles() async {
final String directory = (await getApplicationSupportDirectory()).path;
final path = "$directory/";
final myDir = Directory(path);
List<FileSystemEntity> _csvFiles;
_csvFiles = myDir.listSync(recursive: true, followLinks: false);
_csvFiles.sort((a, b) {
return b.path.compareTo(a.path);
});
return _csvFiles;
}
}

main. dart:

In this file, we are generating and loading a CSV file from the phone storage.

import 'package:csv/csv.dart';
import 'package:flutter/material.dart';
import 'package:flutter_csv/allCsv.dart';
import 'package:flutter_csv/loadCsvDataScreen.dart';
import 'package:path_provider/path_provider.dart';
import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:random_string/random_string.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Csv Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Csv Demo'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
MaterialButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => AllCsvFilesScreen()));
},
color: Colors.cyanAccent,
child: Text("Load all csv form phone storage"),
),
MaterialButton(
onPressed: () {
loadCsvFromStorage();
},
color: Colors.cyanAccent,
child: Text("Load csv form phone storage"),
),
MaterialButton(
onPressed: () {
generateCsv();
},
color: Colors.cyanAccent,
child: Text("Load Created csv"),
),
],
),
),
);
}

generateCsv() async {
List<List<String>> data = [
["No.", "Name", "Roll No."],
["1", randomAlpha(3), randomNumeric(3)],
["2", randomAlpha(3), randomNumeric(3)],
["3", randomAlpha(3), randomNumeric(3)]
];
String csvData = ListToCsvConverter().convert(data);
final String directory = (await getApplicationSupportDirectory()).path;
final path = "$directory/csv-${DateTime.now()}.csv";
print(path);
final File file = File(path);
await file.writeAsString(csvData);
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) {
return LoadCsvDataScreen(path: path);
},
),
);
}

loadCsvFromStorage() async {
FilePickerResult result = await FilePicker.platform.pickFiles(
allowedExtensions: ['csv'],
type: FileType.custom,
);
String path = result.files.first.path;
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) {
return LoadCsvDataScreen(path: path);
},
),
);
}
}

Github Link :

flutter-devs/flutter_csv
A new Flutter application. This project is a starting point for a Flutter application. A few resources to get you…github.com


Demo Module :


Thanks for reading this article ❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.

If we got something wrong? Let me know in the comments. we would love to improve.

From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences!.

Animated Background In Flutter

0

Flutter is a portable UI toolkit. In other words, it’s a comprehensive app Software Development toolkit (SDK) that comes complete with widgets and tools. Flutter is a free and open-source tool to develop mobile, desktop, web applications. Flutter is a cross-platform development tool. This means that with the same code, we can create both ios and android apps. This is the best way to save time and resources in our entire process. In this, hot reload is gaining traction among mobile developers. Allows us to quickly see the changes implemented in the code with hot reload.

In this article, we will explore the Animated Background in flutter using the animated_background_package. With the help of the package, we can easily achieve flutter animated background. So let’s get started.

animated_background | Flutter Package
Animated Backgrounds for Flutter. Easily extended to paint whatever you want on the canvas. Note: These examples are…pub.dev


Table Of Contents :

Animated Background

Implementation

Code Implement

Code File

Conclusion


Animated Background :

Animated background is used for animations in the background. This package contains many types of animations. Users can use animations as per their requirement. In order to define the animations, we can use custom paint to create user customized designs.

Demo Module :

Implementation :

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies :

dependencies:   
animated_background: ^1.0.5

Step 2: Importing

import 'package:animated_background/animated_background.dart';

Step 3: Run flutter package get

Code Implementation :

Create a new dart file called home_page.dart inside the lib folder.

First of all, we have created a home page screen in which five buttons have been created and at the click of each button, a new page will open in which we have shown the swiper list in different ways. Let us understand this in detail.

Random Behavior:

In Random Behaviour we have set its RandomParticleBehaviour inside the animated background class, inside which particle options are custom-defined in the options property. Let us understand this through a reference.

AnimatedBackground(
behaviour: RandomParticleBehaviour(
options: particleOptions,
paint: particlePaint,
),
vsync: this,
child:Center(
child: Text('Random Behavior Background',style:TextStyle(fontSize:20,
fontWeight:FontWeight.w500,fontStyle:FontStyle.italic),),
),
),

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Buble Behavior:

In BubbleBehaviour we have set its behaviour bubble behaviour within the animated background class, in this, we have created a class named Bubal, in which its position radius and color is defined and the behaviour is custom made. Let us understand this through a reference.

AnimatedBackground(
behaviour: BubbleBehaviour(),
vsync: this,
child:Center(
child: Text('Bubble Behavior Background',style:TextStyle(fontSize:20,
fontWeight:FontWeight.w500,fontStyle:FontStyle.italic),),
),

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Rain Behavior:

In RainParticleBehavior, its particle option and particle paint which is custom made, in which its color speed count and its radius etc. have been defined.

AnimatedBackground(
behaviour:RainParticleBehaviour(
enabled:true,
options: particleOptions,
paint: particlePaint,
),
vsync: this,
child:Center(
child: Text('Rain Behavior Background',style:TextStyle(fontSize:20,
fontWeight:FontWeight.w500,fontStyle:FontStyle.italic),),
),
),

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Racing Behavior:

In RacingLinesBehaviour, the behaviour has placed its direction as left to right(ltr) and has given its line count 50 in numLines properties.

AnimatedBackground(
behaviour: RacingLinesBehaviour(
direction: _lineDirection,
numLines: _lineCount,
),
vsync: this,
child:Center(
child: Text('Racing Behavior Background',style:TextStyle(fontSize:20,
fontWeight:FontWeight.w500,fontStyle:FontStyle.italic),),
),
),

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Code File:

import 'package:animated_background_demo/route/route_names.dart';
import 'package:animated_background_demo/widget/custom_button.dart';
import 'package:flutter/material.dart';

class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
bool _value1 = true;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Animated Background Demo'),
centerTitle: true,
),
body: Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomButton(
mainButtonText: 'Random Behaivor',
callbackTertiary: () {
Navigator.of(context).pushNamed
(RouteName.RandomBehaviorScreen);
},
color: Colors.green[200],
),
SizedBox(
height: 10,
),
CustomButton(
mainButtonText: 'Bubble Behavior',
callbackTertiary: () {
Navigator.of(context).pushNamed
(RouteName.BubbleBehavior);
},
color: Colors.blue[200],
),
SizedBox(
height: 10,
),
CustomButton(
mainButtonText: 'Rain Behavior',
callbackTertiary: () {
Navigator.of(context).pushNamed
(RouteName.RainBehavior);
},
color: Colors.orange[200],
),
SizedBox(
height: 10,
),
CustomButton(
mainButtonText: 'Racing Behavior',
callbackTertiary: () {
Navigator.of(context).pushNamed
(RouteName.RacingBehavior);
},
color: Colors.teal[200],
),
SizedBox(
height: 10,
),
CustomButton(
mainButtonText: 'Space Behavior',
callbackTertiary: () {
Navigator.of(context).pushNamed
(RouteName.SpaceBehavior);
},
color: Colors.green[200],
),
],
),
),
);
}
}

Conclusion:

In this article, I have explained an Animated Background in a flutter, which you can modify and experiment with according to your own, this little introduction was from the Animated Background from our side.

I hope this blog will provide you with sufficient information in Trying up the Animated Background in your flutter project. We will show you the Animated Background is?, and work on it in your flutter applications, So please try it.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Feature Discovery In Flutter

Hello friends, I will talk about my new blog on Feature Discovery In Flutter. we will explore the Feature Discovery In flutter using the feature_discovery_package. With the help of the package, we can easily achieve the flutter feature discovery. So let’s get started.

feature_discovery | Flutter Package
This Flutter package implements Feature Discovery following the Material Design guidelines. With Feature Discovery, you…pub.dev


Table of Contents :

Flutter

Feature Discovery

Implementation

Code Implementation

Code File

Conclusion


Flutter :

“ Flutter is Google’s UI toolkit that helps you build beautiful and natively combined applications for mobile, web, and desktop in a single codebase in record time, Flutter offers great developer tools, with amazing hot reload”

Feature Discovery :

The Feature Discovery Package animated implements feature discovery following custom design guidelines, in this, we can use any widget within feature discovery, we use it to introduce the user to a feature about which they wouldn’t you know.

Demo Module :

Implementation :

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies :

dependencies:   
feature_discovery: ^0.13.0+2

Step 2: Importing

import 'package:feature_discovery/feature_discovery.dart';

Step 3: Run flutter package get

Code Implementation :

Create a new dart file called flutter__zoom_drawer_demo.dart inside the libfolder.

First of all, we have to wrap our widget tree in the feature discovery widget and inside it, we will add any class or material to the child widget.

FeatureDiscovery(
recordStepsInSharedPreferences: false,
child: FeatureDiscoveryDemoApp(),
),

Now we will implement FeatureDiscovery.discoverFeature inside the initState() method in which we will give the feature’s id so that the user taps the first feature then it will be sent to the next feature.

@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
FeatureDiscovery.discoverFeatures(context,
<String>[
'feature1',
'feature2',
'feature3',
'feature4',
]
);
});
super.initState();
}

Now we will discuss DescribedFeatureOverlay () widget. This widget takes all the parameters for an overlay displayed during feature search that will display the overlay as its child. This will pass a feature ID inside it which is of string type using the ID. So that we can know which feature is shown on this screen, we have defined feature1, first of all, we will see this feature.

DescribedFeatureOverlay(
featureId: 'feature1',
targetColor: Colors.white,
textColor: Colors.black,
backgroundColor: Colors.red.shade100,
contentLocation: ContentLocation.trivial,
title: Text(
'This is Button',
style: TextStyle(fontSize: 20.0),
),
pulseDuration: Duration(seconds: 1),
enablePulsingAnimation: true,
overflowMode: OverflowMode.extendBackground,
openDuration: Duration(seconds: 1),
description: Text('This is Button you can\n add more details heres'),
tapTarget: Icon(Icons.navigation),
child: BottomNavigationBar(items: [
BottomNavigationBarItem(title: Text('Home'), icon: Icon(Icons.home)),
BottomNavigationBarItem(
title: Text('Notification'),
icon: Icon(Icons.notifications_active)),
]),
),

When we run the application, we ought to get the screen’s output like the underneath screen capture.

In this screen, we have defined the featureId2 inside the DescribedFeatureOverlay() widget, in which it defines its title background color and description etc.

DescribedFeatureOverlay(
featureId: 'feature2',
targetColor: Colors.white,
textColor: Colors.white,
backgroundColor: Colors.blue,
contentLocation: ContentLocation.below,
title: Text(
'Menu Icon',
style: TextStyle(fontSize: 20.0),
),
pulseDuration: Duration(seconds: 1),
enablePulsingAnimation: true,
overflowMode: OverflowMode.clipContent,
openDuration: Duration(seconds: 1),
description: Text(
'This is Button you can add more details heres\n New Info here add more!'),
tapTarget: Icon(Icons.menu),

When we run the application, we ought to get the screen’s output like the underneath screen capture.

In this screen, we have defined the featureId3 inside the DescribedFeatureOverlay() widget, in which it defines its title background color and description etc.

DescribedFeatureOverlay(
featureId: 'feature3',
targetColor: Colors.white,
textColor: Colors.black,
backgroundColor: Colors.amber,
contentLocation: ContentLocation.trivial,
title: Text(
'More Icon',
style: TextStyle(fontSize: 20.0),
),
pulseDuration: Duration(seconds: 1),
enablePulsingAnimation: true,
barrierDismissible: false,
overflowMode: OverflowMode.wrapBackground,
openDuration: Duration(seconds: 1),
description: Text('This is Button you can add more details heres'),
tapTarget: Icon(Icons.search),
child: IconButton(icon: Icon(Icons.search), onPressed: () {}),
onOpen: () async {
return true;
},
),

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Code File:

import 'package:flutter/material.dart';
import 'package:feature_discovery/feature_discovery.dart';

class FeatureDiscoveryDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: FeatureDiscovery(
recordStepsInSharedPreferences: false,
child: FeatureDiscoveryDemoApp(),
),
);
}
}

class FeatureDiscoveryDemoApp extends StatefulWidget {
@override
_FeatureDiscoveryDemoAppState createState() =>
_FeatureDiscoveryDemoAppState();
}

class _FeatureDiscoveryDemoAppState extends State<FeatureDiscoveryDemoApp> {
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
FeatureDiscovery.discoverFeatures(context, <String>[
'feature1',
'feature2',
'feature3',
'feature4',
]);
});
super.initState();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: DescribedFeatureOverlay(
featureId: 'feature2',
targetColor: Colors.white,
textColor: Colors.white,
backgroundColor: Colors.blue,
contentLocation: ContentLocation.below,
title: Text(
'Menu Icon',
style: TextStyle(fontSize: 20.0),
),
pulseDuration: Duration(seconds: 1),
enablePulsingAnimation: true,
overflowMode: OverflowMode.clipContent,
openDuration: Duration(seconds: 1),
description: Text(
'This is Button you can add more details heres\n New Info here add more!'),
tapTarget: Icon(Icons.menu),
child: IconButton(icon: Icon(Icons.menu), onPressed: () {})),
title: Text('Feature Discovery Demo'),
centerTitle: true,
actions: [
DescribedFeatureOverlay(
featureId: 'feature3',
targetColor: Colors.white,
textColor: Colors.black,
backgroundColor: Colors.amber,
contentLocation: ContentLocation.trivial,
title: Text(
'More Icon',
style: TextStyle(fontSize: 20.0),
),
pulseDuration: Duration(seconds: 1),
enablePulsingAnimation: true,
barrierDismissible: false,
overflowMode: OverflowMode.wrapBackground,
openDuration: Duration(seconds: 1),
description: Text('This is Button you can add more details heres'),
tapTarget: Icon(Icons.search),
child: IconButton(icon: Icon(Icons.search), onPressed: () {}),
onOpen: () async {
return true;
},
),
],
),
bottomNavigationBar: DescribedFeatureOverlay(
featureId: 'feature1',
targetColor: Colors.white,
textColor: Colors.black,
backgroundColor: Colors.red.shade100,
contentLocation: ContentLocation.trivial,
title: Text(
'This is Button',
style: TextStyle(fontSize: 20.0),
),
pulseDuration: Duration(seconds: 1),
enablePulsingAnimation: true,
overflowMode: OverflowMode.extendBackground,
openDuration: Duration(seconds: 1),
description: Text('This is Button you can\n add more details heres'),
tapTarget: Icon(Icons.navigation),
child: BottomNavigationBar(items: [
BottomNavigationBarItem(title: Text('Home'), icon: Icon(Icons.home)),
BottomNavigationBarItem(
title: Text('Notification'),
icon: Icon(Icons.notifications_active)),
]),
),
);
}
}

Conclusion:

In this flutter article, I have explained a Feature Discovery in a flutter, which you can modify and experiment with according to your own, this little introduction was from the Feature Discovery demo from our side.

I hope this blog will provide you with sufficient information in Trying up the Feature Discovery in your flutter project. We will show you the Feature Discovery is?, and work on it in your flutter applications, So please try it.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Integrate Google Sheet to Flutter App

0

Google Sheet is a web-based spreadsheet application created by Google. Google Sheet allows collaborative editing in real-time. All users can see all the changes made by other users. Slidebar chat feature that allows a collaborative discussion. Google Sheets also support offline editing. It also supports multiple file formats and file types eg. .xlsx, .xls, .xlt, etc. Google Sheets can also be integrated with other Google products.

In this blog, we shall discuss how to integrate Google Sheets with the Flutter applications. Google Sheets provides us Script Editor to create an API. We can further use it to get the data from the Google Sheet to the Flutter app.

Work Flow of the module:

  • We will first make the doGet script in the google script editor.
  • We will add some data in the google sheets as a demo.
  • Then we will deploy the google script to get the API link.
  • We will then create a model class in our flutter project
  • Define its properties and the fromMap method to Map the JSON data with the model object.
  • Next, we will make the functions to decode the JSON data and fetch or map the JSON data with the List of model objects.
  • We will create a list of widgets that uses the model objects data.
  • To display the list of widgets we will need the Future Builder whose future will be the fetch data method that we have created in the 6 th step and its builder will return the list of widgets that we have created in the previous step.
***Demo***

Follow the following steps to open the Script Editor:

  • >Open Google Sheet
  • >Create a new sheet
  • >Click on the Tool button
  • >Select Script Editor

Now we have to write a doGet function to fetch the data from the Google sheets:

***Script***

To get the data we have to open the spreadsheet. To open it script editor provides three methods to open it using id, URL, open. We will use openById. We can get the id of the spreadsheet from the link https://docs.google.com/spreadsheets/d/id/edit#gid=0 . Now we will get all the values of the spreadSheet. Use for loop to iterate all the values and push them in a data list. Then using ContentService we can create the output in JSON format as shown above.

Deploy it as a web-app:

For deployment crate on the deploy button and click on New Deployment . Select the Web App from the Select Type. Select Anyone in Who can access and provide the Google account access.

After successfully deploying it we will get the URL.

Click on New Deployment

Choose Web App as Select Type

Provide access to AnyOne

Copy the URL to use it to get the data in JSON format

Package Used:

http | Dart Package
A composable, Future-based library for making HTTP requests. This package contains a set of high-level functions and…pub.dev

pubspec.yaml:

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
http: ^0.12.2

Make a Model class to get the JSON data:

class MonumentModel {
String imageUrl;
String name;
String about;

MonumentModel({
this.about,
this.name,
this.imageUrl,
});

factory MonumentModel.fromMap(Map<String, dynamic> json) {
return MonumentModel(
about: json['about'],
name: json['name'],
imageUrl: json['imageUrl'],
);
}
}

fromMap method is used to Map the list of JSON items with the MonumentModel and return list. and fromJson is used to return the MonumentModel object with the JSON data.

Decoding Data:

This method takes

a responseBody. It returns a list of MonumentModel. All the data items in the JSON format are decoded and then the parsed data is then mapped with the MonumentModel using fromMap method and a list of MonumentModel is returned.

List<MonumentModel> decodeMonument(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
return parsed
.map<MonumentModel>((json) => MonumentModel.fromMap(json))
.toList();
}

Fetching JSON Data:

HTTP package provides us get method to fetch the JSON data. We will store the data in the response and the pass its body in the decode method to decode it.

Future<List<MonumentModel>> fetchMonument() async {
final response = await http.get(
'https://script.google.com/macros/s/AKfycbx9kO8lRb2UTMesbih4M4-EwlFxW7Zt58IMmHtFNGrG6bMF-eLlUCwvHuo9GdaAhPy-/exec');
if (response.statusCode == 200) {
return decodeMonument(response.body);
} else {
throw Exception('Unable to fetch data from the REST API');
}

Displaying the Data:

MyHomePage is a widget that takes a Future<List<MonumentModel>> . FutureBuilder is used as the data we got from the API is of Future type. Its Builder takes returns a CircularProgressIndicator if it does not has data else it returns a monumentList . monumentList is a list of all the monuments that we have got. It takes the data of the snapshot.

class MyHomePage extends StatelessWidget {
final Future<List<MonumentModel>> monuments;

MyHomePage({Key key, this.monuments}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: FutureBuilder<List<MonumentModel>>(
future: monuments,
builder: (context, snapshot) {
if (snapshot.hasError) print(snapshot.error);
return snapshot.hasData
? monumentList(snapshot.data)
: Center(child: CircularProgressIndicator());
},
),
));
}
}

Now we will define monumentList Widget:

This is the actual UI that we see on our app. It has a simple Card with elevation 5 and a container with a Column. It has a name as a title, image, and description.

Widget monumentList( List<MonumentModel> monumentList) {
return ListView.builder(
itemCount: monumentList.length,
itemBuilder: (context, index) {
return Card(
elevation: 5,
child: Container(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"|| " + monumentList[index].name,
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 25),
),
Container(
child: Image.network(monumentList[index].imageUrl),
),
Container(
child: Text(
'\n' + monumentList[index].about,
style: TextStyle(
color: Colors.grey,
),
),
),
],
),
));
});
}

Conclusion:

In the article, I have explained how you can integrate google sheet with your flutter app. You can modify the script and code according to your requirement. This was a small introduction on how you create an API using google script and use that API to get the data stored in the sheets and use it in our app. You can also use some different approaches to display the data, please give it a try using initState method without using the FutureBuilder. You can get the data in a new list from the fetch function and directly use the ListView.builder and use the list data items to display the data. So please give it a try.

GitHub Link:

flutter-devs/flutter_google_sheet_example
A new Flutter application. This project is a starting point for a Flutter application. A few resources to get you…github.com


🌸🌼🌸 Thank you for reading. 🌸🌼🌸


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app 987tr project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences!.

What’s New In Flutter 2 !

0

Our next generation of Flutter, built for web, mobile, and desktop

You must’ve heard Flutter has released its second update last week on March 3, 2021. As the Google itself claims that this version is fully dedicated to developer’s experience that is why the new version has developers oriented functionalities.

Flutter 2.0 is packed with new capabilities and improved experiences with brand new and the existing features.


What’s New in Flutter 2 ?

There are many new and exciting features in the new release, let’s look at them one by one.

Web Support of Flutter

In the earlier version of Flutter, the foundation of the web was document centric. But, the web platform is already evolved by using a very dynamic richer platforms and APIs. Keeping that in mind Flutter new release build on these innovations which offers and app-centric framework.

By adding the Canvas Kit powered rendering engine built with Web Assembly and Flutter Plasma, a demo built by community member Felix Blaschke, Flutter 2.0 made a lot of progress on performance optimization which ultimately showcase the ease of building sophisticated web graphics experiences with Dart and Flutter that can also run natively on desktop or on mobile devices.

Platform Adaptive Applications

By now as we all know that the Flutter 2.0 supports three stages of production applications — Android, iOS and the Web and the three more in beta — Windows, macOS and Linux. Hence, we may wonder,

How we would compose an application that adapts well with numerous divers’ factors — Little, medium and large screens. Distinctive info mode — Keyboard, touch and mouse?

To address these, Flutter has introduce “Flutter Folio Scrapbooking Application”.

What is Flutter Folio?

Flutter Folio is a scrapbooking app that is designed to showcase Flutter’s capabilities to create apps that feel at home on every platform and device: iOS, Android, Mac, Linux, Windows, and the Web.

Flutter Folio

Google Mobile Ads: Beta

Another beta release that will make digital marketers excited! Google Mobile Ads SDK for Flutter is a new plugin dedicated to overlay, banner, and native ads for mobile devices. Its unified support of Ad Manager and Ad mob makes it versatile for advertisers, regardless of a publisher.

iOS Features

The most important and awaited feature is that after numerous requests, Flutter has finally added a possibility to build IPA directly from the command line without having to rely on Xcode. Furthermore, the Cupertino design language implementation has been updated with some fresh UI (e.g. iOS search console).

New Widgets: Autocomplete & ScaffoldMessenger

Flutter 2.0 new release brings on board with two new widgets :

Autocomplete Core : The Autocomplete does exactly what we do expect, and simplifies the coding process with a long-requested auto-complete function.

ScaffoldMessenger : The ScaffoldMessenger is dedicated to SnackBar-related issues.

Dart: The Heart

Along with Flutter 2, Google has released Dart 2.12, a new version of the language that is used to create Flutter apps. At the language level, Dart 2.12’s most relevant feature is null safety, which can be enabled to make all variable declarations to be non-nullable by default unless they add a ? Suffix to the type:

var i = 42; // non-nullable int

int? n = null; // nullable int

if (n == null) {

return 0;

}

if (n > 0) { // here n has been promoted to a non-null int

}

Another important feature in Dart 2.12 is Dart FFI, which makes it possible to call into C libraries from Dart code. While Dart FFI is considered stable and ready for production use, there are a number of fine-grained features that are still in the workings, including support for ABI-specific data types like int, long, size_t; inline arrays in structs; packed structs, and so on.

Conclusion

Lastly, I would say that the world is evolving and they are moving more towards the technology. In coming future we will come across with new and innovative business ideas and for most of the business idea there will be one application which satisfies the need. Considering that fact, I believe Flutter has a great future. They are continuously evolving and the developers are taking notice of that, and they’re adopting Flutter more and more.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Number Picker In Flutter

In this article, we will explore the Number Picker in flutter using the number_picker_package. With the help of the package, we can easily achieve a flutter number picker. So let’s get started.

numberpicker | Flutter Package
NumberPicker is a custom widget designed for choosing an integer or decimal number by scrolling spinners.pub.dev


Table Of Contents :

Flutter

Number Picker

Implementation

Code Implement

Code File

Conclusion


Flutter :

“ Flutter is Google’s UI toolkit that helps you build beautiful and natively combined applications for mobile, web, and desktop in a single codebase in record time, Flutter offers great developer tools, with amazing hot reload”

Number Picker :

The Numberpicker is a kind of package that allows us to select any number of numbers, using this package allows us to easily select both integer and decimal numbers.

Types of NumberPicker :

There are two types of dialog in the number picker package:

  1. Integer NumberPicker Dialog — The Integer NumberPicker Dialog is used by the user for any integer number.
  2. Decimal NumberPicker Dialog — The decimal number picker dialog is used by the user to take any floating point, double or decimal number.

Demo Module :

Implementation :

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies :

dependencies:   
numberpicker: ^2.0.1

Step 2: Importing

import 'package:numberpicker/numberpicker.dart';

Step 3: Run flutter package get

Code Implementation :

Create a new dart file called number_picker_demo.dart inside the libfolder.

In this screen, we have defined the Integer Number Picker and Decimal Number Peak inside the Column Widget, in which the selected number of each is also shown below the Number Picker Widget, there is a button that opens a dialog by clicking on it. We can select the number value. Let’s look at it briefly.

In this reference, the NumberPicker.integer type is defined with minValue 0 and maxValue 100.

integerNumberPicker = new NumberPicker.integer(
initialValue: _currentIntValue,
minValue: 0,
maxValue: 100,
step: 10,
onChanged: _handleValueChanged,
);

Now we have created a button to show the value of the Integer type, inside which the NumberPickerDialog.integer dialog is defined. As we press the button a dialog of an integer value will open in which the user can select any number.

Future _showIntegerDialog() async {
await showDialog<int>(
context: context,
builder: (BuildContext context) {
return new NumberPickerDialog.integer(
minValue: 0,
maxValue: 100,
step: 10,
initialIntegerValue: _currentIntValue,
title: new Text("Pick a int value"),
);
},
).then(_handleValueChangedExternally);
}

When we run the application, we ought to get the screen’s output like the underneath screen capture.

In this reference, the NumberPicker.decimal type is defined with minValue 0 and maxValue 50.

decimalNumberPicker = new NumberPicker.decimal(
initialValue: _currentDoubleValue,
minValue: 1,
maxValue: 50,
decimalPlaces: 2,
onChanged: _handleValueChanged);

Now we have created a button to show the value of the decimal type, inside which the NumberPickerDialog.decimal dialog is defined. As we press the button a dialog of a decimal value will open in which the user can select any number.

Future _showDoubleDialog() async {
await showDialog<double>(
context: context,
builder: (BuildContext context) {
return new NumberPickerDialog.decimal(
minValue: 1,
maxValue: 5,
decimalPlaces: 2,
initialDoubleValue: _currentDoubleValue,
title: new Text("Pick a decimal value"),
);
},
).then(_handleValueChangedExternally);
}

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Code File :

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:numberpicker/numberpicker.dart';
class NumberPickerDemo extends StatefulWidget {
@override
_NumberPickerDemoState createState() => _NumberPickerDemoState();
}

class _NumberPickerDemoState extends State<NumberPickerDemo> {
int _currentIntValue = 10;
double _currentDoubleValue = 3.0;
NumberPicker integerNumberPicker;
NumberPicker decimalNumberPicker;

_handleValueChanged(num value) {
if (value != null) {
if (value is int) {
setState(() => _currentIntValue = value);
} else {
setState(() => _currentDoubleValue = value);
}
}
}

_handleValueChangedExternally(num value) {
if (value != null) {
if (value is int) {
setState(() => _currentIntValue = value);
integerNumberPicker.animateInt(value);
} else {
setState(() => _currentDoubleValue = value);
decimalNumberPicker.animateDecimalAndInteger(value);
}
}
}

@override
Widget build(BuildContext context) {
integerNumberPicker = new NumberPicker.integer(
initialValue: _currentIntValue,
minValue: 0,
maxValue: 100,
step: 10,
onChanged: _handleValueChanged,
);
//build number picker for decimal values
decimalNumberPicker = new NumberPicker.decimal(
initialValue: _currentDoubleValue,
minValue: 1,
maxValue: 5,
decimalPlaces: 2,
onChanged: _handleValueChanged);
//scaffold the full homepage
return new Scaffold(
appBar: new AppBar(
title: new Text('Number Picker Demo'),
centerTitle:true,
),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
integerNumberPicker,
RaisedButton(
onPressed: () => _showIntegerDialog(),
child: new Text("Int Value: $_currentIntValue"),
color: Colors.grey[300],
),
decimalNumberPicker,
RaisedButton(
onPressed: () => _showDoubleDialog(),
child: new Text("Decimal Value: $_currentDoubleValue"),
color: Colors.pink[100],

),
],
),
));
}
Future _showIntegerDialog() async {
await showDialog<int>(
context: context,
builder: (BuildContext context) {
return new NumberPickerDialog.integer(
minValue: 0,
maxValue: 100,
step: 10,
initialIntegerValue: _currentIntValue,
title: new Text("Pick a int value"),
);
},
).then(_handleValueChangedExternally);
}
Future _showDoubleDialog() async {
await showDialog<double>(
context: context,
builder: (BuildContext context) {
return new NumberPickerDialog.decimal(
minValue: 1,
maxValue: 5,
decimalPlaces: 2,
initialDoubleValue: _currentDoubleValue,
title: new Text("Pick a decimal value"),
);
},
).then(_handleValueChangedExternally);
}
}

Conclusion :

In this article, I have explained a Number Picker in a flutter, which you can modify and experiment with according to your own, this little introduction was from the Number Picker from our side.

I hope this blog will provide you with sufficient information in Trying up the Number Picker in your flutter project. We will show you the Number Picker is?, and work on it in your flutter applications, So please try it.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

VxSwiper In Flutter

VelocityX is really a great UI tool. It provides us hundreds of new cool features that we can use in our development. VelocityX makes our UI 40% faster in a much easier manner. It has some great widgets, we call them SuperVx with many properties. VxSwiper, VxAnimator, VxPlatform, VxToast, VxStepper, VxRating are SuperVx that helps us to do certain things faster and easier manner. In this blog, we shall discuss about VxSwiper and learn how to implement it.


Table of content :

Install package

VxSwipper

VxSwiper.builder

Using extension method .swiper()

Properties of Swiper

Conclusion


Install package:

velocity_x | Flutter Package
VelocityX is a 100% free Flutter open-source minimalist UI Framework built with Flutter SDK to make Flutter development…pub.dev

dependencies:
velocity_x: ^2.6.0

VxSwipper:

We can directly use VxSwiper to implement it, it has several properties and takes a list of items i.e. list of widgets. We have used map method. A list of String is given and then its data is mapped with text.

You can notice that I have written text in a different manner. VelocityX provides this method to pass text as a child or widget. We can directly write the text string and then make it as text. Using VleocityX we can easily pass color, fontSize, fontWeight, padding, and many more properties very easily.

List<String> list = ["A", "B", "C", "D", "E"];
VxSwiper(
height: 200,
scrollDirection: Axis.horizontal,
scrollPhysics: BouncingScrollPhysics(),
autoPlay: true,
reverse: false,
pauseAutoPlayOnTouch: Duration(seconds: 3),
initialPage: 0,
isFastScrollingEnabled: true,
enlargeCenterPage: true,
onPageChanged: (value) {
print(value);
},
autoPlayCurve: Curves.elasticOut,
items: list
.map((e) => e.text
.makeCentered()
.box
.withRounded(value: 5)
.coolGray600
.make()
.p12())
.toList()),

VxSwiper.builder:

This widget is used when the length of. It also has similar properties. builder returns a widget for each iteration.

VxSwiper.builder(
enableInfiniteScroll: true,
reverse: false,
height: 400,
viewportFraction: 0.8,
initialPage: 0,
autoPlay: true,
autoPlayInterval: Duration(seconds: 1),
autoPlayAnimationDuration: Duration(milliseconds: 500),
autoPlayCurve: Curves.easeIn,
enlargeCenterPage: true,
onPageChanged: (value) {},
scrollDirection: Axis.vertical,
itemCount: list.length,
itemBuilder: (context, index) {
return list[index]
.text
.white
.make()
.box
.rounded
.alignCenter
.color(Vx.blueGray700)
.make()
.p4();
},
)

Using extension method .swiper():

List.generate(
list.length,
(index) => list[index]
.text
.white
.make()
.box
.rounded
.alignCenter
.color(Vx.coolGray500)
.make()
.p4()).swiper(
height: context.isMobile ? 200 : 400,
enlargeCenterPage: true,
autoPlay: true,
autoPlayCurve: Curves.easeIn,
onPageChanged: (index) {
print(index);
},
isFastScrollingEnabled: true,
scrollDirection: Axis.horizontal)

Properties of Swiper:

  1. height: Its default value is 0
  2. aspectRatio : Its default value is 16/9
  3. viewportFraction : 0.8 is the default value and it is the fraction of the viewport that each page should occupy.
  4. initialPage: It takes the index of the initial page. Its default value is 0.
  5. realPage: It is the actual index of the PageView .
  6. enableInfiniteScroll: It is the bool value that determines whether the swiper should loop infinitely or not.
  7. reverse: It reverses the order of items.
  8. autoPlay: It slides the page one by one.
  9. autoPlayInterval: It is the frequency of slides.
  10. autoPlayAnimationDuration: It is animation duration between two transitioning pages while they are in auto playback.
  11. autoPlayCurve: It is the animation curve.
  12. pauseAutoPlayOnTouch: It pauses the autoplay on touch.
  13. enlargeCenterPage: it enlarges the current page.
  14. onPageChanged: It is called when the page viewport changes.
  15. scrollPhysics: It is the physics of scrolling.
  16. isFastScrollingEnabled: It scrolls faster.
  17. scrollDirection: It is the direction of scrolling of pages.

Conclusion :

In the article, I have explained the basic type widget of a VelocityX Swiper. you can modify this code according to your choice. This was a small introduction to VelocityX SwiperX On User Interaction from my side, and it’s working using Flutter.

I hope this blog will provide you with sufficient information in Trying up VelocityX VxSwiper in your flutter projects. This demo program uses velocity_x packages in a flutter and shows how a swiper will work in your flutter applications. So please try it.

🌸🌼🌸 Thank you for reading. 🌸🌼🌸🌼


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app 987tr project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences!.

Snapping Sheet In Flutter

The flutter widget is built using a modern framework. It is like a reaction. In this, we start with the widget to create any application. Each component in the screen is a widget. The widget describes what his outlook should be given his present configuration and condition. Widget shows were similar to its idea and current setup and state. Flutter is a free and open-source tool to develop mobile, desktop, web applications with a single code base.

Hello friends, I will talk about my new blog on Snapping Sheet In Flutter. we will explore the Snapping Sheet In flutter using the snapping_sheet_package. With the help of the package, we can easily achieve the flutter snapping sheet. So let’s get started.


Table of Contents :

Snapping Sheet

Attributes

Implementation

Code Implementation

Code File

Conclusion


Snapping Sheet :

The Snapping Sheet Library provides a highly customizable sheet that goes to different vertical lines, in which we can make the sheet custom and change the size and color of the sheet; inside it, there are two types of the sheet below and sheetAbove widget inside which we can make the item Initializes so that the user can scroll the sheet from the top and bottom.

Attributes:

There are some attributes of the snapping sheet are:

  • > sheetBelow: We use the sheetBelow widget to display any list below, which is the remaining space from the bottom to the bottom of the grabbing widget.
  • > sheetAbove: We use the sheetAbove widget to display any list below, which is the remaining space from the top to the top of the grabbing widget.
  • > grabbing: The grabbing widget is fixed between the sheetBelow and sheetAbove.
  • > grabbingHeight: The grabbing height is used to increase and decrease grabbing height.
  • > snapPositions: The snapPosition are used for different snap position of a sheet.n

Demo Module :


Implementation :

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies :

dependencies:   
snapping_sheet: ^3.0.0+2

Step 2: Importing

import 'package:snapping_sheet/snapping_sheet.dart';

Step 3: Enable AndriodX

org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

How to implement code in dart file :

You need to implement it in your code respectively:

Create a new dart file called snapping_sheet_demo.dart inside the lib folder.

First of all, we have created a snap sheet demo screen in which two buttons are created, and clicking on each button will open a new page in which we have used the sheetBelow and sheetAbove widget inside the SnappingSheet. Let us understand this in detail.

CustomButton(
mainButtonText: 'Snapping Sheet Above',
callbackTertiary: () {
Navigator.of(context).pushNamed(RouteName.SnappingSheetAboveScreen);
},
color: Colors.green[200],
),

Now, we will deeply describe sheetBelow widget:

In the sheetBelow, we will add a list view builder, inside it, we will add some items; the list item has shown the image, title, and subtitle of the item. This item will scroll from the bottom to the top of the sheet

sheetBelow: SnappingSheetContent(
child: Container(
color: Colors.white,
child:ListView.builder(
itemCount:snappingBelowSheetModel.length,
scrollDirection:Axis.vertical,
shrinkWrap:true,
//physics:NeverScrollableScrollPhysics(),
itemBuilder:(BuildContext context,int index){
return _buildSnappingBelowSheetModel(snappingBelowSheetModel[index]);
}
),
),
heightBehavior: SnappingSheetHeight.fit()
),

In this SnappingSheet, we have used the sun position, which will take the content item of the sheetBelow to the snap position.

snapPositions: [
SnapPosition(
positionPixel: 25.0,
snappingCurve: Curves.elasticOut,
snappingDuration: Duration(milliseconds: 750)
),
SnapPosition(
positionFactor: 0.5,
snappingCurve: Curves.ease,
snappingDuration: Duration(milliseconds: 500)
),
],

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Now, we will deeply describe sheetAbove widget:

In sheetAbove, too, we will add a list view builder; inside it we will add some items. The list item shows the image, title, and subtitle of the item.

sheetAbove:SnappingSheetContent(
draggable:true,
child: ListView.builder(
itemCount:snappingBelowSheetModel.length,
scrollDirection:Axis.vertical,
shrinkWrap:true,
//physics:NeverScrollableScrollPhysics(),
itemBuilder:(BuildContext context,int index){
return _buildSnappingBelowSheetModel(snappingBelowSheetModel[index]);
}
),
heightBehavior: SnappingSheetHeight.fit()
),

When we run the application, we ought to get the screen’s output like the underneath screen capture.

Code File:

import 'package:flutter/material.dart';
import 'package:snapping_sheet/snapping_sheet.dart';
import 'package:snnaping_sheet_demo/Constants/Constants.dart';
import 'package:snnaping_sheet_demo/model/snaping_below_sheet_model.dart';
import 'package:snnaping_sheet_demo/shared/default_grabbing.dart';
import 'package:snnaping_sheet_demo/themes/appthemes.dart';
import 'package:snnaping_sheet_demo/themes/device_size.dart';
import 'dart:math';
class SnappingSheetBelow extends StatefulWidget {
@override
_SnappingSheetBelowState createState() => _SnappingSheetBelowState();
}

class _SnappingSheetBelowState extends State<SnappingSheetBelow> {

List<SnappingBelowSheetModel>snappingBelowSheetModel;

@override
void initState() {
snappingBelowSheetModel=Constants.getTestPanelModel();
super.initState();
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor:Colors.grey.shade50,
appBar:AppBar(
title:Text('Snapping Below Sheet Demo'),
),
body:SnappingSheet(
//lockOverflowDrag: true,
grabbingHeight:50,
grabbing:DefaultGrabbing(),

snapPositions: [
SnapPosition(
positionPixel: 25.0,
snappingCurve: Curves.elasticOut,
snappingDuration: Duration(milliseconds: 750)
),
SnapPosition(
positionFactor: 0.5,
snappingCurve: Curves.ease,
snappingDuration: Duration(milliseconds: 500)
),
],

sheetBelow: SnappingSheetContent(
child: Container(
color: Colors.white,
child:ListView.builder(
itemCount:snappingBelowSheetModel.length,
scrollDirection:Axis.vertical,
shrinkWrap:true,
itemBuilder:(BuildContext context,int index){
return _buildSnappingBelowSheetModel(snappingBelowSheetModel[index]);
}
),
),
heightBehavior: SnappingSheetHeight.fit()
),
),

);
}

Widget _buildSnappingBelowSheetModel(SnappingBelowSheetModel items) {
return Container(
height:DeviceSize.height(context)/10,
child:Card(
child:Padding(
padding:EdgeInsets.all(6),
child:Row(
mainAxisAlignment:MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Container(
height:60,
width:60,
padding:EdgeInsets.all(5),
decoration:BoxDecoration(
borderRadius:BorderRadius.all
(Radius.circular(4)),
color:AppTheme.color1.withOpacity(0.2),
),
child:Image.asset(items.img),
),

SizedBox(width:10,),

Column(
crossAxisAlignment:CrossAxisAlignment.start,
mainAxisAlignment:MainAxisAlignment.spaceEvenly,
children: [
Text(items.title,style:TextStyle
(fontSize:13,fontWeight:FontWeight.w700,),),
Text(items.subTitle,style:TextStyle
(fontSize:11,fontWeight:FontWeight.w700,
color:AppTheme.color1),),
],
),
],
),

Icon(Icons.arrow_forward_ios,size:15,color:AppTheme.color2.withOpacity(0.8),)
],
),
),
),
);
}
}

Conclusion:

In this article, I have explained a Snapping Sheet in a flutter, which you can modify and experiment with according to your own. This little introduction was from the Snapping Sheet from our side.

I hope this blog will provide you with sufficient information in Trying up the Snapping Sheet in your flutter project. We will show you the Snapping Sheet is? and work on it in your flutter applications, So please try it.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.


Hover Effect In Flutter

0

In this article, we will explore the Hover Effect in flutter using the hover_effect_package. With the help of the package, we can easily achieve a flutter hover effect. So let’s get started.

hover_effect | Flutter Package
Hover – Tilt 3D Effect Takes any child widget and enables Hover/Tilt 3D functionality to it import…pub.dev


Table Of Contents :

Flutter

Hover Effect

Implementation

Code Implement

Hover Effect Code File

Conclusion


Flutter :

“ Flutter is Google’s UI toolkit that helps you build beautiful and natively combined applications for mobile, web, and desktop in a single codebase in record time, Flutter offers great developer tools, with amazing hot reload”

Hover Effect :

The hover effect library gives a 3d hover effect like any box or container etc. we rotate it around the top, bottom, left, right so it is 3d changes its position in style, in this, we can change its shadow color, depthColor etc.

Demo Module :

Implementation :

You need to implement it in your code respectively :

Step 1: Add dependencies.

Add dependencies to pubspec — yaml file.

dependencies:
hover_effect: ^0.6.0

Step 2: import the package :

import 'package:hover_effect/hover_effect.dart';

Step 3: Run flutter package get

How to implement code in dart file :

Create a new dart file called hover_effect_pager_demo.dart inside the libfolder.

Before creating the hovercard effect, we have taken a container inside which we have implemented the column widget which has a text widget which is the title of the hover effect, then we have taken the container widget in which the hovercard has defined some of its properties, let’s make it a understand in detail by reference.

HoverCard(
builder: (context, hovering) {
return Container(
color: Color(0xFFE9E9E9),
child: Center(
child: FlutterLogo(size: 100),
),
);
},
depth: 10,
depthColor: Colors.grey[500],
shadow: BoxShadow(color: Colors.purple[200], blurRadius: 30, spreadRadius: -20, offset: Offset(0, 40)),
),

Within the HoverCard effect, we have taken a container in which its color and an image is given, the value of the depth attribute of the hovercard is ten, the color of the depth and shadow of the card is also given.

These are snapshots image after running the app.

Code File :

import 'package:flutter/material.dart';
import 'package:flutter_hover_effect_demo/themes/device_size.dart';
import 'package:hover_effect/hover_effect.dart';
class HoverEffectDemo extends StatefulWidget {
@override
_HoverEffectDemoState createState() => _HoverEffectDemoState();
}
class _HoverEffectDemoState extends State<HoverEffectDemo> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar:AppBar(
title:Text('Hover Effect Demo'),
),
body:Container(
height:DeviceSize.height(context),
width:DeviceSize.width(context),
child:Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Hover Tilt 3D Effect',
style:TextStyle(
fontSize:15,
fontWeight: FontWeight.w700,
color: Colors.black,
letterSpacing: 2
),
),
SizedBox(height: 50),
Container(
width: 150,
height: 300,
child: HoverCard(
builder: (context, hovering) {
return Container(
color: Color(0xFFE9E9E9),
child: Center(
child: FlutterLogo(size: 100),
),
);
},
depth: 10,
depthColor: Colors.grey[500],
shadow: BoxShadow(color: Colors.purple[200], blurRadius: 30, spreadRadius: -20, offset: Offset(0, 40)),
),
),
],
),
),
);
}
}

Conclusion :

In the article, I have explained the basic structure of the Hover Effect in a flutter; you can modify this code according to your choice. This was a small introduction to Hover Effect On User Interaction from my side, and it’s working using Flutter.

I hope this blog will provide you with sufficient information in Trying up the Hover Effect in your flutter project. We will show you the Hover Effect is?, and work on it in your flutter applications, So please try it.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.

From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.