Cache image files
This commit is contained in:
parent
567b8544c9
commit
9b352887c1
|
|
@ -11,6 +11,7 @@ import 'package:invoiceninja/ui/dashboard/dashboard_screen.dart';
|
||||||
import 'package:invoiceninja/ui/product/product_screen.dart';
|
import 'package:invoiceninja/ui/product/product_screen.dart';
|
||||||
import 'package:invoiceninja/utils/localization.dart';
|
import 'package:invoiceninja/utils/localization.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
|
||||||
class AppDrawer extends StatelessWidget {
|
class AppDrawer extends StatelessWidget {
|
||||||
final AppDrawerVM viewModel;
|
final AppDrawerVM viewModel;
|
||||||
|
|
@ -37,12 +38,13 @@ class AppDrawer extends StatelessWidget {
|
||||||
child: new DropdownButton<String>(
|
child: new DropdownButton<String>(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
value: viewModel.selectedCompanyIndex,
|
value: viewModel.selectedCompanyIndex,
|
||||||
items: viewModel.companies.map((CompanyEntity company) =>
|
items: viewModel.companies
|
||||||
DropdownMenuItem<String>(
|
.map((CompanyEntity company) => DropdownMenuItem<String>(
|
||||||
value: (viewModel.companies.indexOf(company) + 1).toString(),
|
value:
|
||||||
child: Text(company.name),
|
(viewModel.companies.indexOf(company) + 1).toString(),
|
||||||
)
|
child: Text(company.name),
|
||||||
).toList(),
|
))
|
||||||
|
.toList(),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
viewModel.onCompanyChanged(context, value);
|
viewModel.onCompanyChanged(context, value);
|
||||||
},
|
},
|
||||||
|
|
@ -59,13 +61,21 @@ class AppDrawer extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: viewModel.selectedCompany.logoUrl != null ? Image.network(viewModel.selectedCompany.logoUrl) : null
|
child: viewModel.selectedCompany.logoUrl != null
|
||||||
),
|
//? Image.network(viewModel.selectedCompany.logoUrl)
|
||||||
|
? CachedNetworkImage(
|
||||||
|
imageUrl: viewModel.selectedCompany.logoUrl,
|
||||||
|
placeholder: new CircularProgressIndicator(),
|
||||||
|
errorWidget: new Icon(Icons.error),
|
||||||
|
)
|
||||||
|
: null),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 18.0,
|
height: 18.0,
|
||||||
),
|
),
|
||||||
viewModel.companies.length > 1 ? _multipleCompanies : _singleCompany,
|
viewModel.companies.length > 1
|
||||||
|
? _multipleCompanies
|
||||||
|
: _singleCompany,
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
color: Colors.white10,
|
color: Colors.white10,
|
||||||
|
|
@ -92,7 +102,9 @@ class AppDrawer extends StatelessWidget {
|
||||||
leading: Icon(FontAwesomeIcons.cube, size: 22.0),
|
leading: Icon(FontAwesomeIcons.cube, size: 22.0),
|
||||||
title: Text(AppLocalization.of(context).products),
|
title: Text(AppLocalization.of(context).products),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
StoreProvider.of<AppState>(context).dispatch(SearchProducts(null));
|
StoreProvider
|
||||||
|
.of<AppState>(context)
|
||||||
|
.dispatch(SearchProducts(null));
|
||||||
Navigator.of(context).pushReplacementNamed(ProductScreen.route);
|
Navigator.of(context).pushReplacementNamed(ProductScreen.route);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
@ -113,7 +125,11 @@ class AppDrawer extends StatelessWidget {
|
||||||
),
|
),
|
||||||
AboutListTile(
|
AboutListTile(
|
||||||
applicationName: 'Invoice Ninja',
|
applicationName: 'Invoice Ninja',
|
||||||
applicationIcon: Image.asset('assets/images/logo.png', width: 40.0, height: 40.0,),
|
applicationIcon: Image.asset(
|
||||||
|
'assets/images/logo.png',
|
||||||
|
width: 40.0,
|
||||||
|
height: 40.0,
|
||||||
|
),
|
||||||
applicationVersion: 'v' + kAppVersion,
|
applicationVersion: 'v' + kAppVersion,
|
||||||
icon: Icon(FontAwesomeIcons.info, size: 22.0),
|
icon: Icon(FontAwesomeIcons.info, size: 22.0),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
28
pubspec.lock
28
pubspec.lock
|
|
@ -85,6 +85,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.4.5"
|
version: "5.4.5"
|
||||||
|
cached_network_image:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: cached_network_image
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.4.1+1"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -160,6 +167,13 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_cache_manager:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_cache_manager
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.1"
|
||||||
flutter_driver:
|
flutter_driver:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
|
@ -495,6 +509,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.0.2"
|
||||||
|
synchronized:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: synchronized
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.5.0+1"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -530,6 +551,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.0+4"
|
version: "0.9.0+4"
|
||||||
|
uuid:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: uuid
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.3"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ dependencies:
|
||||||
built_collection: "^3.1.1"
|
built_collection: "^3.1.1"
|
||||||
memoize: "^1.4.0"
|
memoize: "^1.4.0"
|
||||||
url_launcher: "^3.0.2"
|
url_launcher: "^3.0.2"
|
||||||
|
cached_network_image: "^0.4.1"
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_driver:
|
flutter_driver:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue