I built an Agro App, where the majority of users are Offline when they register the data and when they return to the central site they obtain an Internet connection and the data goes up.
However, it is not clear to the user whether or not his record was uploaded to the cloud, so I would like to implement a tick system similar to that used by WhatsApp:
Gray tick when the data is written and is only in cache
Blue tick when the data uploads to the cloud and therefore is available to other users
What I imagine is something like this:
The procedure with which I display the list is as follows:
Widget _crearListado(BuildContext context, AlimentarBloc alimentarBloc) {
return Column(
children: <Widget>[
Container(
child: Padding(
child: StreamBuilder(
stream: alimentarBloc.alimentarStream,
builder: (BuildContext context, AsyncSnapshot<List<AlimentarModel>> snapshot){
if (snapshot.hasData) {
final alimentarList = snapshot.data;
if (alimentarList.length == 0) return _imagenInicial(context);
return Container(
child: Stack(
children: <Widget>[
ListView.builder(
itemCount: alimentarList.length,
itemBuilder: (context, i) =>_crearItem(context, alimentarBloc, alimentarList[i]),
],
),
);
} else if (snapshot.hasError) {
return Text(snapshot.error.toString());
}
return Center (child: Image(image: AssetImage('assets/Preloader.gif'), height: 200.0,));
},
),
),
),
],
);
}
Widget _crearItem(BuildContext context, AlimentarBloc alimentarBloc, AlimentarModel alimentar) {
return Stack(
alignment: Alignment.centerLeft,
children: <Widget>[
Container(
child: Card(
child: ListTile(
leading: Container(,
child: Text(" ${alimentar.nombreRefEstanque}"),
),
title: Text('${alimentar.nombreAlimentoFull}'),
subtitle: Container(
child: Container(
child: Text ('$_fechaAlimentar)
),
),
onTap: () => null,
trailing: Container(
child: Text("${alimentar.consumo),
),
)
),
],
);
}
What options do you see to mark the data when they have already uploaded to the Internet? Can I do that?