No Description

OfficeScreen.dart 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:flutter/material.dart';
  2. import 'dart:convert';
  3. import 'package:hello/Offices.dart';
  4. import 'package:hello/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. print(ofi.variable);
  34. return Scaffold(
  35. appBar: AppBar(
  36. title: Text('Todos'),
  37. ),
  38. //passing in the ListView.builder
  39. body: ListView.builder(
  40. itemCount: offlist.length,
  41. itemBuilder: (context, index) {
  42. return ListTile(
  43. title: Text(offlist[index].office),
  44. onTap: (){
  45. Navigator.push(context, MaterialPageRoute(builder: (context) =>
  46. AppointmentPage(O: offlist[index])),
  47. );
  48. },
  49. );
  50. },
  51. ),
  52. );
  53. }
  54. }