From 490bc0f5972951488ed0bd1c120cfea025596b4e Mon Sep 17 00:00:00 2001 From: jyuesong <425698907@qq.com> Date: Mon, 24 Jan 2022 14:59:35 +0800 Subject: [PATCH] Update login_page.dart --- lib/module/login/login_page.dart | 54 +++++++++++++++++--------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/lib/module/login/login_page.dart b/lib/module/login/login_page.dart index eb325d3..e3f1cd0 100644 --- a/lib/module/login/login_page.dart +++ b/lib/module/login/login_page.dart @@ -371,35 +371,37 @@ class _LoginPageState extends ConsumerState { ), Positioned( bottom: 10, - child: SizedBox( - width: MediaQuery.of(context).size.width, - child: Center( - child: Material( - color: Colors.transparent, - child: PopupMenuButton( - onSelected: (UserInfoBean result) { - selected(result); - }, - itemBuilder: (BuildContext context) => >[ - ...getIt() - .historyAccounts - .map((e) => PopupMenuItem( - value: e, - child: buildCell(e), - )) - .toList(), - ], - child: Text( - "切换账号", - style: TextStyle( - color: ref.watch(themeProvider).primaryColor, - fontSize: 14, + child: (getIt().historyAccounts.isEmpty) + ? const SizedBox.shrink() + : SizedBox( + width: MediaQuery.of(context).size.width, + child: Center( + child: Material( + color: Colors.transparent, + child: PopupMenuButton( + onSelected: (UserInfoBean result) { + selected(result); + }, + itemBuilder: (BuildContext context) => >[ + ...getIt() + .historyAccounts + .map((e) => PopupMenuItem( + value: e, + child: buildCell(e), + )) + .toList(), + ], + child: Text( + "切换账号", + style: TextStyle( + color: ref.watch(themeProvider).primaryColor, + fontSize: 14, + ), + ), + ), ), ), ), - ), - ), - ), ), ], ),