mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-21 18:00:18 +08:00
@@ -29,6 +29,8 @@ import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/material.dart'
|
||||
hide CustomMultiChildLayout, MultiChildLayoutDelegate;
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:get/get_navigation/get_navigation.dart';
|
||||
|
||||
class ImageModel {
|
||||
ImageModel({
|
||||
@@ -74,6 +76,7 @@ class CustomGridView extends StatelessWidget {
|
||||
final bool fullScreen;
|
||||
|
||||
static bool horizontalPreview = Pref.horizontalPreview;
|
||||
static final _regex = RegExp(r'/(videoV|dynamicDetail)');
|
||||
|
||||
void onTap(BuildContext context, int index) {
|
||||
final imgList = picArr.map(
|
||||
@@ -90,6 +93,7 @@ class CustomGridView extends StatelessWidget {
|
||||
).toList();
|
||||
if (horizontalPreview &&
|
||||
!fullScreen &&
|
||||
Get.currentRoute.startsWith(_regex) &&
|
||||
!context.mediaQuerySize.isPortrait) {
|
||||
final scaffoldState = Scaffold.maybeOf(context);
|
||||
if (scaffoldState != null) {
|
||||
|
||||
@@ -78,6 +78,7 @@ class _AudioPageState extends State<AudioPage> {
|
||||
final isPortrait = MediaQuery.sizeOf(context).isPortrait;
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
actions: [
|
||||
Builder(
|
||||
|
||||
@@ -71,6 +71,7 @@ class _DLNAPageState extends State<DLNAPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = ColorScheme.of(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
title: const Text('投屏'),
|
||||
actions: [
|
||||
|
||||
@@ -41,6 +41,7 @@ class _DownloadingPageState extends State<DownloadingPage>
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: MultiSelectAppBarWidget(
|
||||
ctr: this,
|
||||
child: AppBar(
|
||||
|
||||
@@ -79,28 +79,25 @@ class FollowItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (isOwner ?? false)
|
||||
SizedBox(
|
||||
height: 34,
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => RequestUtils.actionRelationMod(
|
||||
context: context,
|
||||
mid: item.mid,
|
||||
isFollow: item.attribute != -1,
|
||||
callback: callback,
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||
foregroundColor: item.attribute == -1
|
||||
? null
|
||||
: colorScheme.outline,
|
||||
backgroundColor: item.attribute == -1
|
||||
? null
|
||||
: colorScheme.onInverseSurface,
|
||||
),
|
||||
child: Text(
|
||||
'${item.attribute == -1 ? '' : '已'}关注',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
FilledButton.tonal(
|
||||
onPressed: () => RequestUtils.actionRelationMod(
|
||||
context: context,
|
||||
mid: item.mid,
|
||||
isFollow: item.attribute != -1,
|
||||
callback: callback,
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||
foregroundColor: item.attribute == -1
|
||||
? null
|
||||
: colorScheme.outline,
|
||||
backgroundColor: item.attribute == -1
|
||||
? null
|
||||
: colorScheme.onInverseSurface,
|
||||
),
|
||||
child: Text(
|
||||
'${item.attribute == -1 ? '' : '已'}关注',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/pages/log_table/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -21,23 +22,18 @@ class _LogPageState<T> extends State<LogPage<T>> {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(title: Text(_controller.title)),
|
||||
body: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 680),
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 10 + padding.left,
|
||||
right: 10 + padding.right,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
sliver: Obx(() => _buildBody(_controller.loadingState.value)),
|
||||
),
|
||||
],
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 10 + padding.left,
|
||||
right: 10 + padding.right,
|
||||
bottom: padding.bottom + 100,
|
||||
),
|
||||
sliver: Obx(() => _buildBody(_controller.loadingState.value)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).constraintWidth(constraints: const BoxConstraints(maxWidth: 680)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -612,13 +612,7 @@ class _LoginPageState extends State<LoginPage> {
|
||||
Widget tabViewOuter(Widget child) {
|
||||
return SingleChildScrollView(
|
||||
padding: padding,
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 600),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
child: child.constraintWidth(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:PiliPlus/common/widgets/view_sliver_safe_area.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models_new/login_devices/device.dart';
|
||||
import 'package:PiliPlus/pages/login_devices/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:flutter/material.dart' hide ListTile;
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -22,27 +23,23 @@ class LoginDevicesPageState extends State<LoginDevicesPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(title: const Text('登录设备')),
|
||||
body: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 650),
|
||||
child: refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
ViewSliverSafeArea(
|
||||
sliver: Obx(
|
||||
() => _buildBody(
|
||||
colorScheme,
|
||||
_controller.loadingState.value,
|
||||
),
|
||||
),
|
||||
body: refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
ViewSliverSafeArea(
|
||||
sliver: Obx(
|
||||
() => _buildBody(
|
||||
colorScheme,
|
||||
_controller.loadingState.value,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/pages/main_reply/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/pages/video/reply_reply/view.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/num_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -55,9 +56,8 @@ class _MainReplyPageState extends State<MainReplyPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = ColorScheme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('查看评论'),
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(title: const Text('查看评论')),
|
||||
body: NotificationListener<UserScrollNotification>(
|
||||
onNotification: (notification) {
|
||||
final direction = notification.direction;
|
||||
@@ -84,7 +84,7 @@ class _MainReplyPageState extends State<MainReplyPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
),
|
||||
floatingActionButton: SlideTransition(
|
||||
position: _controller.fabAnim,
|
||||
@@ -247,7 +247,7 @@ class _MainReplyPageState extends State<MainReplyPage> {
|
||||
replyType: _controller.replyType,
|
||||
firstFloor: replyItem,
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
),
|
||||
routeName: 'dynamicDetail-Copy',
|
||||
);
|
||||
|
||||
@@ -57,7 +57,7 @@ class _MatchInfoPageState extends CommonDynPageState<MatchInfoPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
floatingActionButton: SlideTransition(
|
||||
position: fabAnim,
|
||||
child: replyButton,
|
||||
@@ -220,7 +220,7 @@ class _MatchInfoPageState extends CommonDynPageState<MatchInfoPage> {
|
||||
replyType: controller.replyType,
|
||||
firstFloor: replyItem,
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:PiliPlus/models_new/upower_rank/rank_info.dart';
|
||||
import 'package:PiliPlus/pages/member_upower_rank/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart' hide ListTile;
|
||||
import 'package:get/get.dart';
|
||||
@@ -93,76 +94,71 @@ class _UpowerRankPageState extends State<UpowerRankPage>
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.only(left: padding.left, right: padding.right),
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 625),
|
||||
child: Obx(
|
||||
() {
|
||||
final tabs = _controller.tabs.value;
|
||||
return tabs != null
|
||||
? DefaultTabController(
|
||||
length: tabs.length,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return Column(
|
||||
children: [
|
||||
TabBar(
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
tabs: tabs
|
||||
.map(
|
||||
(e) => Tab(
|
||||
text:
|
||||
'${e.name!}(${e.memberTotal ?? 0})',
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onTap: (index) {
|
||||
if (!DefaultTabController.of(
|
||||
context,
|
||||
).indexIsChanging) {
|
||||
try {
|
||||
if (index == 0) {
|
||||
_controller.animateToTop();
|
||||
} else {
|
||||
Get.find<UpowerRankController>(
|
||||
tag:
|
||||
'$_tag${tabs[index].privilegeType}',
|
||||
).animateToTop();
|
||||
}
|
||||
} catch (_) {}
|
||||
child: Obx(
|
||||
() {
|
||||
final tabs = _controller.tabs.value;
|
||||
return tabs != null
|
||||
? DefaultTabController(
|
||||
length: tabs.length,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return Column(
|
||||
children: [
|
||||
TabBar(
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
tabs: tabs
|
||||
.map(
|
||||
(e) => Tab(
|
||||
text:
|
||||
'${e.name!}(${e.memberTotal ?? 0})',
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onTap: (index) {
|
||||
if (!DefaultTabController.of(
|
||||
context,
|
||||
).indexIsChanging) {
|
||||
try {
|
||||
if (index == 0) {
|
||||
_controller.animateToTop();
|
||||
} else {
|
||||
Get.find<UpowerRankController>(
|
||||
tag:
|
||||
'$_tag${tabs[index].privilegeType}',
|
||||
).animateToTop();
|
||||
}
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: tabBarView(
|
||||
children: [
|
||||
KeepAliveWrapper(
|
||||
builder: (context) => child,
|
||||
),
|
||||
...tabs
|
||||
.skip(1)
|
||||
.map(
|
||||
(e) => UpowerRankPage(
|
||||
upMid: _upMid,
|
||||
tag: _tag,
|
||||
privilegeType: e.privilegeType,
|
||||
),
|
||||
),
|
||||
],
|
||||
} catch (_) {}
|
||||
}
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: tabBarView(
|
||||
children: [
|
||||
KeepAliveWrapper(
|
||||
builder: (context) => child,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: child;
|
||||
},
|
||||
),
|
||||
),
|
||||
...tabs
|
||||
.skip(1)
|
||||
.map(
|
||||
(e) => UpowerRankPage(
|
||||
upMid: _upMid,
|
||||
tag: _tag,
|
||||
privilegeType: e.privilegeType,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: child;
|
||||
},
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
);
|
||||
} else {
|
||||
return child;
|
||||
|
||||
@@ -227,12 +227,9 @@ class _PayCoinsPageState extends State<PayCoinsPage>
|
||||
final isPortrait = size.isPortrait;
|
||||
return isPortrait
|
||||
? _buildBody(isPortrait)
|
||||
: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: math.min(525, size.width * 0.6),
|
||||
),
|
||||
child: _buildBody(isPortrait),
|
||||
: _buildBody(isPortrait).constraintWidth(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: math.min(525, size.width * 0.6),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:PiliPlus/pages/common/slide/common_slide_page.dart';
|
||||
import 'package:PiliPlus/pages/video/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/pages/video/reply_reply/controller.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/num_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
@@ -83,7 +84,7 @@ class VideoReplyReplyPanel extends CommonSlidePage {
|
||||
firstFloor: null,
|
||||
id: rpId,
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ class _WebviewPageState extends State<WebviewPage> {
|
||||
if (Platform.isLinux) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Center(
|
||||
child: TextButton(
|
||||
onPressed: () => PageUtils.launchURL(_url),
|
||||
|
||||
@@ -130,10 +130,7 @@ class _WhisperDetailPageState
|
||||
],
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: padding.left,
|
||||
right: padding.right,
|
||||
),
|
||||
padding: EdgeInsets.only(left: padding.left, right: padding.right),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -161,7 +158,7 @@ class _WhisperDetailPageState
|
||||
SizedBox(height: padding.bottom),
|
||||
],
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/date_utils.dart';
|
||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
@@ -754,20 +755,15 @@ class ChatItem extends StatelessWidget {
|
||||
|
||||
Widget msgTypePictureCard_13(dynamic content) {
|
||||
final url = content['jump_url'];
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 400.0),
|
||||
child: ClipRRect(
|
||||
borderRadius: StyleString.mdRadius,
|
||||
child: GestureDetector(
|
||||
onTap: url == null ? null : () => PiliScheme.routePushFromUrl(url),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: ImageUtils.thumbnailUrl(content['pic_url']),
|
||||
),
|
||||
),
|
||||
return ClipRRect(
|
||||
borderRadius: StyleString.mdRadius,
|
||||
child: GestureDetector(
|
||||
onTap: url == null ? null : () => PiliScheme.routePushFromUrl(url),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: ImageUtils.thumbnailUrl(content['pic_url']),
|
||||
),
|
||||
),
|
||||
);
|
||||
).constraintWidth(constraints: const BoxConstraints(maxWidth: 400.0));
|
||||
}
|
||||
|
||||
Widget def(Color textColor, {err}) {
|
||||
|
||||
@@ -78,7 +78,7 @@ class _WhisperSecPageState extends State<WhisperSecPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
).constraintWidth(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -275,3 +275,17 @@ extension GetExt on GetInterface {
|
||||
S putOrFind<S>(InstanceBuilderCallback<S> dep, {String? tag}) =>
|
||||
GetInstance().putOrFind(dep, tag: tag);
|
||||
}
|
||||
|
||||
extension WidgetExt on Widget {
|
||||
Widget constraintWidth({
|
||||
BoxConstraints constraints = const BoxConstraints(maxWidth: 625),
|
||||
}) {
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConstrainedBox(
|
||||
constraints: constraints,
|
||||
child: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user