Clients
This commit is contained in:
parent
b93cfed97b
commit
471c2f942d
|
|
@ -0,0 +1,4 @@
|
|||
analyzer:
|
||||
strong-mode: true
|
||||
language:
|
||||
enableSuperMixins: true
|
||||
|
|
@ -5,43 +5,108 @@ import 'package:invoiceninja/ui/app/progress_button.dart';
|
|||
import 'package:invoiceninja/ui/client/client_details_vm.dart';
|
||||
import 'package:invoiceninja/utils/localization.dart';
|
||||
|
||||
class ClientDetails extends StatelessWidget {
|
||||
class ClientDetails extends StatefulWidget {
|
||||
final ClientDetailsVM viewModel;
|
||||
|
||||
static final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
static final GlobalKey<FormFieldState<String>> _nameKey =
|
||||
GlobalKey<FormFieldState<String>>();
|
||||
|
||||
ClientDetails({
|
||||
Key key,
|
||||
@required this.viewModel,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ClientDetailsState createState() => new _ClientDetailsState();
|
||||
}
|
||||
|
||||
class _ClientDetailsState extends State<ClientDetails>
|
||||
with SingleTickerProviderStateMixin {
|
||||
static final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
static final GlobalKey<FormFieldState<String>> _nameKey =
|
||||
GlobalKey<FormFieldState<String>>();
|
||||
TabController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = new TabController(vsync: this, length: 2);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var localization = AppLocalization.of(context);
|
||||
|
||||
Widget _overview() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: Icon(Icons.pin_drop),
|
||||
title: Text(widget.viewModel.client.address1),
|
||||
subtitle: Text(localization.billingAddress),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _details() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: Icon(Icons.pin_drop),
|
||||
title: Text(widget.viewModel.client.address1),
|
||||
subtitle: Text(localization.billingAddress),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(viewModel.client.id == null
|
||||
title: Text(widget.viewModel.client.id == null
|
||||
? localization.newClient
|
||||
: viewModel.client.displayName), // Text(localizations.clientDetails),
|
||||
actions: viewModel.client.id == null ? [] : [
|
||||
ActionMenuButton(
|
||||
entity: viewModel.client,
|
||||
onSelected: viewModel.onActionSelected,
|
||||
)],
|
||||
: widget.viewModel.client
|
||||
.displayName), // Text(localizations.clientDetails),
|
||||
bottom: TabBar(
|
||||
controller: _controller,
|
||||
//isScrollable: true,
|
||||
tabs: [
|
||||
Tab(
|
||||
text: localization.overview,
|
||||
),
|
||||
Tab(
|
||||
text: localization.details,
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: widget.viewModel.client.id == null
|
||||
? []
|
||||
: [
|
||||
ActionMenuButton(
|
||||
entity: widget.viewModel.client,
|
||||
onSelected: widget.viewModel.onActionSelected,
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: ListView(children: <Widget>[
|
||||
ListTile(
|
||||
leading: Icon(Icons.location_city),
|
||||
title: Text(viewModel.client.address1),
|
||||
subtitle: Text(localization.billingAddress),
|
||||
)
|
||||
],),
|
||||
)
|
||||
body: TabBarView(
|
||||
controller: _controller,
|
||||
children: <Widget>[
|
||||
_overview(),
|
||||
_details(),
|
||||
],
|
||||
),
|
||||
/*
|
||||
body:
|
||||
*/
|
||||
/*
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ class AppLocalization {
|
|||
'save': 'Save',
|
||||
'an_error_occurred': 'An error occurred',
|
||||
'paid_to_date': 'Paid to Date',
|
||||
'overview': 'Overview',
|
||||
'details': 'Details',
|
||||
|
||||
'product': 'Product',
|
||||
'products': 'Products',
|
||||
|
|
@ -104,6 +106,8 @@ class AppLocalization {
|
|||
String get descending => _localizedValues[locale.languageCode]['descending'];
|
||||
String get save => _localizedValues[locale.languageCode]['save'];
|
||||
String get paidToDate => _localizedValues[locale.languageCode]['paid_to_date'];
|
||||
String get overview => _localizedValues[locale.languageCode]['overview'];
|
||||
String get details => _localizedValues[locale.languageCode]['details'];
|
||||
|
||||
String get product => _localizedValues[locale.languageCode]['product'];
|
||||
String get products => _localizedValues[locale.languageCode]['products'];
|
||||
|
|
|
|||
Loading…
Reference in New Issue