md-app/lib/pages/conferences.dart

52 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:lgcc/models/conferences_model.dart';
import 'package:lgcc/providers/conferences_db.dart';
import 'package:lgcc/providers/conferences_api.dart';
class ConferencesPage extends StatelessWidget {
const ConferencesPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Conferencias', style: TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold)),
centerTitle: true,
shadowColor: Colors.transparent,
backgroundColor: Colors.blue,
),
body: _buildConferenceListView(),
);
}
}
Widget _buildConferenceListView() {
return FutureBuilder(
future: DBProvider.db.getAllConferences(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
} else {
return ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black12,
),
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
return ListTile(
leading: Text(
"${index + 1}",
style: TextStyle(fontSize: 20.0),
),
title: Text(
"titulo: ${snapshot.data[index].title} "),
);
},
);
}
}
);
}