【发布时间】:2020-04-02 02:34:59
【问题描述】:
在下面的链接中,我在 Firestore 中有一些数据。
我的 Firestore 结构:
我在约会提醒时间字段中有一个数组。这些索引中的每一个都有 MedicationName、notificationType 和 time。我有一个名为“查看提醒”的功能,它向我的用户显示他们之前设置的所有提醒。我希望将 MedicationName、notificationType 和时间作为字符串传递,并且用户能够看到他们的提醒。
这是我写的一些代码sn-p
查看AppointmentReminders.dart
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: user.appointmentName.length,
itemBuilder: (BuildContext context, int index) {
return appointmentDataitems(user.appointmentName[index],context);
},
),
//List tile for appointment name and then appointment value
Container appointmentDataitems(String appointmentName, BuildContext context) {
return Container(
height: 40.0,
child: ListTile(
leading: Text(
"Appointment name:",
),
trailing: Text(
appointmentName,
),
),
);
}
user.dart
class User
{
final List<dynamic> appointmentName;
User(
{
this.appointmentName,
});
}
总之,我想使用 Flutter 动态显示上面的数据,以便用户查看他们的预约/用药提醒
提前致谢!
【问题讨论】:
标签: firebase flutter dart google-cloud-firestore