Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class HomePage extends StatelessWidget {
- const HomePage({Key key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Container(
- child: Column(
- children: <Widget>[
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- BlocosHome(FontAwesomeIcons.calendarAlt, 'Agendamento',
- AgendamentoPage()),
- BlocosHome(
- FontAwesomeIcons.microscope, 'Exames', AgendamentoPage()),
- ],
- ),
- ),
- Expanded(
- child: EspecialidadeTile(),
- )
- ],
- ),
- );
- }
- }
- //Especialidade Widget
- class EspecialidadeTile extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return StreamBuilder(
- stream: Firestore.instance.collection('especialidades').snapshots(),
- builder: (context, snapshot) {
- if (!snapshot.hasData) {
- return Center(
- child: CircularProgressIndicator(),
- );
- } else {
- return GridView.builder(
- itemCount: snapshot.data.documents.length,
- gridDelegate:
- SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
- itemBuilder: (context, index) {
- DocumentSnapshot espec = snapshot.data.documents[index];
- return GestureDetector(
- child: Container(
- margin: EdgeInsets.symmetric(horizontal: 10),
- padding: EdgeInsets.symmetric(horizontal: 5),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(10),
- boxShadow: [
- BoxShadow(
- color: Colors.black12,
- offset: Offset(0, 6),
- blurRadius: 6,
- ),
- ]),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- SizedBox(
- height: 150,
- child: Stack(
- children: <Widget>[
- Image.network('${espec['imagem']}'),
- Positioned(
- bottom: 0,
- child: Container(
- width: MediaQuery.of(context).size.width / 2 - 30,
- height: 30,
- color: Colors.black.withOpacity(0.5),
- child: Align(
- alignment: Alignment.bottomCenter,
- child: Text(
- '${espec['nome']}',
- style: TextStyle(
- color: Colors.white, fontSize: 20,fontFamily: 'sans-serif'),
- ),
- )),
- )
- ],
- ),
- ),
- SizedBox(
- height: 30,
- child: Align(
- alignment: Alignment.topLeft,
- child: Text(
- '${espec['des']},',
- style:
- TextStyle(color: Colors.black87, fontSize: 13, fontFamily: 'sans-serif'),
- maxLines: 2,
- ),
- ),
- ),
- SizedBox(
- height: 10,
- child: Container(
- color: Colors.redAccent,
- ),
- ),
- ],
- ),
- ),
- onTap: () {},
- );
- },
- );
- }
- },
- );
- }
- }
- //Blocos Home Widget
- class BlocosHome extends StatelessWidget {
- final IconData icon;
- final String texto;
- final Widget link;
- BlocosHome(this.icon, this.texto, this.link);
- @override
- Widget build(BuildContext context) {
- final colorB = Colors.cyan[900];
- return Container(
- margin: EdgeInsets.symmetric(vertical: 10, horizontal: 8),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(10),
- boxShadow: [
- BoxShadow(
- color: Colors.black12,
- offset: Offset(0, 6),
- blurRadius: 6,
- ),
- ]),
- child: SizedBox(
- height: 200,
- width: MediaQuery.of(context).size.width / 2 - 20,
- child: RaisedButton(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Icon(
- icon,
- color: Colors.white,
- size: 70.0,
- ),
- SizedBox(
- height: 16.0,
- ),
- Text(
- texto,
- style: TextStyle(color: Colors.white, fontSize: 20.0),
- )
- ],
- ),
- color: colorB,
- onPressed: () {
- Navigator.push(
- context, MaterialPageRoute(builder: (context) => link));
- },
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement