opt pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-31 11:22:11 +08:00
parent 132a7e15de
commit 4ac05caa28
14 changed files with 236 additions and 240 deletions

View File

@@ -15,6 +15,7 @@ import 'package:PiliPlus/models/pgc/pgc_rank/pgc_rank_item_model.dart';
import 'package:PiliPlus/models/pgc_lcf.dart';
import 'package:PiliPlus/models/play_info/data.dart';
import 'package:PiliPlus/models/triple/pgc_triple.dart';
import 'package:PiliPlus/models/triple/ugc_triple.dart';
import 'package:PiliPlus/models/user/fav_folder.dart';
import 'package:PiliPlus/models/video/ai.dart';
import 'package:PiliPlus/models/video/note_list/data.dart';
@@ -428,7 +429,7 @@ class VideoHttp {
),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
return {'status': true, 'data': UgcTriple.fromJson(res.data['data'])};
} else {
return {'status': false, 'msg': res.data['message']};
}

View File

@@ -141,39 +141,32 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
],
),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeLeft:
context.orientation == Orientation.landscape,
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
children: response.map((item) {
if (item.episodes!.isNullOrEmpty) {
return const SizedBox.shrink();
}
return ListView.builder(
physics:
const AlwaysScrollableScrollPhysics(),
scrollDirection: Axis.horizontal,
itemCount: item.episodes!.length,
itemBuilder: (context, index) {
return Container(
width: Grid.smallCardWidth / 2,
margin: EdgeInsets.only(
left: StyleString.safeSpace,
right:
index == item.episodes!.length - 1
? StyleString.safeSpace
: 0,
),
child: BangumiCardVTimeline(
item: item.episodes![index],
),
);
},
);
}).toList()),
),
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
children: response.map((item) {
if (item.episodes!.isNullOrEmpty) {
return const SizedBox.shrink();
}
return ListView.builder(
physics: const AlwaysScrollableScrollPhysics(),
scrollDirection: Axis.horizontal,
itemCount: item.episodes!.length,
itemBuilder: (context, index) {
return Container(
width: Grid.smallCardWidth / 2,
margin: EdgeInsets.only(
left: StyleString.safeSpace,
right: index == item.episodes!.length - 1
? StyleString.safeSpace
: 0,
),
child: BangumiCardVTimeline(
item: item.episodes![index],
),
);
},
);
}).toList()),
),
],
),
@@ -347,15 +340,11 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
? Column(
children: [
_buildFollowTitle(theme),
MediaQuery.removePadding(
context: context,
removeLeft: context.orientation == Orientation.landscape,
child: SizedBox(
height: Grid.smallCardWidth / 2 / 0.75 +
MediaQuery.textScalerOf(context).scale(50),
child: Obx(
() => _buildFollowBody(controller.followState.value),
),
SizedBox(
height: Grid.smallCardWidth / 2 / 0.75 +
MediaQuery.textScalerOf(context).scale(50),
child: Obx(
() => _buildFollowBody(controller.followState.value),
),
),
],

View File

@@ -227,7 +227,7 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
Widget? get customPanel => null;
Widget buildEmojiPickerPanel() {
double height = 170;
double height = context.isTablet ? 300 : 170;
final keyboardHeight = controller.keyboardHeight;
if (keyboardHeight != 0) {
height = max(height, keyboardHeight);

View File

@@ -46,13 +46,13 @@ class _ContactPageState extends State<ContactPage>
actions: [
IconButton(
onPressed: () async {
UserModel? userModel = await Get.dialog(
FollowSearchPage(
mid: mid,
isFromSelect: widget.isFromSelect,
UserModel? userModel = await Navigator.of(context).push(
GetPageRoute(
page: () => FollowSearchPage(
mid: mid,
isFromSelect: widget.isFromSelect,
),
),
useSafeArea: false,
transitionDuration: const Duration(milliseconds: 120),
);
if (userModel != null) {
Get.back(result: userModel);

View File

@@ -1,5 +1,3 @@
import 'package:PiliPlus/common/widgets/draggable_sheet/draggable_scrollable_sheet_dyn.dart'
show DraggableScrollableSheet;
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
import 'package:PiliPlus/models/common/dynamic/dynamics_type.dart';
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
@@ -42,21 +40,7 @@ class _DynamicsPageState extends State<DynamicsPage>
),
onPressed: () {
if (_dynamicsController.isLogin.value) {
showModalBottomSheet(
context: context,
useSafeArea: true,
isScrollControlled: true,
builder: (context) => DraggableScrollableSheet(
snap: true,
expand: false,
initialChildSize: 1,
minChildSize: 0,
maxChildSize: 1,
snapSizes: const [1],
builder: (context, scrollController) =>
CreateDynPanel(scrollController: scrollController),
),
);
CreateDynPanel.onCreateDyn(context);
}
},
icon: Icon(
@@ -130,6 +114,7 @@ class _DynamicsPageState extends State<DynamicsPage>
super.build(context);
ThemeData theme = Theme.of(context);
return Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
leading: upPanelPosition == UpPanelPosition.rightDrawer
? _createDynamicBtn(theme, false)

View File

@@ -3,8 +3,10 @@ import 'dart:math';
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
import 'package:PiliPlus/common/widgets/button/toolbar_icon_button.dart';
import 'package:PiliPlus/common/widgets/custom_icon.dart';
import 'package:PiliPlus/common/widgets/draggable_sheet/draggable_scrollable_sheet_dyn.dart'
as dyn_sheet;
import 'package:PiliPlus/common/widgets/draggable_sheet/draggable_scrollable_sheet_topic.dart'
show DraggableScrollableSheet;
as topic_sheet;
import 'package:PiliPlus/common/widgets/pair.dart';
import 'package:PiliPlus/http/dynamics.dart';
import 'package:PiliPlus/models/common/publish_panel_type.dart';
@@ -28,12 +30,33 @@ class CreateDynPanel extends CommonPublishPage {
super.key,
super.imageLengthLimit = 18,
this.scrollController,
this.topic,
});
final ScrollController? scrollController;
final Pair<int, String>? topic;
@override
State<CreateDynPanel> createState() => _CreateDynPanelState();
static void onCreateDyn(BuildContext context, {Pair<int, String>? topic}) =>
showModalBottomSheet(
context: context,
useSafeArea: true,
isScrollControlled: true,
builder: (context) => dyn_sheet.DraggableScrollableSheet(
snap: true,
expand: false,
initialChildSize: 1,
minChildSize: 0,
maxChildSize: 1,
snapSizes: const [1],
builder: (context, scrollController) => CreateDynPanel(
scrollController: scrollController,
topic: topic,
),
),
);
}
class _CreateDynPanelState extends CommonPublishPageState<CreateDynPanel> {
@@ -41,7 +64,13 @@ class _CreateDynPanelState extends CommonPublishPageState<CreateDynPanel> {
final Rx<DateTime?> _publishTime = Rx<DateTime?>(null);
final Rx<ReplyOptionType> _replyOption = ReplyOptionType.allow.obs;
final _titleEditCtr = TextEditingController();
Rx<Pair<int, String>?> topic = Rx<Pair<int, String>?>(null);
final Rx<Pair<int, String>?> topic = Rx<Pair<int, String>?>(null);
@override
void initState() {
super.initState();
topic.value = widget.topic;
}
@override
void dispose() {
@@ -598,7 +627,7 @@ class _CreateDynPanelState extends CommonPublishPageState<CreateDynPanel> {
constraints: BoxConstraints(
maxWidth: min(600, context.mediaQueryShortestSide),
),
builder: (context) => DraggableScrollableSheet(
builder: (context) => topic_sheet.DraggableScrollableSheet(
expand: false,
snap: true,
minChildSize: 0,

View File

@@ -1,14 +1,17 @@
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/widgets/custom_icon.dart';
import 'package:PiliPlus/common/widgets/custom_sliver_persistent_header_delegate.dart';
import 'package:PiliPlus/common/widgets/dynamic_sliver_appbar_medium.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
import 'package:PiliPlus/common/widgets/pair.dart';
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/common/image_type.dart';
import 'package:PiliPlus/models/dynamics/dyn_topic_feed/item.dart';
import 'package:PiliPlus/models/dynamics/dyn_topic_top/top_details.dart';
import 'package:PiliPlus/pages/dynamics/widgets/dynamic_panel.dart';
import 'package:PiliPlus/pages/dynamics_create/view.dart';
import 'package:PiliPlus/pages/dynamics_tab/view.dart';
import 'package:PiliPlus/pages/dynamics_topic/controller.dart';
import 'package:PiliPlus/utils/grid.dart';
@@ -39,6 +42,24 @@ class _DynTopicPageState extends State<DynTopicPage> {
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
return Scaffold(
resizeToAvoidBottomInset: false,
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
if (_controller.isLogin) {
CreateDynPanel.onCreateDyn(
context,
topic: Pair(
first: int.parse(_controller.topicId),
second: _controller.topicName,
),
);
} else {
SmartDialog.showToast('账号未登录');
}
},
icon: const Icon(CustomIcon.topic_tag, size: 20),
label: const Text('参与话题'),
),
body: SafeArea(
top: false,
bottom: false,

View File

@@ -31,49 +31,44 @@ class _HomePageState extends State<HomePage>
Widget build(BuildContext context) {
super.build(context);
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(toolbarHeight: 0),
body: Column(
children: [
if (!_homeController.useSideBar &&
context.orientation == Orientation.portrait)
customAppBar(theme),
if (_homeController.tabs.length > 1)
Material(
color: theme.colorScheme.surface,
child: Container(
height: 42,
padding: const EdgeInsets.only(top: 4),
child: TabBar(
controller: _homeController.tabController,
tabs: [
for (var i in _homeController.tabs) Tab(text: i.label)
],
isScrollable: true,
dividerColor: Colors.transparent,
dividerHeight: 0,
enableFeedback: true,
splashBorderRadius: StyleString.mdRadius,
tabAlignment: TabAlignment.center,
onTap: (value) {
feedBack();
if (!_homeController.tabController.indexIsChanging) {
_homeController.animateToTop();
}
},
),
return Column(
children: [
if (!_homeController.useSideBar &&
context.orientation == Orientation.portrait)
customAppBar(theme),
if (_homeController.tabs.length > 1)
Material(
color: theme.colorScheme.surface,
child: Container(
height: 42,
padding: const EdgeInsets.only(top: 4),
child: TabBar(
controller: _homeController.tabController,
tabs: [for (var i in _homeController.tabs) Tab(text: i.label)],
isScrollable: true,
dividerColor: Colors.transparent,
dividerHeight: 0,
enableFeedback: true,
splashBorderRadius: StyleString.mdRadius,
tabAlignment: TabAlignment.center,
onTap: (value) {
feedBack();
if (!_homeController.tabController.indexIsChanging) {
_homeController.animateToTop();
}
},
),
)
else
const SizedBox(height: 6),
Expanded(
child: tabBarView(
controller: _homeController.tabController,
children: _homeController.tabs.map((e) => e.page).toList(),
),
)
else
const SizedBox(height: 6),
Expanded(
child: tabBarView(
controller: _homeController.tabController,
children: _homeController.tabs.map((e) => e.page).toList(),
),
],
),
),
],
);
}

View File

@@ -43,9 +43,7 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
clipBehavior: Clip.hardEdge,
margin: const EdgeInsets.only(
left: StyleString.safeSpace, right: StyleString.safeSpace),
decoration: const BoxDecoration(
borderRadius: StyleString.mdRadius,
),
decoration: const BoxDecoration(borderRadius: StyleString.mdRadius),
child: refreshIndicator(
onRefresh: controller.onRefresh,
child: CustomScrollView(
@@ -275,58 +273,54 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
}
Widget _buildFollowBody(ThemeData theme, List<CardLiveItem> followList) {
return MediaQuery.removePadding(
context: context,
removeLeft: context.orientation == Orientation.landscape,
child: SelfSizedHorizontalList(
gapSize: 5,
childBuilder: (index) {
final item = followList[index];
return SizedBox(
width: 65,
child: GestureDetector(
onTap: () => Get.toNamed('/liveRoom?roomid=${item.roomid}'),
onLongPress: () {
Feedback.forLongPress(context);
Get.toNamed('/member?mid=${item.uid}');
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8),
Container(
margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
border: Border.all(
width: 1.5,
color: theme.colorScheme.primary,
strokeAlign: BorderSide.strokeAlignOutside,
),
shape: BoxShape.circle,
),
child: NetworkImgLayer(
type: ImageType.avatar,
width: 45,
height: 45,
src: item.face,
return SelfSizedHorizontalList(
gapSize: 5,
childBuilder: (index) {
final item = followList[index];
return SizedBox(
width: 65,
child: GestureDetector(
onTap: () => Get.toNamed('/liveRoom?roomid=${item.roomid}'),
onLongPress: () {
Feedback.forLongPress(context);
Get.toNamed('/member?mid=${item.uid}');
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8),
Container(
margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
border: Border.all(
width: 1.5,
color: theme.colorScheme.primary,
strokeAlign: BorderSide.strokeAlignOutside,
),
shape: BoxShape.circle,
),
const SizedBox(height: 4),
Text(
item.uname!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12),
textAlign: TextAlign.center,
child: NetworkImgLayer(
type: ImageType.avatar,
width: 45,
height: 45,
src: item.face,
),
],
),
),
const SizedBox(height: 4),
Text(
item.uname!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12),
textAlign: TextAlign.center,
),
],
),
);
},
itemCount: followList.length,
),
),
);
},
itemCount: followList.length,
);
}
}

View File

@@ -203,26 +203,25 @@ class _MainAppState extends State<MainApp>
),
child: Scaffold(
extendBody: true,
body: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (useSideBar || !isPortrait) ...[
_mainController.navigationBars.length > 1
? context.isTablet && GStorage.optTabletNav
? Column(
children: [
SizedBox(
height:
MediaQuery.paddingOf(context).top + 50),
userAndSearchVertical(theme),
const Spacer(flex: 2),
Expanded(
flex: 5,
child: SizedBox(
width: 130,
child: MediaQuery.removePadding(
context: context,
removeRight: true,
resizeToAvoidBottomInset: false,
appBar: AppBar(toolbarHeight: 0),
body: SafeArea(
bottom: false,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (useSideBar || !isPortrait) ...[
_mainController.navigationBars.length > 1
? context.isTablet && GStorage.optTabletNav
? Column(
children: [
const SizedBox(height: 25),
userAndSearchVertical(theme),
const Spacer(flex: 2),
Expanded(
flex: 5,
child: SizedBox(
width: 130,
child: Obx(
() => NavigationDrawer(
backgroundColor: Colors.transparent,
@@ -253,49 +252,40 @@ class _MainAppState extends State<MainApp>
),
),
),
],
)
: Obx(
() => NavigationRail(
groupAlignment: 0.5,
selectedIndex:
_mainController.selectedIndex.value,
onDestinationSelected: setIndex,
labelType: NavigationRailLabelType.selected,
leading: userAndSearchVertical(theme),
destinations: _mainController.navigationBars
.map((e) => NavigationRailDestination(
label: Text(e.label),
icon: _buildIcon(type: e),
selectedIcon: _buildIcon(
type: e,
selected: true,
),
))
.toList(),
),
],
)
: Obx(
() => NavigationRail(
groupAlignment: 0.5,
selectedIndex:
_mainController.selectedIndex.value,
onDestinationSelected: setIndex,
labelType: NavigationRailLabelType.selected,
leading: userAndSearchVertical(theme),
destinations: _mainController.navigationBars
.map((e) => NavigationRailDestination(
label: Text(e.label),
icon: _buildIcon(type: e),
selectedIcon: _buildIcon(
type: e,
selected: true,
),
))
.toList(),
),
)
: SafeArea(
right: false,
child: Container(
)
: Container(
padding: const EdgeInsets.only(top: 10),
width: 80,
child: userAndSearchVertical(theme),
),
),
VerticalDivider(
width: 1,
indent: MediaQuery.of(context).padding.top,
endIndent: MediaQuery.of(context).padding.bottom,
color: theme.colorScheme.outline.withValues(alpha: 0.06),
),
],
Expanded(
child: SafeArea(
top: false,
bottom: false,
left: isPortrait,
VerticalDivider(
width: 1,
endIndent: MediaQuery.paddingOf(context).bottom,
color: theme.colorScheme.outline.withValues(alpha: 0.06),
),
],
Expanded(
child: _mainController.mainTabBarView
? CustomTabBarView(
scrollDirection:
@@ -314,8 +304,8 @@ class _MainAppState extends State<MainApp>
.toList(),
),
),
),
],
],
),
),
bottomNavigationBar: useSideBar || !isPortrait
? null

View File

@@ -42,15 +42,11 @@ class _MediaPageState extends CommonPageState<MediaPage, MediaController>
super.build(context);
final theme = Theme.of(context);
Color primary = theme.colorScheme.primary;
return MediaQuery.removePadding(
context: context,
removeLeft: context.orientation == Orientation.landscape,
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
toolbarHeight: 30,
),
body: ListView(
return Padding(
padding: const EdgeInsets.only(top: 30),
child: Material(
color: Colors.transparent,
child: ListView(
controller: controller.scrollController,
physics: const AlwaysScrollableScrollPhysics(),
children: [

View File

@@ -173,10 +173,8 @@ class _SharePanelState extends State<SharePanel> {
GestureDetector(
onTap: () async {
_focusNode.unfocus();
UserModel? userModel = await Get.dialog(
const ContactPage(),
useSafeArea: false,
transitionDuration: const Duration(milliseconds: 120),
UserModel? userModel = await Navigator.of(context).push(
GetPageRoute(page: () => const ContactPage()),
);
if (userModel != null) {
_userList

View File

@@ -443,7 +443,7 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
divider,
SliverToBoxAdapter(child: _blockToastItem(titleStyle)),
divider,
SliverToBoxAdapter(child: _blockTrackItem(titleStyle, titleStyle)),
SliverToBoxAdapter(child: _blockTrackItem(titleStyle, subTitleStyle)),
dividerL,
SliverList.separated(
itemCount: _blockSettings.length,

View File

@@ -48,11 +48,9 @@ class PageUtils {
avatar: item.talkerIcon,
))
.toList());
} else {
UserModel? userModel = await Get.dialog(
const ContactPage(),
useSafeArea: false,
transitionDuration: const Duration(milliseconds: 120),
} else if (context.mounted) {
UserModel? userModel = await Navigator.of(context).push(
GetPageRoute(page: () => const ContactPage()),
);
if (userModel != null) {
selectedIndex = 0;