Google search engine
Home Blog Page 62

RotationTransition In Flutter

0

In this article, we will explore the RotationTransition In Flutter. We will see how to implement a demo program to create a RotationTransition box and also shows a display animation in your flutter applications.


Table Of Contents:

What is RotationTransition?

Properties

How to declare Animation for RotationTransition

How to use RotationTransition Widget in Flutter?

Rotation Transition to Rotate Anticlockwise Flutter

Conclusion

GitHub Link


What is RotationTransition?:

RotationTransition Widget is a widget that is used to animate the rotation of the widget.

Default Constructor of it will have code snippet as below:

RotationTransition({
Key? key,
required Animation turns,
Alignment alignment = Alignment.center,
FilterQuality? filterQuality,
Widget? child,
});

In Above Constructor all the attributes marked with @requuired must not be empty so in this constructor turns must not be empty.

Properties:

There are some properties of RotationTransition are:

1:-key: This attribute key controls how one widget replaces another widget in the tree.

2:-turns: This attribute has a datatype Animation that is used to control the rotation of the child.

3:-alignment: This attribute is used to define the alignment of the origin of the coordinate system around which the rotation occurs, relative to the size of the box.

4:-child: This attribute is used to define the widget below this widget in the tree.

How to declare Animation for RotationTransition:-

Firstly we have to extend the TickerProviderStateMixin.

extends State<Rotation> with TickerProviderStateMixin{

After that we have to declare the variables

late AnimationController _controller;
late Animation<double> _animation;

And then we have to initialize those variables in a initState()

void initState() {

// TODO: implement initState
super.initState();
_controller=AnimationController(vsync:this,duration: Duration(seconds: 10));
_animation=CurvedAnimation(parent: _controller, curve: Curves.easeIn,);
_controller.repeat();
}

After initialization, we have to dispose of the animation controller because This reduces the likelihood of leaks. When used with a StatefulWidget, it is common for an AnimationController to be created in the State. initState method and then disposed in the State.

void dispose() {
_controller.dispose();
// TODO: implement dispose
super.dispose();
}

How to use RotationTransition Widget in Flutter?:

The following code will show you how to make use of the RotationTransition Widget.

class _RotationState extends State<Rotation> with TickerProviderStateMixin{ late AnimationController _controller;
late Animation<double> _animation;@override
void initState() {

// TODO: implement initState
super.initState();
_controller=AnimationController(vsync:this,duration: Duration(seconds: 10));
_animation=CurvedAnimation(parent: _controller, curve: Curves.easeIn,);
_controller.repeat();
}
@override
void dispose() {
_controller.dispose();
// TODO: implement dispose
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
RotationTransition(turns: turnsTween.animate(_controller),,
child: Center(child: Image.network('assets/img/squarebox.png',height: 200,width: 200,))),
],
),
),

);
}
}

In this RotationTransition constructor has turned as a parameter that takes animation as a value, and in animation, we can use multiple curves like easeIn, ease, bounceIn, bounceInOut, bounceOut, decelerate, easeInCubic, and many more types.

_controller=AnimationController(vsync:this,duration: Duration(seconds: 10));
_animation=CurvedAnimation(parent: _controller, curve: Curves.easeIn,);

Just changes curves you can see multiple type & by duration, you can decide how much time the animation will work. When we run the application, we ought to get the screen’s output like the underneath screen capture.

Rotation Transition to Rotate Anticlockwise Flutter:

When the widget rotates clockwise controller’s value goes from 0.0 to 1.0. To rotate in the opposite direction you need value to go from 1.0. to 0.0.To achieve that, you can set up Tween:

final Tween<double> turnsTween = Tween<double>(
begin: 1,
end: 0,
);

We have to declare Tween which will provide us the starting & ending value

RotationTransition(turns: turnsTween.animate(_controller),,
child: Center(child: Image.network('assets/img/squarebox.png',height: 200,width: 200,))),

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

Conclusion:

In this article, we discussed how this RotationTransition is being used, what are all the parameters that you can use to customize the display of it, and also it provides multiple features to customize the widget.

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

❤ ❤ 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.

GitHub Link:

find the source code of the RotationTransition:

GitHub – flutter-devs/flutter_RotationTransition
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…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 Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

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


ClipOval Widget In Flutter

0

In any good app, images are one of the key essentials. Image handling has always been a tricky part for developers. Developers always want some sort and easy method to handle the shape and size of the image. Flutter has come up with a very quick fix for this issue we face with a very handy Widget.

In this blog, I’ll be taking you through the overview, usage, and implementation of a widely popular widget known as ClipOval.


Table Of Contents:

What is ClipOval?

Constructor

Properties

Code implementation

Code Files

Conclusion


What is ClipOval?:

ClipOval is a widget that can be used to wrap any image into circular or oval form. It does not matter whether the image is square, rectangular, or any other shape. The size and location of a clip oval can be customized using child class.

The ClipOval widget does have some standard rules which it follows while its application on images for an eg a square image will be converted into a circular image, an image having any dimensions longer than the counterpart will be elongated into that direction. However, the shape will remain oval.

Constructor:

We need to use the below constructor to use the ClipOval widget in our code.

const ClipOval({Key? key, this.clipper,
this.clipBehavior = Clip.antiAlias,
Widget? child})
: assert(clipBehavior != null),
super(key: key, child: child);

Properties:

  • > Child-This property is used to define the parent builder widget under which it is being passed.
  • > ClipBehaviour– It controls the clipping behavior of the ClipOval widget on which it has been passed to. It must not be set to null or clip. none. There is further three behavior that can be passed under this property.

➤ Clip.hardEdge

➤ Clip.antiAlias

➤ Clip.antiAliasWithSaveLayer

  • > CustomClipper<Rect>? Clipper– If it has been passed as non-null then it determines which clip should be used. It is used to create custom-shaped clipped images. We can pass dimensions as per our requirements.

Code Implementation:

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

After which we will create a class inside the main.dart file.First, we will try to implement the ClipOval widget in its default form that means we won’t be using the custom clipper.

class _DemoPageState extends State<DemoPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Devs'),
backgroundColor: Colors.blue,
),
body: Center(
child: ClipOval(
child: Image.network(
'https://images.unsplash.com/photo-1561731216-c3a4d99437d5?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8MXx8fGVufDB8fHx8&w=1000&q=80',
fit: BoxFit.fill),
),
),
backgroundColor: Colors.lightBlue[50],
);
}
}

Here we are simply creating a new class and then passing the image in the scaffold widget. To get the desired oval shape we have wrapped the image in ClipOval.

Now we will try the same image using a custom clipper in the below code. For doing this we will create a custom clipper method in a whole new class. We will extend the class to Customclipper<Rect>.

class MyClip extends CustomClipper<Rect>

To make sure that our clipper works as per our requirement we will pass two methods getClip and shouldReclip.

class MyClip extends CustomClipper<Rect> {
Rect getClip(Size size) {
return Rect.fromLTWH(50, 0, 300, 300);
}

bool shouldReclip(oldClipper) {
return false;
}
}

The getClip method takes the size of the child and returns to Rect into which flutter will draw the oval. Also, you can place this Rect anywhere and give it any size as per your requirement regardless of the child’s size.

The second method is just a cross-check for flutter to check whether there is any need to clip the image again or not. It takes the boolean value as a return argument. Normally we should return it as false as we have already met the requirement in the getClip method we created.

Code Files:

import 'package:flutter/material.dart';

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

class DemoApp extends StatelessWidget {
// This widget is
//the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'ClipOval',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: DemoPage(),
debugShowCheckedModeBanner: false,
);
}
}

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

class _DemoPageState extends State<DemoPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Devs'),
backgroundColor: Colors.blue,
),
body: Center(
child: ClipOval(
child: Image.network(
'https://images.unsplash.com/photo-1561731216-c3a4d99437d5?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8MXx8fGVufDB8fHx8&w=1000&q=80',
fit: BoxFit.fill),
clipper: MyClip(),
),
),
backgroundColor: Colors.lightBlue[50],
);
}
}

class MyClip extends CustomClipper<Rect> {
Rect getClip(Size size) {
return Rect.fromLTRB(0, 100, 100, 100);
}

bool shouldReclip(oldClipper) {
return false;
}
}

Conclusion:

In the end, clipOval is a widget that can be quite handy while dealing with images. We don’t have to go through the inner structures of the code and worry about shape and size. Rather we can directly import this widget and acquire our desired dimensions.

Thanks for reading the entire article. It was just a small overview of the clipOval widget its functionality and implementation. I hope the time you spent reading this article turns out to be productive. You can try implementing and modifying this code as per your needs. Feel free to reach out to me for any suggestions or corrections where I can improve.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

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

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

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

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

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


GetX In Flutter

0

In this article, we will explore GetX In Flutter. We will see how to implement a demo program using GetX and show you how easily we can do everything in the application.


Table Of Contents:

About Getx

installation

Features of Getx

Conclusion

GitHub Link


About GetX:

GetX is an extra-light and powerful solution for flutter by using getx we can easily manage routing, states and can efficiently perform dependency injection.

If we use GetX then we can not have to use the StatefulWidgets, it can surely reduce some RAM consumption, no need to use the initState() and other such methods which are used in StatefulWidgets.

GetX has 3 basic principles. This means that these are the priority for all resources in the library:

1:-PERFORMANCE: it is focused on performance and minimum consumption of resources. it does not use Streams or ChangeNotifier.

2:-PRODUCTIVITY: it has an easy syntax that can easily remember. No matter what you want to do, there is always an easier way with GetX. It will save hours of development and will provide the maximum performance your application can deliver.

3:-ORGANIZATION: it allows us to do away with business logic on views and separate dependency injection and navigation from the UI. You don’t require the context to navigate between screens.

Installation :

Add Get to your package’s pubspec.yaml file:

dependencies:
get: ^4.6.1

Import it in a file that it will be used:

import 'package:get/get.dart';

Features Of GetX:

GetX has multiple features you will need in your daily app development in Flutter:

> State Management

Get has two different state managers:

1:-Simple state manager (known as GetBuilder).

The Simple state Management uses extremely low resources since it does not use Streams or ChangeNotifier. But your widgets can listen to changes of your state, we use the update() method.

import 'package:get/get.dart';
class CounterController extends GetxController {
var counter = 0;
increment() {
counter++;
update();
} }

After doing some changes to your state in your controller, you have to call the update method to notify the widgets, which are listening to the state. As you can see, we have to simply declare the state of the variable as we normally do. So, you don’t need to transform your state variables into something else.

2:-Reactive state manager (known as GetX/Obx).

Reactive State Management: In this, we’ll not able to use streams for this we have to use GetX class. syntax of GetX is very similar to GetBuilder. GetX has all the required Reactive Programming features we don’t need to use StreamControllers, StreamBuilders for each variable, and class for each state, even we do not need to use any auto-generated classes by code generators.

Let’s imagine that you have a named variable and want that every time you change it, all widgets that use it are automatically changed.

This is a count variable:

var name = 'Jonatas Borges';

To make it observable, you just need to add “.obs” to the end of it:

var name = 'Jonatas Borges'.obs;

And in the UI, when you want to show that value and update the screen whenever the values change, simply do this:

Obx(() => Text("${controller.name}"));

> Route Management

GetX provides API for navigating within the Flutter application. This API is simple and with less code needed.
in the old way, we can use this

Navigator.push(context, MaterialPageRoute(builder: (context)=>Profile()));

but in getx, we can simply navigate through this// Before:

MaterialApp(
GetMaterialApp(
home: MyHome(),
)Get.to(Profile());
Get.toNamed('/profile');
Get.back();
Get.off(Profile());
Get.offAll(Profile());

> Dependency Management

it provides a smart way to manage dependencies in your Flutter application like the view controllers. GetX will remove any controller not being used at the moment from memory. This was a task you as the developer will have to do manually but GetX does that for you automatically out of the box.

Controller controller = Get.put(Controller());

if you navigate through multiple routes, and you require data that was left behind in your controller, you would need a state manager combined with the Provider or Get_it, correct? Not with Get. You just need to ask to Get to “find” for your controller, you don’t need any additional dependencies:

Controller controller = Get.find();

And then you will be able to recover your controller data that was obtained:

Text(controller.textFromApi);

> Internationalization

Internationalization is an activity that developers, perform and it provides the multiple language support feature in an application.
GetX provides API for navigating within the Flutter application. This API is simple and with less code needed.

import 'package:get/get.dart';

class Messages extends Translations {
@override
Map<String, Map<String, String>> get keys => {
'en_US': {
'hello': 'Hello World',
},
'de_DE': {
'hello': 'Hallo Welt',
}};}

Using translations

Just append .tr to the specified key and it will be translated, using the current value of Get.locale and Get.fallbackLocale.Text(‘title’.tr);

Using translation with singular and plural

var products = [];
Text('singularKey'.trPlural('pluralKey', products.length, Args));

Using translation with parameters

import 'package:get/get.dart';

Map<String, Map<String, String>> get keys => {
'en_US': {
'logged_in': 'logged in as @name with email @email',
},
'es_ES': {
'logged_in': 'iniciado sesión como @name con e-mail @email',
}
};

Text('logged_in'.trParams({
'name': 'Jhon',
'email': 'jhon@example.com'
}));

Locales

Pass parameters to GetMaterialApp to define the locale and translations.

return GetMaterialApp(
translations: Messages(), // your translations
locale: Locale('en', 'US'), // translations will be displayed in that locale
fallbackLocale: Locale('en', 'UK'), // specify the fallback locale in case an invalid locale is selected.
);

Change locale

var locale = Locale('en', 'US');
Get.updateLocale(locale);

> Change Theme

While we are using GetX we don’t need to use any higher level widget than GetMaterialApp.

You can create your custom theme and simply add it within Get.changeTheme without any boilerplate for that:

Get.changeTheme(ThemeData.light());

> GetConnect

GetConnect is an easy way to communicate from your back to your front with HTTP or WebSockets.

Default configuration

You can simply extend GetConnect and use the GET/POST/PUT/DELETE/SOCKET.

class UserProvider extends GetConnect {
// Get request
Future<Response> getData() => get('url');
// Post request
Future<Response> postData(Map data) => post('Url', body: data);
}

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

Conclusion:

In this article, we discussed how this GetX is being used, what are all the features provided by Getx also you can use to minimize the ram consumption, and also it provides multiple features that minimize our work.

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

❤ ❤ 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.


GitHub Link:

find the source code of the Getx:

GitHub – flutter-devs/flutter_Getx
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…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 Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

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


SQFlite In Flutter

0

SQFlite is a plugin in flutter which is used to store the data. In SQFlite we perform many operations like create, delete, update, etc. This operation is called CRUD Operations. Using this we can easily store the data in a local database.


Table Of Contents::

Introduction

AddDependency

Create Database

Create Model Class

CURD Operations

Implementation

Conclusion

GitHub Link


Introduction:

There are many ways to store the data in flutter but SQFlite is a very easy plugin to store the data locally. SQFlite plugin supports IOS, Android, and macOS. SQFLite is one of the most used and up-to-date packages for linking to SQLite databases in Flutter.


Add Dependency:

In your project go to the pubspec. yaml and add the dependencies under the dependencies: add the latest version of sqflite, into, and flutter_staggered_grid_view.

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
sqflite: ^2.0.0+3
intl: ^0.17.0
flutter_staggered_grid_view: ^0.4.0-nullsafty.3

We use sqflite for database storage, intl is used for DateTime format and flutter_staggered_grid_view is used for display todos in the grid.


Create Database:

  • > Create Database: We need to open a connection of the database to reach and write data. And for this, we create a database, and inside of it we want to return our database in case it already exists however if it does not exist then we need to initialize our database and for that, we create new file notes. db and in this we store database. and return the database so that can later make use of it.
Future<Database> get database async {
if (_database != null) return _database!;

_database = await _initDB('notes.db');
return _database!;
}
  • > Initialize Database: For initialize database we add a new method where we get the file path. and store our database in our file storage system.
Future<Database> _initDB(String filePath) async {
final dbPath = await getDatabasesPath();
final path = join(dbPath, filePath);

return await openDatabase(path, version: 1, onCreate: _createDB);
}
  • > Database Method: we create a _createDB method inside openDatabase(). And inside this method we want to call the database execute method(), we can put our create table statement and define the structure of our table.
Future _createDB(Database db, int version) async {
final idType = 'INTEGER PRIMARY KEY AUTOINCREMENT';
final textType = 'TEXT NOT NULL';
final boolType = 'BOOLEAN NOT NULL';
final integerType = 'INTEGER NOT NULL';

await db.execute('''
CREATE TABLE $tableNotes (
${NoteFields.id} $idType,
${NoteFields.isImportant} $boolType,
${NoteFields.number} $integerType,
${NoteFields.title} $textType,
${NoteFields.description} $textType,
${NoteFields.time} $textType
)
''');
}

Create Model Class:

We create a class Note and here inside we add all the fields which we want to store in our database. To store our node we need to create a table. So we create table name notes.

class Note {
final int? id;
final bool isImportant;
final int number;
final String title;
final String description;
final DateTime createdTime;

const Note({
this.id,
required this.isImportant,
required this.number,
required this.title,
required this.description,
required this.createdTime,
});

And all the fields which we want to create. For that, we create a new class NoteFields in which we define our field name.


CURD Operations:

> Create:

The Sqflite package provides two ways to hold these operations using RawSQL queries or by using table name and a map that contains the data :

rawInsert:

Future<Note> create(Note note) async {
final db = await instance.database;
final json = note.toJson();
final columns =
'${NoteFields.title}, ${NoteFields.description}, ${NoteFields.time}';
final values =
'${json[NoteFields.title]}, ${json[NoteFields.description]}, ${json[NoteFields.time]}';
final id = await db
.rawInsert('INSERT INTO table_name ($columns) VALUES ($values)');
return note.copy(id: id);
}

Insert:

Future<Note> create(Note note) async {
final db = await instance.database;
final id = await db.insert(tableNotes, note.toJson());
return note.copy(id: id);
}

> Read:

We create a ReadNote and pass id in it. which we have before generated and if you pass down the id inside then we can get from our database the note object again. We define our database and then create a method query(), first we add a table(tableNotes) inside and define all the columns. Create a value list in NoteFiels class. and define which note object you want to read. Use where and whereArgs which prevents SQL injection attacks.

Future<Note> readNote(int id) async {
final db = await instance.database;

final maps = await db.query(
tableNotes,
columns: NoteFields.values,
where: '${NoteFields.id} = ?',
whereArgs: [id],
);

if (maps.isNotEmpty) {
return Note.fromJson(maps.first);
} else {
throw Exception('ID $id not found');
}
}

> Update:

To update our notes we use the update Curd operation. By which we can update the text. ER create an update method in which we pass note object inside. Add the database reference and return the update method and as same we need to define the table which we want to update and secondly, we need to pass the note object and pass JSON object inside.

Future<int> update(Note note) async {
final db = await instance.database;

return db.update(
tableNotes,
note.toJson(),
where: '${NoteFields.id} = ?',
whereArgs: [note.id],
);
}

> Delete:

When we need to delete our object so we use the delete Curd operation. For deleting anything we need to create a method which name is delete(). And pass the note object, therefore we simply call here this method db. delete() and define here a table which we want to delete and lastly we define which object we want to delete.

Future<int> delete(int id) async {
final db = await instance.database;

return await db.delete(
tableNotes,
where: '${NoteFields.id} = ?',
whereArgs: [id],
);
}

Implementation:

In the SQFlite demo first, we take a stateful class. and define a list which name is notes and a bool variable isLoading. after that we create a method refreshNotes() in which we pass isLoading is true and refresh readallnotes(),

Future refreshNotes() async {
setState(() => isLoading = true);

this.notes = await NotesDatabase.instance.readAllNotes();

setState(() => isLoading = false);
}

And pass this method to initstate(). In the BuildContext() we pass the Scaffold and use the property of the appbar. In the body, we pass a method which is buildNotes(), In this method, we pass StaggeredGridView.countBuilder() IN this weight we show all the card which is created, and if there is no card so it shows an empty screen.

Widget buildNotes() => StaggeredGridView.countBuilder(
padding: EdgeInsets.all(8),
itemCount: notes.length,
staggeredTileBuilder: (index) => StaggeredTile.fit(2),
crossAxisCount: 4,
mainAxisSpacing: 4,
crossAxisSpacing: 4,
itemBuilder: (context, index) {
final note = notes[index];

return GestureDetector(
onTap: () async {
await Navigator.of(context).push(MaterialPageRoute(
builder: (context) => NoteDetailPage(noteId: note.id!),
));

refreshNotes();
},
child: NoteCardWidget(note: note, index: index),
);
},
);

At the bottom, we create a FloatingActionButton() which is used for creating new notes. On the click at FloatingActionButton(), its navigate to the AddEditNotePage().

In the AddEditNotePage() we create a form() in which we write our text and we pass a button which name is saved, it is used to save the text. For this, we create a method which name is buildButton() in this we check whether it isFormValid or not.

Widget buildButton() {
final isFormValid = title.isNotEmpty && description.isNotEmpty;

return Padding(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
onPrimary: Colors.white,
primary: isFormValid ? null : Colors.grey.shade700,
),
onPressed: addOrUpdateNote,
child: Text('Save'),
),
);
}

In the appbar we define two buttons one is for update and the other one is for deleting the notes. To edit the note we create a method editButton(). at the click of this button, we navigate to the edit page and after editing this its refreshes the page.

Widget editButton() => IconButton(

icon: Icon(Icons.edit_outlined),
onPressed: () async {
if (isLoading) return;

await Navigator.of(context).push(MaterialPageRoute(
builder: (context) => AddEditNotePage(note: note),
));

refreshNote();
});

And the other button which is used for deleting notes, we create a method deleteButton() in which we delete the instance of the note.

Widget deleteButton() => IconButton(
icon: Icon(Icons.delete),
onPressed: () async {
await NotesDatabase.instance.delete(widget.noteId);

Navigator.of(context).pop();
},
);

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


Conclusion:

In this article, we have been through What is SQFlite in Flutter along with how to implement it in a Flutter. By using we can perform many curd orations. And we can easily add or delete the database locally.

❤ 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.


GitHub Link:

Find the source code of the SQFlite In Flutter :

GitHub – flutter-devs/flutter_sqflite
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…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 Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

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


Linear Progress Indicator In Flutter

0

Guess if you have opened any App and it shows a blank page. You will be having no clue what that application is doing. Even though the app might be doing some tasks in the background. Won’t it will affect the user experience? It will and users will end up having a bad opinion and review for the app.

To prevent this from happening flutter developers introduced a class named Linear Progress Indicator. It is one of the most used class while we have to make the user informed that the process which he initiated is being executed by the application and they need to wait for it to finish. It also helps in keeping the user aware of the progress that the task has made.

In this blog, I’ll be taking you through the overview, usage, and implementation of the class Linear Progress Indicator.


Table Of Contents:

What is Linear Progress Indicator?

Types

Constructor

Properties

Code implementation

Code Files

Conclusion


What is Linear Progress Indicator?

Linear Progress Indicator is predefined in the flutter using which we can make the user aware that some task is being executed by the application and once it finishes they will have the output or result. It can also be used for loading time so that users don’t have to see the blank screen.


Types:

  1. Indeterminate: Indeterminate progress indicator just used to show that app is running and performing some tasks. However, init a user won’t be having any clue when that background process will finish. For creating an indeterminate progress bar we set the value property null.
  2. Determinate: It is a type of indicator some set time has been calculated for the execution of tasks. It also indicates how much progress is completed. The value in the determinate progress indicator range from 0 to 1 where 0 indicates that progress is just started and 1 indicates that the progress is completed.

Constructor:

We need to use the below constructor to use the ClipOval widget in our code.

const LinearProgressIndicator({
Key? key,
double? value,
Color? backgroundColor,
Color? color,
Animation<Color?>? valueColor,
this.minHeight,
String? semanticsLabel,
String? semanticsValue,
}) : assert(minHeight == null || minHeight > 0),
super(
key: key,
value: value,
backgroundColor: backgroundColor,
color: color,
valueColor: valueColor,
semanticsLabel: semanticsLabel,
semanticsValue: semanticsValue,
);

Properties:

> value: It is the property that helps in differentiating between determinate and indeterminate progress indicators. If the value is set to null then the indicator will be indeterminate. However, if some value has been passed then it will work as a determinate progress indicator.

> backgroundColor: This property is used to set the background color of the progress loader.

> minHeight: It is the minimum height of the line that is used to draw the indicator in a LinearProgressIndicator or other words it is used to define how thick the line of an indicator looks.

> valueColor: It is used to define the progress indicator’s value as an animated value. This property covers the highlights of the completed task valued.

> AlwaysStoppedAnimation: It is used to specify a constant color in the valueColor property.

> Semantic Label: Used to add a semantic label.

> Semantic Value: Used to add Semantic value.

Code Implementation:

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

After which we will create a class inside the main.dart file.First, we will try to implement the Indeterminate progress indicator.

In the following code, we have created a class ProgressIndicator and used LinearProgressIndicator without passing any value.

class MyApp extends StatelessWidget { @override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Linear Progression Indicator',
debugShowCheckedModeBanner: false,
home: ProgressionIndicator(),
);
}
}
class ProgressionIndicator extends StatefulWidget {
const ProgressionIndicator({Key? key}) : super(key: key); @override
_ProgressionIndicatorState createState() => _ProgressionIndicatorState();
}class _ProgressionIndicatorState extends State<ProgressionIndicator> {
@override
Widget build(BuildContext context) {
return Scaffold( appBar: AppBar( backgroundColor: Colors.red, title:Text( "Flutter Devs"), ),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Linear Progression Indicator',style: TextStyle(color: Colors.black,fontSize: 20),),
Padding(
padding: const EdgeInsets.all(20.0),
child: LinearProgressIndicator(
backgroundColor: Colors.orangeAccent,
valueColor: AlwaysStoppedAnimation(Colors.blue),
minHeight: 25,
),
), ],
),
);
}
}

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

Now we will try to implement the determinate example in our code. For the same, we will use the Timer. period constructor. It creates a reoccurring callback function until we use the cancel function or it meets certain conditions.

So now we will initialize a variable with a value of zero.double value= 0;

Now we will create a function and increase the value variable by 0.1 every second. Also simultaneously we will update the state of the UI every time the function in revoked.

void determinateIndicator(){
new Timer.periodic(
Duration(seconds: 1),
(Timer timer){
setState(() {
if(value == 1) {
timer.cancel();
}
else {
value = value + 0.1;
}
});
}
);
}

Now we will pass this function on the tap of an elevated button.

Container(
margin: EdgeInsets.all(20),
child: ElevatedButton(
child: Text("Start"),
style: ElevatedButton.styleFrom(
onPrimary: Colors.white,
primary: Colors.blueGrey
),
onPressed: ()
{
value = 0;
determinateIndicator();
setState(() { });
},
),
)

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

Here we can see that our progress bar indicator is reflecting the progress. It turns red little by little indicating the progress of the function we defined. We can customize the animation and also show the percentage of how in written too. We can make the changes as per our requirement.

Code Files:

import 'dart:async';import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';void main() {
runApp(MyApp());
}class MyApp extends StatelessWidget { @override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Linear Progression Indicator',
debugShowCheckedModeBanner: false,
home: ProgressionIndicator(),
);
}
}
class ProgressionIndicator extends StatefulWidget {
const ProgressionIndicator({Key? key}) : super(key: key); @override
_ProgressionIndicatorState createState() => _ProgressionIndicatorState();
}class _ProgressionIndicatorState extends State<ProgressionIndicator> {
double value = 0; @override
Widget build(BuildContext context) {
return Scaffold( appBar: AppBar( backgroundColor: Colors.red, title:Text( "Flutter Devs"), ),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Indeterminate Indicator',style: TextStyle(color: Colors.black,fontSize: 20,fontWeight: FontWeight.w500),),
Padding(
padding: const EdgeInsets.all(20.0),
child: LinearProgressIndicator(
backgroundColor: Colors.orangeAccent,
valueColor: AlwaysStoppedAnimation(Colors.blue),
minHeight: 25,
),
),
SizedBox(height: 20,),
Text("Determinate Indicator",style: TextStyle(color: Colors.black,fontSize: 20,fontWeight: FontWeight.w500),),
Container(
margin: EdgeInsets.all(20),
child: LinearProgressIndicator(
backgroundColor: Colors.lightBlueAccent,
color: Colors.red, minHeight: 15,
value: value,
),
),
Container(
margin: EdgeInsets.all(20),
child: ElevatedButton(
child: Text("Start"),
style: ElevatedButton.styleFrom(
onPrimary: Colors.white,
primary: Colors.blueGrey
),
onPressed: ()
{
value = 0;
determinateIndicator();
setState(() { });
},
),
)

],
),
);
}
void determinateIndicator(){
new Timer.periodic(
Duration(seconds: 1),
(Timer timer){
setState(() {
if(value == 1) {
timer.cancel();
}
else {
value = value + 0.1;
}
});
}
);
}}

Conclusion:

In the end, LinearProgressIndicator is a very useful tool in enhancing the user experience. It aids the user to understand and keep their expectations fulfilled. It is widely used to indicate the download percentage, uploading status, queue time, and many more.

It is very easy to use it and we can do numerous things using it. We can make it adapt to our code as per our requirements. It was just a small overview of the Linear Progress Indicator class its functionality and implementation. I hope the time you spent reading this article turns out to be productive. You can try implementing and modifying this code as per your needs.

Feel free to reach out to me for any suggestions or corrections where I can improve.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

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

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

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

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

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


A/B Testing In Flutter

0

A/B testing (also known as split testing or bucket testing) is a method of comparing two versions of a webpage or app against each other to find out which one performs better. A/B testing is essentially an analysis where two or more alterations of a page are shown to users at random, and statistical analysis is used to determine which alterations perform better for a given conversion goal.

Powered by Google Optimize, Firebase A/B Testing helps you optimize your app experience by making it easy to run, explore, and scale product and marketing experiments.… A/B Testing works with FCM so you can test different marketing messages, and with Remote Config so you can test changes within your app.


Table Of Contents:

Benefits of A/B Testing

When to use A/B Testing

How to Do A/B Testing

Why you should A/B Testing

Firebase Remote Config

Implementation

Conclusion

GitHub Link


Benefits of A/B Testing:

There are many benefits of A/B testing, just like we can easily compare two apps and many more:

  • Improved content: Testing ad copy, for example, requires a list of potential improvements to show users’ data. The very process of creating, considering, and evaluating these lists winnows out ineffective language and makes the versions better for users.
  • Increased conversion rates: A/B testing is the simplest and most effective means to govern the best content to convert visits into sign-ups and purchases. Knowing what works and what doesn’t helps turn more leads.
  • Fast Results: Even a moderately small sample size in an A/B test can provide serious, practical results as to which changes are most engaging for users. This allows for short-order development of new sites, new apps, and low-converting pages.
  • Lower risks: By A/B testing, devotion to costly, time-intensive changes that are proven ineffective can be avoided. A major conclusion can be well-informed, circumvent mistakes that could otherwise tie up resources for base or negative gain.
  • Improved user engagement: Part of a page, app, or email that can be A/B tested to contain the headline or subject line, imagery, forms and language, layout, fonts, and colors, etc. Testing one replaces at a time will show which pretentious users’ behavior and which did not. Updating the exploit with the “victorious” changes will improve the user experience in collection, eventually optimizing it for success.

When to use A/B testing:

There are three key goals for running A/B tests:

  • Deployment: When something is deployed on the app it could be for a new characteristic, and modernize, or several other causes. This is usually brought out by the engineering team. These deployments may be brought as a trial to test if it has no negative impact on the company’s KPIs.
  • Optimization: Also mention as lean formation which is mostly done by marketing. After you must have done your exploration to find out which test has more collision, you’re now ready to optimize while you look out for wins.
  • Research: This is fundamentally using A/B-testing for research before you amend which could be in the form of a flit, appear, or change signal on your website, app, or even campaign. For example, you want to see if adding some factor on your product page will condition conversion, so you make two differences of your product page, and then you run your A/B test to see if there will be a negative or positive result and pick which one to advance based on the results.

How to Do A/B Testing:

If it’s your first time with A/B Testing don’t panic, it’s completely simple. When you choose your tool, think of something that you would like to test, like a title in the stores, a disparate app view design, a button.

This is the cycle you should follow when planning your A/B testing strategy:

  1. Brainstorm to define a theory to see what needs to be tested.
  2. Variants: Select the component that is going to be tested.
  3. Test: Split the viewers and show them the two differences of the page.
  4. Analyze the results to decide which difference performed better.
  5. Apply the victorious variant.
  6. Keep testing. There’s always room for advancement and continuous tests will help you grow.

Why you should A/B Testing:

A/B testing allows entities, groups, and companies to make careful changes to their user experiences while gathering data on the results. This allows them to build theory and to learn why certain components of their experiences impact user behavior. In another way, they can be proven wrong — their belief about the best experience for a given aim can be proven wrong through an A/B test. More than just answering a one-off question or settling a dissent, A/B testing can be used to frequently improve a given experience or improve a single aim like conversion rate over time.

Testing one replaces at a time helps them pinpoint which changes had an outcome on visitor behavior, and which ones did not. Over time, they can unite the effect of multiple victorious changes from experiments to display the quantifiable upgrade of a new experience over the old one.


Firebase Remote Config:

Firebase Remote Config is a cloud service that lets you change the behavior and aspect of your app without needing users to download an app update. When using Remote Config, you create in-app default values that supervise the behavior and aspect of your app. Then, you can later use the Firebase console or the Remote Config backend APIs to override in-app default values for all app users or a bit of your user. Your app controls when updates are applied, and it can regularly check for updates and apply them with a trifling impact on performance.


Setting up Remote Config and AB testing:

The big snag with the Firebase Remote Config in its raw form is that it isn’t very easy to test on a single device. There are hardly any ways you can do this:

  1. You can jurisdiction your property using a Google Analytics spectator, but this takes hours if not days to modernize
  2. You can use a user property, this is the gel I am using
  3. You can get the device references and use this with an AB test. This is successful but, it requires a device identifier which can be firm to get unless you are already using Cloud Messaging

Implementation:

First, we create a flutter project, which name is ab_testing_demo. and then we start work on the firebase console, here we create a project and do the set up on the android studio(paste google.json file at android/app/(path) after that add the dependencies at build. Gradle file).

In the Firebase console, we go to the remote config and add the parameters for the project.

and add the parameter here:

After adding the parameter. Start coding in Android Studio, First, we need to add firebase_core and firebase_remote_config dependencies in pubspec.ymal file.

dependencies:
flutter:
sdk: flutter

cupertino_icons: ^1.0.2
firebase_core: ^1.10.6
firebase_remote_config: ^1.0.3

In the main. dart file, we need to take the advantage of the remote configuration. The void main is a type of asynchronous after that we initialize firebase, in-home we specify FutureBuilder<> of type remote configuration and in it, we specify future and builder.

void main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
title: "A/B Testing",
home: FutureBuilder<RemoteConfig>(
future: setupRemoteConfig(),
builder: (BuildContext context, AsyncSnapshot<RemoteConfig> snapshot) {
return snapshot.hasData
? Home(remoteConfig: snapshot.requireData)
: Container(
child: Text("No data available"),
);
},
),
));

In builder, we pass BuildContext and an asynchronous snapshot of type remote configuration and now you need to return snapshot has data and create a home. dart file and define a class Home() and pass remote config in-home(). In the future we pass setupRemoteConfig().

Create a method setupRemoteConfig() in the future, and make this method asynchronous function and add future(type of remote config), In this, we specify the final remote configuration. After that, we fetch the information by using remoteConfig.fetch() and activate the data and return remoteConfig().

Future<RemoteConfig> setupRemoteConfig() async { final RemoteConfig remoteConfig = RemoteConfig.instance; await remoteConfig.fetch();
await remoteConfig.activate();
return remoteConfig;
}

In-home. dart, add a constructor and create a final variable which is remote configuration, we can make use of this particular data. After this, we return Scaffold and add the appbar and use the property of the title and in scaffold pass body. In the body, we pass column() in the children of column() we pass Image.network we pass remoteConfig.get String(key) which is defined in firebase console we pass Image as key in it. and add the text and pass remoteConfig.getString(“key”) we pass text as key. we can also create a text in which we specify remoteConfig.lastFetchStatus.toString() in which we check the status of remoteConfig and we also create a text remoteConfig.lastFetchTime.toString() in which we check the time when we fetch the data and for this, we create a button in which we pass remoteConfig.setConfigSettings at onPressed() and add an icon of a refresh.

Scaffold(
appBar: AppBar(
title: Text('A/B Testing and REmote Config'),
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
SizedBox(
height: 150.0,
),
Image.network(remoteConfig.getString("Image")),
SizedBox(
height: 50.0,
),
Text(
remoteConfig.getString("Text"),
style: TextStyle(fontSize: 20.0),
),
SizedBox(
height: 20.0,
),
Text(remoteConfig.lastFetchStatus.toString(),
style: TextStyle(
fontSize: 17
),),
SizedBox(
height: 20.0,
),
Text(remoteConfig.lastFetchTime.toString(),
style: TextStyle(
fontSize: 20
),),
SizedBox(
height: 20.0,
),
FloatingActionButton(
onPressed: () async {
try {
await remoteConfig.setConfigSettings(
RemoteConfigSettings(
fetchTimeout: Duration(seconds: 10),
minimumFetchInterval: Duration.zero) );
await remoteConfig.fetchAndActivate();
}
catch (e) {
print(e.toString());
}
},
child: const Icon(Icons.refresh),
)
],
),
),
),
);

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


Conclusion

In this article, we have been through What is A/B Testing In Flutter along with how to implement it in a Flutter. You can use the package according to your requirement.

❤ ❤ 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.


GitHub Link:

find the source code of the Positioned Transition Widget:

GitHub — flutter-devs/flutter_ab_testing_demo
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…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 Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

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


Convex Bottom Bar In Flutter

0

The convex Bottom bar is an app bar sketch in such a way that there is a convex shape to it. It can make the UI look great and also refine the way a user interacts with the Interface. In this article, we will build a simple app with one of the simplest forms of Convex bottom bar In Flutter


Table Of Contents:

Introduction

Add Dependency

How to Use

Features

Properties

Implementation

Conclusion

GitHub Link


Introduction:

Hello everyone, today we are discussing a very important topic of flutter UI which is the bottom navigation bar. In this article, we learn about Convex Bottom Bar. Convex Bottom Bar is a package of flutter. The convex Bottom bar is an app bar sketch in such a way that there is a convex shape to it. It can make the UI look great and also refine the way a user interacts with the Interface. In this article, we will build a simple app with one of the simplest forms of Convex bottom bar.

Providing a list TabItems widgets you can explain the icons and their title shown in the appbar. The list should contain only an odd number of TabItems to run the widget without fallacy causing. If you want to show images alternatively of icons you can provide images for the icon variable in each TabItem widget. If you want to generate a single Icon bottom appbar you can use the ConvexButton.fab widget. It produces you with fewer parameters and a quick and nice-looking one-icon-appbar.


Add Dependency:

In your project go to the pubspec. yaml and add the dependencies under the dependencies: add the latest version of convex_bottom_bar.

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
convex_bottom_bar: ^3.0.0

we use convax_bottom_bar for a better bootom_bar UI.


How to Use:

Generally, ConvexAppBar can work with scaffold by setup its bottomNavigationBar.The convexAppBar has two constructors, the convexAppBar() will use the levant style to simplify the tab creation. Add this to your package’s pubspec.yaml file, use the latest version.

Scaffold(
body: bottomNavigationBar: ConvexAppBar();
);

Features:

  • Provide various internal styles.
  • capability to change the theme of AppBar.
  • Provide builder API to modify a new style.
  • include the badge on the tab menu.
  • graceful transition animation.
  • Provide hook API to override some of the interior styles.
  • RTL reinforce.

Properties:

There are some properties of Convex_Bottom_Bar are:

  • fixed (subhead icon stays in the center)
  • fixedCircle (same but with a white circle on all sides the fixed icon)
  • react (superscripted icon replace on tapping another icon)
  • reactCircle (same but with a white circle throughout the superscripted icon)
  • textIn (the selected Ion appear his corresponding title)
  • titled (the non-selected icons are single showing their title)
  • flip (the tapped icon shows a flip animation)
  • custom (to customize premeditated parameters using the ConvexBottomAppBar builder)
  • height (grabbing the appbar)
  • top (grabbing the superscripted icon)
  • curveSize (stretching the curve of the superscripted icon)
  • color (setting the color of the icon)
  • backgroundColor (setting the appbar background color)
  • gradient (setting the appbar background color using a gradient widget)
  • activeColor (setting the circle color)

Implementation:

In the Convex_Bottom_Bar demo, First, we create a stateful class with the name MyHomePage() in this class we create a variable selectedpage type of integer pass with the value zero. and define a list with the name _pageNo, in which we pass all the pages which we want to add in bootom_navigation_bar.

int selectedpage =0;
final _pageNo = [Home() , Favorite() , CartPage() , ProfilePage()];

In BuildContext(), we define Scaffold. In the appbar, we define the name and center tile.

appBar: AppBar(
centerTitle: true,
title: Text('Convex Bottom Bar'),
),

After that in the body first, we pass the _pageNo with the value of selectedPage. and use the property of scaffold we use bottomNavigationBar. In this, we create ConvexAppBar() and pass Items, initialActiveIndex and onTap. in Items, we pass all the screens which we want to show in our application. And in initialActiveIndexwe pass the variable selectedpage which we already define and in onTap we pass index and define setState() in the setState we pass selectedpage equal to index.

bottomNavigationBar: ConvexAppBar(
items: [
TabItem(icon: Icons.home, title: 'Home'),
TabItem(icon: Icons.favorite, title: 'Favorite'),
TabItem(icon: Icons.shopping_cart, title: 'Cart'),
TabItem(icon: Icons.person, title: 'Profile'),
],
initialActiveIndex: selectedpage,
onTap: (int index){
setState(() {
selectedpage = index;
});
},
),

For index we create different pages, Home(), Favorite(), CartPage(), ProfilePage(). In the Home class we define a text with a background color.

Home Screen:

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

class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);

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

class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text('Home Page',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold
),),
),
);
}
}

Favorite Screen:

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

class Favorite extends StatefulWidget {
const Favorite({Key? key}) : super(key: key);

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

class _FavoriteState extends State<Favorite> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.greenAccent,
body: Center(
child: Text('Favorite Page',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold
),
)),
);
}
}

CartPage Screen:

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

class CartPage extends StatefulWidget {
const CartPage({Key? key}) : super(key: key);

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

class _CartPageState extends State<CartPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.pink.shade100,
body: Center(
child: Text('Cart Page',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold
),)),
);
}
}

ProfilePage Screen:

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

class ProfilePage extends StatefulWidget {
const ProfilePage({Key? key}) : super(key: key);

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

class _ProfilePageState extends State<ProfilePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.yellow,
body: Center(
child: Text('Profile Page',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold
),)),
); }
}

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


Conclusion:

In this article, we have been through What is Convex Bottom Bar along with how to implement it in a Flutter. You can use the package according to your requirement.

❤ ❤ 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.

GitHub Link:

Find the source codeof the Convex Bottom Bar:

GitHub – flutter-devs/convex_bottom_bar_demo
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…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 Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

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


Explore Merging Two Maps In Dart

0

In this article, we will Explore Merging Two Maps In Dart. We perceive how to execute a demo program. We will show you how to couple of different approaches to merging two given maps in Dart in your applications.

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


Table Of Contents::

Introduction

Spread Operator Method

addAll() Method

putIfAbsent() Method

Conclusion


Introduction:

There may be occasions while working with Dart and Flutter when you need to combine two maps, The following points are:

  • > It could be desirable to merge two maps that have distinct characteristics for the same object. For example, you might have two maps: one with the user’s address, preferences, and history, and another with their name, phone number, and email address. These two can be joined to make a single map with all the user’s information on it.
  • Two maps that show separate data sources, like a local cache and a remote server, might be combined.
  • > It can be desirable to combine two maps — for example, a default configuration and a user-defined configuration — that have various app configurations or settings.

Spread Operator Method:

This approach utilizes the spread operator (…) to merge two maps into another map. The spread operator permits you to grow the components of an iterable for this situation, the key-value pairs of the maps into another new collection.

import 'package:flutter/foundation.dart' show kDebugMode;
void main() { 
Map<String, int> map1 = {'a': 10, 'b': 20};
 Map<String, int> map2 = {'c': 30, 'd': 40, 'FlutterDevs.com': 50};

 Map<String, int> mergedMap = {...map1, ...map2};
 if (kDebugMode) { print(mergedMap);
 }
 }

One thing you should be aware of is that the value in the second map will overwrite the value in the first map if there are duplicate keys in the maps that are being merged.

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

{a: 10, b: 20, c: 30, d: 40, FlutterDevs.com: 50} 
 Process finished with exit code 0

addAll() Method:

This arrangement utilizes the addAll() technique to merge two maps. The addAll() strategy adds all the key-value pairs starting with one map and then onto the next map.

import 'package:flutter/foundation.dart' show kDebugMode;
 void main() { 
Map<String, int> map1 = {'a': 10, 'b': 20};
 Map<String, int> map2 = {'c': 30, 'd': 40, 'FlutterDevs.com': 50}; map1.addAll(map2);
 if (kDebugMode) { print(map1);
 }
 }

By adding each key-value pair from the second map, this method directly changes the first map. The value in the second map will overwrite the value in the first one if duplicate keys are present, just like in the previous solution.

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

{a: 10, b: 20, c: 30, d: 40, FlutterDevs.com: 50} 
Process finished with exit code 0

putIfAbsent() Method:

If the key is not already in the second map, the putIfAbsent() method adds the key-value pair from one map to another.

import 'package:flutter/foundation.dart' show kDebugMode; 

void main() { 

Map<String, int> map1 = {'a': 10, 'b': 20, 'c': 27};

Map<String, int> map2 = {'c': 30, 'd': 40, 'FlutterDevs.com': 50};

map1.forEach((key, value) { map2.putIfAbsent(key, () => value); 

});

if (kDebugMode) { print(map2);

}

}

More control over handling duplicate keys is offeredTwo by this solution. You can choose whether or not the value from the first map should replace the value in the second map by using the putIfAbsent() method. It does, however, necessitate repeating the initial map’s key-value pairings, which could affect performance for big maps.

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

{c: 30, d: 40, FlutterDevs.com: 50, a: 10, b: 20}
 Process finished with exit code 0

Conclusion:

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

I hope this blog will provide you with sufficient information on Trying the Merging Two Maps In Dart of your projects. We’ve covered a few methods for combining several maps into one. While selecting the best solution, take into account the details of your use case, the size of the maps, and the potential for duplicate keys. So please try it.

❤❤Thanks for reading this article❤❤

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

Clap 👏 If this article helps you.

From Our Parent Company Aeologic

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

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

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

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

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


Post image

Cupertino Sliver Navigation Bar In Flutter

0

Have you ever thought of implementing ios styled large tiles in your flutter application? Flutter provides a widget to help you in the same-named CupertinoSilver NavigationBar. It is widely used by developers across the community.

CupertinoSilver NavigationBar widgets were designed to aid the developers to implement ios themed features in the flutter apps that are built for the ios platform. Since its introduction, it has gained a lot of appreciation across the community.

In this blog, I’ll be taking you through the overview, usage, and implementation of the class Cupertino Sliver Navigation Bar.


Table Of Contents:

What is CupertinoSilver NavigationBar?

Constructor

Properties

Code implementation

Code Files

Conclusion


What is CupertinoSliverNavigationBar?

The CupertinoSliverNavigationBar is placed in a sliver group such as the CustomScrollView.Cupertino sliver navigation bar has two sections where one section is fixed at the top. The second one is a sliding section with a large title. The second section will appear below the first.

It will slide down to show the large title when the sliver expands. It will hide under the first section if the sliver collapses. Like CupertinoNavigationBar, it also supports a leading and trailing widget on the static section on top that remains while scrolling.

Constructor:

We need to use the below constructor to use the CupertinoNavigationBar widget in our code.

CupertinoSliverNavigationBar(
{Key? key,
Widget? largeTitle,
Widget? leading,
bool automaticallyImplyLeading,
bool automaticallyImplyTitle,
String? previousPageTitle,
Widget? middle,
Widget? trailing,
Border? border,
Color? backgroundColor,
Brightness? brightness,
EdgeInsetsDirectional? padding,
bool transitionBetweenRoutes,
Object heroTag,
bool stretch}
)

Properties:

> largeTitle: This text will appear in the top static navigation bar when collapsed and below the navigation bar, in a larger font, when expanded.

> automaticallyImplyLeading: Controls whether we should try to imply the leading widget if null.

> leading: Widget to place at the start of the navigation bar. It takes a widget as value.

> heroTag: Defaults to a common tag between all CupertinoNavigationBar and CupertinoSliverNavigationBar instances of the same Navigator. With the default tag, all navigation bars of the same navigator can transition between each other as long as there’s only one navigation bar per route.

> automaticallyImplyLeading: Setting this property to true will automatically display a leading widget according to the scenario. It takes boolean as value.

> previousPageTitle: It is used to specify the previous page route’s title. When the leading is null and automaticallyImplyLeading is true the sliver navigation bar will use this title as leading. It takes a string as a value.

Code Implementation:

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

After this, we will create a Stateless Widget that will return Material App. Inside of this, we will pass out class MyHomePage.

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.pink,
),
home: const MyHomePage(),
);
}
}

Now before using Cupertino properties we will import the Cupertino package in our main.dart file.

After this, we will return CupertinoPageScaffold under our MyHomePage class.

class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);

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

class _MyHomePageState extends State<MyHomePage> {
bool state = false;

@override
Widget build(BuildContext context) {
return CupertinoPageScaffold()

Inside CupertinoPageScaffold we will pass CustomScrollView as a child. After this, we will pass CupertinoSliverNavigationBar.

CustomScrollView(
slivers: [
CupertinoSliverNavigationBar(
backgroundColor: Colors.black,
leading: CupertinoNavigationBarBackButton(
onPressed: () {},
color: CupertinoColors.activeBlue,
),
middle: Text(
"Cupertino Sliver Navigation Bar",
style: TextStyle(color: Colors.white),
),
trailing: CupertinoButton(
padding: EdgeInsets.zero,
child: Text(
"Done",
style: TextStyle(
color: CupertinoColors.activeBlue,
),
),
onPressed: () {},
),
largeTitle: Padding(
padding: const EdgeInsets.only(left: 20),
child: Text("Large Tile", style: TextStyle(
color: CupertinoColors.white,
),),
),
previousPageTitle: "Back",
),

)

],
),

In the above code, we have used the CupertinoSilverNavigationBar properties such as leading, middle, trailing, largeTitle.

After this, we will pass SilverGrid in the main body of the page.

SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 10.0,
crossAxisSpacing: 10.0,
),
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) => Padding(
padding: const EdgeInsets.only(left: 10,right: 10),
child: Container(
color: CupertinoColors.systemGrey3,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.network("https://media.wired.com/photos/593261cab8eb31692072f129/master/pass/85120553.jpg",fit: BoxFit.fill,),
)
),
),
childCount: 10
)
)

I have passed the image inside the container which is up to you what you want to choose.

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

Code Files:

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

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

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.pink,
),
home: const MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);

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

class _MyHomePageState extends State<MyHomePage> {
bool state = false;

@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
backgroundColor: Colors.white,
child: CustomScrollView(
slivers: [
CupertinoSliverNavigationBar(
backgroundColor: Colors.black,
leading: CupertinoNavigationBarBackButton(
onPressed: () {},
color: CupertinoColors.activeBlue,
),
middle: Text(
"Cupertino Sliver Navigation Bar",
style: TextStyle(color: Colors.white),
),
trailing: CupertinoButton(
padding: EdgeInsets.zero,
child: Text(
"Done",
style: TextStyle(
color: CupertinoColors.activeBlue,
),
),
onPressed: () {},
),
largeTitle: Padding(
padding: const EdgeInsets.only(left: 20),
child: Text("Large Tile", style: TextStyle(
color: CupertinoColors.white,
),),
),
previousPageTitle: "Back",
),
SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 10.0,
crossAxisSpacing: 10.0,
),
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) => Padding(
padding: const EdgeInsets.only(left: 10,right: 10),
child: Container(
color: CupertinoColors.systemGrey3,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.network("https://media.wired.com/photos/593261cab8eb31692072f129/master/pass/85120553.jpg",fit: BoxFit.fill,),
)
),
),
childCount: 10
)
)
],
),
);
}
}

Conclusion:

In the end, CupertinoSilverNavigationBar is a very useful tool in enhancing the user experience. It aids the user to understand and keep their expectations fulfilled. It is widely used to give application ios styled themes and user interface.

It is very easy to use it and we can do numerous things using it. We can make it adapt to our code as per our requirements. It was just a small overview of the CupertinoSilverNavigationBar class its functionality and implementation. I hope the time you spent reading this article turns out to be productive. You can try implementing and modifying this code as per your needs.

Feel free to reach out to me for any suggestions or corrections where I can improve.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

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

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

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

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

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


Cupertino Switch in Flutter

0

When ios introduced switch-type buttons it became intensively popular among users as well as developers. Developers always want to implement such buttons in their applications irrespective of the platform be it ios or android.

Flutter provides an option to implement it in the form of a widget Cupertino switch. Using the Cupertino switch widget developers can easily implement use the ios styled switches in your application regardless of the platform.

In this blog, I’ll be taking you through the overview, usage, and implementation of the widget CupertinoSwitch.


Table Of Contents:

What is CupertinoSwitch ?

Constructor

Properties

Code implementation

Code Files

Conclusion


What is CupertinoSwitch?

Cupertino switch is an ios styled switch that works like any normal switch in your home. The switch will have a certain condition which once fulfilled will turn the switch on and if not then off.

Whenever there is a change in the state of the switch the onChanged callback will invoke. It will return the updated state which is true or false. So based on the value returned by the callback we have to update the UI and perform some action. It is generally used in the setting sections of an app like wifi, Bluetooth, and many more using the switch in settings of the mobile device.

Constructor:

We need to use the below constructor to use the CupertinoNavigationBar widget in our code.

CupertinoSwitch(
{Key? key,
required bool value,
required ValueChanged<bool>? onChanged,
Color? activeColor,
Color? trackColor,
Color? thumbColor,
DragStartBehavior dragStartBehavior}
)

Properties:

> value: It takes the boolean value as input. The value decides the on/off condition of the switch.

> onChanged: It takes a callback function as a value. This function will invoke every time the user turns the switch on/off. To update the UI with the latest position we have to call setSatete() inside the onChanged function.

> activeColor: The color of the switch when it is in an active state. The default color is green.

> trackColor: It is the color when the state of the switch is off.

> dragStartBehavior: Determines the way that drag start behavior is handled.

> thumbColor: The color to use for the thumb of the switch.

Code Implementation:

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

After this, we will create a Stateless Widget that will return the Material App. Inside of this, we will pass out class MyHomePage.

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

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

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Learning',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home:MyHomePage(),
);
}
}

Now before using Cupertino Switch we will import the Cupertino package in our main.dart file.

After this, we will return CupertinoPageScaffold under our MyHomePage class.

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

class _MyHomePageState extends State<MyHomePage> {
bool state = false;
@override
Widget build(BuildContext context) {
return new CupertinoPageScaffold()

Inside it, we will be passing our CupertinoSwitch along with other properties of CupertinoSwitch like thumbColor, activeColor. Also, we will be changing the state under onChanged property.

CupertinoSwitch(
value:state,
onChanged: (value){
state = value;
setState(() {

},
);
}, thumbColor: CupertinoColors.destructiveRed,
activeColor: CupertinoColors.activeBlue,

),

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

The Text below has also been assigned state change. So when the onChange value is changed it corresponds to the same.

Code Files:

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

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

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'CupertinoSwitch',
theme: ThemeData(
),
home:MyHomePage(),
);
}
}

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

class _MyHomePageState extends State<MyHomePage> {
bool state = false;
@override
Widget build(BuildContext context) {
return new CupertinoPageScaffold(
backgroundColor: Colors.black,
navigationBar:CupertinoNavigationBar(
leading: CupertinoNavigationBarBackButton(
onPressed: ()
{ },
color: CupertinoColors.label,
),
middle: Text(" CupertinoSwitch")
),
child:Material(
child: Container(
margin: EdgeInsets.only(top:120, left: 50, right: 20),
width: double.infinity,
child:Column(
children: [
Container(
width: double.infinity,
child: Row(
children: [
SizedBox(
width: MediaQuery.of(context).size.width*0.5,
child: Text("Bluetooth", style: TextStyle(fontWeight: FontWeight.bold),),
),
SizedBox(
width: MediaQuery.of(context).size.width*0.20,
child: CupertinoSwitch(
value:state,
onChanged: (value){
state = value;
setState(() {

},
);
}, thumbColor: CupertinoColors.destructiveRed,
activeColor: CupertinoColors.activeBlue,

),
),
],
),
),
SizedBox(
height: 20,
),
Divider(
height: 1,
color: CupertinoColors.systemGrey5,
),
SizedBox(
height:40
),
Text(state == true? "Bluetooth turned on": "Bluetooth turned off",
style:TextStyle(
fontWeight: FontWeight.bold,
color: state == true? CupertinoColors.secondaryLabel : CupertinoColors.activeOrange
),
),
],
)
),
),
);
}
}

Conclusion:

In the end, CupertinoSwitch is a very useful widget in helping the developer for implementing ios styled switches in a very easy way. It is widely used to give application ios styled on/off switches.

It is very easy to use it and we can use it in numerous conditions. We can make it adapt to our code as per our requirements. It was just a small overview of the CupertinoSwitch widget its functionality and implementation. I hope the time you spent reading this article turns out to be productive. You can try implementing and modifying this code as per your needs.

Feel free to reach out to me for any suggestions or corrections where I can improve.

❤ ❤ Thanks for reading this article ❤❤

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

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

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

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

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

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

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