import 'package:flutter/material.dart'; import 'dart:convert'; import 'Offices.dart'; import 'appointments.dart'; import 'package:flutter/foundation.dart'; class OfficesScreen extends StatelessWidget { final List off; Offices ofi; // final Offices Of; // final offlist = List.generate( // 2, // (i) => Offices( // 'Office $i', // docs[i], spec[i], addrs[i], // ), // ); var docs = ["Collazo", "Albizu"]; var spec = ["General", "Pediatra"]; var addrs = ["Bo. Montellano, Cayey", "Las Dalias, Mayagüez"]; //requiring the list of todos OfficesScreen({Key key, @required this.off}) : super(key: key); @override Widget build(BuildContext context) { // print(docs[0]); final offlist = List.generate( 2, (i) => Offices( 'Office $i', // "sds", "gfdf", "fvfgv", docs[i], spec[i], addrs[i] ), ); return Scaffold( appBar: AppBar( title: Text('Todos'), ), //passing in the ListView.builder body: ListView.builder( itemCount: offlist.length, itemBuilder: (context, index) { return ListTile( title: Text(offlist[index].office), onTap: (){ Navigator.push(context, MaterialPageRoute(builder: (context) => AppointmentPage(O: offlist[index])), ); }, ); }, ), ); } }