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();
|
return Container();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _companyLogo(CompanyEntity company) => company
|
Widget _companyLogo(CompanyEntity company) {
|
||||||
.settings.companyLogo !=
|
if (company.settings.companyLogo != null &&
|
||||||
null &&
|
company.settings.companyLogo.isNotEmpty) {
|
||||||
company.settings.companyLogo.isNotEmpty
|
if (state.isHosted && kIsWeb) {
|
||||||
? CachedImage(
|
// Fix for CORS error using 'object' subdomain
|
||||||
|
return CachedImage(
|
||||||
width: MenuDrawer.LOGO_WIDTH,
|
width: MenuDrawer.LOGO_WIDTH,
|
||||||
url: state.credentials.url + '/companies/' + company.id + '/logo',
|
url: state.credentials.url + '/companies/' + company.id + '/logo',
|
||||||
apiToken: state.userCompanyStates
|
apiToken: state.userCompanyStates
|
||||||
|
|
@ -93,8 +94,18 @@ class _MenuDrawerState extends State<MenuDrawer> {
|
||||||
userCompanyState.company.id == company.id)
|
userCompanyState.company.id == company.id)
|
||||||
.token
|
.token
|
||||||
.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(
|
Widget _companyListItem(
|
||||||
CompanyEntity company, {
|
CompanyEntity company, {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// Flutter imports:
|
// Flutter imports:
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
|
|
@ -572,14 +573,20 @@ class _CompanyDetailsState extends State<CompanyDetails>
|
||||||
if ('${settings.companyLogo ?? ''}'.isNotEmpty)
|
if ('${settings.companyLogo ?? ''}'.isNotEmpty)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||||
child: CachedImage(
|
// Fix for CORS error using 'object' subdomain
|
||||||
width: double.infinity,
|
child: (state.isHosted && kIsWeb)
|
||||||
url: state.credentials.url +
|
? CachedImage(
|
||||||
'/companies/' +
|
width: double.infinity,
|
||||||
company.id +
|
url: state.credentials.url +
|
||||||
'/logo',
|
'/companies/' +
|
||||||
apiToken: state.userCompany.token.token,
|
company.id +
|
||||||
)),
|
'/logo',
|
||||||
|
apiToken: state.userCompany.token.token,
|
||||||
|
)
|
||||||
|
: CachedImage(
|
||||||
|
width: double.infinity,
|
||||||
|
url: company.settings.companyLogo,
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue