47 lines
1.3 KiB
Dart
47 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:happy_camper_proto/listpage.dart';
|
|
import 'package:happy_camper_proto/preplist.dart';
|
|
|
|
class PrepPage extends StatefulWidget {
|
|
const PrepPage({super.key, required this.prepLists});
|
|
|
|
final List<Preplist> prepLists;
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _PrepPageState();
|
|
}
|
|
|
|
class _PrepPageState extends State<PrepPage> {
|
|
late List<Preplist> prepLists;
|
|
|
|
@override
|
|
void initState() {
|
|
prepLists = widget.prepLists;
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView.separated(
|
|
itemCount: prepLists.length,
|
|
separatorBuilder: (context, index) => const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
child: Divider(color: Colors.grey),
|
|
),
|
|
itemBuilder: (context, index) {
|
|
var list = prepLists[index];
|
|
return ListTile(
|
|
title: Text(list.name),
|
|
subtitle: Text(
|
|
"Incomplete: ${list.countIncomplete}, Complete: ${list.countComplete}"),
|
|
onTap: () async {
|
|
await Navigator.of(context).push(
|
|
MaterialPageRoute(builder: (context) => ListPage(list: list)));
|
|
setState(() {});
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|