From cfc66e436471fc6374d6724e5169447153936fb6 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Mon, 5 May 2025 00:45:16 +0800 Subject: [PATCH] fix: share selectedindex Signed-off-by: bggRGjQaUbCoE --- lib/pages/share/view.dart | 5 +++++ lib/utils/page_utils.dart | 3 +++ 2 files changed, 8 insertions(+) diff --git a/lib/pages/share/view.dart b/lib/pages/share/view.dart index 9106eca20..366d841d3 100644 --- a/lib/pages/share/view.dart +++ b/lib/pages/share/view.dart @@ -39,9 +39,11 @@ class SharePanel extends StatefulWidget { super.key, required this.content, this.userList, + this.selectedIndex, }); final Map content; + final int? selectedIndex; final List? userList; @override @@ -68,6 +70,9 @@ class _SharePanelState extends State { super.initState(); if (widget.userList?.isNotEmpty == true) { _userList.addAll(widget.userList!); + if (widget.selectedIndex != null) { + _selectedIndex = widget.selectedIndex!; + } } } diff --git a/lib/utils/page_utils.dart b/lib/utils/page_utils.dart index e38052768..51608faa4 100644 --- a/lib/utils/page_utils.dart +++ b/lib/utils/page_utils.dart @@ -32,6 +32,7 @@ class PageUtils { {required Map content}) async { // debugPrint(content.toString()); + int? selectedIndex; List userList = []; final shareListRes = await GrpcRepo.shareList(size: 3); @@ -51,6 +52,7 @@ class PageUtils { transitionDuration: const Duration(milliseconds: 120), ); if (userModel != null) { + selectedIndex = 0; userList.add(userModel); } } @@ -61,6 +63,7 @@ class PageUtils { builder: (context) => SharePanel( content: content, userList: userList, + selectedIndex: selectedIndex, ), useSafeArea: true, enableDrag: false,