Google search engine
Home Blog Page 52

Basics of Riverpod | Flutter

Introduction :

Riverpod is also a state management solution in a flutter. It a basically a Provider, but of a different type. It has some advantages over a provider in that it is compile safe, does not have any limitation as a provider have and does not also depend on flutter. Riverpod support multiple providers of the same type, combining asynchronous provider, adding providers from anywhere.

Before starting our blog, let us know what topic will be going to cover-up


Table of contents:

Using Provider in Riverpod to build UI

Using StateProvider in Riverpod to change state of UI

Setup:

Before starting let us first start with the basics of installing up Riverpod

Add this dependency to pubsec.yaml file:

Let us understand the concept by building a basic “Hello World” UI…

Note: Before starting to code install a Flutter Riverpod Snippet to code fast and efficiently.

Lets code :

As you can see in the above code we have to first wrap our code with ProviderScope above to use the Riverpod with provider class in our code as we have done.

As you can see above we have created a normal provider named as numberProvider which contains the string ‘Hello World’.

As you can see above in MyHome class extends ConsumerWidget instead of the stateless widget to remove hectic coding which gave us the advantage not to use the Consumer widget instead. The final value variable is used to get a value of which is stored in numberProvider which is wrapped with a watch widget to get the value of the provider which can be later used in our UI.

The above UI looks like this:

Using StateProvider in Riverpod to change UI :

Let us node see how to use StateProvider to change the state of a UI

Lets code:

As you can see above we have used StateProvider which contains an integer return type. The numberStateProvider variable contains a value of state provider.

The numberState variable is used here to fetch a value of StateProvider here.

The above code UI looks like this and state change are performed are shown as :


For more info visit down the link:

Getting started | Riverpod
Before diving into the inner mechanisms of Riverpod, let’s start with the basics: Installing up Riverpod, then writing…riverpod.dev

Thanks for reading this article ❤

Clap 👏 If this article helps you.

Feel free to post any queries or corrections you think are required…✔

From Our Parent Company Aeologic

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

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

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

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

Customized Calendar in Flutter

In mobile apps, there are lots of cases where a user needs to enter the date like date of birth, book a ticket, scheduling a meeting, etc.

In this article, we’ll create a custom calendar using the flutter_calendar_carousel package. This calendar widget is swappable horizontally. This widget can help you build your own calendar widget highly customizable. Now you can even add your icon for each event

flutter_calendar_carousel | Flutter Package
Calendar widget for flutter that is swipeable horizontally. This widget can help you build your own calendar widget…pub.dev


Table of Contents :

Introduction

Setup

Code Implementation

Code File

Conclusion


Introduction

Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase. It fulfills all the custom needs and requirements.

A calendar is a system to organize dates, meetings, etc. It keeps a record of all the events which will happen on particular dates.

Setup

This section explains the steps required to use the calendar and its basic features.

Add dependency

Start by adding the dependency to the pubspec.yml file

dependencies:
flutter_calendar_carousel: ^latest version

import package in the code

import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart';

Code implementation

Create variables for storing current date-time, target-date time, and current month and also make a reference of CalendarCarousel.

DateTime _currentDate = DateTime.now();
DateTime _currentDate2 = DateTime.now();
String _currentMonth = DateFormat.yMMM().format(DateTime.now());
DateTime _targetDateTime = DateTime.now();

CalendarCarousel _calendarCarouselNoHeader;

Now initializing the object of _calendarCarouselNoHeader

Now add the next and previous button and on click of button change calendar date month.

In this snippet, we are using a carousel calendar and we can also customize our calendar.

Code file

import 'package:flutter/material.dart';
import 'package:flutter_calendar_carousel/classes/event.dart';
import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart';
import 'package:intl/intl.dart';

class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
DateTime _currentDate = DateTime.now();
DateTime _currentDate2 = DateTime.now();
String _currentMonth = DateFormat.yMMM().format(DateTime.now());
DateTime _targetDateTime = DateTime.now();

CalendarCarousel _calendarCarouselNoHeader;

static Widget _eventIcon = new Container(
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(1000)),
border: Border.all(color: Colors.blue, width: 2.0)),
child: new Icon(
Icons.person,
color: Colors.amber,
),
);

EventList<Event> _markedDateMap = new EventList<Event>(
events: {
new DateTime(2020, 2, 10): [
new Event(
date: new DateTime(2020, 2, 14),
title: 'Event 1',
icon: _eventIcon,
dot: Container(
margin: EdgeInsets.symmetric(horizontal: 1.0),
color: Colors.red,
height: 5.0,
width: 5.0,
),
),
new Event(
date: new DateTime(2020, 2, 10),
title: 'Event 2',
icon: _eventIcon,
),
new Event(
date: new DateTime(2020, 2, 15),
title: 'Event 3',
icon: _eventIcon,
),
],
},
);

@override
void initState() {
_markedDateMap.add(
new DateTime(2020, 2, 25),
new Event(
date: new DateTime(2020, 2, 25),
title: 'Event 5',
icon: _eventIcon,
));

_markedDateMap.add(
new DateTime(2020, 2, 10),
new Event(
date: new DateTime(2020, 2, 10),
title: 'Event 4',
icon: _eventIcon,
));

_markedDateMap.addAll(new DateTime(2019, 2, 11), [
new Event(
date: new DateTime(2019, 2, 11),
title: 'Event 1',
icon: _eventIcon,
),
new Event(
date: new DateTime(2019, 2, 11),
title: 'Event 2',
icon: _eventIcon,
),
new Event(
date: new DateTime(2019, 2, 11),
title: 'Event 3',
icon: _eventIcon,
),
]);
super.initState();
}

@override
Widget build(BuildContext context) {
_calendarCarouselNoHeader = CalendarCarousel<Event>(
todayBorderColor: Colors.green,
onDayPressed: (DateTime date, List<Event> events) {
this.setState(() => _currentDate2 = date);
events.forEach((event) => print(event.title));
},
daysHaveCircularBorder: true,
showOnlyCurrentMonthDate: false,
weekendTextStyle: TextStyle(
color: Colors.red,
),
thisMonthDayBorderColor: Colors.grey,
weekFormat: false,
// firstDayOfWeek: 4,
markedDatesMap: _markedDateMap,
height: 420.0,
selectedDateTime: _currentDate2,
targetDateTime: _targetDateTime,
customGridViewPhysics: NeverScrollableScrollPhysics(),
markedDateCustomShapeBorder:
CircleBorder(side: BorderSide(color: Colors.yellow)),
markedDateCustomTextStyle: TextStyle(
fontSize: 18,
color: Colors.blue,
),
showHeader: false,
todayTextStyle: TextStyle(
color: Colors.blue,
),

todayButtonColor: Colors.yellow,
selectedDayTextStyle: TextStyle(
color: Colors.yellow,
),
minSelectedDate: _currentDate.subtract(Duration(days: 360)),
maxSelectedDate: _currentDate.add(Duration(days: 360)),
prevDaysTextStyle: TextStyle(
fontSize: 16,
color: Colors.pinkAccent,
),
inactiveDaysTextStyle: TextStyle(
color: Colors.tealAccent,
fontSize: 16,
),
onCalendarChanged: (DateTime date) {
this.setState(() {
_targetDateTime = date;
_currentMonth = DateFormat.yMMM().format(_targetDateTime);
});
},
onDayLongPressed: (DateTime date) {
print('long pressed date $date');
},
);

return new Scaffold(
appBar: new AppBar(
title: new Text('Calendar'),
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
//custom icon

Container(
margin: EdgeInsets.only(
top: 30.0,
bottom: 16.0,
left: 16.0,
right: 16.0,
),
child: new Row(
children: <Widget>[
Expanded(
child: Text(
_currentMonth,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 24.0,
),
)),
FlatButton(
child: Text('PREV'),
onPressed: () {
setState(() {
_targetDateTime = DateTime(
_targetDateTime.year, _targetDateTime.month - 1);
_currentMonth =
DateFormat.yMMM().format(_targetDateTime);
});
},
),
FlatButton(
child: Text('NEXT'),
onPressed: () {
setState(() {
_targetDateTime = DateTime(
_targetDateTime.year, _targetDateTime.month + 1);
_currentMonth =
DateFormat.yMMM().format(_targetDateTime);
});
},
)
],
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 16.0),
child: _calendarCarouselNoHeader,
), //
],
),
));
}
}

Output

Conclusion

In this article, I have explained the custom calendar package demo which you can modify and experiment with according to your own. This little introduction was about making a custom calendar.

I hope this blog will provide you with sufficient information in trying up to use the custom calendar in your flutter projects. We will show this demo program for working custom calendars 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.

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.

Clap 👏 If this article helps you.


Flip Animation In Flutter

0

Flutter widget is built using a modern framework. It is like a react. In this, we start with the widget to create any application. Each component in the screen is a widget. The widget describes this of what his outlook should be given his present configuration and condition. Widget shows were similar to its idea and current setup and state.

In this article, we will Explore Flip Animation In Flutter Using the flip_card package With the help of the package, we can easily achieve flutter flip animation card and describes his some properties and how to use them in your flutter applications. So let’s get started.


Table Of Contents:

Flip Animation

Code Implementation

Code File

Conclusion


Flip Animation:

This Component that provides flip card animation. It is used to hide and show a product. The card will flip when touched. We can flip it vertically or in the horizontal direction. Let us understand some of its properties.

Properties of the Flip Card:

The following are the basic properties of the Flip Card.

  1. front: With the help of front properties, we rotate our card 90 degrees from back to front.
  2. back: With the help of back properties, we rotate our card 90–180 degrees from front to back.
  3. speed: We use speed properties to manage the speed of the card.
  4. fliponTouch: We use the fliponTouch properties when we do not have to rotate the card or image. And it is a bool type.
  5. direction: We can rotate it vertically and horizontally using the direction property.

Demo Module:

This demo module video uses a flip card package. In which there are two different containers, which when pressed, will rotate vertically and horizontally

Implementation :

You need to implement it in your code respectively:

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

Step 1: Add dependencies.

Add dependencies to pubspec — yaml file.

dependencies:
flip_card: ^0.4.4

Step 2: import the package :

import 'package:flip_card/flip_card.dart';

Step 3: Run flutter package get

In this screen, we have two different containers. In which we have used the flip card package and wrap the container with FlipCard. In this, we have rotated it vertically and horizontally with the help of the direction property. And there is different colour and text on the front and backside of the container.

Let us understand this with the help of a reference.

FlipCard(
direction: FlipDirection.HORIZONTAL,

front: Stack(
alignment: Alignment.center,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.orange.shade200,
),
),
Text(
'Front',
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.w600),
),
],
),
back: Stack(
alignment: Alignment.center,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.blue.shade400,
),
),
Text(
'Back',
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.w600),
),
],
),
),

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

Code File:

import 'dart:ui';

import 'package:flip_card/flip_card.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';

class FlipAnimationDemo extends StatefulWidget {
@override
_FlipAnimationDemoState createState() => _FlipAnimationDemoState();
}

class _FlipAnimationDemoState extends State<FlipAnimationDemo> {
double _height;
double _width;

@override
Widget build(BuildContext context) {
_height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width;
return Scaffold(
appBar: AppBar(
title: Text('Flip Animation Demo'),
),
body: Container(
width: _width,
height: _height,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
children: [
Text(
'Vertical Flip Animation',
style: TextStyle(
color: Colors.black,
fontSize: 18,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w600,
letterSpacing: 0.5),
),
Container(
width: 180,
height: 180,
margin: EdgeInsets.only(top: 20),
child: FlipCard(
direction: FlipDirection.VERTICAL, // default
front: Stack(
alignment: Alignment.center,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.blue.shade400,
),
),
Text(
'Front',
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.w600),
),
],
),
back: Stack(
alignment: Alignment.center,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.orange.shade200,
),
),
Text(
'Back',
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.w600),
),
],
),
),
),
],
),
Column(
children: [
Text(
'Horizontal Flip Animation',
style: TextStyle(
color: Colors.black,
fontSize: 18,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w600,
letterSpacing: 0.5),
),
Container(
width: 180,
height: 180,
margin: EdgeInsets.only(top: 20),
child: FlipCard(
direction: FlipDirection.HORIZONTAL,

front: Stack(
alignment: Alignment.center,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.orange.shade200,
),
),
Text(
'Front',
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.w600),
),
],
),
back: Stack(
alignment: Alignment.center,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.blue.shade400,
),
),
Text(
'Back',
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.w600),
),
],
),
),
),
],
),
],
),
),
);
}
}

Conclusion:

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

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

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

Clap 👏 If this article helps you.

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


From Our Parent Company Aeologic

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

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

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

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

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

Animated Cross Fade in Flutter

0

Hello friends, I have written my new blog on Animated Cross Fade In Flutter. We will also implement a demo of the Animated Cross Fade, and describes his properties, and how to use them in your flutter applications. So let’s get started.


Table Of Contents:

Flutter

Animated Cross Fade

Code Implementation

Code File

Conclusion


Flutter :

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

Animated Cross Fade:

The Cross Fade widget which is a crossfade between given children and animates itself between its shapes. Crossfade is animated in the same place and changes its shape and colour. And we can use it in any other widget I can do such as text images, etc. The animation is controlled through the crossFadeState parameter. Let us understand some of its properties.

Properties of the Animated Cross Fade:

1.firstChild: First Child Properties that represents the first widget of the tree. And what it appears before the second widget is erased by the transition.

2. secondChild: The secondChild properties will represent the second widget to which the first child will transitions.

3. firstCurve/secondCurve: The animation effects first curve and second curve first child and second child. The default value of both of these is Curves.linear.

4.sizeCurve: The sizeCurve is the curve used to animate between the size of the fading-out child and the size of the fading-in child..

5. alignment: Alignment property defines how the children should align.

6. crossFadeState: The CrossFadeState itself determines which child to show and which second to show CrossFadeState.The child that is visible when crossFadeState is CrossFadeState.showSecond. It fades in when transitioning crossFadeState from CrossFadeState.showFirst to CrossFadeState.showSecond and vice versa.

7. duration: In Duration property, we can set the time taken in animation.

8. reverseDuration: TheReverse duration property we can set the time taken in animation to be completed in reverse order.

9. layoutBuilder: You can use a custom layout builder for positioning the widget during the transition.

Demo Module:

Code Implementation:

In this screen, we have taken two images. Which we have initialized inside the first child and second child properties. And clicking on the image shows the second image to be animated. The stateful widget is required to implement the AnimatedCrossFade widget.

Let us understand this with the help of a reference.

First, we will define a bool variable.

bool _firstChild = false;

Implemented the AnimatedCrossFade widget.Which has defined its duration inside crossFadeState.

AnimatedCrossFade(
firstCurve: Curves.easeInCubic,
secondCurve: Curves.easeInCirc,
firstChild: InkWell(
onTap: () {
setState(() {
_firstChild = !_firstChild;
});
},
child: Container(
child: ClipOval(
child: CircleAvatar(
maxRadius: 100,
child: Image.asset(
'assets/images/logo.png',
fit: BoxFit.fill,
),
),
),
alignment: Alignment.center,
),
),
secondChild: InkWell(
onTap: () {
setState(() {
_firstChild = !_firstChild;
});
},
child: Container(
height: 250,
width: 250,
child: Image.asset(
'assets/images/event_2.png',
fit: BoxFit.cover,
),
color: Colors.amberAccent.shade700,
),
),
crossFadeState:
_firstChild ? CrossFadeState.showFirst : CrossFadeState.showSecond,
duration: Duration(seconds: 2),
layoutBuilder: (
Widget topChild,
Key topChildKey,
Widget bottomChild,
Key bottomChildKey,
) {
return Stack(
clipBehavior: Clip.none,
alignment: Alignment.center,
children: [
PositionedDirectional(
child: bottomChild,
key: bottomChildKey,
top: 0,
),
PositionedDirectional(
child: topChild,
key: topChildKey,
),
],
);
},
),

The AnimatedCrossFade widget results can be seen in the given below image.

Code File:

import 'package:flutter/material.dart';

class CrossFadeAnimationDemo extends StatefulWidget {
@override
_CrossFadeAnimationDemoState createState() => _CrossFadeAnimationDemoState();
}

class _CrossFadeAnimationDemoState extends State<CrossFadeAnimationDemo> {
bool _firstChild = false;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar:AppBar(
title:Text('CrossFade Animation'),
),
body: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.all(16.0),
width: double.infinity,
height: 60,
color: Colors.orange.shade200,
),
AnimatedCrossFade(
firstCurve: Curves.easeInCubic,
secondCurve: Curves.easeInCirc,
firstChild: InkWell(
onTap: () {
setState(() {
_firstChild = !_firstChild;
});
},
child: Container(
child: ClipOval(
child: CircleAvatar(
maxRadius: 100,
child: Image.asset(
'assets/images/logo.png',
fit: BoxFit.fill,
),
),
),
alignment: Alignment.center,
),
),
secondChild: InkWell(
onTap: () {
setState(() {
_firstChild = !_firstChild;
});
},
child: Container(
height: 250,
width: 250,
child: Image.asset(
'assets/images/event_2.png',
fit: BoxFit.cover,
),
color: Colors.amberAccent.shade700,
),
),
crossFadeState:
_firstChild ? CrossFadeState.showFirst : CrossFadeState.showSecond,
duration: Duration(seconds: 2),
layoutBuilder: (
Widget topChild,
Key topChildKey,
Widget bottomChild,
Key bottomChildKey,
) {
return Stack(
clipBehavior: Clip.none,
alignment: Alignment.center,
children: [
PositionedDirectional(
child: bottomChild,
key: bottomChildKey,
top: 0,
),
PositionedDirectional(
child: topChild,
key: topChildKey,
),
],
);
},
),
Container(
margin: EdgeInsets.all(16.0),
width: double.infinity,
height: 60,
color: Colors.red.shade200,
),
],
),
),
);
}
}

Conclusion:

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

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

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

Clap 👏 If this article helps you.

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


From Our Parent Company Aeologic

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

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

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

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

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

PhysicalModel Widget in Flutter

0

Hello friends, I will talk about my new blog on Physical Model Widget In Flutter. We will also implement a demo of the Physical Model Widget, and describes his properties, and how to use them in your flutter applications. So let’s get started.


Table of Contents :

Flutter

Physical Model Widget

Code Implementation

Code File

Conclusion


Flutter :

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

Physical Model Widget:

The Physical Model widget allows us to customize custom shadow effects and colours and sizes. This type of design can be done in many ways. But it can be easily achieved with the help of a physical model.

The default constructor of the Physical Model is given below:

PhysicalModel({
Key key,
BoxShape shape: BoxShape.rectangle,
Clip clipBehavior: Clip.none,
BorderRadius borderRadius,
double elevation: 0.0, @required
Color color,
Color shadowColor: const Color(0xFF000000),
Widget child
});

Following Properties of the Physical Model:

1.borderRadius: Using the border-radius properties we give a circular shape around the border corner.

2. color: The color properties use to change the background colour.

3. elevation: We use elevation properties to reduce and increase the elevation of the shadow.

4.shadowColor: We use shadow color properties to change the background color of the shadow.

5. shape: We use shape properties to change its shape. And it can be given the shape of a circle and a rectangle.

Demo Module:

Code Implementation:

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

In this screen, we have shown two examples of physical models. The first one uses the circle box shape and the second one is the rectangle box shape. Inside it uses the elevation shadows color border-radius and color properties.

Why physical model works like attraction in these effects. Let’s understand it with the help of a reference.

PhysicalModel(
elevation: 6.0,
shape: BoxShape.circle,
shadowColor: Colors.red,
color: Colors.black,
borderRadius: BorderRadius.all
(Radius.circular(10)),
child: Container(
height: 120.0,
width: 120.0,
),
),

The physical model widget results can be seen in the given below image.

Code File:

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

class PhysicalModelDemo extends StatefulWidget {
@override
_PhysicalModelDemoState createState() => _PhysicalModelDemoState();
}

class _PhysicalModelDemoState extends State<PhysicalModelDemo> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Physical Model Widget'),
),
body: Container(
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
Text(
'Physical Model Widget in circle Box Shape',
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 25,
),
PhysicalModel(
elevation: 6.0,
shape: BoxShape.circle,
shadowColor: Colors.red,
color: Colors.black,
borderRadius: BorderRadius.all
(Radius.circular(10)),
child: Container(
height: 120.0,
width: 120.0,
),
),
],
),
Column(
children: [
Text(
'Physical Model Widget in rectangle Box Shape',
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 25,
),
PhysicalModel(
elevation: 6.0,
shape: BoxShape.rectangle,
shadowColor: Colors.red,
color: Colors.white,
borderRadius: BorderRadius.all
(Radius.circular(10)),
child: Container(
height: 120.0,
width: 120.0,
color: Colors.blue[50],
child: FlutterLogo(
size: 60,
),
),
),
],
),
],
),
),
);
}
}

Conclusion:

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

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

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

Clap 👏 If this article helps you.

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


From Our Parent Company Aeologic

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

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

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

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

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

Grouped ListView in Flutter

0

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

In this article, we will Explore Grouped ListView In Flutter Using the grouped_list_packaged With the help of the package, we can easily achieve flutter grouped list and describes his some properties and how to use them in your flutter applications. So let’s get started.

group_list_ library

grouped_list | Flutter Package
A flutter ListView in which list items can be grouped to sections. Features Easy creation of chat dialog. List Items…pub.dev


Table Of Contents:

Grouped List View

Implementation 

Code Implementation

Code File

Conclusion


Grouped List View:

The flutter grouped package is used to create its list item in different groups. As its name suggests. It provides some specific functions which are given below.

  • Can be separated into groups of all list item.
  • Can give one header for each group

Required Properties of the Grouped ListView:

elements: It contains a list of data, which we have to display in the list. These properties are very important.

groupBy: A function using which to map content and groups.

itemBuilder: This functions as the widget that defines the content of the app.

groupSeparatorBuilder: This widget separates the content of one group from another.

Optional Properties of the Grouped ListView:

order: The order parameter sets the order in which the grouped list is displayed.

sort: The sort Parameter defines a bool that passes the data to be sorted by the widget.

Demo Module:

In this application demo module video, you will see that there is a list on the screen which contains some items and that item is separated.

Implementation :

Step 1: Add dependencies.

Add dependencies to pubspec — yaml file.

dependencies:
grouped_list: ^3.7.1

Step 2: import the package :

import 'package:grouped_list/grouped_list.dart';

Step 3: Run flutter package get

Code Implementation

You need to implement it in your code respectively:

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

In this screen, we have created a list with the help of grouped list view package, in which there are different groups which have been separated from the header and given their title in the header. Let us understand this with the help of a reference.

GroupedListView<dynamic, String>(
elements: _elements,
groupBy: (element) => element['group'],
groupComparator: (value1,
value2) => value2.compareTo(value1),
itemComparator: (item1, item2) =>
item1['topicName'].compareTo(item2['topicName']),
order: GroupedListOrder.DESC,
// useStickyGroupSeparators: true,
groupSeparatorBuilder: (String value) => Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
value,
textAlign: TextAlign.left,
style: TextStyle(fontSize: 18,
fontWeight: FontWeight.bold),
),
),
itemBuilder: (c, element) {
return Card(
elevation: 8.0,
margin: new EdgeInsets.symmetric(horizontal: 10.0,
vertical: 6.0),
child: Container(
child: ListTile(
contentPadding:
EdgeInsets.symmetric(horizontal: 20.0,
vertical: 10.0),
//leading: Icon(Icons.account_circle),
title: Text(
element['topicName'],
style: TextStyle(fontSize: 16),
),
),
),
);
},
)

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

Code File:

import 'package:flutter/material.dart';
import 'package:group_listview_demo/traction_group_seprator.dart';
import 'package:grouped_list/grouped_list.dart';

class GroupListViewDemo extends StatefulWidget {
@override
_GroupListViewDemoState createState() => _GroupListViewDemoState();
}

class _GroupListViewDemoState extends State<GroupListViewDemo> {
List _elements = [
{'topicName': 'GridView.count', 'group': 'GridView Type'},
{'topicName': 'GridView.builder', 'group': 'GridView Type'},
{'topicName': 'GridView.custom', 'group': 'GridView Type'},
{'topicName': 'GridView.extent', 'group': 'GridView Type'},
{'topicName': 'ListView.builder', 'group': 'ListView Type'},
{'topicName': 'StatefulWidget', 'group': 'Type of Widget'},
{'topicName': 'ListView', 'group': 'ListView Type'},
{'topicName': 'ListView.separated', 'group': 'ListView Type'},
{'topicName': 'ListView.custom', 'group': 'ListView Type'},
{'topicName': 'StatelessWidget', 'group': 'Type of Widget'},
];

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Grouped ListView'),
),
body: GroupedListView<dynamic, String>(
elements: _elements,
groupBy: (element) => element['group'],
groupComparator: (value1,
value2) => value2.compareTo(value1),
itemComparator: (item1, item2) =>
item1['topicName'].compareTo(item2['topicName']),
order: GroupedListOrder.DESC,
// useStickyGroupSeparators: true,
groupSeparatorBuilder: (String value) => Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
value,
textAlign: TextAlign.left,
style: TextStyle(fontSize: 18,
fontWeight: FontWeight.bold),
),
),
itemBuilder: (c, element) {
return Card(
elevation: 8.0,
margin: new EdgeInsets.symmetric(horizontal: 10.0,
vertical: 6.0),
child: Container(
child: ListTile(
contentPadding:
EdgeInsets.symmetric(horizontal: 20.0,
vertical: 10.0),
//leading: Icon(Icons.account_circle),
title: Text(
element['topicName'],
style: TextStyle(fontSize: 16),
),
),
),
);
},
),
);
}
}

Conclusion:

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

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

❤ ❤ Thanks for reading this article ❤❤

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

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.

Clap 👏 If this article helps you.

Percent Indicator In Flutter

0

In this article, we will explore the Percent Indicator in flutter using the percent indicator package. With the help of the package, we can easily achieve flutter animated percent progress indicators. So let’s get started

We will implement a demo of the percent Indicator that can be easily embedded in your flutter applications.

percent_indicator | Flutter Package
Circular and Linear percent indicators Circle percent indicator Linear percent indicator Toggle animation Custom…pub.dev


Table Of Contents :

Flutter

Percent Indicator

Implementation

Code Implement

Code File

Conclusion



Flutter :

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

Percent Indicator :

The flutter percentage indicator package produces a progress bar indicator that is different or linear from the default progress bar indicator that looks more beautiful. It is used to display the progress indicator time in any application, such as download, installation, uploading, etc. In this plugin, linear indicator and circular indicator are the two important indicators that cover it. Let’s look at its important indicator.

Two ways of percent indicator

  1. CircularProgressIndicator: The CircularProgressIndicator is a widget that shows progress with a circle. It is a circular progress bar that indicates whether the application is busy or on hold.
  2. LinearProgressIndicator: The LinearProgressIndicator is a widget that shows a progress bar in a linear direction and shows that the application is in progress.

Some of the important Percent Indicator attributes:

  • progressColor — Progress color properties are used for the progress bar so that the progress line can be easily visible and you can change the progress color as per your choice.
  • percent — The percent defines the percentage as long as the progress bar is animated. It takes a double value from 0 -> 1.
  • radius — Radius properties define the size of the circle.
  • center — Center properties define the widget that is in the centre of the progress bar. It can be used by both linear and circular indicators.

Demo Module:

Implementation :

Step 1: Add dependencies.

Add dependencies to pubspec — yaml file.

dependencies:
percent_indicator: "^2.1.7+2"

Step 2: import the package :

import 'package:percent_indicator/percent_indicator.dart';

Step 3: Run flutter package get

Code Implementation :

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

In this screen, we have shown both the indicator and the circular indicator. In which centre properties are used in which progress bar per cent is initialized. Let us understand this in detail with the help of a reference.

First of all, we have set the percentage timer in the init state which will increase the timer when the progress bar in running them in your application.

@override
void initState() {
Timer timer;
timer = Timer.periodic(Duration(milliseconds:1000),(_){
setState(() {
percent+=10;
if(percent >= 100){
timer.cancel();
// percent=0;
}
});
});
super.initState();
}

Now we have taken the circular percent indicator, which has given the background color, the progress color separately, and showed the progress percentage at the centre which will update the progress percentage.

CircularPercentIndicator(
radius: 120.0,
lineWidth: 10.0,
animation: true,
percent: percent/100,
center: Text(
percent.toString() + "%",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.black),
),
backgroundColor: Colors.grey[300],
circularStrokeCap: CircularStrokeCap.round,
progressColor: Colors.redAccent,
)

Now we have taken the circular percent indicator, which has given the background color, the progress color separately, and showed the progress percentage at the centre which will update the progress percentage.

LinearPercentIndicator( //leaner progress bar
animation: true,
animationDuration: 1000,
lineHeight: 20.0,
percent:percent/100,
center: Text(
percent.toString() + "%",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w600,
color: Colors.black),
),
linearStrokeCap: LinearStrokeCap.roundAll,
progressColor: Colors.blue[400],
backgroundColor: Colors.grey[300],
),
),

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

Code File :

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
import 'package:percent_indicator/linear_percent_indicator.dart';
class PercentIndicatorDemo extends StatefulWidget {
@override
_PercentIndicatorDemoState createState() => _PercentIndicatorDemoState();
}

class _PercentIndicatorDemoState extends State<PercentIndicatorDemo> {

double percent = 0.0;

double _height;
double _width;

@override
void initState() {
Timer timer;
timer = Timer.periodic(Duration(milliseconds:1000),(_){
setState(() {
percent+=10;
if(percent >= 100){
timer.cancel();
// percent=0;
}
});
});
super.initState();
}
@override
Widget build(BuildContext context) {
_height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width;

return Scaffold(
appBar: AppBar(
title:Text("Percent Indicator Demo"),
backgroundColor: Colors.redAccent
),
body:Container(
child:Column(
mainAxisAlignment:MainAxisAlignment.spaceEvenly,
crossAxisAlignment:CrossAxisAlignment.center,
children: <Widget>[

Column(
children: [
Text(
'Circular Percent Indicator',
style: TextStyle(
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w700,
fontSize: 15),
),
SizedBox(
height: 40,
),
Container(
padding: EdgeInsets.all(10),
child: CircularPercentIndicator(
radius: 120.0,
lineWidth: 10.0,
animation: true,
percent: percent/100,
center: Text(
percent.toString() + "%",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.black),
),
backgroundColor: Colors.grey[300],
circularStrokeCap: CircularStrokeCap.round,
progressColor: Colors.redAccent,
)
),
],
),


Column(
children: [
Text(
'Linear Percent indicator',
style: TextStyle(
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w700,
fontSize: 15),
),
SizedBox(
height: 40,
),

Container(
margin: EdgeInsets.only(left:30,right:30),
alignment:Alignment.center,
child: LinearPercentIndicator( //leaner progress bar
animation: true,
animationDuration: 1000,
lineHeight: 20.0,
percent:percent/100,
center: Text(
percent.toString() + "%",
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w600,
color: Colors.black),
),
linearStrokeCap: LinearStrokeCap.roundAll,
progressColor: Colors.blue[400],
backgroundColor: Colors.grey[300],
),
),
],
),
],
)
)
);
}
}

Conclusion :

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

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

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

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

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

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

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

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

Animated Chart In Flutter

In this article, we will be exploring Animated Chart In Flutter using the fl_chart_package. With the help of this package, we can easily achieve charts and describes some properties and how to use them in your flutter applications. So let’s get started.

fl_chart | Flutter Package
💥 A library to draw fantastic charts in Flutter 💥 ScatterChart Coming Soon Read More Banner designed by…pub.dev


Table Of Contents :

FL Chart

Chart Type

Implementation

Code Implementation

Code File

Conclusion


FL Chart :

A chart can take various types, however, in general, the chart is a graphical representation of data. Charts tell the user what is the magnitude of data to better understand and predict current and future data. We can show the data through many types of charts such as pie charts, bar charts, line charts, etc. Let us explain all these charts detail in below.

Types Of Chart :

There are a wide variety of charts available to display data. The list below contains those that are most popular and supported by many programs.

  • Pie Chart: The pie chart is a circle chart. It is a circular chart cut into sections. Each part represents us as a percentage.
  • Line Chart: A-line chart, alternatively referred to as a line graph, is a graphical depiction of the verified value movements of a line chart resource. It disrupts the information focus with a continuous line displays the value axis displayed on the left side of the chart.
  • Bar Chart: A bar chart is alternatively known as a graph, a bar chart is a way of grouping clear-cut information into a group. It shows horizontal or vertical bars across the chart horizontally. Displayed at the bottom of the chart. With value.
  • Scatter Chart: A scatter chart is a kind of plot or mathematical diagram in which two variable values ​​for a data set are displayed using cartesian coordinates. We use a scatter chart to show the correlation between variables and visualize groups of data points.

Demo Module ::

Implementation :

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

fl_chart: latest version

Step 2: Import

import 'package:fl_chart/fl_chart.dart';

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

Code implement in dart file :

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

First of all, we will create four buttons on the home page screen. And we will discuss different charts on each button.

Pie Chart :

In the pie chart, we will use the pie chart class which contains its subclass pie chart data which has section properties in which the list is initialized. In which we have given the color and value of each section.

PieChart(
PieChartData(
pieTouchData: PieTouchData(touchCallback: (pieTouchResponse) {
setState(() {
if (pieTouchResponse.touchInput is FlLongPressEnd ||
pieTouchResponse.touchInput is FlPanEnd) {
touchedIndex = -1;
} else {
touchedIndex = pieTouchResponse.touchedSectionIndex;
}
});
}),
borderData: FlBorderData(
show: false,
),
sectionsSpace: 0,
centerSpaceRadius: 60,
sections: showingSections()),
),

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

Line Chart :

In the line chart, we will use the line chart class which contains its subclass line chart data in which the x-axis data has been initialized in the titles data properties. While the properties of the left tile have data of the Y-axis. We have initialized the color and line of the bar.

LineChart(
LineChartData(
lineTouchData: LineTouchData(enabled: true),
lineBarsData: [
LineChartBarData(
spots: [
FlSpot(0, 1),
FlSpot(1, 1),
FlSpot(2, 3),
FlSpot(3, 4),
FlSpot(3, 5),
FlSpot(4, 4)
],
isCurved: true,
barWidth: 2,
colors: [
Colors.orange,
],
belowBarData: BarAreaData(
show: true,
colors: [Colors.lightBlue.withOpacity(0.5)],
cutOffY: cutOffYValue,
applyCutOffY: true,
),
aboveBarData: BarAreaData(
show: true,
colors: [Colors.lightGreen.withOpacity(0.5)],
cutOffY: cutOffYValue,
applyCutOffY: true,
),
dotData: FlDotData(
show: false,
),
),
],
minY: 0,
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
reservedSize: 5,
// textStyle: yearTextStyle,
getTitles: (value) {
switch (value.toInt()) {
case 0:
return '2016';
case 1:
return '2017';

default:
return '';
}
}),
leftTitles: SideTitles(
showTitles: true,
getTitles: (value) {
return '\$ ${value + 100}';
},
),
),
axisTitleData: FlAxisTitleData(
leftTitle: AxisTitle(
showTitle: true, titleText: 'Value', margin: 10),
bottomTitle: AxisTitle(
showTitle: true,
margin: 10,
titleText: 'Year',
textStyle: yearTextStyle,
textAlign: TextAlign.right)),
gridData: FlGridData(
show: true,
checkToShowHorizontalLine: (double value) {
return value == 1 || value == 2 || value == 3 || value == 4;
},
),
),
)

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

Bar Chart:

In the above, we have used the bar chart class to plot the bar chart. The subclass of which is bar chart data which helps us to change bar chart data graph and gives many options. Using the properties of this widget the user can make modifications as we have used bar touch data and titles data properties.

BarChart(
  BarChartData(
    maxY: 20,
    barTouchData: BarTouchData(
        touchTooltipData: BarTouchTooltipData(
          tooltipBgColor: Colors.grey,
          getTooltipItem: (_a, _b, _c, _d) => null,
        ),
        touchCallback: (response) {
          if (response.spot == null) {
            setState(() {
              touchedGroupIndex = -1;
              showingBarGroups = List.of(rawBarGroups);
            });
            return;
          }
          });
        }),
    titlesData: FlTitlesData(
      show: true,
      bottomTitles: SideTitles(
        showTitles: true,
        getTextStyles: (value) => const TextStyle(
            color: Colors.white70, fontWeight: FontWeight.bold, fontSize: 12),
        margin: 20,
        getTitles: (double value) {
          switch (value.toInt()) {
            case 0:
              return '2015';
        
              return '';
          }
        },
      ),
      leftTitles: SideTitles(
        showTitles: true,
        getTextStyles: (value) => const TextStyle(
            color: Colors.white70, fontWeight: FontWeight.bold, fontSize: 14),
        margin: 32,
        reservedSize: 11,
        getTitles: (value) {
          if (value == 0) {
            return '1K';
          } else if (value == 10) {
            return '5K';
          } else if (value == 19) {
            return '10K';
          } else {
            return '';
          }
        },
      ),
    ),
    borderData: FlBorderData(
      show: false,
    ),
    barGroups: showingBarGroups,
  ),
)

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

Scatter Chart :

In the above, we have used the scatter chart class whose subclass is the scatter chart data which helps us to change the bar chart data graph and gives many options the user can modify using the properties of this widget as we have the bar scatters used the spots property which is of type and used the scatter touch data property which can change the color and value of the data touched by the user.

ScatterChart(
ScatterChartData(
scatterSpots: [],
minX: 0,
maxX: 10,
minY: 0,
maxY: 10,
borderData: FlBorderData(
show: false,
),
gridData: FlGridData(
show: true,
drawHorizontalLine: true,
checkToShowHorizontalLine: (value) => true,
getDrawingHorizontalLine: (value) => FlLine(color: Colors.white.withOpacity(0.1)),
drawVerticalLine: true,
checkToShowVerticalLine: (value) => true,
getDrawingVerticalLine: (value) => FlLine(color: Colors.white.withOpacity(0.1)),
),
titlesData: FlTitlesData(
show: false,
),
showingTooltipIndicators: selectedSpots,
scatterTouchData: ScatterTouchData(
enabled: true,
handleBuiltInTouches: false,
touchTooltipData: ScatterTouchTooltipData(
tooltipBgColor: Colors.black,
),
touchCallback: (ScatterTouchResponse touchResponse) {
},
),
),
)

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

Code file :

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

class ScatterChartPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _ScatterChartPageState();
}

class _ScatterChartPageState extends State {
  int touchedIndex;

Color greyColor = Colors.grey;

  List<int> selectedSpots = [];

 int lastPanStartOnIndex = -1;

 double _height;
  double _width;

@override
  Widget build(BuildContext context) {
    _width = MediaQuery.of(context).size.width;
    _height = MediaQuery.of(context).size.height;
    return Scaffold(
      appBar: AppBar(
        title: Text('Scatter Chart Demo'),
      ),
      body: Container(
        //alignment:Alignment.center,
        height: _height / 2.2,
        width: _width,
        margin: EdgeInsets.symmetric(vertical: 80, horizontal: 15),
        child: Card(
          color: Colors.black54,
          child: ScatterChart(
            ScatterChartData(
              scatterSpots: [
                ScatterSpot(
                  4,
                  5,
                  color: selectedSpots.contains(2)
                      ? Colors.purpleAccent
                      : greyColor,
                  radius: 8,
                ),
                ScatterSpot(
                  8,
                  6,
                  color: selectedSpots.contains(3) ?
                  Colors.orange : greyColor,
                  radius: 20,
                ),
                ScatterSpot(
                  5,
                  7,
                  color: selectedSpots.contains(4) ?
                  Colors.brown : greyColor,
                  radius: 14,
                ),
                ScatterSpot(
                  7,
                  2,
                  color: selectedSpots.contains(5)
                      ? Colors.lightGreenAccent
                      : greyColor,
                  radius: 18,
                ),
                ScatterSpot(
                  3,
                  2,
                  color: selectedSpots.contains(6) ?
                  Colors.red : greyColor,
                  radius: 36,
                ),
              ],
              minX: 0,
              maxX: 10,
              minY: 0,
              maxY: 10,
              borderData: FlBorderData(
                show: false,
              ),
              gridData: FlGridData(
                show: true,
                drawHorizontalLine: true,
                checkToShowHorizontalLine: (value) => true,
                getDrawingHorizontalLine: (value) =>
                    FlLine(color: Colors.white.withOpacity(0.1)),
                drawVerticalLine: true,
                checkToShowVerticalLine: (value) => true,
                getDrawingVerticalLine: (value) =>
                    FlLine(color: Colors.white.withOpacity(0.1)),
              ),
              titlesData: FlTitlesData(
                show: false,
              ),
              showingTooltipIndicators: selectedSpots,
              scatterTouchData: ScatterTouchData(
                enabled: true,
                handleBuiltInTouches: false,
                touchTooltipData: ScatterTouchTooltipData(
                  tooltipBgColor: Colors.black,
                ),
                touchCallback: (ScatterTouchResponse touchResponse) {
                  if (touchResponse.touchInput is FlPanStart) {
                    lastPanStartOnIndex = touchResponse.
                    touchedSpotIndex;
                  } else if (touchResponse.touchInput is FlPanEnd) {
                    final FlPanEnd flPanEnd =
                        touchResponse.touchInput;

                        if (flPanEnd.velocity.pixelsPerSecond <=
                        const Offset(4, 4)) {
                      // Tap happened
                      setState(() {
                        if (selectedSpots.contains
                          (lastPanStartOnIndex)) {
                          selectedSpots.remove(lastPanStartOnIndex);
                        } else {
                          selectedSpots.add(lastPanStartOnIndex);
                        }
                      });
                    }
                  }
                },
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Conclusion :

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

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

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.

From Our Parent Company Aeologic

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

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

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

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

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

CupertinoActivityIndicator In Flutter

0

Displaying Future data In an app is an everyday task in modern applications. As most of the data come from the APIs there comes in need of using proper loading Indicators before the data comes in place. Progress Indicators are a Quintessential tool in modern applications as they provide us with the ease of customizing the User-Interface of the app as per user needs by creating a uniformity displaying of API results data. They also provide the app its fondness and customizability as per particular needs. If your flutter app constitutes Cupertino widgets mainly then a good idea would be to use the CupertinoActivityIndicator as a progress indicator.

CupertinoActivityIndicator is the Cupertino version of the material circular progress indicator. It animates in a clockwise circle. Flutter possesses in its store a widget to perform this task with ease & perfection Using CupertinoActivityIndicator.


If you are requiring a progress indicator for cupertino widgets then the below mentioned is the widget for you :

Watch this video By Flutter for more info on the topic :

What is Flutter?

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

If you want to explore more about Flutter, please visit Flutter’s official website to get more information.

Flutter Is Proudly Entrusted By These Organizations For their Products : — Flutter Showcase

Click to See Flutter Showcase

CupertinoActivityIndicator Syntax :

: Add the CupertinoActivityIndicator() widget .

: Define boolean value to animating property with it being set to false for freezed kind of progress indicator and being set to true if progress indicator is needed to animate.

: Define double value to radius determining progress indicator size to be displayed.

CupertinoActivityIndicator(  
animating: true,
radius: _kDefaultIndicatorRadius,
Key: key)

Using Along with FutureBuilder :

Api Handlers | Circular Progress Indicator are mainly functional for awaiting Non-Deterministic behavior.

So one way to Incorporate it into your app is to wrap it inside a FutureBuilder Widget. This way, CupertinoActivityIndicator will appear while your app is loading data and disappear when your data is ready.

FutureBuilder<String>(
future: _fetchData
builder:(context,snapshot){
if(snapshot.hasData){
return /////;
} else {
return CupertinoActivityIndicator(
animating: false,radius: 10
)
}
}
)

When you run this Flutter application, you would get the CupertinoActivityIndicator displayed in UI as shown below :

How the widget will likely work in your App

Understanding Widget Elements :

CupertinoActivityIndicator.partiallyRevealed: Another type of Cupertino activity indicator that displays a partial ticker based on the progress value provided.

: animating: Whether the activity Indicator is running its animation or not

: radius: radius of the spinner displayed

: key : controls widget replacing activity

Enabling For Flutter Web

CupertinoActivityIndicator Performs the Same for flutter web as well by changing the channel to development mode as current web is enabled in the beta channel.

Use the following commands to switch channels and enabling flutter web

flutter channel beta
flutter upgrade
flutter config — enable-web

Add-On Web to your project & run the project to web view

flutter create .
flutter run -d chrome

Closing Thoughts

In this blog, we explored the CupertinoActivityIndicator widget provided by Flutter for creating an iOS-style activity indicator that spins clockwise. The key purpose of this article is to avail you of an Insight into How we can create CupertinoActivityIndicator based flutter application using the official flutter widget.

If you have not used CupertinoActivityIndicator, I hope this article has provided you with content information about what’s all about it and you will give it — a Try.

Initiate using CupertinoActivityIndicator for your apps. !!


References For the Blog :

CupertinoActivityIndicator class
API docs for the CupertinoActivityIndicator class from the cupertino library, for the Dart programming language.api.flutter.dev

Progress Indicators – Controls – iOS – Human Interface Guidelines – Apple Developer
Don’t make people sit around staring at a static screen waiting for your app to load content or perform lengthy data…developer.apple.com


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


From Our Parent Company Aeologic

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

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

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

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

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

www.flutterdevs.com

Email Customization In Flutter

0

Digital Communication Is an Integral part of communication in today’s era to help us in getting the message quicker & broader. Over the years, Email has always been one of the most popular modes of official textual communications. Mobile provides us the ability to send in an email from remote locations where you may not have enough time to formulate mail. In this article, we’ll send emails using a custom mailer template by using the Sendinblue email provider.

Table of Contents :

Introduction

Create a Template

Creating the Api Request

Code File

Conclusion


Introduction:

The Sendinblue API gives developers access to the entire range of Sendinblue features via a standardized programmatic interface. Using Sendinblue’s API, you can do just about anything you can do on sendinblue.com via the customer interface.

All Your Digital Marketing Tools in One Place – Sendinblue
Take your business to new heights with the complete all-in-one digital marketing toolbox that’s built to scale and…www.sendinblue.com

Create a Template:

  1. Create a test template that contains dynamic contents

2. Design the template

Once directed select the import a template

3. Click “Import” next to the URL. You should be redirected to the following page below.
Click the “Save & Quit” button, then on the new page “ Save and Activate”.

Creating the API request:

In the code snippet, we’ve created a method to call web API for sending an email.

You’ve to add a header request.

API Request method

In this code snippet, we’re using sendinblue to create a custom template and send an email.

Code File :

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app_sendinblue/api-provider.dart';
import 'package:fluttertoast/fluttertoast.dart';

class HomeView extends StatefulWidget {
@override
_HomeViewState createState() => _HomeViewState();
}

class _HomeViewState extends State<HomeView> {
var sNameController = TextEditingController();
var rNameController = TextEditingController();
var sEmailController = TextEditingController();
var rEmailController = TextEditingController();
var subController = TextEditingController();
var _formKey = GlobalKey<FormState>();

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text("Send Email"),
),
body: Container(
margin: const EdgeInsets.all(20),
child: Form(
key: _formKey,
child: Column(
children: [
TextField(
controller: sNameController,
decoration: InputDecoration(
labelText: "Sender's Name",
labelStyle: TextStyle(
color: Colors.black,
),
border: OutlineInputBorder(),
focusedBorder: OutlineInputBorder(),
),
),

SizedBox(height: 10,),

TextFormField(
controller: sEmailController,
validator: (value) {
if (value.isEmpty ||
!RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(value)) {
return 'Enter a valid email!';
}
return null;
},
decoration: InputDecoration(
labelText: "Enter sender's email id ",
labelStyle: TextStyle(
color: Colors.black,
),
border: OutlineInputBorder(),
focusedBorder: OutlineInputBorder(),
),
),
SizedBox(height: 10,),

TextField(
controller: subController,
decoration: InputDecoration(
labelText: "Subject",
labelStyle: TextStyle(
color: Colors.black,
),
border: OutlineInputBorder(),
focusedBorder: OutlineInputBorder(),
),
),
SizedBox(height: 10,),

TextFormField(
controller: rNameController,
decoration: InputDecoration(
labelText: "Receiver's Name",
labelStyle: TextStyle(
color: Colors.black,
),
border: OutlineInputBorder(),
focusedBorder: OutlineInputBorder(),
),
),
SizedBox(height: 10,),
TextFormField(

controller: rEmailController,
validator: (value) {
if (value.isEmpty ||
!RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(value)) {
return 'Enter a valid email!';
}
return null;
},
decoration: InputDecoration(
labelText: "Enter receiver's email id ",
labelStyle: TextStyle(
color: Colors.black,
),
border: OutlineInputBorder(),
focusedBorder: OutlineInputBorder(),
),
),

SizedBox(height: 10,),

RaisedButton(onPressed: (){
//String senderName, String receiverName, String sEmail, String rEmail,String sub,
if(_formKey.currentState.validate()){
new ApiProvider().sendEmail(sNameController.text.toString(),
rNameController.text,sEmailController.text,rEmailController.text,
subController.text,context).then((value){
if(value!=null){
Fluttertoast.showToast(
msg: "Email Send",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
}
});
}
_formKey.currentState.save();
},
child: Text('Send Mail'),)
],
),
),
),
),
);
}
}

Output

Conclusion

In this article, I have explained the Sendinblue package demo which you can modify and experiment with according to your own. This little introduction was about customized the email template.

I hope this blog will provide you with sufficient information in trying up to use the send email in your flutter projects. We will show this demo program for working Sendinblue in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤


From Our Parent Company Aeologic

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

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

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

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

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

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

Clap 👏 If this article helps you.