Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Feb 16, 2024
2 parents ba9c05a + 3c0f54b commit 125b705
Show file tree
Hide file tree
Showing 24 changed files with 406 additions and 335 deletions.
19 changes: 13 additions & 6 deletions lib/common/widgets/http_error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,27 @@ class HttpError extends StatelessWidget {
"assets/images/error.svg",
height: 200,
),
const SizedBox(height: 20),
const SizedBox(height: 30),
Text(
errMsg ?? '请求异常',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleSmall,
),
const SizedBox(height: 30),
OutlinedButton.icon(
const SizedBox(height: 20),
FilledButton.tonal(
onPressed: () {
fn!();
},
icon: const Icon(Icons.arrow_forward_outlined, size: 20),
label: Text(btnText ?? '点击重试'),
)
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) {
return Theme.of(context).colorScheme.primary.withAlpha(20);
}),
),
child: Text(
btnText ?? '点击重试',
style: TextStyle(color: Theme.of(context).colorScheme.primary),
),
),
],
),
),
Expand Down
3 changes: 1 addition & 2 deletions lib/common/widgets/video_card_v.dart
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ class VideoStat extends StatelessWidget {
maxLines: 1,
text: TextSpan(
style: TextStyle(
fontSize: MediaQuery.textScalerOf(context)
.scale(Theme.of(context).textTheme.labelSmall!.fontSize!),
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
color: Theme.of(context).colorScheme.outline,
),
text: Utils.formatTimestampToRelativeTime(videoItem.pubdate)),
Expand Down
2 changes: 1 addition & 1 deletion lib/http/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class VideoHttp {
}
return {'status': true, 'data': list};
} else {
return {'status': false, 'data': []};
return {'status': false, 'data': [], 'msg': res.data['message']};
}
} catch (err) {
return {'status': false, 'data': [], 'msg': err};
Expand Down
11 changes: 7 additions & 4 deletions lib/models/home/rcmd/result.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:pilipala/utils/id_utils.dart';

class RecVideoItemAppModel {
RecVideoItemAppModel({
this.id,
Expand Down Expand Up @@ -50,14 +52,15 @@ class RecVideoItemAppModel {
? json['player_args']['aid']
: int.parse(json['param'] ?? '-1');
aid = json['player_args'] != null ? json['player_args']['aid'] : -1;
bvid = null;
bvid = json['player_args'] != null
? IdUtils.av2bv(json['player_args']['aid'])
: '';
cid = json['player_args'] != null ? json['player_args']['cid'] : -1;
pic = json['cover'];
stat = RcmdStat.fromJson(json);
// 改用player_args中的duration作为原始数据(秒数)
duration = json['player_args'] != null
? json['player_args']['duration']
: -1;
duration =
json['player_args'] != null ? json['player_args']['duration'] : -1;
//duration = json['cover_right_text'];
title = json['title'];
owner = RcmdOwner.fromJson(json);
Expand Down
7 changes: 4 additions & 3 deletions lib/pages/bangumi/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:pilipala/common/constants.dart';
import 'package:pilipala/common/widgets/http_error.dart';
import 'package:pilipala/pages/home/index.dart';
import 'package:pilipala/pages/main/index.dart';
import 'package:pilipala/pages/rcmd/view.dart';

import '../../utils/grid.dart';
import 'controller.dart';
Expand Down Expand Up @@ -200,7 +199,10 @@ class _BangumiPageState extends State<BangumiPage>
} else {
return HttpError(
errMsg: data['msg'],
fn: () => {},
fn: () {
_futureBuilderFuture =
_bangumidController.queryBangumiListFeed();
},
);
}
} else {
Expand All @@ -209,7 +211,6 @@ class _BangumiPageState extends State<BangumiPage>
},
),
),
const LoadingMore()
],
),
);
Expand Down
28 changes: 2 additions & 26 deletions lib/pages/dynamics/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,6 @@ class _DynamicsPageState extends State<DynamicsPage>
)
],
),
// Obx(
// () => Visibility(
// visible: _dynamicsController.userLogin.value,
// child: Positioned(
// right: 4,
// top: 0,
// bottom: 0,
// child: IconButton(
// padding: EdgeInsets.zero,
// onPressed: () =>
// {feedBack(), _dynamicsController.resetSearch()},
// icon: const Icon(Icons.history, size: 21),
// ),
// ),
// ),
// ),
],
),
),
Expand All @@ -232,7 +216,8 @@ class _DynamicsPageState extends State<DynamicsPage>
return Obx(() => UpPanel(_dynamicsController.upData.value));
} else {
return const SliverToBoxAdapter(
child: SizedBox(height: 80));
child: SizedBox(height: 80),
);
}
} else {
return const SliverToBoxAdapter(
Expand All @@ -243,15 +228,6 @@ class _DynamicsPageState extends State<DynamicsPage>
}
},
),
SliverToBoxAdapter(
child: Container(
height: 6,
color: Theme.of(context)
.colorScheme
.onInverseSurface
.withOpacity(0.5),
),
),
FutureBuilder(
future: _futureBuilderFuture,
builder: (context, snapshot) {
Expand Down
42 changes: 28 additions & 14 deletions lib/pages/dynamics/widgets/up_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class _UpPanelState extends State<UpPanel> {
}
upList.insert(
0,
UpItem(
face: 'https://files.catbox.moe/8uc48f.png', uname: '全部动态', mid: -1),
UpItem(face: '', uname: '全部动态', mid: -1),
);
userInfo = userInfoCache.get('userInfoCache');
upList.insert(
Expand All @@ -56,7 +55,7 @@ class _UpPanelState extends State<UpPanel> {
floating: true,
pinned: false,
delegate: _SliverHeaderDelegate(
height: 124,
height: 126,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -121,6 +120,13 @@ class _UpPanelState extends State<UpPanel> {
],
),
),
Container(
height: 6,
color: Theme.of(context)
.colorScheme
.onInverseSurface
.withOpacity(0.5),
),
],
)),
);
Expand Down Expand Up @@ -171,6 +177,9 @@ class _UpPanelState extends State<UpPanel> {
},
onLongPress: () {
feedBack();
if (data.mid == -1) {
return;
}
String heroTag = Utils.makeHeroTag(data.mid);
Get.toNamed('/member?mid=${data.mid}',
arguments: {'face': data.face, 'heroTag': heroTag});
Expand Down Expand Up @@ -198,12 +207,19 @@ class _UpPanelState extends State<UpPanel> {
backgroundColor: data.type == 'live'
? Theme.of(context).colorScheme.secondaryContainer
: Theme.of(context).colorScheme.primary,
child: NetworkImgLayer(
width: 49,
height: 49,
src: data.face,
type: 'avatar',
),
child: data.face != ''
? NetworkImgLayer(
width: 50,
height: 50,
src: data.face,
type: 'avatar',
)
: const CircleAvatar(
radius: 25,
backgroundImage: AssetImage(
'assets/images/noface.jpeg',
),
),
),
Padding(
padding: const EdgeInsets.only(top: 4),
Expand Down Expand Up @@ -271,13 +287,11 @@ class UpPanelSkeleton extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 49,
height: 49,
width: 50,
height: 50,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface,
borderRadius: const BorderRadius.all(
Radius.circular(24),
),
borderRadius: BorderRadius.circular(50),
),
),
Container(
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/fav_detail/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ class _FavDetailPageState extends State<FavDetailPage> {
Get.put(FavDetailController());
late StreamController<bool> titleStreamC; // a
Future? _futureBuilderFuture;
late String mediaId;

@override
void initState() {
super.initState();
_futureBuilderFuture = _favDetailController.queryUserFavFolderDetail();
mediaId = Get.parameters['mediaId']!;
titleStreamC = StreamController<bool>();
_controller.addListener(
() {
Expand Down Expand Up @@ -94,8 +96,8 @@ class _FavDetailPageState extends State<FavDetailPage> {
),
actions: [
IconButton(
onPressed: () => Get.toNamed(
'/favSearch?searchType=0&mediaId=${Get.parameters['mediaId']!}'),
onPressed: () =>
Get.toNamed('/favSearch?searchType=0&mediaId=$mediaId'),
icon: const Icon(Icons.search_outlined),
),
// IconButton(
Expand Down
Loading

0 comments on commit 125b705

Please sign in to comment.