Last active
November 27, 2019 16:51
-
-
Save cristianfb1989/0a7798b4117e176250a2a9c37e720c47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
class Prueba extends StatefulWidget { | |
@override | |
_PruebaState createState() => _PruebaState(); | |
} | |
class _PruebaState extends State<Prueba> { | |
ScrollController _scrollController; | |
bool _flag = true; | |
String nomLocal; | |
String descripcion; | |
String descripcion2; | |
Widget notifCard(String nomLocal, String descripcion, String descripcion2, | |
bool isVisible) { | |
return Container( | |
child: GestureDetector( | |
onTap: () { | |
setState(() { | |
_flag = isVisible; | |
}); | |
}, | |
child: Card( | |
margin: EdgeInsets.only(left: 15, right: 15, top: 10), | |
elevation: 2, | |
shape: | |
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), | |
color: Colors.white.withOpacity(.9), | |
child: Container( | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Container( | |
padding: EdgeInsets.only(left: 15, top: 10), | |
child: Text( | |
nomLocal, | |
style: TextStyle( | |
fontSize: 15.0, | |
color: Colors.black, | |
fontFamily: 'Roboto', | |
fontWeight: FontWeight.bold), | |
), | |
), | |
Container( | |
padding: EdgeInsets.only(left: 15, top: 10), | |
height: 50, | |
width: 250, | |
child: Text( | |
descripcion, | |
maxLines: 2, | |
overflow: TextOverflow.clip, | |
style: TextStyle( | |
fontSize: 15.0, | |
color: Colors.black, | |
fontFamily: 'Roboto', | |
), | |
), | |
), | |
], | |
), | |
Column( | |
children: <Widget>[ | |
SizedBox( | |
height: MediaQuery.of(context).size.height - 620, | |
), | |
Padding( | |
padding: EdgeInsets.only(bottom: 5, right: 20), | |
child: Container( | |
height: 20, | |
width: 70, | |
child: Visibility( | |
visible: _flag ? true : false, | |
child: RaisedButton( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(20)), | |
child: Center( | |
child: Text( | |
'Nueva', | |
style: TextStyle( | |
fontSize: 12, | |
color: Colors.white, | |
fontWeight: FontWeight.bold), | |
), | |
), | |
elevation: 15, | |
onPressed: () {}, | |
color: Color(0xFF2DA771), | |
), | |
), | |
)) | |
], | |
) | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
List<Widget> itemsNotif = [ | |
notifCard(nomLocal, descripcion, descripcion2, _flag), | |
]; | |
_alertDialog() { | |
return showDialog( | |
context: context, | |
builder: (BuildContext context) { | |
return AlertDialog( | |
title: Text('nomLocal'), | |
content: Text('descripcion + descripcion2'), | |
); | |
}); | |
} | |
_alertDialog2() { | |
return showDialog( | |
context: context, | |
builder: (BuildContext context) { | |
return AlertDialog( | |
title: Text('nomLocal'), | |
content: Text('descripcion + descripcion2'), | |
); | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: ListView.builder( | |
controller: _scrollController, | |
itemBuilder: (context, position) { | |
return Padding( | |
padding: const EdgeInsets.only(bottom: 2), | |
child: GestureDetector( | |
child: itemsNotif[position], | |
onTap: () { | |
//Aca irian los popUp | |
}, | |
)); | |
}, | |
itemCount: itemsNotif.length, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment