Fix for logo CORS issue
This commit is contained in:
parent
c36411668e
commit
516a7c1476
|
|
@ -87,7 +87,9 @@ class _MenuDrawerState extends State<MenuDrawer> {
|
|||
company.settings.companyLogo.isNotEmpty
|
||||
? CachedImage(
|
||||
width: MenuDrawer.LOGO_WIDTH,
|
||||
//url: state.credentials.url + '/companies/' + company.id + '/logo',
|
||||
url: company.settings.companyLogo,
|
||||
sendApiToken: true,
|
||||
)
|
||||
: Image.asset('assets/images/icon.png', width: MenuDrawer.LOGO_WIDTH);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,19 @@ import 'package:flutter_redux/flutter_redux.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
|
||||
class CachedImage extends StatelessWidget {
|
||||
const CachedImage(
|
||||
{this.url, this.width, this.height, this.showNinjaOnError = true});
|
||||
const CachedImage({
|
||||
this.url,
|
||||
this.width,
|
||||
this.height,
|
||||
this.showNinjaOnError = true,
|
||||
this.sendApiToken = false,
|
||||
});
|
||||
|
||||
final String url;
|
||||
final bool showNinjaOnError;
|
||||
final double width;
|
||||
final double height;
|
||||
final bool sendApiToken;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -39,6 +45,7 @@ class CachedImage extends StatelessWidget {
|
|||
height: height,
|
||||
key: ValueKey(url),
|
||||
fit: BoxFit.contain,
|
||||
headers: sendApiToken ? {'X-API-TOKEN': state.credentials.token} : null,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -50,6 +57,8 @@ class CachedImage extends StatelessWidget {
|
|||
placeholder: (context, url) => Center(child: CircularProgressIndicator()),
|
||||
errorWidget: (context, url, Object error) =>
|
||||
Image.asset('assets/images/icon.png', width: 32, height: 30),
|
||||
httpHeaders:
|
||||
sendApiToken ? {'X-API-TOKEN': state.credentials.token} : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -574,7 +574,9 @@ class _CompanyDetailsState extends State<CompanyDetails>
|
|||
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||
child: CachedImage(
|
||||
width: double.infinity,
|
||||
//url: state.credentials.url + '/companies/' + company.id + '/logo',
|
||||
url: settings.companyLogo,
|
||||
sendApiToken: true,
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue