mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: share selectedindex
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -39,9 +39,11 @@ class SharePanel extends StatefulWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.content,
|
required this.content,
|
||||||
this.userList,
|
this.userList,
|
||||||
|
this.selectedIndex,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Map content;
|
final Map content;
|
||||||
|
final int? selectedIndex;
|
||||||
final List<UserModel>? userList;
|
final List<UserModel>? userList;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -68,6 +70,9 @@ class _SharePanelState extends State<SharePanel> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
if (widget.userList?.isNotEmpty == true) {
|
if (widget.userList?.isNotEmpty == true) {
|
||||||
_userList.addAll(widget.userList!);
|
_userList.addAll(widget.userList!);
|
||||||
|
if (widget.selectedIndex != null) {
|
||||||
|
_selectedIndex = widget.selectedIndex!;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class PageUtils {
|
|||||||
{required Map content}) async {
|
{required Map content}) async {
|
||||||
// debugPrint(content.toString());
|
// debugPrint(content.toString());
|
||||||
|
|
||||||
|
int? selectedIndex;
|
||||||
List<UserModel> userList = <UserModel>[];
|
List<UserModel> userList = <UserModel>[];
|
||||||
|
|
||||||
final shareListRes = await GrpcRepo.shareList(size: 3);
|
final shareListRes = await GrpcRepo.shareList(size: 3);
|
||||||
@@ -51,6 +52,7 @@ class PageUtils {
|
|||||||
transitionDuration: const Duration(milliseconds: 120),
|
transitionDuration: const Duration(milliseconds: 120),
|
||||||
);
|
);
|
||||||
if (userModel != null) {
|
if (userModel != null) {
|
||||||
|
selectedIndex = 0;
|
||||||
userList.add(userModel);
|
userList.add(userModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,6 +63,7 @@ class PageUtils {
|
|||||||
builder: (context) => SharePanel(
|
builder: (context) => SharePanel(
|
||||||
content: content,
|
content: content,
|
||||||
userList: userList,
|
userList: userList,
|
||||||
|
selectedIndex: selectedIndex,
|
||||||
),
|
),
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
enableDrag: false,
|
enableDrag: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user