Add fallback for company logo URL change
This commit is contained in:
parent
0f9f66226f
commit
d69b9f62a9
|
|
@ -81,11 +81,12 @@ class _MenuDrawerState extends State<MenuDrawer> {
|
|||
return Container();
|
||||
}
|
||||
|
||||
Widget _companyLogo(CompanyEntity company) => company
|
||||
.settings.companyLogo !=
|
||||
null &&
|
||||
company.settings.companyLogo.isNotEmpty
|
||||
? CachedImage(
|
||||
Widget _companyLogo(CompanyEntity company) {
|
||||
if (company.settings.companyLogo != null &&
|
||||
company.settings.companyLogo.isNotEmpty) {
|
||||
if (state.isHosted && kIsWeb) {
|
||||
// Fix for CORS error using 'object' subdomain
|
||||
return CachedImage(
|
||||
width: MenuDrawer.LOGO_WIDTH,
|
||||
url: state.credentials.url + '/companies/' + company.id + '/logo',
|
||||
apiToken: state.userCompanyStates
|
||||
|
|
@ -93,8 +94,18 @@ class _MenuDrawerState extends State<MenuDrawer> {
|
|||
userCompanyState.company.id == company.id)
|
||||
.token
|
||||
.token,
|
||||
)
|
||||
: Image.asset('assets/images/icon.png', width: MenuDrawer.LOGO_WIDTH);
|
||||
);
|
||||
} else {
|
||||
return CachedImage(
|
||||
width: MenuDrawer.LOGO_WIDTH,
|
||||
url: company.settings.companyLogo,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Image.asset('assets/images/icon.png',
|
||||
width: MenuDrawer.LOGO_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _companyListItem(
|
||||
CompanyEntity company, {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// Flutter imports:
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
|
|
@ -572,14 +573,20 @@ class _CompanyDetailsState extends State<CompanyDetails>
|
|||
if ('${settings.companyLogo ?? ''}'.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||
child: CachedImage(
|
||||
width: double.infinity,
|
||||
url: state.credentials.url +
|
||||
'/companies/' +
|
||||
company.id +
|
||||
'/logo',
|
||||
apiToken: state.userCompany.token.token,
|
||||
)),
|
||||
// Fix for CORS error using 'object' subdomain
|
||||
child: (state.isHosted && kIsWeb)
|
||||
? CachedImage(
|
||||
width: double.infinity,
|
||||
url: state.credentials.url +
|
||||
'/companies/' +
|
||||
company.id +
|
||||
'/logo',
|
||||
apiToken: state.userCompany.token.token,
|
||||
)
|
||||
: CachedImage(
|
||||
width: double.infinity,
|
||||
url: company.settings.companyLogo,
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue