Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:tabunganku/src/provider/inherited.dart';
- import 'package:tabunganku/src/provider/blocProvider.dart';
- import 'package:tabunganku/src/blocs/dashboardBloc.dart';
- import 'package:tabunganku/src/blocs/pemasukanBloc.dart';
- import 'package:tabunganku/src/ui/pemasukan.dart';
- class Home extends StatelessWidget {
- Map<String, String> date = {
- "date": (DateTime.now().toString()).split('.')[0]
- };
- @override
- Widget build(BuildContext context) {
- final width = MediaQuery.of(context).size.width;
- final height = MediaQuery.of(context).size.height;
- final _dashboardBloc = BlocProvider.of(context);
- Widget _dashboard(Orientation orientation) {
- return Container(
- alignment: Alignment.centerLeft,
- width: width,
- height:
- orientation == Orientation.landscape ? 0.4 * height : 0.2 * height,
- padding: EdgeInsets.all(8),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5)),
- gradient: LinearGradient(
- colors: [Colors.cyan, Colors.blueAccent],
- ),
- boxShadow: [
- BoxShadow(
- color: Colors.black26,
- blurRadius: 4,
- spreadRadius: 1,
- offset: Offset(1, 1))
- ],
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- // StreamBuilder(
- // stream: _dashboardBloc.resultStream,
- // initialData: 0,
- // builder: (context, snapshot) {
- // if (snapshot.hasData) {
- // var _data = snapshot.data;
- // return Text(
- // "Saldo : $_data",
- // textAlign: TextAlign.start,
- // style: TextStyle(
- // color: Colors.white,
- // fontSize: 20,
- // fontWeight: FontWeight.w300,
- // ),
- // );
- // } else {
- // return SizedBox();
- // }
- // },
- // ),
- Divider(
- color: Colors.transparent,
- height: 14,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Column(
- children: <Widget>[
- // StreamBuilder(
- // stream: _dashboardBloc.resultStream,
- // initialData: 0,
- // builder: (context, snapshot) {
- // if (snapshot.hasData) {
- // var _data = snapshot.data;
- // return Text(
- // "$_data",
- // textAlign: TextAlign.start,
- // style: TextStyle(
- // color: Colors.white,
- // fontSize: 35,
- // fontWeight: FontWeight.w300,
- // ),
- // );
- // } else {
- // return SizedBox();
- // }
- // },
- // ),
- Container(
- child: Text(
- "Pemasukan",
- style: TextStyle(
- color: Colors.white,
- fontSize: 20,
- fontWeight: FontWeight.w300,
- ),
- ),
- ),
- ],
- ),
- Column(
- children: <Widget>[
- Text(
- "10",
- style: TextStyle(
- color: Colors.white,
- fontSize: 35,
- fontWeight: FontWeight.w300,
- ),
- ),
- Container(
- child: Text(
- "Penarikan",
- style: TextStyle(
- color: Colors.white,
- fontSize: 20,
- fontWeight: FontWeight.w300,
- ),
- ),
- ),
- ],
- )
- ],
- )
- ],
- ),
- );
- }
- Widget _drawer = Drawer(
- child: Container(
- height: height,
- color: Colors.white,
- child: ListView(
- padding: EdgeInsets.zero,
- children: <Widget>[
- DrawerHeader(
- decoration: BoxDecoration(
- color: Colors.white,
- ),
- child: Align(
- alignment: Alignment.center,
- child: Text(
- "TabunganKu",
- style: TextStyle(
- fontSize: 40,
- fontWeight: FontWeight.w200,
- ),
- ),
- ),
- ),
- ListTile(
- title: Text("Pemasukan"),
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- fullscreenDialog: true,
- builder: (context){
- return Pemasukan();
- }
- ),
- );
- // Navigator.of(context).pushNamed("/pemasukan");
- },
- ),
- ListTile(
- title: Text("Penarikan"),
- onTap: () {
- Navigator.of(context).pushNamed("/penarikan");
- },
- ),
- ListTile(
- title: Text("Support Us"),
- ),
- ],
- ),
- ),
- );
- Widget _body(Widget child) {
- return Container(
- color: Colors.white,
- padding: const EdgeInsets.all(10),
- alignment: Alignment.center,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [child],
- ),
- );
- }
- return Scaffold(
- appBar: AppBar(
- elevation: 0,
- title: Text("TabunganKu"),
- ),
- drawer: _drawer,
- body: OrientationBuilder(
- builder: (context, Orientation orientation) {
- return _body(_dashboard(orientation));
- },
- ),
- floatingActionButton: FloatingActionButton(
- // onPressed: null,
- onPressed: () {
- print(_dashboardBloc.widget.bloc);
- },
- // onPressed: (){print(_pemasukanBloc);},
- child: Icon(
- Icons.add,
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement