Account management
This commit is contained in:
parent
16d71bb71c
commit
7b6e17bec5
|
|
@ -5,12 +5,12 @@ class ElevatedButton extends StatelessWidget {
|
|||
const ElevatedButton(
|
||||
{@required this.label,
|
||||
@required this.onPressed,
|
||||
this.icon,
|
||||
this.iconData,
|
||||
this.color,
|
||||
this.width});
|
||||
|
||||
final Color color;
|
||||
final IconData icon;
|
||||
final IconData iconData;
|
||||
final String label;
|
||||
final Function onPressed;
|
||||
final double width;
|
||||
|
|
@ -22,9 +22,9 @@ class ElevatedButton extends StatelessWidget {
|
|||
child: RaisedButton(
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||
color: color ?? Theme.of(context).buttonColor,
|
||||
child: icon != null
|
||||
child: iconData != null
|
||||
? IconText(
|
||||
icon: icon,
|
||||
icon: iconData,
|
||||
text: label,
|
||||
)
|
||||
: Text(label),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class DocumentGrid extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
icon: Icons.camera_alt,
|
||||
iconData: Icons.camera_alt,
|
||||
label: localization.takePicture,
|
||||
onPressed: () async {
|
||||
final image = await ImagePicker.pickImage(
|
||||
|
|
@ -56,7 +56,7 @@ class DocumentGrid extends StatelessWidget {
|
|||
),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
icon: Icons.insert_drive_file,
|
||||
iconData: Icons.insert_drive_file,
|
||||
label: localization.uploadFile,
|
||||
onPressed: () async {
|
||||
final image = await ImagePicker.pickImage(
|
||||
|
|
@ -133,7 +133,7 @@ class DocumentTile extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
isFromExpense
|
||||
? ElevatedButton(
|
||||
icon: getEntityIcon(EntityType.expense),
|
||||
iconData: getEntityIcon(EntityType.expense),
|
||||
label: localization.expense,
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
|
|
@ -142,7 +142,7 @@ class DocumentTile extends StatelessWidget {
|
|||
)
|
||||
: ElevatedButton(
|
||||
color: Colors.red,
|
||||
icon: Icons.delete,
|
||||
iconData: Icons.delete,
|
||||
label: localization.delete,
|
||||
onPressed: () {
|
||||
confirmCallback(
|
||||
|
|
@ -157,7 +157,7 @@ class DocumentTile extends StatelessWidget {
|
|||
width: 16,
|
||||
),
|
||||
ElevatedButton(
|
||||
icon: Icons.check_circle,
|
||||
iconData: Icons.check_circle,
|
||||
label: localization.done,
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
|||
),
|
||||
ElevatedButton(
|
||||
color: Colors.red,
|
||||
icon: Icons.delete,
|
||||
iconData: Icons.delete,
|
||||
label: localization.remove,
|
||||
onPressed: () => confirmCallback(
|
||||
context: context,
|
||||
|
|
@ -264,7 +264,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
|||
width: 10.0,
|
||||
),
|
||||
ElevatedButton(
|
||||
icon: Icons.check_circle,
|
||||
iconData: Icons.check_circle,
|
||||
label: localization.done,
|
||||
onPressed: () {
|
||||
viewModel.onDoneContactPressed();
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class _GroupViewState extends State<GroupView> {
|
|||
padding: const EdgeInsets.all(16),
|
||||
child: ElevatedButton(
|
||||
label: localization.configureSettings.toUpperCase(),
|
||||
icon: Icons.settings,
|
||||
iconData: Icons.settings,
|
||||
onPressed: () =>
|
||||
handleGroupAction(context, [group], EntityAction.settings),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
|
|||
children: <Widget>[
|
||||
ElevatedButton(
|
||||
color: Colors.red,
|
||||
icon: Icons.delete,
|
||||
iconData: Icons.delete,
|
||||
label: localization.remove,
|
||||
onPressed: () {
|
||||
widget.viewModel.onRemoveInvoiceItemPressed(widget.index);
|
||||
|
|
@ -221,7 +221,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
|
|||
width: 10.0,
|
||||
),
|
||||
ElevatedButton(
|
||||
icon: Icons.check_circle,
|
||||
iconData: Icons.check_circle,
|
||||
label: localization.done,
|
||||
onPressed: () {
|
||||
viewModel.onDoneInvoiceItemPressed();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
||||
import 'package:invoiceninja_flutter/ui/settings/account_management_vm.dart';
|
||||
import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class AccountManagement extends StatefulWidget {
|
||||
|
|
@ -16,8 +18,7 @@ class AccountManagement extends StatefulWidget {
|
|||
final AccountManagementVM viewModel;
|
||||
|
||||
@override
|
||||
_AccountManagementState createState() =>
|
||||
_AccountManagementState();
|
||||
_AccountManagementState createState() => _AccountManagementState();
|
||||
}
|
||||
|
||||
class _AccountManagementState extends State<AccountManagement>
|
||||
|
|
@ -69,7 +70,22 @@ class _AccountManagementState extends State<AccountManagement>
|
|||
children: <Widget>[
|
||||
ListView(
|
||||
children: <Widget>[
|
||||
|
||||
ElevatedButton(
|
||||
label: localization.deleteCompany,
|
||||
color: Colors.red,
|
||||
iconData: Icons.delete,
|
||||
onPressed: () {
|
||||
confirmCallback(
|
||||
context: context,
|
||||
callback: () {
|
||||
passwordCallback(
|
||||
context: context,
|
||||
callback: (password) {
|
||||
print('delete');
|
||||
});
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
ListView(
|
||||
|
|
@ -95,8 +111,8 @@ class _AccountManagementState extends State<AccountManagement>
|
|||
} else {
|
||||
enabledModules = enabledModules ^ module;
|
||||
}
|
||||
viewModel.onCompanyChanged(company
|
||||
.rebuild((b) => b..enabledModules = enabledModules));
|
||||
viewModel.onCompanyChanged(company.rebuild(
|
||||
(b) => b..enabledModules = enabledModules));
|
||||
}
|
||||
: null,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ class _CompanyDetailsState extends State<CompanyDetails>
|
|||
width: double.infinity,
|
||||
color: Colors.redAccent,
|
||||
label: localization.delete,
|
||||
icon: Icons.delete,
|
||||
iconData: Icons.delete,
|
||||
onPressed: () {
|
||||
confirmCallback(
|
||||
context: context,
|
||||
|
|
@ -359,7 +359,7 @@ class _CompanyDetailsState extends State<CompanyDetails>
|
|||
child: ElevatedButton(
|
||||
width: double.infinity,
|
||||
label: localization.uploadLogo,
|
||||
icon: Icons.cloud_upload,
|
||||
iconData: Icons.cloud_upload,
|
||||
onPressed: () async {
|
||||
String path;
|
||||
if (kIsWeb) {
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class TimeEditDetailsState extends State<TimeEditDetails> {
|
|||
children: <Widget>[
|
||||
ElevatedButton(
|
||||
color: Colors.red,
|
||||
icon: Icons.delete,
|
||||
iconData: Icons.delete,
|
||||
label: localization.remove,
|
||||
onPressed: () {
|
||||
widget.viewModel.onRemoveTaskTimePressed(widget.index);
|
||||
|
|
@ -155,7 +155,7 @@ class TimeEditDetailsState extends State<TimeEditDetails> {
|
|||
width: 10.0,
|
||||
),
|
||||
ElevatedButton(
|
||||
icon: Icons.check_circle,
|
||||
iconData: Icons.check_circle,
|
||||
label: localization.done,
|
||||
onPressed: () {
|
||||
final startDate = DateTime.parse(_date);
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
|||
),
|
||||
ElevatedButton(
|
||||
color: Colors.red,
|
||||
icon: Icons.delete,
|
||||
iconData: Icons.delete,
|
||||
label: localization.remove,
|
||||
onPressed: () => confirmCallback(
|
||||
context: context,
|
||||
|
|
@ -253,7 +253,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
|||
width: 10.0,
|
||||
),
|
||||
ElevatedButton(
|
||||
icon: Icons.check_circle,
|
||||
iconData: Icons.check_circle,
|
||||
label: localization.done,
|
||||
onPressed: () {
|
||||
viewModel.onDoneContactPressed();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,11 @@ void showErrorDialog({BuildContext context, String message}) {
|
|||
});
|
||||
}
|
||||
|
||||
void confirmCallback({BuildContext context, VoidCallback callback}) {
|
||||
void confirmCallback({
|
||||
@required BuildContext context,
|
||||
@required VoidCallback callback,
|
||||
String message,
|
||||
}) {
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
showDialog<AlertDialog>(
|
||||
|
|
@ -20,6 +24,7 @@ void confirmCallback({BuildContext context, VoidCallback callback}) {
|
|||
builder: (BuildContext context) => AlertDialog(
|
||||
semanticLabel: localization.areYouSure,
|
||||
title: Text(localization.areYouSure),
|
||||
content: message == null ? null : Text(message),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text(localization.cancel.toUpperCase()),
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'delete_company': 'Delete Company',
|
||||
'enable_modules': 'Enable Modules',
|
||||
'converted_quote': 'Successfully converted quote',
|
||||
'credit_design': 'Credit Design',
|
||||
|
|
@ -32853,6 +32854,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
|
||||
String get enableModules => _localizedValues[localeCode]['enable_modules'];
|
||||
|
||||
String get deleteCompany => _localizedValues[localeCode]['delete_company'];
|
||||
|
||||
|
||||
String lookup(String key) {
|
||||
final lookupKey = toSnakeCase(key);
|
||||
return _localizedValues[localeCode][lookupKey] ??
|
||||
|
|
|
|||
Loading…
Reference in New Issue