Updated design
This commit is contained in:
parent
e0eb405e0c
commit
46fc7d747b
|
|
@ -6,16 +6,15 @@ import 'package:invoiceninja_flutter/constants.dart';
|
|||
class ListFilter extends StatefulWidget {
|
||||
const ListFilter({
|
||||
Key key,
|
||||
@required this.placeholder,
|
||||
@required this.filter,
|
||||
@required this.title,
|
||||
@required this.onFilterChanged,
|
||||
this.filterLabel,
|
||||
}) : super(key: key);
|
||||
|
||||
final String placeholder;
|
||||
final String filter;
|
||||
final String title;
|
||||
final Function(String) onFilterChanged;
|
||||
final String filterLabel;
|
||||
|
||||
|
||||
@override
|
||||
_ListFilterState createState() => new _ListFilterState();
|
||||
|
|
@ -45,32 +44,38 @@ class _ListFilterState extends State<ListFilter> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
final textColor = Theme.of(context).primaryTextTheme.bodyText1.color;
|
||||
final isFilterSet = (widget.filter ?? '').isNotEmpty;
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
height: 44,
|
||||
margin: EdgeInsets.only(bottom: 2.0),
|
||||
decoration: BoxDecoration(
|
||||
color: convertHexStringToColor(kDefaultBorderColor),
|
||||
color: isFilterSet
|
||||
? convertHexStringToColor(
|
||||
kDefaultBorderColor) // TODO set color here
|
||||
: convertHexStringToColor(kDefaultBorderColor),
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
),
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Padding(
|
||||
padding: EdgeInsets.only(right: 8.0),
|
||||
child: (widget.filter ?? '').isNotEmpty
|
||||
child: isFilterSet
|
||||
? IconButton(
|
||||
icon: Icon(Icons.clear),
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
color: textColor,
|
||||
),
|
||||
onPressed: () {
|
||||
widget.onFilterChanged(null);
|
||||
_filterController.text = '';
|
||||
},
|
||||
)
|
||||
: Icon(Icons.search,
|
||||
color: Theme.of(context).primaryTextTheme.bodyText1.color),
|
||||
: Icon(Icons.search, color: textColor),
|
||||
),
|
||||
border: InputBorder.none,
|
||||
hintText: widget.filterLabel ?? localization.filter,
|
||||
hintText: widget.placeholder ?? localization.search,
|
||||
),
|
||||
autocorrect: false,
|
||||
onChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class ClientScreen extends StatelessWidget {
|
|||
handleClientAction(context, clients, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.clients,
|
||||
placeholder: localization.searchClients,
|
||||
key: ValueKey(state.clientListState.filterClearedAt),
|
||||
filter: state.clientListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class CreditScreen extends StatelessWidget {
|
|||
handleCreditAction(context, credits, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.credits,
|
||||
placeholder: localization.searchCredits,
|
||||
key: ValueKey(state.creditListState.filterClearedAt),
|
||||
filter: state.creditListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -65,12 +65,11 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||
.dispatch(UserSettingsChanged(sidebar: AppSidebar.menu)),
|
||||
),
|
||||
title: ListFilter(
|
||||
title: AppLocalization.of(context).dashboard,
|
||||
placeholder: localization.searchCompany,
|
||||
filter: state.uiState.filter,
|
||||
onFilterChanged: (value) {
|
||||
store.dispatch(FilterCompany(value));
|
||||
},
|
||||
filterLabel: localization.search,
|
||||
),
|
||||
actions: [
|
||||
if (isMobile(context) || !state.prefState.isHistoryVisible)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class DesignScreen extends StatelessWidget {
|
|||
handleDesignAction(context, designs, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.designs,
|
||||
placeholder: localization.searchDesigns,
|
||||
key: ValueKey(state.designListState.filterClearedAt),
|
||||
filter: state.designListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class DocumentScreen extends StatelessWidget {
|
|||
context, documents, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.documents,
|
||||
placeholder: localization.searchDocuments,
|
||||
key: ValueKey(state.documentListState.filterClearedAt),
|
||||
filter: state.documentListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ExpenseScreen extends StatelessWidget {
|
|||
handleExpenseAction(context, expenses, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.expenses,
|
||||
placeholder: localization.searchExpenses,
|
||||
key: ValueKey(store.state.expenseListState.filterClearedAt),
|
||||
filter: state.expenseListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class GroupSettingsScreen extends StatelessWidget {
|
|||
},
|
||||
isSettings: true,
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.groups,
|
||||
placeholder: localization.searchGroups,
|
||||
key: ValueKey(state.groupListState.filterClearedAt),
|
||||
filter: state.groupListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class InvoiceScreen extends StatelessWidget {
|
|||
handleInvoiceAction(context, invoices, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.invoices,
|
||||
placeholder: localization.searchInvoices,
|
||||
key: ValueKey(store.state.invoiceListState.filterClearedAt),
|
||||
filter: state.invoiceListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class PaymentScreen extends StatelessWidget {
|
|||
handlePaymentAction(context, payments, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.payments,
|
||||
placeholder: localization.searchPayments,
|
||||
key: ValueKey(store.state.paymentListState.filterClearedAt),
|
||||
filter: state.paymentListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class ProductScreen extends StatelessWidget {
|
|||
handleProductAction(context, products, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.products,
|
||||
placeholder: localization.searchProducts,
|
||||
key: ValueKey(store.state.productListState.filterClearedAt),
|
||||
filter: state.productListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class ProjectScreen extends StatelessWidget {
|
|||
handleProjectAction(context, projects, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.projects,
|
||||
placeholder: localization.searchProjects,
|
||||
filter: state.projectListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
store.dispatch(FilterProjects(value));
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class QuoteScreen extends StatelessWidget {
|
|||
handleQuoteAction(context, quotes, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.quotes,
|
||||
placeholder: localization.searchQuotes,
|
||||
key: ValueKey(store.state.quoteListState.filterClearedAt),
|
||||
filter: state.quoteListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class SettingsScreen extends StatelessWidget {
|
|||
|
||||
return ListScaffold(
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.settings,
|
||||
placeholder: localization.searchSettings,
|
||||
key: ValueKey(state.settingsUIState.filterClearedAt),
|
||||
filter: state.settingsUIState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class TaskScreen extends StatelessWidget {
|
|||
handleTaskAction(context, tasks, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.tasks,
|
||||
placeholder: localization.searchTasks,
|
||||
key: ValueKey(store.state.taskListState.filterClearedAt),
|
||||
filter: state.taskListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class TaxRateSettingsScreen extends StatelessWidget {
|
|||
handleTaxRateAction(context, taxRates, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.taxRates,
|
||||
placeholder: localization.searchTaxRates,
|
||||
key: ValueKey(state.taxRateListState.filterClearedAt),
|
||||
filter: state.taxRateListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class UserScreen extends StatelessWidget {
|
|||
*/
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.userManagement,
|
||||
placeholder: localization.searchUsers,
|
||||
key: ValueKey(state.userListState.filterClearedAt),
|
||||
filter: state.userListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class VendorScreen extends StatelessWidget {
|
|||
handleVendorAction(context, vendors, EntityAction.toggleMultiselect);
|
||||
},
|
||||
appBarTitle: ListFilter(
|
||||
title: localization.vendors,
|
||||
placeholder: localization.searchVendors,
|
||||
key: ValueKey(store.state.vendorListState.filterClearedAt),
|
||||
filter: state.vendorListState.filter,
|
||||
onFilterChanged: (value) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,24 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'search_documents': 'Search Documents',
|
||||
'search_designs': 'Search Designs',
|
||||
'search_invoices': 'Search Invoices',
|
||||
'search_clients': 'Search Clients',
|
||||
'search_products': 'Search Products',
|
||||
'search_quotes': 'Search Quotes',
|
||||
'search_credits': 'Search Credits',
|
||||
'search_vendors': 'Search Vendors',
|
||||
'search_users': 'Search Users',
|
||||
'search_tax_rates': 'Search Tax Rates',
|
||||
'search_tasks': 'Search Tasks',
|
||||
'search_settings': 'Search Settings',
|
||||
'search_projects': 'Search Projects',
|
||||
'search_expenses': 'Search Expenses',
|
||||
'search_payments': 'Search Payments',
|
||||
'search_groups': 'Search Groups',
|
||||
'search_company': 'Search Company',
|
||||
|
||||
'refund_payment': 'Refund Payment',
|
||||
'cancelled_invoice': 'Successfully cancelled invoice',
|
||||
'cancelled_invoices': 'Successfully cancelled invoices',
|
||||
|
|
@ -36418,6 +36436,55 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
String get refundPayment =>
|
||||
_localizedValues[localeCode]['refund_payment'] ?? '';
|
||||
|
||||
String get searchInvoices =>
|
||||
_localizedValues[localeCode]['search_invoices'] ?? '';
|
||||
|
||||
String get searchClients =>
|
||||
_localizedValues[localeCode]['search_clients'] ?? '';
|
||||
|
||||
String get searchProducts =>
|
||||
_localizedValues[localeCode]['search_products'] ?? '';
|
||||
|
||||
String get searchQuotes =>
|
||||
_localizedValues[localeCode]['search_quotes'] ?? '';
|
||||
|
||||
String get searchCredits =>
|
||||
_localizedValues[localeCode]['search_credits'] ?? '';
|
||||
|
||||
String get searchVendors =>
|
||||
_localizedValues[localeCode]['search_vendors'] ?? '';
|
||||
|
||||
String get searchUsers => _localizedValues[localeCode]['search_users'] ?? '';
|
||||
|
||||
String get searchTaxRates =>
|
||||
_localizedValues[localeCode]['search_tax_rates'] ?? '';
|
||||
|
||||
String get searchTasks => _localizedValues[localeCode]['search_tasks'] ?? '';
|
||||
|
||||
String get searchSettings =>
|
||||
_localizedValues[localeCode]['search_settings'] ?? '';
|
||||
|
||||
String get searchProjects =>
|
||||
_localizedValues[localeCode]['search_projects'] ?? '';
|
||||
|
||||
String get searchExpenses =>
|
||||
_localizedValues[localeCode]['search_expenses'] ?? '';
|
||||
|
||||
String get searchPayments =>
|
||||
_localizedValues[localeCode]['search_payments'] ?? '';
|
||||
|
||||
String get searchGroups =>
|
||||
_localizedValues[localeCode]['search_groups'] ?? '';
|
||||
|
||||
String get searchCompany =>
|
||||
_localizedValues[localeCode]['search_company'] ?? '';
|
||||
|
||||
String get searchDocuments =>
|
||||
_localizedValues[localeCode]['search_documents'] ?? '';
|
||||
|
||||
String get searchDesigns =>
|
||||
_localizedValues[localeCode]['search_designs'] ?? '';
|
||||
|
||||
String lookup(String key) {
|
||||
final lookupKey = toSnakeCase(key);
|
||||
return _localizedValues[localeCode][lookupKey] ??
|
||||
|
|
|
|||
Loading…
Reference in New Issue