From 630758e11aa6fa9b39fd13bf3c4c6060e09cfc53 Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 14 Oct 2021 17:14:21 +0700 Subject: [PATCH] TF-170 [BUG] Fix selected mailbox is not display when open mailboxView --- .../presentation/views/list/tree_view.dart | 1 + .../mailbox/presentation/mailbox_view.dart | 52 +++++++------------ 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/core/lib/presentation/views/list/tree_view.dart b/core/lib/presentation/views/list/tree_view.dart index 9cd5bf7be..84e41e675 100644 --- a/core/lib/presentation/views/list/tree_view.dart +++ b/core/lib/presentation/views/list/tree_view.dart @@ -40,6 +40,7 @@ class _TreeViewData extends StatelessWidget { @override Widget build(BuildContext context) { return ListView.builder( + key: PageStorageKey('tree_view'), shrinkWrap: true, primary: false, itemCount: children.length, diff --git a/lib/features/mailbox/presentation/mailbox_view.dart b/lib/features/mailbox/presentation/mailbox_view.dart index d07d8d00a..f246beb32 100644 --- a/lib/features/mailbox/presentation/mailbox_view.dart +++ b/lib/features/mailbox/presentation/mailbox_view.dart @@ -22,38 +22,26 @@ class MailboxView extends GetWidget { Widget build(BuildContext context) { return Drawer( child: Scaffold( - resizeToAvoidBottomInset: false, backgroundColor: AppColor.primaryLightColor, - body: GestureDetector( - onTap: () => FocusScope.of(context).unfocus(), - child: SafeArea( - right: false, - left: false, - child: RefreshIndicator( - color: AppColor.primaryColor, - onRefresh: () async => controller.refreshAllMailbox(), - child: SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - child: Padding( - padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildHeaderMailbox(context), - // _buildSearchFormWidget(context), - _buildLoadingView(), - _buildListMailbox(context) - ] - ) - ) - ) - ) + body: SafeArea( + child: Container( + alignment: Alignment.center, + margin: EdgeInsets.symmetric(vertical: 24), + child: Column( + children: [ + _buildHeaderMailbox(context), + // _buildSearchFormWidget(context), + SizedBox(height: 16), + Divider(color: AppColor.dividerColor, height: 1), + _buildLoadingView(), + Expanded(child: RefreshIndicator( + color: AppColor.primaryColor, + onRefresh: () async => controller.refreshAllMailbox(), + child: _buildListMailbox(context))) + ] ) - )), + ) + ), // bottomNavigationBar: responsiveUtils.isMobile(context) ? _buildStorageWidget(context) : null ) ); @@ -119,7 +107,7 @@ class MailboxView extends GetWidget { Widget _buildListMailbox(BuildContext context) { return ListView( - key: Key('mailbox_list'), + key: PageStorageKey('mailbox_list'), primary: false, shrinkWrap: true, children: [ @@ -154,7 +142,7 @@ class MailboxView extends GetWidget { Widget _buildDefaultMailbox(BuildContext context, List defaultMailbox) { return ListView.builder( padding: EdgeInsets.only(top: 16, left: 16, right: 16), - key: Key('default_mailbox_list'), + key: PageStorageKey('default_mailbox_list'), itemCount: defaultMailbox.length, shrinkWrap: true, primary: false,