mod: 一些样式修改

This commit is contained in:
guozhigq
2023-08-21 09:03:34 +08:00
parent 01d6308350
commit 706bb0f924
10 changed files with 113 additions and 72 deletions

View File

@ -138,7 +138,12 @@ class VideoHttp {
'data': PlayUrlModel.fromJson(res.data['data'])
};
} else {
return {'status': false, 'data': []};
return {
'status': false,
'data': [],
'code': res.data['code'],
'msg': res.data['message'],
};
}
} catch (err) {
return {'status': false, 'data': [], 'msg': err};
@ -155,13 +160,14 @@ class VideoHttp {
Map errMap = {
-400: '请求错误',
-403: '权限不足',
-404: '视频',
-404: '视频资源失效',
62002: '稿件不可见',
62004: '稿件审核中',
};
return {
'status': false,
'data': null,
'code': result.code,
'msg': errMap[result.code] ?? '请求异常',
};
}

View File

@ -130,7 +130,6 @@ class LevelInfo {
currentLevel = json['current_level'];
currentMin = json['current_min'];
currentExp = json['current_exp'];
// nextExp = json['next_exp'];
nextExp =
json['current_level'] == 6 ? json['current_exp'] : json['next_exp'];
}

View File

@ -50,7 +50,11 @@ class BangumiController extends GetxController {
// 我的订阅
Future queryBangumiFollow() async {
var result = await BangumiHttp.bangumiFollow(mid: 17340771);
userInfo = userInfo ?? userInfoCache.get('userInfoCache');
if (userInfo == null) {
return;
}
var result = await BangumiHttp.bangumiFollow(mid: userInfo.mid);
if (result['status']) {
bangumiFollowList.value = result['data'].list;
} else {}

View File

@ -23,6 +23,7 @@ class _BangumiPageState extends State<BangumiPage>
with AutomaticKeepAliveClientMixin {
final BangumiController _bangumidController = Get.put(BangumiController());
late Future? _futureBuilderFuture;
late Future? _futureBuilderFutureFollow;
late ScrollController scrollController;
@override
@ -35,6 +36,7 @@ class _BangumiPageState extends State<BangumiPage>
StreamController<bool> mainStream =
Get.find<MainController>().bottomBarStream;
_futureBuilderFuture = _bangumidController.queryBangumiListFeed();
_futureBuilderFutureFollow = _bangumidController.queryBangumiFollow();
scrollController.addListener(
() async {
if (scrollController.position.pixels >=
@ -89,43 +91,61 @@ class _BangumiPageState extends State<BangumiPage>
'最近追番',
style: Theme.of(context).textTheme.titleMedium,
),
IconButton(
onPressed: () {
setState(() {
_futureBuilderFutureFollow =
_bangumidController.queryBangumiFollow();
});
},
icon: const Icon(
Icons.refresh,
size: 20,
),
),
],
),
),
SizedBox(
height: 258,
child: FutureBuilder(
future: _bangumidController.queryBangumiFollow(),
future: _futureBuilderFutureFollow,
builder: (context, snapshot) {
if (snapshot.connectionState ==
ConnectionState.done) {
Map data = snapshot.data as Map;
List list = _bangumidController.bangumiFollowList;
if (data['status']) {
return Obx(
() => ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: _bangumidController
.bangumiFollowList.length,
itemBuilder: (context, index) {
return Container(
width: Get.size.width / 3,
height: 254,
margin: EdgeInsets.only(
left: StyleString.safeSpace,
right: index ==
_bangumidController
.bangumiFollowList
.length -
1
? StyleString.safeSpace
: 0),
child: BangumiCardV(
bangumiItem: _bangumidController
.bangumiFollowList[index],
() => list.isNotEmpty
? ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: list.length,
itemBuilder: (context, index) {
return Container(
width: Get.size.width / 3,
height: 254,
margin: EdgeInsets.only(
left: StyleString.safeSpace,
right: index ==
_bangumidController
.bangumiFollowList
.length -
1
? StyleString.safeSpace
: 0),
child: BangumiCardV(
bangumiItem: _bangumidController
.bangumiFollowList[index],
),
);
},
)
: const SizedBox(
child: Center(
child: Text('还没有追番'),
),
),
);
},
),
);
} else {
return const SizedBox();

View File

@ -61,6 +61,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
SliverAppBar(
expandedHeight: 260 - MediaQuery.of(context).padding.top,
pinned: true,
titleSpacing: 0,
title: StreamBuilder(
stream: titleStreamC.stream,
initialData: false,

View File

@ -6,6 +6,7 @@ import 'package:get/get.dart';
import 'package:pilipala/common/constants.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/models/common/theme_type.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/event_bus.dart';
import 'controller.dart';
@ -160,10 +161,11 @@ class _MinePageState extends State<MinePage> {
]))
],
),
const SizedBox(height: 5),
const SizedBox(height: 25),
if (_mineController.userInfo.value.levelInfo != null) ...[
LayoutBuilder(
builder: (context, BoxConstraints box) {
LevelInfo levelInfo = _mineController.userInfo.value.levelInfo;
return SizedBox(
width: box.maxWidth,
height: 24,
@ -172,48 +174,27 @@ class _MinePageState extends State<MinePage> {
Positioned(
top: 0,
right: 0,
child: SizedBox(
height: 22,
bottom: 0,
child: Container(
color: Theme.of(context).colorScheme.primary,
height: 24,
constraints:
const BoxConstraints(minWidth: 100), // 设置最小宽度为100
width: box.maxWidth *
(1 -
(_mineController
.userInfo.value.levelInfo!.currentExp! /
_mineController
.userInfo.value.levelInfo!.nextExp!)),
(1 - (levelInfo.currentExp! / levelInfo.nextExp!)),
child: Center(
child: Text(
(_mineController
.userInfo.value.levelInfo!.nextExp! -
_mineController
.userInfo.value.levelInfo!.currentExp!)
.toString(),
'${levelInfo.currentExp!}/${levelInfo.nextExp!}',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
color: Theme.of(context).colorScheme.onPrimary,
fontSize: 12,
),
),
),
),
),
],
),
);
},
),
LayoutBuilder(
builder: (context, BoxConstraints box) {
return Container(
width: box.maxWidth,
height: 1,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Theme.of(context).colorScheme.onInverseSurface,
),
child: Stack(
children: [
Positioned(
top: 0,
top: 23,
left: 0,
bottom: 0,
child: Container(
@ -224,7 +205,6 @@ class _MinePageState extends State<MinePage> {
.userInfo.value.levelInfo!.nextExp!),
height: 1,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Theme.of(context).colorScheme.primary,
),
),
@ -234,6 +214,36 @@ class _MinePageState extends State<MinePage> {
);
},
),
// LayoutBuilder(
// builder: (context, BoxConstraints box) {
// return Container(
// width: box.maxWidth,
// height: 1,
// color: Theme.of(context).colorScheme.onInverseSurface,
// child: Stack(
// children: [
// Positioned(
// top: 0,
// left: 0,
// bottom: 0,
// child: Container(
// width: box.maxWidth *
// (_mineController
// .userInfo.value.levelInfo!.currentExp! /
// _mineController
// .userInfo.value.levelInfo!.nextExp!),
// height: 1,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(4),
// color: Theme.of(context).colorScheme.primary,
// ),
// ),
// ),
// ],
// ),
// );
// },
// ),
],
const SizedBox(height: 30),
Padding(

View File

@ -34,9 +34,6 @@ class _ImagePreviewState extends State<ImagePreview>
super.initState();
// animationController = AnimationController(
// vsync: this, duration: const Duration(milliseconds: 400));
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.immersiveSticky,
);
_doubleClickAnimationController = AnimationController(
duration: const Duration(milliseconds: 250), vsync: this);
}
@ -96,7 +93,6 @@ class _ImagePreviewState extends State<ImagePreview>
// animationController.dispose();
_doubleClickAnimationController.dispose();
clearGestureDetailsCache();
exitFullScreen();
super.dispose();
}
@ -108,7 +104,7 @@ class _ImagePreviewState extends State<ImagePreview>
primary: false,
toolbarHeight: 0,
backgroundColor: Colors.black,
systemOverlayStyle: SystemUiOverlayStyle.light,
systemOverlayStyle: SystemUiOverlayStyle.dark,
),
body: Stack(
children: [

View File

@ -274,6 +274,9 @@ class VideoDetailController extends GetxController
// duration: data.timeLength ?? 0,
// );
} else {
if (result['code'] == -404) {
isShowCover.value = false;
}
SmartDialog.showToast(result['msg'].toString());
}
return result;

View File

@ -30,9 +30,6 @@ class VideoIntroController extends GetxController {
// 视频详情 请求返回
Rx<VideoDetailData> videoDetail = VideoDetailData().obs;
// 请求返回的信息
String responseMsg = '请求异常';
// up主粉丝数
Map userStat = {'follower': '-'};
@ -79,7 +76,7 @@ class VideoIntroController extends GetxController {
videoItem!['owner'] = args.owner;
}
}
userLogin = userInfo == null;
userLogin = userInfo != null;
lastPlayCid.value = int.parse(Get.parameters['cid']!);
}
@ -96,8 +93,6 @@ class VideoIntroController extends GetxController {
.value = ['简介', '评论 ${result['data']!.stat!.reply}'];
// 获取到粉丝数再返回
await queryUserStat();
} else {
responseMsg = result['msg'];
}
if (userLogin) {
// 获取点赞状态
@ -329,6 +324,9 @@ class VideoIntroController extends GetxController {
// 查询关注状态
Future queryFollowStatus() async {
if (videoDetail.value.owner == null) {
return;
}
var result = await VideoHttp.hasFollow(mid: videoDetail.value.owner!.mid!);
if (result['status']) {
followStatus.value = result['data'];

View File

@ -71,6 +71,10 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
// 请求错误
return HttpError(
errMsg: snapshot.data['msg'],
btnText: snapshot.data['code'] == -404 ||
snapshot.data['code'] == 62002
? '返回上一页'
: null,
fn: () => Get.back(),
);
}