mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-21 02:50:14 +08:00
tweaks (#1142)
* opt: unused layout * mod: semantics * opt: DanmakuMsg type * opt: avoid cast * opt: unnecessary_lambdas * opt: use isEven * opt: logger * opt: invalid common page * tweak * opt: unify DynController
This commit is contained in:
committed by
GitHub
parent
56ffc2781f
commit
5f8313901b
@@ -1,8 +1,6 @@
|
||||
import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
||||
show MainListReply, ReplyInfo;
|
||||
import 'package:PiliPlus/grpc/reply.dart';
|
||||
import 'package:PiliPlus/http/dynamics.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/common/dyn/common_dyn_controller.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
@@ -10,7 +8,7 @@ import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class DynamicDetailController extends CommonDynController<MainListReply> {
|
||||
class DynamicDetailController extends CommonDynController {
|
||||
@override
|
||||
late int oid;
|
||||
@override
|
||||
@@ -54,13 +52,4 @@ class DynamicDetailController extends CommonDynController<MainListReply> {
|
||||
List<ReplyInfo>? getDataList(MainListReply response) {
|
||||
return response.replies;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<MainListReply>> customGetData() => ReplyGrpc.mainList(
|
||||
type: replyType,
|
||||
oid: oid,
|
||||
mode: mode.value,
|
||||
cursorNext: cursorNext,
|
||||
offset: paginationReply?.nextOffset,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,18 +9,15 @@ import 'package:PiliPlus/pages/dynamics/widgets/author_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/dynamic_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_detail/controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_repost/view.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
import 'package:PiliPlus/utils/num_util.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart' hide ContextExtensionss;
|
||||
|
||||
class DynamicDetailPage extends CommonDynPage {
|
||||
class DynamicDetailPage extends StatefulWidget {
|
||||
const DynamicDetailPage({super.key});
|
||||
|
||||
@override
|
||||
@@ -94,45 +91,7 @@ class _DynamicDetailPageState extends CommonDynPageState<DynamicDetailPage> {
|
||||
actions: isPortrait
|
||||
? null
|
||||
: [
|
||||
IconButton(
|
||||
tooltip: '页面比例调节',
|
||||
onPressed: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 56, right: 16),
|
||||
width: maxWidth / 4,
|
||||
height: 32,
|
||||
child: Builder(
|
||||
builder: (context) => Slider(
|
||||
min: 1,
|
||||
max: 100,
|
||||
value: controller.ratio.first,
|
||||
onChanged: (value) {
|
||||
if (value >= 10 && value <= 90) {
|
||||
value = value.toPrecision(2);
|
||||
controller.ratio
|
||||
..[0] = value
|
||||
..[1] = 100 - value;
|
||||
GStorage.setting.put(
|
||||
SettingBoxKey.dynamicDetailRatio,
|
||||
controller.ratio,
|
||||
);
|
||||
(context as Element).markNeedsBuild();
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
icon: Transform.rotate(
|
||||
angle: pi / 2,
|
||||
child: const Icon(Icons.splitscreen, size: 19),
|
||||
),
|
||||
),
|
||||
ratioWidget(maxWidth),
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
);
|
||||
@@ -237,20 +196,6 @@ class _DynamicDetailPageState extends CommonDynPageState<DynamicDetailPage> {
|
||||
position: controller.fabAnim,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
Widget button() => FloatingActionButton(
|
||||
heroTag: null,
|
||||
onPressed: () {
|
||||
feedBack();
|
||||
controller.onReply(
|
||||
context,
|
||||
oid: controller.oid,
|
||||
replyType: controller.replyType,
|
||||
);
|
||||
},
|
||||
tooltip: '评论动态',
|
||||
child: const Icon(Icons.reply),
|
||||
);
|
||||
|
||||
if (!controller.showDynActionBar) {
|
||||
return Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
@@ -259,7 +204,7 @@ class _DynamicDetailPageState extends CommonDynPageState<DynamicDetailPage> {
|
||||
right: 14,
|
||||
bottom: padding.bottom + 14,
|
||||
),
|
||||
child: button(),
|
||||
child: replyButton,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -302,7 +247,7 @@ class _DynamicDetailPageState extends CommonDynPageState<DynamicDetailPage> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 14, bottom: 14),
|
||||
child: button(),
|
||||
child: replyButton,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
|
||||
Reference in New Issue
Block a user