Created
January 10, 2020 13:01
-
-
Save guilhermecarvalhocarneiro/9b920918e7f4c8221c38668124e8bfab 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 ... | |
class FeedPage extends StatefulWidget { | |
@override | |
_FeedPageState createState() => _FeedPageState(); | |
} | |
class _FeedPageState extends State<FeedPage> { | |
var itemSelected = 0; | |
final ScrollController controller = ScrollController(); | |
@override | |
Widget build(BuildContext context) { | |
FeedProvider _feedProvider = Provider.of<FeedProvider>(context); | |
return SafeArea( | |
child: Container( | |
foregroundDecoration: | |
BoxDecoration(color: Color(...)), | |
child: Column( | |
children: <Widget>[ | |
buildHead(), | |
buildFilterOptionsFeed(), | |
buildListView(_feedProvider) | |
], | |
), | |
), | |
); | |
} | |
Widget buildListView(provider) { | |
return Expanded( | |
child: ListView.builder( | |
controller: controller, | |
itemCount: provider.getItens().length, | |
itemBuilder: (context, index) { | |
var feed = provider.getItens(); | |
var post = feed[index]; | |
// passando os dados para o Widget CardView | |
return feedCardView(context, post); | |
}, | |
), | |
); | |
} | |
void moveTop() { | |
try { | |
controller.animateTo(0, | |
duration: Duration(microseconds: 50), curve: Curves.easeInBack); | |
} catch (e) {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment