Skip to content

Instantly share code, notes, and snippets.

Avatar
😁
I may be slow to respond.

Rafael Almeida Barbosa RafaelBarbosatec

😁
I may be slow to respond.
View GitHub Profile
View exemple_route_2.dart
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Screen1()),
);
View exemple_rout.dart
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()
},
View NewsApiv2.dart
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.
View BottomNavigationBar2_flutternews.dart
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'),
View notice_list_complet_nav.dart
import 'package:flutter/material.dart';
import 'Notice.dart';
import 'NewsApi.dart';
class NoticeList extends StatefulWidget{
final state = new _NoticeListPageState();
@override
_NoticeListPageState createState() => state;
View onTabTapped_nav.dart
void onTabTapped(int index) {
setState(() {
_currentIndex = index;
});
}
View BottomNavigationBar_flutternews.dart
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
View NewsApi.dart
import 'dart:async';
import 'dart:convert';
class NewsApi{
Future <List> loadNews() async{
String json = "[ \n" +
" { \n" +
View main_tutorial_notice.dart
import 'package:flutter/material.dart';
import 'widgets/home.dart';
import 'NoticeList.dart'
void main() => runApp(new NewsApp());
class NewsApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {