Skip to content

Instantly share code, notes, and snippets.

@kennedisimbolo
Created December 22, 2020 12:14
Show Gist options
  • Save kennedisimbolo/618deac60be12cded1757f2a1ae27486 to your computer and use it in GitHub Desktop.
Save kennedisimbolo/618deac60be12cded1757f2a1ae27486 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Container(
child: Column(
children: <Widget>[
Stack(
children: <Widget>[backgroundHeader(), summaryCash()],
),
cardDetail('PUPUK SS', 'Beli 15sak', '15.000.000', 'out'),
cardDetail('Bonus', 'Dapat Bonus Penjualan PUPUK', '1.000.000', 'in'),
cardDetail('Beli persediaan toko', 'pupuk untuk dijual', '2.500.000', 'out'),
cardDetail('gaji karyawan', 'perbulan', '1.000.000', 'out'),
cardDetail('Bonus', 'Dapat Bonus Penjualanpupuk', '100.000', 'in'),
],
),
),
),
);
}
}
Widget cardDetail(title, description, price, type) {
return Card(
margin: EdgeInsets.only(top: 15, left: 15, right: 15),
elevation: 8,
child: ListTile(
leading: Icon(
type == 'out' ? Icons.subdirectory_arrow_left:Icons.subdirectory_arrow_right,
color: type == 'out' ? Colors.redAccent:Colors.lightGreen,
),
title: Text(
title,
style: TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Text(description),
trailing: Text(
"Rp "+price,
style: TextStyle(color: type == 'out' ? Colors.redAccent:Colors.lightGreen),
),
),
);
}
Widget summaryCash() {
return Positioned(
top: 180,
left: 20,
right: 20,
child: Container(
width: 370,
height: 140,
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.circular(30),
),
child: Padding(
padding: const EdgeInsets.only(top: 30.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
children: <Widget>[
Text("Penghasilan"),
Divider(),
Text(
"Rp 16.000.000",
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
),
],
),
Column(
children: <Widget>[
Text("Pengeluaran"),
Divider(),
Text(
"Rp 3.600.000",
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
),
],
),
Column(
children: <Widget>[
Text("Saldo"),
Divider(),
Text(
"Rp 12.400.000",
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
),
],
),
],
),
),
),
);
}
Widget backgroundHeader() {
return Container(
height: 300,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.yellow,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
),
child: Padding(
padding: const EdgeInsets.only(top: 60, left: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"KASIR",
style: TextStyle(
fontSize: 25, color: Colors.red, fontWeight: FontWeight.bold),
),
Text(
"UD.APOTII TANI",
style: TextStyle(
fontSize: 25, color: Colors.red, fontWeight: FontWeight.bold),
),
Text(
"jln Siliwangi no 12 doloksanggul",
style: TextStyle(
fontSize: 15,
color: Colors.white,
),
),
],
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment