Highlight current plan

This commit is contained in:
Brandon Presley 2023-11-28 14:53:37 +13:00
parent 4aa6926f5c
commit 2544a3de9f

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fmassive/constants.dart';
import 'package:fmassive/database.dart'; import 'package:fmassive/database.dart';
import 'package:fmassive/edit_plan.dart'; import 'package:fmassive/edit_plan.dart';
import 'package:fmassive/main.dart'; import 'package:fmassive/main.dart';
@ -14,11 +15,20 @@ class PlanList extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final weekday = weekdayNames[DateTime.now().weekday - 1];
return ListView.builder( return ListView.builder(
itemCount: plans.length, itemCount: plans.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return ListTile( return ListTile(
title: Text(plans[index].days.replaceAll(',', ', ')), title: Text(plans[index].days.replaceAll(',', ', '),
style: TextStyle(
fontWeight: plans[index].days.contains(weekday)
? FontWeight.bold
: null,
decoration: plans[index].days.contains(weekday)
? TextDecoration.underline
: null)),
subtitle: Text(plans[index].exercises), subtitle: Text(plans[index].exercises),
onLongPress: () => showDialog( onLongPress: () => showDialog(
context: context, context: context,