Update buttons types

This commit is contained in:
Hillel Coren 2021-02-09 11:45:10 +02:00
parent c4d059579d
commit 67ef9c152c
41 changed files with 97 additions and 97 deletions

View File

@ -442,7 +442,7 @@ Future handleCreditAction(
context: context,
message: localization.clientEmailNotSet,
secondaryActions: [
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
editEntity(

View File

@ -548,7 +548,7 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
context: context,
message: localization.clientEmailNotSet,
secondaryActions: [
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
editEntity(

View File

@ -466,7 +466,7 @@ Future handleQuoteAction(
context: context,
message: localization.clientEmailNotSet,
secondaryActions: [
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
editEntity(

View File

@ -484,7 +484,7 @@ class _AppBottomBarState extends State<AppBottomBar> {
if (!state.prefState.isMenuFloated) Spacer(),
if (!widget.entityType.isSetting && !isList)
if (state.prefState.isDesktop)
FlatButton(
TextButton(
onPressed: _onColumnsPressed,
child: Text(
localization.columns,

View File

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
class ActionFlatButton extends StatelessWidget {
const ActionFlatButton({
class ActionTextButton extends StatelessWidget {
const ActionTextButton({
this.onPressed,
this.tooltip,
this.isSaving = false,
@ -45,7 +45,7 @@ class ActionFlatButton extends StatelessWidget {
);
}
return FlatButton(
return TextButton(
child: Text(
tooltip,
style: isHeader && onPressed != null

View File

@ -21,7 +21,7 @@ class EditIconButton extends StatelessWidget {
return Container();
}
return FlatButton(
return TextButton(
child: Text(
localization.edit,
style: TextStyle(color: store.state.headerTextColor),

View File

@ -71,7 +71,7 @@ class _ChangeLayoutBannerState extends State<ChangeLayoutBanner> {
text: message,
),
),
FlatButton(
TextButton(
child: Text(
localization.dismiss,
style: TextStyle(color: Colors.white),
@ -80,7 +80,7 @@ class _ChangeLayoutBannerState extends State<ChangeLayoutBanner> {
setState(() => _dismissedChange = true);
},
),
FlatButton(
TextButton(
child: Text(
localization.change,
style: TextStyle(color: Colors.white),

View File

@ -12,7 +12,7 @@ class MessageDialog extends StatelessWidget {
final String message;
final String dismissLabel;
final List<FlatButton> secondaryActions;
final List<TextButton> secondaryActions;
final Function onDismiss;
final Function onDiscard;
@ -42,7 +42,7 @@ class MessageDialog extends StatelessWidget {
if (onDiscard != null)
Padding(
padding: const EdgeInsets.only(right: 10),
child: FlatButton(
child: TextButton(
autofocus: true,
child: Text(
localization.discardChanges.toUpperCase()),
@ -60,7 +60,7 @@ class MessageDialog extends StatelessWidget {
))
.toList(),
),
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
if (onDismiss != null) {

View File

@ -29,7 +29,7 @@ class ErrorDialog extends StatelessWidget {
content: error != null ? SelectableText(errorStr.toString()) : SizedBox(),
actions: [
if (clearErrorOnDismiss && !Config.DEMO_MODE)
FlatButton(
TextButton(
child: Text(localization.logout.toUpperCase()),
onPressed: () {
confirmCallback(
@ -38,12 +38,12 @@ class ErrorDialog extends StatelessWidget {
store.dispatch(UserLogout(context));
});
}),
FlatButton(
TextButton(
child: Text(localization.copy.toUpperCase()),
onPressed: () {
Clipboard.setData(ClipboardData(text: errorStr));
}),
FlatButton(
TextButton(
child: Text(localization.dismiss.toUpperCase()),
onPressed: () {
if (clearErrorOnDismiss) {

View File

@ -152,15 +152,15 @@ class _HealthCheckDialogState extends State<HealthCheckDialog> {
actions: _response == null
? []
: [
FlatButton(
TextButton(
child: Text(localization.clearCache.toUpperCase()),
onPressed: () => clearCache(),
),
FlatButton(
TextButton(
child: Text(localization.refresh.toUpperCase()),
onPressed: () => runCheck(),
),
FlatButton(
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
)

View File

@ -206,7 +206,7 @@ class MultiSelectListState extends State<MultiSelectList> {
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
TextButton(
child: Text(localization.reset.toUpperCase()),
onPressed: () {
setState(
@ -228,7 +228,7 @@ class MultiSelectListState extends State<MultiSelectList> {
title: Text(localization.editColumns),
content: column,
actions: [
FlatButton(
TextButton(
child: Text(localization.reset.toUpperCase()),
onPressed: () {
setState(() => selected = widget.defaultSelected.toList());
@ -236,12 +236,12 @@ class MultiSelectListState extends State<MultiSelectList> {
widget.onSelected(selected);
}
}),
FlatButton(
TextButton(
child: Text(localization.cancel.toUpperCase()),
onPressed: () {
Navigator.pop(context);
}),
FlatButton(
TextButton(
child: Text(localization.save.toUpperCase()),
onPressed: () {
Navigator.pop(context);

View File

@ -149,14 +149,14 @@ class DocumentTile extends StatelessWidget {
title: Text(document.name),
actions: [
isFromExpense && onViewExpense != null
? FlatButton(
? TextButton(
child: Text(localization.expense.toUpperCase()),
onPressed: () {
Navigator.of(context).pop();
onViewExpense(document);
},
)
: FlatButton(
: TextButton(
child: Text(localization.delete.toUpperCase()),
onPressed: () {
confirmCallback(
@ -171,7 +171,7 @@ class DocumentTile extends StatelessWidget {
});
},
),
FlatButton(
TextButton(
child: Text(localization.download.toUpperCase()),
onPressed: () async {
final store = StoreProvider.of<AppState>(context);
@ -202,7 +202,7 @@ class DocumentTile extends StatelessWidget {
}
},
),
FlatButton(
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () {
Navigator.of(context).pop();

View File

@ -98,11 +98,11 @@ class _FormColorPickerState extends State<FormColorPicker> {
),
),
actions: <Widget>[
FlatButton(
TextButton(
child: Text(localization.cancel.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
),
FlatButton(
TextButton(
child: Text(localization.done.toUpperCase()),
onPressed: () {
_selectColor(_pendingColor);

View File

@ -27,7 +27,7 @@ class LearnMoreUrl extends StatelessWidget {
SizedBox(
width: 10,
),
FlatButton(
TextButton(
child: Text(localization.learnMore),
onPressed: () async {
if (await canLaunch(url)) {
@ -63,7 +63,7 @@ class LearnMoreDialog extends StatelessWidget {
SizedBox(
width: 10,
),
FlatButton(
TextButton(
child: Text(label ?? localization.learnMore),
onPressed: () {
showDialog<AlertDialog>(

View File

@ -34,7 +34,7 @@ class SaveCancelButtons extends StatelessWidget {
children: <Widget>[
if (onCancelPressed != null && !isSaving)
Builder(builder: (BuildContext context) {
return FlatButton(
return TextButton(
child: Text(
cancelLabel ?? localization.cancel,
style: isHeader && isEnabled
@ -48,7 +48,7 @@ class SaveCancelButtons extends StatelessWidget {
}),
SizedBox(width: 10),
Builder(builder: (BuildContext context) {
return ActionFlatButton(
return ActionTextButton(
tooltip: saveLabel ?? localization.save,
isVisible: true,
isSaving: isSaving,

View File

@ -99,7 +99,7 @@ class ListScaffold extends StatelessWidget {
actions: [
...appBarActions ?? <Widget>[],
if (isDesktop(context) && onCancelSettingsSection != null)
FlatButton(
TextButton(
onPressed: () {
store.dispatch(ViewSettings(
navigator: Navigator.of(context),

View File

@ -849,7 +849,7 @@ class _EntityFilter extends StatelessWidget {
)
: Row(
children: [
SizedBox(width: 4),
SizedBox(width: 8),
if (!state.prefState.showFilterSidebar)
IconButton(
tooltip: localization.showSidebar,
@ -860,10 +860,10 @@ class _EntityFilter extends StatelessWidget {
onPressed: () => store.dispatch(
UpdateUserPreferences(showFilterSidebar: true)),
),
SizedBox(width: 4),
ConstrainedBox(
constraints: BoxConstraints(maxWidth: 220),
child: FlatButton(
visualDensity: VisualDensity.compact,
child: TextButton(
child: Text(
EntityPresenter()
.initialize(filterEntity, context)
@ -887,9 +887,7 @@ class _EntityFilter extends StatelessWidget {
children: <Widget>[
for (int i = 0; i < relatedTypes.length; i++)
DecoratedBox(
child: FlatButton(
minWidth: 0,
visualDensity: VisualDensity.compact,
child: TextButton(
child: Text(
localization
.lookup('${relatedTypes[i].plural}'),

View File

@ -582,14 +582,14 @@ class SidebarFooter extends StatelessWidget {
context: context,
message: localization.cronsNotEnabled,
secondaryActions: [
FlatButton(
TextButton(
child: Text(localization.learnMore.toUpperCase()),
onPressed: () {
launch(kCronsHelpUrl,
forceSafariVC: false, forceWebView: false);
},
),
FlatButton(
TextButton(
child: Text(localization.refreshData.toUpperCase()),
onPressed: () {
store.dispatch(RefreshData());
@ -609,7 +609,7 @@ class SidebarFooter extends StatelessWidget {
context: context,
message: localization.companyDisabledWarning,
secondaryActions: [
FlatButton(
TextButton(
child: Text(localization.viewSettings.toUpperCase()),
onPressed: () {
store.dispatch(ViewSettings(
@ -699,7 +699,7 @@ class SidebarFooter extends StatelessWidget {
if (isHosted(context) &&
!isPaidAccount(context)) ...[
Spacer(),
FlatButton(
TextButton(
child: Text(localization.upgrade),
color: Colors.green,
onPressed: () => showDialog<UpgradeDialog>(
@ -857,7 +857,7 @@ void _showAbout(BuildContext context) async {
builder: (BuildContext context) {
return AlertDialog(
actions: [
FlatButton(
TextButton(
child: Text(localization.viewLicenses.toUpperCase()),
onPressed: () => showLicensePage(
context: context,
@ -867,7 +867,7 @@ void _showAbout(BuildContext context) async {
applicationVersion: state.appVersion,
),
),
FlatButton(
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
),
@ -938,7 +938,7 @@ void _showAbout(BuildContext context) async {
builder: (BuildContext context) {
return AlertDialog(
actions: [
FlatButton(
TextButton(
child:
Text(localization.sourceCode.toUpperCase()),
onPressed: () {
@ -947,7 +947,7 @@ void _showAbout(BuildContext context) async {
builder: (BuildContext context) {
return AlertDialog(
actions: [
FlatButton(
TextButton(
child: Text(localization.close
.toUpperCase()),
onPressed: () =>
@ -990,7 +990,7 @@ void _showAbout(BuildContext context) async {
);
},
),
FlatButton(
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
),
@ -1120,12 +1120,12 @@ class _ContactUsDialogState extends State<ContactUsDialog> {
child: CircularProgressIndicator(),
),
if (!_isSaving)
FlatButton(
TextButton(
child: Text(localization.cancel.toUpperCase()),
onPressed: () => Navigator.pop(context),
),
if (!_isSaving)
FlatButton(
TextButton(
child: Text(localization.send.toUpperCase()),
onPressed: () => _sendMessage(),
),

View File

@ -104,7 +104,7 @@ class AppPaginatedDataTable extends StatefulWidget {
/// The table card's header.
///
/// This is typically a [Text] widget, but can also be a [ButtonBar] with
/// [FlatButton]s. Suitable defaults are automatically provided for the font,
/// [TextButton]s. Suitable defaults are automatically provided for the font,
/// button color, button padding, and so forth.
///
/// If items in the table are selectable, then, when the selection is not

View File

@ -154,7 +154,7 @@ class DatatableHeader extends StatelessWidget {
return Row(
children: <Widget>[
FlatButton(
TextButton(
child: Text(localization.refresh),
onPressed: onRefreshPressed,
),

View File

@ -200,11 +200,11 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FlatButton(
TextButton(
child: Text('Terms', style: TextStyle(fontSize: 12)),
onPressed: () => launch(kTermsOfServiceURL),
),
FlatButton(
TextButton(
child: Text('Privacy', style: TextStyle(fontSize: 12)),
onPressed: () => launch(kPrivacyPolicyURL),
),

View File

@ -209,7 +209,7 @@ class _VariableGrid extends StatelessWidget {
childAspectRatio: 4,
children: fields
.map(
(field) => FlatButton(
(field) => TextButton(
child: Align(
alignment: Alignment.centerLeft,
child: Text(

View File

@ -83,7 +83,7 @@ class ViewScaffold extends StatelessWidget {
? []
: [
if (isSettings && isDesktop(context))
FlatButton(
TextButton(
onPressed: () {
onBackPressed != null
? onBackPressed()

View File

@ -188,7 +188,7 @@ class _LoginState extends State<LoginView> {
actions: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 8),
child: FlatButton(
child: TextButton(
child: Text(AppLocalization.of(context).close),
onPressed: () => Navigator.of(context).pop(),
),
@ -575,7 +575,7 @@ class _LoginState extends State<LoginView> {
children: <Widget>[
if (!_recoverPassword)
Icon(MdiIcons.lock, size: 16),
FlatButton(
TextButton(
child: Text(_recoverPassword
? localization.cancel
: localization.recoverPassword),

View File

@ -371,7 +371,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
? AlertDialog(
content: SingleChildScrollView(child: column),
actions: [
FlatButton(
TextButton(
child: Text(localization.remove.toUpperCase()),
onPressed: () => confirmCallback(
context: context,
@ -380,7 +380,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
Navigator.pop(context);
}),
),
FlatButton(
TextButton(
child: Text(localization.done.toUpperCase()),
onPressed: () => _onDoneContactPressed(),
)

View File

@ -53,7 +53,7 @@ class CompanyGatewayListItem extends StatelessWidget {
onTap: () => selectEntity(entity: companyGateway, context: context),
trailing: onRemovePressed == null
? null
: FlatButton(
: TextButton(
child: Text(AppLocalization.of(context).remove),
onPressed: onRemovePressed,
),

View File

@ -66,7 +66,7 @@ class CompanyGatewayScreen extends StatelessWidget {
)
else if (state.uiState.settingsUIState.isFiltered &&
!state.isSaving) ...[
FlatButton(
TextButton(
child: Text(localization.reset,
style: TextStyle(color: store.state.headerTextColor)),
onPressed: () {

View File

@ -187,7 +187,7 @@ class DashboardPanels extends StatelessWidget {
key: ValueKey(
'__${settings.includeTaxes}_${settings.currencyId}__'),
actions: [
FlatButton(
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
)

View File

@ -234,7 +234,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
return AlertDialog(
actions: [
FlatButton(
TextButton(
child: Text(localization.remove.toUpperCase()),
onPressed: () => confirmCallback(
context: context,
@ -243,7 +243,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
Navigator.of(context).pop();
}),
),
FlatButton(
TextButton(
child: Text(localization.done.toUpperCase()),
onPressed: () {
viewModel.clearSelectedInvoiceItem();

View File

@ -222,7 +222,7 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
if (isDesktop(context) &&
_activityId == null &&
!invoice.isRecurring)
FlatButton(
TextButton(
child: Text(localization.email,
style: TextStyle(color: state.headerTextColor)),
onPressed: () {
@ -230,7 +230,7 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
EntityAction.emailEntityType(invoice.entityType));
},
),
FlatButton(
TextButton(
child: Text(
localization.download,
style: TextStyle(color: state.headerTextColor),
@ -255,7 +255,7 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
},
),
if (isDesktop(context))
FlatButton(
TextButton(
child: Text(localization.close,
style: TextStyle(color: state.headerTextColor)),
onPressed: () {

View File

@ -305,11 +305,11 @@ class _PaymentEditState extends State<PaymentEdit> {
),
)
else ...[
FlatButton(
TextButton(
child: Text(localization.cancel.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
),
FlatButton(
TextButton(
child: Text(localization.apply.toUpperCase()),
onPressed: () => onSavePressed(context),
),

View File

@ -212,11 +212,11 @@ class _PaymentRefundState extends State<PaymentRefund> {
),
)
else ...[
FlatButton(
TextButton(
child: Text(localization.cancel.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
),
FlatButton(
TextButton(
child: Text(localization.refund.toUpperCase()),
onPressed: () => onSavePressed(context),
),

View File

@ -206,7 +206,7 @@ class ReportsScreen extends StatelessWidget {
actions: <Widget>[
if (isDesktop(context)) ...[
Builder(builder: (BuildContext context) {
return FlatButton(
return TextButton(
child: Text(
localization.columns,
style: TextStyle(color: store.state.headerTextColor),
@ -224,7 +224,7 @@ class ReportsScreen extends StatelessWidget {
},
);
}),
FlatButton(
TextButton(
child: Text(
localization.export,
style: TextStyle(color: store.state.headerTextColor),

View File

@ -268,7 +268,7 @@ class _LocalizationSettingsState extends State<LocalizationSettings>
),
),
SizedBox(width: 8),
FlatButton(
TextButton(
child: Text(localization.addCustom),
onPressed: () {
fieldCallback(
@ -280,7 +280,7 @@ class _LocalizationSettingsState extends State<LocalizationSettings>
field: localization.label,
title: localization.addCustom,
secondaryActions: [
FlatButton(
TextButton(
child:
Text(localization.labels.toUpperCase()),
onPressed: () => launch(kGitHubLangUrl),

View File

@ -187,7 +187,7 @@ class _SettingsWizardState extends State<SettingsWizard> {
),
),
actions: [
FlatButton(
TextButton(
onPressed: _onSavePressed,
child: Text(localization.save.toUpperCase()))
],

View File

@ -87,27 +87,27 @@ class _UpdateDialogState extends State<UpdateDialog> {
),
actions: <Widget>[
if (updateState == UpdateState.initial) ...[
FlatButton(
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () {
Navigator.of(context).pop();
},
),
if (!account.isUpdateAvailable)
FlatButton(
TextButton(
child: Text(localization.viewChanges.toUpperCase()),
onPressed: () => launch(kGitHubDiffUrl.replaceFirst(
'VERSION', account.currentVersion)),
),
if (!account.isDocker)
FlatButton(
TextButton(
child: Text(localization.updateNow.toUpperCase()),
onPressed: () {
updateApp(context);
},
),
] else if (updateState == UpdateState.done)
FlatButton(
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () {
Navigator.of(context).pop();

View File

@ -181,14 +181,14 @@ class TimeEditDetailsState extends State<TimeEditDetails> {
),
),
actions: [
FlatButton(
TextButton(
child: Text(localization.remove.toUpperCase()),
onPressed: () {
widget.viewModel.onRemoveTaskTimePressed(widget.index);
Navigator.of(context).pop();
},
),
FlatButton(
TextButton(
child: Text(localization.done.toUpperCase()),
onPressed: () {
widget.viewModel.onDoneTaskTimePressed();

View File

@ -285,7 +285,7 @@ class VendorContactEditDetailsState extends State<VendorContactEditDetails> {
? AlertDialog(
content: SingleChildScrollView(child: column),
actions: [
FlatButton(
TextButton(
child: Text(localization.remove.toUpperCase()),
onPressed: () => confirmCallback(
context: context,
@ -294,7 +294,7 @@ class VendorContactEditDetailsState extends State<VendorContactEditDetails> {
Navigator.pop(context);
}),
),
FlatButton(
TextButton(
child: Text(localization.done.toUpperCase()),
onPressed: () {
viewModel.onDoneContactPressed();

View File

@ -27,7 +27,7 @@ void showErrorDialog({
void showMessageDialog({
@required BuildContext context,
@required String message,
List<FlatButton> secondaryActions,
List<TextButton> secondaryActions,
}) {
showDialog<MessageDialog>(
context: context,
@ -79,12 +79,12 @@ void confirmCallback({
? null
: Text(content),
actions: <Widget>[
FlatButton(
TextButton(
child: Text(localization.cancel.toUpperCase()),
onPressed: () {
Navigator.pop(context);
}),
FlatButton(
TextButton(
child: Text(localization.ok.toUpperCase()),
onPressed: () {
if (typeToConfirm == null ||
@ -192,7 +192,7 @@ void fieldCallback({
String field,
Function(String) callback,
int maxLength,
List<FlatButton> secondaryActions,
List<TextButton> secondaryActions,
}) {
showDialog<AlertDialog>(
context: context,
@ -222,7 +222,7 @@ class FieldConfirmation extends StatefulWidget {
final String title;
final String field;
final int maxLength;
final List<FlatButton> secondaryActions;
final List<TextButton> secondaryActions;
@override
_FieldConfirmationState createState() => _FieldConfirmationState();
@ -335,7 +335,7 @@ void cloneToDialog({
],
),
actions: [
FlatButton(
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
)

View File

@ -23,7 +23,8 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
static final GlobalKey<FormState> _formKey = GlobalKey<FormState>(debugLabel: '_appState');
static final GlobalKey<FormState> _formKey =
GlobalKey<FormState>(debugLabel: '_appState');
static final GlobalKey<ClientPageState> _clientKey =
GlobalKey<ClientPageState>();
@ -273,7 +274,7 @@ class ContactFormState extends State<ContactForm> {
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: FlatButton(
child: TextButton(
onPressed: () => widget.onRemovePressed(widget.key),
child: Text(
'Delete',

View File

@ -119,7 +119,8 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
static final GlobalKey<FormState> _formKey = GlobalKey<FormState>(debugLabel: '_appState');
static final GlobalKey<FormState> _formKey =
GlobalKey<FormState>(debugLabel: '_appState');
TabController _controller;
@ -327,7 +328,7 @@ class _ContactFormState extends State<ContactForm> {
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: FlatButton(
child: TextButton(
onPressed: () => store.dispatch(DeleteContact(widget.index)),
child: Text(
'Delete',