No Description

OfficeScreen.dart 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import 'package:flutter/material.dart';
  2. import 'dart:convert';
  3. import 'Offices.dart';
  4. import 'appointments.dart';
  5. import 'package:flutter/foundation.dart';
  6. class OfficesScreen extends StatelessWidget {
  7. final List<Offices> off;
  8. Offices ofi;
  9. // final Offices Of;
  10. // final offlist = List<Offices>.generate(
  11. // 2,
  12. // (i) => Offices(
  13. // 'Office $i',
  14. // docs[i], spec[i], addrs[i],
  15. // ),
  16. // );
  17. var docs = ["Collazo", "Albizu"];
  18. var spec = ["General", "Pediatra"];
  19. var addrs = ["Bo. Montellano, Cayey", "Las Dalias, Mayagüez"];
  20. //requiring the list of todos
  21. OfficesScreen({Key key, @required this.off}) : super(key: key);
  22. @override
  23. Widget build(BuildContext context) {
  24. // print(docs[0]);
  25. final offlist = List<Offices>.generate(
  26. 2,
  27. (i) => Offices(
  28. 'Office $i',
  29. // "sds", "gfdf", "fvfgv",
  30. docs[i], spec[i], addrs[i]
  31. ),
  32. );
  33. return Scaffold(
  34. appBar: AppBar(
  35. title: Text('Todos'),
  36. ),
  37. //passing in the ListView.builder
  38. body: ListView.builder(
  39. itemCount: offlist.length,
  40. itemBuilder: (context, index) {
  41. return ListTile(
  42. title: Text(offlist[index].office),
  43. onTap: (){
  44. Navigator.push(context, MaterialPageRoute(builder: (context) =>
  45. AppointmentPage(O: offlist[index])),
  46. );
  47. },
  48. );
  49. },
  50. ),
  51. );
  52. }
  53. }