Skip to content

Commit

Permalink
完善TV使用流程
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyaocz committed Mar 8, 2024
1 parent 15ce795 commit dc83117
Show file tree
Hide file tree
Showing 20 changed files with 371 additions and 182 deletions.
7 changes: 7 additions & 0 deletions assets/tv_app_version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": "1.0.1",
"version_num": 10001,
"version_desc": "- 修复虎牙播放中断问题 #317",
"prerelease":false,
"download_url": "https://github.com/xiaoyaocz/dart_simple_live/releases"
}
2 changes: 1 addition & 1 deletion simple_live_app/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: simple_live_app
version: 1.4.9+10409
version: 1.5.0+10500
publish_to: none
description: "Simple Live APP"
environment:
Expand Down
14 changes: 0 additions & 14 deletions simple_live_tv_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,3 @@

Simple Live Android TV APP



# 首页

- 我的关注
- 观看记录
- 二维码
- 手机同步数据
- 设置
- 哔哩哔哩登录


# 播放
- 暂停
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
<item>
<shape android:shape="rectangle">
<gradient
android:type="linear"
android:startColor="#141e30"
android:centerColor="#243b55"
android:endColor="#141e30"
android:angle="135" />
</shape>
</item>
</layer-list>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />

<item>
<shape android:shape="rectangle">
<gradient
android:type="linear"
android:startColor="#141e30"
android:centerColor="#243b55"
android:endColor="#141e30"
android:angle="135" />
</shape>
</item>
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
Expand Down
3 changes: 3 additions & 0 deletions simple_live_tv_app/lib/app/app_style.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
Expand Down Expand Up @@ -25,6 +27,7 @@ class AppStyle {
checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.all(AppColors.lightColorScheme.primary),
),
fontFamily: Platform.isWindows ? 'Microsoft YaHei' : null,
);

static SizedBox get vGap4 => SizedBox(
Expand Down
43 changes: 43 additions & 0 deletions simple_live_tv_app/lib/app/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:simple_live_tv_app/app/app_style.dart';
import 'package:simple_live_tv_app/app/log.dart';
import 'package:simple_live_tv_app/requests/common_request.dart';

class Utils {
static late PackageInfo packageInfo;
Expand Down Expand Up @@ -215,4 +217,45 @@ class Utils {
static void hideRightDialog() {
SmartDialog.dismiss(status: SmartStatus.allCustom);
}

static void checkUpdate({bool showMsg = false}) async {
try {
int currentVer = Utils.parseVersion(packageInfo.version);
CommonRequest request = CommonRequest();
var versionInfo = await request.checkUpdate();
if (versionInfo.versionNum > currentVer) {
await showAlertDialog(
"${versionInfo.versionDesc}\n\n请前往项目主页手动下载新版本",
title: "发现新版本 ${versionInfo.version}",
confirm: "知道了",
cancel: "关闭",
);
} else {
if (showMsg) {
SmartDialog.showToast("当前已经是最新版本了");
}
}
} catch (e) {
Log.logPrint(e);
if (showMsg) {
SmartDialog.showToast("检查更新失败");
}
}
}

static int parseVersion(String version) {
var sp = version.split('.');
var num = "";
for (var item in sp) {
num = num + item.padLeft(2, '0');
}
return int.parse(num);
}

static String onlineToString(int num) {
if (num >= 10000) {
return "${(num / 10000.0).toStringAsFixed(1)}万";
}
return num.toString();
}
}
4 changes: 3 additions & 1 deletion simple_live_tv_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ class MyApp extends StatelessWidget {
return GetMaterialApp(
title: 'Simple Live TV',
theme: AppStyle.lightTheme,
initialRoute: RoutePath.kHome,
initialRoute: AppSettingsController.instance.firstRun
? RoutePath.kAgreement
: RoutePath.kHome,
getPages: AppPages.routes,
debugShowCheckedModeBanner: false,
builder: FlutterSmartDialog.init(
Expand Down
92 changes: 92 additions & 0 deletions simple_live_tv_app/lib/modules/agreement/agreement_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:simple_live_tv_app/app/app_focus_node.dart';
import 'package:simple_live_tv_app/app/app_style.dart';
import 'package:simple_live_tv_app/app/controller/app_settings_controller.dart';
import 'package:simple_live_tv_app/routes/route_path.dart';
import 'package:simple_live_tv_app/widgets/app_scaffold.dart';
import 'package:simple_live_tv_app/widgets/button/highlight_button.dart';

class AgreementPage extends StatelessWidget {
const AgreementPage({super.key});

@override
Widget build(BuildContext context) {
return AppScaffold(
child: Center(
child: SizedBox(
width: 1000.w,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
"使用须知",
textAlign: TextAlign.center,
style: AppStyle.titleStyleWhite,
),
AppStyle.vGap24,
Text(
"欢迎使用Simple Live TV,请在使用前仔细阅读以下内容:",
style: AppStyle.textStyleWhite,
),
AppStyle.vGap12,
Text(
"1. 本软件为开源软件,仅供学习交流使用,禁止用于任何商业用途。",
style: AppStyle.textStyleWhite,
),
AppStyle.vGap12,
Text(
"2. 本软件不提供任何直播内容,所有直播内容均来自网络。",
style: AppStyle.textStyleWhite,
),
AppStyle.vGap12,
Text(
"3. 本软件完全基于您个人意愿使用,您应该对自己的使用行为和所有结果承担全部责任。",
style: AppStyle.textStyleWhite,
),
AppStyle.vGap12,
Text(
"4. 如果本软件存在侵犯您的合法权益的情况,请及时与作者联系,作者将会及时删除有关内容。",
style: AppStyle.textStyleWhite,
),
AppStyle.vGap12,
Text(
"如您继续使用本软件即代表您已完全理解并同意上述内容。",
style: AppStyle.textStyleWhite,
),
AppStyle.vGap32,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
HighlightButton(
text: "已阅读并同意",
autofocus: true,
focusNode: AppFocusNode(),
onTap: () {
AppSettingsController.instance.setNoFirstRun();
Get.offAllNamed(RoutePath.kHome);
},
),
AppStyle.hGap32,
HighlightButton(
text: "退出应用",
focusNode: AppFocusNode(),
onTap: () {
//退出软件
exit(0);
},
),
],
)
],
),
),
),
);
}
}
4 changes: 2 additions & 2 deletions simple_live_tv_app/lib/modules/category/category_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class CategoryPage extends GetView<CategoryController> {
padding: AppStyle.edgeInsetsV8,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 8,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
crossAxisSpacing: 36.w,
mainAxisSpacing: 36.w,
children: item.showAll.value
? (item.childrenExt
.map(
Expand Down
3 changes: 2 additions & 1 deletion simple_live_tv_app/lib/modules/home/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:async';
import 'package:get/get.dart';

import 'package:simple_live_tv_app/app/controller/base_controller.dart';
import 'package:simple_live_tv_app/app/utils.dart';

import 'package:simple_live_tv_app/routes/route_path.dart';

Expand All @@ -12,7 +13,7 @@ class HomeController extends BaseController {
@override
void onInit() {
initTimer();

Utils.checkUpdate();
super.onInit();
}

Expand Down
56 changes: 29 additions & 27 deletions simple_live_tv_app/lib/modules/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ class HomePage extends GetView<HomeController> {
shape: RoundedRectangleBorder(
borderRadius: AppStyle.radius16,
),
contentPadding:
AppStyle.edgeInsetsA48.copyWith(left: 64.w, right: 64.w),
contentPadding: AppStyle.edgeInsetsA48,
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Expand Down Expand Up @@ -336,32 +335,35 @@ class HomePage extends GetView<HomeController> {
],
),
AppStyle.vGap48,
TextField(
controller: textController,
style: AppStyle.textStyleWhite,
textInputAction: TextInputAction.search,
onSubmitted: (e) {
Get.back();
if (e.isEmpty) {
return;
}
if (mode.value == 0) {
controller.toSearchRoom(textController.text);
} else {
controller.toSearchAnchor(textController.text);
}
},
decoration: InputDecoration(
hintText: mode.value == 0 ? "请输入关键字" : "请输入主播昵称",
hintStyle: AppStyle.textStyleWhite,
border: OutlineInputBorder(
borderRadius: AppStyle.radius16,
borderSide: BorderSide(width: 4.w),
SizedBox(
width: 700.w,
child: TextField(
controller: textController,
style: AppStyle.textStyleWhite,
textInputAction: TextInputAction.search,
onSubmitted: (e) {
Get.back();
if (e.isEmpty) {
return;
}
if (mode.value == 0) {
controller.toSearchRoom(textController.text);
} else {
controller.toSearchAnchor(textController.text);
}
},
decoration: InputDecoration(
hintText: mode.value == 0 ? "点击输入关键字搜索" : "点击主播昵称搜索",
hintStyle: AppStyle.textStyleWhite,
border: OutlineInputBorder(
borderRadius: AppStyle.radius16,
borderSide: BorderSide(width: 4.w),
),
filled: true,
isDense: true,
fillColor: Get.theme.primaryColor,
contentPadding: AppStyle.edgeInsetsA32,
),
filled: true,
isDense: true,
fillColor: Get.theme.primaryColor,
contentPadding: AppStyle.edgeInsetsA48,
),
),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:simple_live_tv_app/app/app_focus_node.dart';
import 'package:simple_live_tv_app/app/controller/base_controller.dart';
Expand Down Expand Up @@ -56,4 +57,9 @@ class SettingsController extends BaseController
AppNavigator.toBiliBiliLogin();
}
}

void checkUpdate() {
SmartDialog.showToast("检查更新中...");
Utils.checkUpdate(showMsg: true);
}
}
2 changes: 1 addition & 1 deletion simple_live_tv_app/lib/modules/settings/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class SettingsPage extends GetView<SettingsController> {
focusNode: controller.versionFocusNode,
title: "版本",
subtitle: "v${Utils.packageInfo.version}",
onTap: () {},
onTap: controller.checkUpdate,
),
],
);
Expand Down
Loading

0 comments on commit dc83117

Please sign in to comment.