Add create buttons to dashbaord
This commit is contained in:
parent
2ed54b146d
commit
ba023c39e5
|
|
@ -1,18 +1,14 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja/constants.dart';
|
import 'package:invoiceninja/constants.dart';
|
||||||
|
import 'package:invoiceninja/data/models/models.dart';
|
||||||
import 'package:invoiceninja/redux/app/app_state.dart';
|
import 'package:invoiceninja/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja/redux/client/client_actions.dart';
|
import 'package:invoiceninja/redux/client/client_actions.dart';
|
||||||
import 'package:invoiceninja/redux/dashboard/dashboard_actions.dart';
|
import 'package:invoiceninja/redux/dashboard/dashboard_actions.dart';
|
||||||
import 'package:invoiceninja/redux/invoice/invoice_actions.dart';
|
import 'package:invoiceninja/redux/invoice/invoice_actions.dart';
|
||||||
import 'package:invoiceninja/redux/product/product_actions.dart';
|
import 'package:invoiceninja/redux/product/product_actions.dart';
|
||||||
import 'package:invoiceninja/data/models/entities.dart';
|
import 'package:invoiceninja/data/models/entities.dart';
|
||||||
import 'package:invoiceninja/redux/ui/ui_actions.dart';
|
|
||||||
import 'package:invoiceninja/ui/app/app_drawer_vm.dart';
|
import 'package:invoiceninja/ui/app/app_drawer_vm.dart';
|
||||||
import 'package:invoiceninja/ui/client/client_screen.dart';
|
|
||||||
import 'package:invoiceninja/ui/dashboard/dashboard_screen.dart';
|
|
||||||
import 'package:invoiceninja/ui/invoice/invoice_screen.dart';
|
|
||||||
import 'package:invoiceninja/ui/product/product_screen.dart';
|
|
||||||
import 'package:invoiceninja/utils/localization.dart';
|
import 'package:invoiceninja/utils/localization.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
|
@ -98,28 +94,45 @@ class AppDrawer extends StatelessWidget {
|
||||||
icon: FontAwesomeIcons.tachometerAlt,
|
icon: FontAwesomeIcons.tachometerAlt,
|
||||||
title: AppLocalization.of(context).dashboard,
|
title: AppLocalization.of(context).dashboard,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
navigator.pop();
|
||||||
store.dispatch(ViewDashboard(context));
|
store.dispatch(ViewDashboard(context));
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
DrawerTile(
|
DrawerTile(
|
||||||
icon: FontAwesomeIcons.users,
|
icon: FontAwesomeIcons.users,
|
||||||
title: AppLocalization.of(context).clients,
|
title: AppLocalization.of(context).clients,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
navigator.pop();
|
||||||
store.dispatch(ViewClientList(context));
|
store.dispatch(ViewClientList(context));
|
||||||
},
|
},
|
||||||
|
onCreateTap: () {
|
||||||
|
navigator.pop();
|
||||||
|
store.dispatch(EditClient(client: ClientEntity(), context: context));
|
||||||
|
},
|
||||||
),
|
),
|
||||||
DrawerTile(
|
DrawerTile(
|
||||||
icon: FontAwesomeIcons.cube,
|
icon: FontAwesomeIcons.cube,
|
||||||
title: AppLocalization.of(context).products,
|
title: AppLocalization.of(context).products,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
navigator.pop();
|
||||||
store.dispatch(ViewProductList(context));
|
store.dispatch(ViewProductList(context));
|
||||||
},
|
},
|
||||||
|
onCreateTap: () {
|
||||||
|
navigator.pop();
|
||||||
|
store.dispatch(EditProduct(product: ProductEntity(), context: context));
|
||||||
|
},
|
||||||
),
|
),
|
||||||
DrawerTile(
|
DrawerTile(
|
||||||
icon: FontAwesomeIcons.filePdfO,
|
icon: FontAwesomeIcons.filePdfO,
|
||||||
title: AppLocalization.of(context).invoices,
|
title: AppLocalization.of(context).invoices,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
navigator.pop();
|
||||||
store.dispatch(ViewInvoiceList(context));
|
store.dispatch(ViewInvoiceList(context));
|
||||||
},
|
},
|
||||||
|
onCreateTap: () {
|
||||||
|
navigator.pop();
|
||||||
|
store.dispatch(EditInvoice(invoice: InvoiceEntity(), context: context));
|
||||||
|
},
|
||||||
),
|
),
|
||||||
DrawerTile(
|
DrawerTile(
|
||||||
icon: FontAwesomeIcons.powerOff,
|
icon: FontAwesomeIcons.powerOff,
|
||||||
|
|
@ -149,11 +162,13 @@ class DrawerTile extends StatelessWidget {
|
||||||
this.icon,
|
this.icon,
|
||||||
this.title,
|
this.title,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
|
this.onCreateTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final String title;
|
final String title;
|
||||||
final Function onTap;
|
final Function onTap;
|
||||||
|
final Function onCreateTap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -162,6 +177,10 @@ class DrawerTile extends StatelessWidget {
|
||||||
leading: Icon(icon, size: 22.0),
|
leading: Icon(icon, size: 22.0),
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
onTap: () => onTap(),
|
onTap: () => onTap(),
|
||||||
|
trailing: onCreateTap == null ? null : IconButton(
|
||||||
|
icon: Icon(Icons.add_circle_outline),
|
||||||
|
onPressed: onCreateTap,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class ProgressButton extends StatelessWidget {
|
||||||
padding: EdgeInsets.only(top: 12.0, bottom: 12.0),
|
padding: EdgeInsets.only(top: 12.0, bottom: 12.0),
|
||||||
//color: Colors.lightBlueAccent,
|
//color: Colors.lightBlueAccent,
|
||||||
//color: const Color(0xFF005090),
|
//color: const Color(0xFF005090),
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColorDark,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
onPressed: () => this.onPressed(),
|
onPressed: () => this.onPressed(),
|
||||||
|
|
|
||||||
|
|
@ -53,17 +53,7 @@ class ClientScreen extends StatelessWidget {
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
|
floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
backgroundColor: Theme.of(context).primaryColorDark,
|
backgroundColor: Theme.of(context).primaryColorDark,
|
||||||
onPressed: () {
|
onPressed: () => store.dispatch(EditClient(client: ClientEntity(), context: context)),
|
||||||
// TODO create factory
|
|
||||||
var client = ClientEntity()
|
|
||||||
.rebuild((b) => b..contacts.replace([ContactEntity().rebuild((b) => b
|
|
||||||
..firstName = ''
|
|
||||||
..lastName = ''
|
|
||||||
..email = ''
|
|
||||||
..phone = ''
|
|
||||||
)]));
|
|
||||||
store.dispatch(EditClient(client: client, context: context));
|
|
||||||
},
|
|
||||||
child: Icon(Icons.add, color: Colors.white,),
|
child: Icon(Icons.add, color: Colors.white,),
|
||||||
tooltip: localization.newClient,
|
tooltip: localization.newClient,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class ClientEditContacts extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: RaisedButton(
|
child: RaisedButton(
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColorDark,
|
||||||
textColor: Theme.of(context).secondaryHeaderColor,
|
textColor: Theme.of(context).secondaryHeaderColor,
|
||||||
child: Text(localization.addContact.toUpperCase()),
|
child: Text(localization.addContact.toUpperCase()),
|
||||||
onPressed: viewModel.onAddContactPressed,
|
onPressed: viewModel.onAddContactPressed,
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class InvoiceEditItems extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: RaisedButton(
|
child: RaisedButton(
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColorDark,
|
||||||
textColor: Theme.of(context).secondaryHeaderColor,
|
textColor: Theme.of(context).secondaryHeaderColor,
|
||||||
child: Text(localization.addItem.toUpperCase()),
|
child: Text(localization.addItem.toUpperCase()),
|
||||||
onPressed: viewModel.onAddInvoiceItemPressed,
|
onPressed: viewModel.onAddInvoiceItemPressed,
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ class ContactsPageState extends State<ContactsPage>
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: RaisedButton(
|
child: RaisedButton(
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColorDark,
|
||||||
textColor: Theme.of(context).secondaryHeaderColor,
|
textColor: Theme.of(context).secondaryHeaderColor,
|
||||||
child: Text('ADD CONTACT'),
|
child: Text('ADD CONTACT'),
|
||||||
onPressed: _onAddPressed,
|
onPressed: _onAddPressed,
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ class ContactsPage extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: RaisedButton(
|
child: RaisedButton(
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColorDark,
|
||||||
textColor: Theme.of(context).secondaryHeaderColor,
|
textColor: Theme.of(context).secondaryHeaderColor,
|
||||||
child: Text('ADD CONTACT'),
|
child: Text('ADD CONTACT'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue