Flutter Local Notifications & Sqflite Explained Step by Step | Part 3
In this tutorial, we explained local notifications with Sqflite step by step. Local notifications included immediate notification, scheduled notification, zonedSchedule. And Sqflite included create, delete, update and insert method. All the crud functions of sqflite is there.
This notification app also work like alarm app. This covers both ios and android settings as well. If you want to see the previous part follow the link
Part one https://youtu.be/2L8maZUY2hU
Part two https://youtu.be/6SaCntGgi5o
Get the complete code from here flutter 3.4 version
https://www.buymeacoffee.com/dbestech/e/124108
Twitter @dbestech
Facebook page https://www.facebook.com/dbestech
Learn more about notifications
https://www.dbestech.com/tutorials/flutter-local-notification-explained-for-ios-and-android
Learn more about sqflite
https://www.dbestech.com/tutorials/flutter-sqflite-tutorial-example
We also covered how to make flutter getx listview with obx and obs.
More about GetX
https://www.dbestech.com/tutorials/flutter-getx-app-tutorial
Code for task_tile.dart
class TaskTile extends StatelessWidget {
final Task? task;
TaskTile(this.task);
@override
Widget build(BuildContext context) {
return Container(
padding:
EdgeInsets.symmetric(horizontal: 20),
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.only(bottom: 12),
child: Container(
padding: EdgeInsets.all(16),
// width: SizeConfig.screenWidth * 0.78,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: _getBGClr(task?.color??0),
),
child: Row(children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
task?.title??"",
style: GoogleFonts.lato(
textStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
SizedBox(
height: 12,
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
Icons.access_time_rounded,
color: Colors.grey[200],
size: 18,
),
SizedBox(width: 4),
Text(
"${task!.startTime} - ${task!.endTime}",
style: GoogleFonts.lato(
textStyle:
TextStyle(fontSize: 13, color: Colors.grey[100]),
),
),
],
),
SizedBox(height: 12),
Text(
task?.note??"",
style: GoogleFonts.lato(
textStyle: TextStyle(fontSize: 15, color: Colors.grey[100]),
),
),
],
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 10),
height: 60,
width: 0.5,
color: Colors.grey[200]!.withOpacity(0.7),
),
RotatedBox(
quarterTurns: 3,
child: Text(
task!.isCompleted == 1 ? "COMPLETED" : "TODO",
style: GoogleFonts.lato(
textStyle: TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
),
]),
),
);
}
_getBGClr(int no) {
switch (no) {
case 0:
return bluishClr;
case 1:
return pinkClr;
case 2:
return yellowClr;
default:
return bluishClr;
}
}
}