add game origin url

This commit is contained in:
niuhuan 2021-11-15 16:26:53 +08:00
parent 15435bc602
commit 62c1a38216
8 changed files with 31 additions and 27 deletions

View File

@ -12,6 +12,7 @@ import (
"strings" "strings"
) )
// 根据不通系统初始化数据的保存路径
func init() { func init() {
applicationDir, err := os.UserHomeDir() applicationDir, err := os.UserHomeDir()
if err != nil { if err != nil {

View File

@ -574,7 +574,10 @@ class Method {
Future<List<String>> downloadGame(String url) async { Future<List<String>> downloadGame(String url) async {
if (url.startsWith("https://game.eroge.xyz/hhh.php")) { if (url.startsWith("https://game.eroge.xyz/hhh.php")) {
var data = await _flatInvoke("downloadGame", url); var data = await _flatInvoke("downloadGame", url);
return List.of(jsonDecode(data)).map((e) => e.toString()).toList(); return [
url,
...List.of(jsonDecode(data)).map((e) => e.toString()),
];
} }
return [url]; return [url];
} }
@ -675,5 +678,4 @@ class Method {
Future<String> httpGet(String url) async { Future<String> httpGet(String url) async {
return await _flatInvoke("httpGet", url); return await _flatInvoke("httpGet", url);
} }
} }

View File

@ -1,33 +1,19 @@
import 'dart:async'; ///
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
//
// (await Navigator.push pushReplacement时结束阻塞)
final RouteObserver<ModalRoute<void>> routeObserver = final RouteObserver<ModalRoute<void>> routeObserver =
RouteObserver<ModalRoute<void>>(); RouteObserver<ModalRoute<void>>();
Future<dynamic> navPushOrReplace( //
BuildContext context, WidgetBuilder builder) async {
if (_depth < _depthMax) {
return Navigator.push(
context,
MaterialPageRoute(builder: builder),
);
} else {
return Navigator.pushReplacement(
context,
MaterialPageRoute(builder: builder),
);
}
}
var navigatorObserver = _NavigatorObserver();
const _depthMax = 15; const _depthMax = 15;
var _depth = 0; var _depth = 0;
int currentDepth() { var navigatorObserver = _NavigatorObserver();
return _depth;
}
class _NavigatorObserver extends NavigatorObserver { class _NavigatorObserver extends NavigatorObserver {
@override @override
@ -44,3 +30,19 @@ class _NavigatorObserver extends NavigatorObserver {
super.didPush(route, previousRoute); super.didPush(route, previousRoute);
} }
} }
// 使 pushReplacement
Future<dynamic> navPushOrReplace(
BuildContext context, WidgetBuilder builder) async {
if (_depth < _depthMax) {
return Navigator.push(
context,
MaterialPageRoute(builder: builder),
);
} else {
return Navigator.pushReplacement(
context,
MaterialPageRoute(builder: builder),
);
}
}

View File

@ -1,4 +1,4 @@
// , /// ,
import 'dart:io'; import 'dart:io';

View File

@ -1,7 +1,8 @@
///
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pikapika/basic/Method.dart'; import 'package:pikapika/basic/Method.dart';
const _autoCleanMap = { const _autoCleanMap = {
"一个月前": "${3600 * 24 * 30}", "一个月前": "${3600 * 24 * 30}",
"一周前": "${3600 * 24 * 7}", "一周前": "${3600 * 24 * 7}",
@ -52,7 +53,6 @@ Future<void> _chooseAutoCleanSec(BuildContext context) async {
} }
} }
Widget autoCleanSecSetting() { Widget autoCleanSecSetting() {
return StatefulBuilder( return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) { builder: (BuildContext context, void Function(void Function()) setState) {

View File

@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pikapika/basic/Entities.dart'; import 'package:pikapika/basic/Entities.dart';
import 'package:pikapika/basic/Method.dart';
import '../FilePhotoViewScreen.dart';
import 'Images.dart'; import 'Images.dart';
const double _avatarMargin = 5; const double _avatarMargin = 5;

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// ,
class Badged extends StatelessWidget { class Badged extends StatelessWidget {
final String? badge; final String? badge;
final Widget child; final Widget child;