Add company

This commit is contained in:
Hillel Coren 2020-02-09 16:42:19 +02:00
parent bbfcd8a412
commit 0f20973efc
2 changed files with 22 additions and 5 deletions

View File

@ -72,7 +72,7 @@ class MenuDrawer extends StatelessWidget {
children: <Widget>[
Text(
company.displayName,
style: Theme.of(context).textTheme.headline5,
style: Theme.of(context).textTheme.headline6,
overflow: TextOverflow.ellipsis,
),
Text(viewModel.user.email,
@ -112,10 +112,24 @@ class MenuDrawer extends StatelessWidget {
value: (viewModel.companies.indexOf(company)).toString(),
child: _companyListItem(company),
))
.toList(),
.toList()..add(DropdownMenuItem<String>(
value: null,
child: Row(
children: <Widget>[
SizedBox(width: 2),
Icon(Icons.add_circle, size: 32),
SizedBox(width: 28),
Text(localization.addCompany),
],
),
)),
onChanged: (value) {
viewModel.onCompanyChanged(
context, value, viewModel.companies[int.parse(value)]);
if (value == null) {
print('## ADD COMPANY.. ##');
} else {
viewModel.onCompanyChanged(
context, value, viewModel.companies[int.parse(value)]);
}
},
));

View File

@ -14,6 +14,7 @@ abstract class LocaleCodeAware {
mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
'add_company': 'Add Company',
'to_learn_about_gogle_fonts': 'to learn about Google Fonts',
'unpaid_invoice': 'Unpaid Invoice',
'paid_invoice': 'Paid Invoice',
@ -14137,7 +14138,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get clickHere => _localizedValues[localeCode]['click_here'];
String get clickHereCapital => _localizedValues[localeCode]['click_here_capital'];
String get clickHereCapital =>
_localizedValues[localeCode]['click_here_capital'];
String get toRateIt => _localizedValues[localeCode]['to_rate_it'];
@ -15971,6 +15973,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get toLearnAboutGoogleFonts =>
_localizedValues[localeCode]['to_learn_about_gogle_fonts'];
String get addCompany => _localizedValues[localeCode]['add_company'];
String lookup(String key) {
final lookupKey = toSnakeCase(key);