Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Widget _buildCategoryItem(index){
return new GestureDetector(
onTap: (){
onTabCategory(index);
},
child: new Center(
child: new Container(
margin: new EdgeInsets.only(left: 10.0),
child: new Material(
elevation: 2.0,
borderRadius: const BorderRadius.all(const Radius.circular(25.0)),
child: new Container(
padding: new EdgeInsets.only(left: 12.0,top: 7.0,bottom: 7.0,right: 12.0),
color: _category_selected == index ? Colors.blue[800]:Colors.blue[500],
child: new Text(_categorys[index],
style: new TextStyle(
color: Colors.white),
),
),
),
),
),
);
}
onTabCategory(index){
setState(() {
_category_selected = index;
});
//Realiza chamada de serviço para atualizar as noticias de acordo com a categoria selecionada
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment