Skip to content

Instantly share code, notes, and snippets.

@rodrigolmacedo
Last active January 16, 2020 19:29
Show Gist options
  • Save rodrigolmacedo/0676663496dd1cd0acb741861a84682d to your computer and use it in GitHub Desktop.
Save rodrigolmacedo/0676663496dd1cd0acb741861a84682d to your computer and use it in GitHub Desktop.
// 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());
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> {
Widget _backButton(Function onpressed){
return IconButton(
icon: Icon(Icons.arrow_back_ios),
onPressed: onpressed,
);
}
Widget _chartIcon(Function onpressed){
return IconButton(
icon: Icon(Icons.pie_chart),
onPressed: onpressed,
);
}
Widget _optionsIcon(Function onpressed){
return IconButton(
icon:Icon(Icons.settings),
onPressed: onpressed,
);
}
Widget _botao(String texto, Function onpressed, Color color, IconData icon){
return Container(
height: 50,
width: 120,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(30),
//border: Border.all()
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(icon),
SizedBox(width: 10,),
Text(texto)
],
),
);
}
Widget _textTop(){
return Text("My Bugdets", style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
textAlign: TextAlign.center,);
}
Widget _textTop2(){
return Text("59.5K", style: TextStyle(fontSize: 25, color: Colors.grey),);
}
Widget _Card(String title, String subtitle, IconData icon ){
return Card(
color: Colors.limeAccent,
margin: EdgeInsets.all(10),
elevation: 2,
child: ListTile(
//contentPadding: EdgeInsets.zero,
leading: Icon(icon),
title: Text(title),
subtitle: Text(subtitle),
trailing: Icon(Icons.arrow_drop_down),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
Positioned(
top: 10,
right: 5,
child: Container(
//padding: EdgeInsets.all(15),
child:Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
_chartIcon((){}),
_optionsIcon((){})
],
)
),
),
Positioned(
top: 10,
child: Container(
//padding: EdgeInsets.all(15),
child:Row(
children: <Widget>[
_backButton((){})
],
),
),
),
Positioned.fill(
top: 75,
//right: 50,
child: Container(
//padding: EdgeInsets.only(top: 100),
child: Column(
children: <Widget>[
_textTop(),
SizedBox(height: 10,),
_textTop2(),
SizedBox(height: 50,),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_botao("Today",(){},Colors.orange, Icons.arrow_upward ),
SizedBox(width: 5,),
_botao("Total",(){},Colors.grey, Icons.arrow_downward )
],
),
],
)
),
),
Positioned.fill(
top: 270,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
_Card("Home Refurb", "25.3K",Icons.palette),
_Card("Fun Money", "5.3K",Icons.smoking_rooms),
_Card("Pet Food", "1.3K",Icons.pets),
_Card("Others", "11.3K",Icons.airline_seat_recline_normal)
],
),
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: (){},
backgroundColor: Colors.black,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment