diff --git a/assets/images/error.svg b/assets/images/error.svg
new file mode 100644
index 00000000..ef27bea4
--- /dev/null
+++ b/assets/images/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lib/common/widgets/http_error.dart b/lib/common/widgets/http_error.dart
index 3295721d..b02182c6 100644
--- a/lib/common/widgets/http_error.dart
+++ b/lib/common/widgets/http_error.dart
@@ -1,31 +1,41 @@
import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
class HttpError extends StatelessWidget {
- const HttpError({required this.errMsg, required this.fn, super.key});
+ const HttpError(
+ {required this.errMsg, required this.fn, this.btnText, super.key});
final String? errMsg;
final Function()? fn;
+ final String? btnText;
@override
Widget build(BuildContext context) {
return SliverToBoxAdapter(
child: SizedBox(
- height: 150,
+ height: 400,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
+ SvgPicture.asset(
+ "assets/images/error.svg",
+ height: 200,
+ ),
+ const SizedBox(height: 20),
Text(
errMsg ?? '请求异常',
textAlign: TextAlign.center,
- style: Theme.of(context).textTheme.titleMedium,
+ style: Theme.of(context).textTheme.titleSmall,
),
- const SizedBox(height: 10),
- ElevatedButton(
- onPressed: () {
- fn!();
- },
- child: const Text('点击重试'))
+ const SizedBox(height: 30),
+ OutlinedButton.icon(
+ onPressed: () {
+ fn!();
+ },
+ icon: const Icon(Icons.arrow_forward_outlined, size: 20),
+ label: Text(btnText ?? '点击重试'),
+ )
],
),
),
diff --git a/lib/common/widgets/no_data.dart b/lib/common/widgets/no_data.dart
new file mode 100644
index 00000000..8b6a8214
--- /dev/null
+++ b/lib/common/widgets/no_data.dart
@@ -0,0 +1,31 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+
+class NoData extends StatelessWidget {
+ const NoData({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return SliverToBoxAdapter(
+ child: SizedBox(
+ height: 400,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ SvgPicture.asset(
+ "assets/images/error.svg",
+ height: 200,
+ ),
+ const SizedBox(height: 20),
+ Text(
+ '没有数据',
+ textAlign: TextAlign.center,
+ style: Theme.of(context).textTheme.titleSmall,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/common/widgets/video_card_h.dart b/lib/common/widgets/video_card_h.dart
index 4cfce1ef..ed7b299e 100644
--- a/lib/common/widgets/video_card_h.dart
+++ b/lib/common/widgets/video_card_h.dart
@@ -55,7 +55,7 @@ class VideoCardH extends StatelessWidget {
},
child: Padding(
padding: const EdgeInsets.fromLTRB(
- StyleString.safeSpace, 7, StyleString.safeSpace, 7),
+ StyleString.safeSpace, 5, StyleString.safeSpace, 5),
child: LayoutBuilder(
builder: (context, boxConstraints) {
double width =
diff --git a/lib/pages/dynamics/controller.dart b/lib/pages/dynamics/controller.dart
index 5bef4794..89cc1add 100644
--- a/lib/pages/dynamics/controller.dart
+++ b/lib/pages/dynamics/controller.dart
@@ -62,7 +62,7 @@ class DynamicsController extends GetxController {
Future queryFollowDynamic({type = 'init'}) async {
if (!userLogin.value) {
- return {'status': false, 'msg': '未登录'};
+ return {'status': false, 'msg': '账号未登录'};
}
if (type == 'init') {
dynamicsList.clear();
@@ -188,6 +188,9 @@ class DynamicsController extends GetxController {
}
Future queryFollowUp({type = 'init'}) async {
+ if (!userLogin.value) {
+ return {'status': false, 'msg': '账号未登录'};
+ }
if (type == 'init') {
upData = FollowUpModel().obs;
}
diff --git a/lib/pages/history/controller.dart b/lib/pages/history/controller.dart
index 7dc8e3a5..ae897499 100644
--- a/lib/pages/history/controller.dart
+++ b/lib/pages/history/controller.dart
@@ -9,9 +9,10 @@ import 'package:pilipala/utils/storage.dart';
class HistoryController extends GetxController {
final ScrollController scrollController = ScrollController();
RxList historyList = [HisListItem()].obs;
- bool isLoadingMore = false;
+ RxBool isLoadingMore = false.obs;
RxBool pauseStatus = false.obs;
Box localCache = GStrorage.localCache;
+ RxBool isLoading = false.obs;
@override
void onInit() {
@@ -26,9 +27,9 @@ class HistoryController extends GetxController {
max = historyList.last.history!.oid!;
viewAt = historyList.last.viewAt!;
}
- isLoadingMore = true;
+ isLoadingMore.value = true;
var res = await UserHttp.historyList(max, viewAt);
- isLoadingMore = false;
+ isLoadingMore.value = false;
if (res['status']) {
if (type == 'onload') {
historyList.addAll(res['data'].list);
diff --git a/lib/pages/history/view.dart b/lib/pages/history/view.dart
index 3de41366..b0e068da 100644
--- a/lib/pages/history/view.dart
+++ b/lib/pages/history/view.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/skeleton/video_card_h.dart';
import 'package:pilipala/common/widgets/http_error.dart';
+import 'package:pilipala/common/widgets/no_data.dart';
import 'package:pilipala/pages/history/index.dart';
import 'widgets/item.dart';
@@ -27,7 +28,7 @@ class _HistoryPageState extends State {
if (_historyController.scrollController.position.pixels >=
_historyController.scrollController.position.maxScrollExtent -
300) {
- if (!_historyController.isLoadingMore) {
+ if (!_historyController.isLoadingMore.value) {
_historyController.onLoad();
}
}
@@ -92,13 +93,9 @@ class _HistoryPageState extends State {
Map data = snapshot.data;
if (data['status']) {
return Obx(
- () => _historyController.historyList.isEmpty
- ? const SliverToBoxAdapter(
- child: Center(
- child: Text('没数据'),
- ),
- )
- : SliverList(
+ () => _historyController.historyList.isNotEmpty &&
+ !_historyController.isLoadingMore.value
+ ? SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
return HistoryItem(
@@ -108,7 +105,12 @@ class _HistoryPageState extends State {
},
childCount:
_historyController.historyList.length),
- ),
+ )
+ : _historyController.isLoadingMore.value
+ ? const SliverToBoxAdapter(
+ child: Center(child: Text('加载中')),
+ )
+ : const NoData(),
);
} else {
return HttpError(
diff --git a/lib/pages/history/widgets/item.dart b/lib/pages/history/widgets/item.dart
index b3dd7f0f..e9c039a5 100644
--- a/lib/pages/history/widgets/item.dart
+++ b/lib/pages/history/widgets/item.dart
@@ -116,7 +116,7 @@ class HistoryItem extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.fromLTRB(
- StyleString.cardSpace, 5, StyleString.cardSpace, 5),
+ StyleString.safeSpace, 5, StyleString.safeSpace, 5),
child: LayoutBuilder(
builder: (context, boxConstraints) {
double width =
diff --git a/lib/pages/later/view.dart b/lib/pages/later/view.dart
index fa524157..7c04f8dc 100644
--- a/lib/pages/later/view.dart
+++ b/lib/pages/later/view.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/skeleton/video_card_h.dart';
import 'package:pilipala/common/widgets/http_error.dart';
+import 'package:pilipala/common/widgets/no_data.dart';
import 'package:pilipala/common/widgets/video_card_h.dart';
import 'package:pilipala/pages/later/index.dart';
@@ -85,13 +86,11 @@ class _LaterPageState extends State {
);
}, childCount: _laterController.laterList.length),
)
- : SliverToBoxAdapter(
- child: Center(
- child: Text(_laterController.isLoading.value
- ? '加载中'
- : '没有数据'),
- ),
- ),
+ : _laterController.isLoading.value
+ ? const SliverToBoxAdapter(
+ child: Center(child: Text('加载中')),
+ )
+ : const NoData(),
);
} else {
return HttpError(
diff --git a/lib/pages/media/view.dart b/lib/pages/media/view.dart
index 13ab30bf..3657dbb5 100644
--- a/lib/pages/media/view.dart
+++ b/lib/pages/media/view.dart
@@ -161,11 +161,25 @@ class _MediaPageState extends State
right: 14, bottom: 35),
child: Center(
child: IconButton(
+ style: ButtonStyle(
+ padding: MaterialStateProperty.all(
+ EdgeInsets.zero),
+ backgroundColor:
+ MaterialStateProperty.resolveWith(
+ (states) {
+ return Theme.of(context)
+ .colorScheme
+ .primaryContainer
+ .withOpacity(0.5);
+ }),
+ ),
onPressed: () => Get.toNamed('/fav'),
icon: Icon(
Icons.arrow_forward_ios,
size: 18,
- color: Theme.of(context).primaryColor,
+ color: Theme.of(context)
+ .colorScheme
+ .primary,
),
),
));
diff --git a/pubspec.lock b/pubspec.lock
index 4ae5f387..d7731104 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -467,6 +467,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.9.3+2"
+ flutter_svg:
+ dependency: "direct main"
+ description:
+ name: flutter_svg
+ sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.7"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -813,6 +821,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.3"
+ path_parsing:
+ dependency: transitive
+ description:
+ name: path_parsing
+ sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.0.1"
path_provider:
dependency: "direct main"
description:
@@ -1274,6 +1290,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.7"
+ vector_graphics:
+ dependency: transitive
+ description:
+ name: vector_graphics
+ sha256: "670f6e07aca990b4a2bcdc08a784193c4ccdd1932620244c3a86bb72a0eac67f"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.7"
+ vector_graphics_codec:
+ dependency: transitive
+ description:
+ name: vector_graphics_codec
+ sha256: "7451721781d967db9933b63f5733b1c4533022c0ba373a01bdd79d1a5457f69f"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.7"
+ vector_graphics_compiler:
+ dependency: transitive
+ description:
+ name: vector_graphics_compiler
+ sha256: "80a13c613c8bde758b1464a1755a7b3a8f2b6cec61fbf0f5a53c94c30f03ba2e"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.7"
vector_math:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 6f5810ec..1ad77b54 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -112,6 +112,7 @@ dependencies:
# 获取appx信息
package_info_plus: ^4.1.0
url_launcher: ^6.1.12
+ flutter_svg: ^2.0.7
dev_dependencies:
flutter_test: