diff --git a/lib/ui/app/app_drawer.dart b/lib/ui/app/app_drawer.dart index cc0ff64ec..767370767 100644 --- a/lib/ui/app/app_drawer.dart +++ b/lib/ui/app/app_drawer.dart @@ -11,6 +11,7 @@ import 'package:invoiceninja/ui/dashboard/dashboard_screen.dart'; import 'package:invoiceninja/ui/product/product_screen.dart'; import 'package:invoiceninja/utils/localization.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:cached_network_image/cached_network_image.dart'; class AppDrawer extends StatelessWidget { final AppDrawerVM viewModel; @@ -37,12 +38,13 @@ class AppDrawer extends StatelessWidget { child: new DropdownButton( isDense: true, value: viewModel.selectedCompanyIndex, - items: viewModel.companies.map((CompanyEntity company) => - DropdownMenuItem( - value: (viewModel.companies.indexOf(company) + 1).toString(), - child: Text(company.name), - ) - ).toList(), + items: viewModel.companies + .map((CompanyEntity company) => DropdownMenuItem( + value: + (viewModel.companies.indexOf(company) + 1).toString(), + child: Text(company.name), + )) + .toList(), onChanged: (value) { viewModel.onCompanyChanged(context, value); }, @@ -59,13 +61,21 @@ class AppDrawer extends StatelessWidget { children: [ Expanded( 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( height: 18.0, ), - viewModel.companies.length > 1 ? _multipleCompanies : _singleCompany, + viewModel.companies.length > 1 + ? _multipleCompanies + : _singleCompany, ], )), color: Colors.white10, @@ -92,7 +102,9 @@ class AppDrawer extends StatelessWidget { leading: Icon(FontAwesomeIcons.cube, size: 22.0), title: Text(AppLocalization.of(context).products), onTap: () { - StoreProvider.of(context).dispatch(SearchProducts(null)); + StoreProvider + .of(context) + .dispatch(SearchProducts(null)); Navigator.of(context).pushReplacementNamed(ProductScreen.route); }, ), @@ -113,7 +125,11 @@ class AppDrawer extends StatelessWidget { ), AboutListTile( 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, icon: Icon(FontAwesomeIcons.info, size: 22.0), ), diff --git a/pubspec.lock b/pubspec.lock index 59b659625..9adb935bc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -85,6 +85,13 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: transitive description: @@ -160,6 +167,13 @@ packages: description: flutter source: sdk 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: dependency: "direct dev" description: flutter @@ -495,6 +509,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.0+1" term_glyph: dependency: transitive description: @@ -530,6 +551,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.0+4" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.3" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e5713e6b0..6d350ef03 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,6 +20,7 @@ dependencies: built_collection: "^3.1.1" memoize: "^1.4.0" url_launcher: "^3.0.2" + cached_network_image: "^0.4.1" dev_dependencies: flutter_driver: