hive implementation
save todo in hive first release
This commit is contained in:
@@ -1,43 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
|
||||
class ToDoTile extends StatelessWidget {
|
||||
const ToDoTile(
|
||||
{Key? key,
|
||||
required this.taskName,
|
||||
required this.taskCompleted,
|
||||
required this.onChanged})
|
||||
required this.onChanged,
|
||||
required this.deleteFunction})
|
||||
: super(key: key);
|
||||
|
||||
final String taskName;
|
||||
final bool taskCompleted;
|
||||
final Function(bool?)? onChanged;
|
||||
final Function(BuildContext)? deleteFunction;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(25.0, 25, 25, 0),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(24.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
child: Slidable(
|
||||
endActionPane: ActionPane(
|
||||
motion: StretchMotion(),
|
||||
children: [
|
||||
Text(
|
||||
taskName,
|
||||
style: TextStyle(
|
||||
decoration: taskCompleted
|
||||
? TextDecoration.lineThrough
|
||||
: TextDecoration.none),
|
||||
),
|
||||
Checkbox(
|
||||
value: taskCompleted,
|
||||
onChanged: onChanged,
|
||||
activeColor: Colors.redAccent,
|
||||
SlidableAction(
|
||||
onPressed: deleteFunction,
|
||||
icon: Icons.delete,
|
||||
backgroundColor: const Color.fromARGB(255, 249, 137, 135),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
)
|
||||
],
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(24.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
taskName,
|
||||
style: TextStyle(
|
||||
decoration: taskCompleted
|
||||
? TextDecoration.lineThrough
|
||||
: TextDecoration.none),
|
||||
),
|
||||
Checkbox(
|
||||
value: taskCompleted,
|
||||
onChanged: onChanged,
|
||||
activeColor: Colors.redAccent,
|
||||
)
|
||||
],
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user