Skip to content

Instantly share code, notes, and snippets.

View RafaelBarbosatec's full-sized avatar

Rafael Almeida Barbosa RafaelBarbosatec

View GitHub Profile
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart';
void main() {
runApp(MyApp());
}
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
import 'package:flutter/material.dart';
import 'package:flutter_tutorial_medium/Detail.dart';
class Notice extends StatelessWidget {
var _img;
var _title;
var _date;
var _description;
Notice(this._img, this._title, this._date, this._description);
@override
Widget build(BuildContext context) {
this._context = context;
//Foi adicionado dentro de Container para adicionar margem no item
return new Container(
margin: const EdgeInsets.only(
left: 10.0, right: 10.0, bottom: 10.0, top: 0.0),
child: new Material(
borderRadius: new BorderRadius.circular(6.0),
import 'package:flutter/material.dart';
class Detail extends StatelessWidget{
var _img;
var _title;
var _date;
var _description;
Detail(this._img,this._title,this._date,this._description);
void setCategorys() {
_categorys.add("Geral");
_categorys.add("Esporte");
_categorys.add("Tecnologia");
_categorys.add("Entretenimento");
_categorys.add("Saúde");
_categorys.add("Negócios");
}
import 'package:flutter/material.dart';
import 'Notice.dart';
import 'NewsApi.dart';
class NoticeList extends StatefulWidget{
final state = new _NoticeListPageState();
@override
_NoticeListPageState createState() => state;
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(),
body: new Container(
child: new Column(
children: <Widget>[
_getListCategory(),
new Expanded(
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(
Widget _getListCategory(){
ListView listCategory = new ListView.builder(
itemCount: _categorys.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index){
return _buildCategoryItem(index);
}
);