Нет описания

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import 'package:flutter/material.dart';
  2. import '../widgets/DataTableMySqlDemo/Oficina.dart';
  3. import '../widgets/DataTableMySqlDemo/Services.dart';
  4. import 'dart:async';
  5. class VerOficinas extends StatefulWidget{
  6. VerOficinas() : super();
  7. final String title = 'Oficinas';
  8. @override
  9. State<StatefulWidget> viewOficinas() {
  10. //no se que hago, quizas no lo necesite
  11. return null;
  12. }
  13. _VerOficinasState createState() => _VerOficinasState();
  14. }
  15. class _VerOficinasState extends State<VerOficinas>{
  16. List<Oficina> _oficinas;
  17. List<Oficina> _filterOficinas;
  18. GlobalKey<ScaffoldState> _scaffoldKey;
  19. TextEditingController _nameController;//
  20. Oficina _selectOficina;
  21. bool _isUpdateing;
  22. @override
  23. void initState() {
  24. super.initState();
  25. _oficinas = [];
  26. // _filterOficinas = [];
  27. _isUpdateing = false;
  28. _scaffoldKey = GlobalKey();
  29. _nameController = TextEditingController();
  30. _getOficinas();
  31. }
  32. _getOficinas() {
  33. return _oficinas;
  34. }
  35. @override
  36. Widget build(BuildContext context){
  37. Services.getOficinas().then((Oficinas) {
  38. setState(() {
  39. _oficinas = Oficinas;
  40. //print(_oficinas);
  41. //print("Length ${Oficinas.length}");
  42. });
  43. });
  44. List<Oficina> lista = _oficinas;
  45. return Scaffold(
  46. key: _scaffoldKey,
  47. appBar: AppBar(
  48. title: Text('Oficinas'),
  49. centerTitle: true,
  50. backgroundColor: Colors.purple,
  51. ),
  52. body: Center(
  53. child: Column(
  54. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  55. children: lista.map((Oficina data) {
  56. return FlatButton(
  57. minWidth: 300.0,
  58. height: 100.0,
  59. child: Text(data.name,
  60. style: TextStyle(fontSize: 36),
  61. ),
  62. onPressed: () {
  63. print(data.name);
  64. },
  65. padding: new EdgeInsets.all(0.0),
  66. color: Colors.purple,
  67. );
  68. }).toList(),
  69. ),
  70. // child: FlatButton(
  71. // onPressed: (){
  72. // _getOficinas();
  73. // },
  74. // child: Text('Ver Oficinas'),
  75. // color: Colors.purple,
  76. // )
  77. ),
  78. );
  79. }
  80. }