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_redux/flutter_redux.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/client/client_actions.dart';
|
||||
import 'package:invoiceninja/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja/redux/invoice/invoice_actions.dart';
|
||||
import 'package:invoiceninja/redux/product/product_actions.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/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:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
|
|
@ -98,28 +94,45 @@ class AppDrawer extends StatelessWidget {
|
|||
icon: FontAwesomeIcons.tachometerAlt,
|
||||
title: AppLocalization.of(context).dashboard,
|
||||
onTap: () {
|
||||
navigator.pop();
|
||||
store.dispatch(ViewDashboard(context));
|
||||
}),
|
||||
},
|
||||
),
|
||||
DrawerTile(
|
||||
icon: FontAwesomeIcons.users,
|
||||
title: AppLocalization.of(context).clients,
|
||||
onTap: () {
|
||||
navigator.pop();
|
||||
store.dispatch(ViewClientList(context));
|
||||
},
|
||||
onCreateTap: () {
|
||||
navigator.pop();
|
||||
store.dispatch(EditClient(client: ClientEntity(), context: context));
|
||||
},
|
||||
),
|
||||
DrawerTile(
|
||||
icon: FontAwesomeIcons.cube,
|
||||
title: AppLocalization.of(context).products,
|
||||
onTap: () {
|
||||
navigator.pop();
|
||||
store.dispatch(ViewProductList(context));
|
||||
},
|
||||
onCreateTap: () {
|
||||
navigator.pop();
|
||||
store.dispatch(EditProduct(product: ProductEntity(), context: context));
|
||||
},
|
||||
),
|
||||
DrawerTile(
|
||||
icon: FontAwesomeIcons.filePdfO,
|
||||
title: AppLocalization.of(context).invoices,
|
||||
onTap: () {
|
||||
navigator.pop();
|
||||
store.dispatch(ViewInvoiceList(context));
|
||||
},
|
||||
onCreateTap: () {
|
||||
navigator.pop();
|
||||
store.dispatch(EditInvoice(invoice: InvoiceEntity(), context: context));
|
||||
},
|
||||
),
|
||||
DrawerTile(
|
||||
icon: FontAwesomeIcons.powerOff,
|
||||
|
|
@ -149,11 +162,13 @@ class DrawerTile extends StatelessWidget {
|
|||
this.icon,
|
||||
this.title,
|
||||
this.onTap,
|
||||
this.onCreateTap,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final Function onTap;
|
||||
final Function onCreateTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -162,6 +177,10 @@ class DrawerTile extends StatelessWidget {
|
|||
leading: Icon(icon, size: 22.0),
|
||||
title: Text(title),
|
||||
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),
|
||||
//color: Colors.lightBlueAccent,
|
||||
//color: const Color(0xFF005090),
|
||||
color: Theme.of(context).primaryColor,
|
||||
color: Theme.of(context).primaryColorDark,
|
||||
textColor: Colors.white,
|
||||
elevation: 4.0,
|
||||
onPressed: () => this.onPressed(),
|
||||
|
|
|
|||
|
|
@ -53,17 +53,7 @@ class ClientScreen extends StatelessWidget {
|
|||
floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
|
||||
floatingActionButton: FloatingActionButton(
|
||||
backgroundColor: Theme.of(context).primaryColorDark,
|
||||
onPressed: () {
|
||||
// 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));
|
||||
},
|
||||
onPressed: () => store.dispatch(EditClient(client: ClientEntity(), context: context)),
|
||||
child: Icon(Icons.add, color: Colors.white,),
|
||||
tooltip: localization.newClient,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class ClientEditContacts extends StatelessWidget {
|
|||
padding: const EdgeInsets.all(12.0),
|
||||
child: RaisedButton(
|
||||
elevation: 4.0,
|
||||
color: Theme.of(context).primaryColor,
|
||||
color: Theme.of(context).primaryColorDark,
|
||||
textColor: Theme.of(context).secondaryHeaderColor,
|
||||
child: Text(localization.addContact.toUpperCase()),
|
||||
onPressed: viewModel.onAddContactPressed,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class InvoiceEditItems extends StatelessWidget {
|
|||
padding: const EdgeInsets.all(12.0),
|
||||
child: RaisedButton(
|
||||
elevation: 4.0,
|
||||
color: Theme.of(context).primaryColor,
|
||||
color: Theme.of(context).primaryColorDark,
|
||||
textColor: Theme.of(context).secondaryHeaderColor,
|
||||
child: Text(localization.addItem.toUpperCase()),
|
||||
onPressed: viewModel.onAddInvoiceItemPressed,
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class ContactsPageState extends State<ContactsPage>
|
|||
padding: const EdgeInsets.all(12.0),
|
||||
child: RaisedButton(
|
||||
elevation: 4.0,
|
||||
color: Theme.of(context).primaryColor,
|
||||
color: Theme.of(context).primaryColorDark,
|
||||
textColor: Theme.of(context).secondaryHeaderColor,
|
||||
child: Text('ADD CONTACT'),
|
||||
onPressed: _onAddPressed,
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ class ContactsPage extends StatelessWidget {
|
|||
padding: const EdgeInsets.all(12.0),
|
||||
child: RaisedButton(
|
||||
elevation: 4.0,
|
||||
color: Theme.of(context).primaryColor,
|
||||
color: Theme.of(context).primaryColorDark,
|
||||
textColor: Theme.of(context).secondaryHeaderColor,
|
||||
child: Text('ADD CONTACT'),
|
||||
onPressed: () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue