From 7562f391cc4329ccfefbf1d33fce6d5064f275f1 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Mon, 23 Sep 2019 16:10:46 +0800 Subject: [PATCH] fix: hide language bar if no data --- lib/screens/repo.dart | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/screens/repo.dart b/lib/screens/repo.dart index 9d21faf..20057cf 100644 --- a/lib/screens/repo.dart +++ b/lib/screens/repo.dart @@ -199,25 +199,26 @@ class RepoScreen extends StatelessWidget { ], ), borderView1, - Container( - padding: const EdgeInsets.all(_languageBarPadding), - child: ClipRRect( - borderRadius: BorderRadius.circular(2), - child: SizedBox( - height: 10, - child: Row( - children: join( - SizedBox(width: 1), - (payload['languages']['edges'] as List) - .map((lang) => Container( - color: convertColor(lang['node']['color']), - width: langWidth * - lang['size'] / - payload['languages']['totalSize'])) - .toList())), + if ((payload['languages']['edges'] as List).isNotEmpty) + Container( + padding: const EdgeInsets.all(_languageBarPadding), + child: ClipRRect( + borderRadius: BorderRadius.circular(2), + child: SizedBox( + height: 10, + child: Row( + children: join( + SizedBox(width: 1), + (payload['languages']['edges'] as List) + .map((lang) => Container( + color: convertColor(lang['node']['color']), + width: langWidth * + lang['size'] / + payload['languages']['totalSize'])) + .toList())), + ), ), ), - ), TableView( hasIcon: true, items: [