46 lines
1.2 KiB
Dart
46 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ToDoTile extends StatelessWidget {
|
|
const ToDoTile(
|
|
{Key? key,
|
|
required this.taskName,
|
|
required this.taskCompleted,
|
|
required this.onChanged})
|
|
: super(key: key);
|
|
|
|
final String taskName;
|
|
final bool taskCompleted;
|
|
final Function(bool?)? onChanged;
|
|
|
|
@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,
|
|
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),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|