|
|
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/src/foundation/key.dart';
- import 'package:flutter/src/widgets/framework.dart';
- import 'package:google_fonts/google_fonts.dart';
- import 'package:sqflite_pust_local_notification/models/task_model.dart';
- import 'package:sqflite_pust_local_notification/utils/textStyles.dart';
-
- import '../utils/colors.dart';
-
- class TaskTile extends StatelessWidget {
- final TaskModel? 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),
- 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: taskTitle,
- ),
- 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: taskTime,
- )
- ],
- ),
- SizedBox(
- height: 12,
- ),
- Text(
- task?.note ?? "",
- style: taskNote,
- )
- ],
- ),
- ),
- 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: taskIsComplete,
- ),
- )
- ]),
- ),
- );
- }
-
- _getBGClr(int no) {
- switch (no) {
- case 0:
- return bluishClr;
- case 1:
- return pinkClr;
- case 2:
- return yellowClr;
- default:
- return bluishClr;
- }
- }
- }
|