feat: 首页推荐视频缓存
This commit is contained in:
@ -19,6 +19,7 @@ class VideoHttp {
|
|||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.recommendList,
|
Api.recommendList,
|
||||||
data: {
|
data: {
|
||||||
|
'user-agent': Request().headerUa('mob'),
|
||||||
'feed_version': 'V4',
|
'feed_version': 'V4',
|
||||||
'ps': ps,
|
'ps': ps,
|
||||||
'fresh_idx': freshIdx,
|
'fresh_idx': freshIdx,
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
|
part 'model_owner.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: 3)
|
||||||
class Owner {
|
class Owner {
|
||||||
Owner({
|
Owner({
|
||||||
this.mid,
|
this.mid,
|
||||||
this.name,
|
this.name,
|
||||||
this.face,
|
this.face,
|
||||||
});
|
});
|
||||||
|
@HiveField(0)
|
||||||
int? mid;
|
int? mid;
|
||||||
|
@HiveField(1)
|
||||||
String? name;
|
String? name;
|
||||||
|
@HiveField(2)
|
||||||
String? face;
|
String? face;
|
||||||
|
|
||||||
Owner.fromJson(Map<String, dynamic> json) {
|
Owner.fromJson(Map<String, dynamic> json) {
|
||||||
|
47
lib/models/model_owner.g.dart
Normal file
47
lib/models/model_owner.g.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'model_owner.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class OwnerAdapter extends TypeAdapter<Owner> {
|
||||||
|
@override
|
||||||
|
final int typeId = 3;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Owner read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return Owner(
|
||||||
|
mid: fields[0] as int?,
|
||||||
|
name: fields[1] as String?,
|
||||||
|
face: fields[2] as String?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, Owner obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.mid)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.name)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.face);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is OwnerAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
@ -1,5 +1,9 @@
|
|||||||
import './model_owner.dart';
|
import './model_owner.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
|
part 'model_rec_video_item.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: 0)
|
||||||
class RecVideoItemModel {
|
class RecVideoItemModel {
|
||||||
RecVideoItemModel({
|
RecVideoItemModel({
|
||||||
this.id,
|
this.id,
|
||||||
@ -17,18 +21,31 @@ class RecVideoItemModel {
|
|||||||
this.rcmdReason,
|
this.rcmdReason,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@HiveField(0)
|
||||||
int? id = -1;
|
int? id = -1;
|
||||||
|
@HiveField(1)
|
||||||
String? bvid = '';
|
String? bvid = '';
|
||||||
|
@HiveField(2)
|
||||||
int? cid = -1;
|
int? cid = -1;
|
||||||
|
@HiveField(3)
|
||||||
String? goto = '';
|
String? goto = '';
|
||||||
|
@HiveField(4)
|
||||||
String? uri = '';
|
String? uri = '';
|
||||||
|
@HiveField(5)
|
||||||
String? pic = '';
|
String? pic = '';
|
||||||
|
@HiveField(6)
|
||||||
String? title = '';
|
String? title = '';
|
||||||
|
@HiveField(7)
|
||||||
int? duration = -1;
|
int? duration = -1;
|
||||||
|
@HiveField(8)
|
||||||
int? pubdate = -1;
|
int? pubdate = -1;
|
||||||
|
@HiveField(9)
|
||||||
Owner? owner;
|
Owner? owner;
|
||||||
|
@HiveField(10)
|
||||||
Stat? stat;
|
Stat? stat;
|
||||||
|
@HiveField(11)
|
||||||
int? isFollowed;
|
int? isFollowed;
|
||||||
|
@HiveField(12)
|
||||||
RcmdReason? rcmdReason;
|
RcmdReason? rcmdReason;
|
||||||
|
|
||||||
RecVideoItemModel.fromJson(Map<String, dynamic> json) {
|
RecVideoItemModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -50,15 +67,18 @@ class RecVideoItemModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HiveType(typeId: 1)
|
||||||
class Stat {
|
class Stat {
|
||||||
Stat({
|
Stat({
|
||||||
this.view,
|
this.view,
|
||||||
this.like,
|
this.like,
|
||||||
this.danmaku,
|
this.danmaku,
|
||||||
});
|
});
|
||||||
|
@HiveField(0)
|
||||||
int? view;
|
int? view;
|
||||||
|
@HiveField(1)
|
||||||
int? like;
|
int? like;
|
||||||
|
@HiveField(2)
|
||||||
int? danmaku;
|
int? danmaku;
|
||||||
|
|
||||||
Stat.fromJson(Map<String, dynamic> json) {
|
Stat.fromJson(Map<String, dynamic> json) {
|
||||||
@ -68,13 +88,15 @@ class Stat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HiveType(typeId: 2)
|
||||||
class RcmdReason {
|
class RcmdReason {
|
||||||
RcmdReason({
|
RcmdReason({
|
||||||
this.reasonType,
|
this.reasonType,
|
||||||
this.content,
|
this.content,
|
||||||
});
|
});
|
||||||
|
@HiveField(0)
|
||||||
int? reasonType;
|
int? reasonType;
|
||||||
|
@HiveField(1)
|
||||||
String? content = '';
|
String? content = '';
|
||||||
|
|
||||||
RcmdReason.fromJson(Map<String, dynamic> json) {
|
RcmdReason.fromJson(Map<String, dynamic> json) {
|
||||||
|
154
lib/models/model_rec_video_item.g.dart
Normal file
154
lib/models/model_rec_video_item.g.dart
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'model_rec_video_item.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class RecVideoItemModelAdapter extends TypeAdapter<RecVideoItemModel> {
|
||||||
|
@override
|
||||||
|
final int typeId = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
RecVideoItemModel read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return RecVideoItemModel(
|
||||||
|
id: fields[0] as int?,
|
||||||
|
bvid: fields[1] as String?,
|
||||||
|
cid: fields[2] as int?,
|
||||||
|
goto: fields[3] as String?,
|
||||||
|
uri: fields[4] as String?,
|
||||||
|
pic: fields[5] as String?,
|
||||||
|
title: fields[6] as String?,
|
||||||
|
duration: fields[7] as int?,
|
||||||
|
pubdate: fields[8] as int?,
|
||||||
|
owner: fields[9] as Owner?,
|
||||||
|
stat: fields[10] as Stat?,
|
||||||
|
isFollowed: fields[11] as int?,
|
||||||
|
rcmdReason: fields[12] as RcmdReason?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, RecVideoItemModel obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(13)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.id)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.bvid)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.cid)
|
||||||
|
..writeByte(3)
|
||||||
|
..write(obj.goto)
|
||||||
|
..writeByte(4)
|
||||||
|
..write(obj.uri)
|
||||||
|
..writeByte(5)
|
||||||
|
..write(obj.pic)
|
||||||
|
..writeByte(6)
|
||||||
|
..write(obj.title)
|
||||||
|
..writeByte(7)
|
||||||
|
..write(obj.duration)
|
||||||
|
..writeByte(8)
|
||||||
|
..write(obj.pubdate)
|
||||||
|
..writeByte(9)
|
||||||
|
..write(obj.owner)
|
||||||
|
..writeByte(10)
|
||||||
|
..write(obj.stat)
|
||||||
|
..writeByte(11)
|
||||||
|
..write(obj.isFollowed)
|
||||||
|
..writeByte(12)
|
||||||
|
..write(obj.rcmdReason);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is RecVideoItemModelAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
class StatAdapter extends TypeAdapter<Stat> {
|
||||||
|
@override
|
||||||
|
final int typeId = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Stat read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return Stat(
|
||||||
|
view: fields[0] as int?,
|
||||||
|
like: fields[1] as int?,
|
||||||
|
danmaku: fields[2] as int?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, Stat obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.view)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.like)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.danmaku);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is StatAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RcmdReasonAdapter extends TypeAdapter<RcmdReason> {
|
||||||
|
@override
|
||||||
|
final int typeId = 2;
|
||||||
|
|
||||||
|
@override
|
||||||
|
RcmdReason read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return RcmdReason(
|
||||||
|
reasonType: fields[0] as int?,
|
||||||
|
content: fields[1] as String?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, RcmdReason obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(2)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.reasonType)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is RcmdReasonAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
@ -1,3 +1,8 @@
|
|||||||
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
|
part 'stat.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: 1)
|
||||||
class UserStat {
|
class UserStat {
|
||||||
UserStat({
|
UserStat({
|
||||||
this.following,
|
this.following,
|
||||||
@ -5,8 +10,11 @@ class UserStat {
|
|||||||
this.dynamicCount,
|
this.dynamicCount,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@HiveField(0)
|
||||||
int? following;
|
int? following;
|
||||||
|
@HiveField(1)
|
||||||
int? follower;
|
int? follower;
|
||||||
|
@HiveField(2)
|
||||||
int? dynamicCount;
|
int? dynamicCount;
|
||||||
|
|
||||||
UserStat.fromJson(Map<String, dynamic> json) {
|
UserStat.fromJson(Map<String, dynamic> json) {
|
||||||
|
47
lib/models/user/stat.g.dart
Normal file
47
lib/models/user/stat.g.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'stat.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class UserStatAdapter extends TypeAdapter<UserStat> {
|
||||||
|
@override
|
||||||
|
final int typeId = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
UserStat read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return UserStat(
|
||||||
|
following: fields[0] as int?,
|
||||||
|
follower: fields[1] as int?,
|
||||||
|
dynamicCount: fields[2] as int?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, UserStat obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.following)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.follower)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.dynamicCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is UserStatAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
@ -1,7 +1,9 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/video.dart';
|
import 'package:pilipala/http/video.dart';
|
||||||
import 'package:pilipala/models/model_rec_video_item.dart';
|
import 'package:pilipala/models/model_rec_video_item.dart';
|
||||||
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class HomeController extends GetxController {
|
class HomeController extends GetxController {
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
@ -12,11 +14,18 @@ class HomeController extends GetxController {
|
|||||||
bool isLoadingMore = false;
|
bool isLoadingMore = false;
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
OverlayEntry? popupDialog;
|
OverlayEntry? popupDialog;
|
||||||
|
Box recVideo = GStrorage.recVideo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
// queryRcmdFeed('init');
|
if(recVideo.get('cacheList') != null && recVideo.get('cacheList').isNotEmpty){
|
||||||
|
List<RecVideoItemModel> list = [];
|
||||||
|
for(var i in recVideo.get('cacheList')){
|
||||||
|
list.add(i);
|
||||||
|
}
|
||||||
|
videoList.value = list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取推荐
|
// 获取推荐
|
||||||
@ -33,6 +42,7 @@ class HomeController extends GetxController {
|
|||||||
} else if (type == 'onLoad') {
|
} else if (type == 'onLoad') {
|
||||||
videoList.addAll(res['data']);
|
videoList.addAll(res['data']);
|
||||||
}
|
}
|
||||||
|
recVideo.put('cacheList', res['data']);
|
||||||
_currentPage += 1;
|
_currentPage += 1;
|
||||||
}
|
}
|
||||||
isLoadingMore = false;
|
isLoadingMore = false;
|
||||||
|
@ -89,8 +89,15 @@ class _HomePageState extends State<HomePage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// 缓存数据
|
||||||
|
if(_homeController.videoList.isNotEmpty) {
|
||||||
|
return contentGrid(
|
||||||
|
_homeController, _homeController.videoList);
|
||||||
|
}
|
||||||
// 骨架屏
|
// 骨架屏
|
||||||
return contentGrid(_homeController, []);
|
else{
|
||||||
|
return contentGrid(_homeController, []);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -46,7 +46,13 @@ class HomeAppBar extends StatelessWidget {
|
|||||||
// ),
|
// ),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.bottomSheet(const MinePage());
|
Get.bottomSheet(
|
||||||
|
const SizedBox(
|
||||||
|
height: 450,
|
||||||
|
child: MinePage(),
|
||||||
|
),
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
isScrollControlled: true);
|
||||||
},
|
},
|
||||||
icon: const Icon(CupertinoIcons.person, size: 22),
|
icon: const Icon(CupertinoIcons.person, size: 22),
|
||||||
),
|
),
|
||||||
|
@ -6,6 +6,7 @@ import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|||||||
import 'package:pilipala/pages/home/view.dart';
|
import 'package:pilipala/pages/home/view.dart';
|
||||||
import 'package:pilipala/pages/hot/view.dart';
|
import 'package:pilipala/pages/hot/view.dart';
|
||||||
import 'package:pilipala/pages/media/index.dart';
|
import 'package:pilipala/pages/media/index.dart';
|
||||||
|
import 'package:pilipala/pages/mine/index.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class MainController extends GetxController {
|
class MainController extends GetxController {
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/models/user/fav_folder.dart';
|
import 'package:pilipala/models/user/fav_folder.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class MediaController extends GetxController {
|
class MediaController extends GetxController {
|
||||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||||
|
Box user = GStrorage.user;
|
||||||
|
RxBool userLogin = false.obs;
|
||||||
List list = [
|
List list = [
|
||||||
{
|
{
|
||||||
'icon': Icons.file_download_outlined,
|
'icon': Icons.file_download_outlined,
|
||||||
@ -29,7 +32,16 @@ class MediaController extends GetxController {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
userLogin.value = user.get(UserBoxKey.userLogin) ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
Future<dynamic> queryFavFolder() async {
|
Future<dynamic> queryFavFolder() async {
|
||||||
|
if (!userLogin.value) {
|
||||||
|
return {'status': false, 'data': [], 'msg': '未登录'};
|
||||||
|
}
|
||||||
var res = await await UserHttp.userfavFolder(
|
var res = await await UserHttp.userfavFolder(
|
||||||
pn: 1,
|
pn: 1,
|
||||||
ps: 5,
|
ps: 5,
|
||||||
|
@ -17,7 +17,7 @@ class _MediaPageState extends State<MediaPage>
|
|||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -65,7 +65,9 @@ class _MediaPageState extends State<MediaPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
favFolder()
|
Obx(() => _mediaController.userLogin.value == true
|
||||||
|
? favFolder()
|
||||||
|
: const SizedBox())
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -64,7 +64,6 @@ class _MinePageState extends State<MinePage> {
|
|||||||
future: _mineController.queryUserInfo(),
|
future: _mineController.queryUserInfo(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
print(snapshot.data);
|
|
||||||
if (snapshot.data['status']) {
|
if (snapshot.data['status']) {
|
||||||
return Obx(() => userInfoBuild());
|
return Obx(() => userInfoBuild());
|
||||||
} else {
|
} else {
|
||||||
@ -75,7 +74,6 @@ class _MinePageState extends State<MinePage> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,14 +1,27 @@
|
|||||||
import 'package:hive/hive.dart';
|
// import 'package:hive/hive.dart';
|
||||||
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:pilipala/models/model_owner.dart';
|
||||||
|
import 'package:pilipala/models/model_rec_video_item.dart';
|
||||||
|
|
||||||
class GStrorage {
|
class GStrorage {
|
||||||
static late final Box user;
|
static late final Box user;
|
||||||
|
static late final Box recVideo;
|
||||||
|
|
||||||
static Future<void> init() async {
|
static Future<void> init() async {
|
||||||
final dir = await getApplicationDocumentsDirectory();
|
final dir = await getApplicationDocumentsDirectory();
|
||||||
final path = dir.path;
|
final path = dir.path;
|
||||||
Hive.init('$path/hive');
|
await Hive.initFlutter('$path/hive');
|
||||||
|
// 首页推荐视频
|
||||||
|
Hive.registerAdapter(RecVideoItemModelAdapter());
|
||||||
|
Hive.registerAdapter(RcmdReasonAdapter());
|
||||||
|
Hive.registerAdapter(StatAdapter());
|
||||||
|
Hive.registerAdapter(OwnerAdapter());
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
user = await Hive.openBox('user');
|
user = await Hive.openBox('user');
|
||||||
|
// 首页推荐视频
|
||||||
|
recVideo = await Hive.openBox('recVideo');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
180
pubspec.lock
180
pubspec.lock
@ -45,10 +45,66 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build
|
name: build
|
||||||
sha256: "43865b79fbb78532e4bff7c33087aa43b1d488c4fdef014eaef568af6d8016dc"
|
sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.0"
|
version: "2.3.1"
|
||||||
|
build_config:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: build_config
|
||||||
|
sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.1"
|
||||||
|
build_daemon:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: build_daemon
|
||||||
|
sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.1"
|
||||||
|
build_resolvers:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: build_resolvers
|
||||||
|
sha256: db49b8609ef8c81cca2b310618c3017c00f03a92af44c04d310b907b2d692d95
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.0"
|
||||||
|
build_runner:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: build_runner
|
||||||
|
sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.3"
|
||||||
|
build_runner_core:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: build_runner_core
|
||||||
|
sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "7.2.7"
|
||||||
|
built_collection:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: built_collection
|
||||||
|
sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.1.1"
|
||||||
|
built_value:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: built_value
|
||||||
|
sha256: "2f17434bd5d52a26762043d6b43bb53b3acd029b4d9071a329f46d67ef297e6d"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "8.5.0"
|
||||||
cached_network_image:
|
cached_network_image:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -81,6 +137,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.1"
|
version: "1.2.1"
|
||||||
|
checked_yaml:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: checked_yaml
|
||||||
|
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.3"
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -89,6 +153,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
version: "1.1.1"
|
||||||
|
code_builder:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: code_builder
|
||||||
|
sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.4.0"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -265,6 +337,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.4"
|
version: "6.1.4"
|
||||||
|
fixnum:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: fixnum
|
||||||
|
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.0"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -320,6 +400,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "10.4.0"
|
version: "10.4.0"
|
||||||
|
frontend_server_client:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: frontend_server_client
|
||||||
|
sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.0"
|
||||||
get:
|
get:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -336,6 +424,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.1"
|
||||||
|
graphs:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: graphs
|
||||||
|
sha256: "772db3d53d23361d4ffcf5a9bb091cf3ee9b22f2be52cd107cd7a2683a89ba0e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.0"
|
||||||
hive:
|
hive:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -384,6 +480,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.3"
|
||||||
|
http_multi_server:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: http_multi_server
|
||||||
|
sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.1"
|
||||||
http_parser:
|
http_parser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -400,6 +504,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.1"
|
version: "1.7.1"
|
||||||
|
io:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: io
|
||||||
|
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -408,6 +520,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.5"
|
version: "0.6.5"
|
||||||
|
json_annotation:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: json_annotation
|
||||||
|
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.8.1"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -608,6 +728,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.4"
|
||||||
|
pool:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pool
|
||||||
|
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.5.1"
|
||||||
process:
|
process:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -624,6 +752,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.4"
|
||||||
|
pubspec_parse:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pubspec_parse
|
||||||
|
sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.3"
|
||||||
rxdart:
|
rxdart:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -648,6 +784,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.1"
|
version: "3.2.1"
|
||||||
|
shelf:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shelf
|
||||||
|
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.4.1"
|
||||||
|
shelf_web_socket:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shelf_web_socket
|
||||||
|
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -709,6 +861,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.1"
|
||||||
|
stream_transform:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: stream_transform
|
||||||
|
sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.0"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -741,6 +901,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.16"
|
version: "0.4.16"
|
||||||
|
timing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: timing
|
||||||
|
sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.1"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -845,6 +1013,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.0.2"
|
||||||
|
web_socket_channel:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: web_socket_channel
|
||||||
|
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.4.0"
|
||||||
webview_cookie_manager:
|
webview_cookie_manager:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -87,6 +87,7 @@ dev_dependencies:
|
|||||||
# url: https://github.com/nvi9/flutter_launcher_icons.git
|
# url: https://github.com/nvi9/flutter_launcher_icons.git
|
||||||
# ref: e045d40
|
# ref: e045d40
|
||||||
hive_generator: ^2.0.0
|
hive_generator: ^2.0.0
|
||||||
|
build_runner: ^2.3.3
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: true
|
android: true
|
||||||
|
Reference in New Issue
Block a user