Implementation
Widget theList(BuildContext context, values, AccessState accessState) {
return Container(
decoration: widget.listBackground == null
? StyleRegistry.registry()
.styleWithApp(widget.app)
.adminListStyle()
.boxDecorator(widget.app, context, accessState.getMember())
: BoxDecorationHelper.boxDecoration(
widget.app, accessState.getMember(), widget.listBackground),
child: ListView.separated(
separatorBuilder: (context, index) => StyleRegistry.registry()
.styleWithApp(widget.app)
.adminListStyle()
.divider(widget.app, context),
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: values.length,
itemBuilder: (context, index) {
final value = values[index];
if (widget.widgetProvider != null) {
return widget.widgetProvider!(value);
}
return SectionListItem(
app: widget.app,
value: value,
// app: accessState.app,
onDismissed: (direction) {
BlocProvider.of<SectionListBloc>(context)
.add(DeleteSectionList(value: value));
ScaffoldMessenger.of(context).showSnackBar(DeleteSnackBar(
message: "Section $value.documentID",
onUndo: () => BlocProvider.of<SectionListBloc>(context)
.add(AddSectionList(value: value)),
));
},
onTap: () async {
final removedItem = await Navigator.of(context).push(
pageRouteBuilder(widget.app,
page: BlocProvider.value(
value: BlocProvider.of<SectionListBloc>(context),
child: getForm(value, FormAction.updateAction))));
if (removedItem != null) {
ScaffoldMessenger.of(context).showSnackBar(
DeleteSnackBar(
message: "Section $value.documentID",
onUndo: () => BlocProvider.of<SectionListBloc>(context)
.add(AddSectionList(value: value)),
),
);
}
},
);
}));
}