added navigation to detail page

This commit is contained in:
SomnusVeritas
2023-11-08 14:17:57 +01:00
parent 7fdc03e79f
commit 36aa01fdde
4 changed files with 45 additions and 1 deletions

View File

@@ -1,11 +1,39 @@
import 'package:flutter/material.dart';
import '../models/todo.dart';
import '../services/todo_provider.dart';
class TodoDetailPage extends StatelessWidget {
const TodoDetailPage({super.key});
static const routeName = '/detail';
@override
Widget build(BuildContext context) {
return const Placeholder();
final Todo? todo = TodoProvider.selectedTodo;
if (todo == null) {
Navigator.of(context).pop();
}
final screenWidth = MediaQuery.of(context).size.width;
todo as Todo;
return Scaffold(
appBar: AppBar(),
body: Padding(
padding: EdgeInsets.symmetric(horizontal: screenWidth * 0.05),
child: Column(
children: [
Text(
todo.title,
style: Theme.of(context).textTheme.titleLarge,
),
Text(
todo.description,
),
],
),
),
);
}
}