Skip to content

Commit

Permalink
Fix the bug of abnormal version update;Update version to 1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Stackflow committed Jul 23, 2024
1 parent f7f1595 commit 9fc5118
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 405 deletions.
136 changes: 69 additions & 67 deletions lib/Screens/Info/favorite_folder_list_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,87 +106,89 @@ class _FavoriteFolderListScreenState extends State<FavoriteFolderListScreen>
cacheExtent: 9999,
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 16),
children: List.generate(_favoriteFolderList.length, (index) {
return GestureDetector(
onTap: () {
RouteUtil.pushCupertinoRoute(
context,
FavoriteFolderDetailScreen(
favoriteFolderId: _favoriteFolderList[index].id ?? 0),
);
},
child: _buildFolderItem(
context,
_favoriteFolderList[index],
),
return _buildFolderItem(
context,
_favoriteFolderList[index],
);
}),
);
}

static Widget _buildFolderItem(BuildContext context, FavoriteFolder item) {
return Container(
color: Colors.transparent,
child: Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
border:
Border.all(color: Theme.of(context).dividerColor, width: 0.5),
borderRadius: BorderRadius.circular(10),
color: Colors.transparent,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: SizedBox(
height: 80,
width: 80,
child: ItemBuilder.buildCachedImage(
context: context,
fit: BoxFit.cover,
showLoading: false,
imageUrl: Utils.removeWatermark(item.coverUrl ?? ""),
return ItemBuilder.buildClickItem(
GestureDetector(
onTap: () {
RouteUtil.pushCupertinoRoute(
context,
FavoriteFolderDetailScreen(
favoriteFolderId: item.id ?? 0),
);
},
child: Container(
color: Colors.transparent,
child: Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context).dividerColor, width: 0.5),
borderRadius: BorderRadius.circular(10),
color: Colors.transparent,
),
),
),
),
Expanded(
child: Container(
padding: const EdgeInsets.only(left: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
ItemBuilder.buildCopyItem(
context,
child: Text(
item.name ?? "",
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: SizedBox(
height: 80,
width: 80,
child: ItemBuilder.buildCachedImage(
context: context,
fit: BoxFit.cover,
showLoading: false,
imageUrl: Utils.removeWatermark(item.coverUrl ?? ""),
),
copyText: item.name ?? "",
toastText: "已复制收藏夹名称",
),
const SizedBox(height: 10),
ItemBuilder.buildCopyItem(context,
child: Text(
"ID: ${item.id}",
),
),
Expanded(
child: Container(
padding: const EdgeInsets.only(left: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
ItemBuilder.buildCopyItem(
context,
child: Text(
item.name ?? "",
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
copyText: item.name ?? "",
toastText: "已复制收藏夹名称",
),
const SizedBox(height: 10),
ItemBuilder.buildCopyItem(context,
child: Text(
"ID: ${item.id}",
style: Theme.of(context).textTheme.titleSmall,
),
copyText: item.id.toString(),
toastText: "已复制收藏夹ID"),
const SizedBox(height: 10),
Text(
"${item.postCount}篇",
style: Theme.of(context).textTheme.titleSmall,
),
copyText: item.id.toString(),
toastText: "已复制收藏夹ID"),
const SizedBox(height: 10),
Text(
"${item.postCount}篇",
style: Theme.of(context).textTheme.titleSmall,
],
),
],
),
),
),
],
),
],
),
),
);
}
Expand Down
73 changes: 1 addition & 72 deletions lib/Screens/Info/history_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ import 'package:loftify/Models/history_response.dart';
import 'package:loftify/Resources/theme.dart';
import 'package:loftify/Utils/hive_util.dart';
import 'package:tuple/tuple.dart';
import 'package:waterfall_flow/waterfall_flow.dart';

import '../../Api/post_api.dart';
import '../../Models/post_detail_response.dart';
import '../../Utils/enums.dart';
import '../../Utils/itoast.dart';
import '../../Utils/utils.dart';
import '../../Widgets/BottomSheet/bottom_sheet_builder.dart';
Expand All @@ -37,7 +34,6 @@ class _HistoryScreenState extends State<HistoryScreen>
final List<ArchiveData> _archiveDataList = [];
int _total = 0;
int _recordHistory = 0;
HistoryLayoutMode _layoutMode = HistoryLayoutMode.nineGrid;
bool _loading = false;
final EasyRefreshController _refreshController = EasyRefreshController();
bool _noMore = false;
Expand Down Expand Up @@ -122,20 +118,11 @@ class _HistoryScreenState extends State<HistoryScreen>
onRefresh: _onRefresh,
onLoad: _onLoad,
triggerAxis: Axis.vertical,
child: _buildBody(),
child: _buildNineGridGroup(),
),
);
}

Widget _buildBody() {
switch (_layoutMode) {
case HistoryLayoutMode.waterFlow:
return _buildWaterflow();
case HistoryLayoutMode.nineGrid:
return _buildNineGridGroup();
}
}

Widget _buildNineGridGroup() {
List<Widget> widgets = [];
int startIndex = 0;
Expand Down Expand Up @@ -186,56 +173,7 @@ class _HistoryScreenState extends State<HistoryScreen>
);
}

Widget _buildWaterflow() {
return ItemBuilder.buildLoadMoreNotification(
noMore: _noMore,
onLoad: _onLoad,
child: WaterfallFlow.builder(
cacheExtent: 9999,
padding: const EdgeInsets.only(top: 10, left: 8, right: 8),
gridDelegate: const SliverWaterfallFlowDelegateWithMaxCrossAxisExtent(
mainAxisSpacing: 6,
crossAxisSpacing: 6,
maxCrossAxisExtent: 300,
),
itemBuilder: (BuildContext context, int index) {
return CommonInfoItemBuilder.buildWaterfallFlowPostItem(
context, _histories[index], onLikeTap: () async {
var item = _histories[index];
HapticFeedback.mediumImpact();
return await PostApi.likeOrUnLike(
isLike: !(item.liked == true),
postId: item.post!.id,
blogId: item.post!.blogId,
).then((value) {
setState(() {
if (value['meta']['status'] != 200) {
IToast.showTop(value['meta']['desc'] ?? value['meta']['msg']);
} else {
item.liked = !(item.liked == true);
item.post!.postCount?.favoriteCount +=
item.liked == true ? 1 : -1;
}
});
return value['meta']['status'];
});
});
},
itemCount: _histories.length,
),
);
}

PreferredSizeWidget _buildAppBar() {
IconData icon = Icons.transform_rounded;
switch (_layoutMode) {
case HistoryLayoutMode.waterFlow:
icon = Icons.layers_outlined;
break;
case HistoryLayoutMode.nineGrid:
icon = Icons.grid_3x3_rounded;
break;
}
return ItemBuilder.buildAppBar(
context: context,
leading: Icons.arrow_back_rounded,
Expand All @@ -245,15 +183,6 @@ class _HistoryScreenState extends State<HistoryScreen>
},
title: Text("我的足迹", style: Theme.of(context).textTheme.titleLarge),
actions: [
ItemBuilder.buildIconButton(
context: context,
icon: Icon(icon, color: Theme.of(context).iconTheme.color),
onTap: () {
_layoutMode = HistoryLayoutMode.values[
(_layoutMode.index + 1) % HistoryLayoutMode.values.length];
setState(() {});
}),
const SizedBox(width: 5),
ItemBuilder.buildIconButton(
context: context,
icon: Icon(Icons.more_vert_rounded,
Expand Down
77 changes: 1 addition & 76 deletions lib/Screens/Info/like_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import 'package:loftify/Models/history_response.dart';
import 'package:loftify/Resources/theme.dart';
import 'package:loftify/Utils/hive_util.dart';
import 'package:tuple/tuple.dart';
import 'package:waterfall_flow/waterfall_flow.dart';

import '../../Api/post_api.dart';
import '../../Models/post_detail_response.dart';
import '../../Utils/enums.dart';
import '../../Utils/itoast.dart';
Expand Down Expand Up @@ -51,7 +49,6 @@ class _LikeScreenState extends State<LikeScreen>
final List<PostDetailData> _likeList = [];
List<ArchiveData> _archiveDataList = [];
int _total = 0;
HistoryLayoutMode _layoutMode = HistoryLayoutMode.nineGrid;
bool _loading = false;
final EasyRefreshController _refreshController = EasyRefreshController();
bool _noMore = false;
Expand Down Expand Up @@ -161,21 +158,12 @@ class _LikeScreenState extends State<LikeScreen>
onLoad: _onLoad,
triggerAxis: Axis.vertical,
childBuilder: (context, physics) {
return _buildBody(physics);
return _buildNineGridGroup(physics);
},
),
);
}

Widget _buildBody(ScrollPhysics physics) {
switch (_layoutMode) {
case HistoryLayoutMode.waterFlow:
return _buildWaterflow(physics);
case HistoryLayoutMode.nineGrid:
return _buildNineGridGroup(physics);
}
}

Widget _buildNineGridGroup(ScrollPhysics physics) {
List<Widget> widgets = [];
int startIndex = 0;
Expand Down Expand Up @@ -225,61 +213,7 @@ class _LikeScreenState extends State<LikeScreen>
);
}

Widget _buildWaterflow(ScrollPhysics physics) {
return ItemBuilder.buildLoadMoreNotification(
noMore: _noMore,
onLoad: _onLoad,
child: WaterfallFlow.builder(
physics: physics,
cacheExtent: 9999,
padding: const EdgeInsets.only(top: 10, left: 8, right: 8),
gridDelegate: const SliverWaterfallFlowDelegateWithMaxCrossAxisExtent(
mainAxisSpacing: 6,
crossAxisSpacing: 6,
maxCrossAxisExtent: 300,
),
itemBuilder: (BuildContext context, int index) {
return CommonInfoItemBuilder.buildWaterfallFlowPostItem(
context, _likeList[index], onLikeTap: () async {
var item = _likeList[index];
HapticFeedback.mediumImpact();
return await PostApi.likeOrUnLike(
isLike: !(item.liked == true),
postId: item.post!.id,
blogId: item.post!.blogId)
.then((value) {
setState(() {
if (value['meta']['status'] != 200) {
if (Utils.isNotEmpty(
value['meta']['desc'] ?? value['meta']['msg'])) {
IToast.showTop(
value['meta']['desc'] ?? value['meta']['msg']);
}
} else {
item.liked = !(item.liked == true);
item.post!.postCount?.favoriteCount +=
item.liked == true ? 1 : -1;
}
});
return value['meta']['status'];
});
});
},
itemCount: _likeList.length,
),
);
}

PreferredSizeWidget _buildAppBar() {
IconData icon = Icons.transform_rounded;
switch (_layoutMode) {
case HistoryLayoutMode.waterFlow:
icon = Icons.layers_outlined;
break;
case HistoryLayoutMode.nineGrid:
icon = Icons.grid_3x3_rounded;
break;
}
return ItemBuilder.buildAppBar(
context: context,
leading: Icons.arrow_back_rounded,
Expand All @@ -289,15 +223,6 @@ class _LikeScreenState extends State<LikeScreen>
},
title: Text("我的喜欢", style: Theme.of(context).textTheme.titleLarge),
actions: [
ItemBuilder.buildIconButton(
context: context,
icon: Icon(icon, color: Theme.of(context).iconTheme.color),
onTap: () {
_layoutMode = HistoryLayoutMode.values[
(_layoutMode.index + 1) % HistoryLayoutMode.values.length];
setState(() {});
}),
const SizedBox(width: 5),
ItemBuilder.buildIconButton(
context: context,
icon: Icon(Icons.more_vert_rounded,
Expand Down
Loading

0 comments on commit 9fc5118

Please sign in to comment.