Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[flutter_todos] todo item
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:todos_app_core/todos_app_core.dart';
import 'package:flutter_todos/models/models.dart';
class TodoItem extends StatelessWidget {
final DismissDirectionCallback onDismissed;
final GestureTapCallback onTap;
final ValueChanged<bool> onCheckboxChanged;
final Todo todo;
Key key,
@required this.onDismissed,
@required this.onTap,
@required this.onCheckboxChanged,
@required this.todo,
}) : super(key: key);
Widget build(BuildContext context) {
return Dismissible(
key: ArchSampleKeys.todoItem(,
onDismissed: onDismissed,
child: ListTile(
onTap: onTap,
leading: Checkbox(
key: ArchSampleKeys.todoItemCheckbox(,
value: todo.complete,
onChanged: onCheckboxChanged,
title: Hero(
tag: '${}__heroTag',
child: Container(
width: MediaQuery.of(context).size.width,
child: Text(
key: ArchSampleKeys.todoItemTask(,
style: Theme.of(context).textTheme.title,
subtitle: todo.note.isNotEmpty
? Text(
key: ArchSampleKeys.todoItemNote(,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.subhead,
: null,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.