Google search engine
Home Blog Page 53

Stack And Positioned Widget In Flutter

0

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

In this blog, we will explore the Stack and Positioned Widget In Flutter. We will also implement a demo of the stack and positioned widget, describes its properties, and how to use them in your flutter applications. So let’s get started.


Table of Contents :

Stack Widget

Positioned Widget

Code Implementation

Code File

Conclusion


Stack Widget:

The stack is a widget in Flutter. It contains a list of widgets and places them on top of each other. And it places their children on top of each other like a stack of books. In other words, stack developers would overlap multiple widgets on one screen. As you can add different images or colors using containers in it.

Properties of the Stack Widget:

The following are the basic properties of the stack widget.

  1. alignment: The alignment determines that.How to align children’s widgets in the stack. It can be top,bottom,center,etc.
  2. text direction: The text direction determines the text direction. It can draw the text either ltr (left to right) or rtl (right to the left).
  3. Fit: The fit Property is of type BoxFit.Its use describes how a box is marked in another box. It completes semantics sizing.

These are the some parameters of a Stack widget.

Stack(
alignment: Alignment.center,
textDirection: TextDirection.rtl,
fit: StackFit.loose,
overflow: Overflow.visible,
clipBehavior: Clip.hardEdge,
children: <Widget>[]
),

Positioned Widget:

The Positioned widgets, as we know by name. This is related to the position of some widgets. The right positioned widgets allow us to control this. A child of that stack is positioned on the inside of the stack.

The following are the parameters of the positioned:

Positioned(
height: 0,
width: 0,
left: 0,
right: 0,
top: 0,
bottom: 0,
child:(),
)

Demo Module:

In this demo module video. Stack and Positioned Widget is used, Which overlaps several containers on the screen. And use the positioned widget. And set its positions from left and top.

Code Implementation:

You need to implement it in your code respectively:

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

In this stack and positioned widget. We used 3 Containers that we wrap with the stack. All the containers have different colors and names. And the stack has set all its containers vertically.

Check the code below to better understand it.

Stack(
children: <Widget>[
Container(
width: 150,
height: 150,
color: Colors.green[300],
child: Text(
'Green',
style: TextStyle(
color: Colors.white,
fontSize: 20
),
),
),
],
),

Now we have wrapped her child inside the stack widget with the positioned widget as we have already understood about the positioned widget. In the positioned widget, we have given its position from the top and left.

Check the code below to better understand it.

Stack(
children: <Widget>[
Positioned(
top: 30,
left: 30,
height:250,
width: 250,
child: Container(
width: 150,
height: 150,
color: Colors.green[300],
child: Text(
'Green',
style: TextStyle(
color: Colors.white,
fontSize: 20
),
),
),
),
],
),

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';
class StackAndPositionedDemo extends StatefulWidget {
@override
_StackAndPositionedDemoState createState() => _StackAndPositionedDemoState();
}

class _StackAndPositionedDemoState extends State<StackAndPositionedDemo> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Stack & Positioned Widget'),
centerTitle:true,
),
body:Container(
padding:EdgeInsets.all(10),
child:Stack(
children: <Widget>[
Positioned(
top: 30,
left: 30,
height:250,
width: 250,
child: Container(
width: 150,
height: 150,
color: Colors.green[300],
child: Text(
'Green',
style: TextStyle(
color: Colors.white,
fontSize: 20
),
),
),
),
Positioned(
top: 70,
left:60,
width: 250,
height: 250,
child: Container(
width:150,
height:150,
color: Colors.red[400],
child: Text(
'Red',
style: TextStyle(color: Colors.white,
fontSize: 20),
),
),
),
Positioned(
top: 130,
left: 90,
width: 250,
height: 250,
child: Container(
width: 80,
height: 80,
color: Colors.purple[300],
child: Text(
'Purple',
style: TextStyle(color: Colors.white,
fontSize: 20),
),
),
),
],
),
),
);
}
}

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Stack & Positioned widget in your flutter project. We will show you the stack & positioned widget is?, show a working demo program of the stack & positioned widget 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 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.

Explore Layout Inspector In Flutter

0

The Flutter Inspector is an unimaginable resource that assists developers with diagnosing configuration issues and various issues in Flutter applications. Flutter relies upon Widgets and Widget Trees. If you are new to Flutter, imagine Widgets as plans of Data or Classes of Data. Likewise, to make a Flutter application we home these Widgets inside one another.

This blog will Explore Layout Inspector In Flutter. We perceive how to execute a demo program. We will show you how to use it in your Flutter applications.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

Introduction

Debugging Layout Issues

Steps To Inspect Layout In Flutter

Conclusion



Introduction:

Flutter gives a tool called Flutter Inspector which can assist you with envisioning the blueprint and properties of various widgets in your Flutter Application. Alongside perception, the Inspector apparatus additionally helps in diagnosing Widget design issues.

The Flutter inspector is an amazing asset for envisioning and investigating Flutter widget trees. The Flutter structure involves widgets as the core building block for anything from controls The inspector helps you envision and investigate Flutter widget trees.

Debugging Layout Issues:

Here are some steps to debug layout issues with the Flutter Inspector.

The following is a manual for the elements accessible in the inspector’s toolbar. At the point when space is restricted, the symbol is utilized as the visual adaptation of the label.

  • > Open the Flutter Inspector — Begin by running your Flutter application in debug mode and opening the Flutter Inspector. You can do this by tapping on the “Open Flutter Inspector” button in your IDE’s toolbar or by composing “flutter inspect” in your terminal.
  • > Select the widget you want to inspect — Utilize the Flutter Inspector to choose the widget you need to assess by tapping on it in the widget tree. You can then see data about the widget in the Inspector panel, including its size, position, and requirements.

Subsequent to choosing any Widget from the Widget Tree you can see the outline of that Widget with the assistance of the Layout Explorer tab.

You can check various properties and nested widgets of the chosen Widget with the assistance of the Widget Details Tree tab.

  • > Check the constraints — The requirements of a widget can be a typical reason for design issues. Ensure that the widget has the right requirements and that they are being applied accurately.
  • > Check the widget’s parent — If a widget isn’t being spread out accurately, it very well might be because its parent isn’t applying the current situation to the right requirements or properties. Utilize the Inspector to investigate the widget’s parent and look at its properties and requirements.
  • > Refresh Tree — Whenever you make changes in your app, and you hot reload those changes are not immediately reflected in your Flutter Inspector tool. To visualize the changes you will have to click the Refresh Tree button.
  • > Debug Pain — The “Debug Paint” highlight in the Flutter Inspector can assist you with picturing the design of your widgets. You can empower this component by tapping on the “Switch Debug Paint” button in the Inspector panel.
  • > Slow Animation — Reduces the speed of animation between layouts.
  • > Paint BaseLines — It draws baselines for all the texts and icons currently present on the screen. Cause each RenderBox to paint a line at each of its text baselines.
  • > Repaint Rainbow — Shows rotating colors on layers when repainting. When activated it creates a border around the widgets that are changing. So It’s a great tool to check/debug widgets that are changing.

Steps To Inspect Layout In Flutter:

Debugging layout issues in Flutter can be a difficult undertaking, yet the Flutter Inspector device can be exceptionally useful in recognizing and settling layout issues.

> Start Your App In Debug Mode:

To use the Flutter Inspector, you need to start your app in debug mode. You can do this by running the following command in your terminal:

flutter run –debug

> Open The Flutter Inspector:

Once your application is running in debug mode, you can open the Flutter Inspector by tapping the “Open DevTools” button in the Flutter SDK apparatus. On the other hand, you can likewise open the Flutter Inspector by running the accompanying order in your terminal:

flutter inspect

This will open the Flutter Inspector in your default web browser.

> Inspect The Widget Tree:

When the Flutter Inspector is open, you can utilize it to assess the widget tree of your application. The widget tree is a progressive portrayal of the relative multitude of widgets in your application, and it can assist you with distinguishing design issues. You can explore the widget tree by tapping on the widgets and extending their children.

> Identify Layout Issues:

As you explore the widget tree, search for widgets that are not showing true to form. This might incorporate widgets that are covering, not adjusted as expected, or not taking up the right measure of room. You can likewise utilize the Flutter Inspector to see the design constraints of every widget, which can assist you to recognize issues with the imperatives.

> Fix Layout Issues:

Whenever you have recognized layout issues, you can utilize the Flutter Inspector to try different things with various format imperatives and perceive what they mean for the format of your application. You can likewise alter the code straightforwardly in the Flutter Inspector to make changes to the layout of your application.

> Test Your Changes:

In the wake of making changes to your design, test your application to check whether the issues have been settled. On the off chance that not, keep on utilizing the Flutter Inspector to recognize and fix any excess design issues.

Conclusion:

In the article, I have explained the Explore Layout Inspector In Flutter; you can modify this code according to your choice. This was a small introduction to Explore Layout Inspector In Flutter User Interaction from my side, and it’s working using Flutter.

I hope this blog will provide you with sufficient information on Trying the Explore Layout Inspector In Flutter. You can utilize the Flutter Inspector to recognize and determine layout issues in your Flutter application. Make sure to test your progressions completely to guarantee that your application is working as expected. 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! For any flutter-related queries, you can connect with us on FacebookGitHubTwitter, and LinkedIn.

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.


By Shaiq khan on May 11, 2023.

Canonical link

Exported from Medium on December 4, 2023.

URL launcher in Flutter

While developing mobile applications, there are so many times when we have to interact with outside of your applications. So to achieve this Flutter provides an easy way by usingurl_launcher package.

In this article, we’ll show how to interact with another application from your app

url_launcher | Flutter Package
Flutter plugin for launching a URL on Android and iOS. Supports web, phone, SMS, and email schemes.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. URL launcher is used to open websites, create mail, open maps, etc.

To interact with outsider apps from your app we need to use a URL launcher package.

Setup

Step1: Add the dependency

Start by adding the dependency to the pubspec.yml file

dependencies:
url_launcher: latest version

Supported URL schemas

The launch method takes a string argument containing a URL. This URL can be formatted using a number of different URL schemes. The supported URL schemes depend on the underlying platform and installed apps.

Code Implementation:

Create three buttons to launch web URL, mail, and map in the MyHomePage.dart class, and on clicking that button showing the corresponding launch.

For opening the web pages, on click of button Open URL call this method,

For Google map and apple map, pass latitude and longitude in the base url,

Sent an email by specifying the receiver’s email, subject, and body of the mail

In these snippets, we are using url_launcher to open outsider app like email, webpage, and map.

Code File

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

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

class _MyHomePageState extends State<MyHomePage> {
final String lat = "25.3622";
final String lng = "86.0835";

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Url Launcher Demo'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Card(
color: Colors.blue,
shape: RoundedRectangleBorder(
side: new BorderSide(color: Colors.blue, width: 2.0),
borderRadius: BorderRadius.circular(15.0),
),
child: Padding(
padding: const EdgeInsets.all(13.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.open_in_browser, color: Colors.white,),
SizedBox(width: 5,),
InkWell(
onTap: _launchURL,
child: Text('Open Web url',style: TextStyle(
color: Colors.white
),),
),
],
),
),
),

Card(
color: Colors.blue,
shape: RoundedRectangleBorder(
side: new BorderSide(color: Colors.blue, width: 2.0),
borderRadius: BorderRadius.circular(15.0),
),
child: Padding(
padding: const EdgeInsets.all(13.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.email_outlined, color: Colors.white,),

SizedBox(width: 5,),
InkWell(
onTap: _launchEmail,
child: Text('Open email',style: TextStyle(
color: Colors.white
),),
),
],
),
),
),

Card(
color: Colors.blue,
shape: RoundedRectangleBorder(
side: new BorderSide(color: Colors.blue, width: 2.0),
borderRadius: BorderRadius.circular(15.0),
),
child: Padding(
padding: const EdgeInsets.all(13.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.navigation_outlined, color: Colors.white,),

SizedBox(width: 5,),
InkWell(
onTap: _launchMap,
child: Text('Open map',style: TextStyle(
color: Colors.white
),),
),
],
),
),
),
],
));
}

_launchMap() async {
final String googleMapsUrl = "comgooglemaps://?center=$lat,$lng";
final String appleMapsUrl = "https://maps.apple.com/?q=$lat,$lng";

if (await canLaunch(googleMapsUrl)) {
await launch(googleMapsUrl);
}
if (await canLaunch(appleMapsUrl)) {
await launch(appleMapsUrl, forceSafariVC: false);
} else {
throw "Couldn't launch URL";
}
}

_launchEmail() async {
launch(
"mailto:rakhi@aeologic.com?subject=TestEmail&body=How are you%20plugin");
}

_launchURL() async {
const url = 'https://flutterdevs.com/';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
}

Conclusion

In this article, I have explained URL launcher package demo which you can modify and experiment with according to your own. This little introduction was about to open an outsider app from my app like a map, webpage, and email.

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


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.