My first screen has a sheet "static List<DilemmData> dilemmList = [];" which should be displayed in the ListView. I update this sheet on the second screen. But when I go back to the first one, there is no change. How to fix it?
Here is ListView:
ListView.separated(
separatorBuilder: (ctx, index) =>
const SizedBox(height: 15.0),
itemCount: MyApp.dilemmList.length,
itemBuilder: (ctx, index) {
return Padding(
padding: const EdgeInsets.only(left: 25, right: 25.0),
child: Container(
decoration: BoxDecoration(
color: const Color(0xFF009432),
border:
Border.all(width: 2.0, color: Colors.transparent),
borderRadius: BorderRadius.circular(10.0),
),
child: ListTile(
onTap: () {},
minLeadingWidth: 32,
leading: CircularPercentIndicator(
radius: 25.0,
lineWidth: 4.0,
percent: MyApp.dilemmList[index].percent,
center: Text(
'${(MyApp.dilemmList[index].percent * 100).round()}%',
style: GoogleFonts.roboto(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.w700)),
progressColor: const Color(0xFF3ae374),
),
title: Text(MyApp.dilemmList[index].title,
style: GoogleFonts.roboto(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.w700)),
subtitle: Text(MyApp.dilemmList[index].date,
style: GoogleFonts.roboto(
fontSize: 15,
color: Colors.white,
fontWeight: FontWeight.w700)),
),
),
);
}),
Here I am adding a new element to the sheet:
MyApp.dilemmList.add(DilemmData(
percent: 0,
title: controller.text,
date: formattedDate));