Google search engine
Home Blog Page 80

Rotated Box Widget In Flutter

0

Flutter is Google’s UI tool stash for making excellent, natively compiled iOS and Android applications from a single code base. To construct any application, we start with widgets — The building square of flutter applications. Widgets portray what their view ought to resemble given their present design and state. It incorporates a text widget, row widget, column widget, container widget, and some more.

Every component on a screen of the Flutter application is a widget. The screen’s perspective totally relies on the widgets’ decision and arrangement used to fabricate the application. What’s more, the construction of the code of an application is a tree of widgets.

In this blog, we explore the Rotated Box Widget In Flutter. We will implement a rotated box widget demo program and how to use it in your flutter applications.

Table Of Contents::

Rotated Box Widget

Flutter

Implementation

Code Implement

Code File

Conclusion



Rotated Box Widget:

A widget that rotates its child by an indispensable number of quarter turns. In contrast to Transform, which applies a change only before painting, this article applies its rotation preceding design, which implies the whole rotated box burns through just as much space as needed by the rotated child.

For more info on Rotated Box Widget ,Watch this video By Flutter :

We will rotate the child-like text, image, and renders from bottom to top, like an axis label on a graph. We will show an image with different quarterTurns.

Flutter :

Flutter is Google’s UI toolkit that helps you build beautiful and natively combined applications for mobileweb, and desktop in a single codebase in record time.

https://youtube.com/watch?v=fq4N0hgOWzU%3Ffeature%3Doembed

To begin with, you’ll need the necessary information on Flutter, Git, and GitHub. If you are new to flutter, you can get started by reading the official documentation on flutter. Dev.

Flutter – Beautiful native apps in record time
Paint your app to life in milliseconds with Stateful Hot Reload. Use a rich set of fully customizable widgets to build…flutter. dev

Implementation:

Step 1: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/

Step 2: Run flutter packages get in the root directory of your app.

How to implement code in dart file :

You need to implement it in your code respectively:

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

In the body, we will implement a RotatedBox() widget. Inside the widget, we will add a quarterTurns means the number of clockwise quarter turns should rotate the child. The quarterTurns argument must not be null.

RotatedBox(
quarterTurns: 3,
child: ClipPath(
child: Image(
image: AssetImage("assets/logo.png"),
fit: BoxFit.contain,
height: 200,
)
)
)

We will add ClipPath and his child’s property; we will add an image with height, and Boxfit contains. When we run the application, we ought to get the screen’s output like the underneath screen capture.

RotatedBox With quarterTurns is 3

We will change the quarterTurns for the user to better understand about Rotated Box widget. We will wrap RotatedBox into the center widget. All things we will see same as above.

Center(
child: RotatedBox(
quarterTurns: 5,
child: ClipPath(
child: Image(
image: AssetImage("assets/logo.png"),
fit: BoxFit.contain,
height: 200,
)
)
)
),

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

RotatedBox With quarterTurns is 5

Code File:

import 'package:flutter/material.dart';


void main() => runApp(MyApp());

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

class RotatedDemo extends StatefulWidget {

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

class _RotatedDemoState extends State<RotatedDemo> {

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[100],
appBar: AppBar(
title: Text("Flutter Rotated Box demo"),
backgroundColor: Colors.blueGrey[800],

),
body: Center(
child: RotatedBox(
quarterTurns: 5,
child: ClipPath(
child: Image(
image: AssetImage("assets/logo.png"),
fit: BoxFit.contain,
height: 200,

)

)
)
),
);
}
}

Conclusion:

In the article, I have explained the Rotated Box Widget of the basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Rotated Box Widget 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 Rotated Box Widget in your flutter projectsWe will show you what the Rotated Box Widget is?. Make a demo program for working Rotated Box Widget and rotate the child-like image with different quarterTurns. It renders from bottom to top, like an axis label on a graph 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 FacebookGitHubTwitter, 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.

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Draw Graph In Flutter

The Flutter Line Graph is shown and imagines time-subordinate information to show the patterns at equivalent spans. It upholds the numeric, classification, date-time, or logarithmic axis of a graph. You can make a delightful, enlivened, continuous, and a superior line graph that additionally upholds intuitive highlights like selection, plot diverse informational sets, and so on.

In this article, we will explore the Draw Graph In Flutter. We will implement a draw line graphs demo program and use multiple axes to plot different data sets that widely vary from one other using the draw_graph package in your flutter applications.

draw_graph | Flutter Package
A dart package to draw line graphs in your flutter app.pub.dev

Table Of Contents::

Draw Graph

Properties

Implementation

Code Implement

Code File

Conclusion



Draw Graph

It has a widget that draws a line graph for you. A line graph is a sort of chart used to show data that changes over the long haul. We plot line graphs utilizing a few focuses associated with straight lines. We additionally consider it a line graph. The line graph involves two axes known as the ‘X’ axis and ‘Y’ axis. The horizontal axis is known as the x-axis. Would you like to show a graph in your application?. This package can help.

Demo Module :

This demo video shows how to draw a line graph in a flutter. It shows how the line graph will work using the draw_graph package in your flutter applications. It shows multiple axes to plot different data sets on one line graph, and also, we will split all line graph to proper show. It also tracks your work in one line graph. It will be shown on your device.

Properties:

  • > features: This property is used for a list of features to be shown in the graph.
  • > labelX: This property has been used for a list of X-Axis Labels. This will determine and the number of cells to distribute your data in and the width of your cells.
  • > labelY: This property is used for a list of Y-Axis Labels. The labels will be distributed on Y-Axis and determine the height of cells.
  • > size: This property is used required. This will determine the size of your graph. Height will be size is 50 in the case when the description is shown.
  • > showDescription: This property is used for whether to show description at the end of the graph.
  • > fontFamily: This property is used for labels and descriptions of features.
  • > graphColor: This property is used for the color of your axis and labels.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
draw_graph:

Step 2: Import

import 'package:draw_graph/draw_graph.dart';
import 'package:draw_graph/models/feature.dart';

Step 3: Run flutter packages get in the root directory of your app.

How to implement code in dart file :

You need to implement it in your code respectively:

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

In the body, we will add LineGraph() Widget. In this widget, we will add features that mean a detailed description of the Feature class below. We will add the size of the x-axis and y-axis. This will determine the size of your graph. We will add labelX means the number of cells to distribute your data according to your cells’ width. We will add six data.

LineGraph(
features: features,
size: Size(420, 450),
labelX: ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6'],
labelY: ['25%', '45%', '65%', '75%', '85%', '100%'],
showDescription: true,
graphColor: Colors.black87,
),

Now, we will add labelY means determine the height of cells. We will add six percent data. We will add showDescription and graphColor.

We will deeply describe features

First, we will import the package.

import 'package:draw_graph/models/feature.dart';

We will create a list of feature

final List<Feature> features = [...]

We will create five features of the line graph. We will add Feature(). Inside, we will add a title, color, and data. Data is distributed in our data and the width of your cells.

Feature(
title: "Flutter",
color: Colors.blue,
data: [0.3, 0.6, 0.8, 0.9, 1, 1.2],
),

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

Flutter Graph

When we click on flutter, they will show a flutter line graph according to percentage and days data.

Feature(
title: "Swift",
color: Colors.green,
data: [0.25, 0.6, 1, 0.5, 0.8, 1,4],
),

In this graph, the title was swift programming, color was green, and data was set with different axes to plot. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Swift Graph

We will show a graph. The data was decreasing to increase with the x-axis and y-axis. When we click the swift button again, we will show us all five graphs on one graph. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Final Output

Code File:

import 'package:draw_graph/draw_graph.dart';
import 'package:draw_graph/models/feature.dart';
import 'package:flutter/material.dart';

class GraphScreen extends StatefulWidget {
@override
_GraphScreenState createState() => _GraphScreenState();
}

class _GraphScreenState extends State<GraphScreen> {
final List<Feature> features = [
Feature(
title: "Flutter",
color: Colors.blue,
data: [0.3, 0.6, 0.8, 0.9, 1, 1.2],
),
Feature(
title: "Kotlin",
color: Colors.black,
data: [1, 0.8, 0.6, 0.7, 0.3, 0.1],
),
Feature(
title: "Java",
color: Colors.orange,
data: [0.4, 0.2, 0.9, 0.5, 0.6, 0.4],
),
Feature(
title: "React Native",
color: Colors.red,
data: [0.5, 0.2, 0, 0.3, 1, 1.3],
),
Feature(
title: "Swift",
color: Colors.green,
data: [0.25, 0.6, 1, 0.5, 0.8, 1,4],
),
];

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white54,
appBar: AppBar(
title: Text("Flutter Draw Graph Demo"),
automaticallyImplyLeading: false,
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,

children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(vertical: 64.0),
child: Text(
"Tasks Management",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
letterSpacing: 2,
),
),
),
LineGraph(
features: features,
size: Size(420, 450),
labelX: ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6'],
labelY: ['25%', '45%', '65%', '75%', '85%', '100%'],
showDescription: true,
graphColor: Colors.black87,
),
SizedBox(
height: 50,
)
],
),
);
}
}

Conclusion:

In the article, I have explained the Draw Graph of the basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Draw Graph 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 Draw Graph in your flutter projectsWe will show you what the Draw Graph is?. Show some draw graph properties, make a demo program for working draw graph, and show multiple axes to plot different data sets on one line graph and also we will split all line graph to proper show. It also tracks your work in one line graph using the draw_graph package 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.

find the source code of the Flutter Draw Graph Demo:

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


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 FacebookGitHubTwitter, 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.

Related: SMS Using Twilio In Flutter

Related: Using SharedPreferences in Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Explore Polls Widget In Flutter

0

Have you at any point been going to build a survey or possibly a Twitter poll resemble the other? Well, if you have, amazing! Be that as it may, if you haven’t or need to gain some new useful knowledge. I prefer to show you a flutter package that is constantly a flutter widget that essentially shows your voting data in a Twitter poll that resembles the other the same widget.

In this blog, we will Explore Polls Widget In Flutter. We will implement the polls widget demo program, show your voting data, and visualize a Twitter poll look alike using the polls package in your flutter applications.

polls | Flutter Package
GitHub Basic: import ‘package:polls/polls.dart’; Polls( children: [ // This cannot be less than 2, else will throw an…pub.dev

Table Of Contents::

Introduction

Properties

Implementation

Code Implement

Code File

Conclusion



Introduction:

A flutter widget for the poll imitates the Twitter polls framework. All you need do is associate your information with the polls; it permits casting voting and perception. Below demo video shows how to create a polls widget in a flutter. It shows how the polls widget will work using the polls package in your flutter applications. It shows your voting data, and when the user chooses an option, then the background color was changed and highlighted. It will be shown on your device.

Demo Module :

Properties:

There are some properties of polls widget are:

  • > question: This property is used to this takes the question on the poll.
  • > voteData: This property is used to take in vote data which should be a Map; with this, the polls widget determines what type of view the user should see.
  • > onVote: This property is used to this callback returns user choice after voting.
  • > onVoteBackgroundColor: This property is used to add background-color. When the user taps the poll, then the color will show.
  • > children: This property is used to this takes in the poll options array.
  • > allowCreatorVote: This property is used to this determines if the creator of the poll can vote or not.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
polls:

Step 2: Import

import 'package:flutter_polls_demo/polls_demo.dart';

Step 3: Run flutter packages get in the root directory of your app.

How to implement code in dart file :

You need to implement it in your code respectively:

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

Main Screen

First, we will create a four double variable based on the poll’s question, which should come dynamically from a database or API.

double option1 = 2.0;
double option2 = 1.0;
double option3 = 4.0;
double option4 = 3.0;

We will add a string user ”user@gmail.com,” which holds the current user logged in. We will add a usersWhoVoted mean a Map datatype which holds the users who have voted and their choices. The user’s email is the key, and their choice option is the value. We will add a String creator, “admin@gmail.com,” which means the polls’ creator; we’ll use this to identify what the view of the polls should be.

String user = "user@gmail.com";
Map usersWhoVoted = {'test@gmail.com': 1, 'deny@gmail.com' : 3, 'kent@gmail.com' : 2,
'xyz@gmail.com' : 3};
String creator = "admin@gmail.com";

In the body, we will add the Polls widget. In this widget, we will add children, which takes in PollsOption, PollsOptions takes in title and values. We will add a question mean takes in a text widget of the question, currentUser mean add a String of user email id.

Polls(
children: [
Polls.options(title: 'Java', value: option1),
Polls.options(title: 'Kotlin', value: option2),
Polls.options(title: 'Flutter', value: option3),
Polls.options(title: 'React Native', value: option4),
],
question: Text('Which Andriod App Development technology used?',
style: TextStyle(fontSize: 17),),
currentUser: this.user,
creatorID: this.creator,
voteData: usersWhoVoted,
userChoice: usersWhoVoted[this.user],
onVoteBackgroundColor: Colors.cyan,
leadingBackgroundColor: Colors.cyan,
backgroundColor: Colors.white,
onVote: (choice) {
print(choice);
setState(() {
this.usersWhoVoted[this.user] = choice;
});
if (choice == 1) {
setState(() {
option1 += 1.0;
});
}
if (choice == 2) {
setState(() {
option2 += 1.0;
});
}
if (choice == 3) {
setState(() {
option3 += 1.0;
});
}
if (choice == 4) {
setState(() {
option4 += 1.0;
});
}
},
),

We will add voteData means, which should be a Map with this, polls widget determines what type of view the user should see. We will add userChoice mean takes in the current user choice, so if this user already voted, this will tell the widget which option the user chose. We will add onVoteBackgroundColor means add a background color. When the user taps the poll, then the color will show, leadingBackgroundColor mean add background-color. When the user taps the poll, the highest voting color will show, and backgroundColor is given to the progress stroke bar. onVote means this is a callback that returns the voter’s choice when he casts a vote; with this, you can save it to your database or send it to an API. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Final Output

Code File:

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

class PollsDemo extends StatefulWidget {
@override
_PollsDemoState createState() => _PollsDemoState();
}

class _PollsDemoState extends State<PollsDemo> {

double option1 = 2.0;
double option2 = 1.0;
double option3 = 4.0;
double option4 = 3.0;

String user = "user@gmail.com";
Map usersWhoVoted = {'test@gmail.com': 1, 'deny@gmail.com' : 3, 'kent@gmail.com' : 2,
'xyz@gmail.com' : 3};
String creator = "admin@gmail.com";

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Flutter Polls Widget Demo"),
automaticallyImplyLeading: false,
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Polls(
children: [
Polls.options(title: 'Java', value: option1),
Polls.options(title: 'Kotlin', value: option2),
Polls.options(title: 'Flutter', value: option3),
Polls.options(title: 'React Native', value: option4),
],
question: Text('Which Andriod App Development technology used?',
style: TextStyle(fontSize: 17),
),
currentUser: this.user,
creatorID: this.creator,
voteData: usersWhoVoted,
userChoice: usersWhoVoted[this.user],
onVoteBackgroundColor: Colors.cyan,
leadingBackgroundColor: Colors.cyan,
backgroundColor: Colors.white,
onVote: (choice) {
print(choice);
setState(() {
this.usersWhoVoted[this.user] = choice;
});
if (choice == 1) {
setState(() {
option1 += 1.0;
});
}
if (choice == 2) {
setState(() {
option2 += 1.0;
});
}
if (choice == 3) {
setState(() {
option3 += 1.0;
});
}
if (choice == 4) {
setState(() {
option4 += 1.0;
});
}
},
),
],
),
),
);
}
}

Conclusion:

In the article, I have explained the Polls Widget basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Polls Widget 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 Polls Widget in your flutter projectsWe will show you what the Introduction is?. Some polls widget properties, make a demo program for working Polls Widget, and show your voting data. When the user chooses an option, the background color was changed and highlighted using the polls package 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.

find the source code of the Flutter Polls Widget Demo:

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


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 FacebookGitHubTwitter, 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.

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Explore Confetti Animation In Flutter

0

There are loads of ways Flutter makes it simple to make animations, from essential Tweens to Implicit Animations that are incorporated directly into the structure. Furthermore, assuming those don’t meet your requirements, there are third-party solutions that do almost anything you can envision. From rotations to blurs, size changes, and even animations where one Widget flies, starting with one page then onto the next, Flutter makes it simple!

In any case, simple can now and again be excessively simple. Try not to wrongly settle on the most effortless methodology without looking at how it functions. A few things are more costly than others, and on the off chance that you utilize one of those everywhere when something less difficult would work similarly also, at that point, you could drag your application’s presentation down to a creep.

In this blog, we will Explore Confetti Animation In Flutter. We will see how to implement a demo program of the confetti animation and show a colorful blast using the confetti package in your flutter applications.

confetti | Flutter Package
Blast some confetti all over the screen and celebrate user achievements! A video walkthrough is available here. To use…pub.dev

Table Of Contents::

Confetti

Attributes

Implementation

Code Implement

Code File

Conclusion



Confetti:

Confetti is an impact of colorful confetti everywhere on the screen. Praise application accomplishments with style. Control the speed, angle, gravity, and measure of confetti. They will show an impact when the user taps a button then colorful confetti will happen.

Demo Module :

This demo video shows how to create confetti animation in a flutter. It shows how the confetti animation will work using the confetti package in your flutter applications. It shows a colorful confetti blast when the user taps a button, then occurs, and the user can handle blast types, angle, etc. Celebrate application achievements with style. It will be shown on your device.

Attributes:

There are some attributes of confetti are:

  • > ConfettiController: This attribute is must not be null. The only attribute that is required is the ConfettiController.
  • > blastDirectionality: This attribute is used to an enum that takes one of the two values — directional or explosive. The default is set to directional.
  • > shouldLoop: This attribute is used to determines if the emissionDuration will reset, which will result in continuous particles being emitted.
  • > maxBlastForce: This attribute is used to determine the maximum blast force applied to a particle within its first 5 frames of life. The default maxBlastForce is set to `20`.
  • > blastDirection: This attribute is used to the radial value to determine the particle emission direction. The default is set to `PI` (180 degrees). A value of `PI` will emit to the left of the canvas/screen.
  • > numberOfParticles: This attribute is used to be emitted per emission. Default is set to `10`.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

confetti: 

Step 2: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/

Step 3: Import

import 'package:confetti/confetti.dart';

Step 4: Run flutter packages get in the root directory of your app.

How to implement code in dart file :

You need to implement it in your code respectively:

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

First, we will need to instantiate a ConfettiController variable.

ConfettiController controllerTopCenter;

The ConfettiController can be instantiated in the initState method. We will add setState(). Inside setState, we will add initController() method.

@override
void initState() {
// TODO: implement initState
super.initState();
setState(() {
initController();
});

}

We will create a void initController() method. In this method, we will add a controllerTopCenter that is equal to the ConffettiController. In bracket, we will addDuration an argument.

void initController() {
controllerTopCenter =
ConfettiController(duration: const Duration(seconds: 1));
}

In the body, we will add a stack widget. In this widget, we will add an image with height and width. Also, add a buildButton() method. We will deeply define below.

SafeArea(
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child: Column(
children: <Widget>[
Image.asset(
"assets/trophy.png",
width: MediaQuery.of(context).size.width*0.5,
height: MediaQuery.of(context).size.height*0.5,
),
],
),
),
buildButton()
],
),

We will define buildButton() method:

We will create a button, return an Align() widget. Inside the widget, we will create a RaisedButton(). In this button, we will add shape, text, color, and onPressed method.

Align buildButton() {
return Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 100),
child: RaisedButton(
onPressed: (){},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
color: Colors.red,
textColor: Colors.white,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
"Congratulations!",
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
),
),
),
),
);
}

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

Without Confetti Animation

We will create a buildConfettiWidget(). Inside the widget, we will return Align widget. We will add a ConfettiWidget. In this widget, we will add maximumSize mean set the maximum potential size for the confetti. Must be bigger than the minimumSize attribute and cannot be null. We will add gravity, which means is the speed at which the confetti will fall. Can set it to a value between `0` and `1`.

Align buildConfettiWidget(controller, double blastDirection) {
return Align(
alignment: Alignment.topCenter,
child: ConfettiWidget(
maximumSize: Size(30, 30),
shouldLoop: false,
confettiController: controller,
blastDirection: blastDirection,
blastDirectionality: BlastDirectionality.directional,
maxBlastForce: 20, // set a lower max blast force
minBlastForce: 8, // set a lower min blast force
emissionFrequency: 1,
minBlastForce: 8, // a lot of particles at once
gravity: 1,
),
);
}

We will add an emissionFrequency mean should be a value between 0 and 1. The higher the value that will emit particles on a single frame. Also, we will add confettiController, blastDirection, maxBlastForce, minBlastForce, minBlastForce.

We will add buildConfettiWidget() method on the body. Inside the stack widget, add the controllerTopCenter and pi in a bracket.

buildConfettiWidget(controllerTopCenter, pi / 1),
buildConfettiWidget(controllerTopCenter, pi / 4),

Now, we will add play for confetti animation. We will add controllerTopCenter.play() on button onPressed function.

onPressed: (){
controllerTopCenter.play();
},

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

Final Output

Code File:

import 'dart:math';
import 'package:confetti/confetti.dart';
import 'package:flutter/material.dart';


class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
ConfettiController controllerTopCenter;
@override
void initState() {
// TODO: implement initState
super.initState();
setState(() {
initController();
});

}

void initController() {
controllerTopCenter =
ConfettiController(duration: const Duration(seconds: 1));
}


@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.pink[50],
appBar: AppBar(
backgroundColor: Colors.cyan,
title: Text("Flutter Confetti Animation Demo"),
automaticallyImplyLeading: false,
),

body: SafeArea(
child: Stack(
children: <Widget>[
buildConfettiWidget(controllerTopCenter, pi / 1),
buildConfettiWidget(controllerTopCenter, pi / 4),
Align(
alignment: Alignment.center,
child: Column(
children: <Widget>[
Image.asset(
"assets/trophy.png",
width: MediaQuery.of(context).size.width*0.5,
height: MediaQuery.of(context).size.height*0.5,
),
],
),
),
buildButton()
],
),
),
);
}

Align buildButton() {
return Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 100),
child: RaisedButton(
onPressed: (){
controllerTopCenter.play();

},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
color: Colors.red,
textColor: Colors.white,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
"Congratulations!",
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
),
),
),
),
);
}

Align buildConfettiWidget(controller, double blastDirection) {
return Align(
alignment: Alignment.topCenter,
child: ConfettiWidget(
maximumSize: Size(30, 30),
shouldLoop: false,
confettiController: controller,
blastDirection: blastDirection,
blastDirectionality: BlastDirectionality.directional,
maxBlastForce: 20, // set a lower max blast force
minBlastForce: 8, // set a lower min blast force
emissionFrequency: 1,
numberOfParticles: 8, // a lot of particles at once
gravity: 1,
),
);
}
}

Conclusion:

In the article, I have explained the Confetti Animation basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Confetti Animation 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 Confetti Animation in your flutter projectsWe will show you what the Confetti is?. Some confetti attributes, make a demo program for working Confetti Animation and show a colorful confetti blast when the user taps a button then occurs. The user can handle blast types, angles, etc. Celebrate application achievements with style using the confetti package 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.

find the source code of the Flutter Confetti Animation Demo:

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


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 FacebookGitHubTwitter, 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.

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Foldable Sidebar In Flutter

0

A navigation drawer gives admittance to objections and application usefulness, like exchanging accounts. It can either be forever on-screen or constrained by a navigation menu icon. Mobile applications have various ways to deal with navigating between screens like Navigation drawer, Bottom Navigation bar, Sliding tabs, etc.

Flutter makes it simple for developers to utilize the navigation drawer without composing a significant part of the code without anyone else.

In this blog, we will explore the Foldable Sidebar In Flutter. We will implement a foldable sidebar demo program and create a foldable sidebar navigation drawer using the foldable_sidebar package in your flutter applications.

foldable_sidebar | Flutter Package
An easy to implement Foldable Sidebar Navigation Drawer for Flutter Applications. Initial Release for Foldable…pub. dev

Table Of Contents::

Foldable Sidebar

Implementation

Code Implement

Code File

Conclusion



Foldable Sidebar:

It is a simple to-utilize package for adding a foldable flutter navigation sidebar drawer to your Flutter Application. The mobile applications that utilization Material Design has two essential choices for navigation. These navigations are Tabs and Drawers. A drawer is an elective choice for tabs because, occasionally, the mobile applications don’t have adequate space to help tabs.

A drawer is an invisible side screen. It is a sliding left menu that, for the most part, contains significant connections in the application and possesses half of the screen when shown.

Demo Module :

This demo video shows how to create a foldable sidebar in a flutter. It shows how the foldable sidebar will work using the foldable_sidebar package in your flutter applications. It shows when the user tap on the floating action button, the drawer will show/hide in a folding type way. It will be shown on your device.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
foldable_sidebar:

Step 2: Import

import 'package:foldable_sidebar/foldable_sidebar.dart';

Step 3: Run flutter packages get in the root directory of your app.

How to implement code in dart file :

You need to implement it in your code respectively:

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

First, we will create an instance variable of the foldable sidebar builder status.

FSBStatus _fsbStatus;

In the body, we will implement a FoldableSidebarBuilder() method. Inside, we will add drawerBackgroundColor means the background color of the drawer when sliding to the screen. We will add drawer means create a CustomSidebarDrawer() class. We will add screenContents means when the drawer hide, then this screen will show. We will create a welcomeScreen() widget. We will deeply define the below code. We will add status mean to add a foldable sidebar builder status instance variable.

FoldableSidebarBuilder(
drawerBackgroundColor: Colors.cyan[100],
drawer: CustomSidebarDrawer(drawerClose: (){
setState(() {
_fsbStatus = FSBStatus.FSB_CLOSE;
});
},
),
screenContents: welcomeScreen(),
status: _fsbStatus,
),

We will deeply define welcomeScreen() widget

We will return a Container widget. In this widget, we will add the center widget. Inside, we will add a column widget. In the column widget, we will add two texts, and the mainAxisAlignment was the center.

Widget welcomeScreen() {
return Container(
color: Colors.black.withAlpha(50),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Welcome To Flutter Dev's",
style: TextStyle(fontSize: 25,color: Colors.white),
),
SizedBox(height: 5,),
Text("Click on FAB to Open Foldable Sidebar Drawer",
style: TextStyle(fontSize: 18,color: Colors.white
),
),
],
),
),
);
}

We will add a FloatingActionButton(). Inside, we will add a backgroundColor of the button. We will add a menu icon and onPressed() method. In this method, we will define setState(). When _fsbStatus is equal to the FSBStatus.FSB_OPEN, then the drawer will be closed. Otherwise, they will open.

floatingActionButton: FloatingActionButton(
backgroundColor:Colors.red[400],
child: Icon(Icons.menu,
color: Colors.white,
),
onPressed: () {
setState(() {
_fsbStatus = _fsbStatus == FSBStatus.FSB_OPEN ?
FSBStatus.FSB_CLOSE : FSBStatus.FSB_OPEN;
});
}),

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

Home Screen

We will deeply define CustomSidebarDrawer() class

First, we will create a function.

final Function drawerClose;

const CustomSidebarDrawer({Key key, this.drawerClose}) : super(key: key);

We will return a Container widget. In this widget, we will add a column widget. Inside, we will add image, text, and ListTile. We will add three ListTile with icons and texts.

return Container(
color: Colors.white,
width: mediaQuery.size.width * 0.60,
height: mediaQuery.size.height,
child: Column(
children: <Widget>[
Container(
width: double.infinity,
height: 200,
color: Colors.grey.withAlpha(30),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/devs.jpg",
width: 100,
height: 100,
),
SizedBox(
height: 10,
),
Text("Flutter Devs")
],
)),
ListTile(
onTap: (){
debugPrint("Tapped Profile");
},
leading: Icon(Icons.person),
title: Text(
"Your Profile",
),
),
Divider(
height: 1,
color: Colors.grey,
),
ListTile(
onTap: () {
debugPrint("Tapped settings");
},
leading: Icon(Icons.settings),
title: Text("Settings"),
),
Divider(
height: 1,
color: Colors.grey,
),

ListTile(
onTap: () {
debugPrint("Tapped Log Out");
},
leading: Icon(Icons.exit_to_app),
title: Text("Log Out"),
),
],
),
);

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

CustomSidebarDrawer

Code File:

import 'package:flutter/material.dart';
import 'package:flutter_foldable_sidebar_demo/custom_sidebar_drawer.dart';
import 'package:foldable_sidebar/foldable_sidebar.dart';

class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
FSBStatus _fsbStatus;

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Colors.red[400],
title: Text("Flutter Foldable Sidebar Demo") ,
),
body: FoldableSidebarBuilder(
drawerBackgroundColor: Colors.cyan[100],
drawer: CustomSidebarDrawer(drawerClose: (){
setState(() {
_fsbStatus = FSBStatus.FSB_CLOSE;
});
},
),
screenContents: welcomeScreen(),
status: _fsbStatus,
),
floatingActionButton: FloatingActionButton(
backgroundColor:Colors.red[400],
child: Icon(Icons.menu,
color: Colors.white,
),
onPressed: () {
setState(() {
_fsbStatus = _fsbStatus == FSBStatus.FSB_OPEN ?
FSBStatus.FSB_CLOSE : FSBStatus.FSB_OPEN;
});
}),
),
);
}


Widget welcomeScreen() {
return Container(
color: Colors.black.withAlpha(50),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Welcome To Flutter Dev's",
style: TextStyle(fontSize: 25,color: Colors.white),
),
SizedBox(height: 5,),
Text("Click on FAB to Open Foldable Sidebar Drawer",
style: TextStyle(fontSize: 18,color: Colors.white
),
),
],
),
),
);
}
}

Conclusion:

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

I hope this blog will provide you with sufficient information on Trying up the Foldable Sidebar in your flutter projectsWe will show you what the Foldable Sidebar is?. Make a demo program for working Foldable Sidebar and show when the user tap on the floating action button, the drawer will show/hide in a folding type way using the foldable_sidebar package 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.

find the source code of the Flutter Foldable Sidebar Demo:

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


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 FacebookGitHubTwitter, 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.

Related: SMS Using Twilio In Flutter

Related: Using SharedPreferences in Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Explore Model Viewer In Flutter

3D models are those model which has 3 measurements length, width, and depth. These models give an incredible user experience when utilized for different purposes. What’s more, adding such a sort of perception to your application will be extremely useful for the user, helping your application develop and attract an enormous crowd.

In this article, we will Explore Model Viewer In Flutter. We will implement a model viewer demo program and show 3D models in the glTF and GLB formats using the model_viewer package in your flutter applications.

model_viewer | Flutter Package
This is a Flutter widget for rendering interactive 3D models in the glTF and GLB formats. The widget embeds Google’s…pub. dev

Table Of Contents ::

Introduction

Features

Parameters

Implementation

Code Implement

Code File

Conclusion



Introduction:

A Flutter widget for delivering interactive 3D models in the glTF and GLB designs. The widget inserts Google’s <model-viewer> web part in a WebView. The 3D model shows a 3D picture, and the user ought to turn toward any path for the watcher.

Demo Module :

This demo video shows how to create a model viewer in a flutter. It shows how the model viewer will work using the model_viewer package in your flutter applications. It shows 3D models in the glTF and GLB format and rotates 360° degree by mouse, hand touch, and auto-rotate. It will be shown on your device.

Features:

There are features of the model viewer:

  • > It renders glTF and GLB models. (Also, USDZ models on iOS 12+.)
  • > It Supports animated models with a configurable auto-play setting.
  • > It optionally supports launching the model into an AR viewer.
  • > It optionally auto-rotates the model with a configurable delay.
  • > It supports a configurable background color for the widget.

Parameters:

There are some parameters of the model viewer are:

  • > src: This parameter is used to the URL or path to the 3D model. This parameter is required. Only glTF/GLB models are supported.
  • > alt: This parameter is utilized to designs the model with custom content that utilized will portray the model to watchers who utilize a screen reader or, in any case, rely upon an extra semantic setting to comprehend what they are seeing.
  • > autoRotateDelay: This parameter is utilized to sets the deferral before auto-revolution starts. The configuration of the worth is a number in milliseconds. The default is 3000.
  • > iosSrc: This parameter is used to the URL to a USDZ model, which will be used on supported iOS 12+ devices via AR Quick Look.
  • > arScale: This parameter is utilized to controls the scaling conduct in AR mode in Scene Viewer. Set to “fixed” to incapacitate the model’s scaling, which sets it to be at 100% scale consistently. Defaults to “auto,” which permits the model to be resized.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

model_viewer: 

Step 2: Add the assets

assets:
- assets/

Step 3: Import

import 'package:model_viewer/model_viewer.dart';

Step 4: Run flutter packages get in the root directory of your app.

Step 5: AndroidManifest.xml (Android 9+ only)

android/app/src/main/AndroidManifest.xml

To utilize this widget on Android 9+ devices, your application should be allowed to make an HTTP association with http://localhost:XXXXX. Android 9 (API level 28) changed the default forandroid:usesCleartextTrafficfrom true to false.

<application
android:name="io.flutter.app.FlutterApplication"
android:label="flutter_model_viewer_demo"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">

How to implement code in dart file :

You need to implement it in your code respectively:

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

In the body, we will add ModelViewer(). Inside, we will add a backgroundColor for the model viewer; src means the user adds URL and assets only glTF/GLB models are supported.

ModelViewer(
backgroundColor: Colors.teal[50],
src: 'assets/table_soccer.glb',
alt: "A 3D model of an table soccer",
autoPlay: true,
autoRotate: true,
cameraControls: true,
),

We will add alt mean configures the model with custom text that will describe the model to viewers who use a screen reader; autoplay means if this is true and a model has animations, an animation will automatically begin to play when this attribute is set. The default is false. We will add autoRotate mean it enables the auto-rotation of the model. We will add cameraControls mean it enables controls via mouse/touch when in flat view. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Final Output

Code File:

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

class DemoView extends StatefulWidget {
@override
_DemoViewState createState() => _DemoViewState();
}

class _DemoViewState extends State<DemoView> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Flutter Model Viewer Demo"),
automaticallyImplyLeading: false,
backgroundColor: Colors.black,
),
body: ModelViewer(
backgroundColor: Colors.teal[50],
src: 'assets/table_soccer.glb',
alt: "A 3D model of an table soccer",
autoPlay: true,
autoRotate: true,
cameraControls: true,
),
);
}
}

Conclusion:

In the article, I have explained the Model Viewer basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Model Viewer 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 Model Viewer in your flutter projectsWe will show you what the Introduction is?. Some model viewer features, parameters, make a demo program for working Model Viewer and show 3D models in the glTF and GLB format and rotate 360° degree by mouse, hand touch, and auto-rotate using the model_viewer package 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.

find the source code of the Flutter Model Viewer Demo:

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


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 FacebookGitHubTwitter, 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.

Related: Explore Exception Handling In Flutter

Related: Explore Dart String Interpolation

Related: Explore Design Patterns in Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Explore Fluid Slider In Flutter

Flutter allows you to make lovely, natively compiled applications. The explanation Flutter can do this is that Flutter loves Material. Material is a plan framework that helps assemble high-quality, digital encounters. As UI configuration keeps developing, Material keeps on refreshing its components, motion, and plan framework.

Flutter, as a rule, has been amazingly generous to the extent of giving customization choices to User Interface Components are concerned. Sliders are no special case for this rule.

In this article, we will Explore Fluid Slider In Flutter. We will also implement a demo program of the fluid slider and properties using the flutter_fluid_slider package in your flutter applications.

flutter_fluid_slider | Flutter Package
Inspired by a dribble by Virgil Pana. A fluid design slider that works just like the Slider material widget. Used to…pub. dev

Table Of Contents :

Fluid Slider

Properties

Implementation

Code Implement

Code File

Conclusion



Fluid Slider :

Fluid Slider is a fluid design slider that works very much like the Slider material widget. It is utilized to choose from a range of values. Below demo video shows how to create a fluid slider in a flutter. It shows how the fluid slider carousel will work using the flutter_fluid_slider package in your flutter applications. It shows a three-fluid slider with a different color and uses different working properties for users. It will be shown on your device.

Demo Module :


Properties :

There are few properties of fluid slider are :

  • > onChanged: This property is required and used to call when the user starts selecting a new value for the slider. The value passed will be the last [value] that the slider had before the change began.
  • > value: This property is required and used to the currently selected value for this slider. The slider’s thumb is drawn at a position that corresponds to this value.
  • > min: This property is used to the minimum value the user can select.
    Defaults to 0.0. Must be less than or equal to [max].
  • > max: This property is used to the maximum value the user can select.
     Defaults to 1.0. Must be greater than or equal to [min].
  • > sliderColor: This property is used to the color of the slider. If not provided, primaryColor will applied the ancestor theme.
  • > thumbColor: This property is used to the color of the thumb.
    If not provided, the [Colors was white] will be applied.
  • > onChangeStart: This property is called when the user starts to select a new value for the slider.
  • onChangeEnd: This property is called when the user is done selecting a new value for the slider.

Implementation :

Step 1: Add the dependencies

Add dependencies to pubspec yaml file.

dependencies:

flutter_spinwheel: 

Step 2: Import

import 'package:flutter_spinwheel/flutter_spinwheel.dart';

Step 3: Run flutter packages in your app’s root directory.

How to implement code in dart file :

You need to implement it in your code respectively :

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

First, we will create three double variables for three fluid sliders.

double _value1 = 0.0;
double _value2 = 20.0;
double _value3 = 1.0;

We will create a simple FluidSlider(). Inside, we will add value means the currently selected value for this slider. Add the variable you will create for the fluid slider. We will add onChanged means call when the user starts selecting a new value for the slider. Inside, we will add setState(). In the setState, we will add a variable that is equal to the new value.

FluidSlider(
value: _value1,
onChanged: (double newValue) {
setState(() {
_value1 = newValue;
});
},
min: 0.0,
max: 100.0,
sliderColor: Colors.cyan,
),

We will add a min and max value. Also, we will add a slider color. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Simple Fluid Slider

Now, we will create another FluidSlider(). Inside, we will add a variable in the value method; max means the maximum value is the value the user can select and be greater than or equal to the min value. Add a slider color and thumb color. In this slider, we will add start means the widget to be displayed as the min label. We will display a money-off icon. If not provided the min value is displayed as text.

FluidSlider(
value: _value2,
onChanged: (double newValue) {
setState(() {
_value2 = newValue;
});
},
min: 0.0,
max: 200.0,
sliderColor: Colors.pinkAccent,
thumbColor: Colors.amber[200],
start: Icon(
Icons.money_off,
color: Colors.white,
),
end: Icon(
Icons.attach_money,
color: Colors.white,
),
),

We will add the end means the widget to be displayed as the max label. We will display an attach-money icon. If not provided, the max value is displayed as text. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Fluid Slider With Icon

Now, we will create a third Fluid slider. In this slider, we will add a variable in the value method, slider color, onChanged, mapValueToString means callback function to map the double values to String texts. If null, the value is converted to String based on [showDecimalValue]. We will create a list of string numbers 1 to 10 and return numbers.

FluidSlider(
value: _value3,
sliderColor: Colors.teal,
onChanged: (double newValue) {
setState(() {
_value3 = newValue;
});
},
min: 1.0,
max: 10.0,
mapValueToString: (double value) {
List<String> numbers = ['1', '2', '3', '4', '5','6', '7', '8', '9', '10'];
return numbers[value.toInt() - 1];
}),

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

Fluid Slider With List <String>

Hence, we will use some property in these sliders. There are many ways to used these sliders for your flutter application with different ways and properties. When we run the application, we ought to get the screen’s final output like the underneath screen capture.

Final Output

Code File :

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


class HomePage extends StatefulWidget {
@override
HomePageState createState() {
return new HomePageState();
}
}

class HomePageState extends State<HomePage> {
double _value1 = 0.0;
double _value2 = 20.0;
double _value3 = 1.0;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Flutter Fluid Slider Demo"),
automaticallyImplyLeading: false,
),
body: Padding(
padding: const EdgeInsets.all(30.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
FluidSlider(
value: _value1,
onChanged: (double newValue) {
setState(() {
_value1 = newValue;
});
},
min: 0.0,
max: 100.0,
sliderColor: Colors.cyan,
),
SizedBox(
height: 50.0,
),
FluidSlider(
value: _value2,
onChanged: (double newValue) {
setState(() {
_value2 = newValue;
});
},
min: 0.0,
max: 200.0,
sliderColor: Colors.pinkAccent,
thumbColor: Colors.amber[200],
start: Icon(
Icons.money_off,
color: Colors.white,
),
end: Icon(
Icons.attach_money,
color: Colors.white,
),
),
SizedBox(
height: 50.0,
),
FluidSlider(
value: _value3,
sliderColor: Colors.teal,
onChanged: (double newValue) {
setState(() {
_value3 = newValue;
});
},
min: 1.0,
max: 10.0,
mapValueToString: (double value) {
List<String> numbers = ['1', '2', '3', '4', '5','6', '7', '8', '9', '10'];
return numbers[value.toInt() - 1];
}),
],
),
),
);
}
}

Conclusion :

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

I hope this blog will provide you with sufficient information on Trying up the Fluid Slider in your flutter projectsWe will show you what the Fluid Slider is?. Some fluid slider properties, make a demo program for working Fluid Slider and show three sliders with different colors and properties using the flutter_fluid_slider package 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.

find the source code of the Flutter Fluid Slider Demo:

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


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 FacebookGitHubTwitter, 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.

Related: Explore Table In Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Mouse Parallax Effect In Flutter

0

Animation is an intricate system in any mobile application. Animation improves the user experience to another level regardless of its intricacy and gives a rich user cooperation. Because of its wealth, animation turns into a necessary piece of current mobile applications.

The Flutter system perceives the significance of Animation and gives a basic and natural structure to build up a wide range of animations. There’s continually something so fascinating about animation, and parallax is one of those that consistently gets my eyes.

In this blog, we will explore the Mouse Parallax Effect In Flutter. We will also implement a demo program of the mouse parallax effect with pointer-based parallax animations using the mouse_parallax package in your flutter applications.

mouse_parallax | Flutter Package
A Pointer-Based Animation Package. The goal of this package is to make mouse and touch-based parallax effects as a simple…pub. dev

Table Of Contents :

Introduction

Attributes

Implementation

Code Implement

Code File

Conclusion



Introduction :

A Pointer-Based Animation Package. A simple way to implement pointer-based parallax animations on multiple platforms. Parallax is nothing new. It has been around for decades and was one of those first effects that added extra layers of depth into video games, movies, and simple 3D-like images. The goal of this package is to make mouse and touch-based parallax effects as simple as possible.

Demo Module :

This demo video shows how to use the mouse parallax effect in a flutter. It shows how the mouse parallax effect will work using the mouse_parallax package in your flutter applications and shows that when your mouse and the touch-based pointer will move, the picture also moves in this direction. Feel like a 3D parallax effect. It will be shown the parallax animations effects on your device.

Attributes :

To get started with the Parallax effect, use a ParallaxStack. There are some attributes of ParallaxStack are:

  • > useLocalPosition: This attribute is used whether the parallax should be referenced from the size and position of the [ParallaxStack]. If it is false, the Parallax will be measured based on the screen’s width and height. Otherwise, it is measured based on the size of the [ParallaxStack]. It is recommended to set this to true.
  • > referencePosition: This attribute is used where should reference the parallax effect from. This is a scale from 0–1. Its default value is 0.5, meaning that the parallax is referenced from the center.
  • > layers: This attribute has used a list of [ParallaxLayer]’s.
  • > touchBased: This attribute is used whether the parallax stack should listen to touches instead of hover events.
  • > resetOnExit: This attribute is used whether the animation should reset to the default position when the pointer leaves the hover region.
  • > resetDuration: This attribute is used to how long it should take the widget to reset when the pointer leaves the hover region.

Implementation :

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:

mouse_parallax: 

Step 2: Import

import 'package:mouse_parallax/mouse_parallax.dart';

Step 3: Run flutter packages in your app’s root directory.

How to implement code in dart file :

You need to implement it in your code respectively:

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

A Parallax Stack that does not animate its children. It is animated by the [ParallaxStack]. A Widget that allows you to stack and animate the children of parallax layers.

ParallaxStack(
resetOnExit: true,
useLocalPosition:true,
referencePosition: 0.6,
dragCurve : Curves.easeIn,
resetCurve: Curves.bounceOut,
layers: [ParallaxLayer(..)],
),

In the body, we will use ParallaxStack() for the parallax effect. Inside, we will add a dragCurve means the duration of the animation when pointer events occur and when the widget transforms. By default, it is set to Curves ease. Add a resetCurve means the curve of the animation that occurs when the pointer leaves the hover region. It will only apply when resetOnExit is true. We will add resetOnExit means the animation should reset to the default position when the pointer leaves the hover region. We will add referencePosition means where we should reference the parallax effect from. We will set a 0.6 scale. Also, we will add layers means to add a list of multiple ParallaxLayer()’s. Below, we will define the code.

ParallaxLayer(
yRotation: 2.0,
xRotation: 0.80,
xOffset: 90,
yOffset: 80,

child: Center(
child: Container(
height: MediaQuery.of(context).size.height*0.5,
width: MediaQuery.of(context).size.width*0.7,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset("assets/powered_by.png",),
Image.asset("assets/devs.jpg"),
],
)),
),
),

A layer in the parallax stack. This serves as a blueprint for the transformations of a widget in a ParallaxStack. It contains all the animatable properties of the child. This is not a widget. In ParallaxLayer(), we will add yRotation means how much the child should rotate on the y axis when a pointer event occurs. The nature of the rotation is left-right. Next, we will add xRotation means how much the child should rotate on the x-axis when a pointer event occurs. The nature of the rotation is up-down. We will add xOffset, and yOffset means how much the child should translate on the horizontal and vertical axis when a pointer event occurs. It’s child property, and we will add images. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Output

Code File :

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


class DemoPage extends StatefulWidget {
@override
_DemoPageState createState() => _DemoPageState();
}

class _DemoPageState extends State<DemoPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar(
automaticallyImplyLeading: false,
title: Text("Flutter Mouse Parallax Demo"),
backgroundColor: Colors.black,
),
body: ParallaxStack(
resetOnExit: true,
useLocalPosition:true,
referencePosition: 0.6,
dragCurve : Curves.easeIn,
resetCurve: Curves.bounceOut,
layers: [
ParallaxLayer(
yRotation: 2.0,
xRotation: 0.80,
xOffset: 90,
yOffset: 80,

child: Center(
child: Container(
height: MediaQuery.of(context).size.height*0.5,
width: MediaQuery.of(context).size.width*0.7,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset("assets/powered_by.png",),
Image.asset("assets/devs.jpg"),
],
)),
),
),
],
),
);
}
}

Conclusion :

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

I hope this blog will provide you with sufficient information on Trying up the Mouse Parallax Effect in your flutter projectsWe will show you what the Introduction is?. Some parallax stack attributes make a demo program for working Mouse Parallax Effect and show images will move with the mouse and touch-based parallax effects using the mouse_parallax package 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.

find the source code of the Flutter Mouse Parallax Effect Demo:

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


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 FacebookGitHubTwitter, 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.

Related: Frosted Glass Effect In Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Wave Slider In Flutter

0

A slider in Flutter is a material design widget utilized for choosing a scope of values. It is an information widget where we can set a range of values by dragging or pushing the ideal position.

Typically, we utilize the slider widget for changing a value. Along these lines, it is needed to store the value in a variable. This widget has a slider class that requires the onChanged() work. This capacity will be called at whatever point we change the slider position.

In this blog, we will explore the Wave Slider In Flutter. We will implement a wave slider demo program and show a wave effect when dragged using the wave_slider package in your flutter applications.

wave_slider | Flutter Package
A Flutter slider that makes a wave effect when dragged. It does a little bounce when dropped. To use this plugin, add…pub.dev

Table Of Contents::

Wave Slider

Properties

Implementation

Code Implement

Code File

Conclusion



Wave Slider:

A Flutter slider that makes a wave impact when dragged. It does a little bounce when dropped. Can utilize a slider for choosing a value from a continuous or discrete arrangement of values. Of course, it utilizes a constant scope of values by dragging or pushing on the ideal position.

Demo Module :

This demo video shows how to create a wave slider in a flutter. It shows how the wave slider will work using the wave_slider package in your flutter applications. It shows a wave effect when dragging or pressing on the desired position. It will be shown on your device.

Properties:

There are some properties for wave slider are:

  • > sliderHeight: This property is used to the height of the slider can be set by specifying a sliderHeight. The default height is 50.0.
  • > color: This property is used to the color of the slider can be set by specifying a color. The default color is black.
  • > onChanged: This property is used to the called during a drag when the user selects a new value for the slider by dragging. Returns a percentage value between any number for the current drag position.
  • > displayTrackball: This property is used to display a trackball below the current position’s line as a visual indicator.
  • > onChangeStart: This property is used when the user starts selecting a new value for the slider.
  • > onChangeEnd: This property is used when the user is done selecting a new value for the slider.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

wave_slider: 

Step 2: Import

import 'package:wave_slider/wave_slider.dart';

Step 3: Run flutter packages in your app’s root directory.

How to implement code in dart file :

You need to implement it in your code respectively:

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

First, we will create a variable in double and given named _dragValue is equal to zero.

double _dragValue = 0;

In the body, we will add a WaveSlider(). Inside, we will add a color of the slider that can be set by specifying a color. We will add a sliderHeight, which means the user can set the slider’s height by specifying a sliderHeight. The default height is 50.0.

WaveSlider(
color: Colors.teal,
sliderHeight: 70,
displayTrackball: true,
onChanged: (double dragUpdate) {
setState(() {
_dragValue = dragUpdate*150; // dragUpdate is a fractional value between 0 and 1
});
},
),

We will add a displayTrackball mean to display a trackball below the line on the current position as a visual indicator and add an onChanged() method. In this method, we will add a setState(). We will add a _dragValue equal to the drag Update, and dragUpdate is a fractional value between 0 and 1.

Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Drag Value',
style: TextStyle(fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'$_dragValue',
style: TextStyle(fontSize: 16,
color: Colors.red,),
),
)

We will add a text and show a variable text. When the slider moves, it will be shown the number on your devices. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Output

Code File:

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

class SliderDemo extends StatefulWidget {
@override
_SliderDemoState createState() => _SliderDemoState();
}

class _SliderDemoState extends State<SliderDemo> {
double _dragValue = 0;

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.brown[50],
appBar: AppBar(
title: Text("Flutter Wave Slider Demo"),
automaticallyImplyLeading: false,),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
WaveSlider(
color: Colors.teal,
sliderHeight: 70,
displayTrackball: true,
onChanged: (double dragUpdate) {
setState(() {
_dragValue = dragUpdate*150;
});
},
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Drag Value',
style: TextStyle(fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'$_dragValue',
style: TextStyle(fontSize: 16,
color: Colors.red,),
),
)
],
),
);
}
}

Conclusion:

In the article, I have explained the Wave Slider basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Wave Slider 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 Wave Slider in your flutter projectsWe will show you what the Wave Slider is?. Some wave slider properties, make a demo program for working Wave Slider and show a wave effect when dragging or pressing on the desired position using the wave_slider package 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.

find the source code of the Flutter Wave Slider Demo:

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


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 FacebookGitHubTwitter, 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.

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Card Selector In Flutter

A material design card. A card has somewhat adjusted corners and a shadow. A card is a sheet of material used to represent some connected data, such as a collection, a geographical area, a meal, contact details, etc. Cards contain substance and actions about a solitary subject.

In this article, we will explore the Card Selector In Flutter. We will see how to implement a demo program of card selector with animation and stacked cards using the card_selector package in your flutter applications.

card_selector | Flutter Package
Widget selector for Flutter using stack. The selector is fully configurable, animation time, the gap between cards, size…pub.dev

Table Of Contents::

Introduction

Properties

Implementation

Code Implement

Code File

Conclusion



Introduction:

Card selector is a widget selector for Flutter utilizing the stack. The selector is completely configurable, animation time, the gap between cards, size factor for stacked cards. Users can swipe cards left to right or right to left. Information will be different on specific cards.

Demo Module :

This demo video shows how to create a card selector in a flutter. It shows how the card selector will work using the card_selector package in your flutter applications. It shows a stacked card, animation, swiping cards left to right or right to left. Content will be change according to cards. A widget to select stacked widgets sliding left or right. It will be shown on your device.

Properties:

There are some properties of the card selector are:

  • > cardsGap: This property is used to the gap size between cards.
  • > lastCardSizeFactor: This property is used to render the last element’s factor compared to the first element.
  • > mainCardWidth: This property is used to the width for the first element in the list.
  • > onChanged: This property used to the callback to execute on card changed.
  • > mainCardPadding: This property used to left padding of the first element in the list.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

card_selector:

Step 2: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/

Step 3: Import

import 'package:card_selector/card_selector.dart';

Step 4: Run flutter packages in your app’s root directory.

Step 5: Enable AndriodX

Add this to your gradle.properties file:

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 home_page.dart inside the lib folder.

First, we will create a dummy json file and save it in the assets folder.

data.json

Create a List of the dynamic and give the name called _cards. Also, create a Map of the dynamic and give the name called _data.

List _cards;
Map _data;

Now, we will create initState(). Inside, we will add a json file and add a dynamic list of _cards is equal to the json decode. We will also map a _data equal to the dynamic list of _cards and wrap in setState().

@override
void initState() {
super.initState();
DefaultAssetBundle.of(context).loadString("assets/data.json").then((d) {
_cards = json.decode(d);
setState(() => _data = _cards[0]);
});
}

In the body, we will add a CardSelector(). Inside, we will add cards property means a list of dynamic _cards dot map navigate to CardPage() class. toList(). Also, we will add mainCardWidth means width of the first element of the list, mainCardHeight means height for the first element in the list, onChanged means the callback to execute on card changed. The index navigating to setState() and then navigating to _data is equal to the _cards of the index.

CardSelector(
cards: _cards.map((context) => CardPage(context)).toList(),
mainCardWidth: _width,
mainCardHeight: _width * 0.63,
mainCardPadding: -16.0,
onChanged: (i) => setState(() => _data = _cards[i])),

Now, we will deeply define CardPage() class.

In this class, we will return ClipRRect. Inside, add a container and add color from json file. His child property adds Stack() and inside add the image. We will add a column widget, Inside add card details like bank name, type, number, and branch. All data come from json file.

return ClipRRect(
borderRadius: BorderRadius.circular(12.0),
child: Container(
color: Color(_cardDetails['color']),
child: Stack(
children: <Widget>[
Image.asset(
'assets/${_cardDetails['background_layer']}.png',
fit: BoxFit.cover,
height: double.infinity,
width: double.infinity,
),
Padding(
padding: EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(_cardDetails['bank'], style: textTheme.title),
Text(_cardDetails['type'].toUpperCase(), style: textTheme.caption),
Expanded(child: Container()),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Expanded(
child: Text(_cardDetails['number'],
style: textTheme.subhead, overflow: TextOverflow.ellipsis),
),
Image.asset('assets/${_cardDetails['branch']}.png', width: 48.0)
],
)
],
),
),
],
),
),
);

Now, we will deeply define AmountPage() class.

This class will add to the home page. We will return ListView.builder(), inside add itemCount and itemBuilder. In itemBuilder, if the index is equal to zero, then return column widget. In this widget, add balance from json file. Also, we will add the amount, mode, time from json file.

return ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: (_amount['transactions'] as List).length + 1,
itemBuilder: (context, i) {
if (i == 0) {
return Padding(
padding: padding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Balance', style: TextStyle(color: Colors.black)),
SizedBox(height: 8.0),
Text(_amount['balance'], style: textTheme.display1.apply(color: Colors.white)),
SizedBox(height: 24.0),
Text('Today', style: TextStyle(color: Colors.black)),
],
),
);
}
var transactions = _amount['transactions'][i - 1];
return Padding(
padding: padding,
child: Row(
children: <Widget>[
Icon(Icons.shopping_cart, size: 24.0, color: Colors.blueGrey[600]),
SizedBox(width: 16.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(transactions['mode'], style: textTheme.title.apply(color: Colors.white)),
Text(transactions['time'], style: textTheme.caption)
],
),
),
Text(transactions['amount'], style: textTheme.body2.apply(color: Colors.black))
],
),
);
},
);

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

Card Selector

Code File:

import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:card_selector/card_selector.dart';
import 'package:flutter_card_selector_demo/amount_page.dart';
import 'package:flutter_card_selector_demo/card_page.dart';

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

class _HomePageState extends State<HomePage> {
List _cards;
Map _data;
double _width = 0;

@override
void initState() {
super.initState();
DefaultAssetBundle.of(context).loadString("assets/data.json").then((d) {
_cards = json.decode(d);
setState(() => _data = _cards[0]);
});
}

@override
Widget build(BuildContext context) {
if (_cards == null) return Container();
if (_width <= 0) _width = MediaQuery.of(context).size.width - 40.0;
return Scaffold(
backgroundColor: Colors.white70,
appBar: AppBar(
title: Text("Flutter Card Selector Demo"),
automaticallyImplyLeading: false,
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.all(24.0),
child: Text(
"Wallets",
style: TextStyle(color: Colors.white,fontSize: 25)
),
),
SizedBox(height: 20.0),
CardSelector(
cards: _cards.map((context) => CardPage(context)).toList(),
mainCardWidth: _width,
mainCardHeight: _width * 0.63,
mainCardPadding: -16.0,
onChanged: (i) => setState(() => _data = _cards[i])),
SizedBox(height: 10.0),
Expanded(child: AmountPage(_data)),
],
),
);
}
}

Conclusion:

In the article, I have explained the Card Selector of basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Card Selector 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 Card Selector in your flutter projectsWe will show you what the Introduction is?. Some card selector properties, make a demo program for working Card Selector and show a stacked card, animation, swiping cards left to right or right to left. Content will be change according to cards—a widget to select stacked widgets sliding left or right using the card_selector package 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.

find the source code of the Flutter Card Selector Demo:

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


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 FacebookGitHubTwitter, 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.

Related: Credit Card View In Flutter

Related: Stacked Card Carousel In Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.