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 escopo_notice_list_class.dart
class NoticeList extends StatefulWidget{
final state = new _NoticeListPageState();
@override
_NoticeListPageState createState() => state;
}
class _NoticeListPageState extends State<NoticeList>{
View example_json_notices.json
[
{
"id":"23658",
"tittle":"Tite recebe convocados nesta segunda e tem 27 dias de preparação para estreia",
"description":"As ausências certas são de Casemiro e Marcelo, do Real Madrid, e Roberto Firmino, do Liverpool, que disputarão a final da Liga dos Campeões",
"url_img":"http://104.131.18.84/notice/uploads/news/1fd055d2a109fe18af4414bf87293575.jpg",
"link":"https://www.otempo.com.br/superfc/tite-recebe-convocados-nesta-segunda-e-tem-27-dias-de-prepara%C3%A7%C3%A3o-para-estreia-1.1789078",
"origin":"Otempo.com.br",
"category":"sports",
"date":"2018-05-21 11:37:50"
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) {
View NewsApi.dart
import 'dart:async';
import 'dart:convert';
class NewsApi{
Future <List> loadNews() async{
String json = "[ \n" +
" { \n" +
View notive_list_1.dart
class NoticeList extends StatefulWidget{
final state = new _NoticeListPageState();
@override
_NoticeListPageState createState() => state;
}
class _NoticeListPageState extends State<NoticeList>{
View layout_base_notice.dart
new Material(
borderRadius: new BorderRadius.circular(6.0),
elevation: 2.0,
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
//Adicionamos aqui FadeInImage que é uma variande do widget Image. Ela nos possibilita carregar image de uma URL
new FadeInImage.assetNetwork(
placeholder: '',
image: _img,
View class_notice.dart
class Notice extends StatelessWidget{
var _img;
var _title;
var _date;
var _description;
Notice(this._img,this._title,this._date,this._description);
BuildContext _context;
View notive_list_complet.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 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 onTabTapped_nav.dart
void onTabTapped(int index) {
setState(() {
_currentIndex = index;
});
}