Skip to content

Commit 278782a

Browse files
Optimize responsive layout effects;Update version to 1.11.0
1 parent af672e9 commit 278782a

21 files changed

+215
-127
lines changed

lib/Models/user_response.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class BlogInfoWithHot {
228228
imageDigitStamp: json['imageDigitStamp'],
229229
imageProtected: json['imageProtected'],
230230
imageStamp: json['imageStamp'],
231-
ipLocation: json['ipLocation'],
231+
ipLocation: json['ipLocation'] ?? "",
232232
isOriginalAuthor: json['isOriginalAuthor'],
233233
keyTag: json['keyTag'] ?? "",
234234
novisible: json['novisible'],

lib/Screens/Info/collection_screen.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
55
import 'package:loftify/Api/user_api.dart';
66
import 'package:loftify/Resources/theme.dart';
77
import 'package:loftify/Utils/hive_util.dart';
8+
import 'package:waterfall_flow/waterfall_flow.dart';
89

910
import '../../Models/post_detail_response.dart';
1011
import '../../Utils/enums.dart';
@@ -146,12 +147,13 @@ class _CollectionScreenState extends State<CollectionScreen>
146147
return ItemBuilder.buildLoadMoreNotification(
147148
noMore: _noMore,
148149
onLoad: _onLoad,
149-
child: ListView.builder(
150+
child: WaterfallFlow.extent(
151+
maxCrossAxisExtent: 560,
150152
physics: physics,
151153
padding: const EdgeInsets.only(bottom: 20),
152-
itemCount: _collectionList.length,
153-
itemBuilder: (context, index) {
154-
return _buildCollectionRow(
154+
children: List.generate(
155+
_collectionList.length,
156+
(index) => _buildCollectionRow(
155157
_collectionList[index],
156158
verticalPadding: 8,
157159
onTap: () {
@@ -165,8 +167,8 @@ class _CollectionScreenState extends State<CollectionScreen>
165167
),
166168
);
167169
},
168-
);
169-
},
170+
),
171+
),
170172
),
171173
);
172174
}

lib/Screens/Info/grain_screen.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:loftify/Models/recommend_response.dart';
77
import 'package:loftify/Resources/theme.dart';
88
import 'package:loftify/Screens/Post/grain_detail_screen.dart';
99
import 'package:loftify/Utils/hive_util.dart';
10+
import 'package:waterfall_flow/waterfall_flow.dart';
1011

1112
import '../../Utils/enums.dart';
1213
import '../../Utils/itoast.dart';
@@ -140,12 +141,13 @@ class _GrainScreenState extends State<GrainScreen>
140141
return ItemBuilder.buildLoadMoreNotification(
141142
noMore: _noMore,
142143
onLoad: _onLoad,
143-
child: ListView.builder(
144+
child: WaterfallFlow.extent(
145+
maxCrossAxisExtent: 560,
144146
physics: physics,
145147
padding: EdgeInsets.zero,
146-
itemCount: _grainList.length,
147-
itemBuilder: (context, index) {
148-
return _buildGrainRow(
148+
children: List.generate(
149+
_grainList.length,
150+
(index) => _buildGrainRow(
149151
_grainList[index],
150152
verticalPadding: 8,
151153
onTap: () {
@@ -157,8 +159,8 @@ class _GrainScreenState extends State<GrainScreen>
157159
),
158160
);
159161
},
160-
);
161-
},
162+
),
163+
),
162164
),
163165
);
164166
}

lib/Screens/Info/user_detail_screen.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import 'package:loftify/Screens/Info/supporter_screen.dart';
1414
import 'package:loftify/Screens/Post/post_detail_screen.dart';
1515
import 'package:loftify/Utils/enums.dart';
1616
import 'package:loftify/Utils/hive_util.dart';
17+
import 'package:loftify/Utils/iprint.dart';
1718
import 'package:loftify/Utils/uri_util.dart';
1819
import 'package:loftify/Widgets/BottomSheet/input_bottom_sheet.dart';
1920
import 'package:loftify/Widgets/Custom/subordinate_scroll_controller.dart';
@@ -85,7 +86,9 @@ class UserDetailScreenState extends State<UserDetailScreen>
8586
_fetchShowCases();
8687
setState(() {});
8788
}
88-
} catch (e) {
89+
} catch (e, t) {
90+
IPrint.debug(e);
91+
IPrint.debug(t);
8992
if (mounted) IToast.showTop("加载失败");
9093
}
9194
if (mounted) setState(() {});
@@ -487,7 +490,7 @@ class UserDetailScreenState extends State<UserDetailScreen>
487490
fit: FlexFit.loose,
488491
child: Text(
489492
textAlign: TextAlign.center,
490-
'性别: ${_fullBlogData!.blogInfo.gendar == 1 ? "男" : _fullBlogData!.blogInfo.gendar == 2 ? "女" : "保密"} | IP属地: ${_fullBlogData!.blogInfo.ipLocation}',
493+
'性别: ${_fullBlogData!.blogInfo.gendar == 1 ? "男" : _fullBlogData!.blogInfo.gendar == 2 ? "女" : "保密"}${Utils.isNotEmpty(_fullBlogData!.blogInfo.ipLocation) ? " | IP属地: ${_fullBlogData!.blogInfo.ipLocation}" : ""}',
491494
style: Theme.of(context)
492495
.textTheme
493496
.labelMedium

lib/Screens/Navigation/dynamic_screen.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ class SubscribeGrainTabState extends State<SubscribeGrainTab>
13811381
);
13821382
},
13831383
child: Container(
1384-
height: 96,
1384+
height: 125,
13851385
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
13861386
color: Colors.transparent,
13871387
child: Row(
@@ -1399,8 +1399,8 @@ class SubscribeGrainTabState extends State<SubscribeGrainTab>
13991399
child: ItemBuilder.buildCachedImage(
14001400
imageUrl: item.grain.coverUrl,
14011401
context: context,
1402-
width: 80,
1403-
height: 80,
1402+
width: 100,
1403+
height: 100,
14041404
fit: BoxFit.cover,
14051405
showLoading: false,
14061406
),
@@ -1421,13 +1421,16 @@ class SubscribeGrainTabState extends State<SubscribeGrainTab>
14211421
?.apply(fontWeightDelta: 2),
14221422
),
14231423
const SizedBox(height: 6),
1424-
Text(
1425-
Utils.isNotEmpty(item.latestPost.title)
1426-
? item.latestPost.title
1427-
: item.latestPost.digest,
1428-
style: Theme.of(context).textTheme.labelMedium,
1424+
Flexible(
1425+
child: Text(
1426+
Utils.isNotEmpty(item.latestPost.title)
1427+
? item.latestPost.title
1428+
: item.latestPost.digest,
1429+
style: Theme.of(context).textTheme.labelMedium,
1430+
overflow: TextOverflow.ellipsis,
1431+
maxLines: 2,
1432+
),
14291433
),
1430-
const Spacer(),
14311434
],
14321435
),
14331436
),

lib/Screens/Navigation/webview_screen.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class _WebviewScreenState extends State<WebviewScreen>
103103
: const Color(0xFFF5F5F5),
104104
appBar: showAppBar
105105
? ItemBuilder.buildAppBar(
106+
forceShowClose: true,
106107
context: context,
107108
leading: Icons.close_rounded,
108109
backgroundColor: MyTheme.getBackground(context),

lib/Screens/Post/post_detail_screen.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:async';
12
import 'dart:io';
23
import 'dart:math';
34

@@ -33,7 +34,6 @@ import '../../Resources/theme.dart';
3334
import '../../Utils/app_provider.dart';
3435
import '../../Utils/asset_util.dart';
3536
import '../../Utils/constant.dart';
36-
import '../../Utils/iprint.dart';
3737
import '../../Utils/lottie_util.dart';
3838
import '../../Utils/responsive_util.dart';
3939
import '../../Utils/route_util.dart';
@@ -686,7 +686,10 @@ class _PostDetailScreenState extends State<PostDetailScreen>
686686
.then((value) {
687687
setState(() {
688688
if (value['meta']['status'] != 200) {
689-
IToast.showTop(value['meta']['desc'] ?? value['meta']['msg']);
689+
if (Utils.isNotEmpty(value['meta']['desc']) &&
690+
Utils.isNotEmpty(value['meta']['msg'])) {
691+
IToast.showTop(value['meta']['desc'] ?? value['meta']['msg']);
692+
}
690693
if (value['meta']['status'] == 4071) {
691694
Utils.validSlideCaptcha(context);
692695
}
@@ -721,7 +724,10 @@ class _PostDetailScreenState extends State<PostDetailScreen>
721724
.then((value) {
722725
setState(() {
723726
if (value['meta']['status'] != 200) {
724-
IToast.showTop(value['meta']['desc'] ?? value['meta']['msg']);
727+
if (Utils.isNotEmpty(value['meta']['desc']) &&
728+
Utils.isNotEmpty(value['meta']['msg'])) {
729+
IToast.showTop(value['meta']['desc'] ?? value['meta']['msg']);
730+
}
725731
if (value['meta']['status'] == 4071) {
726732
Utils.validSlideCaptcha(context);
727733
}

lib/Screens/Setting/about_setting_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class _AboutSettingScreenState extends State<AboutSettingScreen>
9696
@override
9797
Widget build(BuildContext context) {
9898
return Scaffold(
99-
appBar: ResponsiveUtil.isDesktop()
99+
appBar: ResponsiveUtil.isLandscape()
100100
? null
101101
: ItemBuilder.buildSimpleAppBar(
102102
transparent: true,

lib/Screens/Setting/apperance_setting_screen.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:loftify/Resources/fonts.dart';
33
import 'package:loftify/Screens/Setting/select_theme_screen.dart';
44
import 'package:loftify/Utils/app_provider.dart';
55
import 'package:loftify/Utils/hive_util.dart';
6+
import 'package:loftify/Utils/responsive_util.dart';
67
import 'package:provider/provider.dart';
78

89
import '../../Utils/enums.dart';
@@ -25,6 +26,8 @@ class AppearanceSettingScreen extends StatefulWidget {
2526

2627
class _AppearanceSettingScreenState extends State<AppearanceSettingScreen>
2728
with TickerProviderStateMixin {
29+
bool _enableLandscapeInTablet =
30+
HiveUtil.getBool(HiveUtil.enableLandscapeInTabletKey, defaultValue: true);
2831
bool _showRecommendVideo =
2932
HiveUtil.getBool(HiveUtil.showRecommendVideoKey, defaultValue: false);
3033
bool _showRecommendArticle =
@@ -128,6 +131,23 @@ class _AppearanceSettingScreenState extends State<AppearanceSettingScreen>
128131
);
129132
},
130133
),
134+
if (ResponsiveUtil.isTablet()) const SizedBox(height: 10),
135+
if (ResponsiveUtil.isTablet())
136+
ItemBuilder.buildRadioItem(
137+
value: _enableLandscapeInTablet,
138+
context: context,
139+
title: "横屏时启用桌面端布局",
140+
description: "更改后需要重启",
141+
topRadius: true,
142+
bottomRadius: true,
143+
onTap: () {
144+
setState(() {
145+
_enableLandscapeInTablet = !_enableLandscapeInTablet;
146+
appProvider.enableLandscapeInTablet =
147+
_enableLandscapeInTablet;
148+
});
149+
},
150+
),
131151
const SizedBox(height: 10),
132152
ItemBuilder.buildCaptionItem(context: context, title: "首页"),
133153
ItemBuilder.buildRadioItem(

lib/Screens/Setting/blacklist_setting_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class _BlacklistSettingScreenState extends State<BlacklistSettingScreen>
118118
border: Border(
119119
bottom: BorderSide(
120120
color: Theme.of(context).dividerColor,
121-
width: 1,
121+
width: 0.5,
122122
),
123123
),
124124
),

0 commit comments

Comments
 (0)