This is flutter sqlite local notification project. User can add task.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.6 KiB

  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter/src/foundation/key.dart';
  4. import 'package:flutter/src/widgets/framework.dart';
  5. import 'package:google_fonts/google_fonts.dart';
  6. import 'package:sqflite_pust_local_notification/models/task_model.dart';
  7. import 'package:sqflite_pust_local_notification/utils/textStyles.dart';
  8. import '../utils/colors.dart';
  9. class TaskTile extends StatelessWidget {
  10. final TaskModel? task;
  11. TaskTile(this.task);
  12. @override
  13. Widget build(BuildContext context) {
  14. return Container(
  15. padding: EdgeInsets.symmetric(horizontal: 20),
  16. width: MediaQuery.of(context).size.width,
  17. margin: EdgeInsets.only(bottom: 12),
  18. child: Container(
  19. padding: EdgeInsets.all(16),
  20. decoration: BoxDecoration(
  21. borderRadius: BorderRadius.circular(16),
  22. color: _getBGClr(task?.color ?? 0)),
  23. child: Row(children: [
  24. Expanded(
  25. child: Column(
  26. crossAxisAlignment: CrossAxisAlignment.start,
  27. children: [
  28. Text(
  29. task?.title ?? "",
  30. style: taskTitle,
  31. ),
  32. SizedBox(
  33. height: 12,
  34. ),
  35. Row(
  36. crossAxisAlignment: CrossAxisAlignment.center,
  37. children: [
  38. Icon(
  39. Icons.access_time_rounded,
  40. color: Colors.grey[200],
  41. size: 18,
  42. ),
  43. SizedBox(width: 4),
  44. Text(
  45. "${task!.startTime}-${task!.endTime}",
  46. style: taskTime,
  47. )
  48. ],
  49. ),
  50. SizedBox(
  51. height: 12,
  52. ),
  53. Text(
  54. task?.note ?? "",
  55. style: taskNote,
  56. )
  57. ],
  58. ),
  59. ),
  60. Container(
  61. margin: EdgeInsets.symmetric(horizontal: 10),
  62. height: 60,
  63. width: 0.5,
  64. color: Colors.grey[200]!.withOpacity(0.7),
  65. ),
  66. RotatedBox(
  67. quarterTurns: 3,
  68. child: Text(
  69. task!.isCompleted == 1 ? "COMPLETED" : "TODO",
  70. style: taskIsComplete,
  71. ),
  72. )
  73. ]),
  74. ),
  75. );
  76. }
  77. _getBGClr(int no) {
  78. switch (no) {
  79. case 0:
  80. return bluishClr;
  81. case 1:
  82. return pinkClr;
  83. case 2:
  84. return yellowClr;
  85. default:
  86. return bluishClr;
  87. }
  88. }
  89. }