Skip to content

Instantly share code, notes, and snippets.

@rubgithub
Created March 23, 2020 18:38
Show Gist options
  • Save rubgithub/25670df70bff3c304f081db314955672 to your computer and use it in GitHub Desktop.
Save rubgithub/25670df70bff3c304f081db314955672 to your computer and use it in GitHub Desktop.
Replicar item Lista
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
final defaultColor = Colors.blueAccent;
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
// int _counter = 0;
// void _incrementCounter() {
// setState(() {
// _counter++;
// });
// }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Container(
color: Colors.black,
child: ListView(
children: <Widget>[_card(),_card(),_card(),_card()],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {},
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}
Widget _card() {
return Container(
padding: EdgeInsets.all(10.0),
child: Center(
child: Column(
//Para ocupar toda a tela no horizontal
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Card(
color: Colors.grey[100],
child: Container(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Evento de Tecnologia e ciência",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 20, color: defaultColor),
),
SizedBox(
height: 10,
),
Text(
"Dispível de 10/02/2020 até 25/06/2020",
style: TextStyle(fontSize: 14),
),
SizedBox(
height: 5,
),
Text(
"Total disponível: 50 de 100 (50%)",
style: TextStyle(fontSize: 14),
),
]),
),
),
],
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment