Skip to content

Instantly share code, notes, and snippets.

View RafaelBarbosatec's full-sized avatar

Rafael Almeida Barbosa RafaelBarbosatec

View GitHub Profile
Widget _getListCategory(){
ListView listCategory = new ListView.builder(
itemCount: _categorys.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index){
return _buildCategoryItem(index);
}
);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Screen1()),
);
Navigator.of(context).pushNamed('/screen1');
return new MaterialApp(
title: 'Flutter News',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new NoticeList(),
routes: <String, WidgetBuilder> {
'/screen1': (BuildContext context) => new Screen1(),
'/screen2' : (BuildContext context) => new Screen2()
},
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
class NewsApi{
String url = "https://raw.githubusercontent.com/RafaelBarbosatec/tutorial_flutter_medium/master/api/news.json";
Future <List> loadNews() async{
// Make a HTTP GET request to the CoinMarketCap API.
import 'package:flutter/material.dart';
import 'Notice.dart';
import 'NewsApi.dart';
class NoticeList extends StatefulWidget{
final state = new _NoticeListPageState();
@override
_NoticeListPageState createState() => state;
Widget _getBottomNavigationBa() {
return new BottomNavigationBar(
onTap: onTabTapped, // new
currentIndex: _currentIndex, // new
type: BottomNavigationBarType.shifting
items: [
new BottomNavigationBarItem(
icon: const Icon(Icons.home),
title: Text('Recentes'),
void onTabTapped(int index) {
setState(() {
_currentIndex = index;
});
}
Widget _getBottomNavigationBa() {
return new BottomNavigationBar(
onTap: onTabTapped, // new
currentIndex: _currentIndex, // new
items: [
new BottomNavigationBarItem(
icon: const Icon(Icons.home),
title: Text('Recentes'),
backgroundColor: Colors.blue
import 'package:flutter/material.dart';
import 'Notice.dart';
import 'NewsApi.dart';
class NoticeList extends StatefulWidget{
final state = new _NoticeListPageState();
@override
_NoticeListPageState createState() => state;