Show error messages
This commit is contained in:
parent
10dff7c86c
commit
d54b37f1f3
|
|
@ -2,12 +2,13 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/responsive_padding.dart';
|
||||
import 'package:invoiceninja_flutter/redux/auth/auth_actions.dart';
|
||||
import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class ErrorDialog extends StatelessWidget {
|
||||
const ErrorDialog(this.error, {this.clearErrorOnDismiss = false});
|
||||
|
||||
final Object error;
|
||||
final bool clearErrorOnDismiss;
|
||||
|
||||
|
|
@ -16,36 +17,28 @@ class ErrorDialog extends StatelessWidget {
|
|||
final localization = AppLocalization.of(context);
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
|
||||
return ResponsivePadding(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Material(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(28.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(localization.anErrorOccurred,
|
||||
style: Theme.of(context).textTheme.headline6),
|
||||
SizedBox(height: 20.0),
|
||||
Text(error.toString()),
|
||||
SizedBox(height: 40.0),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (clearErrorOnDismiss) {
|
||||
store.dispatch(ClearLastError());
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
label: localization.dismiss,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
],
|
||||
),
|
||||
return AlertDialog(
|
||||
title: Text(localization.anErrorOccurred),
|
||||
content: Text(error.toString()),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text(localization.logout.toUpperCase()),
|
||||
onPressed: () {
|
||||
confirmCallback(
|
||||
context: context,
|
||||
callback: () {
|
||||
store.dispatch(UserLogout(context));
|
||||
});
|
||||
}),
|
||||
FlatButton(
|
||||
child: Text(localization.dismiss.toUpperCase()),
|
||||
onPressed: () {
|
||||
if (clearErrorOnDismiss) {
|
||||
store.dispatch(ClearLastError());
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -579,8 +579,8 @@ class SidebarFooter extends StatelessWidget {
|
|||
onPressed: () => viewPdf(InvoiceEntity(), context),
|
||||
),
|
||||
*/
|
||||
if (state.lastError.isNotEmpty &&
|
||||
(state.isSelfHosted || !kReleaseMode))
|
||||
//if (state.lastError.isNotEmpty && (state.isSelfHosted || !kReleaseMode))
|
||||
if (state.lastError.isNotEmpty)
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.warning,
|
||||
|
|
|
|||
Loading…
Reference in New Issue