Google search engine
Home Blog Page 23

Backdrop Filter Widget In Flutter

0

Sometimes you need to apply a blurry impact on your application. How might you make such an impact in case you’re utilizing Flutter?. A widget called BackdropFilter is appropriate for that reason. BackdropFilter is a widget that applies a filter to the current painted substance and afterward paints its child widget. Flutter will apply the filter to all spaces inside its parent widget’s clip. That implies if there’s no clip, the filter will be applied to the whole screen.

In this blog, we will explore the Backdrop Filter Widget In Flutter. We will see how to implement a demo program of the backdrop filter widget and show you how to use that widget for creating a blur effect, in your flutter applications.

BackdropFilter class – widgets library – Dart API
A widget that applies a filter to the existing painted content and then paints the child. The filter will be applied to all…api. flutter.dev

Table Of Contents::

Backdrop Filter Widget

Properties

Implementation

Code Implement

Code File

Conclusion



Backdrop Filter Widget:

Flutter Backdrop Filter Widget is utilizing to making blurring impacts on pictures, Containers, and every one of the widgets. Backdrop Filter widget is utilized with a mix of ImageFilter class. It applies a filter on the current widget and makes the blur impact underneath the current widget. As far as anyone knows we have an image widget so we put the image widget first at that point put the Backdrop Filter widget as its child.

For more info on Backdrop Filter Widget ,Watch this video By Flutter :

Below demo video shows how to create a blur effect in a flutter. It shows how the blur effect will work using the BackdropFilter widget in your flutter applications. It shows three buttons on the center screen. When the user taps on these buttons, it will show the blur effect. All three buttons different working blur effects. It will be shown on your device.

Demo Module :


Properties:

The list of properties of backdrop filter you can pass to the constructor.

  • Key key: The widget key, used to control if it should be replaced.
  • ImageFilter filter *: The image filter to apply to the existing painted content before painting the child.
  • Widget child: The widget below this widget in the tree.

Implementation:

Step 1: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

We will make three buttons on this home page screen, and each button will show Backdrop Filter, and we will show the deeply below detail. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Home Screen

We will deeply define all buttons

Image Blur:

First, we will import it from dart:ui.

import 'dart:ui';

We will make a blur impact that will be applied to the whole space of the parent widget. As BackdropFilter applies the filter to the current painted substance, for the most part, we need to utilize the Stack widget for the execution. The widget where the filter will be applied should be set before the filter.

Stack(
fit: StackFit.expand,
children: <Widget>[
Image.asset("assets/devs.jpg",fit: BoxFit.contain,),
Positioned.fill(
child: Center(
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 10.0,
sigmaY: 10.0,
),
child: Container(
color: Colors.black.withOpacity(0.2),

),
),
),
),
],
),

Since the filter should cover the whole space of its parent, we need to wrap the BackdropFilter widget as the child of Positioned.fill. You are needed to pass an ImageFilter. For this situation, the most appropriate filter can be made utilizing ImageFilter.blursigmaX and sigmaY control the deviation standard dependent on the filter on the x-axis and y-axis individually. Both have a default estimation of 0, which implies no impact is applied. To apply the filter on the x-axis, change the estimation of sigmaX to a positive number. For the y-axis, utilize the sigmaY property. The child of BackdropFilter can be a Container whose shading opacity is under 1, with 0 is a typical worth. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Image Blur

Text Blur:

This Blur example is how to make the filter applied to a specific space of the picture. Rather than Positioned. fill, utilize the default constructor of the Positioned widget by which you can set the separation from the top, left, bottom, and right. In any case, that is adequately not. As I’ve composed above, Flutter will apply the filter to all spaces inside its parent widget’s clip. Accordingly, to apply the channel on a specific territory, you need to wrap them BackdropFilter as the child of any Clip widget, like ClipRect, ClipRRect, ClipOval, ClipPath, or CustomClipper.

Stack(
fit: StackFit.expand,
children: <Widget>[
Image.asset("assets/devs.jpg",fit: BoxFit.contain,),
Positioned(
top: 250,
left: 0,
right: 0,
child: Center(
child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 10.0,
sigmaY: 10.0,
),
child: Container(
padding: EdgeInsets.all(24),
color: Colors.white.withOpacity(0.5),
child: Text(
"Flutter Dev's",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
),
),
),
],
),

We will add text on a container with the color opacity and the border-radius will be circular due to ClipRRect(). When we run the application, we ought to get the screen’s output like the underneath screen capture.

Text Blur

Image & Text Blur:

In this blur effect, all things will be the same. We will add Stack(), inside we will add a Positioned widget with top, left, and right. We will apply BackdropFilter() and its child property we will add a container with the same text and color with opacity. We will remove ClipRRect. All widgets will be blurred.

Stack(
fit: StackFit.expand,
children: <Widget>[
Image.asset("assets/devs.jpg",fit: BoxFit.contain,),
Positioned(
top: 250,
left: 0,
right: 0,
child: Center(
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 10.0,
sigmaY: 10.0,
),
child: Container(
padding: EdgeInsets.all(24),
color: Colors.white.withOpacity(0.5),
child: Text(
"Flutter Dev's",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
),
),
],
),

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

Image & Text Blur

Code File:

import 'package:flutter/material.dart';
import 'package:flutter_backdrop_filter_widget/image_blur.dart';
import 'package:flutter_backdrop_filter_widget/image_text_blur.dart';
import 'package:flutter_backdrop_filter_widget/text_blur.dart';


class HomePageScreen extends StatefulWidget {
@override
_HomePageScreenState createState() => _HomePageScreenState();
}

class _HomePageScreenState extends State<HomePageScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xffFFFFFF),
appBar: AppBar(
title: Text("Flutter BackdropFilter Widget Demo"),
automaticallyImplyLeading: false,
centerTitle: true,
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[

RaisedButton(
child: Text('Image Blur',style: TextStyle(color: Colors.black),),
color: Colors.cyan[100],
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => ImageBlur()));
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))),
padding: EdgeInsets.all(13),
),
SizedBox(height: 8,),
RaisedButton(
child: Text('Text Blur',style: TextStyle(color: Colors.black),),
color: Colors.cyan[100],
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => TextBlur()));
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))),
padding: EdgeInsets.all(13),

),
SizedBox(height: 8,),

RaisedButton(
child: Text('Image & Text Blur',style: TextStyle(color: Colors.black),),
color: Colors.cyan[100],
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => ImageTextBlur()));
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))),
padding: EdgeInsets.all(13),


),
SizedBox(height: 8,),

],
),
)
), //center
);
}
}

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Backdrop Filter Widget in your flutter projects. We will show you what the Backdrop Filter Widget is?, some properties using in Backdrop Filter, and make a demo program for working Backdrop Filter Widget and show you how to use that widget for creating a blur effect using the BackdropFilter widget in your flutter applications, So please try it.

❤ ❤ Thanks for reading this article ❤❤


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

Clap 👏 If this article helps you.

find the source code of the Flutter Backdrop Filter Widget Demo:

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


From Our Parent Company Aeologic

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

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

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

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

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


Animated Circular Menu In Flutter

Animation is a complex methodology in any mobile application. Despite its intricacy, Animation improves the user experience to another level and gives rich user communication. Because of its lavishness, animation turns into an integral part of present-day mobile applications. The Flutter system perceives the significance of Animation and gives a basic and natural structure to build up a wide type of animations.

In this blog, we will explore the Animated Circular Menu In Flutter. We will see how to implement a demo program of the animated circular menu and show a beautiful animation with a colorful icon using the
circular_menu package in your flutter applications.

circular_menu | Flutter Package
A simple animated circular menu for Flutter, Adjustable radius, colors, alignment, animation curve, and animation…pub. dev

Table Of Contents::

Introducton

Parameters

Implementation

Code Implement

Code File

Conclusion



Introduction:

An animated circular menu for Flutter application, Adjustable radius, delightful colors, alignment, animation curve, and animation duration. Below demo video shows how to create an animated circular menu in a flutter. It shows how the animated circular menu will work using the circular_menu package in your flutter applications. It shows when the user taps a button, then animations will occur with beautiful icons, and all icons open in circular form with animation effect. It will be shown on your device.

Demo Module :


Parameters:

There are some parameters of circular menu are:

  • > items: This parameter is used to must not be null, and it must contain two elements at least.
  • > key: This parameter is used as the global key to controlling animation anywhere in the code.
  • > backgroundWidget: This parameter is used to widget holds actual page content.
  • > startingAngleInRadian: This parameter is used to starting the angle in a clockwise radian.
  • > endingAngleInRadian: This parameter is used to ending the angle in clockwise radian.
  • > animationDuration: This parameter is used how long an animation should take to complete one cycle.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
circular_menu:

Step 2: Import

import 'package:circular_menu/circular_menu.dart';

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

First, we will create a String variable called _coloName and a Color variable called _color.

String _colorName ;
Color _color ;

In the body part, we will add CircularMenu() widget. In this widget, we will add an alignment to the center. We will add backgroundWidget, which means show the content. In this widget, we will add a Column widget. We will add RichText() ‘Press the menu button’ and wrap it to the center inside the widget.

CircularMenu(
alignment: Alignment.center,
backgroundWidget: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Center(
child: Padding(
padding: const EdgeInsets.all(100.0),
child: RichText(
text: TextSpan(
style: TextStyle(color: Colors.black, fontSize: 20,fontWeight: FontWeight.bold),
children: <TextSpan>[
TextSpan(text: 'Press the menu button'),
],
),
),
),
),
],
),
curve: Curves.bounceOut,
reverseCurve: Curves.bounceInOut,
toggleButtonColor: Colors.cyan[400],
items: [CircularMenuItem(..),
CircularMenuItem(..)
],
),

We will add a curve when the user taps the menu button, and then the animation curve is forwarding. We will add a bounceOut curve. We will add a reverseCurve means when the user taps the menu button again and the animation curve in reverse. We will add a bounceInOut curve. We will add a toggle button color. We will add items that deeply define the below code. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Main Screen

We will deeply define items:

We will create a five CircularMenuItem(). Inside items, we will add icons, colors, and onTap() function. In this function, we will add a setState() method. This method will see variable _color equal to the colors and _colorname equal to text.

items: [
CircularMenuItem(
icon: Icons.home,
color: Colors.brown,
onTap: () {
setState(() {
_color = Colors.brown;
_colorName = 'Brown';
});
}),
CircularMenuItem(
icon: Icons.search,
color: Colors.green,
onTap: () {
setState(() {
_color = Colors.green;
_colorName = 'Green';
});
}),
CircularMenuItem(
icon: Icons.settings,
color: Colors.red,
onTap: () {
setState(() {
_color = Colors.red;
_colorName = 'red';
});
}),
CircularMenuItem(
icon: Icons.chat,
color: Colors.orange,
onTap: () {
setState(() {
_color = Colors.orange;
_colorName = 'orange';
});
}),
CircularMenuItem(
icon: Icons.notifications,
color: Colors.purple,
onTap: () {
setState(() {
_color = Colors.purple;
_colorName = 'purple';
});
})
],

When we pressed the menu toggle button then, the button open circular animation form. Then button menu icon change to the close icon. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Final Output

Code File:

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

class CircularMenuDemo extends StatefulWidget {
@override
_CircularMenuDemoState createState() => _CircularMenuDemoState();
}

class _CircularMenuDemoState extends State<CircularMenuDemo> {
String _colorName ;
Color _color ;

@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.grey[100],
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Colors.cyan[200],
title: Text('Flutter Animated Circular Menu Demo'),
),
body: CircularMenu(
alignment: Alignment.center,
backgroundWidget: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Center(
child: Padding(
padding: const EdgeInsets.all(100.0),
child: RichText(
text: TextSpan(
style: TextStyle(color: Colors.black, fontSize: 20,fontWeight: FontWeight.bold),
children: <TextSpan>[
TextSpan(text: 'Press the menu button'),
],
),
),
),
),
],
),
curve: Curves.bounceOut,
reverseCurve: Curves.bounceInOut,
toggleButtonColor: Colors.cyan[400],
items: [
CircularMenuItem(
icon: Icons.home,
color: Colors.brown,
onTap: () {
setState(() {
_color = Colors.brown;
_colorName = 'Brown';
});
}),
CircularMenuItem(
icon: Icons.search,
color: Colors.green,
onTap: () {
setState(() {
_color = Colors.green;
_colorName = 'Green';
});
}),
CircularMenuItem(
icon: Icons.settings,
color: Colors.red,
onTap: () {
setState(() {
_color = Colors.red;
_colorName = 'red';
});
}),
CircularMenuItem(
icon: Icons.chat,
color: Colors.orange,
onTap: () {
setState(() {
_color = Colors.orange;
_colorName = 'orange';
});
}),
CircularMenuItem(
icon: Icons.notifications,
color: Colors.purple,
onTap: () {
setState(() {
_color = Colors.purple;
_colorName = 'purple';
});
})
],
),
),
);
}
}

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Animated Circular Menu in your flutter projectsWe will show you what the introduction is?. Some circular menu parameters, make a demo program for working Animated Circular Menu and show when the user taps a button the animations will occur with beautiful icons. All icons open in circular form with an animation effect. When we pressed the menu toggle button, the button menu icon changed to the close icon using the circular_menu package in your flutter applications, so please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.

find the source code of the Flutter Animated Circular Menu Demo:

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


From Our Parent Company Aeologic

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

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

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

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

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


Explore IndexedStack Widget In Flutter

0

Widgets are settled with one another to construct the application. It implies your application’s base is itself a widget, and right down is a widget moreover. For instance, a widget can show something, characterize configuration, deal with communication, etc. At whatever point you will code for building anything in Flutter, it will be inside a widget.

The focal reason for existing is to construct the application out of widgets. It portrays how your application view should look like with their present setup and state. When you modified the code, the widget rebuilt its depiction by computing the contrast between the past and current widget to decide the negligible changes for rendering in the UI of the application.

In Flutter, nearly everything is a widget — even layout models are widgets. The pictures, symbols, and text you find in a Flutter application are on the widgets. In any case, things you don’t see are additionally widgets, like the rows, columns, and grids that arrange, oblige and align the obvious widgets.

In this article, we will Explore IndexedStack Widget In Flutter. We will implement an indexedstack widget demo program and create a custom navigation bar in your flutter applications.

IndexedStack class – widgets library – Dart API
API docs for the IndexedStack class from the widgets library, for the Dart programming language.api.flutter.dev

Table Of Contents::

IndexedStack Widget

Properties

Code Implementation

Code File

Conclusion



IndexedStack Widget:

An IndexedStack is a stack where only one component is shown at one time by its index. A Stack that shows a solitary child from a list of children. The showed child is the one with the given index. The stack is consistently just about as large as the biggest child. On the off chance that the value is null, nothing is shown.

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

Below demo video shows how to create a custom navigation bar in a flutter. It shows how the custom navigation bar will work using the IndexedStack widget in your flutter applications. It shows three buttons on the bottom screen. When the user taps on these buttons, it will show the data. It will be shown on your device.

Demo Module :


Properties:

There are some properties of IndexedStack Widget:

  • > index: These properties are used to the index of the child to show.
  • > children: These properties are used to the List<Widget>. The widgets below this widget in the tree.
  • > alignment: These properties are used to align the non-positioned and partially-positioned children in the stack.
  • > sizing: These properties are used to size the non-positioned children in the stack.
  • > textDirection: These properties are used to the text direction with which to resolve alignment.

Implementation:

Step 1: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

We will create an integer index that is zero.

int index = 0;

In the body, we will add a column widget. In the Column widget, we will create two widgets are_stackedContainers() and _navigationButtons(). We will deeply define the below code.

Column(
children: <Widget>[
_stackedContainers(),
_navigationButtons()
],
),

We will deeply define _stackedContainers() widget:

In this widget, we will return an Expanded widget. Inside, we will add IndexedStack() widget. In this widget, we will add an index that means the index of the child to show. Add the children widget, inside add three containers. In these containers, we will add three images with the wrap of the center widget.

Widget _stackedContainers() {
return Expanded(
child: IndexedStack(
index: index,
children: <Widget>[
Container(
child: Center(
child: Image.asset("assets/images/flutter.png",)
)
),
Container(
child: Center(
child: Image.asset("assets/images/powered_by.png",)
)
),
Container(
child: Center(
child: Image.asset("assets/images/devs.jpg",)
)
),
],
),
);
}

We will deeply define _navigationButtons() widget:

In this widget, we will return a row widget. Inside, we will add three FlatButton(). For all three buttons, we will add text, color, and onPressed method. In this method, we will add setState() and add the different index.

Widget _navigationButtons() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FlatButton(
color:Colors.pink[300],
child: Text('Flutter', style: TextStyle(fontSize: 16.0,color: Colors.white),),
onPressed: () {
setState(() {
index = 0;
});
},
),
FlatButton(
color:Colors.pink[300],
child: Text('Aeologic', style: TextStyle(fontSize: 16.0,color: Colors.white),),
onPressed: () {
setState(() {
index = 1;
});
},
),
FlatButton(
color:Colors.pink[300],
child: Text('Flutter Devs', style: TextStyle(fontSize: 16.0,color: Colors.white),),
onPressed: () {
setState(() {
index = 2;
});
},
),
],
);
}

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

Final Output

Code File:

import 'package:flutter/material.dart';

class CustomNavigationBarDemo extends StatefulWidget {


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

class _CustomNavigationBarDemoState extends State<CustomNavigationBarDemo> {

int index = 0;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Colors.pink[300],
title: Text('Flutter Indexed Stack Demo'),
),
body: Padding(
child: Column(
children: <Widget>[
_stackedContainers(),
_navigationButtons()
],
),
padding: EdgeInsets.all(5.0),
),
);
}

Widget _stackedContainers() {
return Expanded(
child: IndexedStack(
index: index,
children: <Widget>[
Container(
child: Center(
child: Image.asset("assets/images/flutter.png",)
)
),
Container(
child: Center(
child: Image.asset("assets/images/powered_by.png",)
)
),
Container(
child: Center(
child: Image.asset("assets/images/devs.jpg",)
)
),
],
),
);
}

Widget _navigationButtons() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FlatButton(
color:Colors.pink[300],
child: Text('Flutter', style: TextStyle(fontSize: 16.0,color: Colors.white),),
onPressed: () {
setState(() {
index = 0;
});
},
),
FlatButton(
color:Colors.pink[300],
child: Text('Aeologic', style: TextStyle(fontSize: 16.0,color: Colors.white),),
onPressed: () {
setState(() {
index = 1;
});
},
),
FlatButton(
color:Colors.pink[300],
child: Text('Flutter Devs', style: TextStyle(fontSize: 16.0,color: Colors.white),),
onPressed: () {
setState(() {
index = 2;
});
},
),
],
);
}
}

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the IndexedStack Widget in your flutter projectsWe will show you what the IndexedStack Widget is?. Some indexedstack widget properties, make a demo program for working IndexedStack Widget, and create a custom navigation bar. It shows three buttons on the bottom screen. The user taps on these buttons will show the data using the IndexedStack widget in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.

find the source code of the Flutter Indexed Stack Demo:

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


From Our Parent Company Aeologic

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

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

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

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

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


Drag And Drop GridView In Flutter

Drag and drop is typical mobile application interaction. As the user long presses (at times called touch and hold) on a widget, another widget shows up underneath the user’s finger, and the user drags the widget to a last area and deliveries it. On multitouch devices, various drags can happen simultaneously because there can be numerous pointers in contact with the devices without a moment’s delay. To restrict the number of concurrent drags, utilize the maxSimultaneousDrags property. The default is to permit a limitless number of concurrent drags.

In this article, we will explore the Drag And Drop GridView In Flutter. We will implement a drag-and-drop grid view demo program and creating a reorder of the GridViewItems simple by Drag And Drop using the drag_and_drop_gridview package in your flutter applications.

drag_and_drop_gridview | Flutter Package
Drag And Drop GridView extends the functionality of the GridView widget in Flutter and gives you the freedom of…pub.dev

Table Of Contents::

Introduction

Implementation

Code Implement

Code File

Conclusion



Introduction:

Drag And Drop GridView extends the usefulness of the GridView widget in Flutter and gives you the opportunity of making a reorder of the GridViewItems straightforward by Drag And Drop. It is too simple to execute and excellent to utilize.

Demo Module :

This demo video shows how to create a drag-and-drop grid view in a flutter. It shows how the drag-and-drop grid view will work using the drag_and_drop_gridview package in your flutter applications. It shows drag-and-drop interaction where the user long presses on a choice of item and then drags it to the picture using the drag and drop technique. Something like a grid view with drag and drop can change the position both horizontally and vertically. It will be shown on your device.

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
drag_and_drop_gridview:

Step 2: Import

import 'package:drag_and_drop_gridview/devdrag.dart';

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

We will create a list of strings of an image and define it on a staggered _imageUrls.

List<String> _imageUrls = [
'https://cdn.pixabay.com/photo/2020/12/15/16/25/clock-5834193__340.jpg',
'https://cdn.pixabay.com/photo/2020/09/18/19/31/laptop-5582775_960_720.jpg',
'https://media.istockphoto.com/photos/woman-kayaking-in-fjord-in-norway-picture-id1059380230?b=1&k=6&m=1059380230&s=170667a&w=0&h=kA_A_XrhZJjw2bo5jIJ7089-VktFK0h0I4OWDqaac0c=',
'https://cdn.pixabay.com/photo/2019/11/05/00/53/cellular-4602489_960_720.jpg',
'https://cdn.pixabay.com/photo/2017/02/12/10/29/christmas-2059698_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/01/29/17/09/snowboard-4803050_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/02/06/20/01/university-library-4825366_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/11/22/17/28/cat-5767334_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/12/13/16/22/snow-5828736_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/12/09/09/27/women-5816861_960_720.jpg',
"https://images.pexels.com/photos/1144687/pexels-photo-1144687.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",
"https://images.pexels.com/photos/2589010/pexels-photo-2589010.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"
];

We will create an integer variable set equal to zero, add scrollController and add double od width and height.

int variableSet = 0;
ScrollController? _scrollController;
double? width;
double? height;

In the body part, we will add DragAndDropGridView(). Inside, we will add a controller and gridDelegate. The gridDelegate argument must not be null. Add SliverGridDelegateWithFixedCrossAxisCount() means creates a delegate that makes grid layouts with a fixed number of tiles in the cross axis.

DragAndDropGridView(
controller: _scrollController,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 3 / 4.5,
),
),

In DragAndDropGridView(), we will add itemBuilder that it will be called only with indices greater than or equal to zero and less than `itemCount.` LayoutBuilder(), set height, and width. We will return GridTile(), add an image dot network. Also, add itemCount.

itemBuilder: (context, index) => Card(
elevation: 2,
child: LayoutBuilder(
builder: (context, constrains) {
if (variableSet == 0) {
height = constrains.maxHeight;
width = constrains.maxWidth;
variableSet++;
}
return GridTile(
child: Image.network(
_imageUrls[index],
fit: BoxFit.cover,
height: height,
width: width,
),
);
},
),
),
itemCount: _imageUrls.length,

We will add onWillAccept means this function allows you to validate if you want to accept the change in the order of the gridViewItems. If you always want to accept the change, return true.

onWillAccept: (oldIndex, newIndex) {
if (_imageUrls[newIndex] == "something") {
return false;
}
return true;
},

We will add onReorder means this function deals with changing the index of the newly arranged gridItems. Add final temp is equal to the _imageUrls[oldIndex], _imageUrls[oldIndex] is equal to the _imageUrls[newIndex], and _imageUrls[newIndex] is equal to the temp.

onReorder: (oldIndex, newIndex) {
final temp = _imageUrls[oldIndex];
_imageUrls[oldIndex] = _imageUrls[newIndex];
_imageUrls[newIndex] = temp;

setState(() {});
},

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

Final Output

Code File:

import 'package:drag_and_drop_gridview/devdrag.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

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

class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
List<String> _imageUrls = [
'https://cdn.pixabay.com/photo/2020/12/15/16/25/clock-5834193__340.jpg',
'https://cdn.pixabay.com/photo/2020/09/18/19/31/laptop-5582775_960_720.jpg',
'https://media.istockphoto.com/photos/woman-kayaking-in-fjord-in-norway-picture-id1059380230?b=1&k=6&m=1059380230&s=170667a&w=0&h=kA_A_XrhZJjw2bo5jIJ7089-VktFK0h0I4OWDqaac0c=',
'https://cdn.pixabay.com/photo/2019/11/05/00/53/cellular-4602489_960_720.jpg',
'https://cdn.pixabay.com/photo/2017/02/12/10/29/christmas-2059698_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/01/29/17/09/snowboard-4803050_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/02/06/20/01/university-library-4825366_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/11/22/17/28/cat-5767334_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/12/13/16/22/snow-5828736_960_720.jpg',
'https://cdn.pixabay.com/photo/2020/12/09/09/27/women-5816861_960_720.jpg',
"https://images.pexels.com/photos/1144687/pexels-photo-1144687.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",
"https://images.pexels.com/photos/2589010/pexels-photo-2589010.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"
];

int variableSet = 0;
ScrollController? _scrollController;
double? width;
double? height;

@override
void initState() {
super.initState();
}

@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.blueGrey[100],
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Flutter Drag And Drop GridView'),
),
body: Center(
child: DragAndDropGridView(
controller: _scrollController,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 3 / 4.5,
),
padding: EdgeInsets.all(20),
itemBuilder: (context, index) => Card(
elevation: 2,
child: LayoutBuilder(
builder: (context, constrains) {
if (variableSet == 0) {
height = constrains.maxHeight;
width = constrains.maxWidth;
variableSet++;
}
return GridTile(
child: Image.network(
_imageUrls[index],
fit: BoxFit.cover,
height: height,
width: width,
),
);
},
),
),
itemCount: _imageUrls.length,
onWillAccept: (oldIndex, newIndex) {
if (_imageUrls[newIndex] == "something") {
return false;
}
return true;
},
onReorder: (oldIndex, newIndex) {
final temp = _imageUrls[oldIndex];
_imageUrls[oldIndex] = _imageUrls[newIndex];
_imageUrls[newIndex] = temp;

setState(() {});
},
),
),
),
);
}
}

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Drag And Drop GridView in your flutter projectsWe will show you what the Introduction is?. Make a demo program for working Drag And Drop GridView, and show drag-and-drop interaction where the user long presses on a choice of item and then drags that item to the picture using the drag and drop technique. Something like a grid view with drag and drop can change the position both horizontally and vertically using the drag_and_drop_gridview package in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

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

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

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

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

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


Rotated Box Widget In Flutter

0

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

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

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

Table Of Contents::

Rotated Box Widget

Flutter

Implementation

Code Implement

Code File

Conclusion



Rotated Box Widget:

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

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

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

Flutter :

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

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

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

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

Implementation:

Step 1: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

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

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

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

RotatedBox With quarterTurns is 3

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

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

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

RotatedBox With quarterTurns is 5

Code File:

import 'package:flutter/material.dart';


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

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

class RotatedDemo extends StatefulWidget {

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

class _RotatedDemoState extends State<RotatedDemo> {

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

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

)

)
)
),
);
}
}

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Rotated Box Widget in your flutter projectsWe will show you what the Rotated Box Widget is?. Make a demo program for working Rotated Box Widget and rotate the child-like image with different quarterTurns. It renders from bottom to top, like an axis label on a graph in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

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

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

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

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

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


Draw Graph In Flutter

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

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

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

Table Of Contents::

Draw Graph

Properties

Implementation

Code Implement

Code File

Conclusion



Draw Graph

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

Demo Module :

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

Properties:

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

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
draw_graph:

Step 2: Import

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

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

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

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

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

We will deeply describe features

First, we will import the package.

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

We will create a list of feature

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

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

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

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

Flutter Graph

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

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

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

Swift Graph

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

Final Output

Code File:

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

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

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

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

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

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Draw Graph in your flutter projectsWe will show you what the Draw Graph is?. Show some draw graph properties, make a demo program for working draw graph, and show multiple axes to plot different data sets on one line graph and also we will split all line graph to proper show. It also tracks your work in one line graph using the draw_graph package in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.

find the source code of the Flutter Draw Graph Demo:

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


From Our Parent Company Aeologic

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

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

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

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

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


Explore Polls Widget In Flutter

0

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

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

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

Table Of Contents::

Introduction

Properties

Implementation

Code Implement

Code File

Conclusion



Introduction:

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

Demo Module :

Properties:

There are some properties of polls widget are:

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

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
polls:

Step 2: Import

import 'package:flutter_polls_demo/polls_demo.dart';

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

Main Screen

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

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

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

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

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

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

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

Final Output

Code File:

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

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

class _PollsDemoState extends State<PollsDemo> {

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

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

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

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Polls Widget in your flutter projectsWe will show you what the Introduction is?. Some polls widget properties, make a demo program for working Polls Widget, and show your voting data. When the user chooses an option, the background color was changed and highlighted using the polls package in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.

find the source code of the Flutter Polls Widget Demo:

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


From Our Parent Company Aeologic

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

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

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

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

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


Explore Confetti Animation In Flutter

0

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

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

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

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

Table Of Contents::

Confetti

Attributes

Implementation

Code Implement

Code File

Conclusion



Confetti:

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

Demo Module :

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

Attributes:

There are some attributes of confetti are:

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

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

confetti: 

Step 2: Add the assets

Add assets to pubspec — yaml file.

assets:
- assets/

Step 3: Import

import 'package:confetti/confetti.dart';

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

First, we will need to instantiate a ConfettiController variable.

ConfettiController controllerTopCenter;

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

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

}

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

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

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

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

We will define buildButton() method:

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

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

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

Without Confetti Animation

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

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

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

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

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

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

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

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

Final Output

Code File:

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


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

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

}

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


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

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

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

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

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

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Confetti Animation in your flutter projectsWe will show you what the Confetti is?. Some confetti attributes, make a demo program for working Confetti Animation and show a colorful confetti blast when the user taps a button then occurs. The user can handle blast types, angles, etc. Celebrate application achievements with style using the confetti package in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.

find the source code of the Flutter Confetti Animation Demo:

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


From Our Parent Company Aeologic

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

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

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

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

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


Foldable Sidebar In Flutter

0

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

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

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

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

Table Of Contents::

Foldable Sidebar

Implementation

Code Implement

Code File

Conclusion



Foldable Sidebar:

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

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

Demo Module :

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

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

dependencies:
flutter:
sdk: flutter
foldable_sidebar:

Step 2: Import

import 'package:foldable_sidebar/foldable_sidebar.dart';

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

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

FSBStatus _fsbStatus;

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

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

We will deeply define welcomeScreen() widget

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

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

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

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

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

Home Screen

We will deeply define CustomSidebarDrawer() class

First, we will create a function.

final Function drawerClose;

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

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

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

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

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

CustomSidebarDrawer

Code File:

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

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

class _HomeScreenState extends State<HomeScreen> {
FSBStatus _fsbStatus;

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


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

Conclusion:

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

I hope this blog will provide you with sufficient information on Trying up the Foldable Sidebar in your flutter projectsWe will show you what the Foldable Sidebar is?. Make a demo program for working Foldable Sidebar and show when the user tap on the floating action button, the drawer will show/hide in a folding type way using the foldable_sidebar package in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.

find the source code of the Flutter Foldable Sidebar Demo:

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


From Our Parent Company Aeologic

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

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

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

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

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


Explore Model Viewer In Flutter

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

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

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

Table Of Contents ::

Introduction

Features

Parameters

Implementation

Code Implement

Code File

Conclusion



Introduction:

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

Demo Module :

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

Features:

There are features of the model viewer:

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

Parameters:

There are some parameters of the model viewer are:

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

Implementation:

Step 1: Add the dependencies

Add dependencies to pubspec — yaml file.

model_viewer: 

Step 2: Add the assets

assets:
- assets/

Step 3: Import

import 'package:model_viewer/model_viewer.dart';

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

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

android/app/src/main/AndroidManifest.xml

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

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

How to implement code in dart file :

You need to implement it in your code respectively:

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

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

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

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

Final Output

Code File:

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

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

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

Conclusion:

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

I hope this blog will provide you with sufficient information in Trying up the Model Viewer in your flutter projectsWe will show you what the Introduction is?. Some model viewer features, parameters, make a demo program for working Model Viewer and show 3D models in the glTF and GLB format and rotate 360° degree by mouse, hand touch, and auto-rotate using the model_viewer package in your flutter applications. So please try it.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.

find the source code of the Flutter Model Viewer Demo:

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


From Our Parent Company Aeologic

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

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

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

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

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