Google search engine
Home Blog Page 24

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.


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.


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.


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.


Rating Dialog In Flutter

Flutter is a Free and Open Source project, and is created and kept up by Google, and is one reason we loved Flutter. Flutter gives lovely pre-built components, which are called Widgets in a flutter. Everything in flutter is a Widget!.

Showing some knowledge to the user is an amazing thought, and that is the most basic that we use dialogs. In Flutter, this astounding UI Toolkit, we have a few different ways to build Dialogs.

In this blog, we will explore the Rating Dialog In Flutter. We will see how to implement a demo program of rating dialog with beautiful and customize using the rating_dialog package in your flutter applications.

rating_dialog | Flutter Package
A beautiful and customizable Rating Dialog package for Flutter! It supports all platforms that flutter supports! To use…pub.dev

Table Of Contents::

Rating Dialog

Properties

Implementation

Code Implement

Code File

Conclusion



Rating Dialog:

Rating dialog is a wonderful and adaptable star Rating Dialog package for Flutter! It supports all stages that flutter supports!. This library is the best as it accompanies a star rating with contact, and even it empowers to swipe rating and glow to star review. It’s named as rating dialog since this library will identify this gesture you make on the flutter star icon to give the rating.

Demo Module :

This demo video shows how to create a rating dialog in a flutter. It shows how the rating dialog will work using the rating_dialog package in your flutter applications. It shows a beautiful and customizable start rating, and it enables to swipe rating to star review. It will be shown on your device.

Properties:

There are some properties of rating dialog are:

  • > message: This property is used to the dialog’s message/description text.
  • > ratingColor: This property is used to the rating bar (star icon & glow) color.
  • > initialRating: This property is used to the initial rating of the rating bar. Default rating is 1.
  • > force: This property is used to disables the cancel button and force the user to leave a rating.
  • > onSubmitted: This property is used to returns a RatingDialogResponse with the user’s rating and comment values.
  • > onCancelled: This property is used to call when the user cancels/closes the dialog.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

rating_dialog: 

Step 2: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/images/

Step 3: Import

import 'package:rating_dialog/rating_dialog.dart';

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

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

Container(
child: Center(
child: MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
color: Colors.cyan,
padding: EdgeInsets.only(left: 30,right: 30),
child: Text('Rating Dialog',style: TextStyle
(color: Colors.white,fontSize: 15),
),
onPressed: _showRatingAppDialog,
),
),
),

In the body, we will add a container widget. Inside the widget, we will add a center widget, and his child property adds a MaterialButton(). In this button, we will add text, color, button shape, and onPressed method. In this method, we will add a _showRatingAppDialog widget. We will deeply describe it below. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Home Screen

Now, we will deeply define _showRatingAppDialog widget

void _showRatingAppDialog() {
final _ratingDialog = RatingDialog(
ratingColor: Colors.amber,
title: 'Rating Dialog In Flutter',
message: 'Rating this app and tell others what you think.'
' Add more description here if you want.',
image: Image.asset("assets/images/devs.jpg",
height: 100,),
submitButton: 'Submit',
onCancelled: () => print('cancelled'),
onSubmitted: (response) {
print('rating: ${response.rating}, '
'comment: ${response.comment}');

if (response.rating < 3.0) {
print('response.rating: ${response.rating}');
} else {
Container();
}
},
);

showDialog(
context: context,
barrierDismissible: true,
builder: (context) => _ratingDialog,
);
}

In the _showRatingAppDialog(), we will add final _ratingDialog is equal to the RatingDialog() plugin. In this dialog, we will add ratingColor mean the rating bar (star icon & glow) color, titlemessage mean the dialog’s message/description text, imagesubmitButton mean the submit button’s label/text, onSubmitted mean to returns a RatingDialogResponse with user’s rating and comment values, onCancelled mean call when the user cancels/closes the dialog. Also, we will add showDilaog(). In this dialog, we will add context, barrierDismissible mean set to false if you want to force a rating, and navigated the builder to _ratingDialog. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Rating dialog

In this dialog, you will see we will add an image, title, description, star rating, textField for comment, and the last submit button. Also, we will add cancel on the top right corner cross icon.

Code File:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rating_dialog/rating_dialog.dart';

class DemoScreen extends StatefulWidget {
@override
_DemoScreenState createState() => _DemoScreenState();
}

class _DemoScreenState extends State<DemoScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.teal[50],
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Rating Dialog In Flutter'),
automaticallyImplyLeading: false,
),
body: Container(
child: Center(
child: MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
color: Colors.cyan,
padding: EdgeInsets.only(left: 30,right: 30),
child: Text('Rating Dialog',style: TextStyle
(color: Colors.white,fontSize: 15),
),
onPressed: _showRatingAppDialog,
),
),
),
);

}

void _showRatingAppDialog() {
final _ratingDialog = RatingDialog(
ratingColor: Colors.amber,
title: 'Rating Dialog In Flutter',
message: 'Rating this app and tell others what you think.'
' Add more description here if you want.',
image: Image.asset("assets/images/devs.jpg",
height: 100,),
submitButton: 'Submit',
onCancelled: () => print('cancelled'),
onSubmitted: (response) {
print('rating: ${response.rating}, '
'comment: ${response.comment}');

if (response.rating < 3.0) {
print('response.rating: ${response.rating}');
} else {
Container();
}
},
);

showDialog(
context: context,
barrierDismissible: true,
builder: (context) => _ratingDialog,
);
}

}

Conclusion:

In the article, I have explained the Rating Dialog basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Rating Dialog 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 Rating Dialog in your flutter projectsWe will show you what the Rating Dialog is?. Some rating dialog properties, make a demo program for working Rating Dialog and show a beautiful and customizable star rating. It enables you to swipe rating and glow to star review using the rating_dialog 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 Rating Dialog Demo:

flutter-devs/flutter_rating_dialog_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.


Reviews Slider In Flutter

0

The animation Is utilized to add enhanced visualizations to inform users that some part of the application’s state has changed. It gives your application a cleaned look that observes the quality of your application to the end-users. Flutter has a generally excellent animation library. I saw the distinctive review expressions animations, and It was one of the magnificent looking associations I at any point saw, Promptly we chose to make it demo.

Flutter is Google’s UI toolkit for building beautiful, Natively compiled mobile, web, and desktop applications from a single code base.

In this blog, we will explore the Reviews Slider In Flutter. We will see how to implement the demo program Reviews Slider with an animated changing smile using the reviews_slider package in your flutter applications.

reviews_slider | Flutter Package
Animated widget with changing smile to collect user review score Add reviews_slider: “^1.0.4” in your pubspec. yaml…pub.dev

Table Of Contents :

Reviews Slider

Implementation

Code Implement

Code File

Conclusion



Reviews Slider:

Reviews slider is an animated widget with changing smile to gather user survey scores. When the user taps the smile and rotates left to right or right to the left position, then changed the smile shape.

Demo Module :

This demo video shows how to use a reviews slider in a flutter. It shows how the reviews slider will work using the reviews_slider package in your flutter applications. It shows an animated widget with changing smiles when the user rotates smile left to right or right to left positioned and changed the shapes. It will be shown on your device.

Parameters:

There are some parameters of the reviews slider are:

  • > onChange: This parameter is used to trigger whenever a pointer has changed the slider’s value and is no longer in contact with the screen.
  • > options: This parameter is used for review titles like Good, Bad, Okay, etc.
  • > optionStyle: This parameter is used for the Text style of review titles like color, sizes, etc.
  • > initialValue: This parameter is used to the init value of the slider. Default value init value is 2.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:

reviews_slider:

Step 2: Import

import 'package:reviews_slider/reviews_slider.dart';

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

Step 4: 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 reviews_demo.dart inside the lib folder.

First, we will be creating an integer variable.

int selectedValue1;

We will add a variable on the void onChange1() method. In this method, we will add setState(). In this setState, we will add the selectedValue1 variable that is equal to the value.

void onChange1(int value) {
setState(() {
selectedValue1 = value;

});
}

In the body, we will add a column widget, and mainAxisAlignment was the center, and crossAxisAlignment was started. We will add a text and ReviewSlider(). In the ReviewSlider, we will add optionStyle means Text style of review titles like color, sizes, etc., and onChange means trigger whenever a pointer has changed the slider’s value and is no longer in contact with the screen. Also, we will add text selectedValue1.toString(). It will be displayed on the device.

Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'How was the service you received?',
style: TextStyle(color: Colors.black,
fontSize: 18),
),
SizedBox(height: 20),
ReviewSlider(
optionStyle: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
),
onChange: onChange1,
),
Text(selectedValue1.toString(),style: TextStyle(color: Colors.red),
),
],
),

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

Reviews Slider

Now, we will add more than one slider with a different color of text style.

Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'How was the service you received?',
style: TextStyle(color: Colors.black,
fontSize: 18),
),
SizedBox(height: 20),
ReviewSlider(
optionStyle: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
),
onChange: onChange1,
),
Text(selectedValue1.toString(),style: TextStyle(color: Colors.red),),
SizedBox(height: 20),
Text(
'Quality of our product?',
style: TextStyle(color: Colors.black, fontSize: 18),
),
SizedBox(height: 20),
ReviewSlider(
optionStyle: TextStyle(
color: Colors.orange,
fontWeight: FontWeight.bold,
),
onChange: onChange2,
initialValue: 1,
),
Text(selectedValue2.toString(),style: TextStyle(color: Colors.orange)),
SizedBox(height: 20),
Text(
'Price of our product?',
style: TextStyle(color: Colors.black, fontSize: 18),
),
SizedBox(height: 20),
ReviewSlider(
optionStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
onChange: onChange3,
initialValue: 3,
),
Text(selectedValue3.toString(),style: TextStyle(color: Colors.black)),
],
),

We will add three reviews slider with different text colors and also different initialValue, and different titles. 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:reviews_slider/reviews_slider.dart';


class ReviewsDemo extends StatefulWidget {
@override
_ReviewsDemoState createState() => _ReviewsDemoState();
}

class _ReviewsDemoState extends State<ReviewsDemo> {
int selectedValue1;
int selectedValue2;
int selectedValue3;

void onChange1(int value) {
setState(() {
selectedValue1 = value;

});
}

void onChange2(int value) {
setState(() {
selectedValue2 = value;
});
}
void onChange3(int value) {
setState(() {
selectedValue3 = value;
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey[50],
appBar: AppBar(
backgroundColor: Colors.cyan,
title: Text("Flutter Reviews Slider Demo"),
automaticallyImplyLeading: false,
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.only(left:18.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'How was the service you received?',
style: TextStyle(color: Colors.black,
fontSize: 18),
),
SizedBox(height: 20),
ReviewSlider(
optionStyle: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
),
onChange: onChange1,
),
Text(selectedValue1.toString(),style: TextStyle(color: Colors.red),),
SizedBox(height: 20),
Text(
'Quality of our product?',
style: TextStyle(color: Colors.black, fontSize: 18),
),
SizedBox(height: 20),
ReviewSlider(
optionStyle: TextStyle(
color: Colors.orange,
fontWeight: FontWeight.bold,
),
onChange: onChange2,
initialValue: 1,
),
Text(selectedValue2.toString(),style: TextStyle(color: Colors.orange)),
SizedBox(height: 20),
Text(
'Price of our product?',
style: TextStyle(color: Colors.black, fontSize: 18),
),
SizedBox(height: 20),
ReviewSlider(
optionStyle: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
onChange: onChange3,
initialValue: 3,
),
Text(selectedValue3.toString(),style: TextStyle(color: Colors.black)),
],
),
),
),
);
}
}

Conclusion:

In the article, I have explained the Reviews Slider of basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Reviews 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 Reviews Slider in your flutter projectsWe will show you what the Reviews Slider is?. Some reviews slider parameters, make a demo program for working Reviews Slider, and show a beautifully animated widget with changing smiles when the user rotates smile left to right or right to left positioned. The shapes were changed using the reviews_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 Reviews Slider Demo:

flutter-devs/flutter_reviews_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.


Spinwheel In Flutter

0

A Mobile Developer is otherwise called a mobile application developer or an application developer — is somebody who plans, develops, and executes mobile applications. They are answerable for the advancement of these software applications following suitable mobile platforms.

In this article, we will explore the Spinwheel In Flutter. We will also implement a demo program of spinwheel with customization options using the flutter_spinwheel package in your flutter applications.

flutter_spinwheel | Flutter Package
A widget that outputs items (text or image) along with a pan-able circular wheel/spinner with customization options.pub.dev

Table Of Contents::

Spinwheel

Features

Properties

Implementation

Code Implement

Code File

Conclusion



Spinwheel:

A widget that outputs things (text or picture) alongside a pannable roundabout wheel/spinner with customization alternatives. Which permits you to imagine arbitrary choice cycles. They are exceptionally adjustable and work across mobile, desktop, and the web.

Demo Module ::

This demo video shows how to use the spinwheel in a flutter. It shows how spinwheel will work using the flutter_spinwheel package in your flutter applications and shows that when you tap the item, then the spinner will move. Also, you will move the spinner in any direction clockwise/anti-clockwise. It will be shown the selected text on your device.

Features:

There are some features of spinwheel:

  • Auto-play (enable/disable)
  • Long-press to pause (enable/disable)
  • Size adjustments
  • Text/Image support
  • Image tweaking support
  • Clockwise and counter-clockwise pan to navigate
  • Touch to navigate in the previously panned direction
  • Paint customization to alter the look
  • Callback function to notify selected item

Properties:

There are some properties of spinwheel are:

  • > touchToRotate: This property is used to decides whether touching the spinner will make it rotate in the previously panned direction (default-clockwise).
  • > itemCount: This property is used to the number of menu-items given to the spinwheel class. Should handle it in the constructor.
  • > shouldDrawBorder: This property is used to determines whether should draw a border.
  • > hideOthers: This property is used to determines whether should draw the shutter to hide all options except selected.
  • > shutterPaint: This property is used to paint settings used for drawing the shutter if applicable. Also, it is Customizable.
  • > onChanged: This property is used to the callback that returns the selected value from the spinner menu every time the selection is changed.
  • > select: This property is used for the selection (highlighted) sector of the circle. The range is 0 (size of items). Imagine it just like an array. Selection numbering starts from 0.

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 get in the root directory of your app.

Step 4: 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 spinwheel_demo.dart inside the lib folder.

First, we will create a two list of string given by name called questions and answers. We will create a list of the dynamic list given by name choices. Also, we will create an integer given by name select.

List<String> questions;
List<List<dynamic>> choices;
List<String> answers;
int select;

We will create an initState() method. This method will add supper initState and all variables like questions, choices, select, and answers.

@override
void initState() {
super.initState();
questions = [
'Which programming language you will use?',
];
choices = [
['Kotlin', 'Swift', 'Dart', 'Java', 'Python', 'C#', 'Ruby', 'PHP'],
];
select = 0;
answers = ['', '', ''];
}

In the body, we will add ListView.builder(). In this builder, we will add itemCount and itemBuilder. In itemBuilder, we will navigate a container widget. Inside the widget, we will add a margin, height of the container. His child property, we will add a column widget. In this widget, we will add two texts was questions and answers.

ListView.builder(
itemCount: 1,
itemBuilder: (context, index) => Container(
margin: EdgeInsets.all(30.0),
height: MediaQuery.of(context).size.height / 1.7,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(questions[index],style: TextStyle(fontSize: 18,
color: Colors.black, fontWeight: FontWeight.bold),),
Text(answers[index],style: TextStyle(fontSize: 30,
color: Colors.cyanAccent,fontWeight: FontWeight.bold),),
Center(
child: Spinwheel(
size: MediaQuery.of(context).size.height*0.6,
items: choices[index][0] is String
? choices[index].cast<String>()
: null,
select: select,
autoPlay: false,
hideOthers: false,
shouldDrawBorder: true,
onChanged: (val) {
if (this.mounted)
setState(() {
answers[index] = val;
});
},
),
)
],
),
),
)),

Now, we will add a Spinwheel() package. In this package, we will add size means the square on which will draw the circular spinner, items mean will show that on the spinner. Each will get an equally separated sector of the circle; select means the position of the selection (highlighted) sector of the circle, autoPlay means set to true to autoplay, hideOthers means determines whether should draw the shutter to hide all options except selected, shouldDrawBorder means determines whether should draw a border, onChanged means the callback that returns the selected value from the spinner menu every time the selection is changed. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Spinwheel

Code File:

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_spinwheel/flutter_spinwheel.dart';


class SpinWheelDemo extends StatefulWidget {
@override
_SpinWheelDemoState createState() => _SpinWheelDemoState();
}

class _SpinWheelDemoState extends State<SpinWheelDemo> {
List<String> questions;
List<List<dynamic>> choices;
List<String> answers;
int select;

@override
void initState() {
super.initState();
questions = [
'Which programming language you will use?',
];
choices = [
['Kotlin', 'Swift', 'Dart', 'Java', 'Python', 'C#', 'Ruby', 'PHP'],
];
select = 0;
answers = ['', '', ''];
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey[200],
appBar: AppBar(
title: Text('Flutter SpinWheel Demo '),
automaticallyImplyLeading: false,
),
body: Scrollbar(
child: ListView.builder(
itemCount: 1,
itemBuilder: (context, index) => Container(
margin: EdgeInsets.all(30.0),
height: MediaQuery.of(context).size.height / 1.7,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(questions[index],style: TextStyle(fontSize: 18,
color: Colors.black, fontWeight: FontWeight.bold),),
Text(answers[index],style: TextStyle(fontSize: 30,
color: Colors.cyanAccent,fontWeight: FontWeight.bold),),
Center(
child: Spinwheel(
size: MediaQuery.of(context).size.height*0.6,
items: choices[index][0] is String
? choices[index].cast<String>()
: null,
select: select,
autoPlay: false,
hideOthers: false,
shouldDrawBorder: true,
onChanged: (val) {
if (this.mounted)
setState(() {
answers[index] = val;
});
},
),
)
],
),
),
)),
),
);
}
}

Conclusion:

In the article, I have explained the Spinwheel basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Spinwheel 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 Spinwheel in your flutter projectsWe will show you what the Spinwheel is?. Some spinwheel properties, features, make a demo program for working Spinwheel and show a wheel/spinner with customization options. This allows you to visualize random selection processes using the flutter_spinwheel 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 Spinwheel Demo:

flutter-devs/flutter_spinwheel_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.


Passcode Lock Screen In Flutter

Flutter just intrigued me with the pleasant UI stuff you could do effectively, and obviously, it permits you to create for both platforms simultaneously. Until the most recent year, I utilized touchID and FaceID as an authentication instrument. In any case, as indicated by the most recent Andriod prerequisites, you need to give an elective authentication strategy on the off chance that biometric auth is broken or impaired.

In this article, we will explore the Passcode Lock Screen In Flutter. We will see how to implement a demo program passcode lock screen using the passcode_screen package in your flutter applications.

passcode_screen | Flutter Package
A platform-agnostic Flutter package for showing passcode input screen, similar to Native iOS. Screen customizable with…pub.dev

Table Of Contents::

Passcode Lock Screen

Implementation

Code Implement

Code File

Conclusion



Passcode Lock Screen:

A stage agnostic Flutter package for showing password input screen, like Native iOS. Screen adaptable with colors, sizes, textual styles, and so on. It will show how to unlock the screen when using the passcode screen in your flutter application.

Demo Module :

This demo video shows how to create a passcode lock screen in a flutter. It shows how the passcode lock screen will work using the passcode_screen package in your flutter applications. It shows a passcode input screen to unlock the screen. It will be shown on your device.

Implementation :

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:

passcode_screen: 

Step 2: Import

import 'package:passcode_screen/passcode_screen.dart';

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

Step 4: 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 demo_page.dart inside the lib folder.

Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('You are ${isAuthenticated ? '' : 'not'}'
' authenticated',style: TextStyle(fontSize: 16),),
SizedBox(height: 10,),
_lockScreenButton(context),
],
),
),

On the main screen, we will add the text is “You are not authenticated,” which means the user can unlock the passcode screen then the text was changed authenticated. Otherwise, not authenticated is shown on your device. We will add a _lockScreenButton(context),. We will discuss it below.

_lockScreenButton(BuildContext context) => MaterialButton(
padding: EdgeInsets.only(left: 50,right: 50),
color: Theme.of(context).primaryColor,
child: Text('Lock Screen',style: TextStyle(color: Colors.white,
fontWeight: FontWeight.bold,fontSize: 17),),
onPressed: () {
_showLockScreen(
context,
opaque: false,
cancelButton: Text(
'Cancel',
style: const TextStyle(fontSize: 16, color: Colors.white,),
semanticsLabel: 'Cancel',
),
);
},
);

In _lockScreenButton(), we will use material button. We will add padding, color, text, and onPressed method inside the button, and we will add a _showLockScreen() widget on this method. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Main Screen

Now, we will deeply define _showLockScreen() widget.

_showLockScreen(BuildContext context,
{bool opaque,
CircleUIConfig circleUIConfig,
KeyboardUIConfig keyboardUIConfig,
Widget cancelButton,
List<String> digits}) {
Navigator.push(
context,
PageRouteBuilder(
opaque: opaque,
pageBuilder: (context, animation, secondaryAnimation) => PasscodeScreen(
title: Text(
'Enter Passcode',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white, fontSize: 28),
),
circleUIConfig: circleUIConfig,
keyboardUIConfig: keyboardUIConfig,
passwordEnteredCallback: _passcodeEntered,
cancelButton: cancelButton,
deleteButton: Text(
'Delete',
style: const TextStyle(fontSize: 16, color: Colors.white),
semanticsLabel: 'Delete',
),
shouldTriggerVerification: _verificationNotifier.stream,
backgroundColor: Colors.black.withOpacity(0.8),
cancelCallback: _passcodeCancelled,
digits: digits,
passwordDigits: 6,
bottomWidget: _passcodeRestoreButton(),
),
));
}

In this widget, we will add PasscodeScreen(). Inside the screen, we will add a title, inbuilt config of circle, and keyboard. We will add a passwordEnteredCallback method. In this method, add a _passcodeEntered widget, and we will define below. Add a cancelButton, deleteButton, shouldTriggerVerification, cancelCallback, password digits, and bottomWidget.

final StreamController<bool> _verificationNotifier = StreamController<bool>.broadcast();
_passcodeEntered(String enteredPasscode) {
bool isValid = storedPasscode == enteredPasscode;
_verificationNotifier.add(isValid);
if (isValid) {
setState(() {
this.isAuthenticated = isValid;
});
}
}

Passcode input completed callback and notify passcode screen if passcode correct or not. Users can add any storedPasscodelike 654321, etc. If the password was valid, then authenticated the screen. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Passcode Screen

Don’t forget to close a stream. Users can dispose of it.

@override
void dispose() {
_verificationNotifier.close();
super.dispose();
}

Now, we will deeply define _passcodeRestoreButton() widget.

Align(
alignment: Alignment.bottomCenter,
child: Container(
margin: const EdgeInsets.only(bottom: 10.0, top: 20.0),
child: FlatButton(
child: Text(
"Reset passcode",
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w300),
),
splashColor: Colors.white.withOpacity(0.4),
highlightColor: Colors.white.withOpacity(0.2),
onPressed: _resetApplicationPassword,
),
),
);

In this widget, we will add a container. Inside, we will add a FlatButton(). In this button, we will add text, splash color, highlight color, and onPressed method add a _resetApplicationPassword widget.

_resetApplicationPassword() {
Navigator.maybePop(context).then((result) {
if (!result) {
return;
}
_restoreDialog(() {
Navigator.maybePop(context);
});
});
}

In this widget, if the result is equal to the result, then navigate pop. Otherwise, _restoreDialog() widget and then pop.

_restoreDialog(VoidCallback onAccepted) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
backgroundColor: Colors.teal[50],
title: Text(
"Reset passcode",
style: const TextStyle(color: Colors.black87),
),
content: Text(
"Passcode reset is a non-secure operation!\nAre you sure want to reset?",
style: const TextStyle(color: Colors.black87),
),
actions: <Widget>[
// usually buttons at the bottom of the dialog
FlatButton(
child: Text(
"Cancel",
style: const TextStyle(fontSize: 18),
),
onPressed: () {
Navigator.maybePop(context);
},
),
FlatButton(
child: Text(
"I proceed",
style: const TextStyle(fontSize: 18),
),
onPressed: onAccepted,
),
],
);
},
);
}

In this widget, we will create a show dialog. In this dialog, we will return an AlertDialog(). Inside we will add a title, content, and FlatButton(). When we run the application, we ought to get the screen’s output like the underneath screen capture.

Reset Dialog

Code File:

https://gist.github.com/ShaiqAhmedkhan/8af9c54813718ccfb6cde4a534197d08#file-demo_page-dart

Conclusion:

In the article, I have explained the Passcode Lock Screen basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Passcode Lock Screen 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 Passcode Lock Screen in your flutter projectsWe will show you what the Passcode Lock Screen is?. Make a demo program for working Passcode Lock Screen and show a passcode input screen to unlock the screen and beautiful reset dialog using the passcode_screen 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 Passcode Lock Screen Demo:

flutter-devs/flutter_passcode_lock_screen_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.


Credit Card View In Flutter

0

A couple of days prior, I was perusing LinkedIn when I ran over a pleasant Credit Card Entry Form for web and mobile devices. I chose to accept that as a test and implement it utilizing Flutter.

With accommodation at the forefront, numerous mobile applications are integrating a payment alternative, and a large portion of them uphold credit or debit card payment. So we think of a package that permits you to add a CreditCard UI to your application effortlessly.

In this blog, we will explore the Credit Card View In Flutter. We will see how to implement the Credit cards UI easily with the Card detection using the flutter_credit_card package in your flutter applications.

flutter_credit_card | Flutter Package
A Flutter package allows you to easily implement the Credit card’s UI with the Card detection.pub.dev.

Table Of Contents::

Flutter Credit Card

Implementation

Code Implement

Code File

Conclusion



Flutter Credit Card:

A Credit Card widget package, uphold entering card details, card flip animation. A Flutter package permits you to effectively implement the Credit card’s UI easily with Card detection.

Demo Module :

This demo video shows how to create a credit card in a flutter. It shows how the credit card will work using the flutter_credit_card package in your flutter applications. It shows card detection, validation, animation, and dialog box. It will be shown on your device.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:

flutter_credit_card: 

Step 2: Import

import 'package:flutter_credit_card/flutter_credit_card.dart';

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

Step 4: 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 credit_card_page.dart inside the lib folder.

First, we will add CreditCardWidget():

CreditCardWidget(
cardNumber: cardNumber,
expiryDate: expiryDate,
cardHolderName: cardHolderName,
cvvCode: cvvCode,
showBackView: isCvvFocused,
),

In CreditCardWidget() has some required fields that cannot be null, such as cardNumber means the user can add our card number for card detecting, expiryDate means the user can add our card expiry date in a month and year format, cardHolderName means the user can add our name of the person on the front of the credit cardcvvCode means the user can add our cvv number is a 3-digit code printed at the back of a credit or a debit cardshowBackView means true when you want to show cvv(back) view.

CreditCardWidget(
cardNumber: cardNumber,
expiryDate: expiryDate,
cardHolderName: cardHolderName,
cvvCode: cvvCode,
showBackView: isCvvFocused,
cardbgColor: Colors.black,
obscureCardNumber: true,
obscureCardCvv: true,
height: 175,
textStyle: TextStyle(color: Colors.yellowAccent),
width: MediaQuery.of(context).size.width,
animationDuration: Duration(milliseconds: 1000),
),

CreditCardWidget() also has some optional parameters that let you modify this widget as per your need. Like add a cardbgColor means the user add any color, height, width, obscureCardNumberobscureCardCvvanimation-duration, etc.

Now, we will be adding a CreditCardWidget()

CreditCardForm(
formKey: formKey,
onCreditCardModelChange: onCreditCardModelChange,
obscureCvv: true,
obscureNumber: true,
cardNumberDecoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: 'Number',
hintText: 'XXXX XXXX XXXX XXXX',
),
expiryDateDecoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: 'Expired Date',
hintText: 'XX/XX',

),
cvvCodeDecoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: 'CVV',
hintText: 'XXX',
),
cardHolderDecoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: 'Card Holder Name',
),
),

In this CreditCardForm(), we will add a formkey. Users can create the final globalkey.

final GlobalKey<FormState> formKey = GlobalKey<FormState>();

We will add onCreditCardModelChange. In this function, the user can add Strings of cardNumber, expiryDate, cvv, etc.

void onCreditCardModelChange(CreditCardModel creditCardModel) {
setState(() {
cardNumber = creditCardModel.cardNumber;
expiryDate = creditCardModel.expiryDate;
cardHolderName = creditCardModel.cardHolderName;
cvvCode = creditCardModel.cvvCode;
isCvvFocused = creditCardModel.isCvvFocused;
});
}

We will add a cardNumberDecoration means users can write a card number on this decoration box and show it on our credit card. expiryDateDecoration means users can write an expiry date on this decoration box and show it on our credit card. cvvCodeDecoration means users can write a cvv code on this decoration box, and then the card will allow animated reverse and show it on our credit card. cardHolderDecoration means users can write the person’s name on the credit card’s front on this decoration box and show it on our credit card. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Credit Card View

Now, we will add a button for validation. When the user fills in all forms properly, the card will be fine; otherwise, they will show some errors.

RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
child: Container(
margin: const EdgeInsets.all(8),
child: const Text(
'Validate',
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
),
color: const Color(0xff1b447b),
onPressed: () {
if (formKey.currentState.validate()) {
print('valid!');
_showValidDialog(context,"Valid","Your card successfully valid !!!");
} else {
print('invalid!');
}
},
)

In the RaisedButton(), we will add the text “validate” and wrap it to the container. onPressed method, we will add if fromkey is validated, then print valid and open a _showValidDialog(). Otherwise, they will give an error.

Now, we will define _showValidDialog()

Future <AlertDialog> _showValidDialog(BuildContext context, String title, String content,) {
showDialog<AlertDialog>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
backgroundColor: Color(0xff1b447b),
title: Text(title),
content: Text(content),
actions: [
FlatButton(
child: Text(
"Ok",
style: TextStyle(fontSize: 18,color: Colors.cyan),
),
onPressed: () {
Navigator.of(context).pop();
}),
],
);
},
);
}

In this dialog, we will add context, return an AlertDailog(). Inside AlertDialog, we will title, content, and actions. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Dialog Box

Code File:

https://gist.github.com/ShaiqAhmedkhan/fa1c1eea56e74194ebc79ca5b2af1818#file-credit_card_page-dart

Conclusion:

In the article, I have explained the Credit Card View of basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Credit Card View 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 Credit Card View in your flutter projectsWe will show you what the Flutter Credit Card is in the introduction part?. Make a demo program for working Credit Card and show a card detection, validation, animation, and dialog box using the flutter_credit_card 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 Credit Card View Demo:

flutter-devs/flutter_credit_card_view_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.


Explore Sliding Card In Flutter

Flutter allows you to make delightful, natively compiled applications. The explanation Flutter can do this is that Flutter loves Material. Material is a design framework that helps construct high-quality, digital experiences. As UI configuration keeps advancing, Material keeps on refreshing its components, motion, and design system.

In this blog, we will explore the Sliding Card In Flutter. We will also implement a demo program and learn to create a sliding card with a sliding animation effect using the sliding_card package in your flutter applications.

sliding_card | Flutter Package
The sliding card is a highly customizable flutter package that will help you create beautiful Cards with a sliding…pub. dev

Table Of Contents :

Sliding Card

Properties

Implementation

Code Implement

Code File

Conclusion



Sliding Card :

The Sliding card is a profoundly adjustable flutter package that will help you make delightful Cards with a sliding animation impact. Users can easily add any content to the card for use flutter application.

Demo Module :

This demo video shows how to create a sliding card in a flutter. It shows how the sliding card will work using the sliding_card package in your flutter applications. It shows a bouncing animation of a card that separates into two different cards open. It will be shown on your device.

Properties:

There are some properties of a sliding card are:

  • > slidingAnimationReverseCurve: This property is used to the curve of the sliding animation when reserving. It is preferable to leave it to its default value.
  • > hiddenCardHeight: This property is used to height the hidden card less than or equal to 90% of the frontCard Widget.
  • > frontCardWidget: This property is used to the widget to be displayed on the front.

Note: It’s parent widget is a container.

  • > backCardWidget: This property is used to the widget to be displayed on the back. Its height should be less than or equal to the height of the front card.
  • > animateOpacity: This property is used to this gives a good visual effect. Leave this to true for a more realistic.
  • > slidingAnimmationForwardCurve: This property is used to the curve of the sliding animation when expanding. It is preferable to leave it to its default value

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

sliding_card: 

Step 2: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/images/

Step 3: Import

import 'package:sliding_card/sliding_card.dart';

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

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 SlidingCardController and give any name. We will create an initState() method. In this method, we will add a supper dot initstate(), and the controller is equal to the SlidingCardController(). SlidingCardController() Class is used to control the opening and closing of the card.

SlidingCardController controller ;
@override
void initState() {
super.initState();
controller = SlidingCardController();
}

In the body, we will add a center widget. Inside the widget, we will add the column widget and add the InterviewCard()class. In this class, we will add the onTapped function; if the controller isCardSeparated is true, then it is collapsed the card else expanded the card. Below, we will deeply define InterviewCard()class.

Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
InterviewCard(
onTapped: () {
if(controller.isCardSeparated == true)
{
controller.collapseCard();
}
else
{
controller.expandCard();
}
},
slidingCardController: controller,
)
],
),
),

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

We will create two constructors that are slidingCardController and onTapped function.

const InterviewCard({
Key key,
this.slidingCardController , @required this.onTapped
}) : super(key: key);

final SlidingCardController slidingCardController;
final Function onTapped;

Now, we will return a GestureDetector(). Inside we will add an OnTap function and child property. It’s Child property, and we will add SlidingCard(). Inside SlidingCard, we will add a slimeCardElevation, bounceInOut curves are slidingAnimationReverseCurvecardsGap is space between the two cards, controllerslidingCardWidth is the width of the overall card, visibleCardHeight is the height of the front card, hiddenCardHeight is the height of the back card, It cannot be greater than the height of the front card. frontCardWidget, and backCardWidget we will describe below.

return GestureDetector(
onTap: (){
widget.onTapped();
},
child: SlidingCard(
slimeCardElevation: 0.5,
slidingAnimationReverseCurve: Curves.bounceInOut,
cardsGap: DeviceSize.safeBlockVertical,
controller: widget.slidingCardController,
slidingCardWidth: DeviceSize.horizontalBloc * 90,
visibleCardHeight: DeviceSize.safeBlockVertical * 27,
hiddenCardHeight: DeviceSize.safeBlockVertical * 15,
frontCardWidget: InterviewFrontCard(...),
backCardWidget: InterviewBackCard(...),
);

Now, we will deeply describe frontCardWidget:

In the frontCardWidget, we will create a class InterviewFrontCard(). We will add a title, image, name, surname, two buttons, and an info icon to this card. When the user taps the icon, then the card was expanded, and again tap then collapsed the card.

InterviewFrontCard(
candidateName: '@Astin',
candidateSurname: 'Martin',
interviewDate: '9 March 2021 ',
interviewTime: '2:30Pm',
onInfoTapped: () {
print('info pressed');
widget.slidingCardController.expandCard();
},
onDecline: () {
print('Declined');
},
onAccept: () {
print('Accepted');
},
onCloseButtonTapped: (){
widget.slidingCardController.collapseCard();
},
),

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

frontCardWidget

Now, we will deeply describe backCardWidget:

In the backCardWidget, we will create a class InterviewBackCard(). In this card, we will add a title, content, and phone icon. When the user taps the info icon, then it will be shown the back card, and otherwise not.

InterviewBackCard(
onPhoneTapped: (){},
companyInfo: "FlutterDevs specializes in creating cost-effective and efficient "
"applications with our perfectly crafted."
),

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

backCardWidget

Code File:

import 'package:flutter/material.dart';
import 'package:sliding_card/sliding_card.dart';
import 'interview_back_card.dart';
import 'interview_front_card.dart';
import 'device_size.dart';

class InterviewCard extends StatefulWidget {
const InterviewCard({
Key key,
this.slidingCardController , @required this.onTapped
}) : super(key: key);

final SlidingCardController slidingCardController;
final Function onTapped;

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

class _InterviewCardState extends State<InterviewCard> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: (){
widget.onTapped();
},
child: SlidingCard(
slimeCardElevation: 0.5,
slidingAnimationReverseCurve: Curves.bounceInOut,
cardsGap: DeviceSize.safeBlockVertical,
controller: widget.slidingCardController,
slidingCardWidth: DeviceSize.horizontalBloc * 90,
visibleCardHeight: DeviceSize.safeBlockVertical * 27,
hiddenCardHeight: DeviceSize.safeBlockVertical * 15,
frontCardWidget: InterviewFrontCard(
candidateName: '@Astin',
candidateSurname: 'Martin',
interviewDate: '9 March 2021 ',
interviewTime: '2:30Pm',
onInfoTapped: () {
print('info pressed');
widget.slidingCardController.expandCard();
},
onDecline: () {
print('Declined');
},
onAccept: () {
print('Accepted');
},
onCloseButtonTapped: (){
widget.slidingCardController.collapseCard();
},
),
backCardWidget:InterviewBackCard(
onPhoneTapped: (){},
companyInfo: "FlutterDevs specializes in creating cost-effective and efficient "
"applications with our perfectly crafted."
),
),
);
}
}

Conclusion :

In the article, I have explained the Sliding Card basic structure in a flutter; you can modify this code according to your choice. This was a small introduction to Sliding Card 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 Sliding Card in your flutter projectsWe will show you what the Sliding Card is?. Some sliding card properties, make a demo program for working Sliding Card and show a beautiful bounceInOut animation of a Card with a sliding animation effect that separates into two different Cards, one at the front and then another at the back using the sliding_card 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 Sliding Card Demo:

flutter-devs/flutter_sliding_card_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.